@aztec/end-to-end 0.0.1-commit.ee80a48 → 0.0.1-commit.f103f88
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 +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +22 -29
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- 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 +6 -3
- 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 +23 -13
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- 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 +64 -36
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +19 -12
- 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 +9 -10
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +38 -20
- 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 +26 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +54 -45
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +19 -9
- 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 +7 -6
- 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 +53 -29
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +79 -163
- package/dest/fixtures/setup_p2p_test.d.ts +18 -10
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +23 -17
- 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.d.ts +2 -2
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- 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 +16 -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 +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +100 -39
- 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 +84 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +249 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- 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 +279 -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 -43
- package/src/bench/client_flows/client_flows_benchmark.ts +31 -18
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/utils.ts +8 -3
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +31 -21
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
- package/src/e2e_deploy_contract/deploy_test.ts +3 -3
- package/src/e2e_epochs/epochs_test.ts +85 -63
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +21 -29
- package/src/e2e_nested_contract/nested_contract_test.ts +7 -5
- package/src/e2e_p2p/inactivity_slash_test.ts +7 -7
- package/src/e2e_p2p/p2p_network.ts +58 -37
- package/src/e2e_p2p/reqresp/utils.ts +62 -13
- package/src/e2e_p2p/shared.ts +74 -60
- package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
- package/src/e2e_token_contract/token_contract_test.ts +26 -9
- 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 +46 -55
- 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 +124 -231
- package/src/fixtures/setup_p2p_test.ts +33 -32
- package/src/fixtures/token_utils.ts +3 -3
- package/src/guides/up_quick_start.sh +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 +3 -2
- package/src/shared/uniswap_l1_l2.ts +38 -33
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +141 -32
- 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 +351 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +214 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
package/src/fixtures/setup.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { type InitialAccountData, generateSchnorrAccounts
|
|
3
|
-
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
2
|
+
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
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,
|
|
8
8
|
type ContractFunctionInteraction,
|
|
9
9
|
type ContractMethod,
|
|
10
|
+
type DeployInteractionWaitOptions,
|
|
11
|
+
type DeployOptions,
|
|
10
12
|
getContractClassFromArtifact,
|
|
11
13
|
waitForProven,
|
|
12
14
|
} from '@aztec/aztec.js/contracts';
|
|
13
15
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
14
16
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
15
17
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
16
|
-
import {
|
|
18
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
19
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
18
20
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
19
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
20
21
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
21
22
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
22
23
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -30,13 +31,9 @@ import {
|
|
|
30
31
|
type ZKPassportArgs,
|
|
31
32
|
deployAztecL1Contracts,
|
|
32
33
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
EthCheatCodesWithState,
|
|
37
|
-
createDelayedL1TxUtilsFromViemWallet,
|
|
38
|
-
startAnvil,
|
|
39
|
-
} from '@aztec/ethereum/test';
|
|
34
|
+
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
35
|
+
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
36
|
+
import type { Anvil } from '@aztec/ethereum/test';
|
|
40
37
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
41
38
|
import { SecretValue } from '@aztec/foundation/config';
|
|
42
39
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
@@ -45,21 +42,19 @@ import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
|
45
42
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
46
43
|
import { sleep } from '@aztec/foundation/sleep';
|
|
47
44
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
48
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
49
45
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
50
46
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
51
47
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
52
48
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
53
49
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
54
|
-
import
|
|
50
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
55
51
|
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
56
52
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
57
|
-
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
58
53
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
59
|
-
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
54
|
+
import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
60
55
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
61
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
62
56
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
57
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
63
58
|
import {
|
|
64
59
|
type TelemetryClient,
|
|
65
60
|
type TelemetryClientConfig,
|
|
@@ -67,10 +62,9 @@ import {
|
|
|
67
62
|
initTelemetryClient,
|
|
68
63
|
} from '@aztec/telemetry-client';
|
|
69
64
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
70
|
-
import {
|
|
65
|
+
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
71
66
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
72
67
|
|
|
73
|
-
import type { Anvil } from '@viem/anvil';
|
|
74
68
|
import fs from 'fs/promises';
|
|
75
69
|
import { tmpdir } from 'os';
|
|
76
70
|
import path from 'path';
|
|
@@ -84,6 +78,7 @@ import {
|
|
|
84
78
|
} from 'viem/accounts';
|
|
85
79
|
import { type Chain, foundry } from 'viem/chains';
|
|
86
80
|
|
|
81
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
87
82
|
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
88
83
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
89
84
|
import { getBBConfig } from './get_bb_config.js';
|
|
@@ -92,9 +87,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
92
87
|
|
|
93
88
|
export { startAnvil };
|
|
94
89
|
|
|
95
|
-
const { AZTEC_NODE_URL = '' } = process.env;
|
|
96
|
-
const getAztecUrl = () => AZTEC_NODE_URL;
|
|
97
|
-
|
|
98
90
|
let telemetry: TelemetryClient | undefined = undefined;
|
|
99
91
|
async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
|
|
100
92
|
if (!telemetry) {
|
|
@@ -189,6 +181,8 @@ export type SetupOptions = {
|
|
|
189
181
|
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
190
182
|
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
191
183
|
mockGossipSubNetwork?: boolean;
|
|
184
|
+
/** Whether to add simulated latency to the mock gossipsub network (in ms) */
|
|
185
|
+
mockGossipSubNetworkLatency?: number;
|
|
192
186
|
/** Whether to disable the anvil test watcher (can still be manually started) */
|
|
193
187
|
disableAnvilTestWatcher?: boolean;
|
|
194
188
|
/** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
|
|
@@ -197,6 +191,11 @@ export type SetupOptions = {
|
|
|
197
191
|
anvilAccounts?: number;
|
|
198
192
|
/** Port to start anvil (defaults to 8545) */
|
|
199
193
|
anvilPort?: number;
|
|
194
|
+
/**
|
|
195
|
+
* Number of slots per epoch for Anvil's finality simulation.
|
|
196
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
197
|
+
*/
|
|
198
|
+
anvilSlotsInAnEpoch?: number;
|
|
200
199
|
/** Key to use for publishing L1 contracts */
|
|
201
200
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
202
201
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
@@ -216,14 +215,14 @@ export type EndToEndContext = {
|
|
|
216
215
|
/** The Anvil instance (only set if anvil was started locally). */
|
|
217
216
|
anvil: Anvil | undefined;
|
|
218
217
|
/** The Aztec Node service or client a connected to it. */
|
|
219
|
-
aztecNode: AztecNode;
|
|
220
|
-
/** The Aztec Node as a service
|
|
221
|
-
aztecNodeService: AztecNodeService
|
|
222
|
-
/** Client to the Aztec Node admin interface
|
|
223
|
-
aztecNodeAdmin: AztecNodeAdmin
|
|
224
|
-
/** The prover node
|
|
225
|
-
proverNode:
|
|
226
|
-
/** A client to the sequencer service
|
|
218
|
+
aztecNode: AztecNode & AztecNodeDebug;
|
|
219
|
+
/** The Aztec Node as a service. */
|
|
220
|
+
aztecNodeService: AztecNodeService;
|
|
221
|
+
/** Client to the Aztec Node admin interface. */
|
|
222
|
+
aztecNodeAdmin: AztecNodeAdmin;
|
|
223
|
+
/** The aztec node running the prover node subsystem (only set if startProverNode is true). */
|
|
224
|
+
proverNode: AztecNodeService | undefined;
|
|
225
|
+
/** A client to the sequencer service. */
|
|
227
226
|
sequencer: SequencerClient | undefined;
|
|
228
227
|
/** Return values from deployAztecL1Contracts function. */
|
|
229
228
|
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
@@ -243,102 +242,30 @@ export type EndToEndContext = {
|
|
|
243
242
|
cheatCodes: CheatCodes;
|
|
244
243
|
/** The cheat codes for L1 */
|
|
245
244
|
ethCheatCodes: EthCheatCodes;
|
|
246
|
-
/** The anvil test watcher
|
|
247
|
-
watcher: AnvilTestWatcher
|
|
248
|
-
/** Allows tweaking current system time, used by the epoch cache only
|
|
249
|
-
dateProvider: TestDateProvider
|
|
245
|
+
/** The anvil test watcher. */
|
|
246
|
+
watcher: AnvilTestWatcher;
|
|
247
|
+
/** Allows tweaking current system time, used by the epoch cache only. */
|
|
248
|
+
dateProvider: TestDateProvider;
|
|
250
249
|
/** Telemetry client */
|
|
251
|
-
telemetryClient: TelemetryClient
|
|
250
|
+
telemetryClient: TelemetryClient;
|
|
252
251
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
253
252
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
254
|
-
/**
|
|
255
|
-
|
|
253
|
+
/** Delayer for sequencer L1 txs (only when enableDelayer is true). */
|
|
254
|
+
sequencerDelayer: Delayer | undefined;
|
|
255
|
+
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
256
|
+
proverDelayer: Delayer | undefined;
|
|
257
|
+
/** Genesis data used for setting up nodes. */
|
|
258
|
+
genesis: GenesisData | undefined;
|
|
256
259
|
/** ACVM config (only set if running locally). */
|
|
257
260
|
acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
|
|
258
261
|
/** BB config (only set if running locally). */
|
|
259
262
|
bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
|
|
260
263
|
/** Directory to cleanup on teardown. */
|
|
261
|
-
directoryToCleanup: string
|
|
264
|
+
directoryToCleanup: string;
|
|
262
265
|
/** Function to stop the started services. */
|
|
263
266
|
teardown: () => Promise<void>;
|
|
264
267
|
};
|
|
265
268
|
|
|
266
|
-
/**
|
|
267
|
-
* Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
|
|
268
|
-
*/
|
|
269
|
-
async function setupWithRemoteEnvironment(
|
|
270
|
-
account: HDAccount | PrivateKeyAccount,
|
|
271
|
-
config: AztecNodeConfig & SetupOptions,
|
|
272
|
-
logger: Logger,
|
|
273
|
-
numberOfAccounts: number,
|
|
274
|
-
): Promise<EndToEndContext> {
|
|
275
|
-
const aztecNodeUrl = getAztecUrl();
|
|
276
|
-
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
277
|
-
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
278
|
-
await waitForNode(aztecNode, logger);
|
|
279
|
-
logger.verbose('JSON RPC client connected to Aztec Node');
|
|
280
|
-
logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
|
|
281
|
-
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
282
|
-
|
|
283
|
-
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
284
|
-
|
|
285
|
-
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
|
|
286
|
-
l1ContractAddresses,
|
|
287
|
-
l1Client,
|
|
288
|
-
rollupVersion,
|
|
289
|
-
};
|
|
290
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
291
|
-
const wallet = await TestWallet.create(aztecNode);
|
|
292
|
-
|
|
293
|
-
if (config.walletMinFeePadding !== undefined) {
|
|
294
|
-
wallet.setMinFeePadding(config.walletMinFeePadding);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
|
|
298
|
-
const teardown = () => Promise.resolve();
|
|
299
|
-
|
|
300
|
-
logger.verbose('Populating wallet from already registered accounts...');
|
|
301
|
-
const initialFundedAccounts = await getInitialTestAccountsData();
|
|
302
|
-
|
|
303
|
-
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
304
|
-
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const testAccounts = await Promise.all(
|
|
308
|
-
initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
|
|
309
|
-
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
310
|
-
return accountManager.address;
|
|
311
|
-
}),
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
return {
|
|
315
|
-
anvil: undefined,
|
|
316
|
-
aztecNode,
|
|
317
|
-
aztecNodeService: undefined,
|
|
318
|
-
aztecNodeAdmin: undefined,
|
|
319
|
-
sequencer: undefined,
|
|
320
|
-
proverNode: undefined,
|
|
321
|
-
deployL1ContractsValues,
|
|
322
|
-
config,
|
|
323
|
-
aztecNodeConfig: config,
|
|
324
|
-
initialFundedAccounts,
|
|
325
|
-
wallet,
|
|
326
|
-
accounts: testAccounts,
|
|
327
|
-
logger,
|
|
328
|
-
cheatCodes,
|
|
329
|
-
ethCheatCodes,
|
|
330
|
-
prefilledPublicData: undefined,
|
|
331
|
-
mockGossipSubNetwork: undefined,
|
|
332
|
-
watcher: undefined,
|
|
333
|
-
dateProvider: undefined,
|
|
334
|
-
telemetryClient: undefined,
|
|
335
|
-
acvmConfig: undefined,
|
|
336
|
-
bbConfig: undefined,
|
|
337
|
-
directoryToCleanup: undefined,
|
|
338
|
-
teardown,
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
269
|
/**
|
|
343
270
|
* Sets up the environment for the end-to-end tests.
|
|
344
271
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
@@ -354,7 +281,7 @@ export async function setup(
|
|
|
354
281
|
let anvil: Anvil | undefined;
|
|
355
282
|
try {
|
|
356
283
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
357
|
-
opts.
|
|
284
|
+
opts.slasherEnabled ??= false;
|
|
358
285
|
|
|
359
286
|
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
360
287
|
// use initialValidators for the node config
|
|
@@ -366,8 +293,12 @@ export async function setup(
|
|
|
366
293
|
config.realProofs = !!opts.realProofs;
|
|
367
294
|
// Only enforce the time table if requested
|
|
368
295
|
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
296
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
297
|
+
config.enableDelayer = true;
|
|
369
298
|
config.listenAddress = '127.0.0.1';
|
|
370
299
|
|
|
300
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
301
|
+
|
|
371
302
|
const logger = getLogger();
|
|
372
303
|
|
|
373
304
|
// Create a temp directory for any services that need it and cleanup later
|
|
@@ -377,20 +308,18 @@ export async function setup(
|
|
|
377
308
|
config.dataDirectory = directoryToCleanup;
|
|
378
309
|
}
|
|
379
310
|
|
|
311
|
+
const dateProvider = new TestDateProvider();
|
|
312
|
+
|
|
380
313
|
if (!config.l1RpcUrls?.length) {
|
|
381
314
|
if (!isAnvilTestChain(chain.id)) {
|
|
382
315
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
383
316
|
}
|
|
384
|
-
if (AZTEC_NODE_URL) {
|
|
385
|
-
throw new Error(
|
|
386
|
-
`AZTEC_NODE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`,
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
|
|
390
317
|
const res = await startAnvil({
|
|
391
318
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
392
319
|
accounts: opts.anvilAccounts,
|
|
393
320
|
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
321
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
322
|
+
dateProvider,
|
|
394
323
|
});
|
|
395
324
|
anvil = res.anvil;
|
|
396
325
|
config.l1RpcUrls = [res.rpcUrl];
|
|
@@ -402,8 +331,6 @@ export async function setup(
|
|
|
402
331
|
logger.info(`Logging metrics to ${filename}`);
|
|
403
332
|
setupMetricsLogger(filename);
|
|
404
333
|
}
|
|
405
|
-
|
|
406
|
-
const dateProvider = new TestDateProvider();
|
|
407
334
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
408
335
|
|
|
409
336
|
if (opts.stateLoad) {
|
|
@@ -421,11 +348,11 @@ export async function setup(
|
|
|
421
348
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
422
349
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
423
350
|
} else if (
|
|
424
|
-
config.
|
|
425
|
-
config.
|
|
426
|
-
config.
|
|
351
|
+
config.sequencerPublisherPrivateKeys &&
|
|
352
|
+
config.sequencerPublisherPrivateKeys.length > 0 &&
|
|
353
|
+
config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
|
|
427
354
|
) {
|
|
428
|
-
publisherPrivKeyHex = config.
|
|
355
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
429
356
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
430
357
|
} else if (!MNEMONIC) {
|
|
431
358
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -434,18 +361,13 @@ export async function setup(
|
|
|
434
361
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
435
362
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
436
363
|
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
|
|
437
|
-
config.
|
|
364
|
+
config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
438
365
|
}
|
|
439
366
|
|
|
440
367
|
if (config.coinbase === undefined) {
|
|
441
368
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
442
369
|
}
|
|
443
370
|
|
|
444
|
-
if (AZTEC_NODE_URL) {
|
|
445
|
-
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
446
|
-
return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
371
|
// Determine which addresses to fund in genesis
|
|
450
372
|
const initialFundedAccounts =
|
|
451
373
|
opts.initialFundedAccounts ??
|
|
@@ -458,10 +380,12 @@ export async function setup(
|
|
|
458
380
|
addressesToFund.push(sponsoredFPCAddress);
|
|
459
381
|
}
|
|
460
382
|
|
|
461
|
-
const
|
|
383
|
+
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
384
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
|
|
462
385
|
addressesToFund,
|
|
463
386
|
opts.initialAccountFeeJuice,
|
|
464
387
|
opts.genesisPublicData,
|
|
388
|
+
genesisTimestamp,
|
|
465
389
|
);
|
|
466
390
|
|
|
467
391
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
@@ -502,7 +426,13 @@ export async function setup(
|
|
|
502
426
|
if (enableAutomine) {
|
|
503
427
|
await ethCheatCodes.setAutomine(false);
|
|
504
428
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
505
|
-
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
432
|
+
// ahead of system time due to the local-network watcher warping time forward on each filled slot.
|
|
433
|
+
// When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
|
|
434
|
+
if (!anvil) {
|
|
435
|
+
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
506
436
|
}
|
|
507
437
|
|
|
508
438
|
if (opts.l2StartTime) {
|
|
@@ -541,10 +471,10 @@ export async function setup(
|
|
|
541
471
|
}
|
|
542
472
|
|
|
543
473
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
544
|
-
let p2pClientDeps: P2PClientDeps
|
|
474
|
+
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
545
475
|
|
|
546
476
|
if (opts.mockGossipSubNetwork) {
|
|
547
|
-
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
477
|
+
mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
|
|
548
478
|
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
549
479
|
}
|
|
550
480
|
|
|
@@ -573,39 +503,37 @@ export async function setup(
|
|
|
573
503
|
}
|
|
574
504
|
|
|
575
505
|
const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
|
|
576
|
-
AztecNodeService.createAndSync(
|
|
577
|
-
config,
|
|
578
|
-
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
579
|
-
{ prefilledPublicData },
|
|
580
|
-
),
|
|
506
|
+
AztecNodeService.createAndSync(config, { dateProvider, telemetry: telemetryClient, p2pClientDeps }, { genesis }),
|
|
581
507
|
);
|
|
582
508
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
583
509
|
|
|
584
|
-
|
|
585
|
-
const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
|
|
586
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
let proverNode: ProverNode | undefined = undefined;
|
|
510
|
+
let proverNode: AztecNodeService | undefined = undefined;
|
|
590
511
|
if (opts.startProverNode) {
|
|
591
512
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
592
513
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
593
514
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
594
515
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
516
|
+
|
|
517
|
+
const p2pClientDeps: Partial<P2PClientDeps> = {
|
|
518
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
|
|
519
|
+
rpcTxProviders: [aztecNodeService],
|
|
599
520
|
};
|
|
600
|
-
|
|
521
|
+
|
|
522
|
+
({ proverNode } = await createAndSyncProverNode(
|
|
601
523
|
proverNodePrivateKeyHex,
|
|
602
524
|
config,
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
525
|
+
{
|
|
526
|
+
...config.proverNodeConfig,
|
|
527
|
+
dataDirectory: proverNodeDataDirectory,
|
|
528
|
+
},
|
|
529
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
530
|
+
{ genesis },
|
|
531
|
+
));
|
|
607
532
|
}
|
|
608
533
|
|
|
534
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
535
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
536
|
+
|
|
609
537
|
logger.verbose('Creating a pxe...');
|
|
610
538
|
const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
|
|
611
539
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
@@ -683,7 +611,7 @@ export async function setup(
|
|
|
683
611
|
logger.error(`Error during e2e test teardown`, err);
|
|
684
612
|
} finally {
|
|
685
613
|
try {
|
|
686
|
-
await telemetryClient
|
|
614
|
+
await telemetryClient.stop();
|
|
687
615
|
} catch (err) {
|
|
688
616
|
logger.error(`Error during telemetry client stop`, err);
|
|
689
617
|
}
|
|
@@ -704,8 +632,10 @@ export async function setup(
|
|
|
704
632
|
initialFundedAccounts,
|
|
705
633
|
logger,
|
|
706
634
|
mockGossipSubNetwork,
|
|
707
|
-
|
|
635
|
+
genesis,
|
|
708
636
|
proverNode,
|
|
637
|
+
sequencerDelayer,
|
|
638
|
+
proverDelayer,
|
|
709
639
|
sequencer: sequencerClient,
|
|
710
640
|
teardown,
|
|
711
641
|
telemetryClient,
|
|
@@ -789,93 +719,55 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
|
|
|
789
719
|
);
|
|
790
720
|
}
|
|
791
721
|
|
|
722
|
+
/**
|
|
723
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
724
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
725
|
+
*/
|
|
792
726
|
export function createAndSyncProverNode(
|
|
793
727
|
proverNodePrivateKey: `0x${string}`,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
728
|
+
baseConfig: AztecNodeConfig,
|
|
729
|
+
configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
|
|
730
|
+
deps: {
|
|
731
|
+
telemetry?: TelemetryClient;
|
|
732
|
+
dateProvider: DateProvider;
|
|
733
|
+
p2pClientDeps?: P2PClientDeps;
|
|
734
|
+
},
|
|
735
|
+
options: { genesis?: GenesisData; dontStart?: boolean },
|
|
736
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
800
737
|
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
{ blobClient, dateProvider: proverNodeDeps.dateProvider },
|
|
813
|
-
{ blockUntilSync: true },
|
|
814
|
-
);
|
|
815
|
-
|
|
816
|
-
const proverConfig: ProverNodeConfig = {
|
|
817
|
-
...aztecNodeConfig,
|
|
818
|
-
txCollectionNodeRpcUrls: [],
|
|
819
|
-
realProofs: false,
|
|
820
|
-
proverAgentCount: 2,
|
|
821
|
-
publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
822
|
-
proverNodeMaxPendingJobs: 10,
|
|
823
|
-
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
824
|
-
proverNodePollingIntervalMs: 200,
|
|
825
|
-
txGatheringIntervalMs: 1000,
|
|
826
|
-
txGatheringBatchSize: 10,
|
|
827
|
-
txGatheringMaxParallelRequestsPerNode: 10,
|
|
828
|
-
txGatheringTimeoutMs: 24_000,
|
|
829
|
-
proverNodeFailedEpochStore: undefined,
|
|
830
|
-
proverId: EthAddress.fromNumber(1),
|
|
831
|
-
proverNodeEpochProvingDelayMs: undefined,
|
|
832
|
-
...proverNodeConfig,
|
|
833
|
-
};
|
|
834
|
-
|
|
835
|
-
const l1TxUtils = createDelayedL1TxUtils(
|
|
836
|
-
aztecNodeConfig,
|
|
837
|
-
proverNodePrivateKey,
|
|
838
|
-
'prover-node',
|
|
839
|
-
proverNodeDeps.dateProvider,
|
|
738
|
+
const proverNode = await AztecNodeService.createAndSync(
|
|
739
|
+
{
|
|
740
|
+
...baseConfig,
|
|
741
|
+
...configOverrides,
|
|
742
|
+
p2pPort: 0,
|
|
743
|
+
enableProverNode: true,
|
|
744
|
+
disableValidator: true,
|
|
745
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
746
|
+
},
|
|
747
|
+
deps,
|
|
748
|
+
{ genesis: options.genesis, dontStartProverNode: options.dontStart },
|
|
840
749
|
);
|
|
841
750
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
{ ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
|
|
845
|
-
{ prefilledPublicData },
|
|
846
|
-
);
|
|
847
|
-
getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
|
|
848
|
-
if (!proverNodeConfig.dontStart) {
|
|
849
|
-
await proverNode.start();
|
|
751
|
+
if (!proverNode.getProverNode()) {
|
|
752
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
850
753
|
}
|
|
851
|
-
return proverNode;
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
754
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
logName: string,
|
|
859
|
-
dateProvider?: DateProvider,
|
|
860
|
-
) {
|
|
861
|
-
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
862
|
-
|
|
863
|
-
const log = createLogger(logName);
|
|
864
|
-
const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
|
|
865
|
-
l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
|
|
866
|
-
return l1TxUtils;
|
|
755
|
+
getLogger().info(`Created and synced prover node`);
|
|
756
|
+
return { proverNode };
|
|
757
|
+
});
|
|
867
758
|
}
|
|
868
759
|
|
|
869
760
|
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
870
761
|
export function getBalancesFn(
|
|
871
762
|
symbol: string,
|
|
872
763
|
method: ContractMethod,
|
|
873
|
-
from: AztecAddress,
|
|
874
764
|
logger: any,
|
|
875
765
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
876
766
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
877
767
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
878
|
-
const b = await Promise.all(
|
|
768
|
+
const b = await Promise.all(
|
|
769
|
+
addresses.map(async address => (await method(address).simulate({ from: address })).result),
|
|
770
|
+
);
|
|
879
771
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
880
772
|
logger.verbose(debugString);
|
|
881
773
|
return b;
|
|
@@ -944,7 +836,7 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
|
|
|
944
836
|
* Returns deployed account data that can be used by tests.
|
|
945
837
|
*/
|
|
946
838
|
export const deployAccounts =
|
|
947
|
-
(numberOfAccounts: number, logger: Logger) =>
|
|
839
|
+
(numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<DeployInteractionWaitOptions>>) =>
|
|
948
840
|
async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
|
|
949
841
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
950
842
|
throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
|
|
@@ -961,8 +853,9 @@ export const deployAccounts =
|
|
|
961
853
|
);
|
|
962
854
|
const deployMethod = await accountManager.getDeployMethod();
|
|
963
855
|
await deployMethod.send({
|
|
964
|
-
from:
|
|
856
|
+
from: NO_FROM,
|
|
965
857
|
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
858
|
+
...deployOptions,
|
|
966
859
|
});
|
|
967
860
|
}
|
|
968
861
|
|
|
@@ -993,7 +886,7 @@ export async function publicDeployAccounts(
|
|
|
993
886
|
|
|
994
887
|
const batch = new BatchCall(wallet, calls);
|
|
995
888
|
|
|
996
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
889
|
+
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
997
890
|
if (waitUntilProven) {
|
|
998
891
|
if (!node) {
|
|
999
892
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|