@aztec/aztec 0.0.1-commit.3e3d0c9cd → 0.0.1-commit.3f5453c7b

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 (47) 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 +11 -1
  4. package/dest/cli/aztec_start_options.d.ts +1 -1
  5. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  6. package/dest/cli/aztec_start_options.js +7 -0
  7. package/dest/cli/cmds/compile.d.ts +1 -1
  8. package/dest/cli/cmds/compile.d.ts.map +1 -1
  9. package/dest/cli/cmds/compile.js +2 -0
  10. package/dest/cli/cmds/standby.d.ts +1 -1
  11. package/dest/cli/cmds/standby.js +2 -2
  12. package/dest/cli/cmds/start_node.d.ts +1 -1
  13. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  14. package/dest/cli/cmds/start_node.js +6 -20
  15. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  16. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  17. package/dest/cli/cmds/start_prover_agent.js +3 -15
  18. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
  19. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
  20. package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
  21. package/dest/cli/cmds/utils/needs_recompile.d.ts +1 -1
  22. package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -1
  23. package/dest/cli/cmds/utils/needs_recompile.js +9 -53
  24. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
  25. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
  26. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +41 -0
  27. package/dest/local-network/local-network.d.ts +3 -4
  28. package/dest/local-network/local-network.d.ts.map +1 -1
  29. package/dest/local-network/local-network.js +3 -3
  30. package/dest/testing/anvil_test_watcher.js +1 -1
  31. package/dest/testing/cheat_codes.d.ts +11 -15
  32. package/dest/testing/cheat_codes.d.ts.map +1 -1
  33. package/dest/testing/cheat_codes.js +34 -32
  34. package/package.json +33 -33
  35. package/scripts/aztec.sh +1 -1
  36. package/src/cli/aztec_start_action.ts +5 -1
  37. package/src/cli/aztec_start_options.ts +7 -0
  38. package/src/cli/cmds/compile.ts +3 -0
  39. package/src/cli/cmds/standby.ts +2 -2
  40. package/src/cli/cmds/start_node.ts +9 -11
  41. package/src/cli/cmds/start_prover_agent.ts +3 -6
  42. package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
  43. package/src/cli/cmds/utils/needs_recompile.ts +8 -61
  44. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +54 -0
  45. package/src/local-network/local-network.ts +5 -5
  46. package/src/testing/anvil_test_watcher.ts +1 -1
  47. package/src/testing/cheat_codes.ts +42 -36
@@ -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`);
@@ -1,7 +1,6 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
2
  import type { DateProvider } from '@aztec/foundation/timer';
3
- import type { SequencerClient } from '@aztec/sequencer-client';
4
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
+ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
5
4
  /**
6
5
  * A class that provides utility functions for interacting with the chain.
7
6
  * @deprecated There used to be 3 kinds of cheat codes: eth, rollup and aztec. We have nuked the Aztec ones because
@@ -13,6 +12,7 @@ export declare class CheatCodes {
13
12
  eth: EthCheatCodes;
14
13
  /** Cheat codes for the Aztec Rollup contract on L1. */
15
14
  rollup: RollupCheatCodes;
15
+ private logger;
16
16
  constructor(
17
17
  /** Cheat codes for L1.*/
18
18
  eth: EthCheatCodes,
@@ -21,23 +21,19 @@ export declare class CheatCodes {
21
21
  static create(rpcUrls: string[], node: AztecNode, dateProvider: DateProvider): Promise<CheatCodes>;
22
22
  /**
23
23
  * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
24
- * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
25
- * by the slot number, which advances in fixed intervals.
26
- * This is useful for testing time-dependent contract behavior.
27
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
28
- * @param node - The Aztec node used to query if a new block has been mined.
24
+ * the target timestamp. If the target timestamp falls within the current L2 slot (which already has a block),
25
+ * the timestamp is automatically adjusted forward to the start of the next slot so that `mineBlock()` succeeds.
26
+ * @param node - The Aztec node used to force an empty block to be mined.
29
27
  * @param targetTimestamp - The target timestamp to warp to (in seconds)
30
28
  */
31
- warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number): Promise<void>;
29
+ warpL2TimeAtLeastTo(node: AztecNodeDebug, targetTimestamp: bigint | number): Promise<void>;
32
30
  /**
33
31
  * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
34
- * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
35
- * number, which advances in fixed intervals.
36
- * This is useful for testing time-dependent contract behavior.
37
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
38
- * @param node - The Aztec node used to query if a new block has been mined.
32
+ * least by the duration. If the duration is too short to cross an L2 slot boundary, the warp is automatically
33
+ * extended to the start of the next slot so that `mineBlock()` succeeds.
34
+ * @param node - The Aztec node used to force an empty block to be mined.
39
35
  * @param duration - The duration to advance time by (in seconds)
40
36
  */
41
- warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number): Promise<void>;
37
+ warpL2TimeAtLeastBy(node: AztecNodeDebug, duration: bigint | number): Promise<void>;
42
38
  }
43
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUd2RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMvRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRTs7Ozs7R0FLRztBQUNILHFCQUFhLFVBQVU7SUFFbkIseUJBQXlCO0lBQ2xCLEdBQUcsRUFBRSxhQUFhO0lBQ3pCLHVEQUF1RDtJQUNoRCxNQUFNLEVBQUUsZ0JBQWdCO0lBSmpDO0lBQ0UseUJBQXlCO0lBQ2xCLEdBQUcsRUFBRSxhQUFhO0lBQ3pCLHVEQUF1RDtJQUNoRCxNQUFNLEVBQUUsZ0JBQWdCLEVBQzdCO0lBRUosT0FBYSxNQUFNLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxFQUFFLElBQUksRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBT3ZHO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDRyxtQkFBbUIsQ0FBQyxlQUFlLEVBQUUsZUFBZSxFQUFFLElBQUksRUFBRSxTQUFTLEVBQUUsZUF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","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjF;;;;;GAKG;AACH,qBAAa,UAAU;IAInB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;IANjC,OAAO,CAAC,MAAM,CAAuC;IAErD;IACE,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB,EAC7B;IAEJ,OAAa,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvG;IAED;;;;;;OAMG;IACG,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,iBA4B/E;IAED;;;;;;OAMG;IACG,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,iBAQxE;CACF"}
@@ -1,5 +1,6 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
- import { retryUntil } from '@aztec/foundation/retry';
2
+ import { SlotNumber } from '@aztec/foundation/branded-types';
3
+ import { createLogger } from '@aztec/foundation/log';
3
4
  /**
4
5
  * A class that provides utility functions for interacting with the chain.
5
6
  * @deprecated There used to be 3 kinds of cheat codes: eth, rollup and aztec. We have nuked the Aztec ones because
@@ -8,9 +9,11 @@ import { retryUntil } from '@aztec/foundation/retry';
8
9
  */ export class CheatCodes {
9
10
  eth;
10
11
  rollup;
12
+ logger;
11
13
  constructor(/** Cheat codes for L1.*/ eth, /** Cheat codes for the Aztec Rollup contract on L1. */ rollup){
12
14
  this.eth = eth;
13
15
  this.rollup = rollup;
16
+ this.logger = createLogger('aztecjs:cheat_codes');
14
17
  }
15
18
  static async create(rpcUrls, node, dateProvider) {
16
19
  const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
@@ -19,44 +22,43 @@ import { retryUntil } from '@aztec/foundation/retry';
19
22
  }
20
23
  /**
21
24
  * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
22
- * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
23
- * by the slot number, which advances in fixed intervals.
24
- * This is useful for testing time-dependent contract behavior.
25
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
26
- * @param node - The Aztec node used to query if a new block has been mined.
25
+ * the target timestamp. If the target timestamp falls within the current L2 slot (which already has a block),
26
+ * the timestamp is automatically adjusted forward to the start of the next slot so that `mineBlock()` succeeds.
27
+ * @param node - The Aztec node used to force an empty block to be mined.
27
28
  * @param targetTimestamp - The target timestamp to warp to (in seconds)
28
- */ async warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp) {
29
- const currentL2BlockNumber = await node.getBlockNumber();
30
- // We warp the L1 timestamp
31
- await this.eth.warp(targetTimestamp, {
29
+ */ async warpL2TimeAtLeastTo(node, targetTimestamp) {
30
+ const targetBigInt = BigInt(targetTimestamp);
31
+ const currentTimestamp = BigInt(await this.eth.lastBlockTimestamp());
32
+ if (targetBigInt <= currentTimestamp) {
33
+ throw new Error(`warpL2TimeAtLeastTo: target timestamp ${targetBigInt} is not in the future (current L1 timestamp is ${currentTimestamp}).`);
34
+ }
35
+ const currentSlot = await this.rollup.getSlot();
36
+ const targetSlot = await this.rollup.getSlotAt(targetBigInt);
37
+ let effectiveTimestamp = targetBigInt;
38
+ if (targetSlot <= currentSlot) {
39
+ // Target lands in the same (or earlier) slot — auto-adjust to the next slot's start.
40
+ const nextSlot = SlotNumber(currentSlot + 1);
41
+ const nextSlotTimestamp = await this.rollup.getTimestampForSlot(nextSlot);
42
+ this.logger.warn(`warpL2TimeAtLeastTo: target timestamp ${targetBigInt} falls in current slot ${currentSlot}. ` + `Auto-adjusting to start of slot ${nextSlot} at timestamp ${nextSlotTimestamp}.`);
43
+ effectiveTimestamp = nextSlotTimestamp;
44
+ }
45
+ await this.eth.warp(effectiveTimestamp, {
32
46
  resetBlockInterval: true
33
47
  });
34
- // Wait until an L2 block is mined
35
- const sequencer = sequencerClient.getSequencer();
36
- const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
37
- sequencer.updateConfig({
38
- minTxsPerBlock: 0
39
- });
40
- await retryUntil(async ()=>{
41
- const newL2BlockNumber = await node.getBlockNumber();
42
- return newL2BlockNumber > currentL2BlockNumber;
43
- }, 'new block after warping L2 time', 36, 1);
44
- // Restore original minTxsPerBlock
45
- sequencer.updateConfig({
46
- minTxsPerBlock
47
- });
48
+ await node.mineBlock();
48
49
  }
49
50
  /**
50
51
  * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
51
- * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
52
- * number, which advances in fixed intervals.
53
- * This is useful for testing time-dependent contract behavior.
54
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
55
- * @param node - The Aztec node used to query if a new block has been mined.
52
+ * least by the duration. If the duration is too short to cross an L2 slot boundary, the warp is automatically
53
+ * extended to the start of the next slot so that `mineBlock()` succeeds.
54
+ * @param node - The Aztec node used to force an empty block to be mined.
56
55
  * @param duration - The duration to advance time by (in seconds)
57
- */ async warpL2TimeAtLeastBy(sequencerClient, node, duration) {
58
- const currentTimestamp = await this.eth.timestamp();
56
+ */ async warpL2TimeAtLeastBy(node, duration) {
57
+ if (BigInt(duration) <= 0n) {
58
+ throw new Error(`warpL2TimeAtLeastBy: duration must be positive, got ${duration} seconds.`);
59
+ }
60
+ const currentTimestamp = await this.eth.lastBlockTimestamp();
59
61
  const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
60
- await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
62
+ await this.warpL2TimeAtLeastTo(node, targetTimestamp);
61
63
  }
62
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "0.0.1-commit.3e3d0c9cd",
3
+ "version": "0.0.1-commit.3f5453c7b",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -28,38 +28,38 @@
28
28
  "../package.common.json"
29
29
  ],
30
30
  "dependencies": {
31
- "@aztec/accounts": "0.0.1-commit.3e3d0c9cd",
32
- "@aztec/archiver": "0.0.1-commit.3e3d0c9cd",
33
- "@aztec/aztec-node": "0.0.1-commit.3e3d0c9cd",
34
- "@aztec/aztec.js": "0.0.1-commit.3e3d0c9cd",
35
- "@aztec/bb-prover": "0.0.1-commit.3e3d0c9cd",
36
- "@aztec/bb.js": "0.0.1-commit.3e3d0c9cd",
37
- "@aztec/blob-client": "0.0.1-commit.3e3d0c9cd",
38
- "@aztec/bot": "0.0.1-commit.3e3d0c9cd",
39
- "@aztec/builder": "0.0.1-commit.3e3d0c9cd",
40
- "@aztec/cli": "0.0.1-commit.3e3d0c9cd",
41
- "@aztec/constants": "0.0.1-commit.3e3d0c9cd",
42
- "@aztec/entrypoints": "0.0.1-commit.3e3d0c9cd",
43
- "@aztec/ethereum": "0.0.1-commit.3e3d0c9cd",
44
- "@aztec/foundation": "0.0.1-commit.3e3d0c9cd",
45
- "@aztec/kv-store": "0.0.1-commit.3e3d0c9cd",
46
- "@aztec/l1-artifacts": "0.0.1-commit.3e3d0c9cd",
47
- "@aztec/node-lib": "0.0.1-commit.3e3d0c9cd",
48
- "@aztec/noir-contracts.js": "0.0.1-commit.3e3d0c9cd",
49
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.3e3d0c9cd",
50
- "@aztec/p2p": "0.0.1-commit.3e3d0c9cd",
51
- "@aztec/p2p-bootstrap": "0.0.1-commit.3e3d0c9cd",
52
- "@aztec/protocol-contracts": "0.0.1-commit.3e3d0c9cd",
53
- "@aztec/prover-client": "0.0.1-commit.3e3d0c9cd",
54
- "@aztec/prover-node": "0.0.1-commit.3e3d0c9cd",
55
- "@aztec/pxe": "0.0.1-commit.3e3d0c9cd",
56
- "@aztec/sequencer-client": "0.0.1-commit.3e3d0c9cd",
57
- "@aztec/stdlib": "0.0.1-commit.3e3d0c9cd",
58
- "@aztec/telemetry-client": "0.0.1-commit.3e3d0c9cd",
59
- "@aztec/txe": "0.0.1-commit.3e3d0c9cd",
60
- "@aztec/validator-ha-signer": "0.0.1-commit.3e3d0c9cd",
61
- "@aztec/wallets": "0.0.1-commit.3e3d0c9cd",
62
- "@aztec/world-state": "0.0.1-commit.3e3d0c9cd",
31
+ "@aztec/accounts": "0.0.1-commit.3f5453c7b",
32
+ "@aztec/archiver": "0.0.1-commit.3f5453c7b",
33
+ "@aztec/aztec-node": "0.0.1-commit.3f5453c7b",
34
+ "@aztec/aztec.js": "0.0.1-commit.3f5453c7b",
35
+ "@aztec/bb-prover": "0.0.1-commit.3f5453c7b",
36
+ "@aztec/bb.js": "0.0.1-commit.3f5453c7b",
37
+ "@aztec/blob-client": "0.0.1-commit.3f5453c7b",
38
+ "@aztec/bot": "0.0.1-commit.3f5453c7b",
39
+ "@aztec/builder": "0.0.1-commit.3f5453c7b",
40
+ "@aztec/cli": "0.0.1-commit.3f5453c7b",
41
+ "@aztec/constants": "0.0.1-commit.3f5453c7b",
42
+ "@aztec/entrypoints": "0.0.1-commit.3f5453c7b",
43
+ "@aztec/ethereum": "0.0.1-commit.3f5453c7b",
44
+ "@aztec/foundation": "0.0.1-commit.3f5453c7b",
45
+ "@aztec/kv-store": "0.0.1-commit.3f5453c7b",
46
+ "@aztec/l1-artifacts": "0.0.1-commit.3f5453c7b",
47
+ "@aztec/node-lib": "0.0.1-commit.3f5453c7b",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.3f5453c7b",
49
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.3f5453c7b",
50
+ "@aztec/p2p": "0.0.1-commit.3f5453c7b",
51
+ "@aztec/p2p-bootstrap": "0.0.1-commit.3f5453c7b",
52
+ "@aztec/protocol-contracts": "0.0.1-commit.3f5453c7b",
53
+ "@aztec/prover-client": "0.0.1-commit.3f5453c7b",
54
+ "@aztec/prover-node": "0.0.1-commit.3f5453c7b",
55
+ "@aztec/pxe": "0.0.1-commit.3f5453c7b",
56
+ "@aztec/sequencer-client": "0.0.1-commit.3f5453c7b",
57
+ "@aztec/stdlib": "0.0.1-commit.3f5453c7b",
58
+ "@aztec/telemetry-client": "0.0.1-commit.3f5453c7b",
59
+ "@aztec/txe": "0.0.1-commit.3f5453c7b",
60
+ "@aztec/validator-ha-signer": "0.0.1-commit.3f5453c7b",
61
+ "@aztec/wallets": "0.0.1-commit.3f5453c7b",
62
+ "@aztec/world-state": "0.0.1-commit.3f5453c7b",
63
63
  "@iarna/toml": "^2.2.5",
64
64
  "@types/chalk": "^2.2.0",
65
65
  "abitype": "^0.8.11",
package/scripts/aztec.sh CHANGED
@@ -23,7 +23,7 @@ case $cmd in
23
23
  # Attempt to compile, no-op if there are no changes
24
24
  node --no-warnings "$script_dir/../dest/bin/index.js" compile
25
25
 
26
- export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract_log"}"
26
+ export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract"}"
27
27
  aztec start --txe --port 8081 &
28
28
  server_pid=$!
29
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 { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
10
+ import { AztecNodeAdminApiSchema, AztecNodeApiSchema, AztecNodeDebugApiSchema } 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';
@@ -51,6 +51,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
51
51
  signalHandlers.push(stop);
52
52
  services.node = [node, AztecNodeApiSchema];
53
53
  adminServices.node = [node, AztecNodeAdminApiSchema];
54
+ services.nodeDebug = [node, AztecNodeDebugApiSchema];
54
55
  } else {
55
56
  // Route --prover-node through startNode
56
57
  if (options.proverNode && !options.node) {
@@ -61,6 +62,9 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
61
62
  const { startNode } = await import('./cmds/start_node.js');
62
63
  const networkName = getActiveNetworkName(options.network);
63
64
  ({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
65
+ if (options.nodeDebug && services.node) {
66
+ services.nodeDebug = [services.node[0], AztecNodeDebugApiSchema];
67
+ }
64
68
  } else if (options.bot) {
65
69
  const { startBot } = await import('./cmds/start_bot.js');
66
70
  await startBot(options, signalHandlers, services, userLog);
@@ -165,6 +165,13 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
165
165
  env: 'AZTEC_RESET_ADMIN_API_KEY',
166
166
  parseVal: val => val === 'true' || val === '1',
167
167
  },
168
+ {
169
+ flag: '--node-debug',
170
+ description: 'Expose debug endpoints (e.g. mineBlock) on the main RPC port',
171
+ defaultValue: false,
172
+ env: 'AZTEC_NODE_DEBUG',
173
+ parseVal: val => val === undefined || val === 'true' || val === '1',
174
+ },
168
175
  {
169
176
  flag: '--api-prefix <value>',
170
177
  description: 'Prefix for API routes on any service that is started',
@@ -9,6 +9,7 @@ import { join } from 'path';
9
9
  import { readArtifactFiles } from './utils/artifacts.js';
10
10
  import { needsRecompile } from './utils/needs_recompile.js';
11
11
  import { run } from './utils/spawn.js';
12
+ import { warnIfAztecVersionMismatch } from './utils/warn_if_aztec_version_mismatch.js';
12
13
 
13
14
  /** Returns paths to contract artifacts in the target directory. */
14
15
  async function collectContractArtifacts(): Promise<string[]> {
@@ -139,6 +140,8 @@ async function checkNoTestsInContracts(nargo: string, log: LogFn): Promise<void>
139
140
 
140
141
  /** Compiles Aztec Noir contracts and postprocesses artifacts. */
141
142
  async function compileAztecContract(nargoArgs: string[], log: LogFn): Promise<void> {
143
+ await warnIfAztecVersionMismatch(log);
144
+
142
145
  if (!(await needsRecompile())) {
143
146
  log('No source changes detected, skipping compilation.');
144
147
  return;
@@ -28,11 +28,11 @@ export async function computeExpectedGenesisRoot(config: GenesisStateConfig, use
28
28
 
29
29
  userLog(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
30
30
 
31
- const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
31
+ const { genesisArchiveRoot, genesis } = await getGenesisValues(initialFundedAccounts);
32
32
 
33
33
  userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
34
34
 
35
- return { genesisArchiveRoot, prefilledPublicData };
35
+ return { genesisArchiveRoot, genesis };
36
36
  }
37
37
 
38
38
  async function checkRollupCompatibility(
@@ -9,7 +9,11 @@ import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
9
9
  import type { LogFn } from '@aztec/foundation/log';
10
10
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
11
11
  import { protocolContractsHash } from '@aztec/protocol-contracts';
12
- import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
12
+ import {
13
+ ProvingJobConsumerSchema,
14
+ createProvingJobBrokerClient,
15
+ proverBrokerBackoff,
16
+ } from '@aztec/prover-client/broker';
13
17
  import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
14
18
  import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
15
19
  import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
@@ -65,12 +69,8 @@ export async function startNode(
65
69
  if (nodeConfig.proverBrokerUrl) {
66
70
  // at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
67
71
  // set a lower connection limit such that we don't overload the server
68
- // Keep retrying up to 30s
69
- const fetch = makeTracedFetch(
70
- [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3],
71
- false,
72
- makeUndiciFetch(new Agent({ connections: 100 })),
73
- );
72
+ // Retry indefinitely until the epoch proving times out and the chain reorgs
73
+ const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({ connections: 100 })));
74
74
  broker = createProvingJobBrokerClient(nodeConfig.proverBrokerUrl, getVersions(nodeConfig), fetch);
75
75
  } else if (options.proverBroker) {
76
76
  ({ broker } = await startProverBroker(options, signalHandlers, services, userLog));
@@ -83,7 +83,7 @@ export async function startNode(
83
83
  await preloadCrsDataForVerifying(nodeConfig, userLog);
84
84
 
85
85
  const genesisConfig = getGenesisStateConfigEnvVars();
86
- const { genesisArchiveRoot, prefilledPublicData } = await computeExpectedGenesisRoot(genesisConfig, userLog);
86
+ const { genesisArchiveRoot, genesis } = await computeExpectedGenesisRoot(genesisConfig, userLog);
87
87
 
88
88
  const followsCanonicalRollup =
89
89
  typeof nodeConfig.rollupVersion !== 'number' || (nodeConfig.rollupVersion as unknown as string) === 'canonical';
@@ -116,12 +116,10 @@ export async function startNode(
116
116
  );
117
117
  }
118
118
 
119
- // TODO(#12272): will clean this up.
120
119
  nodeConfig = {
121
120
  ...nodeConfig,
122
121
  l1Contracts: {
123
122
  ...addresses,
124
- slashFactoryAddress: nodeConfig.l1Contracts.slashFactoryAddress,
125
123
  },
126
124
  ...config,
127
125
  };
@@ -158,7 +156,7 @@ export async function startNode(
158
156
  const telemetry = await initTelemetryClient(telemetryConfig);
159
157
 
160
158
  // Create and start Aztec Node
161
- const node = await createAztecNode(nodeConfig, { telemetry, proverBroker: broker }, { prefilledPublicData });
159
+ const node = await createAztecNode(nodeConfig, { telemetry, proverBroker: broker }, { genesis });
162
160
 
163
161
  // Add node and p2p to services list
164
162
  services.node = [node, AztecNodeApiSchema];
@@ -9,6 +9,7 @@ import {
9
9
  createProofStore,
10
10
  createProvingJobBrokerClient,
11
11
  proverAgentConfigMappings,
12
+ proverBrokerBackoff,
12
13
  } from '@aztec/prover-client/broker';
13
14
  import { getProverNodeAgentConfigFromEnv } from '@aztec/prover-node';
14
15
  import { ProverAgentApiSchema } from '@aztec/stdlib/interfaces/server';
@@ -45,12 +46,8 @@ export async function startProverAgent(
45
46
 
46
47
  await preloadCrsDataForServerSideProving(config, userLog);
47
48
 
48
- const fetch = makeTracedFetch(
49
- // retry connections every 3s, up to 30s before giving up
50
- [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3],
51
- false,
52
- makeUndiciFetch(new Agent({ connections: 10 })),
53
- );
49
+ // Retry indefinitely until the epoch proving times out and the chain reorgs
50
+ const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({ connections: 10 })));
54
51
  const broker = createProvingJobBrokerClient(config.proverBrokerUrl, getVersions(), fetch);
55
52
 
56
53
  const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
@@ -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
+ }
@@ -1,6 +1,7 @@
1
- import TOML from '@iarna/toml';
2
- import { readFile, readdir, stat } from 'fs/promises';
3
- import { join, resolve } from 'path';
1
+ import { readdir, stat } from 'fs/promises';
2
+ import { join } from 'path';
3
+
4
+ import { collectCrateDirs } from './collect_crate_dirs.js';
4
5
 
5
6
  /**
6
7
  * Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
@@ -16,7 +17,10 @@ export async function needsRecompile(): Promise<boolean> {
16
17
  return true;
17
18
  }
18
19
 
19
- const crateDirs = await collectCrateDirs('.');
20
+ // Git deps are pinned to a specific tag in Nargo.toml and nargo always fetches an exact tag, so their contents never
21
+ // change without Nargo.toml itself changing — and Nargo.toml is already tracked as a source file. Hence we can
22
+ // safely ignore checking source files of git deps.
23
+ const crateDirs = await collectCrateDirs('.', { skipGitDeps: true });
20
24
  return hasNewerSourceFile(crateDirs, oldestArtifactMs);
21
25
  }
22
26
 
@@ -49,63 +53,6 @@ async function getOldestArtifactModificationTime(targetDir: string): Promise<num
49
53
  return oldest;
50
54
  }
51
55
 
52
- /**
53
- * Recursively collects crate directories starting from startCrateDir by following path-based dependencies declared in
54
- * Nargo.toml files. Git-based deps are ignored (they only change when Nargo.toml itself is modified since the deps are
55
- * tagged).
56
- */
57
- async function collectCrateDirs(startCrateDir: string): Promise<string[]> {
58
- // We have a set of visited dirs we check against when entering a new dir because we could stumble upon a directory
59
- // multiple times in case multiple deps shared a dep (e.g. dep A and dep B both sharing dep C).
60
- const visited = new Set<string>();
61
-
62
- async function visit(crateDir: string): Promise<void> {
63
- const absDir = resolve(crateDir);
64
- if (visited.has(absDir)) {
65
- return;
66
- }
67
- visited.add(absDir);
68
-
69
- // Every dep is its own crate and every crate needs to have Nargo.toml defined in the root so we try to load it and
70
- // error out if it's not the case.
71
- const tomlPath = join(absDir, 'Nargo.toml');
72
- const content = await readFile(tomlPath, 'utf-8').catch(() => {
73
- throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
74
- });
75
-
76
- const parsed = TOML.parse(content) as Record<string, any>;
77
-
78
- const members = (parsed.workspace as Record<string, any>)?.members as string[] | undefined;
79
-
80
- // A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
81
- if (Array.isArray(members)) {
82
- // The crate is a workspace root and has members defined so we visit the members
83
- for (const member of members) {
84
- const memberPath = resolve(absDir, member);
85
- await visit(memberPath);
86
- }
87
- } else {
88
- // The crate is not a workspace root so we check for dependencies
89
- const deps = (parsed.dependencies as Record<string, any>) ?? {};
90
- for (const dep of Object.values(deps)) {
91
- if (dep && typeof dep === 'object' && typeof dep.path === 'string') {
92
- const depPath = resolve(absDir, dep.path);
93
- const s = await stat(depPath);
94
- if (!s.isDirectory()) {
95
- throw new Error(
96
- `Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`,
97
- );
98
- }
99
- await visit(depPath);
100
- }
101
- }
102
- }
103
- }
104
-
105
- await visit(startCrateDir);
106
- return [...visited];
107
- }
108
-
109
56
  /**
110
57
  * Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
111
58
  */