@aztec/aztec 0.0.1-commit.35158ae7e → 0.0.1-commit.3750d92a7

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 (49) 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 +2 -2
  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_archiver.d.ts +1 -1
  13. package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
  14. package/dest/cli/cmds/start_archiver.js +3 -1
  15. package/dest/cli/cmds/start_node.d.ts +1 -1
  16. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  17. package/dest/cli/cmds/start_node.js +6 -20
  18. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  19. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  20. package/dest/cli/cmds/start_prover_agent.js +3 -15
  21. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
  22. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
  23. package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
  24. package/dest/cli/cmds/utils/needs_recompile.d.ts +1 -1
  25. package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -1
  26. package/dest/cli/cmds/utils/needs_recompile.js +9 -53
  27. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
  28. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
  29. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +41 -0
  30. package/dest/local-network/local-network.d.ts +3 -4
  31. package/dest/local-network/local-network.d.ts.map +1 -1
  32. package/dest/local-network/local-network.js +3 -3
  33. package/dest/testing/cheat_codes.d.ts +11 -15
  34. package/dest/testing/cheat_codes.d.ts.map +1 -1
  35. package/dest/testing/cheat_codes.js +33 -31
  36. package/package.json +33 -33
  37. package/scripts/aztec.sh +1 -1
  38. package/src/cli/aztec_start_action.ts +5 -1
  39. package/src/cli/aztec_start_options.ts +13 -2
  40. package/src/cli/cmds/compile.ts +3 -0
  41. package/src/cli/cmds/standby.ts +2 -2
  42. package/src/cli/cmds/start_archiver.ts +7 -1
  43. package/src/cli/cmds/start_node.ts +9 -11
  44. package/src/cli/cmds/start_prover_agent.ts +3 -6
  45. package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
  46. package/src/cli/cmds/utils/needs_recompile.ts +8 -61
  47. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +54 -0
  48. package/src/local-network/local-network.ts +5 -5
  49. package/src/testing/cheat_codes.ts +41 -35
@@ -1 +1 @@
1
- {"version":3,"file":"local-network.d.ts","sourceRoot":"","sources":["../../src/local-network/local-network.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAE,KAAK,mBAAmB,EAAoB,MAAM,2BAA2B,CAAC;AASvF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAoB,MAAM,yBAAyB,CAAC;AAKzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,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@@ const localAnvil = foundry;
49
49
  genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
50
50
  feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
51
51
  aztecTargetCommitteeSize: 0,
52
- slasherFlavor: 'none',
52
+ slasherEnabled: false,
53
53
  realVerifier: false
54
54
  });
55
55
  aztecNodeConfig.l1Contracts = l1Contracts.l1ContractAddresses;
@@ -116,7 +116,7 @@ const localAnvil = foundry;
116
116
  ] : [],
117
117
  ...prefundAddresses
118
118
  ];
119
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(fundedAddresses);
119
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(fundedAddresses);
120
120
  const dateProvider = new TestDateProvider();
121
121
  let cheatcodes;
122
122
  let rollupAddress;
@@ -153,7 +153,7 @@ const localAnvil = foundry;
153
153
  blobClient,
154
154
  dateProvider
155
155
  }, {
156
- prefilledPublicData
156
+ genesis
157
157
  });
158
158
  // Now that the node is up, let the watcher check for pending txs so it can skip unfilled slots faster when
159
159
  // transactions are waiting in the mempool. Also let it check if the sequencer is actively building, to avoid
@@ -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,eyJ2ZXJzaW9u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DRyxtQkFBbUIsQ0FBQyxJQUFJLEVBQUUsY0FBYyxFQUFFLFFBQVEsRUFBRSxNQUFNLEdBQUcsTUFBTSxpQkFReEU7Q0FDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"cheat_codes.d.ts","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,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;;;GAKG;AACH,qBAAa,UAAU;IAEnB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;IAJjC;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;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,iBAuB5G;IAED;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,iBAIrG;CACF"}
1
+ {"version":3,"file":"cheat_codes.d.ts","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) {
56
+ */ async warpL2TimeAtLeastBy(node, duration) {
57
+ if (BigInt(duration) <= 0n) {
58
+ throw new Error(`warpL2TimeAtLeastBy: duration must be positive, got ${duration} seconds.`);
59
+ }
58
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.35158ae7e",
3
+ "version": "0.0.1-commit.3750d92a7",
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.35158ae7e",
32
- "@aztec/archiver": "0.0.1-commit.35158ae7e",
33
- "@aztec/aztec-node": "0.0.1-commit.35158ae7e",
34
- "@aztec/aztec.js": "0.0.1-commit.35158ae7e",
35
- "@aztec/bb-prover": "0.0.1-commit.35158ae7e",
36
- "@aztec/bb.js": "0.0.1-commit.35158ae7e",
37
- "@aztec/blob-client": "0.0.1-commit.35158ae7e",
38
- "@aztec/bot": "0.0.1-commit.35158ae7e",
39
- "@aztec/builder": "0.0.1-commit.35158ae7e",
40
- "@aztec/cli": "0.0.1-commit.35158ae7e",
41
- "@aztec/constants": "0.0.1-commit.35158ae7e",
42
- "@aztec/entrypoints": "0.0.1-commit.35158ae7e",
43
- "@aztec/ethereum": "0.0.1-commit.35158ae7e",
44
- "@aztec/foundation": "0.0.1-commit.35158ae7e",
45
- "@aztec/kv-store": "0.0.1-commit.35158ae7e",
46
- "@aztec/l1-artifacts": "0.0.1-commit.35158ae7e",
47
- "@aztec/node-lib": "0.0.1-commit.35158ae7e",
48
- "@aztec/noir-contracts.js": "0.0.1-commit.35158ae7e",
49
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.35158ae7e",
50
- "@aztec/p2p": "0.0.1-commit.35158ae7e",
51
- "@aztec/p2p-bootstrap": "0.0.1-commit.35158ae7e",
52
- "@aztec/protocol-contracts": "0.0.1-commit.35158ae7e",
53
- "@aztec/prover-client": "0.0.1-commit.35158ae7e",
54
- "@aztec/prover-node": "0.0.1-commit.35158ae7e",
55
- "@aztec/pxe": "0.0.1-commit.35158ae7e",
56
- "@aztec/sequencer-client": "0.0.1-commit.35158ae7e",
57
- "@aztec/stdlib": "0.0.1-commit.35158ae7e",
58
- "@aztec/telemetry-client": "0.0.1-commit.35158ae7e",
59
- "@aztec/txe": "0.0.1-commit.35158ae7e",
60
- "@aztec/validator-ha-signer": "0.0.1-commit.35158ae7e",
61
- "@aztec/wallets": "0.0.1-commit.35158ae7e",
62
- "@aztec/world-state": "0.0.1-commit.35158ae7e",
31
+ "@aztec/accounts": "0.0.1-commit.3750d92a7",
32
+ "@aztec/archiver": "0.0.1-commit.3750d92a7",
33
+ "@aztec/aztec-node": "0.0.1-commit.3750d92a7",
34
+ "@aztec/aztec.js": "0.0.1-commit.3750d92a7",
35
+ "@aztec/bb-prover": "0.0.1-commit.3750d92a7",
36
+ "@aztec/bb.js": "0.0.1-commit.3750d92a7",
37
+ "@aztec/blob-client": "0.0.1-commit.3750d92a7",
38
+ "@aztec/bot": "0.0.1-commit.3750d92a7",
39
+ "@aztec/builder": "0.0.1-commit.3750d92a7",
40
+ "@aztec/cli": "0.0.1-commit.3750d92a7",
41
+ "@aztec/constants": "0.0.1-commit.3750d92a7",
42
+ "@aztec/entrypoints": "0.0.1-commit.3750d92a7",
43
+ "@aztec/ethereum": "0.0.1-commit.3750d92a7",
44
+ "@aztec/foundation": "0.0.1-commit.3750d92a7",
45
+ "@aztec/kv-store": "0.0.1-commit.3750d92a7",
46
+ "@aztec/l1-artifacts": "0.0.1-commit.3750d92a7",
47
+ "@aztec/node-lib": "0.0.1-commit.3750d92a7",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.3750d92a7",
49
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.3750d92a7",
50
+ "@aztec/p2p": "0.0.1-commit.3750d92a7",
51
+ "@aztec/p2p-bootstrap": "0.0.1-commit.3750d92a7",
52
+ "@aztec/protocol-contracts": "0.0.1-commit.3750d92a7",
53
+ "@aztec/prover-client": "0.0.1-commit.3750d92a7",
54
+ "@aztec/prover-node": "0.0.1-commit.3750d92a7",
55
+ "@aztec/pxe": "0.0.1-commit.3750d92a7",
56
+ "@aztec/sequencer-client": "0.0.1-commit.3750d92a7",
57
+ "@aztec/stdlib": "0.0.1-commit.3750d92a7",
58
+ "@aztec/telemetry-client": "0.0.1-commit.3750d92a7",
59
+ "@aztec/txe": "0.0.1-commit.3750d92a7",
60
+ "@aztec/validator-ha-signer": "0.0.1-commit.3750d92a7",
61
+ "@aztec/wallets": "0.0.1-commit.3750d92a7",
62
+ "@aztec/world-state": "0.0.1-commit.3750d92a7",
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);
@@ -36,7 +36,7 @@ export interface AztecStartOption {
36
36
  parseVal?: (val: string) => any;
37
37
  }
38
38
 
39
- export const getOptions = (namespace: string, configMappings: Record<string, ConfigMapping>) => {
39
+ export const getOptions = (namespace: string, configMappings: Record<string, ConfigMapping<unknown>>) => {
40
40
  const options: AztecStartOption[] = [];
41
41
  for (const [key, { env, defaultValue: def, parseEnv, description, printDefault, fallback }] of Object.entries(
42
42
  configMappings,
@@ -58,7 +58,11 @@ export const getOptions = (namespace: string, configMappings: Record<string, Con
58
58
  return options;
59
59
  };
60
60
 
61
- const configToFlag = (flag: string, configMapping: ConfigMapping, overrideDefaultValue?: any): AztecStartOption => {
61
+ const configToFlag = (
62
+ flag: string,
63
+ configMapping: ConfigMapping<unknown>,
64
+ overrideDefaultValue?: any,
65
+ ): AztecStartOption => {
62
66
  if (!configMapping.isBoolean) {
63
67
  flag += ' <value>';
64
68
  }
@@ -165,6 +169,13 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
165
169
  env: 'AZTEC_RESET_ADMIN_API_KEY',
166
170
  parseVal: val => val === 'true' || val === '1',
167
171
  },
172
+ {
173
+ flag: '--node-debug',
174
+ description: 'Expose debug endpoints (e.g. mineBlock) on the main RPC port',
175
+ defaultValue: false,
176
+ env: 'AZTEC_NODE_DEBUG',
177
+ parseVal: val => val === undefined || val === 'true' || val === '1',
178
+ },
168
179
  {
169
180
  flag: '--api-prefix <value>',
170
181
  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(
@@ -20,7 +20,13 @@ export async function startArchiver(
20
20
  const envConfig = getArchiverConfigFromEnv();
21
21
  const cliOptions = extractRelevantOptions<ArchiverConfig & DataStoreConfig & BlobClientConfig>(
22
22
  options,
23
- { ...archiverConfigMappings, ...dataConfigMappings, ...blobClientConfigMapping },
23
+ {
24
+ // dataConfigMappings must come first: its l1Contracts only maps rollupAddress,
25
+ // while archiverConfigMappings (spread later) maps all L1 contract addresses.
26
+ ...dataConfigMappings,
27
+ ...archiverConfigMappings,
28
+ ...blobClientConfigMapping,
29
+ },
24
30
  'archiver',
25
31
  );
26
32
 
@@ -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
+ }