@aztec/end-to-end 0.0.1-commit.e2b2873ed → 0.0.1-commit.e304674f1
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/README.md +27 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +19 -26
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +2 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +16 -16
- package/dest/e2e_epochs/epochs_test.d.ts +11 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +60 -38
- package/dest/e2e_fees/fees_test.d.ts +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +14 -7
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
- package/dest/e2e_p2p/p2p_network.d.ts +8 -9
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +32 -19
- package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +46 -9
- package/dest/e2e_p2p/shared.d.ts +25 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +49 -44
- package/dest/e2e_token_contract/token_contract_test.d.ts +2 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +13 -13
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +6 -5
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +37 -49
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +1 -1
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +3 -1
- package/dest/fixtures/setup.d.ts +33 -11
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +68 -89
- package/dest/fixtures/setup_p2p_test.d.ts +10 -7
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +18 -15
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +5 -7
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/shared/cross_chain_test_harness.d.ts +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.js +2 -2
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +14 -17
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +4 -4
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +11 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +97 -38
- package/dest/spartan/tx_metrics.js +1 -1
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +7 -1
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +3 -1
- package/dest/spartan/utils/index.d.ts +4 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +5 -1
- package/dest/spartan/utils/k8s.d.ts +3 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +6 -0
- package/dest/spartan/utils/nodes.d.ts +4 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +9 -9
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +16 -23
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +73 -65
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +43 -44
- package/src/bench/client_flows/client_flows_benchmark.ts +27 -10
- package/src/bench/utils.ts +7 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +20 -16
- package/src/e2e_epochs/epochs_test.ts +78 -66
- package/src/e2e_fees/fees_test.ts +14 -7
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -4
- package/src/e2e_p2p/inactivity_slash_test.ts +3 -3
- package/src/e2e_p2p/p2p_network.ts +47 -28
- package/src/e2e_p2p/reqresp/utils.ts +58 -9
- package/src/e2e_p2p/shared.ts +71 -59
- package/src/e2e_token_contract/token_contract_test.ts +18 -10
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +43 -52
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +3 -1
- package/src/fixtures/setup.ts +97 -124
- package/src/fixtures/setup_p2p_test.ts +17 -25
- package/src/fixtures/token_utils.ts +3 -3
- package/src/legacy-jest-resolver.cjs +135 -0
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +35 -28
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -2
- package/src/spartan/setup_test_wallets.ts +138 -31
- package/src/spartan/tx_metrics.ts +1 -1
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +2 -0
- package/src/spartan/utils/index.ts +7 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/spartan/utils/nodes.ts +15 -10
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +101 -80
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +213 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
package/src/fixtures/setup.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
|
-
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
4
3
|
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
5
5
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
6
6
|
import {
|
|
7
7
|
BatchCall,
|
|
@@ -16,7 +16,6 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
|
16
16
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
17
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
18
18
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
19
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
20
19
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
21
20
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
22
21
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -30,13 +29,9 @@ import {
|
|
|
30
29
|
type ZKPassportArgs,
|
|
31
30
|
deployAztecL1Contracts,
|
|
32
31
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
EthCheatCodesWithState,
|
|
37
|
-
createDelayedL1TxUtilsFromViemWallet,
|
|
38
|
-
startAnvil,
|
|
39
|
-
} from '@aztec/ethereum/test';
|
|
32
|
+
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
33
|
+
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
34
|
+
import type { Anvil } from '@aztec/ethereum/test';
|
|
40
35
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
41
36
|
import { SecretValue } from '@aztec/foundation/config';
|
|
42
37
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
@@ -45,21 +40,19 @@ import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
|
45
40
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
46
41
|
import { sleep } from '@aztec/foundation/sleep';
|
|
47
42
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
48
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
49
43
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
50
44
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
51
45
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
52
46
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
53
47
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
54
|
-
import
|
|
48
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
55
49
|
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
56
50
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
57
|
-
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
58
51
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
59
52
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
60
53
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
61
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
62
54
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
55
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
63
56
|
import {
|
|
64
57
|
type TelemetryClient,
|
|
65
58
|
type TelemetryClientConfig,
|
|
@@ -70,7 +63,6 @@ import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
|
70
63
|
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
71
64
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
72
65
|
|
|
73
|
-
import type { Anvil } from '@viem/anvil';
|
|
74
66
|
import fs from 'fs/promises';
|
|
75
67
|
import { tmpdir } from 'os';
|
|
76
68
|
import path from 'path';
|
|
@@ -195,6 +187,11 @@ export type SetupOptions = {
|
|
|
195
187
|
anvilAccounts?: number;
|
|
196
188
|
/** Port to start anvil (defaults to 8545) */
|
|
197
189
|
anvilPort?: number;
|
|
190
|
+
/**
|
|
191
|
+
* Number of slots per epoch for Anvil's finality simulation.
|
|
192
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
193
|
+
*/
|
|
194
|
+
anvilSlotsInAnEpoch?: number;
|
|
198
195
|
/** Key to use for publishing L1 contracts */
|
|
199
196
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
200
197
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
@@ -219,8 +216,8 @@ export type EndToEndContext = {
|
|
|
219
216
|
aztecNodeService: AztecNodeService;
|
|
220
217
|
/** Client to the Aztec Node admin interface. */
|
|
221
218
|
aztecNodeAdmin: AztecNodeAdmin;
|
|
222
|
-
/** The prover node
|
|
223
|
-
proverNode:
|
|
219
|
+
/** The aztec node running the prover node subsystem (only set if startProverNode is true). */
|
|
220
|
+
proverNode: AztecNodeService | undefined;
|
|
224
221
|
/** A client to the sequencer service. */
|
|
225
222
|
sequencer: SequencerClient | undefined;
|
|
226
223
|
/** Return values from deployAztecL1Contracts function. */
|
|
@@ -249,8 +246,12 @@ export type EndToEndContext = {
|
|
|
249
246
|
telemetryClient: TelemetryClient;
|
|
250
247
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
251
248
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
252
|
-
/**
|
|
253
|
-
|
|
249
|
+
/** Delayer for sequencer L1 txs (only when enableDelayer is true). */
|
|
250
|
+
sequencerDelayer: Delayer | undefined;
|
|
251
|
+
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
252
|
+
proverDelayer: Delayer | undefined;
|
|
253
|
+
/** Genesis data used for setting up nodes. */
|
|
254
|
+
genesis: GenesisData | undefined;
|
|
254
255
|
/** ACVM config (only set if running locally). */
|
|
255
256
|
acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
|
|
256
257
|
/** BB config (only set if running locally). */
|
|
@@ -276,7 +277,7 @@ export async function setup(
|
|
|
276
277
|
let anvil: Anvil | undefined;
|
|
277
278
|
try {
|
|
278
279
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
279
|
-
opts.
|
|
280
|
+
opts.slasherEnabled ??= false;
|
|
280
281
|
|
|
281
282
|
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
282
283
|
// use initialValidators for the node config
|
|
@@ -288,8 +289,12 @@ export async function setup(
|
|
|
288
289
|
config.realProofs = !!opts.realProofs;
|
|
289
290
|
// Only enforce the time table if requested
|
|
290
291
|
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
292
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
293
|
+
config.enableDelayer = true;
|
|
291
294
|
config.listenAddress = '127.0.0.1';
|
|
292
295
|
|
|
296
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
297
|
+
|
|
293
298
|
const logger = getLogger();
|
|
294
299
|
|
|
295
300
|
// Create a temp directory for any services that need it and cleanup later
|
|
@@ -299,6 +304,8 @@ export async function setup(
|
|
|
299
304
|
config.dataDirectory = directoryToCleanup;
|
|
300
305
|
}
|
|
301
306
|
|
|
307
|
+
const dateProvider = new TestDateProvider();
|
|
308
|
+
|
|
302
309
|
if (!config.l1RpcUrls?.length) {
|
|
303
310
|
if (!isAnvilTestChain(chain.id)) {
|
|
304
311
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
@@ -307,6 +314,8 @@ export async function setup(
|
|
|
307
314
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
308
315
|
accounts: opts.anvilAccounts,
|
|
309
316
|
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
317
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
318
|
+
dateProvider,
|
|
310
319
|
});
|
|
311
320
|
anvil = res.anvil;
|
|
312
321
|
config.l1RpcUrls = [res.rpcUrl];
|
|
@@ -318,8 +327,6 @@ export async function setup(
|
|
|
318
327
|
logger.info(`Logging metrics to ${filename}`);
|
|
319
328
|
setupMetricsLogger(filename);
|
|
320
329
|
}
|
|
321
|
-
|
|
322
|
-
const dateProvider = new TestDateProvider();
|
|
323
330
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
324
331
|
|
|
325
332
|
if (opts.stateLoad) {
|
|
@@ -337,11 +344,11 @@ export async function setup(
|
|
|
337
344
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
338
345
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
339
346
|
} else if (
|
|
340
|
-
config.
|
|
341
|
-
config.
|
|
342
|
-
config.
|
|
347
|
+
config.sequencerPublisherPrivateKeys &&
|
|
348
|
+
config.sequencerPublisherPrivateKeys.length > 0 &&
|
|
349
|
+
config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
|
|
343
350
|
) {
|
|
344
|
-
publisherPrivKeyHex = config.
|
|
351
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
345
352
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
346
353
|
} else if (!MNEMONIC) {
|
|
347
354
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -350,7 +357,7 @@ export async function setup(
|
|
|
350
357
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
351
358
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
352
359
|
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
|
|
353
|
-
config.
|
|
360
|
+
config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
354
361
|
}
|
|
355
362
|
|
|
356
363
|
if (config.coinbase === undefined) {
|
|
@@ -369,10 +376,12 @@ export async function setup(
|
|
|
369
376
|
addressesToFund.push(sponsoredFPCAddress);
|
|
370
377
|
}
|
|
371
378
|
|
|
372
|
-
const
|
|
379
|
+
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
380
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
|
|
373
381
|
addressesToFund,
|
|
374
382
|
opts.initialAccountFeeJuice,
|
|
375
383
|
opts.genesisPublicData,
|
|
384
|
+
genesisTimestamp,
|
|
376
385
|
);
|
|
377
386
|
|
|
378
387
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
@@ -413,7 +422,13 @@ export async function setup(
|
|
|
413
422
|
if (enableAutomine) {
|
|
414
423
|
await ethCheatCodes.setAutomine(false);
|
|
415
424
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
416
|
-
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
428
|
+
// ahead of system time due to the local-network watcher warping time forward on each filled slot.
|
|
429
|
+
// When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
|
|
430
|
+
if (!anvil) {
|
|
431
|
+
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
417
432
|
}
|
|
418
433
|
|
|
419
434
|
if (opts.l2StartTime) {
|
|
@@ -452,7 +467,7 @@ export async function setup(
|
|
|
452
467
|
}
|
|
453
468
|
|
|
454
469
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
455
|
-
let p2pClientDeps: P2PClientDeps
|
|
470
|
+
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
456
471
|
|
|
457
472
|
if (opts.mockGossipSubNetwork) {
|
|
458
473
|
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
@@ -484,44 +499,37 @@ export async function setup(
|
|
|
484
499
|
}
|
|
485
500
|
|
|
486
501
|
const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
|
|
487
|
-
AztecNodeService.createAndSync(
|
|
488
|
-
config,
|
|
489
|
-
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
490
|
-
{ prefilledPublicData },
|
|
491
|
-
),
|
|
502
|
+
AztecNodeService.createAndSync(config, { dateProvider, telemetry: telemetryClient, p2pClientDeps }, { genesis }),
|
|
492
503
|
);
|
|
493
504
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
494
505
|
|
|
495
|
-
|
|
496
|
-
const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
|
|
497
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
let proverNode: ProverNode | undefined = undefined;
|
|
506
|
+
let proverNode: AztecNodeService | undefined = undefined;
|
|
501
507
|
if (opts.startProverNode) {
|
|
502
508
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
503
509
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
504
510
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
505
511
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
512
|
+
|
|
513
|
+
const p2pClientDeps: Partial<P2PClientDeps> = {
|
|
514
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
|
|
515
|
+
rpcTxProviders: [aztecNodeService],
|
|
510
516
|
};
|
|
511
|
-
|
|
517
|
+
|
|
518
|
+
({ proverNode } = await createAndSyncProverNode(
|
|
512
519
|
proverNodePrivateKeyHex,
|
|
513
520
|
config,
|
|
514
|
-
proverNodeConfig,
|
|
515
|
-
aztecNodeService,
|
|
516
|
-
prefilledPublicData,
|
|
517
521
|
{
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
: undefined,
|
|
522
|
+
...config.proverNodeConfig,
|
|
523
|
+
dataDirectory: proverNodeDataDirectory,
|
|
521
524
|
},
|
|
522
|
-
|
|
525
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
526
|
+
{ genesis },
|
|
527
|
+
));
|
|
523
528
|
}
|
|
524
529
|
|
|
530
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
531
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
532
|
+
|
|
525
533
|
logger.verbose('Creating a pxe...');
|
|
526
534
|
const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
|
|
527
535
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
@@ -620,8 +628,10 @@ export async function setup(
|
|
|
620
628
|
initialFundedAccounts,
|
|
621
629
|
logger,
|
|
622
630
|
mockGossipSubNetwork,
|
|
623
|
-
|
|
631
|
+
genesis,
|
|
624
632
|
proverNode,
|
|
633
|
+
sequencerDelayer,
|
|
634
|
+
proverDelayer,
|
|
625
635
|
sequencer: sequencerClient,
|
|
626
636
|
teardown,
|
|
627
637
|
telemetryClient,
|
|
@@ -705,81 +715,42 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
|
|
|
705
715
|
);
|
|
706
716
|
}
|
|
707
717
|
|
|
718
|
+
/**
|
|
719
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
720
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
721
|
+
*/
|
|
708
722
|
export function createAndSyncProverNode(
|
|
709
723
|
proverNodePrivateKey: `0x${string}`,
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
724
|
+
baseConfig: AztecNodeConfig,
|
|
725
|
+
configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
|
|
726
|
+
deps: {
|
|
727
|
+
telemetry?: TelemetryClient;
|
|
728
|
+
dateProvider: DateProvider;
|
|
729
|
+
p2pClientDeps?: P2PClientDeps;
|
|
730
|
+
},
|
|
731
|
+
options: { genesis?: GenesisData; dontStart?: boolean },
|
|
732
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
716
733
|
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
{ blobClient, dateProvider: proverNodeDeps.dateProvider },
|
|
729
|
-
{ blockUntilSync: true },
|
|
730
|
-
);
|
|
731
|
-
|
|
732
|
-
const proverConfig: ProverNodeConfig = {
|
|
733
|
-
...aztecNodeConfig,
|
|
734
|
-
txCollectionNodeRpcUrls: [],
|
|
735
|
-
realProofs: false,
|
|
736
|
-
proverAgentCount: 2,
|
|
737
|
-
publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
738
|
-
proverNodeMaxPendingJobs: 10,
|
|
739
|
-
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
740
|
-
proverNodePollingIntervalMs: 200,
|
|
741
|
-
txGatheringIntervalMs: 1000,
|
|
742
|
-
txGatheringBatchSize: 10,
|
|
743
|
-
txGatheringMaxParallelRequestsPerNode: 10,
|
|
744
|
-
txGatheringTimeoutMs: 24_000,
|
|
745
|
-
proverNodeFailedEpochStore: undefined,
|
|
746
|
-
proverId: EthAddress.fromNumber(1),
|
|
747
|
-
proverNodeEpochProvingDelayMs: undefined,
|
|
748
|
-
...proverNodeConfig,
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
const l1TxUtils = createDelayedL1TxUtils(
|
|
752
|
-
aztecNodeConfig,
|
|
753
|
-
proverNodePrivateKey,
|
|
754
|
-
'prover-node',
|
|
755
|
-
proverNodeDeps.dateProvider,
|
|
734
|
+
const proverNode = await AztecNodeService.createAndSync(
|
|
735
|
+
{
|
|
736
|
+
...baseConfig,
|
|
737
|
+
...configOverrides,
|
|
738
|
+
p2pPort: 0,
|
|
739
|
+
enableProverNode: true,
|
|
740
|
+
disableValidator: true,
|
|
741
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
742
|
+
},
|
|
743
|
+
deps,
|
|
744
|
+
{ genesis: options.genesis, dontStartProverNode: options.dontStart },
|
|
756
745
|
);
|
|
757
746
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
{ ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
|
|
761
|
-
{ prefilledPublicData },
|
|
762
|
-
);
|
|
763
|
-
getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
|
|
764
|
-
if (!proverNodeConfig.dontStart) {
|
|
765
|
-
await proverNode.start();
|
|
747
|
+
if (!proverNode.getProverNode()) {
|
|
748
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
766
749
|
}
|
|
767
|
-
return proverNode;
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
750
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
logName: string,
|
|
775
|
-
dateProvider?: DateProvider,
|
|
776
|
-
) {
|
|
777
|
-
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
778
|
-
|
|
779
|
-
const log = createLogger(logName);
|
|
780
|
-
const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
|
|
781
|
-
l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
|
|
782
|
-
return l1TxUtils;
|
|
751
|
+
getLogger().info(`Created and synced prover node`);
|
|
752
|
+
return { proverNode };
|
|
753
|
+
});
|
|
783
754
|
}
|
|
784
755
|
|
|
785
756
|
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
@@ -790,7 +761,9 @@ export function getBalancesFn(
|
|
|
790
761
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
791
762
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
792
763
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
793
|
-
const b = await Promise.all(
|
|
764
|
+
const b = await Promise.all(
|
|
765
|
+
addresses.map(async address => (await method(address).simulate({ from: address })).result),
|
|
766
|
+
);
|
|
794
767
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
795
768
|
logger.verbose(debugString);
|
|
796
769
|
return b;
|
|
@@ -876,7 +849,7 @@ export const deployAccounts =
|
|
|
876
849
|
);
|
|
877
850
|
const deployMethod = await accountManager.getDeployMethod();
|
|
878
851
|
await deployMethod.send({
|
|
879
|
-
from:
|
|
852
|
+
from: NO_FROM,
|
|
880
853
|
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
881
854
|
});
|
|
882
855
|
}
|
|
@@ -908,7 +881,7 @@ export async function publicDeployAccounts(
|
|
|
908
881
|
|
|
909
882
|
const batch = new BatchCall(wallet, calls);
|
|
910
883
|
|
|
911
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
884
|
+
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
912
885
|
if (waitUntilProven) {
|
|
913
886
|
if (!node) {
|
|
914
887
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
@@ -7,8 +7,7 @@ import { SecretValue } from '@aztec/foundation/config';
|
|
|
7
7
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
8
8
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
9
9
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
10
|
-
import type {
|
|
11
|
-
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
10
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
12
11
|
|
|
13
12
|
import getPort from 'get-port';
|
|
14
13
|
|
|
@@ -41,7 +40,7 @@ export async function createNodes(
|
|
|
41
40
|
bootstrapNodeEnr: string,
|
|
42
41
|
numNodes: number,
|
|
43
42
|
bootNodePort: number,
|
|
44
|
-
|
|
43
|
+
genesis?: GenesisData,
|
|
45
44
|
dataDirectory?: string,
|
|
46
45
|
metricsPort?: number,
|
|
47
46
|
indexOffset = 0,
|
|
@@ -66,7 +65,7 @@ export async function createNodes(
|
|
|
66
65
|
port,
|
|
67
66
|
bootstrapNodeEnr,
|
|
68
67
|
validatorIndices,
|
|
69
|
-
|
|
68
|
+
genesis,
|
|
70
69
|
dataDir,
|
|
71
70
|
metricsPort,
|
|
72
71
|
);
|
|
@@ -98,7 +97,7 @@ export async function createNode(
|
|
|
98
97
|
tcpPort: number,
|
|
99
98
|
bootstrapNode: string | undefined,
|
|
100
99
|
addressIndex: number | number[],
|
|
101
|
-
|
|
100
|
+
genesis?: GenesisData,
|
|
102
101
|
dataDirectory?: string,
|
|
103
102
|
metricsPort?: number,
|
|
104
103
|
) {
|
|
@@ -109,7 +108,7 @@ export async function createNode(
|
|
|
109
108
|
return await AztecNodeService.createAndSync(
|
|
110
109
|
validatorConfig,
|
|
111
110
|
{ telemetry, dateProvider },
|
|
112
|
-
{
|
|
111
|
+
{ genesis, dontStartSequencer: config.dontStartSequencer },
|
|
113
112
|
);
|
|
114
113
|
});
|
|
115
114
|
}
|
|
@@ -120,7 +119,7 @@ export async function createNonValidatorNode(
|
|
|
120
119
|
dateProvider: DateProvider,
|
|
121
120
|
tcpPort: number,
|
|
122
121
|
bootstrapNode: string | undefined,
|
|
123
|
-
|
|
122
|
+
genesis?: GenesisData,
|
|
124
123
|
dataDirectory?: string,
|
|
125
124
|
metricsPort?: number,
|
|
126
125
|
) {
|
|
@@ -131,10 +130,10 @@ export async function createNonValidatorNode(
|
|
|
131
130
|
...p2pConfig,
|
|
132
131
|
disableValidator: true,
|
|
133
132
|
validatorPrivateKeys: undefined,
|
|
134
|
-
|
|
133
|
+
sequencerPublisherPrivateKeys: [],
|
|
135
134
|
};
|
|
136
135
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
137
|
-
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, {
|
|
136
|
+
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { genesis });
|
|
138
137
|
});
|
|
139
138
|
}
|
|
140
139
|
|
|
@@ -143,31 +142,24 @@ export async function createProverNode(
|
|
|
143
142
|
tcpPort: number,
|
|
144
143
|
bootstrapNode: string | undefined,
|
|
145
144
|
addressIndex: number,
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
deps: { dateProvider: DateProvider },
|
|
146
|
+
genesis?: GenesisData,
|
|
148
147
|
dataDirectory?: string,
|
|
149
148
|
metricsPort?: number,
|
|
150
|
-
) {
|
|
149
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
151
150
|
const actorIndex = proverCounter++;
|
|
152
151
|
return await withLoggerBindings({ actor: `prover-${actorIndex}` }, async () => {
|
|
153
152
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
|
|
154
153
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
155
154
|
|
|
156
|
-
const
|
|
157
|
-
config,
|
|
158
|
-
bootstrapNode,
|
|
159
|
-
tcpPort,
|
|
160
|
-
dataDirectory,
|
|
161
|
-
);
|
|
155
|
+
const p2pConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
|
|
162
156
|
|
|
163
|
-
const aztecNodeRpcTxProvider = undefined;
|
|
164
157
|
return await createAndSyncProverNode(
|
|
165
158
|
bufferToHex(proverNodePrivateKey),
|
|
166
|
-
config,
|
|
167
|
-
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
{ ...proverNodeDeps, telemetry },
|
|
159
|
+
{ ...config, ...p2pConfig },
|
|
160
|
+
{ dataDirectory },
|
|
161
|
+
{ ...deps, telemetry },
|
|
162
|
+
{ genesis },
|
|
171
163
|
);
|
|
172
164
|
});
|
|
173
165
|
}
|
|
@@ -215,7 +207,7 @@ export async function createValidatorConfig(
|
|
|
215
207
|
...config,
|
|
216
208
|
...p2pConfig,
|
|
217
209
|
validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
|
|
218
|
-
|
|
210
|
+
sequencerPublisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
|
|
219
211
|
};
|
|
220
212
|
|
|
221
213
|
return nodeConfig;
|
|
@@ -8,7 +8,6 @@ export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAd
|
|
|
8
8
|
logger.info(`Deploying Token contract...`);
|
|
9
9
|
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
|
|
10
10
|
from: admin,
|
|
11
|
-
wait: { returnReceipt: true },
|
|
12
11
|
});
|
|
13
12
|
|
|
14
13
|
if (initialAdminBalance > 0n) {
|
|
@@ -25,8 +24,9 @@ export async function mintTokensToPrivate(
|
|
|
25
24
|
minter: AztecAddress,
|
|
26
25
|
recipient: AztecAddress,
|
|
27
26
|
amount: bigint,
|
|
27
|
+
additionalScopes?: AztecAddress[],
|
|
28
28
|
) {
|
|
29
|
-
await token.methods.mint_to_private(recipient, amount).send({ from: minter });
|
|
29
|
+
await token.methods.mint_to_private(recipient, amount).send({ from: minter, additionalScopes });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export async function expectTokenBalance(
|
|
@@ -38,7 +38,7 @@ export async function expectTokenBalance(
|
|
|
38
38
|
) {
|
|
39
39
|
// Then check the balance
|
|
40
40
|
const contractWithWallet = TokenContract.at(token.address, wallet);
|
|
41
|
-
const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
41
|
+
const { result: balance } = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
42
42
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
43
43
|
expect(balance).toBe(expectedBalance);
|
|
44
44
|
}
|