@aztec/aztec 0.0.1-commit.f650c0a5c → 0.0.1-commit.f7ea82942

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 (33) 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 -3
  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 +13 -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 +1 -14
  10. package/dest/cli/cmds/start_archiver.d.ts +1 -1
  11. package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
  12. package/dest/cli/cmds/start_archiver.js +3 -1
  13. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +2 -2
  14. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -1
  15. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +33 -12
  16. package/dest/testing/anvil_test_watcher.d.ts +7 -3
  17. package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
  18. package/dest/testing/anvil_test_watcher.js +39 -13
  19. package/dest/testing/cheat_codes.d.ts +11 -15
  20. package/dest/testing/cheat_codes.d.ts.map +1 -1
  21. package/dest/testing/cheat_codes.js +33 -31
  22. package/dest/testing/index.d.ts +2 -2
  23. package/dest/testing/index.d.ts.map +1 -1
  24. package/package.json +33 -33
  25. package/scripts/aztec.sh +5 -1
  26. package/src/cli/aztec_start_action.ts +6 -3
  27. package/src/cli/aztec_start_options.ts +19 -2
  28. package/src/cli/cmds/compile.ts +1 -17
  29. package/src/cli/cmds/start_archiver.ts +7 -1
  30. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +35 -12
  31. package/src/testing/anvil_test_watcher.ts +43 -12
  32. package/src/testing/cheat_codes.ts +41 -35
  33. package/src/testing/index.ts +1 -1
@@ -1,3 +1,3 @@
1
1
  import type { LogFn, Logger } from '@aztec/foundation/log';
2
2
  export declare function aztecStart(options: any, userLog: LogFn, debugLogger: Logger): Promise<void>;
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfYWN0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2F6dGVjX3N0YXJ0X2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFhM0Qsd0JBQXNCLFVBQVUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBMklqRiJ9
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfYWN0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2F6dGVjX3N0YXJ0X2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFhM0Qsd0JBQXNCLFVBQVUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBOElqRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAa3D,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBA2IjF"}
1
+ {"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAa3D,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBA8IjF"}
@@ -1,6 +1,6 @@
1
1
  import { getActiveNetworkName } from '@aztec/foundation/config';
2
2
  import { createNamespacedSafeJsonRpcServer, getApiKeyAuthMiddleware, startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
3
- import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
3
+ import { AztecNodeAdminApiSchema, AztecNodeApiSchema, AztecNodeDebugApiSchema } from '@aztec/stdlib/interfaces/client';
4
4
  import { getPackageVersion } from '@aztec/stdlib/update-checker';
5
5
  import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
6
6
  import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
@@ -17,8 +17,7 @@ export async function aztecStart(options, userLog, debugLogger) {
17
17
  const packageVersion = getPackageVersion();
18
18
  let config = undefined;
19
19
  if (options.localNetwork) {
20
- const localNetwork = extractNamespacedOptions(options, 'local-network');
21
- localNetwork.testAccounts = true;
20
+ const localNetwork = extractNamespacedOptions(options, 'localNetwork');
22
21
  userLog(`${splash}\n${github}\n\n`);
23
22
  userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`);
24
23
  const { node, stop } = await createLocalNetwork({
@@ -42,6 +41,10 @@ export async function aztecStart(options, userLog, debugLogger) {
42
41
  node,
43
42
  AztecNodeAdminApiSchema
44
43
  ];
44
+ services.nodeDebug = [
45
+ node,
46
+ AztecNodeDebugApiSchema
47
+ ];
45
48
  } else {
46
49
  // Route --prover-node through startNode
47
50
  if (options.proverNode && !options.node) {
@@ -51,6 +54,12 @@ export async function aztecStart(options, userLog, debugLogger) {
51
54
  const { startNode } = await import('./cmds/start_node.js');
52
55
  const networkName = getActiveNetworkName(options.network);
53
56
  ({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
57
+ if (options.nodeDebug && services.node) {
58
+ services.nodeDebug = [
59
+ services.node[0],
60
+ AztecNodeDebugApiSchema
61
+ ];
62
+ }
54
63
  } else if (options.bot) {
55
64
  const { startBot } = await import('./cmds/start_bot.js');
56
65
  await startBot(options, signalHandlers, services, userLog);
@@ -8,10 +8,10 @@ export interface AztecStartOption {
8
8
  fallback?: EnvVar[];
9
9
  parseVal?: (val: string) => any;
10
10
  }
11
- export declare const getOptions: (namespace: string, configMappings: Record<string, ConfigMapping>) => AztecStartOption[];
11
+ export declare const getOptions: (namespace: string, configMappings: Record<string, ConfigMapping<unknown>>) => AztecStartOption[];
12
12
  export declare const universalOptions: string[];
13
13
  export declare const NETWORK_FLAG = "network";
14
14
  export declare const aztecStartOptions: {
15
15
  [key: string]: AztecStartOption[];
16
16
  };
17
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfb3B0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9henRlY19zdGFydF9vcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sRUFDTCxLQUFLLGFBQWEsRUFDbEIsS0FBSyxNQUFNLEVBSVosTUFBTSwwQkFBMEIsQ0FBQztBQWVsQyxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLElBQUksRUFBRSxNQUFNLENBQUM7SUFDYixXQUFXLEVBQUUsTUFBTS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A;CAsOlE,CAAC"}
1
+ {"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,mGAoBtB,CAAC;AA2BF,eAAO,MAAM,gBAAgB,UAY5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CAmPlE,CAAC"}
@@ -93,6 +93,12 @@ export const aztecStartOptions = {
93
93
  description: 'Mnemonic for L1 accounts. Will be used ',
94
94
  defaultValue: DefaultMnemonic,
95
95
  env: 'MNEMONIC'
96
+ },
97
+ {
98
+ flag: '--local-network.testAccounts',
99
+ description: 'Deploy test accounts on local network start',
100
+ env: 'TEST_ACCOUNTS',
101
+ ...booleanConfigHelper(true)
96
102
  }
97
103
  ],
98
104
  API: [
@@ -131,6 +137,13 @@ export const aztecStartOptions = {
131
137
  env: 'AZTEC_RESET_ADMIN_API_KEY',
132
138
  parseVal: (val)=>val === 'true' || val === '1'
133
139
  },
140
+ {
141
+ flag: '--node-debug',
142
+ description: 'Expose debug endpoints (e.g. mineBlock) on the main RPC port',
143
+ defaultValue: false,
144
+ env: 'AZTEC_NODE_DEBUG',
145
+ parseVal: (val)=>val === undefined || val === 'true' || val === '1'
146
+ },
134
147
  {
135
148
  flag: '--api-prefix <value>',
136
149
  description: 'Prefix for API routes on any service that is started',
@@ -1,4 +1,4 @@
1
1
  import type { LogFn } from '@aztec/foundation/log';
2
2
  import type { Command } from 'commander';
3
3
  export declare function injectCompileCommand(program: Command, log: LogFn): Command;
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL2NvbXBpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBdUt6Qyx3QkFBZ0Isb0JBQW9CLENBQUMsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FzQjFFIn0=
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL2NvbXBpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBdUp6Qyx3QkFBZ0Isb0JBQW9CLENBQUMsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FzQjFFIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuKzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAsB1E"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuJzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAsB1E"}
@@ -1,6 +1,6 @@
1
1
  import { findBbBinary } from '@aztec/bb.js';
2
2
  import { execFileSync } from 'child_process';
3
- import { readFile, writeFile } from 'fs/promises';
3
+ import { readFile } from 'fs/promises';
4
4
  import { join } from 'path';
5
5
  import { readArtifactFiles } from './utils/artifacts.js';
6
6
  import { needsRecompile } from './utils/needs_recompile.js';
@@ -18,17 +18,6 @@ import { warnIfAztecVersionMismatch } from './utils/warn_if_aztec_version_mismat
18
18
  }
19
19
  return files.filter((f)=>Array.isArray(f.content.functions)).map((f)=>f.filePath);
20
20
  }
21
- /** Strips the `__aztec_nr_internals__` prefix from function names in contract artifacts. */ async function stripInternalPrefixes(artifactPaths) {
22
- for (const path of artifactPaths){
23
- const artifact = JSON.parse(await readFile(path, 'utf-8'));
24
- for (const fn of artifact.functions){
25
- if (typeof fn.name === 'string') {
26
- fn.name = fn.name.replace(/^__aztec_nr_internals__/, '');
27
- }
28
- }
29
- await writeFile(path, JSON.stringify(artifact, null, 2) + '\n');
30
- }
31
- }
32
21
  /** Returns the set of package names that are contract crates in the current workspace. */ async function getContractPackageNames() {
33
22
  const contractNames = new Set();
34
23
  let rootToml;
@@ -143,8 +132,6 @@ import { warnIfAztecVersionMismatch } from './utils/warn_if_aztec_version_mismat
143
132
  'aztec_process',
144
133
  ...bbArgs
145
134
  ]);
146
- // TODO: This should be part of bb aztec_process!
147
- await stripInternalPrefixes(artifacts);
148
135
  }
149
136
  log('Compilation complete!');
150
137
  }
@@ -6,4 +6,4 @@ export type { ArchiverConfig, DataStoreConfig };
6
6
  export declare function startArchiver(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers): Promise<{
7
7
  config: ArchiverConfig & DataStoreConfig;
8
8
  }>;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUUvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFLbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBK0J2RCJ9
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUUvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFLbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBcUN2RCJ9
@@ -1 +1 @@
1
- {"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAKlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CA+BvD"}
1
+ {"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAKlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CAqCvD"}
@@ -9,8 +9,10 @@ import { extractRelevantOptions } from '../util.js';
9
9
  /** Starts a standalone archiver. */ export async function startArchiver(options, signalHandlers, services) {
10
10
  const envConfig = getArchiverConfigFromEnv();
11
11
  const cliOptions = extractRelevantOptions(options, {
12
- ...archiverConfigMappings,
12
+ // dataConfigMappings must come first: its l1Contracts only maps rollupAddress,
13
+ // while archiverConfigMappings (spread later) maps all L1 contract addresses.
13
14
  ...dataConfigMappings,
15
+ ...archiverConfigMappings,
14
16
  ...blobClientConfigMapping
15
17
  }, 'archiver');
16
18
  let archiverConfig = {
@@ -1,4 +1,4 @@
1
1
  import type { LogFn } from '@aztec/foundation/log';
2
- /** Warns if the `aztec` dependency tag in any crate's Nargo.toml doesn't match the CLI version. */
2
+ /** Warns if any aztec-nr git dependency in a crate's Nargo.toml has a tag that doesn't match the CLI version. */
3
3
  export declare function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string): Promise<void>;
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvd2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBU25ELG1HQUFtRztBQUNuRyx3QkFBc0IsMEJBQTBCLENBQUMsR0FBRyxFQUFFLEtBQUssRUFBRSxVQUFVLENBQUMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQTJDL0YifQ==
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvd2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBMkJuRCxpSEFBaUg7QUFDakgsd0JBQXNCLDBCQUEwQixDQUFDLEdBQUcsRUFBRSxLQUFLLEVBQUUsVUFBVSxDQUFDLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FnRC9GIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"warn_if_aztec_version_mismatch.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,mGAAmG;AACnG,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C/F"}
1
+ {"version":3,"file":"warn_if_aztec_version_mismatch.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA2BnD,iHAAiH;AACjH,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgD/F"}
@@ -3,7 +3,20 @@ import TOML from '@iarna/toml';
3
3
  import { readFile } from 'fs/promises';
4
4
  import { join } from 'path';
5
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) {
6
+ /** Returns true if the given git URL points to the AztecProtocol/aztec-nr repository. */ function isAztecNrGitUrl(gitUrl) {
7
+ let url;
8
+ try {
9
+ url = new URL(gitUrl);
10
+ } catch {
11
+ return false;
12
+ }
13
+ if (url.hostname !== 'github.com') {
14
+ return false;
15
+ }
16
+ const repoPath = url.pathname.replace(/^\//, '').replace(/\.git$/, '').replace(/\/$/, '');
17
+ return repoPath === 'AztecProtocol/aztec-nr';
18
+ }
19
+ /** Warns if any aztec-nr git dependency in a crate's Nargo.toml has a tag that doesn't match the CLI version. */ export async function warnIfAztecVersionMismatch(log, cliVersion) {
7
20
  const version = cliVersion ?? getPackageVersion();
8
21
  if (!version) {
9
22
  log(`WARNING: aztec CLI version not found. Skipping dependency compatibility check.`);
@@ -23,19 +36,27 @@ import { collectCrateDirs } from './collect_crate_dirs.js';
23
36
  continue;
24
37
  }
25
38
  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
- });
39
+ const deps = parsed.dependencies ?? {};
40
+ for (const [depName, dep] of Object.entries(deps)){
41
+ // Skip non-object deps (e.g. malformed entries) and anything that isn't a tagged git dep.
42
+ if (!dep || typeof dep !== 'object' || typeof dep.git !== 'string' || typeof dep.tag !== 'string') {
43
+ continue;
44
+ }
45
+ // Only flag deps that are sourced from the aztec-nr repo.
46
+ if (!isAztecNrGitUrl(dep.git)) {
47
+ continue;
48
+ }
49
+ if (dep.tag !== expectedTag) {
50
+ mismatches.push({
51
+ file: tomlPath,
52
+ depName,
53
+ tag: dep.tag
54
+ });
55
+ }
35
56
  }
36
57
  }
37
58
  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.`);
59
+ const details = mismatches.map((m)=>` ${m.file} — ${m.depName} (${m.tag})`).join('\n');
60
+ log(`WARNING: Aztec dependency version mismatch detected.\n` + `The following aztec-nr dependencies do not match the CLI version (${expectedTag}):\n` + `${details}\n\n` + `See https://docs.aztec.network/errors/9 for how to update your dependencies.`);
40
61
  }
41
62
  }
@@ -2,6 +2,10 @@ import { EthCheatCodes } from '@aztec/ethereum/test';
2
2
  import type { ViemClient } from '@aztec/ethereum/types';
3
3
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
4
  import type { TestDateProvider } from '@aztec/foundation/timer';
5
+ export type AnvilTestWatcherOpts = {
6
+ isLocalNetwork?: boolean;
7
+ isMarkingAsProven?: boolean;
8
+ };
5
9
  /**
6
10
  * Represents a watcher for a rollup contract.
7
11
  *
@@ -13,6 +17,7 @@ export declare class AnvilTestWatcher {
13
17
  private cheatcodes;
14
18
  private dateProvider?;
15
19
  private isLocalNetwork;
20
+ private isMarkingAsProven;
16
21
  private rollup;
17
22
  private rollupCheatCodes;
18
23
  private l2SlotDuration;
@@ -20,11 +25,10 @@ export declare class AnvilTestWatcher {
20
25
  private syncDateProviderPromise?;
21
26
  private markingAsProvenRunningPromise?;
22
27
  private logger;
23
- private isMarkingAsProven;
24
28
  private getPendingTxCount?;
25
29
  private isSequencerBuilding?;
26
30
  private unfilledSlotFirstSeen?;
27
- constructor(cheatcodes: EthCheatCodes, rollupAddress: EthAddress, l1Client: ViemClient, dateProvider?: TestDateProvider | undefined);
31
+ constructor(cheatcodes: EthCheatCodes, rollupAddress: EthAddress, l1Client: ViemClient, dateProvider?: TestDateProvider | undefined, opts?: AnvilTestWatcherOpts);
28
32
  setIsMarkingAsProven(isMarkingAsProven: boolean): void;
29
33
  setisLocalNetwork(isLocalNetwork: boolean): void;
30
34
  /** Sets a callback to check for pending txs, used to skip unfilled slots faster when txs are waiting. */
@@ -39,4 +43,4 @@ export declare class AnvilTestWatcher {
39
43
  warpTimeIfNeeded(): Promise<void>;
40
44
  private warpToTimestamp;
41
45
  }
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW52aWxfdGVzdF93YXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9hbnZpbF90ZXN0X3dhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGFBQWEsRUFBb0IsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEtBQUssR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,GAAE,oBAAyB,EAgBhC;IAED,oBAAoB,CAAC,iBAAiB,EAAE,OAAO,QAG9C;IAED,iBAAiB,CAAC,cAAc,EAAE,OAAO,QAExC;IAED,yGAAyG;IACzG,oBAAoB,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,QAE7C;IAED,uGAAuG;IACvG,sBAAsB,CAAC,EAAE,EAAE,MAAM,OAAO,QAEvC;IAEK,KAAK,kBAyBV;IAEK,IAAI,kBAIT;IAEK,OAAO,kBAIZ;IAEK,YAAY,kBAKjB;IAEK,4BAA4B,kBAsBjC;IAEK,gBAAgB,kBA4DrB;YAMa,eAAe;CAgB9B"}
@@ -14,6 +14,7 @@ import { getAddress, getContract } from 'viem';
14
14
  cheatcodes;
15
15
  dateProvider;
16
16
  isLocalNetwork;
17
+ isMarkingAsProven;
17
18
  rollup;
18
19
  rollupCheatCodes;
19
20
  l2SlotDuration;
@@ -21,19 +22,16 @@ import { getAddress, getContract } from 'viem';
21
22
  syncDateProviderPromise;
22
23
  markingAsProvenRunningPromise;
23
24
  logger;
24
- isMarkingAsProven;
25
25
  // Optional callback to check if there are pending txs in the mempool.
26
26
  getPendingTxCount;
27
27
  // Optional callback to check if the sequencer is actively building a block.
28
28
  isSequencerBuilding;
29
29
  // Tracks when we first observed the current unfilled slot with pending txs (real wall time).
30
30
  unfilledSlotFirstSeen;
31
- constructor(cheatcodes, rollupAddress, l1Client, dateProvider){
31
+ constructor(cheatcodes, rollupAddress, l1Client, dateProvider, opts = {}){
32
32
  this.cheatcodes = cheatcodes;
33
33
  this.dateProvider = dateProvider;
34
- this.isLocalNetwork = false;
35
34
  this.logger = createLogger(`aztecjs:utils:watcher`);
36
- this.isMarkingAsProven = true;
37
35
  this.rollup = getContract({
38
36
  address: getAddress(rollupAddress.toString()),
39
37
  abi: RollupAbi,
@@ -42,6 +40,8 @@ import { getAddress, getContract } from 'viem';
42
40
  this.rollupCheatCodes = new RollupCheatCodes(this.cheatcodes, {
43
41
  rollupAddress
44
42
  });
43
+ this.isLocalNetwork = opts.isLocalNetwork ?? false;
44
+ this.isMarkingAsProven = opts.isMarkingAsProven ?? true;
45
45
  this.logger.debug(`Watcher created for rollup at ${rollupAddress}`);
46
46
  }
47
47
  setIsMarkingAsProven(isMarkingAsProven) {
@@ -107,8 +107,19 @@ import { getAddress, getContract } from 'viem';
107
107
  this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
108
108
  this.dateProvider.setTime(l1Time);
109
109
  } else if (l1Time + Number(this.l2SlotDuration) * 1000 < wallTime) {
110
- this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to wall time`);
111
- await this.cheatcodes.warp(Math.ceil(wallTime / 1000));
110
+ // Warp L1 to the slot boundary at-or-before wall time. Rounding to a slot boundary (rather than
111
+ // `ceil(wallTime / 1000)`) keeps this loop's target aligned with `warpTimeIfNeeded`'s
112
+ // `nextSlotTimestamp` target, avoiding a race where the two loops pick timestamps a fraction of
113
+ // a second apart and one of them is then rejected by anvil as non-monotonic.
114
+ const wallSec = Math.floor(wallTime / 1000);
115
+ const targetSlot = await this.rollup.read.getSlotAt([
116
+ BigInt(wallSec)
117
+ ]);
118
+ const targetTimestamp = Number(await this.rollup.read.getTimestampForSlot([
119
+ targetSlot
120
+ ]));
121
+ this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to slot ${targetSlot} boundary`);
122
+ await this.warpToTimestamp(targetTimestamp);
112
123
  }
113
124
  }
114
125
  async warpTimeIfNeeded() {
@@ -124,8 +135,9 @@ import { getAddress, getContract } from 'viem';
124
135
  ]));
125
136
  if (BigInt(currentSlot) === checkpointLog.slotNumber) {
126
137
  // The current slot has been filled, we should jump to the next slot.
127
- await this.warpToTimestamp(nextSlotTimestamp);
128
- this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
138
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
139
+ this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
140
+ }
129
141
  return;
130
142
  }
131
143
  // If we are not in local network, we don't need to warp time
@@ -152,9 +164,10 @@ import { getAddress, getContract } from 'viem';
152
164
  return;
153
165
  }
154
166
  if (realNow - this.unfilledSlotFirstSeen.realTime > 2000) {
155
- await this.warpToTimestamp(nextSlotTimestamp);
167
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
168
+ this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
169
+ }
156
170
  this.unfilledSlotFirstSeen = undefined;
157
- this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
158
171
  }
159
172
  return;
160
173
  }
@@ -162,20 +175,33 @@ import { getAddress, getContract } from 'viem';
162
175
  // Fallback: warp when the dateProvider time has passed the next slot timestamp.
163
176
  const currentTimestamp = this.dateProvider?.now() ?? Date.now();
164
177
  if (currentTimestamp > nextSlotTimestamp * 1000) {
165
- await this.warpToTimestamp(nextSlotTimestamp);
166
- this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
178
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
179
+ this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
180
+ }
167
181
  }
168
182
  } catch {
169
183
  this.logger.error('mineIfSlotFilled failed');
170
184
  }
171
185
  }
172
- async warpToTimestamp(timestamp) {
186
+ /**
187
+ * Warps L1 to `timestamp`, unless L1 is already at or past it. Returns true when a warp actually
188
+ * happened, false when skipped or on error. Callers use the return value to gate success logs.
189
+ */ async warpToTimestamp(timestamp) {
173
190
  try {
191
+ // Anvil rejects evm_setNextBlockTimestamp values <= the current block's timestamp. The two
192
+ // watcher loops can race and pick targets a fraction of a second apart; skip here rather than
193
+ // letting the second one error out noisily.
194
+ const lastTimestamp = await this.cheatcodes.lastBlockTimestamp();
195
+ if (timestamp <= lastTimestamp) {
196
+ return false;
197
+ }
174
198
  await this.cheatcodes.warp(timestamp, {
175
199
  resetBlockInterval: true
176
200
  });
201
+ return true;
177
202
  } catch (e) {
178
203
  this.logger.error(`Failed to warp to timestamp ${timestamp}: ${e}`);
204
+ return false;
179
205
  }
180
206
  }
181
207
  }
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUd2RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMvRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRTs7Ozs7R0FLRztBQUNILHFCQUFhLFVBQVU7SUFFbkIseUJBQXlCO0lBQ2xCLEdBQUcsRUFBRSxhQUFhO0lBQ3pCLHVEQUF1RDtJQUNoRCxNQUFNLEVBQUUsZ0JBQWdCO0lBSmpDO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xE;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
  }
@@ -1,6 +1,6 @@
1
- export { AnvilTestWatcher } from './anvil_test_watcher.js';
1
+ export { AnvilTestWatcher, type AnvilTestWatcherOpts } from './anvil_test_watcher.js';
2
2
  export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
3
  export { CheatCodes } from './cheat_codes.js';
4
4
  export { EpochTestSettler } from './epoch_test_settler.js';
5
5
  export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sMEJBQTBCLENBQUMifQ==
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxLQUFLLG9CQUFvQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEYsT0FBTyxFQUFFLGFBQWEsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3ZFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUM5QyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEVBQUUsNkJBQTZCLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "0.0.1-commit.f650c0a5c",
3
+ "version": "0.0.1-commit.f7ea82942",
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.f650c0a5c",
32
- "@aztec/archiver": "0.0.1-commit.f650c0a5c",
33
- "@aztec/aztec-node": "0.0.1-commit.f650c0a5c",
34
- "@aztec/aztec.js": "0.0.1-commit.f650c0a5c",
35
- "@aztec/bb-prover": "0.0.1-commit.f650c0a5c",
36
- "@aztec/bb.js": "0.0.1-commit.f650c0a5c",
37
- "@aztec/blob-client": "0.0.1-commit.f650c0a5c",
38
- "@aztec/bot": "0.0.1-commit.f650c0a5c",
39
- "@aztec/builder": "0.0.1-commit.f650c0a5c",
40
- "@aztec/cli": "0.0.1-commit.f650c0a5c",
41
- "@aztec/constants": "0.0.1-commit.f650c0a5c",
42
- "@aztec/entrypoints": "0.0.1-commit.f650c0a5c",
43
- "@aztec/ethereum": "0.0.1-commit.f650c0a5c",
44
- "@aztec/foundation": "0.0.1-commit.f650c0a5c",
45
- "@aztec/kv-store": "0.0.1-commit.f650c0a5c",
46
- "@aztec/l1-artifacts": "0.0.1-commit.f650c0a5c",
47
- "@aztec/node-lib": "0.0.1-commit.f650c0a5c",
48
- "@aztec/noir-contracts.js": "0.0.1-commit.f650c0a5c",
49
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f650c0a5c",
50
- "@aztec/p2p": "0.0.1-commit.f650c0a5c",
51
- "@aztec/p2p-bootstrap": "0.0.1-commit.f650c0a5c",
52
- "@aztec/protocol-contracts": "0.0.1-commit.f650c0a5c",
53
- "@aztec/prover-client": "0.0.1-commit.f650c0a5c",
54
- "@aztec/prover-node": "0.0.1-commit.f650c0a5c",
55
- "@aztec/pxe": "0.0.1-commit.f650c0a5c",
56
- "@aztec/sequencer-client": "0.0.1-commit.f650c0a5c",
57
- "@aztec/stdlib": "0.0.1-commit.f650c0a5c",
58
- "@aztec/telemetry-client": "0.0.1-commit.f650c0a5c",
59
- "@aztec/txe": "0.0.1-commit.f650c0a5c",
60
- "@aztec/validator-ha-signer": "0.0.1-commit.f650c0a5c",
61
- "@aztec/wallets": "0.0.1-commit.f650c0a5c",
62
- "@aztec/world-state": "0.0.1-commit.f650c0a5c",
31
+ "@aztec/accounts": "0.0.1-commit.f7ea82942",
32
+ "@aztec/archiver": "0.0.1-commit.f7ea82942",
33
+ "@aztec/aztec-node": "0.0.1-commit.f7ea82942",
34
+ "@aztec/aztec.js": "0.0.1-commit.f7ea82942",
35
+ "@aztec/bb-prover": "0.0.1-commit.f7ea82942",
36
+ "@aztec/bb.js": "0.0.1-commit.f7ea82942",
37
+ "@aztec/blob-client": "0.0.1-commit.f7ea82942",
38
+ "@aztec/bot": "0.0.1-commit.f7ea82942",
39
+ "@aztec/builder": "0.0.1-commit.f7ea82942",
40
+ "@aztec/cli": "0.0.1-commit.f7ea82942",
41
+ "@aztec/constants": "0.0.1-commit.f7ea82942",
42
+ "@aztec/entrypoints": "0.0.1-commit.f7ea82942",
43
+ "@aztec/ethereum": "0.0.1-commit.f7ea82942",
44
+ "@aztec/foundation": "0.0.1-commit.f7ea82942",
45
+ "@aztec/kv-store": "0.0.1-commit.f7ea82942",
46
+ "@aztec/l1-artifacts": "0.0.1-commit.f7ea82942",
47
+ "@aztec/node-lib": "0.0.1-commit.f7ea82942",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.f7ea82942",
49
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f7ea82942",
50
+ "@aztec/p2p": "0.0.1-commit.f7ea82942",
51
+ "@aztec/p2p-bootstrap": "0.0.1-commit.f7ea82942",
52
+ "@aztec/protocol-contracts": "0.0.1-commit.f7ea82942",
53
+ "@aztec/prover-client": "0.0.1-commit.f7ea82942",
54
+ "@aztec/prover-node": "0.0.1-commit.f7ea82942",
55
+ "@aztec/pxe": "0.0.1-commit.f7ea82942",
56
+ "@aztec/sequencer-client": "0.0.1-commit.f7ea82942",
57
+ "@aztec/stdlib": "0.0.1-commit.f7ea82942",
58
+ "@aztec/telemetry-client": "0.0.1-commit.f7ea82942",
59
+ "@aztec/txe": "0.0.1-commit.f7ea82942",
60
+ "@aztec/validator-ha-signer": "0.0.1-commit.f7ea82942",
61
+ "@aztec/wallets": "0.0.1-commit.f7ea82942",
62
+ "@aztec/world-state": "0.0.1-commit.f7ea82942",
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,10 +23,14 @@ 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"}"
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
30
+ if ! command -v nc &>/dev/null; then
31
+ echo "Error: 'nc' (netcat) is required but not installed." >&2
32
+ exit 1
33
+ fi
30
34
  while ! nc -z 127.0.0.1 8081 &>/dev/null; do sleep 0.2; done
31
35
  export NARGO_FOREIGN_CALL_TIMEOUT=300000
32
36
  nargo test --silence-warnings --oracle-resolver http://127.0.0.1:8081 --test-threads 16 "$@"
@@ -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';
@@ -27,8 +27,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
27
27
  let config: ChainConfig | undefined = undefined;
28
28
 
29
29
  if (options.localNetwork) {
30
- const localNetwork = extractNamespacedOptions(options, 'local-network');
31
- localNetwork.testAccounts = true;
30
+ const localNetwork = extractNamespacedOptions(options, 'localNetwork');
32
31
  userLog(`${splash}\n${github}\n\n`);
33
32
  userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`);
34
33
 
@@ -51,6 +50,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
51
50
  signalHandlers.push(stop);
52
51
  services.node = [node, AztecNodeApiSchema];
53
52
  adminServices.node = [node, AztecNodeAdminApiSchema];
53
+ services.nodeDebug = [node, AztecNodeDebugApiSchema];
54
54
  } else {
55
55
  // Route --prover-node through startNode
56
56
  if (options.proverNode && !options.node) {
@@ -61,6 +61,9 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
61
61
  const { startNode } = await import('./cmds/start_node.js');
62
62
  const networkName = getActiveNetworkName(options.network);
63
63
  ({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
64
+ if (options.nodeDebug && services.node) {
65
+ services.nodeDebug = [services.node[0], AztecNodeDebugApiSchema];
66
+ }
64
67
  } else if (options.bot) {
65
68
  const { startBot } = await import('./cmds/start_bot.js');
66
69
  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
  }
@@ -125,6 +129,12 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
125
129
  defaultValue: DefaultMnemonic,
126
130
  env: 'MNEMONIC',
127
131
  },
132
+ {
133
+ flag: '--local-network.testAccounts',
134
+ description: 'Deploy test accounts on local network start',
135
+ env: 'TEST_ACCOUNTS',
136
+ ...booleanConfigHelper(true),
137
+ },
128
138
  ],
129
139
  API: [
130
140
  {
@@ -165,6 +175,13 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
165
175
  env: 'AZTEC_RESET_ADMIN_API_KEY',
166
176
  parseVal: val => val === 'true' || val === '1',
167
177
  },
178
+ {
179
+ flag: '--node-debug',
180
+ description: 'Expose debug endpoints (e.g. mineBlock) on the main RPC port',
181
+ defaultValue: false,
182
+ env: 'AZTEC_NODE_DEBUG',
183
+ parseVal: val => val === undefined || val === 'true' || val === '1',
184
+ },
168
185
  {
169
186
  flag: '--api-prefix <value>',
170
187
  description: 'Prefix for API routes on any service that is started',
@@ -3,7 +3,7 @@ import type { LogFn } from '@aztec/foundation/log';
3
3
 
4
4
  import { execFileSync } from 'child_process';
5
5
  import type { Command } from 'commander';
6
- import { readFile, writeFile } from 'fs/promises';
6
+ import { readFile } from 'fs/promises';
7
7
  import { join } from 'path';
8
8
 
9
9
  import { readArtifactFiles } from './utils/artifacts.js';
@@ -25,19 +25,6 @@ async function collectContractArtifacts(): Promise<string[]> {
25
25
  return files.filter(f => Array.isArray(f.content.functions)).map(f => f.filePath);
26
26
  }
27
27
 
28
- /** Strips the `__aztec_nr_internals__` prefix from function names in contract artifacts. */
29
- async function stripInternalPrefixes(artifactPaths: string[]): Promise<void> {
30
- for (const path of artifactPaths) {
31
- const artifact = JSON.parse(await readFile(path, 'utf-8'));
32
- for (const fn of artifact.functions) {
33
- if (typeof fn.name === 'string') {
34
- fn.name = fn.name.replace(/^__aztec_nr_internals__/, '');
35
- }
36
- }
37
- await writeFile(path, JSON.stringify(artifact, null, 2) + '\n');
38
- }
39
- }
40
-
41
28
  /** Returns the set of package names that are contract crates in the current workspace. */
42
29
  async function getContractPackageNames(): Promise<Set<string>> {
43
30
  const contractNames = new Set<string>();
@@ -161,9 +148,6 @@ async function compileAztecContract(nargoArgs: string[], log: LogFn): Promise<vo
161
148
  log('Postprocessing contracts...');
162
149
  const bbArgs = artifacts.flatMap(a => ['-i', a]);
163
150
  await run(bb, ['aztec_process', ...bbArgs]);
164
-
165
- // TODO: This should be part of bb aztec_process!
166
- await stripInternalPrefixes(artifacts);
167
151
  }
168
152
 
169
153
  log('Compilation complete!');
@@ -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
 
@@ -7,7 +7,25 @@ import { join } from 'path';
7
7
 
8
8
  import { collectCrateDirs } from './collect_crate_dirs.js';
9
9
 
10
- /** Warns if the `aztec` dependency tag in any crate's Nargo.toml doesn't match the CLI version. */
10
+ /** Returns true if the given git URL points to the AztecProtocol/aztec-nr repository. */
11
+ function isAztecNrGitUrl(gitUrl: string): boolean {
12
+ let url: URL;
13
+ try {
14
+ url = new URL(gitUrl);
15
+ } catch {
16
+ return false;
17
+ }
18
+ if (url.hostname !== 'github.com') {
19
+ return false;
20
+ }
21
+ const repoPath = url.pathname
22
+ .replace(/^\//, '')
23
+ .replace(/\.git$/, '')
24
+ .replace(/\/$/, '');
25
+ return repoPath === 'AztecProtocol/aztec-nr';
26
+ }
27
+
28
+ /** Warns if any aztec-nr git dependency in a crate's Nargo.toml has a tag that doesn't match the CLI version. */
11
29
  export async function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string): Promise<void> {
12
30
  const version = cliVersion ?? getPackageVersion();
13
31
  if (!version) {
@@ -16,7 +34,7 @@ export async function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string
16
34
  }
17
35
 
18
36
  const expectedTag = `v${version}`;
19
- const mismatches: { file: string; tag: string }[] = [];
37
+ const mismatches: { file: string; depName: string; tag: string }[] = [];
20
38
 
21
39
  const crateDirs = await collectCrateDirs('.', { skipGitDeps: true });
22
40
 
@@ -30,23 +48,28 @@ export async function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string
30
48
  }
31
49
 
32
50
  const parsed = TOML.parse(content) as Record<string, any>;
33
- const aztecDep = (parsed.dependencies as Record<string, any>)?.aztec;
34
- if (!aztecDep || typeof aztecDep !== 'object' || typeof aztecDep.tag !== 'string') {
35
- // If a dep called "aztec" doesn't exist or it does not get parsed to an object or it doesn't have a tag defined
36
- // we skip the check.
37
- continue;
38
- }
51
+ const deps = (parsed.dependencies as Record<string, any>) ?? {};
39
52
 
40
- if (aztecDep.tag !== expectedTag) {
41
- mismatches.push({ file: tomlPath, tag: aztecDep.tag });
53
+ for (const [depName, dep] of Object.entries(deps)) {
54
+ // Skip non-object deps (e.g. malformed entries) and anything that isn't a tagged git dep.
55
+ if (!dep || typeof dep !== 'object' || typeof dep.git !== 'string' || typeof dep.tag !== 'string') {
56
+ continue;
57
+ }
58
+ // Only flag deps that are sourced from the aztec-nr repo.
59
+ if (!isAztecNrGitUrl(dep.git)) {
60
+ continue;
61
+ }
62
+ if (dep.tag !== expectedTag) {
63
+ mismatches.push({ file: tomlPath, depName, tag: dep.tag });
64
+ }
42
65
  }
43
66
  }
44
67
 
45
68
  if (mismatches.length > 0) {
46
- const details = mismatches.map(m => ` ${m.file} (${m.tag})`).join('\n');
69
+ const details = mismatches.map(m => ` ${m.file} — ${m.depName} (${m.tag})`).join('\n');
47
70
  log(
48
71
  `WARNING: Aztec dependency version mismatch detected.\n` +
49
- `The following crates have an aztec dependency that does not match the CLI version (${expectedTag}):\n` +
72
+ `The following aztec-nr dependencies do not match the CLI version (${expectedTag}):\n` +
50
73
  `${details}\n\n` +
51
74
  `See https://docs.aztec.network/errors/9 for how to update your dependencies.`,
52
75
  );
@@ -9,6 +9,11 @@ import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
9
9
 
10
10
  import { type GetContractReturnType, getAddress, getContract } from 'viem';
11
11
 
12
+ export type AnvilTestWatcherOpts = {
13
+ isLocalNetwork?: boolean;
14
+ isMarkingAsProven?: boolean;
15
+ };
16
+
12
17
  /**
13
18
  * Represents a watcher for a rollup contract.
14
19
  *
@@ -17,7 +22,8 @@ import { type GetContractReturnType, getAddress, getContract } from 'viem';
17
22
  * block within the slot. And if so, it will time travel into the next slot.
18
23
  */
19
24
  export class AnvilTestWatcher {
20
- private isLocalNetwork: boolean = false;
25
+ private isLocalNetwork;
26
+ private isMarkingAsProven;
21
27
 
22
28
  private rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
23
29
  private rollupCheatCodes: RollupCheatCodes;
@@ -29,8 +35,6 @@ export class AnvilTestWatcher {
29
35
 
30
36
  private logger: Logger = createLogger(`aztecjs:utils:watcher`);
31
37
 
32
- private isMarkingAsProven = true;
33
-
34
38
  // Optional callback to check if there are pending txs in the mempool.
35
39
  private getPendingTxCount?: () => Promise<number>;
36
40
 
@@ -45,6 +49,7 @@ export class AnvilTestWatcher {
45
49
  rollupAddress: EthAddress,
46
50
  l1Client: ViemClient,
47
51
  private dateProvider?: TestDateProvider,
52
+ opts: AnvilTestWatcherOpts = {},
48
53
  ) {
49
54
  this.rollup = getContract({
50
55
  address: getAddress(rollupAddress.toString()),
@@ -56,6 +61,9 @@ export class AnvilTestWatcher {
56
61
  rollupAddress,
57
62
  });
58
63
 
64
+ this.isLocalNetwork = opts.isLocalNetwork ?? false;
65
+ this.isMarkingAsProven = opts.isMarkingAsProven ?? true;
66
+
59
67
  this.logger.debug(`Watcher created for rollup at ${rollupAddress}`);
60
68
  }
61
69
 
@@ -136,8 +144,15 @@ export class AnvilTestWatcher {
136
144
  this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
137
145
  this.dateProvider.setTime(l1Time);
138
146
  } else if (l1Time + Number(this.l2SlotDuration) * 1000 < wallTime) {
139
- this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to wall time`);
140
- await this.cheatcodes.warp(Math.ceil(wallTime / 1000));
147
+ // Warp L1 to the slot boundary at-or-before wall time. Rounding to a slot boundary (rather than
148
+ // `ceil(wallTime / 1000)`) keeps this loop's target aligned with `warpTimeIfNeeded`'s
149
+ // `nextSlotTimestamp` target, avoiding a race where the two loops pick timestamps a fraction of
150
+ // a second apart and one of them is then rejected by anvil as non-monotonic.
151
+ const wallSec = Math.floor(wallTime / 1000);
152
+ const targetSlot = await this.rollup.read.getSlotAt([BigInt(wallSec)]);
153
+ const targetTimestamp = Number(await this.rollup.read.getTimestampForSlot([targetSlot]));
154
+ this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to slot ${targetSlot} boundary`);
155
+ await this.warpToTimestamp(targetTimestamp);
141
156
  }
142
157
  }
143
158
 
@@ -151,8 +166,9 @@ export class AnvilTestWatcher {
151
166
 
152
167
  if (BigInt(currentSlot) === checkpointLog.slotNumber) {
153
168
  // The current slot has been filled, we should jump to the next slot.
154
- await this.warpToTimestamp(nextSlotTimestamp);
155
- this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
169
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
170
+ this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
171
+ }
156
172
  return;
157
173
  }
158
174
 
@@ -180,9 +196,10 @@ export class AnvilTestWatcher {
180
196
  }
181
197
 
182
198
  if (realNow - this.unfilledSlotFirstSeen.realTime > 2000) {
183
- await this.warpToTimestamp(nextSlotTimestamp);
199
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
200
+ this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
201
+ }
184
202
  this.unfilledSlotFirstSeen = undefined;
185
- this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
186
203
  }
187
204
 
188
205
  return;
@@ -192,19 +209,33 @@ export class AnvilTestWatcher {
192
209
  // Fallback: warp when the dateProvider time has passed the next slot timestamp.
193
210
  const currentTimestamp = this.dateProvider?.now() ?? Date.now();
194
211
  if (currentTimestamp > nextSlotTimestamp * 1000) {
195
- await this.warpToTimestamp(nextSlotTimestamp);
196
- this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
212
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
213
+ this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
214
+ }
197
215
  }
198
216
  } catch {
199
217
  this.logger.error('mineIfSlotFilled failed');
200
218
  }
201
219
  }
202
220
 
203
- private async warpToTimestamp(timestamp: number) {
221
+ /**
222
+ * Warps L1 to `timestamp`, unless L1 is already at or past it. Returns true when a warp actually
223
+ * happened, false when skipped or on error. Callers use the return value to gate success logs.
224
+ */
225
+ private async warpToTimestamp(timestamp: number): Promise<boolean> {
204
226
  try {
227
+ // Anvil rejects evm_setNextBlockTimestamp values <= the current block's timestamp. The two
228
+ // watcher loops can race and pick targets a fraction of a second apart; skip here rather than
229
+ // letting the second one error out noisily.
230
+ const lastTimestamp = await this.cheatcodes.lastBlockTimestamp();
231
+ if (timestamp <= lastTimestamp) {
232
+ return false;
233
+ }
205
234
  await this.cheatcodes.warp(timestamp, { resetBlockInterval: true });
235
+ return true;
206
236
  } catch (e) {
207
237
  this.logger.error(`Failed to warp to timestamp ${timestamp}: ${e}`);
238
+ return false;
208
239
  }
209
240
  }
210
241
  }
@@ -1,9 +1,8 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
- import { BlockNumber } from '@aztec/foundation/branded-types';
3
- import { retryUntil } from '@aztec/foundation/retry';
2
+ import { SlotNumber } from '@aztec/foundation/branded-types';
3
+ import { createLogger } from '@aztec/foundation/log';
4
4
  import type { DateProvider } from '@aztec/foundation/timer';
5
- import type { SequencerClient } from '@aztec/sequencer-client';
6
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
7
6
 
8
7
  /**
9
8
  * A class that provides utility functions for interacting with the chain.
@@ -12,6 +11,8 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
12
11
  * codes, please consider whether it makes sense to just introduce new utils in your tests instead.
13
12
  */
14
13
  export class CheatCodes {
14
+ private logger = createLogger('aztecjs:cheat_codes');
15
+
15
16
  constructor(
16
17
  /** Cheat codes for L1.*/
17
18
  public eth: EthCheatCodes,
@@ -30,50 +31,55 @@ export class CheatCodes {
30
31
 
31
32
  /**
32
33
  * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
33
- * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
34
- * by the slot number, which advances in fixed intervals.
35
- * This is useful for testing time-dependent contract behavior.
36
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
37
- * @param node - The Aztec node used to query if a new block has been mined.
34
+ * the target timestamp. If the target timestamp falls within the current L2 slot (which already has a block),
35
+ * the timestamp is automatically adjusted forward to the start of the next slot so that `mineBlock()` succeeds.
36
+ * @param node - The Aztec node used to force an empty block to be mined.
38
37
  * @param targetTimestamp - The target timestamp to warp to (in seconds)
39
38
  */
40
- async warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number) {
41
- const currentL2BlockNumber: BlockNumber = await node.getBlockNumber();
39
+ async warpL2TimeAtLeastTo(node: AztecNodeDebug, targetTimestamp: bigint | number) {
40
+ const targetBigInt = BigInt(targetTimestamp);
41
+ const currentTimestamp = BigInt(await this.eth.lastBlockTimestamp());
42
42
 
43
- // We warp the L1 timestamp
44
- await this.eth.warp(targetTimestamp, { resetBlockInterval: true });
43
+ if (targetBigInt <= currentTimestamp) {
44
+ throw new Error(
45
+ `warpL2TimeAtLeastTo: target timestamp ${targetBigInt} is not in the future (current L1 timestamp is ${currentTimestamp}).`,
46
+ );
47
+ }
45
48
 
46
- // Wait until an L2 block is mined
47
- const sequencer = sequencerClient.getSequencer();
48
- const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
49
- sequencer.updateConfig({ minTxsPerBlock: 0 });
49
+ const currentSlot = await this.rollup.getSlot();
50
+ const targetSlot = await this.rollup.getSlotAt(targetBigInt);
50
51
 
51
- await retryUntil(
52
- async () => {
53
- const newL2BlockNumber: BlockNumber = await node.getBlockNumber();
54
- return newL2BlockNumber > currentL2BlockNumber;
55
- },
56
- 'new block after warping L2 time',
57
- 36,
58
- 1,
59
- );
52
+ let effectiveTimestamp = targetBigInt;
60
53
 
61
- // Restore original minTxsPerBlock
62
- sequencer.updateConfig({ minTxsPerBlock });
54
+ if (targetSlot <= currentSlot) {
55
+ // Target lands in the same (or earlier) slot — auto-adjust to the next slot's start.
56
+ const nextSlot = SlotNumber(currentSlot + 1);
57
+ const nextSlotTimestamp = await this.rollup.getTimestampForSlot(nextSlot);
58
+ this.logger.warn(
59
+ `warpL2TimeAtLeastTo: target timestamp ${targetBigInt} falls in current slot ${currentSlot}. ` +
60
+ `Auto-adjusting to start of slot ${nextSlot} at timestamp ${nextSlotTimestamp}.`,
61
+ );
62
+ effectiveTimestamp = nextSlotTimestamp;
63
+ }
64
+
65
+ await this.eth.warp(effectiveTimestamp, { resetBlockInterval: true });
66
+ await node.mineBlock();
63
67
  }
64
68
 
65
69
  /**
66
70
  * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
67
- * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
68
- * number, which advances in fixed intervals.
69
- * This is useful for testing time-dependent contract behavior.
70
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
71
- * @param node - The Aztec node used to query if a new block has been mined.
71
+ * least by the duration. If the duration is too short to cross an L2 slot boundary, the warp is automatically
72
+ * extended to the start of the next slot so that `mineBlock()` succeeds.
73
+ * @param node - The Aztec node used to force an empty block to be mined.
72
74
  * @param duration - The duration to advance time by (in seconds)
73
75
  */
74
- async warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number) {
76
+ async warpL2TimeAtLeastBy(node: AztecNodeDebug, duration: bigint | number) {
77
+ if (BigInt(duration) <= 0n) {
78
+ throw new Error(`warpL2TimeAtLeastBy: duration must be positive, got ${duration} seconds.`);
79
+ }
80
+
75
81
  const currentTimestamp = await this.eth.lastBlockTimestamp();
76
82
  const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
77
- await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
83
+ await this.warpL2TimeAtLeastTo(node, targetTimestamp);
78
84
  }
79
85
  }
@@ -1,4 +1,4 @@
1
- export { AnvilTestWatcher } from './anvil_test_watcher.js';
1
+ export { AnvilTestWatcher, type AnvilTestWatcherOpts } from './anvil_test_watcher.js';
2
2
  export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
3
  export { CheatCodes } from './cheat_codes.js';
4
4
  export { EpochTestSettler } from './epoch_test_settler.js';