@aztec/end-to-end 0.0.1-commit.fffb133c → 0.0.1-dev
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 +21 -14
- 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 +17 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +89 -42
- 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_l1_publisher/write_json.d.ts +3 -2
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +1 -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.d.ts +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +1 -0
- package/dest/e2e_p2p/p2p_network.d.ts +4 -3
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +23 -6
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +177 -0
- package/dest/e2e_p2p/shared.d.ts +34 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +63 -5
- 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 +4 -4
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +34 -41
- 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/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/setup.d.ts +53 -31
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +117 -168
- package/dest/fixtures/setup_p2p_test.d.ts +16 -9
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +40 -29
- 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 -4
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- 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 +3 -3
- 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/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 -21
- 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 +59 -16
- package/dest/spartan/tx_metrics.d.ts +35 -1
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +150 -0
- 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 +4 -1
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +2 -1
- package/dest/spartan/utils/index.d.ts +5 -4
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +4 -2
- package/dest/spartan/utils/k8s.d.ts +31 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +124 -0
- package/dest/spartan/utils/nodes.d.ts +11 -1
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +198 -27
- package/dest/spartan/utils/scripts.d.ts +18 -4
- package/dest/spartan/utils/scripts.d.ts.map +1 -1
- package/dest/spartan/utils/scripts.js +19 -4
- 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 +253 -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 +66 -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 +277 -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 +48 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +44 -40
- 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 +113 -70
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +21 -29
- package/src/e2e_l1_publisher/write_json.ts +1 -6
- package/src/e2e_nested_contract/nested_contract_test.ts +7 -5
- package/src/e2e_p2p/inactivity_slash_test.ts +5 -4
- package/src/e2e_p2p/p2p_network.ts +35 -9
- package/src/e2e_p2p/reqresp/utils.ts +235 -0
- package/src/e2e_p2p/shared.ts +110 -5
- 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 +40 -44
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/ha_setup.ts +186 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/setup.ts +161 -228
- package/src/fixtures/setup_p2p_test.ts +40 -44
- package/src/fixtures/token_utils.ts +6 -3
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +3 -5
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -2
- package/src/shared/index.ts +1 -0
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +6 -2
- package/src/shared/uniswap_l1_l2.ts +38 -37
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +104 -18
- package/src/spartan/tx_metrics.ts +126 -0
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +1 -0
- package/src/spartan/utils/index.ts +7 -1
- package/src/spartan/utils/k8s.ts +160 -0
- package/src/spartan/utils/nodes.ts +239 -24
- package/src/spartan/utils/scripts.ts +43 -7
- package/src/test-wallet/test_wallet.ts +355 -0
- package/src/test-wallet/utils.ts +107 -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,36 +31,30 @@ import {
|
|
|
30
31
|
type ZKPassportArgs,
|
|
31
32
|
deployAztecL1Contracts,
|
|
32
33
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
EthCheatCodes,
|
|
36
|
-
EthCheatCodesWithState,
|
|
37
|
-
createDelayedL1TxUtilsFromViemWallet,
|
|
38
|
-
startAnvil,
|
|
39
|
-
} from '@aztec/ethereum/test';
|
|
34
|
+
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
35
|
+
import { type Anvil, EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
40
36
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
41
37
|
import { SecretValue } from '@aztec/foundation/config';
|
|
42
38
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
43
39
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
44
|
-
import {
|
|
40
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
45
41
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
46
42
|
import { sleep } from '@aztec/foundation/sleep';
|
|
47
43
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
48
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
49
44
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
50
45
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
51
46
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
52
47
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
53
48
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
54
|
-
import
|
|
55
|
-
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
49
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
50
|
+
import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
|
|
56
51
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
57
|
-
import
|
|
52
|
+
import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
|
|
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 { DEV_VERSION } from '@aztec/stdlib/update-checker';
|
|
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) {
|
|
@@ -125,14 +117,14 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
|
|
|
125
117
|
* @param aztecNode - An instance of Aztec Node.
|
|
126
118
|
* @param opts - Partial configuration for the PXE.
|
|
127
119
|
* @param logger - The logger to be used.
|
|
128
|
-
* @param
|
|
120
|
+
* @param actor - Actor label to include in log output (e.g., 'pxe-test').
|
|
129
121
|
* @returns A test wallet, logger and teardown function.
|
|
130
122
|
*/
|
|
131
123
|
export async function setupPXEAndGetWallet(
|
|
132
124
|
aztecNode: AztecNode,
|
|
133
125
|
opts: Partial<PXEConfig> = {},
|
|
134
126
|
logger = getLogger(),
|
|
135
|
-
|
|
127
|
+
actor?: string,
|
|
136
128
|
): Promise<{
|
|
137
129
|
wallet: TestWallet;
|
|
138
130
|
logger: Logger;
|
|
@@ -150,9 +142,7 @@ export async function setupPXEAndGetWallet(
|
|
|
150
142
|
|
|
151
143
|
const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
|
|
152
144
|
|
|
153
|
-
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
154
|
-
useLogSuffix,
|
|
155
|
-
});
|
|
145
|
+
const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
|
|
156
146
|
|
|
157
147
|
return {
|
|
158
148
|
wallet,
|
|
@@ -199,6 +189,11 @@ export type SetupOptions = {
|
|
|
199
189
|
anvilAccounts?: number;
|
|
200
190
|
/** Port to start anvil (defaults to 8545) */
|
|
201
191
|
anvilPort?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Number of slots per epoch for Anvil's finality simulation.
|
|
194
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
195
|
+
*/
|
|
196
|
+
anvilSlotsInAnEpoch?: number;
|
|
202
197
|
/** Key to use for publishing L1 contracts */
|
|
203
198
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
204
199
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
@@ -211,6 +206,8 @@ export type SetupOptions = {
|
|
|
211
206
|
l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
|
|
212
207
|
/** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
|
|
213
208
|
walletMinFeePadding?: number;
|
|
209
|
+
/** Options forwarded to PXE creation (e.g. execution hooks). */
|
|
210
|
+
pxeCreationOptions?: PXECreationOptions;
|
|
214
211
|
} & Partial<AztecNodeConfig>;
|
|
215
212
|
|
|
216
213
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
@@ -218,14 +215,14 @@ export type EndToEndContext = {
|
|
|
218
215
|
/** The Anvil instance (only set if anvil was started locally). */
|
|
219
216
|
anvil: Anvil | undefined;
|
|
220
217
|
/** The Aztec Node service or client a connected to it. */
|
|
221
|
-
aztecNode: AztecNode;
|
|
222
|
-
/** The Aztec Node as a service
|
|
223
|
-
aztecNodeService: AztecNodeService
|
|
224
|
-
/** Client to the Aztec Node admin interface
|
|
225
|
-
aztecNodeAdmin: AztecNodeAdmin
|
|
226
|
-
/** The prover node
|
|
227
|
-
proverNode:
|
|
228
|
-
/** 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. */
|
|
229
226
|
sequencer: SequencerClient | undefined;
|
|
230
227
|
/** Return values from deployAztecL1Contracts function. */
|
|
231
228
|
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
@@ -245,14 +242,18 @@ export type EndToEndContext = {
|
|
|
245
242
|
cheatCodes: CheatCodes;
|
|
246
243
|
/** The cheat codes for L1 */
|
|
247
244
|
ethCheatCodes: EthCheatCodes;
|
|
248
|
-
/** The anvil test watcher
|
|
249
|
-
watcher: AnvilTestWatcher
|
|
250
|
-
/** Allows tweaking current system time, used by the epoch cache only
|
|
251
|
-
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;
|
|
252
249
|
/** Telemetry client */
|
|
253
|
-
telemetryClient: TelemetryClient
|
|
250
|
+
telemetryClient: TelemetryClient;
|
|
254
251
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
255
252
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
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;
|
|
256
257
|
/** Prefilled public data used for setting up nodes. */
|
|
257
258
|
prefilledPublicData: PublicDataTreeLeaf[] | undefined;
|
|
258
259
|
/** ACVM config (only set if running locally). */
|
|
@@ -260,85 +261,43 @@ export type EndToEndContext = {
|
|
|
260
261
|
/** BB config (only set if running locally). */
|
|
261
262
|
bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
|
|
262
263
|
/** Directory to cleanup on teardown. */
|
|
263
|
-
directoryToCleanup: string
|
|
264
|
+
directoryToCleanup: string;
|
|
264
265
|
/** Function to stop the started services. */
|
|
265
266
|
teardown: () => Promise<void>;
|
|
266
267
|
};
|
|
267
268
|
|
|
268
269
|
/**
|
|
269
|
-
*
|
|
270
|
+
* When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
|
|
271
|
+
* aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
|
|
272
|
+
* actually swapped in the correct version.
|
|
270
273
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
numberOfAccounts: number,
|
|
276
|
-
): Promise<EndToEndContext> {
|
|
277
|
-
const aztecNodeUrl = getAztecUrl();
|
|
278
|
-
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
279
|
-
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
280
|
-
await waitForNode(aztecNode, logger);
|
|
281
|
-
logger.verbose('JSON RPC client connected to Aztec Node');
|
|
282
|
-
logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
|
|
283
|
-
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
284
|
-
|
|
285
|
-
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
286
|
-
|
|
287
|
-
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
|
|
288
|
-
l1ContractAddresses,
|
|
289
|
-
l1Client,
|
|
290
|
-
rollupVersion,
|
|
291
|
-
};
|
|
292
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
293
|
-
const wallet = await TestWallet.create(aztecNode);
|
|
294
|
-
|
|
295
|
-
if (config.walletMinFeePadding !== undefined) {
|
|
296
|
-
wallet.setMinFeePadding(config.walletMinFeePadding);
|
|
274
|
+
function assertContractArtifactsVersion() {
|
|
275
|
+
const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
|
|
276
|
+
if (!expected) {
|
|
277
|
+
return;
|
|
297
278
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
279
|
+
const { aztecVersion } = SponsoredFPCContract.artifact;
|
|
280
|
+
// TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
|
|
281
|
+
if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
|
|
282
|
+
createLogger('e2e:setup').info(
|
|
283
|
+
`Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`,
|
|
284
|
+
);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
// TODO(F-557): Remove once v4.3.0 drops off the compat matrix. The v4.3.0 npm release shipped with
|
|
288
|
+
// aztec_version: "dev" baked into the artifact JSONs because of a bug.
|
|
289
|
+
if (expected === '4.3.0' && aztecVersion === DEV_VERSION) {
|
|
290
|
+
createLogger('e2e:setup').warn(
|
|
291
|
+
`Skipping artifact version check: v4.3.0 artifacts shipped with aztec_version="dev"`,
|
|
292
|
+
);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (aztecVersion !== expected) {
|
|
296
|
+
throw new Error(
|
|
297
|
+
`Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` +
|
|
298
|
+
`The legacy artifact resolver may not have swapped in the correct version.`,
|
|
299
|
+
);
|
|
307
300
|
}
|
|
308
|
-
|
|
309
|
-
const testAccounts = await Promise.all(
|
|
310
|
-
initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
|
|
311
|
-
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
312
|
-
return accountManager.address;
|
|
313
|
-
}),
|
|
314
|
-
);
|
|
315
|
-
|
|
316
|
-
return {
|
|
317
|
-
anvil: undefined,
|
|
318
|
-
aztecNode,
|
|
319
|
-
aztecNodeService: undefined,
|
|
320
|
-
aztecNodeAdmin: undefined,
|
|
321
|
-
sequencer: undefined,
|
|
322
|
-
proverNode: undefined,
|
|
323
|
-
deployL1ContractsValues,
|
|
324
|
-
config,
|
|
325
|
-
aztecNodeConfig: config,
|
|
326
|
-
initialFundedAccounts,
|
|
327
|
-
wallet,
|
|
328
|
-
accounts: testAccounts,
|
|
329
|
-
logger,
|
|
330
|
-
cheatCodes,
|
|
331
|
-
ethCheatCodes,
|
|
332
|
-
prefilledPublicData: undefined,
|
|
333
|
-
mockGossipSubNetwork: undefined,
|
|
334
|
-
watcher: undefined,
|
|
335
|
-
dateProvider: undefined,
|
|
336
|
-
telemetryClient: undefined,
|
|
337
|
-
acvmConfig: undefined,
|
|
338
|
-
bbConfig: undefined,
|
|
339
|
-
directoryToCleanup: undefined,
|
|
340
|
-
teardown,
|
|
341
|
-
};
|
|
342
301
|
}
|
|
343
302
|
|
|
344
303
|
/**
|
|
@@ -353,6 +312,7 @@ export async function setup(
|
|
|
353
312
|
pxeOpts: Partial<PXEConfig> = {},
|
|
354
313
|
chain: Chain = foundry,
|
|
355
314
|
): Promise<EndToEndContext> {
|
|
315
|
+
assertContractArtifactsVersion();
|
|
356
316
|
let anvil: Anvil | undefined;
|
|
357
317
|
try {
|
|
358
318
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
@@ -368,8 +328,12 @@ export async function setup(
|
|
|
368
328
|
config.realProofs = !!opts.realProofs;
|
|
369
329
|
// Only enforce the time table if requested
|
|
370
330
|
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
331
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
332
|
+
config.enableDelayer = true;
|
|
371
333
|
config.listenAddress = '127.0.0.1';
|
|
372
334
|
|
|
335
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
336
|
+
|
|
373
337
|
const logger = getLogger();
|
|
374
338
|
|
|
375
339
|
// Create a temp directory for any services that need it and cleanup later
|
|
@@ -379,20 +343,18 @@ export async function setup(
|
|
|
379
343
|
config.dataDirectory = directoryToCleanup;
|
|
380
344
|
}
|
|
381
345
|
|
|
346
|
+
const dateProvider = new TestDateProvider();
|
|
347
|
+
|
|
382
348
|
if (!config.l1RpcUrls?.length) {
|
|
383
349
|
if (!isAnvilTestChain(chain.id)) {
|
|
384
350
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
385
351
|
}
|
|
386
|
-
if (AZTEC_NODE_URL) {
|
|
387
|
-
throw new Error(
|
|
388
|
-
`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`,
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
352
|
const res = await startAnvil({
|
|
393
353
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
394
354
|
accounts: opts.anvilAccounts,
|
|
395
|
-
port: opts.anvilPort,
|
|
355
|
+
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
356
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
357
|
+
dateProvider,
|
|
396
358
|
});
|
|
397
359
|
anvil = res.anvil;
|
|
398
360
|
config.l1RpcUrls = [res.rpcUrl];
|
|
@@ -404,8 +366,6 @@ export async function setup(
|
|
|
404
366
|
logger.info(`Logging metrics to ${filename}`);
|
|
405
367
|
setupMetricsLogger(filename);
|
|
406
368
|
}
|
|
407
|
-
|
|
408
|
-
const dateProvider = new TestDateProvider();
|
|
409
369
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
410
370
|
|
|
411
371
|
if (opts.stateLoad) {
|
|
@@ -423,11 +383,11 @@ export async function setup(
|
|
|
423
383
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
424
384
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
425
385
|
} else if (
|
|
426
|
-
config.
|
|
427
|
-
config.
|
|
428
|
-
config.
|
|
386
|
+
config.sequencerPublisherPrivateKeys &&
|
|
387
|
+
config.sequencerPublisherPrivateKeys.length > 0 &&
|
|
388
|
+
config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
|
|
429
389
|
) {
|
|
430
|
-
publisherPrivKeyHex = config.
|
|
390
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
431
391
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
432
392
|
} else if (!MNEMONIC) {
|
|
433
393
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -436,18 +396,13 @@ export async function setup(
|
|
|
436
396
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
437
397
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
438
398
|
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
|
|
439
|
-
config.
|
|
399
|
+
config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
440
400
|
}
|
|
441
401
|
|
|
442
402
|
if (config.coinbase === undefined) {
|
|
443
403
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
444
404
|
}
|
|
445
405
|
|
|
446
|
-
if (AZTEC_NODE_URL) {
|
|
447
|
-
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
448
|
-
return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
406
|
// Determine which addresses to fund in genesis
|
|
452
407
|
const initialFundedAccounts =
|
|
453
408
|
opts.initialFundedAccounts ??
|
|
@@ -504,7 +459,13 @@ export async function setup(
|
|
|
504
459
|
if (enableAutomine) {
|
|
505
460
|
await ethCheatCodes.setAutomine(false);
|
|
506
461
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
507
|
-
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
465
|
+
// ahead of system time due to the local-network watcher warping time forward on each filled slot.
|
|
466
|
+
// When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
|
|
467
|
+
if (!anvil) {
|
|
468
|
+
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
508
469
|
}
|
|
509
470
|
|
|
510
471
|
if (opts.l2StartTime) {
|
|
@@ -543,7 +504,7 @@ export async function setup(
|
|
|
543
504
|
}
|
|
544
505
|
|
|
545
506
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
546
|
-
let p2pClientDeps: P2PClientDeps
|
|
507
|
+
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
547
508
|
|
|
548
509
|
if (opts.mockGossipSubNetwork) {
|
|
549
510
|
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
@@ -574,44 +535,51 @@ export async function setup(
|
|
|
574
535
|
}
|
|
575
536
|
}
|
|
576
537
|
|
|
577
|
-
const aztecNodeService = await
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
538
|
+
const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
|
|
539
|
+
AztecNodeService.createAndSync(
|
|
540
|
+
config,
|
|
541
|
+
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
542
|
+
{ prefilledPublicData },
|
|
543
|
+
),
|
|
581
544
|
);
|
|
582
545
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
583
546
|
|
|
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;
|
|
547
|
+
let proverNode: AztecNodeService | undefined = undefined;
|
|
590
548
|
if (opts.startProverNode) {
|
|
591
549
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
592
550
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
593
551
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
594
552
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
553
|
+
|
|
554
|
+
const p2pClientDeps: Partial<P2PClientDeps> = {
|
|
555
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
|
|
556
|
+
rpcTxProviders: [aztecNodeService],
|
|
599
557
|
};
|
|
600
|
-
|
|
558
|
+
|
|
559
|
+
({ proverNode } = await createAndSyncProverNode(
|
|
601
560
|
proverNodePrivateKeyHex,
|
|
602
561
|
config,
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
562
|
+
{
|
|
563
|
+
...config.proverNodeConfig,
|
|
564
|
+
dataDirectory: proverNodeDataDirectory,
|
|
565
|
+
},
|
|
566
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
567
|
+
{ prefilledPublicData },
|
|
568
|
+
));
|
|
607
569
|
}
|
|
608
570
|
|
|
571
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
572
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
573
|
+
|
|
609
574
|
logger.verbose('Creating a pxe...');
|
|
610
575
|
const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
|
|
611
576
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
612
577
|
// For tests we only want proving enabled if specifically requested
|
|
613
578
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
614
|
-
const wallet = await TestWallet.create(aztecNodeService, pxeConfig
|
|
579
|
+
const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
|
|
580
|
+
loggerActorLabel: 'pxe-0',
|
|
581
|
+
...opts.pxeCreationOptions,
|
|
582
|
+
});
|
|
615
583
|
|
|
616
584
|
if (opts.walletMinFeePadding !== undefined) {
|
|
617
585
|
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
@@ -683,7 +651,7 @@ export async function setup(
|
|
|
683
651
|
logger.error(`Error during e2e test teardown`, err);
|
|
684
652
|
} finally {
|
|
685
653
|
try {
|
|
686
|
-
await telemetryClient
|
|
654
|
+
await telemetryClient.stop();
|
|
687
655
|
} catch (err) {
|
|
688
656
|
logger.error(`Error during telemetry client stop`, err);
|
|
689
657
|
}
|
|
@@ -706,6 +674,8 @@ export async function setup(
|
|
|
706
674
|
mockGossipSubNetwork,
|
|
707
675
|
prefilledPublicData,
|
|
708
676
|
proverNode,
|
|
677
|
+
sequencerDelayer,
|
|
678
|
+
proverDelayer,
|
|
709
679
|
sequencer: sequencerClient,
|
|
710
680
|
teardown,
|
|
711
681
|
telemetryClient,
|
|
@@ -789,93 +759,55 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
|
|
|
789
759
|
);
|
|
790
760
|
}
|
|
791
761
|
|
|
762
|
+
/**
|
|
763
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
764
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
765
|
+
*/
|
|
792
766
|
export function createAndSyncProverNode(
|
|
793
767
|
proverNodePrivateKey: `0x${string}`,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
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,
|
|
768
|
+
baseConfig: AztecNodeConfig,
|
|
769
|
+
configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
|
|
770
|
+
deps: {
|
|
771
|
+
telemetry?: TelemetryClient;
|
|
772
|
+
dateProvider: DateProvider;
|
|
773
|
+
p2pClientDeps?: P2PClientDeps;
|
|
774
|
+
},
|
|
775
|
+
options: { prefilledPublicData: PublicDataTreeLeaf[]; dontStart?: boolean },
|
|
776
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
777
|
+
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
778
|
+
const proverNode = await AztecNodeService.createAndSync(
|
|
779
|
+
{
|
|
780
|
+
...baseConfig,
|
|
781
|
+
...configOverrides,
|
|
782
|
+
p2pPort: 0,
|
|
783
|
+
enableProverNode: true,
|
|
784
|
+
disableValidator: true,
|
|
785
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
786
|
+
},
|
|
787
|
+
deps,
|
|
788
|
+
{ ...options, dontStartProverNode: options.dontStart },
|
|
840
789
|
);
|
|
841
790
|
|
|
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();
|
|
791
|
+
if (!proverNode.getProverNode()) {
|
|
792
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
850
793
|
}
|
|
851
|
-
return proverNode;
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
794
|
|
|
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;
|
|
795
|
+
getLogger().info(`Created and synced prover node`);
|
|
796
|
+
return { proverNode };
|
|
797
|
+
});
|
|
867
798
|
}
|
|
868
799
|
|
|
869
800
|
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
870
801
|
export function getBalancesFn(
|
|
871
802
|
symbol: string,
|
|
872
803
|
method: ContractMethod,
|
|
873
|
-
from: AztecAddress,
|
|
874
804
|
logger: any,
|
|
875
805
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
876
806
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
877
807
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
878
|
-
const b = await Promise.all(
|
|
808
|
+
const b = await Promise.all(
|
|
809
|
+
addresses.map(async address => (await method(address).simulate({ from: address })).result),
|
|
810
|
+
);
|
|
879
811
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
880
812
|
logger.verbose(debugString);
|
|
881
813
|
return b;
|
|
@@ -944,7 +876,7 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
|
|
|
944
876
|
* Returns deployed account data that can be used by tests.
|
|
945
877
|
*/
|
|
946
878
|
export const deployAccounts =
|
|
947
|
-
(numberOfAccounts: number, logger: Logger) =>
|
|
879
|
+
(numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<DeployInteractionWaitOptions>>) =>
|
|
948
880
|
async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
|
|
949
881
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
950
882
|
throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
|
|
@@ -961,8 +893,9 @@ export const deployAccounts =
|
|
|
961
893
|
);
|
|
962
894
|
const deployMethod = await accountManager.getDeployMethod();
|
|
963
895
|
await deployMethod.send({
|
|
964
|
-
from:
|
|
896
|
+
from: NO_FROM,
|
|
965
897
|
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
898
|
+
...deployOptions,
|
|
966
899
|
});
|
|
967
900
|
}
|
|
968
901
|
|
|
@@ -993,7 +926,7 @@ export async function publicDeployAccounts(
|
|
|
993
926
|
|
|
994
927
|
const batch = new BatchCall(wallet, calls);
|
|
995
928
|
|
|
996
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
929
|
+
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
997
930
|
if (waitUntilProven) {
|
|
998
931
|
if (!node) {
|
|
999
932
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|