@aztec/aztec 0.86.0 → 0.87.0

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.
@@ -2,7 +2,7 @@ import { type ConfigMapping, type EnvVar } from '@aztec/foundation/config';
2
2
  export interface AztecStartOption {
3
3
  flag: string;
4
4
  description: string;
5
- defaultValue: any | undefined;
5
+ defaultValue: any;
6
6
  printDefault?: (val: any) => string;
7
7
  envVar: EnvVar | undefined;
8
8
  parseVal?: (val: string) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,GAAG,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,cAAe,MAAM,kBAAkB,OAAO,MAAM,EAAE,aAAa,CAAC,uBAiB1F,CAAC;AAGF,eAAO,MAAM,gBAAgB,UAU5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CA0WlE,CAAC"}
1
+ {"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,EAAE,gBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,uBAiB1F,CAAC;AAGF,eAAO,MAAM,gBAAgB,UAU5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CAsXlE,CAAC"}
@@ -43,12 +43,24 @@ export const universalOptions = [
43
43
  export const NETWORK_FLAG = 'network';
44
44
  // Define categories and options
45
45
  export const aztecStartOptions = {
46
- NETWORK: [
46
+ MISC: [
47
47
  {
48
48
  flag: `--${NETWORK_FLAG} <value>`,
49
49
  description: 'Network to run Aztec on',
50
50
  defaultValue: undefined,
51
51
  envVar: 'NETWORK'
52
+ },
53
+ {
54
+ flag: `--auto-update <value>`,
55
+ description: 'Configure auto updates',
56
+ envVar: 'AUTO_UPDATE',
57
+ defaultValue: 'disabled'
58
+ },
59
+ {
60
+ flag: `--auto-update-url <value>`,
61
+ description: 'Configure where to get updates from',
62
+ envVar: 'AUTO_UPDATE_URL',
63
+ defaultValue: undefined
52
64
  }
53
65
  ],
54
66
  SANDBOX: [
@@ -1,3 +1,4 @@
1
+ import type { SharedNodeConfig } from '@aztec/node-lib/config';
1
2
  export type NetworkNames = 'testnet-ignition' | 'alpha-testnet';
2
3
  export type L2ChainConfig = {
3
4
  l1ChainId: number;
@@ -16,6 +17,8 @@ export type L2ChainConfig = {
16
17
  seqMaxTxsPerBlock: number;
17
18
  realProofs: boolean;
18
19
  snapshotsUrl: string;
20
+ autoUpdate: SharedNodeConfig['autoUpdate'];
21
+ autoUpdateUrl?: string;
19
22
  };
20
23
  export declare const testnetIgnitionL2ChainConfig: L2ChainConfig;
21
24
  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":"AAKA,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;CACtB,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAiB1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAiBvC,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,iBAwB/E"}
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,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAmB1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAmBvC,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,iBAgC/E"}
@@ -16,7 +16,9 @@ export const testnetIgnitionL2ChainConfig = {
16
16
  seqMinTxsPerBlock: 0,
17
17
  seqMaxTxsPerBlock: 0,
18
18
  realProofs: true,
19
- snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/'
19
+ snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
20
+ autoUpdate: 'disabled',
21
+ autoUpdateUrl: undefined
20
22
  };
21
23
  export const alphaTestnetL2ChainConfig = {
22
24
  l1ChainId: 11155111,
@@ -32,9 +34,11 @@ export const alphaTestnetL2ChainConfig = {
32
34
  slashFactoryAddress: '0x3c9ccf55a8ac3c2eeedf2ee2aa1722188fd676be',
33
35
  feeAssetHandlerAddress: '0x80d848dc9f52df56789e2d62ce66f19555ff1019',
34
36
  seqMinTxsPerBlock: 0,
35
- seqMaxTxsPerBlock: 4,
37
+ seqMaxTxsPerBlock: 20,
36
38
  realProofs: true,
37
- snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/'
39
+ snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
40
+ autoUpdate: 'config-and-version',
41
+ autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/alpha-testnet.json'
38
42
  };
39
43
  export async function getBootnodes(networkName) {
40
44
  const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
@@ -96,6 +100,12 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
96
100
  enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
97
101
  enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
98
102
  enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
103
+ if (config.autoUpdate) {
104
+ enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
105
+ }
106
+ if (config.autoUpdateUrl) {
107
+ enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
108
+ }
99
109
  enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
100
110
  enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
101
111
  enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
@@ -1 +1 @@
1
- {"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAIpG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAuJtC"}
1
+ {"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAIpG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAqBnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAuKtC"}
@@ -1,8 +1,8 @@
1
1
  import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
2
  import { aztecNodeConfigMappings, getConfigEnvVars } from '@aztec/aztec-node';
3
- import { Fr } from '@aztec/aztec.js';
3
+ import { EthAddress, Fr } from '@aztec/aztec.js';
4
4
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
5
- import { NULL_KEY } from '@aztec/ethereum';
5
+ import { NULL_KEY, getAddressFromPrivateKey, getPublicClient } from '@aztec/ethereum';
6
6
  import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
7
7
  import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
8
8
  import { initTelemetryClient, telemetryClientConfigMappings } from '@aztec/telemetry-client';
@@ -10,7 +10,7 @@ import { getGenesisValues } from '@aztec/world-state/testing';
10
10
  import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
11
11
  import { createAztecNode, deployContractsToL1 } from '../../sandbox/index.js';
12
12
  import { getL1Config } from '../get_l1_config.js';
13
- import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying } from '../util.js';
13
+ import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
14
14
  export async function startNode(options, signalHandlers, services, adminServices, userLog) {
15
15
  // options specifically namespaced with --node.<option>
16
16
  const nodeSpecificOptions = extractNamespacedOptions(options, 'node');
@@ -36,6 +36,7 @@ export async function startNode(options, signalHandlers, services, adminServices
36
36
  userLog(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
37
37
  const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
38
38
  userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
39
+ const followsCanonicalRollup = typeof nodeConfig.rollupVersion !== 'number' || nodeConfig.rollupVersion === 'canonical';
39
40
  // Deploy contracts if needed
40
41
  if (nodeSpecificOptions.deployAztecContracts || nodeSpecificOptions.deployAztecContractsSalt) {
41
42
  let account;
@@ -102,6 +103,7 @@ export async function startNode(options, signalHandlers, services, adminServices
102
103
  }
103
104
  }
104
105
  nodeConfig.publisherPrivateKey = sequencerConfig.publisherPrivateKey;
106
+ nodeConfig.coinbase ??= EthAddress.fromString(getAddressFromPrivateKey(nodeConfig.publisherPrivateKey));
105
107
  }
106
108
  if (nodeConfig.p2pEnabled) {
107
109
  // ensure bootstrapNodes is an array
@@ -149,6 +151,11 @@ export async function startNode(options, signalHandlers, services, adminServices
149
151
  telemetry
150
152
  });
151
153
  }
154
+ if (nodeConfig.autoUpdate !== 'disabled' && nodeConfig.autoUpdateUrl) {
155
+ await setupUpdateMonitor(nodeConfig.autoUpdate, new URL(nodeConfig.autoUpdateUrl), followsCanonicalRollup, getPublicClient(nodeConfig), nodeConfig.l1Contracts.registryAddress, signalHandlers, async (config)=>node.setConfig((await AztecNodeAdminApiSchema.setConfig.parameters().parseAsync([
156
+ config
157
+ ]))[0]));
158
+ }
152
159
  return {
153
160
  config: nodeConfig
154
161
  };
@@ -1 +1 @@
1
- {"version":3,"file":"start_prover_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_node.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,oBAAoB,CAAC;AAY5B,wBAAsB,eAAe,CACnC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,CA4FvC"}
1
+ {"version":3,"file":"start_prover_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_node.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,oBAAoB,CAAC;AAY5B,wBAAsB,eAAe,CACnC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAwGvC"}
@@ -1,7 +1,7 @@
1
1
  import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
2
  import { Fr } from '@aztec/aztec.js';
3
3
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
4
- import { NULL_KEY } from '@aztec/ethereum';
4
+ import { NULL_KEY, getPublicClient } from '@aztec/ethereum';
5
5
  import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
6
6
  import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
7
7
  import { createProverNode, getProverNodeConfigFromEnv, proverNodeConfigMappings } from '@aztec/prover-node';
@@ -10,7 +10,7 @@ import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } f
10
10
  import { getGenesisValues } from '@aztec/world-state/testing';
11
11
  import { mnemonicToAccount } from 'viem/accounts';
12
12
  import { getL1Config } from '../get_l1_config.js';
13
- import { extractRelevantOptions, preloadCrsDataForVerifying } from '../util.js';
13
+ import { extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
14
14
  import { getVersions } from '../versioning.js';
15
15
  import { startProverBroker } from './start_prover_broker.js';
16
16
  export async function startProverNode(options, signalHandlers, services, userLog) {
@@ -38,6 +38,7 @@ export async function startProverNode(options, signalHandlers, services, userLog
38
38
  if (!proverConfig.l1Contracts.registryAddress || proverConfig.l1Contracts.registryAddress.isZero()) {
39
39
  throw new Error('L1 registry address is required to start a Prover Node with --archiver option');
40
40
  }
41
+ const followsCanonicalRollup = typeof proverConfig.rollupVersion !== 'number';
41
42
  const { addresses, config } = await getL1Config(proverConfig.l1Contracts.registryAddress, proverConfig.l1RpcUrls, proverConfig.l1ChainId, proverConfig.rollupVersion);
42
43
  proverConfig.l1Contracts = addresses;
43
44
  proverConfig = {
@@ -102,6 +103,9 @@ export async function startProverNode(options, signalHandlers, services, userLog
102
103
  }
103
104
  signalHandlers.push(proverNode.stop.bind(proverNode));
104
105
  await proverNode.start();
106
+ if (proverConfig.autoUpdate !== 'disabled' && proverConfig.autoUpdateUrl) {
107
+ await setupUpdateMonitor(proverConfig.autoUpdate, new URL(proverConfig.autoUpdateUrl), followsCanonicalRollup, getPublicClient(proverConfig), proverConfig.l1Contracts.registryAddress, signalHandlers);
108
+ }
105
109
  return {
106
110
  config: proverConfig
107
111
  };
@@ -1,7 +1,9 @@
1
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
2
- import type { AccountManager, Fr } from '@aztec/aztec.js';
2
+ import type { AccountManager, EthAddress, Fr } from '@aztec/aztec.js';
3
+ import type { ViemClient } from '@aztec/ethereum';
3
4
  import type { ConfigMappingsType } from '@aztec/foundation/config';
4
- import type { LogFn } from '@aztec/foundation/log';
5
+ import { type LogFn } from '@aztec/foundation/log';
6
+ import type { SharedNodeConfig } from '@aztec/node-lib/config';
5
7
  import type { PXEService } from '@aztec/pxe/server';
6
8
  import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
7
9
  import type { Command } from 'commander';
@@ -57,4 +59,6 @@ export declare function preloadCrsDataForVerifying({ realProofs }: Pick<AztecNod
57
59
  * @param log - Logging function
58
60
  */
59
61
  export declare function preloadCrsDataForServerSideProving({ realProofs }: Pick<ProverConfig, 'realProofs'>, log: LogFn): Promise<void>;
62
+ 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>;
60
64
  //# 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,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAEpF,eAAO,MAAM,qBAAqB,UAAW,KAAK,OAAO,MAAM,MAAM,QAAQ,IAAI,CAAC,CAAC,SAclF,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,GAAG,EAAE,UAAU,qBAyBhB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAiB/F;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,gBAAgB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AAE,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,iBAgDrD;AAED,wBAAsB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,iBAM3E"}
package/dest/cli/util.js CHANGED
@@ -1,19 +1,14 @@
1
+ import { createLogger } from '@aztec/foundation/log';
2
+ import { UpdateChecker } from '@aztec/stdlib/update-checker';
1
3
  import chalk from 'chalk';
2
4
  import { aztecStartOptions } from './aztec_start_options.js';
3
5
  export const installSignalHandlers = (logFn, cb)=>{
4
- const shutdown = async ()=>{
5
- logFn('Shutting down...');
6
- if (cb) {
7
- await Promise.all(cb);
8
- }
9
- process.exit(0);
10
- };
11
6
  process.removeAllListeners('SIGINT');
12
7
  process.removeAllListeners('SIGTERM');
13
8
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
14
- process.once('SIGINT', shutdown);
9
+ process.once('SIGINT', ()=>shutdown(logFn, cb));
15
10
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
16
- process.once('SIGTERM', shutdown);
11
+ process.once('SIGTERM', ()=>shutdown(logFn, cb));
17
12
  };
18
13
  /**
19
14
  * Creates logs for the initial accounts
@@ -178,3 +173,67 @@ export const printAztecStartHelpText = ()=>{
178
173
  ]);
179
174
  }
180
175
  }
176
+ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, followsCanonicalRollup, publicClient, registryContractAddress, signalHandlers, updateNodeConfig) {
177
+ const logger = createLogger('update-check');
178
+ const checker = await UpdateChecker.new({
179
+ baseURL: updatesLocation,
180
+ publicClient,
181
+ registryContractAddress
182
+ });
183
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
184
+ checker.on('newRollupVersion', async ({ latestVersion, currentVersion })=>{
185
+ // if node follows canonical rollup then this is equivalent to a config update
186
+ if (!followsCanonicalRollup) {
187
+ return;
188
+ }
189
+ if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
190
+ logger.info(`New rollup version detected. Please restart the node`, {
191
+ latestVersion,
192
+ currentVersion
193
+ });
194
+ await shutdown(logger.info, signalHandlers);
195
+ } else if (autoUpdateMode === 'notify') {
196
+ logger.warn(`New rollup detected. Please restart the node`, {
197
+ latestVersion,
198
+ currentVersion
199
+ });
200
+ }
201
+ });
202
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
203
+ checker.on('newNodeVersion', async ({ latestVersion, currentVersion })=>{
204
+ if (autoUpdateMode === 'config-and-version') {
205
+ logger.info(`New node version detected. Please update and restart the node`, {
206
+ latestVersion,
207
+ currentVersion
208
+ });
209
+ await shutdown(logger.info, signalHandlers);
210
+ } else if (autoUpdateMode === 'notify') {
211
+ logger.info(`New node version detected. Please update and restart the node`, {
212
+ latestVersion,
213
+ currentVersion
214
+ });
215
+ }
216
+ });
217
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
218
+ checker.on('updateNodeConfig', async (config)=>{
219
+ if ((autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') && updateNodeConfig) {
220
+ logger.warn(`Config change detected. Updating node`, config);
221
+ try {
222
+ await updateNodeConfig(config);
223
+ } catch (err) {
224
+ logger.warn('Failed to update config', {
225
+ err
226
+ });
227
+ }
228
+ }
229
+ // don't notify on these config changes
230
+ });
231
+ checker.start();
232
+ }
233
+ export async function shutdown(logFn, cb) {
234
+ logFn('Shutting down...');
235
+ if (cb) {
236
+ await Promise.all(cb);
237
+ }
238
+ process.exit(0);
239
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/sandbox/sandbox.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AAE7F,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAU7F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AAGjE,OAAO,EAAE,KAAK,gBAAgB,EAAyC,MAAM,mBAAmB,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAA2D,MAAM,MAAM,CAAC;AAavH;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GAAG,iBAAiB,EACxC,oBAAoB,yCAAS,EAC7B,IAAI,GAAE;IACJ,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,EAAE,CAAC;IACxB,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAClC;;;;;;;;;;;;;;;;;;;;GA4BP;AAED,wBAAwB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+ "version": "0.87.0",
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": "0.86.0",
31
- "@aztec/archiver": "0.86.0",
32
- "@aztec/aztec-faucet": "0.86.0",
33
- "@aztec/aztec-node": "0.86.0",
34
- "@aztec/aztec.js": "0.86.0",
35
- "@aztec/bb-prover": "0.86.0",
36
- "@aztec/bb.js": "0.86.0",
37
- "@aztec/blob-sink": "0.86.0",
38
- "@aztec/bot": "0.86.0",
39
- "@aztec/builder": "0.86.0",
40
- "@aztec/cli": "0.86.0",
41
- "@aztec/cli-wallet": "0.86.0",
42
- "@aztec/constants": "0.86.0",
43
- "@aztec/entrypoints": "0.86.0",
44
- "@aztec/ethereum": "0.86.0",
45
- "@aztec/foundation": "0.86.0",
46
- "@aztec/kv-store": "0.86.0",
47
- "@aztec/noir-contracts.js": "0.86.0",
48
- "@aztec/noir-protocol-circuits-types": "0.86.0",
49
- "@aztec/p2p": "0.86.0",
50
- "@aztec/p2p-bootstrap": "0.86.0",
51
- "@aztec/protocol-contracts": "0.86.0",
52
- "@aztec/prover-client": "0.86.0",
53
- "@aztec/prover-node": "0.86.0",
54
- "@aztec/pxe": "0.86.0",
55
- "@aztec/stdlib": "0.86.0",
56
- "@aztec/telemetry-client": "0.86.0",
57
- "@aztec/txe": "0.86.0",
58
- "@aztec/world-state": "0.86.0",
30
+ "@aztec/accounts": "0.87.0",
31
+ "@aztec/archiver": "0.87.0",
32
+ "@aztec/aztec-faucet": "0.87.0",
33
+ "@aztec/aztec-node": "0.87.0",
34
+ "@aztec/aztec.js": "0.87.0",
35
+ "@aztec/bb-prover": "0.87.0",
36
+ "@aztec/bb.js": "0.87.0",
37
+ "@aztec/blob-sink": "0.87.0",
38
+ "@aztec/bot": "0.87.0",
39
+ "@aztec/builder": "0.87.0",
40
+ "@aztec/cli": "0.87.0",
41
+ "@aztec/cli-wallet": "0.87.0",
42
+ "@aztec/constants": "0.87.0",
43
+ "@aztec/entrypoints": "0.87.0",
44
+ "@aztec/ethereum": "0.87.0",
45
+ "@aztec/foundation": "0.87.0",
46
+ "@aztec/kv-store": "0.87.0",
47
+ "@aztec/noir-contracts.js": "0.87.0",
48
+ "@aztec/noir-protocol-circuits-types": "0.87.0",
49
+ "@aztec/p2p": "0.87.0",
50
+ "@aztec/p2p-bootstrap": "0.87.0",
51
+ "@aztec/protocol-contracts": "0.87.0",
52
+ "@aztec/prover-client": "0.87.0",
53
+ "@aztec/prover-node": "0.87.0",
54
+ "@aztec/pxe": "0.87.0",
55
+ "@aztec/stdlib": "0.87.0",
56
+ "@aztec/telemetry-client": "0.87.0",
57
+ "@aztec/txe": "0.87.0",
58
+ "@aztec/world-state": "0.87.0",
59
59
  "@types/chalk": "^2.2.0",
60
60
  "abitype": "^0.8.11",
61
61
  "chalk": "^5.3.0",
@@ -76,7 +76,7 @@
76
76
  "@types/koa": "^2.15.0",
77
77
  "jest": "^29.5.0",
78
78
  "ts-node": "^10.9.1",
79
- "typescript": "^5.0.4"
79
+ "typescript": "^5.3.3"
80
80
  },
81
81
  "jest": {
82
82
  "moduleNameMapper": {
@@ -112,6 +112,6 @@
112
112
  ]
113
113
  },
114
114
  "engines": {
115
- "node": ">=18"
115
+ "node": ">=20.10"
116
116
  }
117
117
  }
@@ -27,7 +27,7 @@ import { DefaultMnemonic } from '../mnemonic.js';
27
27
  export interface AztecStartOption {
28
28
  flag: string;
29
29
  description: string;
30
- defaultValue: any | undefined;
30
+ defaultValue: any;
31
31
  printDefault?: (val: any) => string;
32
32
  envVar: EnvVar | undefined;
33
33
  parseVal?: (val: string) => any;
@@ -69,13 +69,25 @@ export const NETWORK_FLAG = 'network';
69
69
 
70
70
  // Define categories and options
71
71
  export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
72
- NETWORK: [
72
+ MISC: [
73
73
  {
74
74
  flag: `--${NETWORK_FLAG} <value>`,
75
75
  description: 'Network to run Aztec on',
76
76
  defaultValue: undefined,
77
77
  envVar: 'NETWORK',
78
78
  },
79
+ {
80
+ flag: `--auto-update <value>`,
81
+ description: 'Configure auto updates',
82
+ envVar: 'AUTO_UPDATE',
83
+ defaultValue: 'disabled',
84
+ },
85
+ {
86
+ flag: `--auto-update-url <value>`,
87
+ description: 'Configure where to get updates from',
88
+ envVar: 'AUTO_UPDATE_URL',
89
+ defaultValue: undefined,
90
+ },
79
91
  ],
80
92
  SANDBOX: [
81
93
  {
@@ -1,5 +1,6 @@
1
1
  import { EthAddress } from '@aztec/aztec.js';
2
2
  import type { EnvVar } from '@aztec/foundation/config';
3
+ import type { SharedNodeConfig } from '@aztec/node-lib/config';
3
4
 
4
5
  import path from 'path';
5
6
 
@@ -22,6 +23,8 @@ export type L2ChainConfig = {
22
23
  seqMaxTxsPerBlock: number;
23
24
  realProofs: boolean;
24
25
  snapshotsUrl: string;
26
+ autoUpdate: SharedNodeConfig['autoUpdate'];
27
+ autoUpdateUrl?: string;
25
28
  };
26
29
 
27
30
  export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
@@ -41,6 +44,8 @@ export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
41
44
  seqMaxTxsPerBlock: 0,
42
45
  realProofs: true,
43
46
  snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
47
+ autoUpdate: 'disabled',
48
+ autoUpdateUrl: undefined,
44
49
  };
45
50
 
46
51
  export const alphaTestnetL2ChainConfig: L2ChainConfig = {
@@ -57,9 +62,11 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
57
62
  slashFactoryAddress: '0x3c9ccf55a8ac3c2eeedf2ee2aa1722188fd676be',
58
63
  feeAssetHandlerAddress: '0x80d848dc9f52df56789e2d62ce66f19555ff1019',
59
64
  seqMinTxsPerBlock: 0,
60
- seqMaxTxsPerBlock: 4,
65
+ seqMaxTxsPerBlock: 20,
61
66
  realProofs: true,
62
67
  snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
68
+ autoUpdate: 'config-and-version',
69
+ autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/alpha-testnet.json',
63
70
  };
64
71
 
65
72
  export async function getBootnodes(networkName: NetworkNames) {
@@ -126,6 +133,14 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
126
133
  enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
127
134
  enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
128
135
 
136
+ if (config.autoUpdate) {
137
+ enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
138
+ }
139
+
140
+ if (config.autoUpdateUrl) {
141
+ enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
142
+ }
143
+
129
144
  enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
130
145
  enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
131
146
  enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
@@ -1,8 +1,8 @@
1
1
  import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
2
  import { type AztecNodeConfig, aztecNodeConfigMappings, getConfigEnvVars } from '@aztec/aztec-node';
3
- import { Fr } from '@aztec/aztec.js';
3
+ import { EthAddress, Fr } from '@aztec/aztec.js';
4
4
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
5
- import { NULL_KEY } from '@aztec/ethereum';
5
+ import { NULL_KEY, getAddressFromPrivateKey, getPublicClient } from '@aztec/ethereum';
6
6
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
7
7
  import type { LogFn } from '@aztec/foundation/log';
8
8
  import { AztecNodeAdminApiSchema, AztecNodeApiSchema, type PXE } from '@aztec/stdlib/interfaces/client';
@@ -18,7 +18,12 @@ import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
18
18
 
19
19
  import { createAztecNode, deployContractsToL1 } from '../../sandbox/index.js';
20
20
  import { getL1Config } from '../get_l1_config.js';
21
- import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying } from '../util.js';
21
+ import {
22
+ extractNamespacedOptions,
23
+ extractRelevantOptions,
24
+ preloadCrsDataForVerifying,
25
+ setupUpdateMonitor,
26
+ } from '../util.js';
22
27
 
23
28
  export async function startNode(
24
29
  options: any,
@@ -59,6 +64,9 @@ export async function startNode(
59
64
 
60
65
  userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
61
66
 
67
+ const followsCanonicalRollup =
68
+ typeof nodeConfig.rollupVersion !== 'number' || (nodeConfig.rollupVersion as unknown as string) === 'canonical';
69
+
62
70
  // Deploy contracts if needed
63
71
  if (nodeSpecificOptions.deployAztecContracts || nodeSpecificOptions.deployAztecContractsSalt) {
64
72
  let account;
@@ -140,6 +148,7 @@ export async function startNode(
140
148
  }
141
149
  }
142
150
  nodeConfig.publisherPrivateKey = sequencerConfig.publisherPrivateKey;
151
+ nodeConfig.coinbase ??= EthAddress.fromString(getAddressFromPrivateKey(nodeConfig.publisherPrivateKey));
143
152
  }
144
153
 
145
154
  if (nodeConfig.p2pEnabled) {
@@ -176,5 +185,17 @@ export async function startNode(
176
185
  await addBot(options, signalHandlers, services, { pxe, node, telemetry });
177
186
  }
178
187
 
188
+ if (nodeConfig.autoUpdate !== 'disabled' && nodeConfig.autoUpdateUrl) {
189
+ await setupUpdateMonitor(
190
+ nodeConfig.autoUpdate,
191
+ new URL(nodeConfig.autoUpdateUrl),
192
+ followsCanonicalRollup,
193
+ getPublicClient(nodeConfig!),
194
+ nodeConfig.l1Contracts.registryAddress,
195
+ signalHandlers,
196
+ async config => node.setConfig((await AztecNodeAdminApiSchema.setConfig.parameters().parseAsync([config]))[0]),
197
+ );
198
+ }
199
+
179
200
  return { config: nodeConfig };
180
201
  }
@@ -1,7 +1,7 @@
1
1
  import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
2
  import { Fr } from '@aztec/aztec.js';
3
3
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
4
- import { NULL_KEY } from '@aztec/ethereum';
4
+ import { NULL_KEY, getPublicClient } from '@aztec/ethereum';
5
5
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
6
6
  import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
7
7
  import type { LogFn } from '@aztec/foundation/log';
@@ -19,7 +19,7 @@ import { getGenesisValues } from '@aztec/world-state/testing';
19
19
  import { mnemonicToAccount } from 'viem/accounts';
20
20
 
21
21
  import { getL1Config } from '../get_l1_config.js';
22
- import { extractRelevantOptions, preloadCrsDataForVerifying } from '../util.js';
22
+ import { extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
23
23
  import { getVersions } from '../versioning.js';
24
24
  import { startProverBroker } from './start_prover_broker.js';
25
25
 
@@ -58,6 +58,7 @@ export async function startProverNode(
58
58
  throw new Error('L1 registry address is required to start a Prover Node with --archiver option');
59
59
  }
60
60
 
61
+ const followsCanonicalRollup = typeof proverConfig.rollupVersion !== 'number';
61
62
  const { addresses, config } = await getL1Config(
62
63
  proverConfig.l1Contracts.registryAddress,
63
64
  proverConfig.l1RpcUrls,
@@ -119,5 +120,16 @@ export async function startProverNode(
119
120
  signalHandlers.push(proverNode.stop.bind(proverNode));
120
121
 
121
122
  await proverNode.start();
123
+
124
+ if (proverConfig.autoUpdate !== 'disabled' && proverConfig.autoUpdateUrl) {
125
+ await setupUpdateMonitor(
126
+ proverConfig.autoUpdate,
127
+ new URL(proverConfig.autoUpdateUrl),
128
+ followsCanonicalRollup,
129
+ getPublicClient(proverConfig),
130
+ proverConfig.l1Contracts.registryAddress,
131
+ signalHandlers,
132
+ );
133
+ }
122
134
  return { config: proverConfig };
123
135
  }
package/src/cli/util.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
2
- import type { AccountManager, Fr } from '@aztec/aztec.js';
2
+ import type { AccountManager, EthAddress, Fr } from '@aztec/aztec.js';
3
+ import type { ViemClient } from '@aztec/ethereum';
3
4
  import type { ConfigMappingsType } from '@aztec/foundation/config';
4
- import type { LogFn } from '@aztec/foundation/log';
5
+ import { type LogFn, createLogger } from '@aztec/foundation/log';
6
+ import type { SharedNodeConfig } from '@aztec/node-lib/config';
5
7
  import type { PXEService } from '@aztec/pxe/server';
6
8
  import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
9
+ import { UpdateChecker } from '@aztec/stdlib/update-checker';
7
10
 
8
11
  import chalk from 'chalk';
9
12
  import type { Command } from 'commander';
@@ -11,19 +14,12 @@ import type { Command } from 'commander';
11
14
  import { type AztecStartOption, aztecStartOptions } from './aztec_start_options.js';
12
15
 
13
16
  export const installSignalHandlers = (logFn: LogFn, cb?: Array<() => Promise<void>>) => {
14
- const shutdown = async () => {
15
- logFn('Shutting down...');
16
- if (cb) {
17
- await Promise.all(cb);
18
- }
19
- process.exit(0);
20
- };
21
17
  process.removeAllListeners('SIGINT');
22
18
  process.removeAllListeners('SIGTERM');
23
19
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
24
- process.once('SIGINT', shutdown);
20
+ process.once('SIGINT', () => shutdown(logFn, cb));
25
21
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
26
- process.once('SIGTERM', shutdown);
22
+ process.once('SIGTERM', () => shutdown(logFn, cb));
27
23
  };
28
24
 
29
25
  /**
@@ -246,3 +242,68 @@ export async function preloadCrsDataForServerSideProving(
246
242
  await Promise.all([Crs.new(2 ** 25 + 1, undefined, log), GrumpkinCrs.new(2 ** 18 + 1, undefined, log)]);
247
243
  }
248
244
  }
245
+
246
+ export async function setupUpdateMonitor(
247
+ autoUpdateMode: SharedNodeConfig['autoUpdate'],
248
+ updatesLocation: URL,
249
+ followsCanonicalRollup: boolean,
250
+ publicClient: ViemClient,
251
+ registryContractAddress: EthAddress,
252
+ signalHandlers: Array<() => Promise<void>>,
253
+ updateNodeConfig?: (config: object) => Promise<void>,
254
+ ) {
255
+ const logger = createLogger('update-check');
256
+ const checker = await UpdateChecker.new({
257
+ baseURL: updatesLocation,
258
+ publicClient,
259
+ registryContractAddress,
260
+ });
261
+
262
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
263
+ checker.on('newRollupVersion', async ({ latestVersion, currentVersion }) => {
264
+ // if node follows canonical rollup then this is equivalent to a config update
265
+ if (!followsCanonicalRollup) {
266
+ return;
267
+ }
268
+
269
+ if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
270
+ logger.info(`New rollup version detected. Please restart the node`, { latestVersion, currentVersion });
271
+ await shutdown(logger.info, signalHandlers);
272
+ } else if (autoUpdateMode === 'notify') {
273
+ logger.warn(`New rollup detected. Please restart the node`, { latestVersion, currentVersion });
274
+ }
275
+ });
276
+
277
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
278
+ checker.on('newNodeVersion', async ({ latestVersion, currentVersion }) => {
279
+ if (autoUpdateMode === 'config-and-version') {
280
+ logger.info(`New node version detected. Please update and restart the node`, { latestVersion, currentVersion });
281
+ await shutdown(logger.info, signalHandlers);
282
+ } else if (autoUpdateMode === 'notify') {
283
+ logger.info(`New node version detected. Please update and restart the node`, { latestVersion, currentVersion });
284
+ }
285
+ });
286
+
287
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
288
+ checker.on('updateNodeConfig', async config => {
289
+ if ((autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') && updateNodeConfig) {
290
+ logger.warn(`Config change detected. Updating node`, config);
291
+ try {
292
+ await updateNodeConfig(config);
293
+ } catch (err) {
294
+ logger.warn('Failed to update config', { err });
295
+ }
296
+ }
297
+ // don't notify on these config changes
298
+ });
299
+
300
+ checker.start();
301
+ }
302
+
303
+ export async function shutdown(logFn: LogFn, cb?: Array<() => Promise<void>>) {
304
+ logFn('Shutting down...');
305
+ if (cb) {
306
+ await Promise.all(cb);
307
+ }
308
+ process.exit(0);
309
+ }