@aztec/aztec 0.0.1-commit.ef17749e1 → 0.0.1-commit.f1b29a41e

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 (50) hide show
  1. package/dest/cli/aztec_start_action.d.ts +1 -1
  2. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  3. package/dest/cli/aztec_start_action.js +12 -5
  4. package/dest/cli/cmds/compile.d.ts +1 -1
  5. package/dest/cli/cmds/compile.d.ts.map +1 -1
  6. package/dest/cli/cmds/compile.js +9 -1
  7. package/dest/cli/cmds/profile_flamegraph.d.ts +1 -1
  8. package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -1
  9. package/dest/cli/cmds/profile_flamegraph.js +2 -1
  10. package/dest/cli/cmds/profile_gates.d.ts +1 -1
  11. package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
  12. package/dest/cli/cmds/profile_gates.js +2 -1
  13. package/dest/cli/cmds/standby.d.ts +10 -5
  14. package/dest/cli/cmds/standby.d.ts.map +1 -1
  15. package/dest/cli/cmds/standby.js +33 -14
  16. package/dest/cli/cmds/start_node.d.ts +1 -1
  17. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  18. package/dest/cli/cmds/start_node.js +7 -1
  19. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  20. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  21. package/dest/cli/cmds/start_prover_broker.js +7 -1
  22. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
  23. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
  24. package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
  25. package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
  26. package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
  27. package/dest/cli/cmds/utils/needs_recompile.js +90 -0
  28. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
  29. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
  30. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +41 -0
  31. package/dest/testing/anvil_test_watcher.js +1 -1
  32. package/dest/testing/cheat_codes.js +1 -1
  33. package/dest/testing/epoch_test_settler.d.ts +1 -1
  34. package/dest/testing/epoch_test_settler.d.ts.map +1 -1
  35. package/dest/testing/epoch_test_settler.js +3 -4
  36. package/package.json +34 -34
  37. package/scripts/aztec.sh +4 -1
  38. package/src/cli/aztec_start_action.ts +7 -5
  39. package/src/cli/cmds/compile.ts +11 -1
  40. package/src/cli/cmds/profile_flamegraph.ts +2 -1
  41. package/src/cli/cmds/profile_gates.ts +2 -1
  42. package/src/cli/cmds/standby.ts +37 -16
  43. package/src/cli/cmds/start_node.ts +8 -1
  44. package/src/cli/cmds/start_prover_broker.ts +8 -1
  45. package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
  46. package/src/cli/cmds/utils/needs_recompile.ts +98 -0
  47. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +54 -0
  48. package/src/testing/anvil_test_watcher.ts +1 -1
  49. package/src/testing/cheat_codes.ts +1 -1
  50. package/src/testing/epoch_test_settler.ts +3 -4
@@ -0,0 +1,41 @@
1
+ import { getPackageVersion } from '@aztec/stdlib/update-checker';
2
+ import TOML from '@iarna/toml';
3
+ import { readFile } from 'fs/promises';
4
+ import { join } from 'path';
5
+ import { collectCrateDirs } from './collect_crate_dirs.js';
6
+ /** Warns if the `aztec` dependency tag in any crate's Nargo.toml doesn't match the CLI version. */ export async function warnIfAztecVersionMismatch(log, cliVersion) {
7
+ const version = cliVersion ?? getPackageVersion();
8
+ if (!version) {
9
+ log(`WARNING: aztec CLI version not found. Skipping dependency compatibility check.`);
10
+ return;
11
+ }
12
+ const expectedTag = `v${version}`;
13
+ const mismatches = [];
14
+ const crateDirs = await collectCrateDirs('.', {
15
+ skipGitDeps: true
16
+ });
17
+ for (const dir of crateDirs){
18
+ const tomlPath = join(dir, 'Nargo.toml');
19
+ let content;
20
+ try {
21
+ content = await readFile(tomlPath, 'utf-8');
22
+ } catch {
23
+ continue;
24
+ }
25
+ const parsed = TOML.parse(content);
26
+ const aztecDep = parsed.dependencies?.aztec;
27
+ if (!aztecDep || typeof aztecDep !== 'object' || typeof aztecDep.tag !== 'string') {
28
+ continue;
29
+ }
30
+ if (aztecDep.tag !== expectedTag) {
31
+ mismatches.push({
32
+ file: tomlPath,
33
+ tag: aztecDep.tag
34
+ });
35
+ }
36
+ }
37
+ if (mismatches.length > 0) {
38
+ const details = mismatches.map((m)=>` ${m.file} (${m.tag})`).join('\n');
39
+ log(`WARNING: Aztec dependency version mismatch detected.\n` + `The following crates have an aztec dependency that does not match the CLI version (${expectedTag}):\n` + `${details}\n\n` + `See https://docs.aztec.network/errors/9 for how to update your dependencies.`);
40
+ }
41
+ }
@@ -101,7 +101,7 @@ import { getAddress, getContract } from 'viem';
101
101
  if (!this.dateProvider) {
102
102
  return;
103
103
  }
104
- const l1Time = await this.cheatcodes.timestamp() * 1000;
104
+ const l1Time = await this.cheatcodes.lastBlockTimestamp() * 1000;
105
105
  const wallTime = this.dateProvider.now();
106
106
  if (l1Time > wallTime) {
107
107
  this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
@@ -55,7 +55,7 @@ import { retryUntil } from '@aztec/foundation/retry';
55
55
  * @param node - The Aztec node used to query if a new block has been mined.
56
56
  * @param duration - The duration to advance time by (in seconds)
57
57
  */ async warpL2TimeAtLeastBy(sequencerClient, node, duration) {
58
- const currentTimestamp = await this.eth.timestamp();
58
+ const currentTimestamp = await this.eth.lastBlockTimestamp();
59
59
  const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
60
60
  await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
61
61
  }
@@ -16,4 +16,4 @@ export declare class EpochTestSettler {
16
16
  stop(): Promise<void>;
17
17
  handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean>;
18
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 @@
1
- {"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAqClE;CACF"}
1
+ {"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAoClE;CACF"}
@@ -1,7 +1,7 @@
1
1
  import { RollupCheatCodes } from '@aztec/ethereum/test';
2
2
  import { SlotNumber } from '@aztec/foundation/branded-types';
3
3
  import { EpochMonitor } from '@aztec/prover-node';
4
- import { computeL2ToL1MembershipWitnessFromMessagesInEpoch } from '@aztec/stdlib/messaging';
4
+ import { computeEpochOutHash } from '@aztec/stdlib/messaging';
5
5
  export class EpochTestSettler {
6
6
  l2BlockSource;
7
7
  log;
@@ -44,9 +44,8 @@ export class EpochTestSettler {
44
44
  }
45
45
  messagesInEpoch[checkpointIndex].push(block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs));
46
46
  }
47
- const [firstMessage] = messagesInEpoch.flat(3);
48
- if (firstMessage) {
49
- const { root: outHash } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, firstMessage);
47
+ const outHash = computeEpochOutHash(messagesInEpoch);
48
+ if (!outHash.isZero()) {
50
49
  await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
51
50
  } else {
52
51
  this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "0.0.1-commit.ef17749e1",
3
+ "version": "0.0.1-commit.f1b29a41e",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -28,39 +28,39 @@
28
28
  "../package.common.json"
29
29
  ],
30
30
  "dependencies": {
31
- "@aztec/accounts": "0.0.1-commit.ef17749e1",
32
- "@aztec/archiver": "0.0.1-commit.ef17749e1",
33
- "@aztec/aztec-faucet": "0.0.1-commit.ef17749e1",
34
- "@aztec/aztec-node": "0.0.1-commit.ef17749e1",
35
- "@aztec/aztec.js": "0.0.1-commit.ef17749e1",
36
- "@aztec/bb-prover": "0.0.1-commit.ef17749e1",
37
- "@aztec/bb.js": "0.0.1-commit.ef17749e1",
38
- "@aztec/blob-client": "0.0.1-commit.ef17749e1",
39
- "@aztec/bot": "0.0.1-commit.ef17749e1",
40
- "@aztec/builder": "0.0.1-commit.ef17749e1",
41
- "@aztec/cli": "0.0.1-commit.ef17749e1",
42
- "@aztec/constants": "0.0.1-commit.ef17749e1",
43
- "@aztec/entrypoints": "0.0.1-commit.ef17749e1",
44
- "@aztec/ethereum": "0.0.1-commit.ef17749e1",
45
- "@aztec/foundation": "0.0.1-commit.ef17749e1",
46
- "@aztec/kv-store": "0.0.1-commit.ef17749e1",
47
- "@aztec/l1-artifacts": "0.0.1-commit.ef17749e1",
48
- "@aztec/node-lib": "0.0.1-commit.ef17749e1",
49
- "@aztec/noir-contracts.js": "0.0.1-commit.ef17749e1",
50
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.ef17749e1",
51
- "@aztec/p2p": "0.0.1-commit.ef17749e1",
52
- "@aztec/p2p-bootstrap": "0.0.1-commit.ef17749e1",
53
- "@aztec/protocol-contracts": "0.0.1-commit.ef17749e1",
54
- "@aztec/prover-client": "0.0.1-commit.ef17749e1",
55
- "@aztec/prover-node": "0.0.1-commit.ef17749e1",
56
- "@aztec/pxe": "0.0.1-commit.ef17749e1",
57
- "@aztec/sequencer-client": "0.0.1-commit.ef17749e1",
58
- "@aztec/stdlib": "0.0.1-commit.ef17749e1",
59
- "@aztec/telemetry-client": "0.0.1-commit.ef17749e1",
60
- "@aztec/txe": "0.0.1-commit.ef17749e1",
61
- "@aztec/validator-ha-signer": "0.0.1-commit.ef17749e1",
62
- "@aztec/wallets": "0.0.1-commit.ef17749e1",
63
- "@aztec/world-state": "0.0.1-commit.ef17749e1",
31
+ "@aztec/accounts": "0.0.1-commit.f1b29a41e",
32
+ "@aztec/archiver": "0.0.1-commit.f1b29a41e",
33
+ "@aztec/aztec-node": "0.0.1-commit.f1b29a41e",
34
+ "@aztec/aztec.js": "0.0.1-commit.f1b29a41e",
35
+ "@aztec/bb-prover": "0.0.1-commit.f1b29a41e",
36
+ "@aztec/bb.js": "0.0.1-commit.f1b29a41e",
37
+ "@aztec/blob-client": "0.0.1-commit.f1b29a41e",
38
+ "@aztec/bot": "0.0.1-commit.f1b29a41e",
39
+ "@aztec/builder": "0.0.1-commit.f1b29a41e",
40
+ "@aztec/cli": "0.0.1-commit.f1b29a41e",
41
+ "@aztec/constants": "0.0.1-commit.f1b29a41e",
42
+ "@aztec/entrypoints": "0.0.1-commit.f1b29a41e",
43
+ "@aztec/ethereum": "0.0.1-commit.f1b29a41e",
44
+ "@aztec/foundation": "0.0.1-commit.f1b29a41e",
45
+ "@aztec/kv-store": "0.0.1-commit.f1b29a41e",
46
+ "@aztec/l1-artifacts": "0.0.1-commit.f1b29a41e",
47
+ "@aztec/node-lib": "0.0.1-commit.f1b29a41e",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.f1b29a41e",
49
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f1b29a41e",
50
+ "@aztec/p2p": "0.0.1-commit.f1b29a41e",
51
+ "@aztec/p2p-bootstrap": "0.0.1-commit.f1b29a41e",
52
+ "@aztec/protocol-contracts": "0.0.1-commit.f1b29a41e",
53
+ "@aztec/prover-client": "0.0.1-commit.f1b29a41e",
54
+ "@aztec/prover-node": "0.0.1-commit.f1b29a41e",
55
+ "@aztec/pxe": "0.0.1-commit.f1b29a41e",
56
+ "@aztec/sequencer-client": "0.0.1-commit.f1b29a41e",
57
+ "@aztec/stdlib": "0.0.1-commit.f1b29a41e",
58
+ "@aztec/telemetry-client": "0.0.1-commit.f1b29a41e",
59
+ "@aztec/txe": "0.0.1-commit.f1b29a41e",
60
+ "@aztec/validator-ha-signer": "0.0.1-commit.f1b29a41e",
61
+ "@aztec/wallets": "0.0.1-commit.f1b29a41e",
62
+ "@aztec/world-state": "0.0.1-commit.f1b29a41e",
63
+ "@iarna/toml": "^2.2.5",
64
64
  "@types/chalk": "^2.2.0",
65
65
  "abitype": "^0.8.11",
66
66
  "chalk": "^5.3.0",
package/scripts/aztec.sh CHANGED
@@ -20,7 +20,10 @@ function aztec {
20
20
 
21
21
  case $cmd in
22
22
  test)
23
- export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract_log"}"
23
+ # Attempt to compile, no-op if there are no changes
24
+ node --no-warnings "$script_dir/../dest/bin/index.js" compile
25
+
26
+ export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract"}"
24
27
  aztec start --txe --port 8081 &
25
28
  server_pid=$!
26
29
  trap 'kill $server_pid &>/dev/null || true' EXIT
@@ -7,7 +7,7 @@ import {
7
7
  } from '@aztec/foundation/json-rpc/server';
8
8
  import type { LogFn, Logger } from '@aztec/foundation/log';
9
9
  import type { ChainConfig } from '@aztec/stdlib/config';
10
- import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
10
+ import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
11
11
  import { getPackageVersion } from '@aztec/stdlib/update-checker';
12
12
  import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
13
13
  import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
@@ -23,14 +23,14 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
23
23
  const signalHandlers: Array<() => Promise<void>> = [];
24
24
  const services: NamespacedApiHandlers = {};
25
25
  const adminServices: NamespacedApiHandlers = {};
26
+ const packageVersion = getPackageVersion();
26
27
  let config: ChainConfig | undefined = undefined;
27
28
 
28
29
  if (options.localNetwork) {
29
- const cliVersion = getPackageVersion() ?? 'unknown';
30
30
  const localNetwork = extractNamespacedOptions(options, 'local-network');
31
31
  localNetwork.testAccounts = true;
32
32
  userLog(`${splash}\n${github}\n\n`);
33
- userLog(`Setting up Aztec local network ${cliVersion}, please stand by...`);
33
+ userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`);
34
34
 
35
35
  const { node, stop } = await createLocalNetwork(
36
36
  {
@@ -50,6 +50,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
50
50
  // Start Node and PXE JSON-RPC server
51
51
  signalHandlers.push(stop);
52
52
  services.node = [node, AztecNodeApiSchema];
53
+ adminServices.node = [node, AztecNodeAdminApiSchema];
53
54
  } else {
54
55
  // Route --prover-node through startNode
55
56
  if (options.proverNode && !options.node) {
@@ -89,13 +90,14 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
89
90
 
90
91
  installSignalHandlers(debugLogger.info, signalHandlers);
91
92
  const versions = getVersions(config);
93
+ const versioningOpts = { packageVersion };
92
94
 
93
95
  // Start the main JSON-RPC server
94
96
  if (Object.entries(services).length > 0) {
95
97
  const rpcServer = createNamespacedSafeJsonRpcServer(services, {
96
98
  http200OnError: false,
97
99
  log: debugLogger,
98
- middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)],
100
+ middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions, versioningOpts)],
99
101
  maxBatchSize: options.rpcMaxBatchSize,
100
102
  maxBodySizeBytes: options.rpcMaxBodySize,
101
103
  });
@@ -105,7 +107,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
105
107
 
106
108
  // If there are any admin services, start a separate JSON-RPC server for them
107
109
  if (Object.entries(adminServices).length > 0) {
108
- const adminMiddlewares = [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)];
110
+ const adminMiddlewares = [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions, versioningOpts)];
109
111
 
110
112
  // Resolve the admin API key (auto-generated and persisted, or opt-out)
111
113
  const apiKeyResolution = await resolveAdminApiKey(
@@ -1,3 +1,4 @@
1
+ import { findBbBinary } from '@aztec/bb.js';
1
2
  import type { LogFn } from '@aztec/foundation/log';
2
3
 
3
4
  import { execFileSync } from 'child_process';
@@ -6,7 +7,9 @@ import { readFile, writeFile } from 'fs/promises';
6
7
  import { join } from 'path';
7
8
 
8
9
  import { readArtifactFiles } from './utils/artifacts.js';
10
+ import { needsRecompile } from './utils/needs_recompile.js';
9
11
  import { run } from './utils/spawn.js';
12
+ import { warnIfAztecVersionMismatch } from './utils/warn_if_aztec_version_mismatch.js';
10
13
 
11
14
  /** Returns paths to contract artifacts in the target directory. */
12
15
  async function collectContractArtifacts(): Promise<string[]> {
@@ -137,8 +140,15 @@ async function checkNoTestsInContracts(nargo: string, log: LogFn): Promise<void>
137
140
 
138
141
  /** Compiles Aztec Noir contracts and postprocesses artifacts. */
139
142
  async function compileAztecContract(nargoArgs: string[], log: LogFn): Promise<void> {
143
+ await warnIfAztecVersionMismatch(log);
144
+
145
+ if (!(await needsRecompile())) {
146
+ log('No source changes detected, skipping compilation.');
147
+ return;
148
+ }
149
+
140
150
  const nargo = process.env.NARGO ?? 'nargo';
141
- const bb = process.env.BB ?? 'bb';
151
+ const bb = process.env.BB ?? findBbBinary() ?? 'bb';
142
152
 
143
153
  await run(nargo, ['compile', ...nargoArgs]);
144
154
 
@@ -1,3 +1,4 @@
1
+ import { findBbBinary } from '@aztec/bb.js';
1
2
  import type { LogFn } from '@aztec/foundation/log';
2
3
 
3
4
  import { readFile, rename, rm, writeFile } from 'fs/promises';
@@ -33,7 +34,7 @@ export async function profileFlamegraph(artifactPath: string, functionName: stri
33
34
  await writeFile(functionArtifact, makeFunctionArtifact(artifact, func));
34
35
 
35
36
  const profiler = process.env.PROFILER_PATH ?? 'noir-profiler';
36
- const bb = process.env.BB ?? 'bb';
37
+ const bb = process.env.BB ?? findBbBinary() ?? 'bb';
37
38
 
38
39
  await run(profiler, [
39
40
  'gates',
@@ -1,3 +1,4 @@
1
+ import { findBbBinary } from '@aztec/bb.js';
1
2
  import { asyncPool } from '@aztec/foundation/async-pool';
2
3
  import type { LogFn } from '@aztec/foundation/log';
3
4
 
@@ -32,7 +33,7 @@ async function getGateCount(bb: string, artifactPath: string): Promise<number> {
32
33
 
33
34
  /** Profiles all compiled artifacts in a target directory and prints gate counts. */
34
35
  export async function profileGates(targetDir: string, log: LogFn): Promise<void> {
35
- const bb = process.env.BB ?? 'bb';
36
+ const bb = process.env.BB ?? findBbBinary() ?? 'bb';
36
37
  const { artifacts, tmpDir } = await discoverArtifacts(targetDir);
37
38
 
38
39
  if (artifacts.length === 0) {
@@ -35,10 +35,33 @@ export async function computeExpectedGenesisRoot(config: GenesisStateConfig, use
35
35
  return { genesisArchiveRoot, prefilledPublicData };
36
36
  }
37
37
 
38
+ async function checkRollupCompatibility(
39
+ rollup: RollupContract,
40
+ expected: { genesisArchiveRoot: Fr; vkTreeRoot: Fr; protocolContractsHash: Fr },
41
+ ): Promise<string[]> {
42
+ const mismatches: string[] = [];
43
+ const [l1Genesis, l1Vk, l1Protocol] = await Promise.all([
44
+ rollup.getGenesisArchiveTreeRoot(),
45
+ rollup.getVkTreeRoot(),
46
+ rollup.getProtocolContractsHash(),
47
+ ]);
48
+ if (!l1Genesis.equals(expected.genesisArchiveRoot)) {
49
+ mismatches.push(`genesis archive root (expected ${expected.genesisArchiveRoot}, got ${l1Genesis})`);
50
+ }
51
+ if (!l1Vk.equals(expected.vkTreeRoot)) {
52
+ mismatches.push(`VK tree root (expected ${expected.vkTreeRoot}, got ${l1Vk})`);
53
+ }
54
+ if (!l1Protocol.equals(expected.protocolContractsHash)) {
55
+ mismatches.push(`protocol contracts hash (expected ${expected.protocolContractsHash}, got ${l1Protocol})`);
56
+ }
57
+ return mismatches;
58
+ }
59
+
38
60
  /**
39
- * Waits until the canonical rollup's genesis archive root matches the expected local genesis root.
40
- * If the rollup is not yet compatible (e.g. during L1 contract upgrades), enters standby mode:
41
- * starts a lightweight HTTP server for K8s liveness probes and polls every 60s until a compatible rollup appears.
61
+ * Waits until the canonical rollup's genesis archive root, VK tree root, and protocol contracts hash
62
+ * all match the expected local values. If the rollup is not yet compatible (e.g. during L1 contract upgrades),
63
+ * enters standby mode: starts a lightweight HTTP server for K8s liveness probes and polls every 60s
64
+ * until a compatible rollup appears.
42
65
  */
43
66
  export async function waitForCompatibleRollup(
44
67
  config: {
@@ -47,7 +70,7 @@ export async function waitForCompatibleRollup(
47
70
  l1Contracts: { registryAddress: EthAddress };
48
71
  rollupVersion?: number;
49
72
  },
50
- expectedGenesisRoot: Fr,
73
+ expected: { genesisArchiveRoot: Fr; vkTreeRoot: Fr; protocolContractsHash: Fr },
51
74
  port: number | undefined,
52
75
  userLog: LogFn,
53
76
  ): Promise<void> {
@@ -58,21 +81,19 @@ export async function waitForCompatibleRollup(
58
81
  const rollupAddress = await registry.getRollupAddress(rollupVersion);
59
82
  const rollup = new RollupContract(publicClient, rollupAddress.toString());
60
83
 
61
- let l1GenesisRoot: Fr;
84
+ let mismatches: string[];
62
85
  try {
63
- l1GenesisRoot = await rollup.getGenesisArchiveTreeRoot();
86
+ mismatches = await checkRollupCompatibility(rollup, expected);
64
87
  } catch (err: any) {
65
- throw new Error(
66
- `Could not retrieve genesis archive root from canonical rollup at ${rollupAddress}: ${err.message}`,
67
- );
88
+ throw new Error(`Could not retrieve rollup config from canonical rollup at ${rollupAddress}: ${err.message}`);
68
89
  }
69
90
 
70
- if (l1GenesisRoot.equals(expectedGenesisRoot)) {
91
+ if (mismatches.length === 0) {
71
92
  return;
72
93
  }
73
94
 
74
95
  userLog(
75
- `Genesis root mismatch: expected ${expectedGenesisRoot}, got ${l1GenesisRoot} from rollup at ${rollupAddress}. ` +
96
+ `Rollup at ${rollupAddress} is incompatible: ${mismatches.join('; ')}. ` +
76
97
  `Entering standby mode. Will poll every ${ROLLUP_POLL_INTERVAL_S}s for a compatible rollup...`,
77
98
  );
78
99
 
@@ -85,20 +106,20 @@ export async function waitForCompatibleRollup(
85
106
  const currentRollupAddress = await registry.getRollupAddress(rollupVersion);
86
107
  const currentRollup = new RollupContract(publicClient, currentRollupAddress.toString());
87
108
 
88
- let currentGenesisRoot: Fr;
109
+ let currentMismatches: string[];
89
110
  try {
90
- currentGenesisRoot = await currentRollup.getGenesisArchiveTreeRoot();
111
+ currentMismatches = await checkRollupCompatibility(currentRollup, expected);
91
112
  } catch {
92
- userLog(`Failed to fetch genesis root from rollup at ${currentRollupAddress}. Retrying...`);
113
+ userLog(`Failed to fetch rollup config from rollup at ${currentRollupAddress}. Retrying...`);
93
114
  return undefined;
94
115
  }
95
116
 
96
- if (currentGenesisRoot.equals(expectedGenesisRoot)) {
117
+ if (currentMismatches.length === 0) {
97
118
  userLog(`Compatible rollup found at ${currentRollupAddress}. Exiting standby mode.`);
98
119
  return true;
99
120
  }
100
121
 
101
- userLog(`Still waiting. Rollup at ${currentRollupAddress} has genesis root ${currentGenesisRoot}.`);
122
+ userLog(`Still waiting. Rollup at ${currentRollupAddress}: ${currentMismatches.join('; ')}.`);
102
123
  return undefined;
103
124
  },
104
125
  'compatible rollup',
@@ -7,6 +7,8 @@ import { type NetworkNames, SecretValue } from '@aztec/foundation/config';
7
7
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
8
8
  import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
9
9
  import type { LogFn } from '@aztec/foundation/log';
10
+ import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
11
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
10
12
  import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
11
13
  import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
12
14
  import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
@@ -92,7 +94,12 @@ export async function startNode(
92
94
 
93
95
  // Wait for a compatible rollup before proceeding with full L1 config fetch.
94
96
  // This prevents crashes when the canonical rollup hasn't been upgraded yet.
95
- await waitForCompatibleRollup(nodeConfig, genesisArchiveRoot, options.port, userLog);
97
+ await waitForCompatibleRollup(
98
+ nodeConfig,
99
+ { genesisArchiveRoot, vkTreeRoot: getVKTreeRoot(), protocolContractsHash },
100
+ options.port,
101
+ userLog,
102
+ );
96
103
 
97
104
  const { addresses, config } = await getL1Config(
98
105
  nodeConfig.l1Contracts.registryAddress,
@@ -2,6 +2,8 @@ import { getL1Config } from '@aztec/cli/config';
2
2
  import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
3
3
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
4
4
  import type { LogFn } from '@aztec/foundation/log';
5
+ import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
6
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
5
7
  import {
6
8
  type ProverBrokerConfig,
7
9
  ProvingJobBrokerSchema,
@@ -38,7 +40,12 @@ export async function startProverBroker(
38
40
 
39
41
  const genesisConfig = getGenesisStateConfigEnvVars();
40
42
  const { genesisArchiveRoot } = await computeExpectedGenesisRoot(genesisConfig, userLog);
41
- await waitForCompatibleRollup(config, genesisArchiveRoot, options.port, userLog);
43
+ await waitForCompatibleRollup(
44
+ config,
45
+ { genesisArchiveRoot, vkTreeRoot: getVKTreeRoot(), protocolContractsHash },
46
+ options.port,
47
+ userLog,
48
+ );
42
49
 
43
50
  const { addresses, config: rollupConfig } = await getL1Config(
44
51
  config.l1Contracts.registryAddress,
@@ -0,0 +1,118 @@
1
+ import TOML from '@iarna/toml';
2
+ import { existsSync } from 'fs';
3
+ import { mkdir, readFile, stat } from 'fs/promises';
4
+ import { homedir } from 'os';
5
+ import { dirname, join, resolve } from 'path';
6
+
7
+ import { run } from './spawn.js';
8
+
9
+ /**
10
+ * Recursively collects crate directories starting from startCrateDir by following dependencies declared in Nargo.toml
11
+ * files.
12
+ *
13
+ * When `skipGitDeps` is false (default), git-based deps are followed and fetched into the nargo cache
14
+ * (`$HOME/nargo/<domain>/<repo-path>/<tag>`) if not already present.
15
+ *
16
+ * When `skipGitDeps` is true, git-based deps are ignored entirely.
17
+ */
18
+ export async function collectCrateDirs(startCrateDir: string, opts?: { skipGitDeps?: boolean }): Promise<string[]> {
19
+ const { skipGitDeps = false } = opts ?? {};
20
+ const visited = new Set<string>();
21
+
22
+ async function visit(crateDir: string): Promise<void> {
23
+ const absDir = resolve(crateDir);
24
+ if (visited.has(absDir)) {
25
+ return;
26
+ }
27
+ visited.add(absDir);
28
+
29
+ const tomlPath = join(absDir, 'Nargo.toml');
30
+ const content = await readFile(tomlPath, 'utf-8').catch(() => {
31
+ throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
32
+ });
33
+
34
+ const parsed = TOML.parse(content) as Record<string, any>;
35
+ const members = (parsed.workspace as Record<string, any>)?.members as string[] | undefined;
36
+
37
+ // A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
38
+ if (Array.isArray(members)) {
39
+ // The crate is a workspace root and has members defined so we visit the members
40
+ for (const member of members) {
41
+ await visit(resolve(absDir, member));
42
+ }
43
+ } else {
44
+ // Single crate — follow its deps
45
+ const deps = (parsed.dependencies as Record<string, any>) ?? {};
46
+ for (const dep of Object.values(deps)) {
47
+ if (!dep || typeof dep !== 'object') {
48
+ continue;
49
+ }
50
+ if (typeof dep.path === 'string') {
51
+ // Dependency contains "path" hence it's a local dependency. We just check it's a real directory and then we
52
+ // recursively search through it
53
+ const depPath = resolve(absDir, dep.path);
54
+ const s = await stat(depPath);
55
+ if (!s.isDirectory()) {
56
+ throw new Error(
57
+ `Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`,
58
+ );
59
+ }
60
+ await visit(depPath);
61
+ } else if (!skipGitDeps && typeof dep.git === 'string' && typeof dep.tag === 'string') {
62
+ // Dependency contains "git" hence it's a git dependency. We ensure it has been fetched and fetch it if
63
+ // it's not the case and then we recursively search through it.
64
+ await fetchAndVisit(dep.git, dep.tag, dep.directory);
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ async function fetchAndVisit(gitUrl: string, tag: string, directory?: string): Promise<void> {
71
+ // `directory` is set when the dep lives in a subdirectory of a repository, e.g.:
72
+ // aztec = { git = "https://github.com/AztecProtocol/aztec-packages", tag = "v0.82.0",
73
+ // directory = "noir-projects/aztec-nr/aztec" }
74
+ // In that case nargo clones the whole repo and the crate root is <cachePath>/<directory>.
75
+ const cachePath = nargoGitDepPath(gitUrl, tag);
76
+ const crateDir = directory ? join(cachePath, directory) : cachePath;
77
+ await ensureGitDepCached(gitUrl, tag, cachePath);
78
+ await visit(crateDir);
79
+ }
80
+
81
+ await visit(startCrateDir);
82
+ return [...visited];
83
+ }
84
+
85
+ /**
86
+ * Computes the local nargo cache path for a git dependency, mirroring nargo's own `git_dep_location` function.
87
+ * Path format: `$HOME/nargo/<domain>/<repo-path>/<tag>`
88
+ * e.g. `~/nargo/github.com/AztecProtocol/aztec-packages/v0.82.0`
89
+ *
90
+ * Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
91
+ */
92
+ export function nargoGitDepPath(gitUrl: string, tag: string): string {
93
+ const url = new URL(gitUrl);
94
+ const domain = url.hostname;
95
+ const repoPath = url.pathname.replace(/^\//, '');
96
+ return join(process.env.HOME ?? homedir(), 'nargo', domain, repoPath, tag);
97
+ }
98
+
99
+ /**
100
+ * Ensures a git dep is present in the nargo cache, cloning it if it isn't. Mirrors nargo's `clone_git_repo`.
101
+ * If cloning fails (e.g. no network), throws with a message suggesting `nargo check` to prime the cache.
102
+ *
103
+ * Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
104
+ */
105
+ async function ensureGitDepCached(gitUrl: string, tag: string, cachePath: string): Promise<void> {
106
+ if (existsSync(cachePath)) {
107
+ return;
108
+ }
109
+ await mkdir(dirname(cachePath), { recursive: true });
110
+ try {
111
+ await run('git', ['-c', 'advice.detachedHead=false', 'clone', '--depth', '1', '--branch', tag, gitUrl, cachePath]);
112
+ } catch (err: any) {
113
+ throw new Error(
114
+ `Failed to fetch git dependency ${gitUrl}@${tag}: ${err?.message ?? err}.\n` +
115
+ `Try running \`nargo check\` first to prime the dependency cache.`,
116
+ );
117
+ }
118
+ }