@aztec/aztec 0.0.1-commit.9ef841308 → 0.0.1-commit.a89ec08

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.
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfYWN0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2F6dGVjX3N0YXJ0X2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFhM0Qsd0JBQXNCLFVBQVUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBK0lqRiJ9
@@ -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,iBA+IjF"}
@@ -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';
@@ -42,6 +42,10 @@ export async function aztecStart(options, userLog, debugLogger) {
42
42
  node,
43
43
  AztecNodeAdminApiSchema
44
44
  ];
45
+ services.nodeDebug = [
46
+ node,
47
+ AztecNodeDebugApiSchema
48
+ ];
45
49
  } else {
46
50
  // Route --prover-node through startNode
47
51
  if (options.proverNode && !options.node) {
@@ -51,6 +55,12 @@ export async function aztecStart(options, userLog, debugLogger) {
51
55
  const { startNode } = await import('./cmds/start_node.js');
52
56
  const networkName = getActiveNetworkName(options.network);
53
57
  ({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
58
+ if (options.nodeDebug && services.node) {
59
+ services.nodeDebug = [
60
+ services.node[0],
61
+ AztecNodeDebugApiSchema
62
+ ];
63
+ }
54
64
  } else if (options.bot) {
55
65
  const { startBot } = await import('./cmds/start_bot.js');
56
66
  await startBot(options, signalHandlers, services, userLog);
@@ -14,4 +14,4 @@ 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfb3B0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9henRlY19zdGFydF9vcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sRUFDTCxLQUFLLGFBQWEsRUFDbEIsS0FBSyxNQUFNLEVBSVosTUFBTSwwQkFBMEIsQ0FBQztBQWVsQyxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLElBQUksRUFBRSxNQUFNLENBQUM7SUFDYixXQUFXLEVBQUUsTUFBTSxDQUFDO0lBQ3BCLFlBQVksRUFBRSxHQUFHLENBQUM7SUFDbEIsWUFBWSxDQUFDLEVBQUUsQ0FBQyxHQUFHLEVBQUUsR0FBRyxLQUFLLE1BQU0sQ0FBQztJQUNwQyxHQUFHLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQUN4QixRQUFRLENBQUMsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUNwQixRQUFRLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEtBQUssR0FBRyxDQUFDO0NBQ2pDO0FBRUQsZUFBTyxNQUFNLFVBQVUsMEZBb0J0QixDQUFDO0FBdUJGLGVBQU8sTUFBTSxnQkFBZ0IsVUFZNUIsQ0FBQztBQUVGLGVBQU8sT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BQUUsQ0FBQTtDQTZPbEUsQ0FBQyJ9
@@ -1 +1 @@
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,0FAoBtB,CAAC;AAuBF,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;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,0FAoBtB,CAAC;AAuBF,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;CA6OlE,CAAC"}
@@ -6,6 +6,7 @@ import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresse
6
6
  import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
7
7
  import { getKeys } from '@aztec/foundation/collection';
8
8
  import { booleanConfigHelper, isBooleanConfigValue, omitConfigMappings } from '@aztec/foundation/config';
9
+ import { dataConfigMappings } from '@aztec/kv-store/config';
9
10
  import { sharedNodeConfigMappings } from '@aztec/node-lib/config';
10
11
  import { bootnodeConfigMappings, p2pConfigMappings } from '@aztec/p2p/config';
11
12
  import { proverAgentConfigMappings, proverBrokerConfigMappings } from '@aztec/prover-client/broker/config';
@@ -13,7 +14,6 @@ import { proverNodeConfigMappings } from '@aztec/prover-node/config';
13
14
  import { allPxeConfigMappings } from '@aztec/pxe/config';
14
15
  import { sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
15
16
  import { chainConfigMappings, nodeRpcConfigMappings } from '@aztec/stdlib/config';
16
- import { dataConfigMappings } from '@aztec/stdlib/kv-store';
17
17
  import { telemetryClientConfigMappings } from '@aztec/telemetry-client/config';
18
18
  import { worldStateConfigMappings } from '@aztec/world-state/config';
19
19
  import { DefaultMnemonic } from '../mnemonic.js';
@@ -131,6 +131,13 @@ export const aztecStartOptions = {
131
131
  env: 'AZTEC_RESET_ADMIN_API_KEY',
132
132
  parseVal: (val)=>val === 'true' || val === '1'
133
133
  },
134
+ {
135
+ flag: '--node-debug',
136
+ description: 'Expose debug endpoints (e.g. mineBlock) on the main RPC port',
137
+ defaultValue: false,
138
+ env: 'AZTEC_NODE_DEBUG',
139
+ parseVal: (val)=>val === undefined || val === 'true' || val === '1'
140
+ },
134
141
  {
135
142
  flag: '--api-prefix <value>',
136
143
  description: 'Prefix for API routes on any service that is started',
@@ -1,9 +1,9 @@
1
1
  import { type ArchiverConfig } from '@aztec/archiver';
2
2
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
3
- import { type DataStoreConfig } from '@aztec/stdlib/kv-store';
3
+ import { type DataStoreConfig } from '@aztec/kv-store/config';
4
4
  export type { ArchiverConfig, DataStoreConfig };
5
5
  /** Starts a standalone archiver. */
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFNbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBK0J2RCJ9
@@ -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;AAC/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAMlF,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"}
@@ -2,8 +2,8 @@ import { archiverConfigMappings, createArchiver, getArchiverConfigFromEnv } from
2
2
  import { createLogger } from '@aztec/aztec.js/log';
3
3
  import { blobClientConfigMapping, createBlobClient } from '@aztec/blob-client/client';
4
4
  import { getL1Config } from '@aztec/cli/config';
5
+ import { dataConfigMappings } from '@aztec/kv-store/config';
5
6
  import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
6
- import { dataConfigMappings } from '@aztec/stdlib/kv-store';
7
7
  import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
8
8
  import { extractRelevantOptions } from '../util.js';
9
9
  /** Starts a standalone archiver. */ export async function startArchiver(options, signalHandlers, services) {
@@ -5,4 +5,4 @@ import type { LogFn } from '@aztec/foundation/log';
5
5
  export declare function startNode(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, adminServices: NamespacedApiHandlers, userLog: LogFn, networkName: NetworkNames): Promise<{
6
6
  config: AztecNodeConfig;
7
7
  }>;
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfbm9kZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YXJ0X25vZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUE2QyxNQUFNLG1CQUFtQixDQUFDO0FBS3BHLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBZSxNQUFNLDBCQUEwQixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUEwQm5ELHdCQUFzQixTQUFTLENBQzdCLE9BQU8sRUFBRSxHQUFHLEVBQ1osY0FBYyxFQUFFLENBQUMsTUFBTSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxFQUN2QyxRQUFRLEVBQUUscUJBQXFCLEVBQy9CLGFBQWEsRUFBRSxxQkFBcUIsRUFDcEMsT0FBTyxFQUFFLEtBQUssRUFDZCxXQUFXLEVBQUUsWUFBWSxHQUN4QixPQUFPLENBQUM7SUFBRSxNQUFNLEVBQUUsZUFBZSxDQUFBO0NBQUUsQ0FBQyxDQW9LdEMifQ==
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfbm9kZS5kLnRzIiwic291cm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AAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,EACd,WAAW,EAAE,YAAY,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAoKtC"}
1
+ {"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAKpG,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA8BnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,EACd,WAAW,EAAE,YAAY,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAgKtC"}
@@ -7,7 +7,7 @@ import { SecretValue } from '@aztec/foundation/config';
7
7
  import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
8
8
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
9
9
  import { protocolContractsHash } from '@aztec/protocol-contracts';
10
- import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
10
+ import { ProvingJobConsumerSchema, createProvingJobBrokerClient, proverBrokerBackoff } from '@aztec/prover-client/broker';
11
11
  import { allPxeConfigMappings } from '@aztec/pxe/config';
12
12
  import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
13
13
  import { P2PApiSchema, ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
@@ -39,20 +39,8 @@ export async function startNode(options, signalHandlers, services, adminServices
39
39
  if (nodeConfig.proverBrokerUrl) {
40
40
  // at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
41
41
  // set a lower connection limit such that we don't overload the server
42
- // Keep retrying up to 30s
43
- const fetch = makeTracedFetch([
44
- 1,
45
- 2,
46
- 3,
47
- 3,
48
- 3,
49
- 3,
50
- 3,
51
- 3,
52
- 3,
53
- 3,
54
- 3
55
- ], false, makeUndiciFetch(new Agent({
42
+ // Retry indefinitely until the epoch proving times out and the chain reorgs
43
+ const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({
56
44
  connections: 100
57
45
  })));
58
46
  broker = createProvingJobBrokerClient(nodeConfig.proverBrokerUrl, getVersions(nodeConfig), fetch);
@@ -1,4 +1,4 @@
1
1
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
2
2
  import type { LogFn } from '@aztec/foundation/log';
3
3
  export declare function startProverAgent(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<void>;
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX2FnZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfcHJvdmVyX2FnZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFnQm5ELHdCQUFzQixnQkFBZ0IsQ0FDcEMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsT0FBTyxFQUFFLEtBQUssaUJBd0RmIn0=
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX2FnZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfcHJvdmVyX2FnZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFpQm5ELHdCQUFzQixnQkFBZ0IsQ0FDcEMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsT0FBTyxFQUFFLEtBQUssaUJBb0RmIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"start_prover_agent.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAwDf"}
1
+ {"version":3,"file":"start_prover_agent.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAiBnD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAoDf"}
@@ -1,7 +1,7 @@
1
1
  import { times } from '@aztec/foundation/collection';
2
2
  import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
3
3
  import { buildServerCircuitProver } from '@aztec/prover-client';
4
- import { ProvingAgent, createProofStore, createProvingJobBrokerClient, proverAgentConfigMappings } from '@aztec/prover-client/broker';
4
+ import { ProvingAgent, createProofStore, createProvingJobBrokerClient, proverAgentConfigMappings, proverBrokerBackoff } from '@aztec/prover-client/broker';
5
5
  import { getProverNodeAgentConfigFromEnv } from '@aztec/prover-node';
6
6
  import { ProverAgentApiSchema } from '@aztec/stdlib/interfaces/server';
7
7
  import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
@@ -25,20 +25,8 @@ export async function startProverAgent(options, signalHandlers, services, userLo
25
25
  process.exit(1);
26
26
  }
27
27
  await preloadCrsDataForServerSideProving(config, userLog);
28
- const fetch = makeTracedFetch(// retry connections every 3s, up to 30s before giving up
29
- [
30
- 1,
31
- 2,
32
- 3,
33
- 3,
34
- 3,
35
- 3,
36
- 3,
37
- 3,
38
- 3,
39
- 3,
40
- 3
41
- ], false, makeUndiciFetch(new Agent({
28
+ // Retry indefinitely until the epoch proving times out and the chain reorgs
29
+ const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({
42
30
  connections: 10
43
31
  })));
44
32
  const broker = createProvingJobBrokerClient(config.proverBrokerUrl, getVersions(), fetch);
package/dest/cli/util.js CHANGED
@@ -222,7 +222,7 @@ export const printAztecStartHelpText = ()=>{
222
222
  const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
223
223
  await Promise.all([
224
224
  Crs.new(2 ** 1, undefined, log),
225
- GrumpkinCrs.new(2 ** 16, undefined, log)
225
+ GrumpkinCrs.new(2 ** 16 + 1, undefined, log)
226
226
  ]);
227
227
  }
228
228
  }
@@ -234,8 +234,8 @@ export const printAztecStartHelpText = ()=>{
234
234
  if (realProofs) {
235
235
  const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
236
236
  await Promise.all([
237
- Crs.new(2 ** 25, undefined, log),
238
- GrumpkinCrs.new(2 ** 18, undefined, log)
237
+ Crs.new(2 ** 25 + 1, undefined, log),
238
+ GrumpkinCrs.new(2 ** 18 + 1, undefined, log)
239
239
  ]);
240
240
  }
241
241
  }
@@ -39,4 +39,4 @@ export declare class AnvilTestWatcher {
39
39
  warpTimeIfNeeded(): Promise<void>;
40
40
  private warpToTimestamp;
41
41
  }
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW52aWxfdGVzdF93YXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9hbnZpbF90ZXN0X3dhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGFBQWEsRUFBb0IsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV4RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBS2hFOzs7Ozs7R0FNRztBQUNILHFCQUFhLGdCQUF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,MAAM,yBAAyB,CAAC;AAKhE;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAyBzB,OAAO,CAAC,UAAU;IAGlB,OAAO,CAAC,YAAY,CAAC;IA3BvB,OAAO,CAAC,cAAc,CAAkB;IAExC,OAAO,CAAC,MAAM,CAAsD;IACpE,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAU;IAEhC,OAAO,CAAC,oBAAoB,CAAC,CAAiB;IAC9C,OAAO,CAAC,uBAAuB,CAAC,CAAiB;IACjD,OAAO,CAAC,6BAA6B,CAAC,CAAiB;IAEvD,OAAO,CAAC,MAAM,CAAiD;IAE/D,OAAO,CAAC,iBAAiB,CAAQ;IAGjC,OAAO,CAAC,iBAAiB,CAAC,CAAwB;IAGlD,OAAO,CAAC,mBAAmB,CAAC,CAAgB;IAG5C,OAAO,CAAC,qBAAqB,CAAC,CAAqC;IAEnE,YACU,UAAU,EAAE,aAAa,EACjC,aAAa,EAAE,UAAU,EACzB,QAAQ,EAAE,UAAU,EACZ,YAAY,CAAC,8BAAkB,EAaxC;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"}
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUd2RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMvRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRTs7Ozs7R0FLRztBQUNILHFCQUFhLFVBQVU7SUFFbkIseUJBQXlCO0lBQ2xCLEdBQUcsRUFBRSxhQUFhO0lBQ3pCLHVEQUF1RDtJQUNoRCxNQUFNLEVBQUUsZ0JBQWdCO0lBSmpDO0lBQ0UseUJBQXlCO0lBQ2xCLEdBQUcsRUFBRSxhQUFhO0lBQ3pCLHVEQUF1RDtJQUNoRCxNQUFNLEVBQUUsZ0JBQWdCLEVBQzdCO0lBRUosT0FBYSxNQUFNLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxFQUFFLElBQUksRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBT3ZHO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDRyxtQkFBbUIsQ0FB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AAE,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.9ef841308",
3
+ "version": "0.0.1-commit.a89ec08",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -28,38 +28,39 @@
28
28
  "../package.common.json"
29
29
  ],
30
30
  "dependencies": {
31
- "@aztec/accounts": "0.0.1-commit.9ef841308",
32
- "@aztec/archiver": "0.0.1-commit.9ef841308",
33
- "@aztec/aztec-node": "0.0.1-commit.9ef841308",
34
- "@aztec/aztec.js": "0.0.1-commit.9ef841308",
35
- "@aztec/bb-prover": "0.0.1-commit.9ef841308",
36
- "@aztec/bb.js": "0.0.1-commit.9ef841308",
37
- "@aztec/blob-client": "0.0.1-commit.9ef841308",
38
- "@aztec/bot": "0.0.1-commit.9ef841308",
39
- "@aztec/builder": "0.0.1-commit.9ef841308",
40
- "@aztec/cli": "0.0.1-commit.9ef841308",
41
- "@aztec/constants": "0.0.1-commit.9ef841308",
42
- "@aztec/entrypoints": "0.0.1-commit.9ef841308",
43
- "@aztec/ethereum": "0.0.1-commit.9ef841308",
44
- "@aztec/foundation": "0.0.1-commit.9ef841308",
45
- "@aztec/kv-store": "0.0.1-commit.9ef841308",
46
- "@aztec/l1-artifacts": "0.0.1-commit.9ef841308",
47
- "@aztec/node-lib": "0.0.1-commit.9ef841308",
48
- "@aztec/noir-contracts.js": "0.0.1-commit.9ef841308",
49
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.9ef841308",
50
- "@aztec/p2p": "0.0.1-commit.9ef841308",
51
- "@aztec/p2p-bootstrap": "0.0.1-commit.9ef841308",
52
- "@aztec/protocol-contracts": "0.0.1-commit.9ef841308",
53
- "@aztec/prover-client": "0.0.1-commit.9ef841308",
54
- "@aztec/prover-node": "0.0.1-commit.9ef841308",
55
- "@aztec/pxe": "0.0.1-commit.9ef841308",
56
- "@aztec/sequencer-client": "0.0.1-commit.9ef841308",
57
- "@aztec/stdlib": "0.0.1-commit.9ef841308",
58
- "@aztec/telemetry-client": "0.0.1-commit.9ef841308",
59
- "@aztec/txe": "0.0.1-commit.9ef841308",
60
- "@aztec/validator-ha-signer": "0.0.1-commit.9ef841308",
61
- "@aztec/wallets": "0.0.1-commit.9ef841308",
62
- "@aztec/world-state": "0.0.1-commit.9ef841308",
31
+ "@aztec/accounts": "0.0.1-commit.a89ec08",
32
+ "@aztec/archiver": "0.0.1-commit.a89ec08",
33
+ "@aztec/aztec-faucet": "0.0.1-commit.a89ec08",
34
+ "@aztec/aztec-node": "0.0.1-commit.a89ec08",
35
+ "@aztec/aztec.js": "0.0.1-commit.a89ec08",
36
+ "@aztec/bb-prover": "0.0.1-commit.a89ec08",
37
+ "@aztec/bb.js": "0.0.1-commit.a89ec08",
38
+ "@aztec/blob-client": "0.0.1-commit.a89ec08",
39
+ "@aztec/bot": "0.0.1-commit.a89ec08",
40
+ "@aztec/builder": "0.0.1-commit.a89ec08",
41
+ "@aztec/cli": "0.0.1-commit.a89ec08",
42
+ "@aztec/constants": "0.0.1-commit.a89ec08",
43
+ "@aztec/entrypoints": "0.0.1-commit.a89ec08",
44
+ "@aztec/ethereum": "0.0.1-commit.a89ec08",
45
+ "@aztec/foundation": "0.0.1-commit.a89ec08",
46
+ "@aztec/kv-store": "0.0.1-commit.a89ec08",
47
+ "@aztec/l1-artifacts": "0.0.1-commit.a89ec08",
48
+ "@aztec/node-lib": "0.0.1-commit.a89ec08",
49
+ "@aztec/noir-contracts.js": "0.0.1-commit.a89ec08",
50
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.a89ec08",
51
+ "@aztec/p2p": "0.0.1-commit.a89ec08",
52
+ "@aztec/p2p-bootstrap": "0.0.1-commit.a89ec08",
53
+ "@aztec/protocol-contracts": "0.0.1-commit.a89ec08",
54
+ "@aztec/prover-client": "0.0.1-commit.a89ec08",
55
+ "@aztec/prover-node": "0.0.1-commit.a89ec08",
56
+ "@aztec/pxe": "0.0.1-commit.a89ec08",
57
+ "@aztec/sequencer-client": "0.0.1-commit.a89ec08",
58
+ "@aztec/stdlib": "0.0.1-commit.a89ec08",
59
+ "@aztec/telemetry-client": "0.0.1-commit.a89ec08",
60
+ "@aztec/txe": "0.0.1-commit.a89ec08",
61
+ "@aztec/validator-ha-signer": "0.0.1-commit.a89ec08",
62
+ "@aztec/wallets": "0.0.1-commit.a89ec08",
63
+ "@aztec/world-state": "0.0.1-commit.a89ec08",
63
64
  "@iarna/toml": "^2.2.5",
64
65
  "@types/chalk": "^2.2.0",
65
66
  "abitype": "^0.8.11",
package/scripts/aztec.sh CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
+ shopt -s inherit_errexit
3
4
 
4
5
  # Re-execute using correct version if we have an .aztecrc file.
5
6
  if [ "${AZTEC_VERSIONED:-0}" -eq 0 ] && [ -f .aztecrc ] && command -v aztec-up &>/dev/null; then
@@ -23,7 +24,7 @@ case $cmd in
23
24
  # Attempt to compile, no-op if there are no changes
24
25
  node --no-warnings "$script_dir/../dest/bin/index.js" compile
25
26
 
26
- export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract"}"
27
+ export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract_log"}"
27
28
  aztec start --txe --port 8081 &
28
29
  server_pid=$!
29
30
  trap 'kill $server_pid &>/dev/null || true' EXIT
@@ -49,7 +50,7 @@ case $cmd in
49
50
  export ETHEREUM_HOSTS=${ETHEREUM_HOSTS:-"http://127.0.0.1:${ANVIL_PORT}"}
50
51
 
51
52
  anvil --version
52
- anvil --silent --port "$ANVIL_PORT" &
53
+ anvil --silent &
53
54
  anvil_pid=$!
54
55
  trap 'kill $anvil_pid &>/dev/null' EXIT
55
56
  fi
@@ -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);
@@ -12,6 +12,7 @@ import {
12
12
  isBooleanConfigValue,
13
13
  omitConfigMappings,
14
14
  } from '@aztec/foundation/config';
15
+ import { dataConfigMappings } from '@aztec/kv-store/config';
15
16
  import { sharedNodeConfigMappings } from '@aztec/node-lib/config';
16
17
  import { bootnodeConfigMappings, p2pConfigMappings } from '@aztec/p2p/config';
17
18
  import { proverAgentConfigMappings, proverBrokerConfigMappings } from '@aztec/prover-client/broker/config';
@@ -19,7 +20,6 @@ import { proverNodeConfigMappings } from '@aztec/prover-node/config';
19
20
  import { allPxeConfigMappings } from '@aztec/pxe/config';
20
21
  import { sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
21
22
  import { chainConfigMappings, nodeRpcConfigMappings } from '@aztec/stdlib/config';
22
- import { dataConfigMappings } from '@aztec/stdlib/kv-store';
23
23
  import { telemetryClientConfigMappings } from '@aztec/telemetry-client/config';
24
24
  import { worldStateConfigMappings } from '@aztec/world-state/config';
25
25
 
@@ -165,6 +165,13 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
165
165
  env: 'AZTEC_RESET_ADMIN_API_KEY',
166
166
  parseVal: val => val === 'true' || val === '1',
167
167
  },
168
+ {
169
+ flag: '--node-debug',
170
+ description: 'Expose debug endpoints (e.g. mineBlock) on the main RPC port',
171
+ defaultValue: false,
172
+ env: 'AZTEC_NODE_DEBUG',
173
+ parseVal: val => val === undefined || val === 'true' || val === '1',
174
+ },
168
175
  {
169
176
  flag: '--api-prefix <value>',
170
177
  description: 'Prefix for API routes on any service that is started',
@@ -3,8 +3,8 @@ import { createLogger } from '@aztec/aztec.js/log';
3
3
  import { type BlobClientConfig, blobClientConfigMapping, createBlobClient } from '@aztec/blob-client/client';
4
4
  import { getL1Config } from '@aztec/cli/config';
5
5
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
6
+ import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
6
7
  import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
7
- import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
8
8
  import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
9
9
 
10
10
  import { extractRelevantOptions } from '../util.js';
@@ -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));
@@ -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'));
package/src/cli/util.ts CHANGED
@@ -272,7 +272,7 @@ export async function preloadCrsDataForVerifying(
272
272
  ): Promise<void> {
273
273
  if (realProofs) {
274
274
  const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
275
- await Promise.all([Crs.new(2 ** 1, undefined, log), GrumpkinCrs.new(2 ** 16, undefined, log)]);
275
+ await Promise.all([Crs.new(2 ** 1, undefined, log), GrumpkinCrs.new(2 ** 16 + 1, undefined, log)]);
276
276
  }
277
277
  }
278
278
 
@@ -287,7 +287,7 @@ export async function preloadCrsDataForServerSideProving(
287
287
  ): Promise<void> {
288
288
  if (realProofs) {
289
289
  const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
290
- await Promise.all([Crs.new(2 ** 25, undefined, log), GrumpkinCrs.new(2 ** 18, undefined, log)]);
290
+ await Promise.all([Crs.new(2 ** 25 + 1, undefined, log), GrumpkinCrs.new(2 ** 18 + 1, undefined, log)]);
291
291
  }
292
292
  }
293
293
 
@@ -136,8 +136,15 @@ export class AnvilTestWatcher {
136
136
  this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
137
137
  this.dateProvider.setTime(l1Time);
138
138
  } 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));
139
+ // Warp L1 to the slot boundary at-or-before wall time. Rounding to a slot boundary (rather than
140
+ // `ceil(wallTime / 1000)`) keeps this loop's target aligned with `warpTimeIfNeeded`'s
141
+ // `nextSlotTimestamp` target, avoiding a race where the two loops pick timestamps a fraction of
142
+ // a second apart and one of them is then rejected by anvil as non-monotonic.
143
+ const wallSec = Math.floor(wallTime / 1000);
144
+ const targetSlot = await this.rollup.read.getSlotAt([BigInt(wallSec)]);
145
+ const targetTimestamp = Number(await this.rollup.read.getTimestampForSlot([targetSlot]));
146
+ this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to slot ${targetSlot} boundary`);
147
+ await this.warpToTimestamp(targetTimestamp);
141
148
  }
142
149
  }
143
150
 
@@ -151,8 +158,9 @@ export class AnvilTestWatcher {
151
158
 
152
159
  if (BigInt(currentSlot) === checkpointLog.slotNumber) {
153
160
  // 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`);
161
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
162
+ this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
163
+ }
156
164
  return;
157
165
  }
158
166
 
@@ -180,9 +188,10 @@ export class AnvilTestWatcher {
180
188
  }
181
189
 
182
190
  if (realNow - this.unfilledSlotFirstSeen.realTime > 2000) {
183
- await this.warpToTimestamp(nextSlotTimestamp);
191
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
192
+ this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
193
+ }
184
194
  this.unfilledSlotFirstSeen = undefined;
185
- this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
186
195
  }
187
196
 
188
197
  return;
@@ -192,19 +201,33 @@ export class AnvilTestWatcher {
192
201
  // Fallback: warp when the dateProvider time has passed the next slot timestamp.
193
202
  const currentTimestamp = this.dateProvider?.now() ?? Date.now();
194
203
  if (currentTimestamp > nextSlotTimestamp * 1000) {
195
- await this.warpToTimestamp(nextSlotTimestamp);
196
- this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
204
+ if (await this.warpToTimestamp(nextSlotTimestamp)) {
205
+ this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
206
+ }
197
207
  }
198
208
  } catch {
199
209
  this.logger.error('mineIfSlotFilled failed');
200
210
  }
201
211
  }
202
212
 
203
- private async warpToTimestamp(timestamp: number) {
213
+ /**
214
+ * Warps L1 to `timestamp`, unless L1 is already at or past it. Returns true when a warp actually
215
+ * happened, false when skipped or on error. Callers use the return value to gate success logs.
216
+ */
217
+ private async warpToTimestamp(timestamp: number): Promise<boolean> {
204
218
  try {
219
+ // Anvil rejects evm_setNextBlockTimestamp values <= the current block's timestamp. The two
220
+ // watcher loops can race and pick targets a fraction of a second apart; skip here rather than
221
+ // letting the second one error out noisily.
222
+ const lastTimestamp = await this.cheatcodes.lastBlockTimestamp();
223
+ if (timestamp <= lastTimestamp) {
224
+ return false;
225
+ }
205
226
  await this.cheatcodes.warp(timestamp, { resetBlockInterval: true });
227
+ return true;
206
228
  } catch (e) {
207
229
  this.logger.error(`Failed to warp to timestamp ${timestamp}: ${e}`);
230
+ return false;
208
231
  }
209
232
  }
210
233
  }
@@ -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
  }