@aztec/aztec 4.2.0-nightly.20260410 → 4.2.0-nightly.20260412
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.
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +15 -1
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +7 -0
- package/dest/testing/cheat_codes.d.ts +11 -15
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +33 -31
- package/package.json +34 -34
- package/src/cli/aztec_start_action.ts +6 -1
- package/src/cli/aztec_start_options.ts +7 -0
- package/src/testing/cheat_codes.ts +41 -35
|
@@ -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,
|
|
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,
|
|
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 { 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';
|
|
@@ -38,6 +38,14 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
38
38
|
node,
|
|
39
39
|
AztecNodeApiSchema
|
|
40
40
|
];
|
|
41
|
+
adminServices.node = [
|
|
42
|
+
node,
|
|
43
|
+
AztecNodeAdminApiSchema
|
|
44
|
+
];
|
|
45
|
+
services.nodeDebug = [
|
|
46
|
+
node,
|
|
47
|
+
AztecNodeDebugApiSchema
|
|
48
|
+
];
|
|
41
49
|
} else {
|
|
42
50
|
// Route --prover-node through startNode
|
|
43
51
|
if (options.proverNode && !options.node) {
|
|
@@ -47,6 +55,12 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
47
55
|
const { startNode } = await import('./cmds/start_node.js');
|
|
48
56
|
const networkName = getActiveNetworkName(options.network);
|
|
49
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
|
+
}
|
|
50
64
|
} else if (options.bot) {
|
|
51
65
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
52
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,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfb3B0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9henRlY19zdGFydF9vcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sRUFDTCxLQUFLLGFBQWEsRUFDbEIsS0FBSyxNQUFNLEVBSVosTUFBTSwwQkFBMEIsQ0FBQztBQWVsQyxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLElBQUksRUFBRSxNQUFNLENBQUM7SUFDYixXQUFXLEVBQUUsTUFBTSxDQUFDO0lBQ3BCLFlBQVksRUFBRSxHQUFHLENBQUM7SUFDbEIsWUFBWSxDQUFDLEVBQUUsQ0FBQyxHQUFHLEVBQUUsR0FBRyxLQUFLLE1BQU0sQ0FBQztJQUNwQyxHQUFHLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQUN4QixRQUFRLENBQUMsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUNwQixRQUFRLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEtBQUssR0FBRyxDQUFDO0NBQ2pDO0FBRUQsZUFBTyxNQUFNLFVBQVUsMEZBb0J0QixDQUFDO0FBdUJGLGVBQU8sTUFBTSxnQkFBZ0IsVUFZNUIsQ0FBQztBQUVGLGVBQU8sTUFBTSxZQUFZLFlBQVksQ0FBQztBQUd0QyxlQUFPLE1BQU0saUJBQWlCLEVBQUU7SUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEdBQUcsZ0JBQWdCLEVBQUUsQ0FBQTtDQTZPbEUsQ0FBQyJ9
|
|
@@ -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;
|
|
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"}
|
|
@@ -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,7 +1,6 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
2
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
3
|
-
import type {
|
|
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.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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(
|
|
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.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
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(
|
|
37
|
+
warpL2TimeAtLeastBy(node: AztecNodeDebug, duration: bigint | number): Promise<void>;
|
|
42
38
|
}
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUd2RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsY0FBYyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakY7Ozs7O0dBS0c7QUFDSCxxQkFBYSxVQUFVO0lBSW5CLHlCQUF5QjtJQUNsQixHQUFHLEVBQUUsYUFBYTtJQUN6Qix1REFBdUQ7SUFDaEQsTUFBTSxFQUFFLGdCQUFnQjtJQU5qQyxPQUFPLENBQUMsTUFBTSxDQUF1QztJQUVyRDtJQUNFLHlCQUF5QjtJQUNsQixHQUFHLEVBQUUsYUFBYTtJQUN6Qix1REFBdUQ7SUFDaEQsTUFBTSxFQUFFLGdCQUFnQixFQUM3QjtJQUVKLE9BQWEsTUFBTSxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFBRSxJQUFJLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQU92RztJQUVEOzs7Ozs7T0FNRztJQUNHLG1CQUFtQixDQUFDLElBQUksRUFBRSxjQUFjLEVBQUUsZUFBZSxFQUFFLE1BQU0sR0FBRyxNQUFNLGlCQTRCL0U7SUFFRDs7Ozs7O09BTUc7SUFDRyxtQkFBbUIsQ0FBQyxJQUFJLEVBQUUsY0FBYyxFQUFFLFFBQVEsRUFBRSxNQUFNLEdBQUcsTUFBTSxpQkFReEU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,
|
|
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 {
|
|
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.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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(
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
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.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
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(
|
|
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(
|
|
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": "4.2.0-nightly.
|
|
3
|
+
"version": "4.2.0-nightly.20260412",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,39 +28,39 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "4.2.0-nightly.
|
|
32
|
-
"@aztec/archiver": "4.2.0-nightly.
|
|
33
|
-
"@aztec/aztec-faucet": "4.2.0-nightly.
|
|
34
|
-
"@aztec/aztec-node": "4.2.0-nightly.
|
|
35
|
-
"@aztec/aztec.js": "4.2.0-nightly.
|
|
36
|
-
"@aztec/bb-prover": "4.2.0-nightly.
|
|
37
|
-
"@aztec/bb.js": "4.2.0-nightly.
|
|
38
|
-
"@aztec/blob-client": "4.2.0-nightly.
|
|
39
|
-
"@aztec/bot": "4.2.0-nightly.
|
|
40
|
-
"@aztec/builder": "4.2.0-nightly.
|
|
41
|
-
"@aztec/cli": "4.2.0-nightly.
|
|
42
|
-
"@aztec/constants": "4.2.0-nightly.
|
|
43
|
-
"@aztec/entrypoints": "4.2.0-nightly.
|
|
44
|
-
"@aztec/ethereum": "4.2.0-nightly.
|
|
45
|
-
"@aztec/foundation": "4.2.0-nightly.
|
|
46
|
-
"@aztec/kv-store": "4.2.0-nightly.
|
|
47
|
-
"@aztec/l1-artifacts": "4.2.0-nightly.
|
|
48
|
-
"@aztec/node-lib": "4.2.0-nightly.
|
|
49
|
-
"@aztec/noir-contracts.js": "4.2.0-nightly.
|
|
50
|
-
"@aztec/noir-protocol-circuits-types": "4.2.0-nightly.
|
|
51
|
-
"@aztec/p2p": "4.2.0-nightly.
|
|
52
|
-
"@aztec/p2p-bootstrap": "4.2.0-nightly.
|
|
53
|
-
"@aztec/protocol-contracts": "4.2.0-nightly.
|
|
54
|
-
"@aztec/prover-client": "4.2.0-nightly.
|
|
55
|
-
"@aztec/prover-node": "4.2.0-nightly.
|
|
56
|
-
"@aztec/pxe": "4.2.0-nightly.
|
|
57
|
-
"@aztec/sequencer-client": "4.2.0-nightly.
|
|
58
|
-
"@aztec/stdlib": "4.2.0-nightly.
|
|
59
|
-
"@aztec/telemetry-client": "4.2.0-nightly.
|
|
60
|
-
"@aztec/txe": "4.2.0-nightly.
|
|
61
|
-
"@aztec/validator-ha-signer": "4.2.0-nightly.
|
|
62
|
-
"@aztec/wallets": "4.2.0-nightly.
|
|
63
|
-
"@aztec/world-state": "4.2.0-nightly.
|
|
31
|
+
"@aztec/accounts": "4.2.0-nightly.20260412",
|
|
32
|
+
"@aztec/archiver": "4.2.0-nightly.20260412",
|
|
33
|
+
"@aztec/aztec-faucet": "4.2.0-nightly.20260412",
|
|
34
|
+
"@aztec/aztec-node": "4.2.0-nightly.20260412",
|
|
35
|
+
"@aztec/aztec.js": "4.2.0-nightly.20260412",
|
|
36
|
+
"@aztec/bb-prover": "4.2.0-nightly.20260412",
|
|
37
|
+
"@aztec/bb.js": "4.2.0-nightly.20260412",
|
|
38
|
+
"@aztec/blob-client": "4.2.0-nightly.20260412",
|
|
39
|
+
"@aztec/bot": "4.2.0-nightly.20260412",
|
|
40
|
+
"@aztec/builder": "4.2.0-nightly.20260412",
|
|
41
|
+
"@aztec/cli": "4.2.0-nightly.20260412",
|
|
42
|
+
"@aztec/constants": "4.2.0-nightly.20260412",
|
|
43
|
+
"@aztec/entrypoints": "4.2.0-nightly.20260412",
|
|
44
|
+
"@aztec/ethereum": "4.2.0-nightly.20260412",
|
|
45
|
+
"@aztec/foundation": "4.2.0-nightly.20260412",
|
|
46
|
+
"@aztec/kv-store": "4.2.0-nightly.20260412",
|
|
47
|
+
"@aztec/l1-artifacts": "4.2.0-nightly.20260412",
|
|
48
|
+
"@aztec/node-lib": "4.2.0-nightly.20260412",
|
|
49
|
+
"@aztec/noir-contracts.js": "4.2.0-nightly.20260412",
|
|
50
|
+
"@aztec/noir-protocol-circuits-types": "4.2.0-nightly.20260412",
|
|
51
|
+
"@aztec/p2p": "4.2.0-nightly.20260412",
|
|
52
|
+
"@aztec/p2p-bootstrap": "4.2.0-nightly.20260412",
|
|
53
|
+
"@aztec/protocol-contracts": "4.2.0-nightly.20260412",
|
|
54
|
+
"@aztec/prover-client": "4.2.0-nightly.20260412",
|
|
55
|
+
"@aztec/prover-node": "4.2.0-nightly.20260412",
|
|
56
|
+
"@aztec/pxe": "4.2.0-nightly.20260412",
|
|
57
|
+
"@aztec/sequencer-client": "4.2.0-nightly.20260412",
|
|
58
|
+
"@aztec/stdlib": "4.2.0-nightly.20260412",
|
|
59
|
+
"@aztec/telemetry-client": "4.2.0-nightly.20260412",
|
|
60
|
+
"@aztec/txe": "4.2.0-nightly.20260412",
|
|
61
|
+
"@aztec/validator-ha-signer": "4.2.0-nightly.20260412",
|
|
62
|
+
"@aztec/wallets": "4.2.0-nightly.20260412",
|
|
63
|
+
"@aztec/world-state": "4.2.0-nightly.20260412",
|
|
64
64
|
"@types/chalk": "^2.2.0",
|
|
65
65
|
"abitype": "^0.8.11",
|
|
66
66
|
"chalk": "^5.3.0",
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@aztec/foundation/json-rpc/server';
|
|
8
8
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
9
9
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
10
|
-
import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
10
|
+
import { AztecNodeAdminApiSchema, AztecNodeApiSchema, 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';
|
|
@@ -50,6 +50,8 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
50
50
|
// Start Node and PXE JSON-RPC server
|
|
51
51
|
signalHandlers.push(stop);
|
|
52
52
|
services.node = [node, AztecNodeApiSchema];
|
|
53
|
+
adminServices.node = [node, AztecNodeAdminApiSchema];
|
|
54
|
+
services.nodeDebug = [node, AztecNodeDebugApiSchema];
|
|
53
55
|
} else {
|
|
54
56
|
// Route --prover-node through startNode
|
|
55
57
|
if (options.proverNode && !options.node) {
|
|
@@ -60,6 +62,9 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
60
62
|
const { startNode } = await import('./cmds/start_node.js');
|
|
61
63
|
const networkName = getActiveNetworkName(options.network);
|
|
62
64
|
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
|
|
65
|
+
if (options.nodeDebug && services.node) {
|
|
66
|
+
services.nodeDebug = [services.node[0], AztecNodeDebugApiSchema];
|
|
67
|
+
}
|
|
63
68
|
} else if (options.bot) {
|
|
64
69
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
65
70
|
await startBot(options, signalHandlers, services, userLog);
|
|
@@ -165,6 +165,13 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
165
165
|
env: 'AZTEC_RESET_ADMIN_API_KEY',
|
|
166
166
|
parseVal: val => val === 'true' || val === '1',
|
|
167
167
|
},
|
|
168
|
+
{
|
|
169
|
+
flag: '--node-debug',
|
|
170
|
+
description: 'Expose debug endpoints (e.g. mineBlock) on the main RPC port',
|
|
171
|
+
defaultValue: false,
|
|
172
|
+
env: 'AZTEC_NODE_DEBUG',
|
|
173
|
+
parseVal: val => val === undefined || val === 'true' || val === '1',
|
|
174
|
+
},
|
|
168
175
|
{
|
|
169
176
|
flag: '--api-prefix <value>',
|
|
170
177
|
description: 'Prefix for API routes on any service that is started',
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 {
|
|
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.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
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(
|
|
41
|
-
const
|
|
39
|
+
async warpL2TimeAtLeastTo(node: AztecNodeDebug, targetTimestamp: bigint | number) {
|
|
40
|
+
const targetBigInt = BigInt(targetTimestamp);
|
|
41
|
+
const currentTimestamp = BigInt(await this.eth.lastBlockTimestamp());
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
47
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
62
|
-
|
|
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.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
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(
|
|
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(
|
|
83
|
+
await this.warpL2TimeAtLeastTo(node, targetTimestamp);
|
|
78
84
|
}
|
|
79
85
|
}
|