@aztec/end-to-end 0.0.1-commit.e3c1de76 → 0.0.1-commit.e57c76e
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/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +17 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +3 -3
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +36 -39
- 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 +8 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -5
- 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 +36 -17
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +16 -5
- 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 +42 -9
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +2 -1
- package/dest/e2e_epochs/epochs_test.d.ts +33 -8
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +143 -44
- package/dest/e2e_fees/fees_test.d.ts +6 -3
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +50 -17
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +6 -7
- 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 +4 -3
- package/dest/e2e_p2p/p2p_network.d.ts +14 -12
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +70 -34
- 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 +67 -14
- package/dest/e2e_p2p/shared.d.ts +37 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +91 -51
- 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 +6 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +23 -11
- 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 +9 -8
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +39 -50
- 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 +74 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +71 -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 +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/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +86 -32
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +209 -169
- package/dest/fixtures/setup_p2p_test.d.ts +22 -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/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- 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 +4 -2
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +22 -18
- package/dest/shared/gas_portal_test_harness.d.ts +8 -5
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +19 -10
- 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 +57 -40
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/lending_simulator.d.ts +10 -3
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +26 -14
- 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 +108 -41
- package/dest/spartan/tx_metrics.d.ts +18 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +74 -21
- 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 +11 -28
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +4 -1
- package/dest/spartan/utils/index.d.ts +5 -3
- 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 +11 -11
- 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/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 +85 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +273 -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 +53 -0
- package/dest/test-wallet/worker_wallet.d.ts +53 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +155 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +22 -0
- package/package.json +52 -45
- package/src/bench/client_flows/benchmark.ts +19 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +64 -49
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/utils.ts +10 -4
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +52 -25
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +56 -19
- package/src/e2e_deploy_contract/deploy_test.ts +6 -5
- package/src/e2e_epochs/epochs_test.ts +166 -68
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +57 -32
- package/src/e2e_nested_contract/nested_contract_test.ts +10 -6
- package/src/e2e_p2p/inactivity_slash_test.ts +8 -7
- package/src/e2e_p2p/p2p_network.ts +93 -49
- package/src/e2e_p2p/reqresp/utils.ts +84 -17
- package/src/e2e_p2p/shared.ts +109 -65
- 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 +38 -11
- 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 +49 -56
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +93 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +188 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +272 -233
- package/src/fixtures/setup_p2p_test.ts +37 -32
- package/src/fixtures/token_utils.ts +3 -3
- package/src/fixtures/utils.ts +2 -0
- 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 +27 -13
- package/src/shared/gas_portal_test_harness.ts +21 -11
- 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 +103 -54
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +32 -14
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +146 -35
- package/src/spartan/tx_metrics.ts +82 -24
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +3 -0
- package/src/spartan/utils/index.ts +8 -1
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/spartan/utils/nodes.ts +17 -12
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +43 -7
- package/src/test-wallet/test_wallet.ts +376 -0
- package/src/test-wallet/utils.ts +108 -0
- package/src/test-wallet/wallet_worker_script.ts +63 -0
- package/src/test-wallet/worker_wallet.ts +218 -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 DeployOptions,
|
|
11
|
+
type InteractionWaitOptions,
|
|
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
|
-
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
19
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
20
|
+
import { AnvilTestWatcher, type AnvilTestWatcherOpts, CheatCodes } from '@aztec/aztec/testing';
|
|
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,23 @@ 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
|
|
55
|
-
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
50
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
51
|
+
import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
|
|
56
52
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
57
|
-
import
|
|
53
|
+
import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
54
|
+
import { HandshakeRegistryArtifact, getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
|
|
55
|
+
import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
|
|
56
|
+
import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
|
|
58
57
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
59
|
-
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
58
|
+
import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
60
59
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
61
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
62
60
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
61
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
63
62
|
import {
|
|
64
63
|
type TelemetryClient,
|
|
65
64
|
type TelemetryClientConfig,
|
|
@@ -67,10 +66,9 @@ import {
|
|
|
67
66
|
initTelemetryClient,
|
|
68
67
|
} from '@aztec/telemetry-client';
|
|
69
68
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
70
|
-
import {
|
|
69
|
+
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
71
70
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
72
71
|
|
|
73
|
-
import type { Anvil } from '@viem/anvil';
|
|
74
72
|
import fs from 'fs/promises';
|
|
75
73
|
import { tmpdir } from 'os';
|
|
76
74
|
import path from 'path';
|
|
@@ -84,6 +82,7 @@ import {
|
|
|
84
82
|
} from 'viem/accounts';
|
|
85
83
|
import { type Chain, foundry } from 'viem/chains';
|
|
86
84
|
|
|
85
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
87
86
|
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
88
87
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
89
88
|
import { getBBConfig } from './get_bb_config.js';
|
|
@@ -92,9 +91,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
92
91
|
|
|
93
92
|
export { startAnvil };
|
|
94
93
|
|
|
95
|
-
const { AZTEC_NODE_URL = '' } = process.env;
|
|
96
|
-
const getAztecUrl = () => AZTEC_NODE_URL;
|
|
97
|
-
|
|
98
94
|
let telemetry: TelemetryClient | undefined = undefined;
|
|
99
95
|
async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
|
|
100
96
|
if (!telemetry) {
|
|
@@ -189,14 +185,22 @@ export type SetupOptions = {
|
|
|
189
185
|
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
190
186
|
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
191
187
|
mockGossipSubNetwork?: boolean;
|
|
188
|
+
/** Whether to add simulated latency to the mock gossipsub network (in ms) */
|
|
189
|
+
mockGossipSubNetworkLatency?: number;
|
|
192
190
|
/** Whether to disable the anvil test watcher (can still be manually started) */
|
|
193
191
|
disableAnvilTestWatcher?: boolean;
|
|
192
|
+
anvilTestWatcherOpts?: AnvilTestWatcherOpts;
|
|
194
193
|
/** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
|
|
195
194
|
automineL1Setup?: boolean;
|
|
196
195
|
/** How many accounts to seed and unlock in anvil. */
|
|
197
196
|
anvilAccounts?: number;
|
|
198
197
|
/** Port to start anvil (defaults to 8545) */
|
|
199
198
|
anvilPort?: number;
|
|
199
|
+
/**
|
|
200
|
+
* Number of slots per epoch for Anvil's finality simulation.
|
|
201
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
202
|
+
*/
|
|
203
|
+
anvilSlotsInAnEpoch?: number;
|
|
200
204
|
/** Key to use for publishing L1 contracts */
|
|
201
205
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
202
206
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
@@ -207,8 +211,16 @@ export type SetupOptions = {
|
|
|
207
211
|
skipAccountDeployment?: boolean;
|
|
208
212
|
/** L1 contracts deployment arguments. */
|
|
209
213
|
l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
|
|
210
|
-
/** Wallet minimum fee padding multiplier
|
|
214
|
+
/** Wallet minimum fee padding multiplier */
|
|
211
215
|
walletMinFeePadding?: number;
|
|
216
|
+
/** Whether the initial node should be a lightweight RPC-only node (no sequencer, no validator).
|
|
217
|
+
* Use for tests that create their own validator nodes and don't need the initial sequencer. */
|
|
218
|
+
skipInitialSequencer?: boolean;
|
|
219
|
+
/** Whether to swap the production Sequencer for the minimal AutomineSequencer.
|
|
220
|
+
* Use only for single-sequencer non-block-building tests. See AUTOMINE_E2E_OPTS in `fixtures.ts`. */
|
|
221
|
+
useAutomineSequencer?: boolean;
|
|
222
|
+
/** Options forwarded to PXE creation (e.g. execution hooks). */
|
|
223
|
+
pxeCreationOptions?: PXECreationOptions;
|
|
212
224
|
} & Partial<AztecNodeConfig>;
|
|
213
225
|
|
|
214
226
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
@@ -216,14 +228,14 @@ export type EndToEndContext = {
|
|
|
216
228
|
/** The Anvil instance (only set if anvil was started locally). */
|
|
217
229
|
anvil: Anvil | undefined;
|
|
218
230
|
/** 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
|
|
231
|
+
aztecNode: AztecNode & AztecNodeDebug;
|
|
232
|
+
/** The Aztec Node as a service. */
|
|
233
|
+
aztecNodeService: AztecNodeService;
|
|
234
|
+
/** Client to the Aztec Node admin interface. */
|
|
235
|
+
aztecNodeAdmin: AztecNodeAdmin;
|
|
236
|
+
/** The aztec node running the prover node subsystem (only set if startProverNode is true). */
|
|
237
|
+
proverNode: AztecNodeService | undefined;
|
|
238
|
+
/** A client to the sequencer service. */
|
|
227
239
|
sequencer: SequencerClient | undefined;
|
|
228
240
|
/** Return values from deployAztecL1Contracts function. */
|
|
229
241
|
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
@@ -243,100 +255,54 @@ export type EndToEndContext = {
|
|
|
243
255
|
cheatCodes: CheatCodes;
|
|
244
256
|
/** The cheat codes for L1 */
|
|
245
257
|
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
|
|
258
|
+
/** The anvil test watcher. */
|
|
259
|
+
watcher: AnvilTestWatcher;
|
|
260
|
+
/** Allows tweaking current system time, used by the epoch cache only. */
|
|
261
|
+
dateProvider: TestDateProvider;
|
|
250
262
|
/** Telemetry client */
|
|
251
|
-
telemetryClient: TelemetryClient
|
|
263
|
+
telemetryClient: TelemetryClient;
|
|
252
264
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
253
265
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
254
|
-
/**
|
|
255
|
-
|
|
266
|
+
/** Delayer for sequencer L1 txs (only when enableDelayer is true). */
|
|
267
|
+
sequencerDelayer: Delayer | undefined;
|
|
268
|
+
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
269
|
+
proverDelayer: Delayer | undefined;
|
|
270
|
+
/** Genesis data used for setting up nodes. */
|
|
271
|
+
genesis: GenesisData | undefined;
|
|
256
272
|
/** ACVM config (only set if running locally). */
|
|
257
273
|
acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
|
|
258
274
|
/** BB config (only set if running locally). */
|
|
259
275
|
bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
|
|
260
276
|
/** Directory to cleanup on teardown. */
|
|
261
|
-
directoryToCleanup: string
|
|
277
|
+
directoryToCleanup: string;
|
|
262
278
|
/** Function to stop the started services. */
|
|
263
279
|
teardown: () => Promise<void>;
|
|
264
280
|
};
|
|
265
281
|
|
|
266
282
|
/**
|
|
267
|
-
*
|
|
283
|
+
* When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
|
|
284
|
+
* aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
|
|
285
|
+
* actually swapped in the correct version.
|
|
268
286
|
*/
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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);
|
|
287
|
+
function assertContractArtifactsVersion() {
|
|
288
|
+
const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
|
|
289
|
+
if (!expected) {
|
|
290
|
+
return;
|
|
295
291
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
292
|
+
const { aztecVersion } = SponsoredFPCContract.artifact;
|
|
293
|
+
// TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
|
|
294
|
+
if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
|
|
295
|
+
createLogger('e2e:setup').info(
|
|
296
|
+
`Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`,
|
|
297
|
+
);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (aztecVersion !== expected) {
|
|
301
|
+
throw new Error(
|
|
302
|
+
`Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` +
|
|
303
|
+
`The legacy artifact resolver may not have swapped in the correct version.`,
|
|
304
|
+
);
|
|
305
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
306
|
}
|
|
341
307
|
|
|
342
308
|
/**
|
|
@@ -351,10 +317,11 @@ export async function setup(
|
|
|
351
317
|
pxeOpts: Partial<PXEConfig> = {},
|
|
352
318
|
chain: Chain = foundry,
|
|
353
319
|
): Promise<EndToEndContext> {
|
|
320
|
+
assertContractArtifactsVersion();
|
|
354
321
|
let anvil: Anvil | undefined;
|
|
355
322
|
try {
|
|
356
323
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
357
|
-
opts.
|
|
324
|
+
opts.slasherEnabled ??= false;
|
|
358
325
|
|
|
359
326
|
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
360
327
|
// use initialValidators for the node config
|
|
@@ -366,8 +333,12 @@ export async function setup(
|
|
|
366
333
|
config.realProofs = !!opts.realProofs;
|
|
367
334
|
// Only enforce the time table if requested
|
|
368
335
|
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
336
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
337
|
+
config.enableDelayer = true;
|
|
369
338
|
config.listenAddress = '127.0.0.1';
|
|
370
339
|
|
|
340
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
341
|
+
|
|
371
342
|
const logger = getLogger();
|
|
372
343
|
|
|
373
344
|
// Create a temp directory for any services that need it and cleanup later
|
|
@@ -377,20 +348,18 @@ export async function setup(
|
|
|
377
348
|
config.dataDirectory = directoryToCleanup;
|
|
378
349
|
}
|
|
379
350
|
|
|
351
|
+
const dateProvider = new TestDateProvider();
|
|
352
|
+
|
|
380
353
|
if (!config.l1RpcUrls?.length) {
|
|
381
354
|
if (!isAnvilTestChain(chain.id)) {
|
|
382
355
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
383
356
|
}
|
|
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
357
|
const res = await startAnvil({
|
|
391
358
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
392
359
|
accounts: opts.anvilAccounts,
|
|
393
360
|
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
361
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
362
|
+
dateProvider,
|
|
394
363
|
});
|
|
395
364
|
anvil = res.anvil;
|
|
396
365
|
config.l1RpcUrls = [res.rpcUrl];
|
|
@@ -402,8 +371,6 @@ export async function setup(
|
|
|
402
371
|
logger.info(`Logging metrics to ${filename}`);
|
|
403
372
|
setupMetricsLogger(filename);
|
|
404
373
|
}
|
|
405
|
-
|
|
406
|
-
const dateProvider = new TestDateProvider();
|
|
407
374
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
408
375
|
|
|
409
376
|
if (opts.stateLoad) {
|
|
@@ -421,11 +388,11 @@ export async function setup(
|
|
|
421
388
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
422
389
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
423
390
|
} else if (
|
|
424
|
-
config.
|
|
425
|
-
config.
|
|
426
|
-
config.
|
|
391
|
+
config.sequencerPublisherPrivateKeys &&
|
|
392
|
+
config.sequencerPublisherPrivateKeys.length > 0 &&
|
|
393
|
+
config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
|
|
427
394
|
) {
|
|
428
|
-
publisherPrivKeyHex = config.
|
|
395
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
429
396
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
430
397
|
} else if (!MNEMONIC) {
|
|
431
398
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -434,18 +401,13 @@ export async function setup(
|
|
|
434
401
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
435
402
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
436
403
|
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
|
|
437
|
-
config.
|
|
404
|
+
config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
438
405
|
}
|
|
439
406
|
|
|
440
407
|
if (config.coinbase === undefined) {
|
|
441
408
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
442
409
|
}
|
|
443
410
|
|
|
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
411
|
// Determine which addresses to fund in genesis
|
|
450
412
|
const initialFundedAccounts =
|
|
451
413
|
opts.initialFundedAccounts ??
|
|
@@ -458,10 +420,12 @@ export async function setup(
|
|
|
458
420
|
addressesToFund.push(sponsoredFPCAddress);
|
|
459
421
|
}
|
|
460
422
|
|
|
461
|
-
const
|
|
423
|
+
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
424
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
|
|
462
425
|
addressesToFund,
|
|
463
426
|
opts.initialAccountFeeJuice,
|
|
464
427
|
opts.genesisPublicData,
|
|
428
|
+
genesisTimestamp,
|
|
465
429
|
);
|
|
466
430
|
|
|
467
431
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
@@ -496,13 +460,37 @@ export async function setup(
|
|
|
496
460
|
},
|
|
497
461
|
);
|
|
498
462
|
|
|
499
|
-
config
|
|
463
|
+
Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
|
|
500
464
|
config.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
501
465
|
|
|
466
|
+
// Propagate L1-contracts-config overrides back to the node config so the archiver's
|
|
467
|
+
// `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
|
|
468
|
+
// Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
|
|
469
|
+
// but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
|
|
470
|
+
// `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
|
|
471
|
+
// `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
|
|
472
|
+
// Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
|
|
473
|
+
// by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
|
|
474
|
+
// as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
|
|
475
|
+
// in this function and crash `setupSharedBlobStorage`.
|
|
476
|
+
if (opts.l1ContractsArgs) {
|
|
477
|
+
for (const [key, value] of Object.entries(opts.l1ContractsArgs)) {
|
|
478
|
+
if (value !== undefined) {
|
|
479
|
+
(config as unknown as Record<string, unknown>)[key] = value;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
502
484
|
if (enableAutomine) {
|
|
503
485
|
await ethCheatCodes.setAutomine(false);
|
|
504
486
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
505
|
-
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
490
|
+
// ahead of system time due to the local-network watcher warping time forward on each filled slot.
|
|
491
|
+
// When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
|
|
492
|
+
if (!anvil) {
|
|
493
|
+
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
506
494
|
}
|
|
507
495
|
|
|
508
496
|
if (opts.l2StartTime) {
|
|
@@ -514,6 +502,7 @@ export async function setup(
|
|
|
514
502
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
515
503
|
deployL1ContractsValues.l1Client,
|
|
516
504
|
dateProvider,
|
|
505
|
+
opts.anvilTestWatcherOpts,
|
|
517
506
|
);
|
|
518
507
|
if (!opts.disableAnvilTestWatcher) {
|
|
519
508
|
await watcher.start();
|
|
@@ -541,10 +530,10 @@ export async function setup(
|
|
|
541
530
|
}
|
|
542
531
|
|
|
543
532
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
544
|
-
let p2pClientDeps: P2PClientDeps
|
|
533
|
+
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
545
534
|
|
|
546
535
|
if (opts.mockGossipSubNetwork) {
|
|
547
|
-
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
536
|
+
mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
|
|
548
537
|
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
549
538
|
}
|
|
550
539
|
|
|
@@ -557,11 +546,17 @@ export async function setup(
|
|
|
557
546
|
throw new Error('minTxsPerBlock is undefined in e2e test setup');
|
|
558
547
|
}
|
|
559
548
|
|
|
560
|
-
//
|
|
549
|
+
// Whether we're deploying accounts (and therefore need reliable block inclusion past genesis)
|
|
561
550
|
const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
|
|
562
551
|
// Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
|
|
563
552
|
const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
|
|
564
|
-
|
|
553
|
+
// Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at
|
|
554
|
+
// slot N start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on
|
|
555
|
+
// alternating slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) for account
|
|
556
|
+
// deployment. Automine is unaffected: its runBuild clamps mempool builds to
|
|
557
|
+
// Math.max(minTxsPerBlock ?? 1, 1) and still requires minValidTxs: 1.
|
|
558
|
+
const accountsDeployMinTxs = 0;
|
|
559
|
+
config.minTxsPerBlock = shouldDeployAccounts ? accountsDeployMinTxs : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
|
|
565
560
|
|
|
566
561
|
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
567
562
|
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
@@ -572,52 +567,73 @@ export async function setup(
|
|
|
572
567
|
}
|
|
573
568
|
}
|
|
574
569
|
|
|
570
|
+
// When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
|
|
571
|
+
// We apply these overrides to a copy so they don't leak into the returned config.
|
|
572
|
+
// Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
|
|
573
|
+
const initialNodeConfig = opts.skipInitialSequencer
|
|
574
|
+
? {
|
|
575
|
+
...config,
|
|
576
|
+
disableValidator: true,
|
|
577
|
+
...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
|
|
578
|
+
}
|
|
579
|
+
: config;
|
|
580
|
+
|
|
575
581
|
const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
|
|
576
582
|
AztecNodeService.createAndSync(
|
|
577
|
-
|
|
583
|
+
initialNodeConfig,
|
|
578
584
|
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
579
|
-
{
|
|
585
|
+
{ genesis, dontStartSequencer: opts.skipInitialSequencer },
|
|
580
586
|
),
|
|
581
587
|
);
|
|
582
588
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
583
589
|
|
|
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;
|
|
590
|
+
let proverNode: AztecNodeService | undefined = undefined;
|
|
590
591
|
if (opts.startProverNode) {
|
|
591
592
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
592
593
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
593
594
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
594
595
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
596
|
+
|
|
597
|
+
const p2pClientDeps: Partial<P2PClientDeps> = {
|
|
598
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
|
|
599
|
+
rpcTxProviders: [aztecNodeService],
|
|
599
600
|
};
|
|
600
|
-
|
|
601
|
+
|
|
602
|
+
({ proverNode } = await createAndSyncProverNode(
|
|
601
603
|
proverNodePrivateKeyHex,
|
|
602
604
|
config,
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
605
|
+
{
|
|
606
|
+
...config.proverNodeConfig,
|
|
607
|
+
dataDirectory: proverNodeDataDirectory,
|
|
608
|
+
},
|
|
609
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
610
|
+
{ genesis },
|
|
611
|
+
));
|
|
607
612
|
}
|
|
608
613
|
|
|
614
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
615
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
616
|
+
|
|
609
617
|
logger.verbose('Creating a pxe...');
|
|
610
618
|
const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
|
|
611
619
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
612
620
|
// For tests we only want proving enabled if specifically requested
|
|
613
621
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
614
|
-
const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
|
|
622
|
+
const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
|
|
623
|
+
loggerActorLabel: 'pxe-0',
|
|
624
|
+
...opts.pxeCreationOptions,
|
|
625
|
+
});
|
|
615
626
|
|
|
616
627
|
if (opts.walletMinFeePadding !== undefined) {
|
|
617
628
|
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
618
629
|
}
|
|
619
630
|
|
|
620
|
-
const cheatCodes = await CheatCodes.create(
|
|
631
|
+
const cheatCodes = await CheatCodes.create(
|
|
632
|
+
config.l1RpcUrls,
|
|
633
|
+
aztecNodeService,
|
|
634
|
+
dateProvider,
|
|
635
|
+
aztecNodeService.getAutomineSequencer(),
|
|
636
|
+
);
|
|
621
637
|
|
|
622
638
|
if (
|
|
623
639
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -635,15 +651,22 @@ export async function setup(
|
|
|
635
651
|
|
|
636
652
|
let accounts: AztecAddress[] = [];
|
|
637
653
|
|
|
638
|
-
if (
|
|
654
|
+
if (opts.skipInitialSequencer) {
|
|
655
|
+
logger.info('Sequencer not started on initial node, skipping block progression');
|
|
656
|
+
} else if (shouldDeployAccounts) {
|
|
639
657
|
logger.info(
|
|
640
|
-
`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by
|
|
658
|
+
`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by waiting for the accounts to be deployed`,
|
|
641
659
|
);
|
|
642
660
|
const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
643
661
|
const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
|
|
644
662
|
accounts = accountManagers.map(accountManager => accountManager.address);
|
|
645
663
|
} else if (needsEmptyBlock) {
|
|
646
664
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
665
|
+
// AutomineSequencer only builds on tx arrival; explicitly request an empty block.
|
|
666
|
+
const automine = aztecNodeService.getAutomineSequencer();
|
|
667
|
+
if (automine) {
|
|
668
|
+
await automine.buildEmptyBlock();
|
|
669
|
+
}
|
|
647
670
|
while ((await aztecNodeService.getBlockNumber()) === 0) {
|
|
648
671
|
await sleep(2000);
|
|
649
672
|
}
|
|
@@ -683,7 +706,7 @@ export async function setup(
|
|
|
683
706
|
logger.error(`Error during e2e test teardown`, err);
|
|
684
707
|
} finally {
|
|
685
708
|
try {
|
|
686
|
-
await telemetryClient
|
|
709
|
+
await telemetryClient.stop();
|
|
687
710
|
} catch (err) {
|
|
688
711
|
logger.error(`Error during telemetry client stop`, err);
|
|
689
712
|
}
|
|
@@ -704,8 +727,10 @@ export async function setup(
|
|
|
704
727
|
initialFundedAccounts,
|
|
705
728
|
logger,
|
|
706
729
|
mockGossipSubNetwork,
|
|
707
|
-
|
|
730
|
+
genesis,
|
|
708
731
|
proverNode,
|
|
732
|
+
sequencerDelayer,
|
|
733
|
+
proverDelayer,
|
|
709
734
|
sequencer: sequencerClient,
|
|
710
735
|
teardown,
|
|
711
736
|
telemetryClient,
|
|
@@ -782,100 +807,62 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
|
|
|
782
807
|
targetBlock ??= await node.getBlockNumber();
|
|
783
808
|
|
|
784
809
|
await retryUntil(
|
|
785
|
-
async () => (await node.
|
|
810
|
+
async () => (await node.getBlockNumber('proven')) >= targetBlock,
|
|
786
811
|
'proven chain status',
|
|
787
812
|
timeoutSec,
|
|
788
813
|
intervalSec,
|
|
789
814
|
);
|
|
790
815
|
}
|
|
791
816
|
|
|
817
|
+
/**
|
|
818
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
819
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
820
|
+
*/
|
|
792
821
|
export function createAndSyncProverNode(
|
|
793
822
|
proverNodePrivateKey: `0x${string}`,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
823
|
+
baseConfig: AztecNodeConfig,
|
|
824
|
+
configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
|
|
825
|
+
deps: {
|
|
826
|
+
telemetry?: TelemetryClient;
|
|
827
|
+
dateProvider: DateProvider;
|
|
828
|
+
p2pClientDeps?: P2PClientDeps;
|
|
829
|
+
},
|
|
830
|
+
options: { genesis?: GenesisData; dontStart?: boolean },
|
|
831
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
800
832
|
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,
|
|
833
|
+
const proverNode = await AztecNodeService.createAndSync(
|
|
834
|
+
{
|
|
835
|
+
...baseConfig,
|
|
836
|
+
...configOverrides,
|
|
837
|
+
p2pPort: 0,
|
|
838
|
+
enableProverNode: true,
|
|
839
|
+
disableValidator: true,
|
|
840
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
841
|
+
},
|
|
842
|
+
deps,
|
|
843
|
+
{ genesis: options.genesis, dontStartProverNode: options.dontStart },
|
|
840
844
|
);
|
|
841
845
|
|
|
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();
|
|
846
|
+
if (!proverNode.getProverNode()) {
|
|
847
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
850
848
|
}
|
|
851
|
-
return proverNode;
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
849
|
|
|
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;
|
|
850
|
+
getLogger().info(`Created and synced prover node`);
|
|
851
|
+
return { proverNode };
|
|
852
|
+
});
|
|
867
853
|
}
|
|
868
854
|
|
|
869
855
|
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
870
856
|
export function getBalancesFn(
|
|
871
857
|
symbol: string,
|
|
872
858
|
method: ContractMethod,
|
|
873
|
-
from: AztecAddress,
|
|
874
859
|
logger: any,
|
|
875
860
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
876
861
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
877
862
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
878
|
-
const b = await Promise.all(
|
|
863
|
+
const b = await Promise.all(
|
|
864
|
+
addresses.map(async address => (await method(address).simulate({ from: address })).result),
|
|
865
|
+
);
|
|
879
866
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
880
867
|
logger.verbose(debugString);
|
|
881
868
|
return b;
|
|
@@ -910,6 +897,57 @@ export async function expectMappingDelta<K, V extends number | bigint>(
|
|
|
910
897
|
expect(diffs).toEqual(expectedDiffs);
|
|
911
898
|
}
|
|
912
899
|
|
|
900
|
+
/**
|
|
901
|
+
* Registers the auth_registry contract class and publishes its standard instance if not already
|
|
902
|
+
* present, and registers the artifact with PXE. Publishing is required before exercising the public
|
|
903
|
+
* authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
|
|
904
|
+
* required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
|
|
905
|
+
* surface as generic "Assertion failed:" and tests that match on the real message fail).
|
|
906
|
+
*/
|
|
907
|
+
export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
908
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
909
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
910
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
|
|
911
|
+
}
|
|
912
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
913
|
+
await publishInstance(wallet, instance).send({ from });
|
|
914
|
+
}
|
|
915
|
+
await wallet.registerContract(instance, AuthRegistryArtifact);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Registers the public_checks contract class and publishes its standard instance if not already
|
|
920
|
+
* present, and registers the artifact with PXE. Required for any contract that calls
|
|
921
|
+
* `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
|
|
922
|
+
* deployed PublicChecks contract via an enqueued public call).
|
|
923
|
+
*/
|
|
924
|
+
export async function ensurePublicChecksPublished(wallet: Wallet, from: AztecAddress) {
|
|
925
|
+
const { instance, contractClass } = await getStandardPublicChecks();
|
|
926
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
927
|
+
await (await publishContractClass(wallet, PublicChecksArtifact)).send({ from });
|
|
928
|
+
}
|
|
929
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
930
|
+
await publishInstance(wallet, instance).send({ from });
|
|
931
|
+
}
|
|
932
|
+
await wallet.registerContract(instance, PublicChecksArtifact);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Registers the handshake_registry contract class and publishes its standard instance if not
|
|
937
|
+
* already present, and registers the artifact with PXE. Required for constrained-delivery flows
|
|
938
|
+
* that call into the HandshakeRegistry at its well-known address.
|
|
939
|
+
*/
|
|
940
|
+
export async function ensureHandshakeRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
941
|
+
const { instance, contractClass } = await getStandardHandshakeRegistry();
|
|
942
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
943
|
+
await (await publishContractClass(wallet, HandshakeRegistryArtifact)).send({ from });
|
|
944
|
+
}
|
|
945
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
946
|
+
await publishInstance(wallet, instance).send({ from });
|
|
947
|
+
}
|
|
948
|
+
await wallet.registerContract(instance, HandshakeRegistryArtifact);
|
|
949
|
+
}
|
|
950
|
+
|
|
913
951
|
/**
|
|
914
952
|
* Registers the contract class used for test accounts and publicly deploys the instances requested.
|
|
915
953
|
* Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
|
|
@@ -944,7 +982,7 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
|
|
|
944
982
|
* Returns deployed account data that can be used by tests.
|
|
945
983
|
*/
|
|
946
984
|
export const deployAccounts =
|
|
947
|
-
(numberOfAccounts: number, logger: Logger) =>
|
|
985
|
+
(numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<InteractionWaitOptions>>) =>
|
|
948
986
|
async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
|
|
949
987
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
950
988
|
throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
|
|
@@ -961,8 +999,9 @@ export const deployAccounts =
|
|
|
961
999
|
);
|
|
962
1000
|
const deployMethod = await accountManager.getDeployMethod();
|
|
963
1001
|
await deployMethod.send({
|
|
964
|
-
from:
|
|
1002
|
+
from: NO_FROM,
|
|
965
1003
|
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
1004
|
+
...deployOptions,
|
|
966
1005
|
});
|
|
967
1006
|
}
|
|
968
1007
|
|
|
@@ -993,7 +1032,7 @@ export async function publicDeployAccounts(
|
|
|
993
1032
|
|
|
994
1033
|
const batch = new BatchCall(wallet, calls);
|
|
995
1034
|
|
|
996
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
1035
|
+
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
997
1036
|
if (waitUntilProven) {
|
|
998
1037
|
if (!node) {
|
|
999
1038
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|