@aztec/end-to-end 5.0.0-rc.1 → 5.0.0
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 +215 -27
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +17 -24
- package/dest/automine/token/token_contract_test.d.ts +40 -0
- package/dest/automine/token/token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +22 -28
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +1 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +3 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +4 -4
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +25 -10
- package/dest/bench/utils.d.ts +1 -1
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/fixtures/e2e_prover_test.d.ts +10 -7
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +33 -14
- package/dest/fixtures/fixtures.d.ts +8 -5
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +12 -4
- package/dest/fixtures/ha_setup.d.ts +3 -3
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +4 -1
- 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 +35 -9
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +175 -142
- package/dest/fixtures/setup_p2p_test.d.ts +1 -1
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +3 -3
- package/dest/fixtures/standard_contracts_genesis.d.ts +16 -0
- package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
- package/dest/fixtures/standard_contracts_genesis.js +25 -0
- package/dest/fixtures/timing.d.ts +42 -0
- package/dest/fixtures/timing.d.ts.map +1 -0
- package/dest/fixtures/timing.js +72 -0
- package/dest/fixtures/token_utils.d.ts +22 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +21 -1
- package/dest/fixtures/wait_helpers.d.ts +135 -0
- package/dest/fixtures/wait_helpers.d.ts.map +1 -0
- package/dest/fixtures/wait_helpers.js +154 -0
- package/dest/forward-compatibility/wallet_service.js +1 -1
- package/dest/multi-node/block-production/setup.d.ts +97 -0
- package/dest/multi-node/block-production/setup.d.ts.map +1 -0
- package/dest/multi-node/block-production/setup.js +158 -0
- package/dest/multi-node/governance/setup.d.ts +67 -0
- package/dest/multi-node/governance/setup.d.ts.map +1 -0
- package/dest/multi-node/governance/setup.js +126 -0
- package/dest/multi-node/multi_node_test_context.d.ts +212 -0
- package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
- package/dest/multi-node/multi_node_test_context.js +347 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/inactivity_setup.js +111 -0
- package/dest/multi-node/slashing/setup.d.ts +167 -0
- package/dest/multi-node/slashing/setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/setup.js +275 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +10 -2
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +36 -9
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -15
- package/dest/p2p/shared.d.ts +72 -0
- package/dest/p2p/shared.d.ts.map +1 -0
- package/dest/p2p/shared.js +212 -0
- package/dest/shared/cross_chain_test_harness.d.ts +3 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +24 -16
- package/dest/shared/gas_portal_test_harness.d.ts +1 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +8 -5
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +12 -5
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +365 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
- package/dest/simulators/lending_simulator.js +1 -1
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/{e2e_cross_chain_messaging → single-node/cross-chain}/cross_chain_messaging_test.js +77 -27
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
- package/dest/single-node/fees/fees_test.d.ts +95 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/fees_test.js +124 -46
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +373 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +845 -0
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +18 -8
- package/dest/spartan/tx_metrics.d.ts +10 -1
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +32 -0
- package/dest/test-wallet/test_wallet.d.ts +23 -4
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +20 -4
- package/dest/test-wallet/utils.d.ts +36 -1
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +64 -4
- package/dest/test-wallet/wallet_worker_script.js +5 -2
- package/dest/test-wallet/worker_wallet.d.ts +5 -5
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +2 -2
- package/dest/test-wallet/worker_wallet_schema.js +2 -1
- package/package.json +41 -41
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
- package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +19 -39
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -43
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +3 -1
- package/src/bench/client_flows/client_flows_benchmark.ts +39 -12
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/e2e_prover_test.ts +40 -23
- package/src/fixtures/fixtures.ts +14 -4
- package/src/fixtures/ha_setup.ts +7 -3
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/setup.ts +217 -146
- package/src/fixtures/setup_p2p_test.ts +3 -3
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +39 -4
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_service.ts +2 -2
- package/src/guides/up_quick_start.sh +5 -0
- package/src/infra/README.md +12 -0
- package/src/multi-node/README.md +96 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +36 -7
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -14
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +22 -13
- package/src/shared/gas_portal_test_harness.ts +13 -5
- package/src/shared/submit-transactions.ts +13 -5
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
- package/src/simulators/lending_simulator.ts +1 -1
- package/src/single-node/README.md +66 -0
- package/src/{e2e_cross_chain_messaging → single-node/cross-chain}/cross_chain_messaging_test.ts +110 -39
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
- package/src/{e2e_fees → single-node/fees}/fees_test.ts +141 -48
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1054 -0
- package/src/spartan/setup_test_wallets.ts +23 -8
- package/src/spartan/tx_metrics.ts +26 -0
- package/src/test-wallet/test_wallet.ts +28 -6
- package/src/test-wallet/utils.ts +102 -5
- package/src/test-wallet/wallet_worker_script.ts +6 -3
- package/src/test-wallet/worker_wallet.ts +5 -9
- package/src/test-wallet/worker_wallet_schema.ts +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -58
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -42
- package/dest/e2e_epochs/epochs_test.d.ts +0 -137
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -485
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -89
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -56
- package/dest/e2e_multi_validator/utils.d.ts +0 -12
- package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -22
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -40
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +0 -138
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.d.ts +0 -75
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -217
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/src/e2e_deploy_contract/deploy_test.ts +0 -73
- package/src/e2e_epochs/epochs_test.ts +0 -596
- package/src/e2e_l1_publisher/write_json.ts +0 -77
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -51
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -181
- package/src/e2e_p2p/shared.ts +0 -332
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
- /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
- /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
package/dest/fixtures/setup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
2
|
+
import { createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
3
3
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
4
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
5
5
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
@@ -12,14 +12,13 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
|
12
12
|
import { NULL_KEY } from '@aztec/ethereum/constants';
|
|
13
13
|
import { deployMulticall3 } from '@aztec/ethereum/contracts';
|
|
14
14
|
import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
15
|
-
import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
15
|
+
import { EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
|
|
16
16
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
17
17
|
import { SecretValue } from '@aztec/foundation/config';
|
|
18
18
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
19
19
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
20
20
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
21
21
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
22
|
-
import { sleep } from '@aztec/foundation/sleep';
|
|
23
22
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
24
23
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
25
24
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
@@ -46,6 +45,8 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
|
|
|
46
45
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
47
46
|
import { getBBConfig } from './get_bb_config.js';
|
|
48
47
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
48
|
+
import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
|
|
49
|
+
import { testSpan } from './timing.js';
|
|
49
50
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
50
51
|
export { startAnvil };
|
|
51
52
|
let telemetry = undefined;
|
|
@@ -81,11 +82,13 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
81
82
|
/**
|
|
82
83
|
* Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
|
|
83
84
|
* @param aztecNode - An instance of Aztec Node.
|
|
85
|
+
* @param nodeDebug - The node's debug API, used to register public function signatures for named traces; pass
|
|
86
|
+
* `undefined` when the node does not expose it.
|
|
84
87
|
* @param opts - Partial configuration for the PXE.
|
|
85
88
|
* @param logger - The logger to be used.
|
|
86
89
|
* @param actor - Actor label to include in log output (e.g., 'pxe-test').
|
|
87
90
|
* @returns A test wallet, logger and teardown function.
|
|
88
|
-
*/ export async function setupPXEAndGetWallet(aztecNode, opts = {}, logger = getLogger(), actor) {
|
|
91
|
+
*/ export async function setupPXEAndGetWallet(aztecNode, nodeDebug, opts = {}, logger = getLogger(), actor) {
|
|
89
92
|
const PXEConfig = {
|
|
90
93
|
...getPXEConfig(),
|
|
91
94
|
...opts
|
|
@@ -99,7 +102,8 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
99
102
|
}
|
|
100
103
|
const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(PXEConfig.dataDirectory);
|
|
101
104
|
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
102
|
-
loggerActorLabel: actor
|
|
105
|
+
loggerActorLabel: actor,
|
|
106
|
+
nodeDebug
|
|
103
107
|
});
|
|
104
108
|
return {
|
|
105
109
|
wallet,
|
|
@@ -131,12 +135,32 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
131
135
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
132
136
|
* @param opts - Options to pass to the node initialization and to the setup script.
|
|
133
137
|
* @param pxeOpts - Options to pass to the PXE initialization.
|
|
134
|
-
*/ export
|
|
138
|
+
*/ export function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
|
|
139
|
+
// Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
|
|
140
|
+
// swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
|
|
141
|
+
// (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
|
|
142
|
+
const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
|
|
143
|
+
return testSpan(`setup:env:${proverMode}`, async ()=>{
|
|
144
|
+
const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
|
|
145
|
+
if (process.env.EXIT_E2E_AFTER_SETUP) {
|
|
146
|
+
ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
|
|
147
|
+
throw new Error('EXIT_E2E_AFTER_SETUP');
|
|
148
|
+
}
|
|
149
|
+
return ctx;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
|
|
135
153
|
assertContractArtifactsVersion();
|
|
154
|
+
const logger = getLogger();
|
|
136
155
|
let anvil;
|
|
137
156
|
try {
|
|
138
157
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
139
158
|
opts.slasherEnabled ??= false;
|
|
159
|
+
// Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
|
|
160
|
+
// waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
|
|
161
|
+
// assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
|
|
162
|
+
opts.automineL1Setup ??= true;
|
|
163
|
+
logger.trace('Starting e2e test setup');
|
|
140
164
|
const config = {
|
|
141
165
|
...getConfigEnvVars(),
|
|
142
166
|
...opts
|
|
@@ -151,7 +175,6 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
151
175
|
config.enableDelayer = true;
|
|
152
176
|
config.listenAddress = '127.0.0.1';
|
|
153
177
|
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
154
|
-
const logger = getLogger();
|
|
155
178
|
// Create a temp directory for any services that need it and cleanup later
|
|
156
179
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
157
180
|
await fs.mkdir(directoryToCleanup, {
|
|
@@ -165,18 +188,19 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
165
188
|
if (!isAnvilTestChain(chain.id)) {
|
|
166
189
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
167
190
|
}
|
|
168
|
-
const res = await startAnvil({
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
191
|
+
const res = await testSpan('setup:env:anvil', ()=>startAnvil({
|
|
192
|
+
l1BlockTime: opts.ethereumSlotDuration,
|
|
193
|
+
accounts: opts.anvilAccounts,
|
|
194
|
+
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
195
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
196
|
+
dateProvider
|
|
197
|
+
}));
|
|
175
198
|
anvil = res.anvil;
|
|
176
199
|
config.l1RpcUrls = [
|
|
177
200
|
res.rpcUrl
|
|
178
201
|
];
|
|
179
202
|
}
|
|
203
|
+
logger.trace('Started anvil and L1 RPC client');
|
|
180
204
|
// Enable logging metrics to a local file named after the test suite
|
|
181
205
|
if (isMetricsLoggingRequested()) {
|
|
182
206
|
const filename = path.join('log', getJobName() + '.jsonl');
|
|
@@ -192,6 +216,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
192
216
|
resetBlockInterval: true
|
|
193
217
|
});
|
|
194
218
|
}
|
|
219
|
+
logger.trace('Initialized L1 cheat codes and applied state/time overrides');
|
|
195
220
|
let publisherPrivKeyHex = undefined;
|
|
196
221
|
let publisherHdAccount = undefined;
|
|
197
222
|
if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
|
|
@@ -216,6 +241,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
216
241
|
if (config.coinbase === undefined) {
|
|
217
242
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
218
243
|
}
|
|
244
|
+
logger.trace('Resolved L1 publisher account');
|
|
219
245
|
// The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
|
|
220
246
|
// funded at genesis so they are immediately usable.
|
|
221
247
|
const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
|
|
@@ -230,14 +256,31 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
230
256
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
231
257
|
addressesToFund.push(sponsoredFPCAddress);
|
|
232
258
|
}
|
|
259
|
+
// Fund any extra addresses whose value depends on the just-generated accounts (e.g. an FPC admin'd
|
|
260
|
+
// by a default account), so a test can genesis-fund them instead of bridging fee juice during setup.
|
|
261
|
+
if (opts.computeExtraGenesisFundedAddresses) {
|
|
262
|
+
addressesToFund.push(...await opts.computeExtraGenesisFundedAddresses(defaultAccounts));
|
|
263
|
+
}
|
|
264
|
+
logger.trace('Generated test accounts to fund at genesis');
|
|
265
|
+
// Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) so their `ensure*Published` setup
|
|
266
|
+
// helpers short-circuit their publish txs. The archiver flag seeds the bytecode/instance into every spawned node's
|
|
267
|
+
// contract store; the genesis nullifiers make the AVM's deployment-nullifier check pass when they are called. Both
|
|
268
|
+
// must go together (flag alone would recreate the publish-collision bug), so the flag lives here beside the seeding.
|
|
269
|
+
config.testPreloadStandardContracts = true;
|
|
270
|
+
const standardContractNullifiers = await getStandardContractGenesisNullifiers();
|
|
233
271
|
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
234
|
-
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp);
|
|
272
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp, standardContractNullifiers);
|
|
273
|
+
logger.trace('Computed genesis values');
|
|
235
274
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
236
275
|
const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
|
|
237
276
|
if (enableAutomine) {
|
|
238
277
|
await ethCheatCodes.setAutomine(true);
|
|
239
278
|
}
|
|
240
279
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount, chain);
|
|
280
|
+
// Warm both KZG trusted setups (ours + anvil's) in parallel
|
|
281
|
+
if (anvil && isAnvilTestChain(chain.id)) {
|
|
282
|
+
await warmBlobKzg(l1Client, logger);
|
|
283
|
+
}
|
|
241
284
|
// Deploy Multicall3 if running locally
|
|
242
285
|
await deployMulticall3(l1Client, logger);
|
|
243
286
|
// Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
|
|
@@ -245,17 +288,18 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
245
288
|
await l1Client.getTransactionCount({
|
|
246
289
|
address: l1Client.account.address
|
|
247
290
|
});
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
291
|
+
logger.trace('Deployed Multicall3');
|
|
292
|
+
const deployL1ContractsValues = await testSpan('setup:env:l1-deploy', ()=>deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
|
|
293
|
+
...getL1ContractsConfigEnvVars(),
|
|
294
|
+
...opts,
|
|
295
|
+
...opts.l1ContractsArgs,
|
|
296
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
297
|
+
protocolContractsHash,
|
|
298
|
+
genesisArchiveRoot,
|
|
299
|
+
initialValidators: opts.initialValidators,
|
|
300
|
+
feeJuicePortalInitialBalance: fundingNeeded,
|
|
301
|
+
realVerifier: false
|
|
302
|
+
}));
|
|
259
303
|
Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
|
|
260
304
|
config.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
261
305
|
// Propagate L1-contracts-config overrides back to the node config so the archiver's
|
|
@@ -275,9 +319,24 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
275
319
|
}
|
|
276
320
|
}
|
|
277
321
|
}
|
|
322
|
+
// Deploy any test-specific L1 contracts while automine is still on and before the node starts,
|
|
323
|
+
// so they mine instantly rather than paying the L1 block interval once the sequencer is live.
|
|
324
|
+
let extraL1DeployResult = undefined;
|
|
325
|
+
if (opts.deployExtraL1Contracts) {
|
|
326
|
+
logger.trace('Running deployExtraL1Contracts hook');
|
|
327
|
+
extraL1DeployResult = await opts.deployExtraL1Contracts({
|
|
328
|
+
l1Client,
|
|
329
|
+
deployL1ContractsValues,
|
|
330
|
+
logger
|
|
331
|
+
});
|
|
332
|
+
// The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
|
|
333
|
+
// stale cached nonce for later transactions on the publisher account.
|
|
334
|
+
await l1Client.getTransactionCount({
|
|
335
|
+
address: l1Client.account.address
|
|
336
|
+
});
|
|
337
|
+
}
|
|
278
338
|
if (enableAutomine) {
|
|
279
|
-
await ethCheatCodes.
|
|
280
|
-
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
339
|
+
await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
|
|
281
340
|
}
|
|
282
341
|
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
283
342
|
// ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
|
|
@@ -290,20 +349,30 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
290
349
|
resetBlockInterval: true
|
|
291
350
|
});
|
|
292
351
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const acvmConfig = await
|
|
352
|
+
logger.trace('Deployed L1 rollup contracts');
|
|
353
|
+
// These boot steps are independent and write disjoint config keys, so run them concurrently:
|
|
354
|
+
// telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
|
|
355
|
+
// and the ACVM/BB config resolvers write their own acvm*/bb* keys.
|
|
356
|
+
const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
|
|
357
|
+
// Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
|
|
358
|
+
opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
|
|
359
|
+
setupSharedBlobStorage(config),
|
|
360
|
+
getACVMConfig(logger),
|
|
361
|
+
getBBConfig(logger)
|
|
362
|
+
]);
|
|
363
|
+
logger.trace('Created telemetry client');
|
|
364
|
+
logger.trace('Set up shared blob storage');
|
|
298
365
|
if (acvmConfig) {
|
|
299
366
|
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
300
367
|
config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
|
|
301
368
|
}
|
|
302
|
-
|
|
369
|
+
logger.trace('Resolved ACVM config');
|
|
303
370
|
if (bbConfig) {
|
|
304
371
|
config.bbBinaryPath = bbConfig.bbBinaryPath;
|
|
305
372
|
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
306
373
|
}
|
|
374
|
+
logger.trace('Resolved Barretenberg config');
|
|
375
|
+
logger.verbose('Creating and synching an aztec node', config);
|
|
307
376
|
let mockGossipSubNetwork;
|
|
308
377
|
let p2pClientDeps = undefined;
|
|
309
378
|
if (opts.mockGossipSubNetwork) {
|
|
@@ -312,25 +381,6 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
312
381
|
p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
|
|
313
382
|
};
|
|
314
383
|
}
|
|
315
|
-
// Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
|
|
316
|
-
// To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
|
|
317
|
-
const originalMinTxsPerBlock = config.minTxsPerBlock;
|
|
318
|
-
if (originalMinTxsPerBlock === undefined) {
|
|
319
|
-
throw new Error('minTxsPerBlock is undefined in e2e test setup');
|
|
320
|
-
}
|
|
321
|
-
const originalBuildCheckpointIfEmpty = config.buildCheckpointIfEmpty ?? false;
|
|
322
|
-
// Allow an empty checkpoint so the empty block can be built; leave untouched when not advancing.
|
|
323
|
-
const advancePastGenesis = (opts.advancePastGenesis ?? true) && !opts.skipInitialSequencer;
|
|
324
|
-
config.minTxsPerBlock = advancePastGenesis ? 0 : originalMinTxsPerBlock;
|
|
325
|
-
// Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at slot N
|
|
326
|
-
// start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on alternating
|
|
327
|
-
// slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) while advancing past genesis.
|
|
328
|
-
// Automine is unaffected: its runBuild clamps mempool builds to Math.max(minTxsPerBlock ?? 1, 1) and
|
|
329
|
-
// still requires minValidTxs: 1.
|
|
330
|
-
const shouldTemporarilyBuildEmptyCheckpoints = advancePastGenesis && config.useAutomineSequencer !== true;
|
|
331
|
-
if (shouldTemporarilyBuildEmptyCheckpoints) {
|
|
332
|
-
config.buildCheckpointIfEmpty = true;
|
|
333
|
-
}
|
|
334
384
|
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
335
385
|
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
336
386
|
if (!config.disableValidator) {
|
|
@@ -351,17 +401,19 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
351
401
|
bootstrapNodes: []
|
|
352
402
|
}
|
|
353
403
|
} : config;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
404
|
+
logger.trace('Prepared aztec node config');
|
|
405
|
+
const aztecNodeService = await testSpan('setup:env:sequencer-start', ()=>withLoggerBindings({
|
|
406
|
+
actor: 'node-0'
|
|
407
|
+
}, ()=>createAztecNodeService(initialNodeConfig, {
|
|
408
|
+
dateProvider,
|
|
409
|
+
telemetry: telemetryClient,
|
|
410
|
+
p2pClientDeps
|
|
411
|
+
}, {
|
|
412
|
+
genesis,
|
|
413
|
+
dontStartSequencer: opts.skipInitialSequencer
|
|
414
|
+
})));
|
|
364
415
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
416
|
+
logger.trace('Created and synced aztec node');
|
|
365
417
|
let proverNode = undefined;
|
|
366
418
|
if (opts.startProverNode) {
|
|
367
419
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
@@ -374,16 +426,17 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
374
426
|
aztecNodeService
|
|
375
427
|
]
|
|
376
428
|
};
|
|
377
|
-
({ proverNode } = await createAndSyncProverNode(proverNodePrivateKeyHex, config, {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
429
|
+
({ proverNode } = await testSpan('setup:env:prover-node', ()=>createAndSyncProverNode(proverNodePrivateKeyHex, config, {
|
|
430
|
+
...config.proverNodeConfig,
|
|
431
|
+
dataDirectory: proverNodeDataDirectory
|
|
432
|
+
}, {
|
|
433
|
+
dateProvider,
|
|
434
|
+
p2pClientDeps,
|
|
435
|
+
telemetry: telemetryClient
|
|
436
|
+
}, {
|
|
437
|
+
genesis
|
|
438
|
+
})));
|
|
439
|
+
logger.trace('Created prover node');
|
|
387
440
|
}
|
|
388
441
|
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
389
442
|
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
@@ -395,80 +448,57 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
395
448
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
396
449
|
// For tests we only want proving enabled if specifically requested
|
|
397
450
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
398
|
-
const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
451
|
+
const wallet = await testSpan('setup:env:pxe', ()=>TestWallet.create(aztecNodeService, pxeConfig, {
|
|
452
|
+
loggerActorLabel: 'pxe-0',
|
|
453
|
+
// In-process node implements the debug API, so register public function signatures for named traces.
|
|
454
|
+
nodeDebug: aztecNodeService,
|
|
455
|
+
...opts.pxeCreationOptions
|
|
456
|
+
}));
|
|
402
457
|
if (opts.walletMinFeePadding !== undefined) {
|
|
403
458
|
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
404
459
|
}
|
|
405
|
-
|
|
460
|
+
logger.trace('Created PXE and test wallet');
|
|
461
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
|
|
462
|
+
logger.trace('Created cheat codes');
|
|
406
463
|
if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
|
|
407
464
|
// We need to advance such that the committee is set up.
|
|
408
465
|
await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1)));
|
|
409
466
|
await cheatCodes.rollup.setupEpoch();
|
|
410
467
|
await cheatCodes.rollup.debugRollup();
|
|
468
|
+
logger.trace('Advanced chain to set up validator committee');
|
|
411
469
|
}
|
|
412
470
|
let accounts = [];
|
|
413
471
|
// Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
|
|
414
472
|
// + a simulated store call) with no on-chain tx, independent of the sequencer.
|
|
415
473
|
if (numberOfAccounts > 0) {
|
|
416
474
|
logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
|
|
417
|
-
await createFundedInitializerlessAccounts(wallet, defaultAccounts);
|
|
475
|
+
await testSpan('wallet:create', ()=>createFundedInitializerlessAccounts(wallet, defaultAccounts));
|
|
418
476
|
accounts = defaultAccounts.map((a)=>a.address);
|
|
419
477
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
if (advancePastGenesis) {
|
|
423
|
-
logger.info('Mining an empty block to progress past genesis');
|
|
424
|
-
const automine = aztecNodeService.getAutomineSequencer();
|
|
425
|
-
if (automine) {
|
|
426
|
-
await automine.buildEmptyBlock();
|
|
427
|
-
}
|
|
428
|
-
while(await aztecNodeService.getBlockNumber() === 0){
|
|
429
|
-
await sleep(2000);
|
|
430
|
-
}
|
|
431
|
-
} else if (opts.skipInitialSequencer) {
|
|
432
|
-
logger.info('Sequencer not started on initial node, skipping block progression');
|
|
433
|
-
}
|
|
434
|
-
// Now we restore the original minTxsPerBlock setting if we changed it.
|
|
435
|
-
if (sequencerClient) {
|
|
436
|
-
const sequencer = sequencerClient.getSequencer();
|
|
437
|
-
if (config.minTxsPerBlock !== originalMinTxsPerBlock) {
|
|
438
|
-
sequencer.updateConfig({
|
|
439
|
-
minTxsPerBlock: originalMinTxsPerBlock
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
if (shouldTemporarilyBuildEmptyCheckpoints) {
|
|
443
|
-
sequencer.updateConfig({
|
|
444
|
-
buildCheckpointIfEmpty: originalBuildCheckpointIfEmpty
|
|
445
|
-
});
|
|
446
|
-
config.buildCheckpointIfEmpty = originalBuildCheckpointIfEmpty;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
const teardown = async ()=>{
|
|
450
|
-
try {
|
|
451
|
-
await tryStop(wallet, logger);
|
|
452
|
-
await tryStop(aztecNodeService, logger);
|
|
453
|
-
await tryStop(proverNode, logger);
|
|
454
|
-
if (acvmConfig?.cleanup) {
|
|
455
|
-
await acvmConfig.cleanup();
|
|
456
|
-
}
|
|
457
|
-
if (bbConfig?.cleanup) {
|
|
458
|
-
await bbConfig.cleanup();
|
|
459
|
-
}
|
|
460
|
-
await tryStop(anvil, logger);
|
|
461
|
-
await tryRmDir(directoryToCleanup, logger);
|
|
462
|
-
} catch (err) {
|
|
463
|
-
logger.error(`Error during e2e test teardown`, err);
|
|
464
|
-
} finally{
|
|
478
|
+
logger.trace('Created funded test accounts');
|
|
479
|
+
const teardown = ()=>testSpan('teardown:env', async ()=>{
|
|
465
480
|
try {
|
|
466
|
-
await
|
|
481
|
+
await tryStop(wallet, logger);
|
|
482
|
+
await tryStop(aztecNodeService, logger);
|
|
483
|
+
await tryStop(proverNode, logger);
|
|
484
|
+
if (acvmConfig?.cleanup) {
|
|
485
|
+
await acvmConfig.cleanup();
|
|
486
|
+
}
|
|
487
|
+
if (bbConfig?.cleanup) {
|
|
488
|
+
await bbConfig.cleanup();
|
|
489
|
+
}
|
|
490
|
+
await tryStop(anvil, logger);
|
|
491
|
+
await tryRmDir(directoryToCleanup, logger);
|
|
467
492
|
} catch (err) {
|
|
468
|
-
logger.error(`Error during
|
|
493
|
+
logger.error(`Error during e2e test teardown`, err);
|
|
494
|
+
} finally{
|
|
495
|
+
try {
|
|
496
|
+
await telemetryClient.stop();
|
|
497
|
+
} catch (err) {
|
|
498
|
+
logger.error(`Error during telemetry client stop`, err);
|
|
499
|
+
}
|
|
469
500
|
}
|
|
470
|
-
}
|
|
471
|
-
};
|
|
501
|
+
});
|
|
472
502
|
return {
|
|
473
503
|
anvil,
|
|
474
504
|
aztecNode: aztecNodeService,
|
|
@@ -484,6 +514,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
484
514
|
logger,
|
|
485
515
|
mockGossipSubNetwork,
|
|
486
516
|
genesis,
|
|
517
|
+
extraL1DeployResult,
|
|
487
518
|
proverNode,
|
|
488
519
|
sequencerDelayer,
|
|
489
520
|
proverDelayer,
|
|
@@ -542,7 +573,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
542
573
|
*/ export async function registerSponsoredFPC(wallet) {
|
|
543
574
|
await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
|
|
544
575
|
}
|
|
545
|
-
export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec =
|
|
576
|
+
export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 0.25) {
|
|
546
577
|
targetBlock ??= await node.getBlockNumber();
|
|
547
578
|
await retryUntil(async ()=>await node.getBlockNumber('proven') >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
|
|
548
579
|
}
|
|
@@ -553,7 +584,7 @@ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, int
|
|
|
553
584
|
return withLoggerBindings({
|
|
554
585
|
actor: 'prover-0'
|
|
555
586
|
}, async ()=>{
|
|
556
|
-
const proverNode = await
|
|
587
|
+
const proverNode = await createAztecNodeService({
|
|
557
588
|
...baseConfig,
|
|
558
589
|
...configOverrides,
|
|
559
590
|
p2pPort: 0,
|
|
@@ -605,18 +636,20 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
605
636
|
* required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
|
|
606
637
|
* surface as generic "Assertion failed:" and tests that match on the real message fail).
|
|
607
638
|
*/ export async function ensureAuthRegistryPublished(wallet, from) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
await
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
639
|
+
await testSpan('setup:auth-registry', async ()=>{
|
|
640
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
641
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
642
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
|
|
643
|
+
from
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
647
|
+
await publishInstance(wallet, instance).send({
|
|
648
|
+
from
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
await wallet.registerContract(instance, AuthRegistryArtifact);
|
|
652
|
+
});
|
|
620
653
|
}
|
|
621
654
|
/**
|
|
622
655
|
* Registers the public_checks contract class and publishes its standard instance if not already
|
|
@@ -31,4 +31,4 @@ export declare function createProverNode(config: AztecNodeConfig, tcpPort: numbe
|
|
|
31
31
|
}>;
|
|
32
32
|
export declare function createP2PConfig(config: AztecNodeConfig, bootstrapNodeEnr?: string, port?: number, dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
33
33
|
export declare function createValidatorConfig(config: CreateNodeConfig, bootstrapNodeEnr?: string, port?: number, addressIndex?: number | number[], dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
34
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0dXBfcDJwX3Rlc3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maXh0dXJlcy9zZXR1cF9wMnBfdGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILE9BQU8sRUFBRSxLQUFLLGVBQWUsRUFBRSxnQkFBZ0IsRUFBMEIsTUFBTSxtQkFBbUIsQ0FBQztBQUtuRyxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQVc3RCxlQUFPLE1BQU0saUNBQWlDLElBQUksQ0FBQztBQU9uRCx3QkFBZ0IsbUJBQW1CLENBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsTUFBTSxHQUFHLEtBQUssTUFBTSxFQUFFLEVBQUUsQ0FPN0Y7QUFFRCx3QkFBc0IsV0FBVyxDQUMvQixNQUFNLEVBQUUsZUFBZSxHQUFHO0lBQUUsa0JBQWtCLENBQUMsRUFBRSxPQUFPLENBQUE7Q0FBRSxFQUMxRCxZQUFZLEVBQUUsWUFBWSxFQUMxQixnQkFBZ0IsRUFBRSxNQUFNLEVBQ3hCLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLFlBQVksRUFBRSxNQUFNLEVBQ3BCLE9BQU8sQ0FBQyxFQUFFLFdBQVcsRUFDckIsYUFBYSxD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jC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,EAC/B,OAAO,CAAC,EAAE,WAAW,EACrB,aAAa,CAAC,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,6BAYrB;AAED,+EAA+E;AAC/E,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,eAAe,EAC3B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,OAAO,CAAC,EAAE,WAAW,EACrB,aAAa,CAAC,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,6BAcrB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,EACpC,OAAO,CAAC,EAAE,WAAW,EACrB,aAAa,CAAC,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC;IAAE,UAAU,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAgB3C;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,gBAAgB,CAAC,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,MAAM,4BAgBvB;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,gBAAgB,EACxB,gBAAgB,CAAC,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,GAAE,MAAM,GAAG,MAAM,EAAM,EACnC,aAAa,CAAC,EAAE,MAAM,4BAoBvB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Test fixtures and utilities to set up and run a test using multiple validators
|
|
3
|
-
*/ import {
|
|
3
|
+
*/ import { createAztecNodeService } from '@aztec/aztec-node';
|
|
4
4
|
import { range } from '@aztec/foundation/array';
|
|
5
5
|
import { SecretValue } from '@aztec/foundation/config';
|
|
6
6
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
@@ -53,7 +53,7 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
53
53
|
}, async ()=>{
|
|
54
54
|
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
55
55
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
56
|
-
return await
|
|
56
|
+
return await createAztecNodeService(validatorConfig, {
|
|
57
57
|
telemetry,
|
|
58
58
|
dateProvider
|
|
59
59
|
}, {
|
|
@@ -75,7 +75,7 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
75
75
|
sequencerPublisherPrivateKeys: []
|
|
76
76
|
};
|
|
77
77
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
78
|
-
return await
|
|
78
|
+
return await createAztecNodeService(config, {
|
|
79
79
|
telemetry,
|
|
80
80
|
dateProvider
|
|
81
81
|
}, {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
/**
|
|
3
|
+
* Computes the genesis nullifiers that pre-publish the standard contracts (AuthRegistry, PublicChecks,
|
|
4
|
+
* HandshakeRegistry) in e2e environments, mirroring the nullifiers their on-chain publish txs would emit. Per contract:
|
|
5
|
+
* - `siloNullifier(ContractClassRegistry, classId)` — the class-registration nullifier that `ContractClassRegistry.publish` pushes.
|
|
6
|
+
* - `siloNullifier(ContractInstanceRegistry, instanceAddress)` — the instance-deployment nullifier that
|
|
7
|
+
* `ContractInstanceRegistry.publish_for_public_execution` pushes, using the contract's real derived address (standard
|
|
8
|
+
* contracts are deployed at artifact-derived addresses, not magic protocol addresses).
|
|
9
|
+
*
|
|
10
|
+
* Seed these into the genesis nullifier tree (as the 5th `getGenesisValues` arg) alongside the archiver's
|
|
11
|
+
* `testPreloadStandardContracts` preload: the store preload makes the `ensure*Published` guards short-circuit, and these
|
|
12
|
+
* nullifiers make the AVM's deployment-nullifier check pass when the contracts are called. Every e2e node genesis that
|
|
13
|
+
* feeds an L1 `genesisArchiveRoot` must seed the same set, or the world-state root diverges from the deployed rollup.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getStandardContractGenesisNullifiers(): Promise<Fr[]>;
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhbmRhcmRfY29udHJhY3RzX2dlbmVzaXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maXh0dXJlcy9zdGFuZGFyZF9jb250cmFjdHNfZ2VuZXNpcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUt6RDs7Ozs7Ozs7Ozs7O0dBWUc7QUFDSCx3QkFBc0Isb0NBQW9DLElBQUksT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBUzFFIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard_contracts_genesis.d.ts","sourceRoot":"","sources":["../../src/fixtures/standard_contracts_genesis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAKzD;;;;;;;;;;;;GAYG;AACH,wBAAsB,oCAAoC,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAS1E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
2
|
+
import { getPublishableStandardContracts } from '@aztec/standard-contracts';
|
|
3
|
+
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
4
|
+
/**
|
|
5
|
+
* Computes the genesis nullifiers that pre-publish the standard contracts (AuthRegistry, PublicChecks,
|
|
6
|
+
* HandshakeRegistry) in e2e environments, mirroring the nullifiers their on-chain publish txs would emit. Per contract:
|
|
7
|
+
* - `siloNullifier(ContractClassRegistry, classId)` — the class-registration nullifier that `ContractClassRegistry.publish` pushes.
|
|
8
|
+
* - `siloNullifier(ContractInstanceRegistry, instanceAddress)` — the instance-deployment nullifier that
|
|
9
|
+
* `ContractInstanceRegistry.publish_for_public_execution` pushes, using the contract's real derived address (standard
|
|
10
|
+
* contracts are deployed at artifact-derived addresses, not magic protocol addresses).
|
|
11
|
+
*
|
|
12
|
+
* Seed these into the genesis nullifier tree (as the 5th `getGenesisValues` arg) alongside the archiver's
|
|
13
|
+
* `testPreloadStandardContracts` preload: the store preload makes the `ensure*Published` guards short-circuit, and these
|
|
14
|
+
* nullifiers make the AVM's deployment-nullifier check pass when the contracts are called. Every e2e node genesis that
|
|
15
|
+
* feeds an L1 `genesisArchiveRoot` must seed the same set, or the world-state root diverges from the deployed rollup.
|
|
16
|
+
*/ export async function getStandardContractGenesisNullifiers() {
|
|
17
|
+
const classRegistry = ProtocolContractAddress.ContractClassRegistry;
|
|
18
|
+
const instanceRegistry = ProtocolContractAddress.ContractInstanceRegistry;
|
|
19
|
+
const nullifiers = [];
|
|
20
|
+
for (const { contractClass, address } of (await getPublishableStandardContracts())){
|
|
21
|
+
nullifiers.push(await siloNullifier(classRegistry, contractClass.id));
|
|
22
|
+
nullifiers.push(await siloNullifier(instanceRegistry, address.toField()));
|
|
23
|
+
}
|
|
24
|
+
return nullifiers;
|
|
25
|
+
}
|