@aztec/aztec 1.0.0-staging.0 → 1.0.0-staging.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,6 +20,9 @@ export type L2ChainConfig = {
20
20
  autoUpdate: SharedNodeConfig['autoUpdate'];
21
21
  autoUpdateUrl?: string;
22
22
  maxTxPoolSize: number;
23
+ publicIncludeMetrics?: string[];
24
+ publicMetricsCollectorUrl?: string;
25
+ publicMetricsCollectFrom?: string[];
23
26
  };
24
27
  export declare const testnetIgnitionL2ChainConfig: L2ChainConfig;
25
28
  export declare const alphaTestnetL2ChainConfig: L2ChainConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/cli/chain_l2_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,eAAe,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C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,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAoB1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAuBvC,CAAC;AAEF,wBAAsB,YAAY,CAAC,WAAW,EAAE,YAAY,gBAW3D;AAED,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAWpG;AAmBD,wBAAsB,gCAAgC,CAAC,WAAW,EAAE,YAAY,iBA6C/E"}
@@ -1,5 +1,8 @@
1
1
  import { EthAddress } from '@aztec/aztec.js';
2
2
  import path from 'path';
3
+ import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with {
4
+ type: 'json'
5
+ };
3
6
  export const testnetIgnitionL2ChainConfig = {
4
7
  l1ChainId: 11155111,
5
8
  ethereumSlotDuration: 12,
@@ -40,7 +43,12 @@ export const alphaTestnetL2ChainConfig = {
40
43
  snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
41
44
  autoUpdate: 'config-and-version',
42
45
  autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/alpha-testnet.json',
43
- maxTxPoolSize: 2 * 1024 * 1024 * 1024
46
+ maxTxPoolSize: 100_000_000,
47
+ publicIncludeMetrics,
48
+ publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec.network',
49
+ publicMetricsCollectFrom: [
50
+ 'sequencer'
51
+ ]
44
52
  };
45
53
  export async function getBootnodes(networkName) {
46
54
  const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
@@ -109,6 +117,15 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
109
117
  if (config.autoUpdateUrl) {
110
118
  enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
111
119
  }
120
+ if (config.publicIncludeMetrics) {
121
+ enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
122
+ }
123
+ if (config.publicMetricsCollectorUrl) {
124
+ enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
125
+ }
126
+ if (config.publicMetricsCollectFrom) {
127
+ enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
128
+ }
112
129
  enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
113
130
  enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
114
131
  enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
@@ -8,6 +8,18 @@ import type { PXEService } from '@aztec/pxe/server';
8
8
  import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
9
9
  import type { Command } from 'commander';
10
10
  import { type AztecStartOption } from './aztec_start_options.js';
11
+ export declare const enum ExitCode {
12
+ SUCCESS = 0,
13
+ ERROR = 1,
14
+ ROLLUP_UPGRADE = 78,// EX_CONFIG from FreeBSD (https://man.freebsd.org/cgi/man.cgi?query=sysexits)
15
+ VERSION_UPGRADE = 79,// prev + 1 because there's nothing better
16
+ SIGHUP = 129,
17
+ SIGINT = 130,
18
+ SIGQUIT = 131,
19
+ SIGTERM = 143
20
+ }
21
+ export declare function shutdown(logFn: LogFn, exitCode: ExitCode, cb?: Array<() => Promise<void>>): Promise<never>;
22
+ export declare function isShuttingDown(): boolean;
11
23
  export declare const installSignalHandlers: (logFn: LogFn, cb?: Array<() => Promise<void>>) => void;
12
24
  /**
13
25
  * Creates logs for the initial accounts
@@ -60,5 +72,4 @@ export declare function preloadCrsDataForVerifying({ realProofs }: Pick<AztecNod
60
72
  */
61
73
  export declare function preloadCrsDataForServerSideProving({ realProofs }: Pick<ProverConfig, 'realProofs'>, log: LogFn): Promise<void>;
62
74
  export declare function setupUpdateMonitor(autoUpdateMode: SharedNodeConfig['autoUpdate'], updatesLocation: URL, followsCanonicalRollup: boolean, publicClient: ViemClient, registryContractAddress: EthAddress, signalHandlers: Array<() => Promise<void>>, updateNodeConfig?: (config: object) => Promise<void>): Promise<void>;
63
- export declare function shutdown(logFn: LogFn, cb?: Array<() => Promise<void>>): Promise<void>;
64
75
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAKpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAEpF,eAAO,MAAM,qBAAqB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,SAOlF,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,sBAAsB,EAAE;IACtB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC;IACxB;;OAEG;IACH,SAAS,EAAE,EAAE,CAAC;CACf,EAAE,EACH,GAA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AC9C,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EACnD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;GAIG;AACH,wBAAsB,kCAAkC,CACtD,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EAChD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAC9C,eAAe,EAAE,GAAG,EACpB,sBAAsB,EAAE,OAAO,EAC/B,YAAY,EAAE,UAAU,EACxB,uBAAuB,EAAE,UAAU,EACnC,cAAc,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAC1C,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,iBA8ErD"}
package/dest/cli/util.js CHANGED
@@ -3,13 +3,63 @@ import { UpdateChecker } from '@aztec/stdlib/update-checker';
3
3
  import { getTelemetryClient } from '@aztec/telemetry-client';
4
4
  import chalk from 'chalk';
5
5
  import { aztecStartOptions } from './aztec_start_options.js';
6
+ export var ExitCode = /*#__PURE__*/ function(ExitCode) {
7
+ ExitCode[ExitCode["SUCCESS"] = 0] = "SUCCESS";
8
+ ExitCode[ExitCode["ERROR"] = 1] = "ERROR";
9
+ ExitCode[ExitCode["ROLLUP_UPGRADE"] = 78] = "ROLLUP_UPGRADE";
10
+ ExitCode[ExitCode["VERSION_UPGRADE"] = 79] = "VERSION_UPGRADE";
11
+ // 128 + int(SIGNAL)
12
+ ExitCode[ExitCode["SIGHUP"] = 129] = "SIGHUP";
13
+ ExitCode[ExitCode["SIGINT"] = 130] = "SIGINT";
14
+ ExitCode[ExitCode["SIGQUIT"] = 131] = "SIGQUIT";
15
+ ExitCode[ExitCode["SIGTERM"] = 143] = "SIGTERM";
16
+ return ExitCode;
17
+ }({});
18
+ let shutdownPromise;
19
+ export function shutdown(logFn, exitCode, cb) {
20
+ if (shutdownPromise) {
21
+ logFn('Already shutting down.');
22
+ return shutdownPromise;
23
+ }
24
+ logFn('Shutting down...', {
25
+ exitCode
26
+ });
27
+ if (cb) {
28
+ shutdownPromise = Promise.allSettled(cb).then(()=>process.exit(exitCode));
29
+ } else {
30
+ // synchronously shuts down the process
31
+ // no need to set shutdownPromise on this branch of the if statement because no more code will be executed
32
+ process.exit(exitCode);
33
+ }
34
+ return shutdownPromise;
35
+ }
36
+ export function isShuttingDown() {
37
+ return shutdownPromise !== undefined;
38
+ }
6
39
  export const installSignalHandlers = (logFn, cb)=>{
7
- process.removeAllListeners('SIGINT');
8
- process.removeAllListeners('SIGTERM');
9
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
10
- process.once('SIGINT', ()=>shutdown(logFn, cb));
11
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
12
- process.once('SIGTERM', ()=>shutdown(logFn, cb));
40
+ const signals = [
41
+ [
42
+ 'SIGINT',
43
+ 130
44
+ ],
45
+ [
46
+ 'SIGTERM',
47
+ 143
48
+ ],
49
+ [
50
+ 'SIGHUP',
51
+ 129
52
+ ],
53
+ [
54
+ 'SIQUIT',
55
+ 131
56
+ ]
57
+ ];
58
+ for (const [signal, exitCode] of signals){
59
+ process.removeAllListeners(signal);
60
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
61
+ process.once(signal, ()=>shutdown(logFn, exitCode, cb));
62
+ }
13
63
  };
14
64
  /**
15
65
  * Creates logs for the initial accounts
@@ -183,6 +233,9 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
183
233
  });
184
234
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
185
235
  checker.on('newRollupVersion', async ({ latestVersion, currentVersion })=>{
236
+ if (isShuttingDown()) {
237
+ return;
238
+ }
186
239
  // if node follows canonical rollup then this is equivalent to a config update
187
240
  if (!followsCanonicalRollup) {
188
241
  return;
@@ -192,7 +245,7 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
192
245
  latestVersion,
193
246
  currentVersion
194
247
  });
195
- await shutdown(logger.info, signalHandlers);
248
+ await shutdown(logger.info, 78, signalHandlers);
196
249
  } else if (autoUpdateMode === 'notify') {
197
250
  logger.warn(`New rollup detected. Please restart the node`, {
198
251
  latestVersion,
@@ -202,12 +255,15 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
202
255
  });
203
256
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
204
257
  checker.on('newNodeVersion', async ({ latestVersion, currentVersion })=>{
258
+ if (isShuttingDown()) {
259
+ return;
260
+ }
205
261
  if (autoUpdateMode === 'config-and-version') {
206
262
  logger.info(`New node version detected. Please update and restart the node`, {
207
263
  latestVersion,
208
264
  currentVersion
209
265
  });
210
- await shutdown(logger.info, signalHandlers);
266
+ await shutdown(logger.info, 79, signalHandlers);
211
267
  } else if (autoUpdateMode === 'notify') {
212
268
  logger.info(`New node version detected. Please update and restart the node`, {
213
269
  latestVersion,
@@ -217,6 +273,9 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
217
273
  });
218
274
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
219
275
  checker.on('updateNodeConfig', async (config)=>{
276
+ if (isShuttingDown()) {
277
+ return;
278
+ }
220
279
  if ((autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') && updateNodeConfig) {
221
280
  logger.warn(`Config change detected. Updating node`, config);
222
281
  try {
@@ -237,6 +296,10 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
237
296
  if (Array.isArray(publicIncludeMetrics) && publicIncludeMetrics.every((m)=>typeof m === 'string')) {
238
297
  getTelemetryClient().setExportedPublicTelemetry(publicIncludeMetrics);
239
298
  }
299
+ const publicMetricsCollectFrom = config.publicMetricsCollectFrom;
300
+ if (Array.isArray(publicMetricsCollectFrom) && publicMetricsCollectFrom.every((m)=>typeof m === 'string')) {
301
+ getTelemetryClient().setPublicTelemetryCollectFrom(publicMetricsCollectFrom);
302
+ }
240
303
  } catch (err) {
241
304
  logger.warn('Failed to update config', {
242
305
  err
@@ -247,10 +310,3 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
247
310
  });
248
311
  checker.start();
249
312
  }
250
- export async function shutdown(logFn, cb) {
251
- logFn('Shutting down...');
252
- if (cb) {
253
- await Promise.all(cb);
254
- }
255
- process.exit(0);
256
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "1.0.0-staging.0",
3
+ "version": "1.0.0-staging.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js"
@@ -27,35 +27,35 @@
27
27
  "../package.common.json"
28
28
  ],
29
29
  "dependencies": {
30
- "@aztec/accounts": "1.0.0-staging.0",
31
- "@aztec/archiver": "1.0.0-staging.0",
32
- "@aztec/aztec-faucet": "1.0.0-staging.0",
33
- "@aztec/aztec-node": "1.0.0-staging.0",
34
- "@aztec/aztec.js": "1.0.0-staging.0",
35
- "@aztec/bb-prover": "1.0.0-staging.0",
36
- "@aztec/bb.js": "1.0.0-staging.0",
37
- "@aztec/blob-sink": "1.0.0-staging.0",
38
- "@aztec/bot": "1.0.0-staging.0",
39
- "@aztec/builder": "1.0.0-staging.0",
40
- "@aztec/cli": "1.0.0-staging.0",
41
- "@aztec/cli-wallet": "1.0.0-staging.0",
42
- "@aztec/constants": "1.0.0-staging.0",
43
- "@aztec/entrypoints": "1.0.0-staging.0",
44
- "@aztec/ethereum": "1.0.0-staging.0",
45
- "@aztec/foundation": "1.0.0-staging.0",
46
- "@aztec/kv-store": "1.0.0-staging.0",
47
- "@aztec/noir-contracts.js": "1.0.0-staging.0",
48
- "@aztec/noir-protocol-circuits-types": "1.0.0-staging.0",
49
- "@aztec/p2p": "1.0.0-staging.0",
50
- "@aztec/p2p-bootstrap": "1.0.0-staging.0",
51
- "@aztec/protocol-contracts": "1.0.0-staging.0",
52
- "@aztec/prover-client": "1.0.0-staging.0",
53
- "@aztec/prover-node": "1.0.0-staging.0",
54
- "@aztec/pxe": "1.0.0-staging.0",
55
- "@aztec/stdlib": "1.0.0-staging.0",
56
- "@aztec/telemetry-client": "1.0.0-staging.0",
57
- "@aztec/txe": "1.0.0-staging.0",
58
- "@aztec/world-state": "1.0.0-staging.0",
30
+ "@aztec/accounts": "1.0.0-staging.2",
31
+ "@aztec/archiver": "1.0.0-staging.2",
32
+ "@aztec/aztec-faucet": "1.0.0-staging.2",
33
+ "@aztec/aztec-node": "1.0.0-staging.2",
34
+ "@aztec/aztec.js": "1.0.0-staging.2",
35
+ "@aztec/bb-prover": "1.0.0-staging.2",
36
+ "@aztec/bb.js": "1.0.0-staging.2",
37
+ "@aztec/blob-sink": "1.0.0-staging.2",
38
+ "@aztec/bot": "1.0.0-staging.2",
39
+ "@aztec/builder": "1.0.0-staging.2",
40
+ "@aztec/cli": "1.0.0-staging.2",
41
+ "@aztec/cli-wallet": "1.0.0-staging.2",
42
+ "@aztec/constants": "1.0.0-staging.2",
43
+ "@aztec/entrypoints": "1.0.0-staging.2",
44
+ "@aztec/ethereum": "1.0.0-staging.2",
45
+ "@aztec/foundation": "1.0.0-staging.2",
46
+ "@aztec/kv-store": "1.0.0-staging.2",
47
+ "@aztec/noir-contracts.js": "1.0.0-staging.2",
48
+ "@aztec/noir-protocol-circuits-types": "1.0.0-staging.2",
49
+ "@aztec/p2p": "1.0.0-staging.2",
50
+ "@aztec/p2p-bootstrap": "1.0.0-staging.2",
51
+ "@aztec/protocol-contracts": "1.0.0-staging.2",
52
+ "@aztec/prover-client": "1.0.0-staging.2",
53
+ "@aztec/prover-node": "1.0.0-staging.2",
54
+ "@aztec/pxe": "1.0.0-staging.2",
55
+ "@aztec/stdlib": "1.0.0-staging.2",
56
+ "@aztec/telemetry-client": "1.0.0-staging.2",
57
+ "@aztec/txe": "1.0.0-staging.2",
58
+ "@aztec/world-state": "1.0.0-staging.2",
59
59
  "@types/chalk": "^2.2.0",
60
60
  "abitype": "^0.8.11",
61
61
  "chalk": "^5.3.0",
@@ -4,6 +4,8 @@ import type { SharedNodeConfig } from '@aztec/node-lib/config';
4
4
 
5
5
  import path from 'path';
6
6
 
7
+ import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
8
+
7
9
  export type NetworkNames = 'testnet-ignition' | 'alpha-testnet';
8
10
 
9
11
  export type L2ChainConfig = {
@@ -26,6 +28,9 @@ export type L2ChainConfig = {
26
28
  autoUpdate: SharedNodeConfig['autoUpdate'];
27
29
  autoUpdateUrl?: string;
28
30
  maxTxPoolSize: number;
31
+ publicIncludeMetrics?: string[];
32
+ publicMetricsCollectorUrl?: string;
33
+ publicMetricsCollectFrom?: string[];
29
34
  };
30
35
 
31
36
  export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
@@ -69,7 +74,10 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
69
74
  snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
70
75
  autoUpdate: 'config-and-version',
71
76
  autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/alpha-testnet.json',
72
- maxTxPoolSize: 2 * 1024 * 1024 * 1024, // 2GB
77
+ maxTxPoolSize: 100_000_000, // 100MB
78
+ publicIncludeMetrics,
79
+ publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec.network',
80
+ publicMetricsCollectFrom: ['sequencer'],
73
81
  };
74
82
 
75
83
  export async function getBootnodes(networkName: NetworkNames) {
@@ -145,6 +153,18 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
145
153
  enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
146
154
  }
147
155
 
156
+ if (config.publicIncludeMetrics) {
157
+ enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
158
+ }
159
+
160
+ if (config.publicMetricsCollectorUrl) {
161
+ enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
162
+ }
163
+
164
+ if (config.publicMetricsCollectFrom) {
165
+ enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
166
+ }
167
+
148
168
  enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
149
169
  enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
150
170
  enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
package/src/cli/util.ts CHANGED
@@ -14,13 +14,54 @@ import type { Command } from 'commander';
14
14
 
15
15
  import { type AztecStartOption, aztecStartOptions } from './aztec_start_options.js';
16
16
 
17
+ export const enum ExitCode {
18
+ SUCCESS = 0,
19
+ ERROR = 1,
20
+ ROLLUP_UPGRADE = 78, // EX_CONFIG from FreeBSD (https://man.freebsd.org/cgi/man.cgi?query=sysexits)
21
+ VERSION_UPGRADE = 79, // prev + 1 because there's nothing better
22
+ // 128 + int(SIGNAL)
23
+ SIGHUP = 129,
24
+ SIGINT = 130,
25
+ SIGQUIT = 131,
26
+ SIGTERM = 143,
27
+ }
28
+
29
+ let shutdownPromise: Promise<never> | undefined;
30
+ export function shutdown(logFn: LogFn, exitCode: ExitCode, cb?: Array<() => Promise<void>>): Promise<never> {
31
+ if (shutdownPromise) {
32
+ logFn('Already shutting down.');
33
+ return shutdownPromise;
34
+ }
35
+
36
+ logFn('Shutting down...', { exitCode });
37
+ if (cb) {
38
+ shutdownPromise = Promise.allSettled(cb).then(() => process.exit(exitCode));
39
+ } else {
40
+ // synchronously shuts down the process
41
+ // no need to set shutdownPromise on this branch of the if statement because no more code will be executed
42
+ process.exit(exitCode);
43
+ }
44
+
45
+ return shutdownPromise;
46
+ }
47
+
48
+ export function isShuttingDown(): boolean {
49
+ return shutdownPromise !== undefined;
50
+ }
51
+
17
52
  export const installSignalHandlers = (logFn: LogFn, cb?: Array<() => Promise<void>>) => {
18
- process.removeAllListeners('SIGINT');
19
- process.removeAllListeners('SIGTERM');
20
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
21
- process.once('SIGINT', () => shutdown(logFn, cb));
22
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
23
- process.once('SIGTERM', () => shutdown(logFn, cb));
53
+ const signals = [
54
+ ['SIGINT', ExitCode.SIGINT],
55
+ ['SIGTERM', ExitCode.SIGTERM],
56
+ ['SIGHUP', ExitCode.SIGHUP],
57
+ ['SIQUIT', ExitCode.SIGQUIT],
58
+ ] as const;
59
+
60
+ for (const [signal, exitCode] of signals) {
61
+ process.removeAllListeners(signal);
62
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
63
+ process.once(signal, () => shutdown(logFn, exitCode, cb));
64
+ }
24
65
  };
25
66
 
26
67
  /**
@@ -262,6 +303,10 @@ export async function setupUpdateMonitor(
262
303
 
263
304
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
264
305
  checker.on('newRollupVersion', async ({ latestVersion, currentVersion }) => {
306
+ if (isShuttingDown()) {
307
+ return;
308
+ }
309
+
265
310
  // if node follows canonical rollup then this is equivalent to a config update
266
311
  if (!followsCanonicalRollup) {
267
312
  return;
@@ -269,7 +314,7 @@ export async function setupUpdateMonitor(
269
314
 
270
315
  if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
271
316
  logger.info(`New rollup version detected. Please restart the node`, { latestVersion, currentVersion });
272
- await shutdown(logger.info, signalHandlers);
317
+ await shutdown(logger.info, ExitCode.ROLLUP_UPGRADE, signalHandlers);
273
318
  } else if (autoUpdateMode === 'notify') {
274
319
  logger.warn(`New rollup detected. Please restart the node`, { latestVersion, currentVersion });
275
320
  }
@@ -277,9 +322,12 @@ export async function setupUpdateMonitor(
277
322
 
278
323
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
279
324
  checker.on('newNodeVersion', async ({ latestVersion, currentVersion }) => {
325
+ if (isShuttingDown()) {
326
+ return;
327
+ }
280
328
  if (autoUpdateMode === 'config-and-version') {
281
329
  logger.info(`New node version detected. Please update and restart the node`, { latestVersion, currentVersion });
282
- await shutdown(logger.info, signalHandlers);
330
+ await shutdown(logger.info, ExitCode.VERSION_UPGRADE, signalHandlers);
283
331
  } else if (autoUpdateMode === 'notify') {
284
332
  logger.info(`New node version detected. Please update and restart the node`, { latestVersion, currentVersion });
285
333
  }
@@ -287,6 +335,10 @@ export async function setupUpdateMonitor(
287
335
 
288
336
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
289
337
  checker.on('updateNodeConfig', async config => {
338
+ if (isShuttingDown()) {
339
+ return;
340
+ }
341
+
290
342
  if ((autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') && updateNodeConfig) {
291
343
  logger.warn(`Config change detected. Updating node`, config);
292
344
  try {
@@ -306,6 +358,10 @@ export async function setupUpdateMonitor(
306
358
  if (Array.isArray(publicIncludeMetrics) && publicIncludeMetrics.every(m => typeof m === 'string')) {
307
359
  getTelemetryClient().setExportedPublicTelemetry(publicIncludeMetrics);
308
360
  }
361
+ const publicMetricsCollectFrom: unknown = (config as any).publicMetricsCollectFrom;
362
+ if (Array.isArray(publicMetricsCollectFrom) && publicMetricsCollectFrom.every(m => typeof m === 'string')) {
363
+ getTelemetryClient().setPublicTelemetryCollectFrom(publicMetricsCollectFrom);
364
+ }
309
365
  } catch (err) {
310
366
  logger.warn('Failed to update config', { err });
311
367
  }
@@ -315,11 +371,3 @@ export async function setupUpdateMonitor(
315
371
 
316
372
  checker.start();
317
373
  }
318
-
319
- export async function shutdown(logFn: LogFn, cb?: Array<() => Promise<void>>) {
320
- logFn('Shutting down...');
321
- if (cb) {
322
- await Promise.all(cb);
323
- }
324
- process.exit(0);
325
- }