@aztec/aztec 0.0.1-commit.7035c9bd6 → 0.0.1-commit.71324e566
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 +12 -3
- package/dest/cli/aztec_start_options.d.ts +2 -2
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +13 -0
- package/dest/cli/cmds/compile.d.ts +1 -1
- package/dest/cli/cmds/compile.d.ts.map +1 -1
- package/dest/cli/cmds/compile.js +3 -14
- package/dest/cli/cmds/standby.d.ts +1 -1
- package/dest/cli/cmds/standby.js +2 -2
- package/dest/cli/cmds/start_archiver.d.ts +1 -1
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +3 -1
- package/dest/cli/cmds/start_node.d.ts +1 -1
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +6 -20
- package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +3 -15
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts +1 -1
- package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -1
- package/dest/cli/cmds/utils/needs_recompile.js +9 -53
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +62 -0
- package/dest/local-network/local-network.d.ts +3 -4
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +3 -3
- package/dest/testing/anvil_test_watcher.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +36 -10
- 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 +34 -32
- package/package.json +33 -33
- package/scripts/aztec.sh +1 -1
- package/src/cli/aztec_start_action.ts +6 -3
- package/src/cli/aztec_start_options.ts +19 -2
- package/src/cli/cmds/compile.ts +4 -17
- package/src/cli/cmds/standby.ts +2 -2
- package/src/cli/cmds/start_archiver.ts +7 -1
- package/src/cli/cmds/start_node.ts +9 -11
- package/src/cli/cmds/start_prover_agent.ts +3 -6
- package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
- package/src/cli/cmds/utils/needs_recompile.ts +8 -61
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +77 -0
- package/src/local-network/local-network.ts +5 -5
- package/src/testing/anvil_test_watcher.ts +33 -10
- package/src/testing/cheat_codes.ts +42 -36
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
2
|
+
import TOML from '@iarna/toml';
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
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) {
|
|
20
|
+
const version = cliVersion ?? getPackageVersion();
|
|
21
|
+
if (!version) {
|
|
22
|
+
log(`WARNING: aztec CLI version not found. Skipping dependency compatibility check.`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const expectedTag = `v${version}`;
|
|
26
|
+
const mismatches = [];
|
|
27
|
+
const crateDirs = await collectCrateDirs('.', {
|
|
28
|
+
skipGitDeps: true
|
|
29
|
+
});
|
|
30
|
+
for (const dir of crateDirs){
|
|
31
|
+
const tomlPath = join(dir, 'Nargo.toml');
|
|
32
|
+
let content;
|
|
33
|
+
try {
|
|
34
|
+
content = await readFile(tomlPath, 'utf-8');
|
|
35
|
+
} catch {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const parsed = TOML.parse(content);
|
|
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
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (mismatches.length > 0) {
|
|
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.`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -7,7 +7,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
7
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
8
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
9
|
import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import type {
|
|
10
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
11
11
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
12
12
|
import { type Hex } from 'viem';
|
|
13
13
|
/**
|
|
@@ -31,7 +31,6 @@ export declare function deployContractsToL1(aztecNodeConfig: AztecNodeConfig, pr
|
|
|
31
31
|
rollupAddress: EthAddress;
|
|
32
32
|
stakingAssetAddress: EthAddress;
|
|
33
33
|
} & {
|
|
34
|
-
slashFactoryAddress?: EthAddress | undefined;
|
|
35
34
|
feeAssetHandlerAddress?: EthAddress | undefined;
|
|
36
35
|
stakingAssetHandlerAddress?: EthAddress | undefined;
|
|
37
36
|
zkPassportVerifierAddress?: EthAddress | undefined;
|
|
@@ -68,6 +67,6 @@ export declare function createAztecNode(config?: Partial<AztecNodeConfig>, deps?
|
|
|
68
67
|
dateProvider?: DateProvider;
|
|
69
68
|
proverBroker?: ProvingJobBroker;
|
|
70
69
|
}, options?: {
|
|
71
|
-
|
|
70
|
+
genesis?: GenesisData;
|
|
72
71
|
}): Promise<AztecNodeService>;
|
|
73
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtbmV0d29yay5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvY2FsLW5ldHdv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G;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC5B,EACN,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAO,6BAexC"}
|
|
@@ -49,7 +49,7 @@ const localAnvil = foundry;
|
|
|
49
49
|
genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
50
50
|
feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
|
|
51
51
|
aztecTargetCommitteeSize: 0,
|
|
52
|
-
|
|
52
|
+
slasherEnabled: false,
|
|
53
53
|
realVerifier: false
|
|
54
54
|
});
|
|
55
55
|
aztecNodeConfig.l1Contracts = l1Contracts.l1ContractAddresses;
|
|
@@ -116,7 +116,7 @@ const localAnvil = foundry;
|
|
|
116
116
|
] : [],
|
|
117
117
|
...prefundAddresses
|
|
118
118
|
];
|
|
119
|
-
const { genesisArchiveRoot,
|
|
119
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(fundedAddresses);
|
|
120
120
|
const dateProvider = new TestDateProvider();
|
|
121
121
|
let cheatcodes;
|
|
122
122
|
let rollupAddress;
|
|
@@ -153,7 +153,7 @@ const localAnvil = foundry;
|
|
|
153
153
|
blobClient,
|
|
154
154
|
dateProvider
|
|
155
155
|
}, {
|
|
156
|
-
|
|
156
|
+
genesis
|
|
157
157
|
});
|
|
158
158
|
// Now that the node is up, let the watcher check for pending txs so it can skip unfilled slots faster when
|
|
159
159
|
// transactions are waiting in the mempool. Also let it check if the sequencer is actively building, to avoid
|
|
@@ -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,
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW52aWxfdGVzdF93YXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9hbnZpbF90ZXN0X3dhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGFBQWEsRUFBb0IsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV4RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBS2hFOzs7Ozs7R0FNRztBQUNILHFCQUFhLGdCQUFnQjtJQXlCekIsT0FBTyxDQUFDLFVBQVU7SUFHbEIsT0FBTyxDQUFDLFlBQVksQ0FBQztJQTNCdkIsT0FBTyxDQUFDLGNBQWMsQ0FBa0I7SUFFeEMsT0FBTyxDQUFDLE1BQU0sQ0FBc0Q7SUFDcEUsT0FBTyxDQUFDLGdCQUFnQixDQUFtQjtJQUMzQyxPQUFPLENBQUMsY0FBYyxDQUFVO0lBRWhDLE9BQU8sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFpQjtJQUM5QyxPQUFPLENBQUMsdUJBQXVCLENBQUMsQ0FBaUI7SUFDakQsT0FBTyxDQUFDLDZCQUE2QixDQUFDLENBQWlCO0lBRXZELE9BQU8sQ0FBQyxNQUFNLENBQWlEO0lBRS9ELE9BQU8sQ0FBQyxpQkFBaUIsQ0FBUTtJQUdqQyxPQUFPLENBQUMsaUJBQWlC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;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"}
|
|
@@ -101,14 +101,25 @@ import { getAddress, getContract } from 'viem';
|
|
|
101
101
|
if (!this.dateProvider) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
const l1Time = await this.cheatcodes.
|
|
104
|
+
const l1Time = await this.cheatcodes.lastBlockTimestamp() * 1000;
|
|
105
105
|
const wallTime = this.dateProvider.now();
|
|
106
106
|
if (l1Time > wallTime) {
|
|
107
107
|
this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
|
|
108
108
|
this.dateProvider.setTime(l1Time);
|
|
109
109
|
} else if (l1Time + Number(this.l2SlotDuration) * 1000 < wallTime) {
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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(
|
|
58
|
-
|
|
56
|
+
*/ async warpL2TimeAtLeastBy(node, duration) {
|
|
57
|
+
if (BigInt(duration) <= 0n) {
|
|
58
|
+
throw new Error(`warpL2TimeAtLeastBy: duration must be positive, got ${duration} seconds.`);
|
|
59
|
+
}
|
|
60
|
+
const currentTimestamp = await this.eth.lastBlockTimestamp();
|
|
59
61
|
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
60
|
-
await this.warpL2TimeAtLeastTo(
|
|
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.
|
|
3
|
+
"version": "0.0.1-commit.71324e566",
|
|
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.
|
|
32
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
33
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
34
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
35
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
36
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
37
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
38
|
-
"@aztec/bot": "0.0.1-commit.
|
|
39
|
-
"@aztec/builder": "0.0.1-commit.
|
|
40
|
-
"@aztec/cli": "0.0.1-commit.
|
|
41
|
-
"@aztec/constants": "0.0.1-commit.
|
|
42
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
43
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
44
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
45
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
46
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
47
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
48
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
50
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
51
|
-
"@aztec/p2p-bootstrap": "0.0.1-commit.
|
|
52
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
53
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
54
|
-
"@aztec/prover-node": "0.0.1-commit.
|
|
55
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
56
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
57
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
58
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
59
|
-
"@aztec/txe": "0.0.1-commit.
|
|
60
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
61
|
-
"@aztec/wallets": "0.0.1-commit.
|
|
62
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.71324e566",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.71324e566",
|
|
33
|
+
"@aztec/aztec-node": "0.0.1-commit.71324e566",
|
|
34
|
+
"@aztec/aztec.js": "0.0.1-commit.71324e566",
|
|
35
|
+
"@aztec/bb-prover": "0.0.1-commit.71324e566",
|
|
36
|
+
"@aztec/bb.js": "0.0.1-commit.71324e566",
|
|
37
|
+
"@aztec/blob-client": "0.0.1-commit.71324e566",
|
|
38
|
+
"@aztec/bot": "0.0.1-commit.71324e566",
|
|
39
|
+
"@aztec/builder": "0.0.1-commit.71324e566",
|
|
40
|
+
"@aztec/cli": "0.0.1-commit.71324e566",
|
|
41
|
+
"@aztec/constants": "0.0.1-commit.71324e566",
|
|
42
|
+
"@aztec/entrypoints": "0.0.1-commit.71324e566",
|
|
43
|
+
"@aztec/ethereum": "0.0.1-commit.71324e566",
|
|
44
|
+
"@aztec/foundation": "0.0.1-commit.71324e566",
|
|
45
|
+
"@aztec/kv-store": "0.0.1-commit.71324e566",
|
|
46
|
+
"@aztec/l1-artifacts": "0.0.1-commit.71324e566",
|
|
47
|
+
"@aztec/node-lib": "0.0.1-commit.71324e566",
|
|
48
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.71324e566",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.71324e566",
|
|
50
|
+
"@aztec/p2p": "0.0.1-commit.71324e566",
|
|
51
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.71324e566",
|
|
52
|
+
"@aztec/protocol-contracts": "0.0.1-commit.71324e566",
|
|
53
|
+
"@aztec/prover-client": "0.0.1-commit.71324e566",
|
|
54
|
+
"@aztec/prover-node": "0.0.1-commit.71324e566",
|
|
55
|
+
"@aztec/pxe": "0.0.1-commit.71324e566",
|
|
56
|
+
"@aztec/sequencer-client": "0.0.1-commit.71324e566",
|
|
57
|
+
"@aztec/stdlib": "0.0.1-commit.71324e566",
|
|
58
|
+
"@aztec/telemetry-client": "0.0.1-commit.71324e566",
|
|
59
|
+
"@aztec/txe": "0.0.1-commit.71324e566",
|
|
60
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.71324e566",
|
|
61
|
+
"@aztec/wallets": "0.0.1-commit.71324e566",
|
|
62
|
+
"@aztec/world-state": "0.0.1-commit.71324e566",
|
|
63
63
|
"@iarna/toml": "^2.2.5",
|
|
64
64
|
"@types/chalk": "^2.2.0",
|
|
65
65
|
"abitype": "^0.8.11",
|
package/scripts/aztec.sh
CHANGED
|
@@ -23,7 +23,7 @@ case $cmd in
|
|
|
23
23
|
# Attempt to compile, no-op if there are no changes
|
|
24
24
|
node --no-warnings "$script_dir/../dest/bin/index.js" compile
|
|
25
25
|
|
|
26
|
-
export LOG_LEVEL="${LOG_LEVEL:-"error;trace:
|
|
26
|
+
export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract"}"
|
|
27
27
|
aztec start --txe --port 8081 &
|
|
28
28
|
server_pid=$!
|
|
29
29
|
trap 'kill $server_pid &>/dev/null || true' EXIT
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@aztec/foundation/json-rpc/server';
|
|
8
8
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
9
9
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
10
|
-
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
10
|
+
import { AztecNodeAdminApiSchema, AztecNodeApiSchema, AztecNodeDebugApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
11
11
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
12
12
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
13
13
|
import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
@@ -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, '
|
|
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 = (
|
|
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',
|