@aztec/aztec 0.0.1-commit.993d240 → 0.0.1-commit.9a89641

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.
Files changed (75) hide show
  1. package/dest/bin/index.js +2 -0
  2. package/dest/cli/aztec_start_action.d.ts +1 -1
  3. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  4. package/dest/cli/aztec_start_action.js +10 -26
  5. package/dest/cli/aztec_start_options.js +1 -1
  6. package/dest/cli/cmds/compile.d.ts +1 -1
  7. package/dest/cli/cmds/compile.d.ts.map +1 -1
  8. package/dest/cli/cmds/compile.js +25 -17
  9. package/dest/cli/cmds/prover.d.ts +4 -0
  10. package/dest/cli/cmds/prover.d.ts.map +1 -0
  11. package/dest/cli/cmds/prover.js +24 -0
  12. package/dest/cli/cmds/standby.d.ts +28 -2
  13. package/dest/cli/cmds/standby.d.ts.map +1 -1
  14. package/dest/cli/cmds/standby.js +45 -2
  15. package/dest/cli/cmds/start_bot.d.ts +1 -1
  16. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  17. package/dest/cli/cmds/start_bot.js +5 -1
  18. package/dest/cli/cmds/start_node.d.ts +1 -1
  19. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  20. package/dest/cli/cmds/start_node.js +14 -23
  21. package/dest/cli/cmds/utils/artifacts.d.ts +6 -1
  22. package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -1
  23. package/dest/cli/util.d.ts +10 -5
  24. package/dest/cli/util.d.ts.map +1 -1
  25. package/dest/cli/util.js +20 -49
  26. package/dest/examples/token.js +3 -3
  27. package/dest/local-network/auth_registry.d.ts +3 -2
  28. package/dest/local-network/auth_registry.d.ts.map +1 -1
  29. package/dest/local-network/auth_registry.js +5 -3
  30. package/dest/local-network/banana_fpc.d.ts +3 -2
  31. package/dest/local-network/banana_fpc.d.ts.map +1 -1
  32. package/dest/local-network/banana_fpc.js +5 -3
  33. package/dest/local-network/local-network.d.ts +6 -5
  34. package/dest/local-network/local-network.d.ts.map +1 -1
  35. package/dest/local-network/local-network.js +43 -78
  36. package/dest/testing/cheat_codes.d.ts +16 -23
  37. package/dest/testing/cheat_codes.d.ts.map +1 -1
  38. package/dest/testing/cheat_codes.js +20 -82
  39. package/dest/testing/epoch_test_settler.d.ts +2 -2
  40. package/dest/testing/epoch_test_settler.d.ts.map +1 -1
  41. package/dest/testing/epoch_test_settler.js +5 -26
  42. package/dest/testing/index.d.ts +2 -2
  43. package/dest/testing/index.d.ts.map +1 -1
  44. package/dest/testing/index.js +1 -1
  45. package/dest/testing/local-network.d.ts +51 -0
  46. package/dest/testing/local-network.d.ts.map +1 -0
  47. package/dest/testing/local-network.js +60 -0
  48. package/dest/testing/token_allowed_setup.d.ts +9 -4
  49. package/dest/testing/token_allowed_setup.d.ts.map +1 -1
  50. package/dest/testing/token_allowed_setup.js +12 -8
  51. package/package.json +34 -34
  52. package/scripts/templates/counter/contract/src/main.nr +4 -4
  53. package/src/bin/index.ts +2 -0
  54. package/src/cli/aztec_start_action.ts +8 -13
  55. package/src/cli/aztec_start_options.ts +1 -1
  56. package/src/cli/cmds/compile.ts +29 -16
  57. package/src/cli/cmds/prover.ts +42 -0
  58. package/src/cli/cmds/standby.ts +55 -3
  59. package/src/cli/cmds/start_bot.ts +6 -1
  60. package/src/cli/cmds/start_node.ts +17 -23
  61. package/src/cli/cmds/utils/artifacts.ts +5 -0
  62. package/src/cli/util.ts +21 -62
  63. package/src/examples/token.ts +11 -3
  64. package/src/local-network/auth_registry.ts +8 -3
  65. package/src/local-network/banana_fpc.ts +9 -2
  66. package/src/local-network/local-network.ts +48 -89
  67. package/src/testing/cheat_codes.ts +19 -103
  68. package/src/testing/epoch_test_settler.ts +8 -30
  69. package/src/testing/index.ts +1 -1
  70. package/src/testing/local-network.ts +97 -0
  71. package/src/testing/token_allowed_setup.ts +15 -8
  72. package/dest/testing/anvil_test_watcher.d.ts +0 -54
  73. package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
  74. package/dest/testing/anvil_test_watcher.js +0 -235
  75. package/src/testing/anvil_test_watcher.ts +0 -273
@@ -12,8 +12,8 @@ import { needsRecompile } from './utils/needs_recompile.js';
12
12
  import { run } from './utils/spawn.js';
13
13
  import { warnIfAztecVersionMismatch } from './utils/warn_if_aztec_version_mismatch.js';
14
14
 
15
- /** Returns paths to contract artifacts in the target directory. */
16
- async function collectContractArtifacts(): Promise<string[]> {
15
+ /** Returns contract artifacts in the target directory along with whether each has already been postprocessed. */
16
+ async function collectContractArtifacts(): Promise<ContractArtifactInfo[]> {
17
17
  let files;
18
18
  try {
19
19
  files = await readArtifactFiles('target');
@@ -23,7 +23,9 @@ async function collectContractArtifacts(): Promise<string[]> {
23
23
  }
24
24
  throw err;
25
25
  }
26
- return files.filter(f => Array.isArray(f.content.functions)).map(f => f.filePath);
26
+ return files
27
+ .filter(f => Array.isArray(f.content.functions))
28
+ .map(f => ({ filePath: f.filePath, transpiled: f.content.transpiled === true }));
27
29
  }
28
30
 
29
31
  /** Stamps the Aztec stack version into the contract artifacts. */
@@ -141,30 +143,34 @@ async function checkNoTestsInContracts(nargo: string, log: LogFn): Promise<void>
141
143
  async function compileAztecContract(nargoArgs: string[], log: LogFn): Promise<void> {
142
144
  await warnIfAztecVersionMismatch(log);
143
145
 
144
- if (!(await needsRecompile())) {
145
- log('No source changes detected, skipping compilation.');
146
- return;
147
- }
148
-
149
146
  const nargo = process.env.NARGO ?? 'nargo';
150
147
  const bb = process.env.BB ?? findBbBinary() ?? 'bb';
151
148
 
152
- await run(nargo, ['compile', ...nargoArgs]);
149
+ const shouldRecompile = await needsRecompile();
150
+ if (shouldRecompile) {
151
+ await run(nargo, ['compile', ...nargoArgs]);
153
152
 
154
- // Ensure contract crates contain no tests (tests belong in the test crate).
155
- await checkNoTestsInContracts(nargo, log);
153
+ // Ensure contract crates contain no tests (tests belong in the test crate).
154
+ await checkNoTestsInContracts(nargo, log);
155
+ }
156
156
 
157
- const artifacts = await collectContractArtifacts();
157
+ // Postprocess any untranspiled artifacts: those just produced by nargo above, and any left behind by a bare
158
+ // `nargo compile` run outside `aztec compile`.
159
+ const unprocessed = (await collectContractArtifacts()).filter(a => !a.transpiled).map(a => a.filePath);
158
160
 
159
- if (artifacts.length > 0) {
161
+ if (unprocessed.length > 0) {
160
162
  log('Postprocessing contracts...');
161
- const bbArgs = artifacts.flatMap(a => ['-i', a]);
163
+ const bbArgs = unprocessed.flatMap(a => ['-i', a]);
162
164
  await run(bb, ['aztec_process', ...bbArgs]);
163
165
 
164
- await stampAztecVersion(artifacts);
166
+ await stampAztecVersion(unprocessed);
165
167
  }
166
168
 
167
- log('Compilation complete!');
169
+ if (shouldRecompile || unprocessed.length > 0) {
170
+ log('Compilation complete!');
171
+ } else {
172
+ log('No source changes detected, skipping compilation.');
173
+ }
168
174
  }
169
175
 
170
176
  export function injectCompileCommand(program: Command, log: LogFn): Command {
@@ -190,3 +196,10 @@ export function injectCompileCommand(program: Command, log: LogFn): Command {
190
196
 
191
197
  return program;
192
198
  }
199
+
200
+ interface ContractArtifactInfo {
201
+ /** Path to the artifact JSON in the target directory. */
202
+ filePath: string;
203
+ /** Whether the artifact has already been transpiled and had its verification keys generated. */
204
+ transpiled: boolean;
205
+ }
@@ -0,0 +1,42 @@
1
+ import { jsonStringify } from '@aztec/foundation/json-rpc';
2
+ import type { LogFn } from '@aztec/foundation/log';
3
+ import { createProverNodeAdminClient } from '@aztec/stdlib/interfaces/server';
4
+
5
+ import { type Command, InvalidArgumentError } from 'commander';
6
+
7
+ function parseEpoch(value: string): number {
8
+ const parsed = Number(value);
9
+ if (!Number.isInteger(parsed) || parsed < 0) {
10
+ throw new InvalidArgumentError('Epoch must be a non-negative integer.');
11
+ }
12
+ return parsed;
13
+ }
14
+
15
+ export function injectProverCommand(program: Command, log: LogFn): Command {
16
+ const proverCommand = program.command('prover').description('Operate a prover node via its admin JSON-RPC endpoint');
17
+
18
+ proverCommand
19
+ .command('start-proof')
20
+ .description('Schedules proving for the given epoch')
21
+ .requiredOption('--epoch <n>', 'Epoch number to prove', parseEpoch)
22
+ .requiredOption('--admin-url <url>', 'URL of the prover node admin JSON-RPC endpoint')
23
+ .option('--api-key <key>', 'Admin API key', process.env.AZTEC_ADMIN_API_KEY)
24
+ .action(async options => {
25
+ const client = createProverNodeAdminClient(options.adminUrl, {}, undefined, options.apiKey);
26
+ const jobId = await client.startProof(options.epoch);
27
+ log(`Started proving job ${jobId} for epoch ${options.epoch}`);
28
+ });
29
+
30
+ proverCommand
31
+ .command('get-jobs')
32
+ .description('Lists the prover node proving jobs')
33
+ .requiredOption('--admin-url <url>', 'URL of the prover node admin JSON-RPC endpoint')
34
+ .option('--api-key <key>', 'Admin API key', process.env.AZTEC_ADMIN_API_KEY)
35
+ .action(async options => {
36
+ const client = createProverNodeAdminClient(options.adminUrl, {}, undefined, options.apiKey);
37
+ const jobs = await client.getJobs();
38
+ log(jsonStringify(jobs, true));
39
+ });
40
+
41
+ return program;
42
+ }
@@ -6,13 +6,16 @@ import type { GenesisStateConfig } from '@aztec/ethereum/config';
6
6
  import { RegistryContract, RollupContract } from '@aztec/ethereum/contracts';
7
7
  import type { EthAddress } from '@aztec/foundation/eth-address';
8
8
  import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
9
- import type { LogFn } from '@aztec/foundation/log';
9
+ import { type LogFn, createLogger } from '@aztec/foundation/log';
10
10
  import { retryUntil } from '@aztec/foundation/retry';
11
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
+ import type { VersionCheck } from '@aztec/stdlib/update-checker';
12
13
  import { getGenesisValues } from '@aztec/world-state/testing';
13
14
 
14
15
  import Koa from 'koa';
15
16
 
17
+ import { isShuttingDown, softShutdown } from '../util.js';
18
+
16
19
  const ROLLUP_POLL_INTERVAL_S = 60;
17
20
 
18
21
  /**
@@ -23,7 +26,7 @@ const ROLLUP_POLL_INTERVAL_S = 60;
23
26
  export async function computeExpectedGenesisRoot(config: GenesisStateConfig, userLog: LogFn) {
24
27
  const testAccounts = config.testAccounts ? (await getInitialTestAccountsData()).map(a => a.address) : [];
25
28
  const sponsoredFPCAccounts = config.sponsoredFPC ? [await getSponsoredFPCAddress()] : [];
26
- const prefundAddresses = (config.prefundAddresses ?? []).map(a => AztecAddress.fromString(a));
29
+ const prefundAddresses = (config.prefundAddresses ?? []).map(a => AztecAddress.fromStringUnsafe(a));
27
30
  const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts).concat(prefundAddresses);
28
31
 
29
32
  userLog(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
@@ -35,7 +38,12 @@ export async function computeExpectedGenesisRoot(config: GenesisStateConfig, use
35
38
  return { genesisArchiveRoot, genesis };
36
39
  }
37
40
 
38
- async function checkRollupCompatibility(
41
+ /**
42
+ * Compares the rollup's on-chain protocol constants (genesis archive root, VK tree root, protocol
43
+ * contracts hash) against the node's expected local values. Returns a list of human-readable mismatch
44
+ * descriptions, empty if the rollup is compatible.
45
+ */
46
+ export async function checkRollupCompatibility(
39
47
  rollup: RollupContract,
40
48
  expected: { genesisArchiveRoot: Fr; vkTreeRoot: Fr; protocolContractsHash: Fr },
41
49
  ): Promise<string[]> {
@@ -130,3 +138,47 @@ export async function waitForCompatibleRollup(
130
138
  await new Promise<void>((resolve, reject) => standbyServer.close(err => (err ? reject(err) : resolve())));
131
139
  }
132
140
  }
141
+
142
+ /**
143
+ * Polls the canonical rollup's protocol constants every 10 minutes and soft-shuts-down the node once they
144
+ * diverge from the node's expected local values (i.e. an incompatible rollup has become canonical on L1).
145
+ * The HTTP health server is left running so K8s probes keep passing on the wound-down pod. This is the
146
+ * inverse of {@link waitForCompatibleRollup}; it should only be set up for nodes following the canonical
147
+ * rollup. Reuses the {@link checkRollupCompatibility} diff and the generic VersionChecker poll primitive.
148
+ */
149
+ export async function setupAutoShutdown(
150
+ config: { l1RpcUrls: string[]; l1ChainId: number },
151
+ registryAddress: EthAddress,
152
+ rollupVersion: number | 'canonical',
153
+ expected: { genesisArchiveRoot: Fr; vkTreeRoot: Fr; protocolContractsHash: Fr },
154
+ signalHandlers: Array<() => Promise<void>>,
155
+ ): Promise<void> {
156
+ const { VersionChecker } = await import('@aztec/stdlib/update-checker');
157
+
158
+ const logger = createLogger('auto_shutdown');
159
+ const publicClient = getPublicClient(config);
160
+ const registry = new RegistryContract(publicClient, registryAddress);
161
+
162
+ const check: VersionCheck = {
163
+ name: 'rollup',
164
+ currentVersion: 'compatible',
165
+ getLatestVersion: async () => {
166
+ const rollupAddress = await registry.getRollupAddress(rollupVersion);
167
+ const rollup = new RollupContract(publicClient, rollupAddress.toString());
168
+ const mismatches = await checkRollupCompatibility(rollup, expected);
169
+ return mismatches.length === 0 ? 'compatible' : `incompatible: ${mismatches.join('; ')}`;
170
+ },
171
+ };
172
+
173
+ const checker = new VersionChecker([check], 600_000, logger);
174
+ checker.on('newVersion', ({ latestVersion }) => {
175
+ if (isShuttingDown()) {
176
+ return;
177
+ }
178
+ logger.warn('Canonical rollup is no longer compatible; auto-shutting down node', { latestVersion });
179
+ // softShutdown never rejects (it awaits handlers via allSettled); fire-and-forget from the listener.
180
+ void softShutdown(logger.info.bind(logger), signalHandlers);
181
+ });
182
+ checker.start();
183
+ signalHandlers.push(() => checker.stop());
184
+ }
@@ -56,6 +56,11 @@ export async function addBot(
56
56
  const config = extractRelevantOptions<BotConfig>(options, botConfigMappings, 'bot');
57
57
  userLog?.(`Starting bot with config ${stringifyConfig(config)}`);
58
58
 
59
+ // The bot wallet's embedded PXE syncs to this tip (see start_bot.ts/start_node.ts which build the wallet from the
60
+ // same options). L1-to-L2 readiness checks must be evaluated at this tip rather than at 'latest', or the bot can
61
+ // consider a message ready while the PXE simulation anchors to an older block that cannot prove its membership yet.
62
+ const { syncChainTip } = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
63
+
59
64
  const db = await (config.dataDirectory
60
65
  ? createStore('bot', BotStore.SCHEMA_VERSION, config)
61
66
  : openTmpStore('bot', true, config.dataStoreMapSizeKb));
@@ -63,7 +68,7 @@ export async function addBot(
63
68
  const store = new BotStore(db);
64
69
  await store.cleanupOldClaims();
65
70
 
66
- const botRunner = new BotRunner(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store);
71
+ const botRunner = new BotRunner(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store, syncChainTip);
67
72
  if (!config.noStart) {
68
73
  void botRunner.start(); // Do not block since bot setup takes time
69
74
  }
@@ -1,7 +1,11 @@
1
- import { type AztecNodeConfig, aztecNodeConfigMappings, getConfigEnvVars } from '@aztec/aztec-node';
1
+ import {
2
+ type AztecNodeConfig,
3
+ aztecNodeConfigMappings,
4
+ getConfigEnvVars,
5
+ registerAztecNodeRpcHandlers,
6
+ } from '@aztec/aztec-node';
2
7
  import { Fr } from '@aztec/aztec.js/fields';
3
8
  import { getL1Config } from '@aztec/cli/config';
4
- import { getPublicClient } from '@aztec/ethereum/client';
5
9
  import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
6
10
  import { type NetworkNames, SecretValue } from '@aztec/foundation/config';
7
11
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
@@ -15,8 +19,7 @@ import {
15
19
  proverBrokerBackoff,
16
20
  } from '@aztec/prover-client/broker';
17
21
  import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
18
- import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
19
- import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
22
+ import { ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
20
23
  import {
21
24
  type TelemetryClientConfig,
22
25
  initTelemetryClient,
@@ -26,14 +29,9 @@ import {
26
29
  import { EmbeddedWallet } from '@aztec/wallets/embedded';
27
30
 
28
31
  import { createAztecNode } from '../../local-network/index.js';
29
- import {
30
- extractNamespacedOptions,
31
- extractRelevantOptions,
32
- preloadCrsDataForVerifying,
33
- setupVersionChecker,
34
- } from '../util.js';
32
+ import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying } from '../util.js';
35
33
  import { getVersions } from '../versioning.js';
36
- import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
34
+ import { computeExpectedGenesisRoot, setupAutoShutdown, waitForCompatibleRollup } from './standby.js';
37
35
  import { startProverBroker } from './start_prover_broker.js';
38
36
 
39
37
  export async function startNode(
@@ -156,15 +154,12 @@ export async function startNode(
156
154
  // Create and start Aztec Node
157
155
  const node = await createAztecNode(nodeConfig, { telemetry, proverBroker: broker }, { genesis });
158
156
 
159
- // Add node and p2p to services list
160
- services.node = [node, AztecNodeApiSchema];
161
- services.p2p = [node.getP2P(), P2PApiSchema];
162
- adminServices.nodeAdmin = [node, AztecNodeAdminApiSchema];
157
+ registerAztecNodeRpcHandlers(node, services, adminServices, { debug: options.nodeDebug });
163
158
 
164
159
  // Register prover-node services if the prover node subsystem is running
165
160
  const proverNode = node.getProverNode();
166
161
  if (proverNode) {
167
- services.prover = [proverNode, ProverNodeApiSchema];
162
+ adminServices.prover = [proverNode, ProverNodeApiSchema];
168
163
  if (!nodeConfig.proverBrokerUrl) {
169
164
  services.provingJobSource = [proverNode.getProver().getProvingJobSource(), ProvingJobConsumerSchema];
170
165
  }
@@ -183,15 +178,14 @@ export async function startNode(
183
178
  await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
184
179
  }
185
180
 
186
- if (nodeConfig.enableVersionCheck && networkName !== 'local') {
187
- const cacheDir = process.env.DATA_DIRECTORY ? `${process.env.DATA_DIRECTORY}/cache` : undefined;
181
+ if (nodeConfig.enableAutoShutdown && networkName !== 'local' && followsCanonicalRollup) {
188
182
  try {
189
- await setupVersionChecker(
190
- networkName,
191
- followsCanonicalRollup,
192
- getPublicClient(nodeConfig!),
183
+ await setupAutoShutdown(
184
+ nodeConfig,
185
+ nodeConfig.registryAddress,
186
+ (nodeConfig.rollupVersion as number | 'canonical') ?? 'canonical',
187
+ { genesisArchiveRoot, vkTreeRoot: getVKTreeRoot(), protocolContractsHash },
193
188
  signalHandlers,
194
- cacheDir,
195
189
  );
196
190
  } catch {
197
191
  /* no-op */
@@ -6,6 +6,11 @@ export interface CompiledArtifact {
6
6
  file_map: unknown;
7
7
  functions: ContractFunction[];
8
8
  bytecode?: string;
9
+ /**
10
+ * Set to true by the AVM transpiler (invoked via `bb aztec_process`) once the contract has been transpiled and its
11
+ * verification keys generated. Absent on raw `nargo compile` output, hence optional.
12
+ */
13
+ transpiled?: boolean;
9
14
  }
10
15
 
11
16
  export interface ContractFunction {
package/src/cli/util.ts CHANGED
@@ -1,18 +1,13 @@
1
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
2
2
  import type { AccountManager } from '@aztec/aztec.js/wallet';
3
- import { getNetworkConfig } from '@aztec/cli/config';
4
- import { RegistryContract } from '@aztec/ethereum/contracts';
5
- import type { ViemClient } from '@aztec/ethereum/types';
6
- import type { ConfigMappingsType, NetworkNames } from '@aztec/foundation/config';
3
+ import type { ConfigMappingsType } from '@aztec/foundation/config';
7
4
  import { jsonStringify } from '@aztec/foundation/json-rpc';
8
- import { type LogFn, createLogger } from '@aztec/foundation/log';
5
+ import type { LogFn } from '@aztec/foundation/log';
9
6
  import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
10
- import { type VersionCheck, getPackageVersion } from '@aztec/stdlib/update-checker';
11
7
  import type { EmbeddedWallet } from '@aztec/wallets/embedded';
12
8
 
13
9
  import chalk from 'chalk';
14
10
  import type { Command } from 'commander';
15
- import type { Hex } from 'viem';
16
11
 
17
12
  import { type AztecStartOption, aztecStartOptions } from './aztec_start_options.js';
18
13
 
@@ -51,6 +46,24 @@ export function isShuttingDown(): boolean {
51
46
  return shutdownPromise !== undefined;
52
47
  }
53
48
 
49
+ /**
50
+ * Stops the node's subsystems (via the registered signal handlers) without exiting the process, leaving
51
+ * the HTTP health server listening so K8s liveness/readiness probes keep passing. Unlike {@link shutdown}
52
+ * this deliberately does not latch `shutdownPromise` or call `process.exit`; instead it re-arms
53
+ * SIGTERM/SIGINT so a later K8s pod deletion still terminates the wound-down pod with a clean exit.
54
+ */
55
+ export async function softShutdown(logFn: LogFn, signalHandlers: Array<() => Promise<void>>): Promise<void> {
56
+ logFn('Canonical rollup upgrade detected: stopping subsystems, health server stays up.', {
57
+ exitCode: ExitCode.ROLLUP_UPGRADE,
58
+ });
59
+ await Promise.allSettled(signalHandlers.map(fn => fn()));
60
+ for (const sig of ['SIGTERM', 'SIGINT'] as const) {
61
+ process.removeAllListeners(sig);
62
+ process.once(sig, () => process.exit(ExitCode.ROLLUP_UPGRADE));
63
+ }
64
+ logFn('Subsystems stopped due to rollup upgrade. Health server remains active.');
65
+ }
66
+
54
67
  export const installSignalHandlers = (logFn: LogFn, cb?: Array<() => Promise<void>>) => {
55
68
  const signals = [
56
69
  ['SIGINT', ExitCode.SIGINT],
@@ -81,7 +94,7 @@ export async function createAccountLogs(accountManagers: AccountManager[], walle
81
94
  if (registeredAccounts.find(a => a.item.equals(completeAddress.address))) {
82
95
  accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
83
96
  accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
84
- accountLogStrings.push(` Secret Key: ${account.getSecretKey().toString()}\n`);
97
+ accountLogStrings.push(` Secret Key: ${accountManager.getSecretKey().toString()}\n`);
85
98
  accountLogStrings.push(` Master nullifier public key hash: ${completeAddress.publicKeys.npkMHash.toString()}\n`);
86
99
  accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.ivpkM.toString()}\n\n`);
87
100
  accountLogStrings.push(
@@ -291,60 +304,6 @@ export async function preloadCrsDataForServerSideProving(
291
304
  }
292
305
  }
293
306
 
294
- export async function setupVersionChecker(
295
- network: NetworkNames,
296
- followsCanonicalRollup: boolean,
297
- publicClient: ViemClient,
298
- signalHandlers: Array<() => Promise<void>>,
299
- cacheDir?: string,
300
- ): Promise<void> {
301
- const networkConfig = await getNetworkConfig(network, cacheDir);
302
- if (!networkConfig) {
303
- return;
304
- }
305
-
306
- const { VersionChecker } = await import('@aztec/stdlib/update-checker');
307
-
308
- const logger = createLogger('version_check');
309
- const registry = new RegistryContract(publicClient, networkConfig.registryAddress as Hex);
310
-
311
- const checks: Array<VersionCheck> = [];
312
- checks.push({
313
- name: 'node',
314
- currentVersion: getPackageVersion(),
315
- getLatestVersion: async () => {
316
- const cfg = await getNetworkConfig(network, cacheDir);
317
- return cfg?.nodeVersion;
318
- },
319
- });
320
-
321
- if (followsCanonicalRollup) {
322
- const getLatestVersion = async () => {
323
- const version = (await registry.getRollupVersions()).at(-1);
324
- return version !== undefined ? String(version) : undefined;
325
- };
326
- const currentVersion = await getLatestVersion();
327
- if (currentVersion !== undefined) {
328
- checks.push({
329
- name: 'rollup',
330
- currentVersion,
331
- getLatestVersion,
332
- });
333
- }
334
- }
335
-
336
- const checker = new VersionChecker(checks, 600_000, logger);
337
- checker.on('newVersion', ({ name, latestVersion, currentVersion }) => {
338
- if (isShuttingDown()) {
339
- return;
340
- }
341
-
342
- logger.warn(`New ${name} version available`, { latestVersion, currentVersion });
343
- });
344
- checker.start();
345
- signalHandlers.push(() => checker.stop());
346
- }
347
-
348
307
  export function stringifyConfig(config: object): string {
349
308
  return Object.entries(config)
350
309
  .map(([key, value]) => `${key}=${jsonStringify(value)}`)
@@ -21,10 +21,18 @@ async function main() {
21
21
 
22
22
  const wallet = await EmbeddedWallet.create(node);
23
23
 
24
- // During local network setup we deploy a few accounts. Below we add them to our wallet.
24
+ // During local network setup we create a few initializerless accounts. Below we add them to our wallet.
25
25
  const [aliceInitialAccountData, bobInitialAccountData] = await getInitialTestAccountsData();
26
- await wallet.createSchnorrAccount(aliceInitialAccountData.secret, aliceInitialAccountData.salt);
27
- await wallet.createSchnorrAccount(bobInitialAccountData.secret, bobInitialAccountData.salt);
26
+ await wallet.createSchnorrInitializerlessAccount(
27
+ aliceInitialAccountData.secret,
28
+ aliceInitialAccountData.salt,
29
+ aliceInitialAccountData.signingKey,
30
+ );
31
+ await wallet.createSchnorrInitializerlessAccount(
32
+ bobInitialAccountData.secret,
33
+ bobInitialAccountData.salt,
34
+ bobInitialAccountData.signingKey,
35
+ );
28
36
 
29
37
  const alice = aliceInitialAccountData.address;
30
38
  const bob = bobInitialAccountData.address;
@@ -1,14 +1,19 @@
1
+ import type { WaitOpts } from '@aztec/aztec.js/contracts';
1
2
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
2
3
  import type { Wallet } from '@aztec/aztec.js/wallet';
3
4
  import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
4
5
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
6
 
6
- export async function publishStandardAuthRegistry(wallet: Wallet, from: AztecAddress): Promise<void> {
7
+ export async function publishStandardAuthRegistry(
8
+ wallet: Wallet,
9
+ from: AztecAddress,
10
+ waitOpts?: WaitOpts,
11
+ ): Promise<void> {
7
12
  const { instance, contractClass } = await getStandardAuthRegistry();
8
13
  if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
9
- await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
14
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from, wait: waitOpts });
10
15
  }
11
16
  if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
12
- await publishInstance(wallet, instance).send({ from });
17
+ await publishInstance(wallet, instance).send({ from, wait: waitOpts });
13
18
  }
14
19
  }
@@ -1,4 +1,5 @@
1
1
  import { type InitialAccountData, getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import type { WaitOpts } from '@aztec/aztec.js/contracts';
2
3
  import type { Wallet } from '@aztec/aztec.js/wallet';
3
4
  import { Fr } from '@aztec/foundation/curves/bn254';
4
5
  import type { LogFn } from '@aztec/foundation/log';
@@ -45,16 +46,22 @@ export async function getBananaFPCAddress(initialAccounts: InitialAccountData[])
45
46
  return (await getBananaFPCInstance(initialAccounts)).address;
46
47
  }
47
48
 
48
- export async function setupBananaFPC(initialAccounts: InitialAccountData[], wallet: Wallet, log: LogFn) {
49
+ export async function setupBananaFPC(
50
+ initialAccounts: InitialAccountData[],
51
+ wallet: Wallet,
52
+ log: LogFn,
53
+ waitOpts?: WaitOpts,
54
+ ) {
49
55
  const bananaCoinAddress = await getBananaCoinAddress(initialAccounts);
50
56
  const admin = getBananaAdmin(initialAccounts);
51
57
  const [{ contract: bananaCoin }, { contract: fpc }] = await Promise.all([
52
58
  TokenContract.deploy(wallet, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal, {
53
59
  salt: BANANA_COIN_SALT,
54
60
  universalDeploy: true,
55
- }).send({ from: admin }),
61
+ }).send({ from: admin, wait: waitOpts }),
56
62
  FPCContract.deploy(wallet, bananaCoinAddress, admin, { salt: BANANA_FPC_SALT, universalDeploy: true }).send({
57
63
  from: admin,
64
+ wait: waitOpts,
58
65
  }),
59
66
  ]);
60
67