@aztec/end-to-end 0.0.1-commit.f504929 → 0.0.1-commit.f5a9928
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 +229 -14
- 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 +23 -36
- 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 +24 -39
- 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 +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +19 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +5 -5
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +62 -54
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +97 -6
- 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/authwit_proxy.d.ts +1 -1
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -0
- package/dest/fixtures/e2e_prover_test.d.ts +15 -11
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +56 -40
- package/dest/fixtures/fixtures.d.ts +79 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +80 -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 +4 -4
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +5 -2
- 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 -42
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +295 -200
- package/dest/fixtures/setup_p2p_test.d.ts +10 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +11 -11
- 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 +23 -6
- 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/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_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 +13 -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/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 +20 -11
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +83 -39
- 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 +45 -29
- 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 +6 -4
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +33 -21
- 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 +24 -12
- 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/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 +50 -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 +25 -13
- package/dest/simulators/token_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/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- 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/single-node/fees/fees_test.js +347 -0
- 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 +374 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +847 -0
- package/dest/spartan/setup_test_wallets.d.ts +4 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +94 -48
- package/dest/spartan/tx_metrics.d.ts +27 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +105 -20
- package/dest/spartan/utils/config.d.ts +9 -32
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +1 -0
- package/dest/spartan/utils/gossip_metrics.d.ts +9 -0
- package/dest/spartan/utils/gossip_metrics.d.ts.map +1 -0
- package/dest/spartan/utils/gossip_metrics.js +77 -0
- package/dest/spartan/utils/index.d.ts +3 -1
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +4 -0
- package/dest/spartan/utils/nodes.js +2 -2
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +47 -25
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +197 -91
- package/dest/test-wallet/utils.d.ts +38 -3
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +65 -10
- package/dest/test-wallet/wallet_worker_script.js +12 -4
- package/dest/test-wallet/worker_wallet.d.ts +9 -8
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +10 -4
- package/dest/test-wallet/worker_wallet_schema.d.ts +3 -273
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet_schema.js +15 -2
- package/package.json +48 -44
- 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 +24 -47
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +25 -48
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +21 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +108 -75
- package/src/bench/utils.ts +110 -6
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/e2e_prover_test.ts +73 -63
- package/src/fixtures/fixtures.ts +100 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +11 -5
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +372 -258
- package/src/fixtures/setup_p2p_test.ts +15 -11
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +40 -8
- package/src/fixtures/utils.ts +2 -3
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +106 -0
- package/src/guides/up_quick_start.sh +5 -2
- package/src/infra/README.md +12 -0
- package/src/install_legacy_contracts.cjs +81 -0
- package/src/legacy-jest-resolver.cjs +98 -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 +96 -51
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +56 -28
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +36 -17
- package/src/shared/gas_portal_test_harness.ts +32 -14
- 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/uniswap_l1_l2.ts +92 -50
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +29 -13
- package/src/simulators/token_simulator.ts +1 -1
- package/src/single-node/README.md +66 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- 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/single-node/fees/fees_test.ts +437 -0
- 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 +1058 -0
- package/src/spartan/setup_test_wallets.ts +124 -45
- package/src/spartan/tx_metrics.ts +107 -23
- package/src/spartan/utils/config.ts +1 -0
- package/src/spartan/utils/gossip_metrics.ts +108 -0
- package/src/spartan/utils/index.ts +6 -0
- package/src/spartan/utils/nodes.ts +2 -2
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +227 -107
- package/src/test-wallet/utils.ts +104 -11
- package/src/test-wallet/wallet_worker_script.ts +11 -5
- package/src/test-wallet/worker_wallet.ts +19 -16
- package/src/test-wallet/worker_wallet_schema.ts +4 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -55
- 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 -47
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -129
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -50
- package/dest/e2e_epochs/epochs_test.d.ts +0 -102
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -386
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -88
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.js +0 -248
- 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 -26
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -54
- 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 -136
- 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 -60
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -204
- 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_cross_chain_messaging/cross_chain_messaging_test.ts +0 -193
- package/src/e2e_deploy_contract/deploy_test.ts +0 -85
- package/src/e2e_epochs/epochs_test.ts +0 -487
- package/src/e2e_fees/fees_test.ts +0 -328
- package/src/e2e_l1_publisher/write_json.ts +0 -77
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -75
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
- package/src/e2e_p2p/shared.ts +0 -333
- /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/src/fixtures/setup.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
1
|
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
|
-
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
2
|
+
import { type AztecNodeConfig, AztecNodeService, createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
3
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
5
|
-
import {
|
|
6
|
-
BatchCall,
|
|
7
|
-
type ContractFunctionInteraction,
|
|
8
|
-
type ContractMethod,
|
|
9
|
-
getContractClassFromArtifact,
|
|
10
|
-
waitForProven,
|
|
11
|
-
} from '@aztec/aztec.js/contracts';
|
|
4
|
+
import type { ContractMethod } from '@aztec/aztec.js/contracts';
|
|
12
5
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
13
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
14
7
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
15
8
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
16
9
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
17
|
-
import {
|
|
10
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
18
11
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
19
12
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
20
13
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -29,28 +22,33 @@ import {
|
|
|
29
22
|
deployAztecL1Contracts,
|
|
30
23
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
31
24
|
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
32
|
-
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
25
|
+
import { EthCheatCodes, EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
|
|
33
26
|
import type { Anvil } from '@aztec/ethereum/test';
|
|
27
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
34
28
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
35
29
|
import { SecretValue } from '@aztec/foundation/config';
|
|
36
30
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
37
31
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
38
32
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
39
33
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
40
|
-
import { sleep } from '@aztec/foundation/sleep';
|
|
41
34
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
42
35
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
43
36
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
44
37
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
45
38
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
46
39
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
47
|
-
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
48
|
-
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
40
|
+
import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
|
|
41
|
+
import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
|
|
49
42
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
43
|
+
import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
44
|
+
import { HandshakeRegistryArtifact, getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
|
|
45
|
+
import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
|
|
46
|
+
import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
|
|
50
47
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
51
|
-
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
48
|
+
import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
52
49
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
53
50
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
51
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
54
52
|
import {
|
|
55
53
|
type TelemetryClient,
|
|
56
54
|
type TelemetryClientConfig,
|
|
@@ -58,7 +56,7 @@ import {
|
|
|
58
56
|
initTelemetryClient,
|
|
59
57
|
} from '@aztec/telemetry-client';
|
|
60
58
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
61
|
-
import {
|
|
59
|
+
import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
|
|
62
60
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
63
61
|
|
|
64
62
|
import fs from 'fs/promises';
|
|
@@ -79,6 +77,8 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
|
|
|
79
77
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
80
78
|
import { getBBConfig } from './get_bb_config.js';
|
|
81
79
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
80
|
+
import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
|
|
81
|
+
import { testSpan } from './timing.js';
|
|
82
82
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
83
83
|
|
|
84
84
|
export { startAnvil };
|
|
@@ -111,6 +111,8 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
|
|
|
111
111
|
/**
|
|
112
112
|
* Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
|
|
113
113
|
* @param aztecNode - An instance of Aztec Node.
|
|
114
|
+
* @param nodeDebug - The node's debug API, used to register public function signatures for named traces; pass
|
|
115
|
+
* `undefined` when the node does not expose it.
|
|
114
116
|
* @param opts - Partial configuration for the PXE.
|
|
115
117
|
* @param logger - The logger to be used.
|
|
116
118
|
* @param actor - Actor label to include in log output (e.g., 'pxe-test').
|
|
@@ -118,6 +120,7 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
|
|
|
118
120
|
*/
|
|
119
121
|
export async function setupPXEAndGetWallet(
|
|
120
122
|
aztecNode: AztecNode,
|
|
123
|
+
nodeDebug: AztecNodeDebug | undefined,
|
|
121
124
|
opts: Partial<PXEConfig> = {},
|
|
122
125
|
logger = getLogger(),
|
|
123
126
|
actor?: string,
|
|
@@ -138,7 +141,10 @@ export async function setupPXEAndGetWallet(
|
|
|
138
141
|
|
|
139
142
|
const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
|
|
140
143
|
|
|
141
|
-
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
144
|
+
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
145
|
+
loggerActorLabel: actor,
|
|
146
|
+
nodeDebug,
|
|
147
|
+
});
|
|
142
148
|
|
|
143
149
|
return {
|
|
144
150
|
wallet,
|
|
@@ -148,7 +154,7 @@ export async function setupPXEAndGetWallet(
|
|
|
148
154
|
}
|
|
149
155
|
|
|
150
156
|
/** Options for the e2e tests setup */
|
|
151
|
-
export type SetupOptions = {
|
|
157
|
+
export type SetupOptions<TDeployExtraL1ContractsReturnType = unknown> = {
|
|
152
158
|
/** State load */
|
|
153
159
|
stateLoad?: string;
|
|
154
160
|
/** Whether to enable metrics collection, if undefined, metrics collection is disabled */
|
|
@@ -157,10 +163,11 @@ export type SetupOptions = {
|
|
|
157
163
|
deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
|
|
158
164
|
/** Initial fee juice for default accounts */
|
|
159
165
|
initialAccountFeeJuice?: Fr;
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Extra accounts to fund at genesis beyond the `numberOfAccounts` initializerless accounts that setup
|
|
168
|
+
* creates. Setup funds these but does NOT create or deploy them — the test creates/deploys them itself
|
|
169
|
+
*/
|
|
170
|
+
additionallyFundedAccounts?: InitialAccountData[];
|
|
164
171
|
/** An initial set of validators */
|
|
165
172
|
initialValidators?: (Operator & { privateKey: `0x${string}` })[];
|
|
166
173
|
/** Anvil Start time */
|
|
@@ -177,34 +184,71 @@ export type SetupOptions = {
|
|
|
177
184
|
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
178
185
|
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
179
186
|
mockGossipSubNetwork?: boolean;
|
|
180
|
-
/** Whether to
|
|
181
|
-
|
|
182
|
-
/**
|
|
187
|
+
/** Whether to add simulated latency to the mock gossipsub network (in ms) */
|
|
188
|
+
mockGossipSubNetworkLatency?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Whether to mine the L1 setup txs (Multicall3 + rollup contract deployment) under anvil automine
|
|
191
|
+
* instead of waiting on the block interval. Defaults to `true` (set in `setupInner`); only suites
|
|
192
|
+
* that assert on genesis-relative L1 timing need to opt out with `false`.
|
|
193
|
+
*/
|
|
183
194
|
automineL1Setup?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Hook invoked after the Aztec L1 rollup contracts are deployed but BEFORE the node/sequencer
|
|
197
|
+
* start, while anvil automine is still enabled (when `automineL1Setup` is true, the default).
|
|
198
|
+
* Deploy extra L1 contracts a test needs here (e.g. a cross-chain token portal + ERC20) so they
|
|
199
|
+
* mine instantly under automine instead of paying the L1 block interval once the node is running
|
|
200
|
+
* (and racing the live sequencer/archiver). The resolved value is exposed on the returned context
|
|
201
|
+
* as `extraL1DeployResult`. The hook receives setup's L1 deployer client (the same one used to
|
|
202
|
+
* deploy Multicall3).
|
|
203
|
+
*/
|
|
204
|
+
deployExtraL1Contracts?: (deps: {
|
|
205
|
+
l1Client: ExtendedViemWalletClient;
|
|
206
|
+
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
207
|
+
logger: Logger;
|
|
208
|
+
}) => Promise<TDeployExtraL1ContractsReturnType>;
|
|
184
209
|
/** How many accounts to seed and unlock in anvil. */
|
|
185
210
|
anvilAccounts?: number;
|
|
186
211
|
/** Port to start anvil (defaults to 8545) */
|
|
187
212
|
anvilPort?: number;
|
|
213
|
+
/**
|
|
214
|
+
* Number of slots per epoch for Anvil's finality simulation.
|
|
215
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
216
|
+
*/
|
|
217
|
+
anvilSlotsInAnEpoch?: number;
|
|
188
218
|
/** Key to use for publishing L1 contracts */
|
|
189
219
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
190
220
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
191
221
|
zkPassportArgs?: ZKPassportArgs;
|
|
192
222
|
/** Whether to fund the sponsored FPC in genesis (defaults to false). */
|
|
193
223
|
fundSponsoredFPC?: boolean;
|
|
194
|
-
/**
|
|
195
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Compute extra addresses to fund at genesis from the accounts setup just generated (passed as the
|
|
226
|
+
* argument). Runs after the default accounts are created and before genesis values are computed, so a
|
|
227
|
+
* test can genesis-fund a contract whose address derives from a default account (e.g. an FPC whose
|
|
228
|
+
* admin is the first account) instead of bridging fee juice to it during setup. Each returned address
|
|
229
|
+
* is funded with the same fee juice as an initial account and included in the L1 portal `fundingNeeded`.
|
|
230
|
+
*/
|
|
231
|
+
computeExtraGenesisFundedAddresses?: (defaultAccounts: InitialAccountData[]) => Promise<AztecAddress[]>;
|
|
196
232
|
/** L1 contracts deployment arguments. */
|
|
197
233
|
l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
|
|
198
|
-
/** Wallet minimum fee padding multiplier
|
|
234
|
+
/** Wallet minimum fee padding multiplier */
|
|
199
235
|
walletMinFeePadding?: number;
|
|
236
|
+
/** Whether the initial node should be a lightweight RPC-only node (no sequencer, no validator).
|
|
237
|
+
* Use for tests that create their own validator nodes and don't need the initial sequencer. */
|
|
238
|
+
skipInitialSequencer?: boolean;
|
|
239
|
+
/** Whether to swap the production Sequencer for the minimal AutomineSequencer.
|
|
240
|
+
* Use only for single-sequencer non-block-building tests. See AUTOMINE_E2E_OPTS in `fixtures.ts`. */
|
|
241
|
+
useAutomineSequencer?: boolean;
|
|
242
|
+
/** Options forwarded to PXE creation (e.g. execution hooks). */
|
|
243
|
+
pxeCreationOptions?: PXECreationOptions;
|
|
200
244
|
} & Partial<AztecNodeConfig>;
|
|
201
245
|
|
|
202
246
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
203
|
-
export type EndToEndContext = {
|
|
247
|
+
export type EndToEndContext<TDeployExtraL1ContractsReturnType = unknown> = {
|
|
204
248
|
/** The Anvil instance (only set if anvil was started locally). */
|
|
205
249
|
anvil: Anvil | undefined;
|
|
206
250
|
/** The Aztec Node service or client a connected to it. */
|
|
207
|
-
aztecNode: AztecNode;
|
|
251
|
+
aztecNode: AztecNode & AztecNodeDebug;
|
|
208
252
|
/** The Aztec Node as a service. */
|
|
209
253
|
aztecNodeService: AztecNodeService;
|
|
210
254
|
/** Client to the Aztec Node admin interface. */
|
|
@@ -219,8 +263,8 @@ export type EndToEndContext = {
|
|
|
219
263
|
config: AztecNodeConfig;
|
|
220
264
|
/** The Aztec Node configuration (alias for config for backward compatibility). */
|
|
221
265
|
aztecNodeConfig: AztecNodeConfig;
|
|
222
|
-
/**
|
|
223
|
-
|
|
266
|
+
/** Data for the extra accounts funded at genesis but not created by setup (the test creates/deploys them). */
|
|
267
|
+
additionallyFundedAccounts: InitialAccountData[];
|
|
224
268
|
/** The wallet to be used. */
|
|
225
269
|
wallet: TestWallet;
|
|
226
270
|
/** The wallets to be used. */
|
|
@@ -231,8 +275,6 @@ export type EndToEndContext = {
|
|
|
231
275
|
cheatCodes: CheatCodes;
|
|
232
276
|
/** The cheat codes for L1 */
|
|
233
277
|
ethCheatCodes: EthCheatCodes;
|
|
234
|
-
/** The anvil test watcher. */
|
|
235
|
-
watcher: AnvilTestWatcher;
|
|
236
278
|
/** Allows tweaking current system time, used by the epoch cache only. */
|
|
237
279
|
dateProvider: TestDateProvider;
|
|
238
280
|
/** Telemetry client */
|
|
@@ -243,8 +285,10 @@ export type EndToEndContext = {
|
|
|
243
285
|
sequencerDelayer: Delayer | undefined;
|
|
244
286
|
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
245
287
|
proverDelayer: Delayer | undefined;
|
|
246
|
-
/**
|
|
247
|
-
|
|
288
|
+
/** Genesis data used for setting up nodes. */
|
|
289
|
+
genesis: GenesisData | undefined;
|
|
290
|
+
/** Resolved value of the `deployExtraL1Contracts` setup hook, if one was provided. */
|
|
291
|
+
extraL1DeployResult: TDeployExtraL1ContractsReturnType;
|
|
248
292
|
/** ACVM config (only set if running locally). */
|
|
249
293
|
acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
|
|
250
294
|
/** BB config (only set if running locally). */
|
|
@@ -255,22 +299,75 @@ export type EndToEndContext = {
|
|
|
255
299
|
teardown: () => Promise<void>;
|
|
256
300
|
};
|
|
257
301
|
|
|
302
|
+
/**
|
|
303
|
+
* When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
|
|
304
|
+
* aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
|
|
305
|
+
* actually swapped in the correct version.
|
|
306
|
+
*/
|
|
307
|
+
function assertContractArtifactsVersion() {
|
|
308
|
+
const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
|
|
309
|
+
if (!expected) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const { aztecVersion } = SponsoredFPCContract.artifact;
|
|
313
|
+
// TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
|
|
314
|
+
if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
|
|
315
|
+
createLogger('e2e:setup').info(
|
|
316
|
+
`Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`,
|
|
317
|
+
);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (aztecVersion !== expected) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
`Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` +
|
|
323
|
+
`The legacy artifact resolver may not have swapped in the correct version.`,
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
258
328
|
/**
|
|
259
329
|
* Sets up the environment for the end-to-end tests.
|
|
260
330
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
261
331
|
* @param opts - Options to pass to the node initialization and to the setup script.
|
|
262
332
|
* @param pxeOpts - Options to pass to the PXE initialization.
|
|
263
333
|
*/
|
|
264
|
-
export
|
|
334
|
+
export function setup<TDeployExtraL1ContractsReturnType = unknown>(
|
|
265
335
|
numberOfAccounts = 1,
|
|
266
|
-
opts: SetupOptions = {},
|
|
336
|
+
opts: SetupOptions<TDeployExtraL1ContractsReturnType> = {},
|
|
267
337
|
pxeOpts: Partial<PXEConfig> = {},
|
|
268
338
|
chain: Chain = foundry,
|
|
269
|
-
): Promise<EndToEndContext
|
|
339
|
+
): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
|
|
340
|
+
// Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
|
|
341
|
+
// swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
|
|
342
|
+
// (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
|
|
343
|
+
const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
|
|
344
|
+
return testSpan(`setup:env:${proverMode}`, async () => {
|
|
345
|
+
const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
|
|
346
|
+
if (process.env.EXIT_E2E_AFTER_SETUP) {
|
|
347
|
+
ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
|
|
348
|
+
throw new Error('EXIT_E2E_AFTER_SETUP');
|
|
349
|
+
}
|
|
350
|
+
return ctx;
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
async function setupInner<TDeployExtraL1ContractsReturnType = unknown>(
|
|
355
|
+
numberOfAccounts: number,
|
|
356
|
+
opts: SetupOptions<TDeployExtraL1ContractsReturnType>,
|
|
357
|
+
pxeOpts: Partial<PXEConfig>,
|
|
358
|
+
chain: Chain,
|
|
359
|
+
): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
|
|
360
|
+
assertContractArtifactsVersion();
|
|
361
|
+
const logger = getLogger();
|
|
270
362
|
let anvil: Anvil | undefined;
|
|
271
363
|
try {
|
|
272
364
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
273
|
-
opts.
|
|
365
|
+
opts.slasherEnabled ??= false;
|
|
366
|
+
// Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
|
|
367
|
+
// waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
|
|
368
|
+
// assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
|
|
369
|
+
opts.automineL1Setup ??= true;
|
|
370
|
+
logger.trace('Starting e2e test setup');
|
|
274
371
|
|
|
275
372
|
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
276
373
|
// use initialValidators for the node config
|
|
@@ -280,16 +377,12 @@ export async function setup(
|
|
|
280
377
|
config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
|
|
281
378
|
// For tests we only want proving enabled if specifically requested
|
|
282
379
|
config.realProofs = !!opts.realProofs;
|
|
283
|
-
// Only enforce the time table if requested
|
|
284
|
-
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
285
380
|
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
286
381
|
config.enableDelayer = true;
|
|
287
382
|
config.listenAddress = '127.0.0.1';
|
|
288
383
|
|
|
289
384
|
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
290
385
|
|
|
291
|
-
const logger = getLogger();
|
|
292
|
-
|
|
293
386
|
// Create a temp directory for any services that need it and cleanup later
|
|
294
387
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
295
388
|
await fs.mkdir(directoryToCleanup, { recursive: true });
|
|
@@ -297,18 +390,25 @@ export async function setup(
|
|
|
297
390
|
config.dataDirectory = directoryToCleanup;
|
|
298
391
|
}
|
|
299
392
|
|
|
393
|
+
const dateProvider = new TestDateProvider();
|
|
394
|
+
|
|
300
395
|
if (!config.l1RpcUrls?.length) {
|
|
301
396
|
if (!isAnvilTestChain(chain.id)) {
|
|
302
397
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
303
398
|
}
|
|
304
|
-
const res = await
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
399
|
+
const res = await testSpan('setup:env:anvil', () =>
|
|
400
|
+
startAnvil({
|
|
401
|
+
l1BlockTime: opts.ethereumSlotDuration,
|
|
402
|
+
accounts: opts.anvilAccounts,
|
|
403
|
+
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
404
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
405
|
+
dateProvider,
|
|
406
|
+
}),
|
|
407
|
+
);
|
|
309
408
|
anvil = res.anvil;
|
|
310
409
|
config.l1RpcUrls = [res.rpcUrl];
|
|
311
410
|
}
|
|
411
|
+
logger.trace('Started anvil and L1 RPC client');
|
|
312
412
|
|
|
313
413
|
// Enable logging metrics to a local file named after the test suite
|
|
314
414
|
if (isMetricsLoggingRequested()) {
|
|
@@ -316,8 +416,6 @@ export async function setup(
|
|
|
316
416
|
logger.info(`Logging metrics to ${filename}`);
|
|
317
417
|
setupMetricsLogger(filename);
|
|
318
418
|
}
|
|
319
|
-
|
|
320
|
-
const dateProvider = new TestDateProvider();
|
|
321
419
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
322
420
|
|
|
323
421
|
if (opts.stateLoad) {
|
|
@@ -327,6 +425,7 @@ export async function setup(
|
|
|
327
425
|
if (opts.l1StartTime) {
|
|
328
426
|
await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
|
|
329
427
|
}
|
|
428
|
+
logger.trace('Initialized L1 cheat codes and applied state/time overrides');
|
|
330
429
|
|
|
331
430
|
let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
|
|
332
431
|
let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
|
|
@@ -354,12 +453,14 @@ export async function setup(
|
|
|
354
453
|
if (config.coinbase === undefined) {
|
|
355
454
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
356
455
|
}
|
|
456
|
+
logger.trace('Resolved L1 publisher account');
|
|
357
457
|
|
|
358
|
-
//
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const
|
|
458
|
+
// The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
|
|
459
|
+
// funded at genesis so they are immediately usable.
|
|
460
|
+
const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
|
|
461
|
+
// Extra accounts the test wants funded at genesis but will create/deploy itself.
|
|
462
|
+
const additionallyFundedAccounts = opts.additionallyFundedAccounts ?? [];
|
|
463
|
+
const addressesToFund = [...defaultAccounts, ...additionallyFundedAccounts].map(a => a.address);
|
|
363
464
|
|
|
364
465
|
// Optionally fund the sponsored FPC
|
|
365
466
|
if (opts.fundSponsoredFPC) {
|
|
@@ -367,11 +468,29 @@ export async function setup(
|
|
|
367
468
|
addressesToFund.push(sponsoredFPCAddress);
|
|
368
469
|
}
|
|
369
470
|
|
|
370
|
-
|
|
471
|
+
// Fund any extra addresses whose value depends on the just-generated accounts (e.g. an FPC admin'd
|
|
472
|
+
// by a default account), so a test can genesis-fund them instead of bridging fee juice during setup.
|
|
473
|
+
if (opts.computeExtraGenesisFundedAddresses) {
|
|
474
|
+
addressesToFund.push(...(await opts.computeExtraGenesisFundedAddresses(defaultAccounts)));
|
|
475
|
+
}
|
|
476
|
+
logger.trace('Generated test accounts to fund at genesis');
|
|
477
|
+
|
|
478
|
+
// Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) so their `ensure*Published` setup
|
|
479
|
+
// helpers short-circuit their publish txs. The archiver flag seeds the bytecode/instance into every spawned node's
|
|
480
|
+
// contract store; the genesis nullifiers make the AVM's deployment-nullifier check pass when they are called. Both
|
|
481
|
+
// must go together (flag alone would recreate the publish-collision bug), so the flag lives here beside the seeding.
|
|
482
|
+
config.testPreloadStandardContracts = true;
|
|
483
|
+
const standardContractNullifiers = await getStandardContractGenesisNullifiers();
|
|
484
|
+
|
|
485
|
+
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
486
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
|
|
371
487
|
addressesToFund,
|
|
372
488
|
opts.initialAccountFeeJuice,
|
|
373
489
|
opts.genesisPublicData,
|
|
490
|
+
genesisTimestamp,
|
|
491
|
+
standardContractNullifiers,
|
|
374
492
|
);
|
|
493
|
+
logger.trace('Computed genesis values');
|
|
375
494
|
|
|
376
495
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
377
496
|
const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
|
|
@@ -381,18 +500,21 @@ export async function setup(
|
|
|
381
500
|
|
|
382
501
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
|
|
383
502
|
|
|
503
|
+
// Warm both KZG trusted setups (ours + anvil's) in parallel
|
|
504
|
+
if (anvil && isAnvilTestChain(chain.id)) {
|
|
505
|
+
await warmBlobKzg(l1Client, logger);
|
|
506
|
+
}
|
|
507
|
+
|
|
384
508
|
// Deploy Multicall3 if running locally
|
|
385
509
|
await deployMulticall3(l1Client, logger);
|
|
386
510
|
|
|
387
511
|
// Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
|
|
388
512
|
// This is necessary because deployMulticall3 sends multiple transactions and viem may cache a stale nonce
|
|
389
513
|
await l1Client.getTransactionCount({ address: l1Client.account.address });
|
|
514
|
+
logger.trace('Deployed Multicall3');
|
|
390
515
|
|
|
391
|
-
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await
|
|
392
|
-
config.l1RpcUrls[0],
|
|
393
|
-
publisherPrivKeyHex!,
|
|
394
|
-
chain.id,
|
|
395
|
-
{
|
|
516
|
+
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await testSpan('setup:env:l1-deploy', () =>
|
|
517
|
+
deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex!, chain.id, {
|
|
396
518
|
...getL1ContractsConfigEnvVars(),
|
|
397
519
|
...opts,
|
|
398
520
|
...opts.l1ContractsArgs,
|
|
@@ -402,81 +524,96 @@ export async function setup(
|
|
|
402
524
|
initialValidators: opts.initialValidators,
|
|
403
525
|
feeJuicePortalInitialBalance: fundingNeeded,
|
|
404
526
|
realVerifier: false,
|
|
405
|
-
},
|
|
527
|
+
}),
|
|
406
528
|
);
|
|
407
529
|
|
|
408
|
-
config
|
|
530
|
+
Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
|
|
409
531
|
config.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
410
532
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
533
|
+
// Propagate L1-contracts-config overrides back to the node config so the archiver's
|
|
534
|
+
// `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
|
|
535
|
+
// Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
|
|
536
|
+
// but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
|
|
537
|
+
// `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
|
|
538
|
+
// `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
|
|
539
|
+
// Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
|
|
540
|
+
// by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
|
|
541
|
+
// as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
|
|
542
|
+
// in this function and crash `setupSharedBlobStorage`.
|
|
543
|
+
if (opts.l1ContractsArgs) {
|
|
544
|
+
for (const [key, value] of Object.entries(opts.l1ContractsArgs)) {
|
|
545
|
+
if (value !== undefined) {
|
|
546
|
+
(config as unknown as Record<string, unknown>)[key] = value;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
414
549
|
}
|
|
415
550
|
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
551
|
+
// Deploy any test-specific L1 contracts while automine is still on and before the node starts,
|
|
552
|
+
// so they mine instantly rather than paying the L1 block interval once the sequencer is live.
|
|
553
|
+
let extraL1DeployResult: TDeployExtraL1ContractsReturnType = undefined as TDeployExtraL1ContractsReturnType;
|
|
554
|
+
if (opts.deployExtraL1Contracts) {
|
|
555
|
+
logger.trace('Running deployExtraL1Contracts hook');
|
|
556
|
+
extraL1DeployResult = await opts.deployExtraL1Contracts({
|
|
557
|
+
l1Client,
|
|
558
|
+
deployL1ContractsValues,
|
|
559
|
+
logger,
|
|
560
|
+
});
|
|
561
|
+
// The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
|
|
562
|
+
// stale cached nonce for later transactions on the publisher account.
|
|
563
|
+
await l1Client.getTransactionCount({ address: l1Client.account.address });
|
|
424
564
|
}
|
|
425
565
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
429
|
-
deployL1ContractsValues.l1Client,
|
|
430
|
-
dateProvider,
|
|
431
|
-
);
|
|
432
|
-
if (!opts.disableAnvilTestWatcher) {
|
|
433
|
-
await watcher.start();
|
|
566
|
+
if (enableAutomine) {
|
|
567
|
+
await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
|
|
434
568
|
}
|
|
435
569
|
|
|
436
|
-
//
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
570
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
571
|
+
// ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
|
|
572
|
+
// the stdout listener.
|
|
573
|
+
if (!anvil) {
|
|
574
|
+
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
575
|
+
}
|
|
442
576
|
|
|
443
|
-
|
|
577
|
+
if (opts.l2StartTime) {
|
|
578
|
+
await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
|
|
579
|
+
}
|
|
580
|
+
logger.trace('Deployed L1 rollup contracts');
|
|
581
|
+
|
|
582
|
+
// These boot steps are independent and write disjoint config keys, so run them concurrently:
|
|
583
|
+
// telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
|
|
584
|
+
// and the ACVM/BB config resolvers write their own acvm*/bb* keys.
|
|
585
|
+
const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
|
|
586
|
+
// Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
|
|
587
|
+
opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
|
|
588
|
+
setupSharedBlobStorage(config),
|
|
589
|
+
getACVMConfig(logger),
|
|
590
|
+
getBBConfig(logger),
|
|
591
|
+
]);
|
|
592
|
+
logger.trace('Created telemetry client');
|
|
593
|
+
logger.trace('Set up shared blob storage');
|
|
444
594
|
|
|
445
|
-
const acvmConfig = await getACVMConfig(logger);
|
|
446
595
|
if (acvmConfig) {
|
|
447
596
|
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
448
597
|
config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
|
|
449
598
|
}
|
|
599
|
+
logger.trace('Resolved ACVM config');
|
|
450
600
|
|
|
451
|
-
const bbConfig = await getBBConfig(logger);
|
|
452
601
|
if (bbConfig) {
|
|
453
602
|
config.bbBinaryPath = bbConfig.bbBinaryPath;
|
|
454
603
|
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
455
604
|
}
|
|
605
|
+
logger.trace('Resolved Barretenberg config');
|
|
606
|
+
|
|
607
|
+
logger.verbose('Creating and synching an aztec node', config);
|
|
456
608
|
|
|
457
609
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
458
610
|
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
459
611
|
|
|
460
612
|
if (opts.mockGossipSubNetwork) {
|
|
461
|
-
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
613
|
+
mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
|
|
462
614
|
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
463
615
|
}
|
|
464
616
|
|
|
465
|
-
// Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
|
|
466
|
-
// To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
|
|
467
|
-
// For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
|
|
468
|
-
// If no accounts need deployment, we await an empty block to confirm network progression.
|
|
469
|
-
const originalMinTxsPerBlock = config.minTxsPerBlock;
|
|
470
|
-
if (originalMinTxsPerBlock === undefined) {
|
|
471
|
-
throw new Error('minTxsPerBlock is undefined in e2e test setup');
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
// Only set minTxsPerBlock=1 if we're going to deploy accounts and need reliable block inclusion
|
|
475
|
-
const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
|
|
476
|
-
// Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
|
|
477
|
-
const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
|
|
478
|
-
config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
|
|
479
|
-
|
|
480
617
|
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
481
618
|
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
482
619
|
|
|
@@ -486,14 +623,29 @@ export async function setup(
|
|
|
486
623
|
}
|
|
487
624
|
}
|
|
488
625
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
626
|
+
// When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
|
|
627
|
+
// We apply these overrides to a copy so they don't leak into the returned config.
|
|
628
|
+
// Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
|
|
629
|
+
const initialNodeConfig = opts.skipInitialSequencer
|
|
630
|
+
? {
|
|
631
|
+
...config,
|
|
632
|
+
disableValidator: true,
|
|
633
|
+
...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
|
|
634
|
+
}
|
|
635
|
+
: config;
|
|
636
|
+
logger.trace('Prepared aztec node config');
|
|
637
|
+
|
|
638
|
+
const aztecNodeService = await testSpan('setup:env:sequencer-start', () =>
|
|
639
|
+
withLoggerBindings({ actor: 'node-0' }, () =>
|
|
640
|
+
createAztecNodeService(
|
|
641
|
+
initialNodeConfig,
|
|
642
|
+
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
643
|
+
{ genesis, dontStartSequencer: opts.skipInitialSequencer },
|
|
644
|
+
),
|
|
494
645
|
),
|
|
495
646
|
);
|
|
496
647
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
648
|
+
logger.trace('Created and synced aztec node');
|
|
497
649
|
|
|
498
650
|
let proverNode: AztecNodeService | undefined = undefined;
|
|
499
651
|
if (opts.startProverNode) {
|
|
@@ -507,16 +659,19 @@ export async function setup(
|
|
|
507
659
|
rpcTxProviders: [aztecNodeService],
|
|
508
660
|
};
|
|
509
661
|
|
|
510
|
-
({ proverNode } = await
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
662
|
+
({ proverNode } = await testSpan('setup:env:prover-node', () =>
|
|
663
|
+
createAndSyncProverNode(
|
|
664
|
+
proverNodePrivateKeyHex,
|
|
665
|
+
config,
|
|
666
|
+
{
|
|
667
|
+
...config.proverNodeConfig,
|
|
668
|
+
dataDirectory: proverNodeDataDirectory,
|
|
669
|
+
},
|
|
670
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
671
|
+
{ genesis },
|
|
672
|
+
),
|
|
519
673
|
));
|
|
674
|
+
logger.trace('Created prover node');
|
|
520
675
|
}
|
|
521
676
|
|
|
522
677
|
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
@@ -527,13 +682,22 @@ export async function setup(
|
|
|
527
682
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
528
683
|
// For tests we only want proving enabled if specifically requested
|
|
529
684
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
530
|
-
const wallet = await
|
|
685
|
+
const wallet = await testSpan('setup:env:pxe', () =>
|
|
686
|
+
TestWallet.create(aztecNodeService, pxeConfig, {
|
|
687
|
+
loggerActorLabel: 'pxe-0',
|
|
688
|
+
// In-process node implements the debug API, so register public function signatures for named traces.
|
|
689
|
+
nodeDebug: aztecNodeService,
|
|
690
|
+
...opts.pxeCreationOptions,
|
|
691
|
+
}),
|
|
692
|
+
);
|
|
531
693
|
|
|
532
694
|
if (opts.walletMinFeePadding !== undefined) {
|
|
533
695
|
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
534
696
|
}
|
|
697
|
+
logger.trace('Created PXE and test wallet');
|
|
535
698
|
|
|
536
699
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
|
|
700
|
+
logger.trace('Created cheat codes');
|
|
537
701
|
|
|
538
702
|
if (
|
|
539
703
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -547,64 +711,48 @@ export async function setup(
|
|
|
547
711
|
);
|
|
548
712
|
await cheatCodes.rollup.setupEpoch();
|
|
549
713
|
await cheatCodes.rollup.debugRollup();
|
|
714
|
+
logger.trace('Advanced chain to set up validator committee');
|
|
550
715
|
}
|
|
551
716
|
|
|
552
717
|
let accounts: AztecAddress[] = [];
|
|
553
718
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
);
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
accounts = accountManagers.map(accountManager => accountManager.address);
|
|
561
|
-
} else if (needsEmptyBlock) {
|
|
562
|
-
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
563
|
-
while ((await aztecNodeService.getBlockNumber()) === 0) {
|
|
564
|
-
await sleep(2000);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
// If skipAccountDeployment is true, we don't deploy or wait - tests will handle account deployment later
|
|
568
|
-
|
|
569
|
-
// Now we restore the original minTxsPerBlock setting if we changed it.
|
|
570
|
-
if (sequencerClient && config.minTxsPerBlock !== originalMinTxsPerBlock) {
|
|
571
|
-
sequencerClient.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
575
|
-
throw new Error(
|
|
576
|
-
`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`,
|
|
577
|
-
);
|
|
719
|
+
// Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
|
|
720
|
+
// + a simulated store call) with no on-chain tx, independent of the sequencer.
|
|
721
|
+
if (numberOfAccounts > 0) {
|
|
722
|
+
logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
|
|
723
|
+
await testSpan('wallet:create', () => createFundedInitializerlessAccounts(wallet, defaultAccounts));
|
|
724
|
+
accounts = defaultAccounts.map(a => a.address);
|
|
578
725
|
}
|
|
726
|
+
logger.trace('Created funded test accounts');
|
|
579
727
|
|
|
580
|
-
const teardown =
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
728
|
+
const teardown = () =>
|
|
729
|
+
testSpan('teardown:env', async () => {
|
|
730
|
+
try {
|
|
731
|
+
await tryStop(wallet, logger);
|
|
732
|
+
await tryStop(aztecNodeService, logger);
|
|
733
|
+
await tryStop(proverNode, logger);
|
|
585
734
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
735
|
+
if (acvmConfig?.cleanup) {
|
|
736
|
+
await acvmConfig.cleanup();
|
|
737
|
+
}
|
|
589
738
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
739
|
+
if (bbConfig?.cleanup) {
|
|
740
|
+
await bbConfig.cleanup();
|
|
741
|
+
}
|
|
593
742
|
|
|
594
|
-
|
|
595
|
-
await tryStop(anvil, logger);
|
|
743
|
+
await tryStop(anvil, logger);
|
|
596
744
|
|
|
597
|
-
|
|
598
|
-
} catch (err) {
|
|
599
|
-
logger.error(`Error during e2e test teardown`, err);
|
|
600
|
-
} finally {
|
|
601
|
-
try {
|
|
602
|
-
await telemetryClient.stop();
|
|
745
|
+
await tryRmDir(directoryToCleanup, logger);
|
|
603
746
|
} catch (err) {
|
|
604
|
-
logger.error(`Error during
|
|
747
|
+
logger.error(`Error during e2e test teardown`, err);
|
|
748
|
+
} finally {
|
|
749
|
+
try {
|
|
750
|
+
await telemetryClient.stop();
|
|
751
|
+
} catch (err) {
|
|
752
|
+
logger.error(`Error during telemetry client stop`, err);
|
|
753
|
+
}
|
|
605
754
|
}
|
|
606
|
-
}
|
|
607
|
-
};
|
|
755
|
+
});
|
|
608
756
|
|
|
609
757
|
return {
|
|
610
758
|
anvil,
|
|
@@ -617,10 +765,11 @@ export async function setup(
|
|
|
617
765
|
aztecNodeConfig: config,
|
|
618
766
|
dateProvider,
|
|
619
767
|
deployL1ContractsValues,
|
|
620
|
-
|
|
768
|
+
additionallyFundedAccounts,
|
|
621
769
|
logger,
|
|
622
770
|
mockGossipSubNetwork,
|
|
623
|
-
|
|
771
|
+
genesis,
|
|
772
|
+
extraL1DeployResult,
|
|
624
773
|
proverNode,
|
|
625
774
|
sequencerDelayer,
|
|
626
775
|
proverDelayer,
|
|
@@ -629,7 +778,6 @@ export async function setup(
|
|
|
629
778
|
telemetryClient,
|
|
630
779
|
wallet,
|
|
631
780
|
accounts,
|
|
632
|
-
watcher,
|
|
633
781
|
acvmConfig,
|
|
634
782
|
bbConfig,
|
|
635
783
|
directoryToCleanup,
|
|
@@ -696,11 +844,16 @@ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
|
|
|
696
844
|
await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
|
|
697
845
|
}
|
|
698
846
|
|
|
699
|
-
export async function waitForProvenChain(
|
|
847
|
+
export async function waitForProvenChain(
|
|
848
|
+
node: AztecNode,
|
|
849
|
+
targetBlock?: BlockNumber,
|
|
850
|
+
timeoutSec = 60,
|
|
851
|
+
intervalSec = 0.25,
|
|
852
|
+
) {
|
|
700
853
|
targetBlock ??= await node.getBlockNumber();
|
|
701
854
|
|
|
702
855
|
await retryUntil(
|
|
703
|
-
async () => (await node.
|
|
856
|
+
async () => (await node.getBlockNumber('proven')) >= targetBlock,
|
|
704
857
|
'proven chain status',
|
|
705
858
|
timeoutSec,
|
|
706
859
|
intervalSec,
|
|
@@ -719,11 +872,12 @@ export function createAndSyncProverNode(
|
|
|
719
872
|
telemetry?: TelemetryClient;
|
|
720
873
|
dateProvider: DateProvider;
|
|
721
874
|
p2pClientDeps?: P2PClientDeps;
|
|
875
|
+
proverNodeDeps?: Partial<ProverNodeDeps>;
|
|
722
876
|
},
|
|
723
|
-
options: {
|
|
877
|
+
options: { genesis?: GenesisData; dontStart?: boolean },
|
|
724
878
|
): Promise<{ proverNode: AztecNodeService }> {
|
|
725
879
|
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
726
|
-
const proverNode = await
|
|
880
|
+
const proverNode = await createAztecNodeService(
|
|
727
881
|
{
|
|
728
882
|
...baseConfig,
|
|
729
883
|
...configOverrides,
|
|
@@ -733,7 +887,7 @@ export function createAndSyncProverNode(
|
|
|
733
887
|
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
734
888
|
},
|
|
735
889
|
deps,
|
|
736
|
-
{
|
|
890
|
+
{ genesis: options.genesis, dontStartProverNode: options.dontStart },
|
|
737
891
|
);
|
|
738
892
|
|
|
739
893
|
if (!proverNode.getProverNode()) {
|
|
@@ -791,96 +945,56 @@ export async function expectMappingDelta<K, V extends number | bigint>(
|
|
|
791
945
|
}
|
|
792
946
|
|
|
793
947
|
/**
|
|
794
|
-
* Registers the contract class
|
|
795
|
-
*
|
|
948
|
+
* Registers the auth_registry contract class and publishes its standard instance if not already
|
|
949
|
+
* present, and registers the artifact with PXE. Publishing is required before exercising the public
|
|
950
|
+
* authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
|
|
951
|
+
* required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
|
|
952
|
+
* surface as generic "Assertion failed:" and tests that match on the real message fail).
|
|
796
953
|
*/
|
|
797
|
-
export async function
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
accountsAndAddresses
|
|
809
|
-
.filter(({ deployed }) => !deployed)
|
|
810
|
-
.map(({ address }) => wallet.getContractMetadata(address)),
|
|
811
|
-
)
|
|
812
|
-
).map(contractMetadata => contractMetadata.instance);
|
|
813
|
-
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
814
|
-
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
815
|
-
await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
|
|
816
|
-
}
|
|
817
|
-
const requests = instances.map(instance => publishInstance(wallet, instance!));
|
|
818
|
-
const batch = new BatchCall(wallet, requests);
|
|
819
|
-
await batch.send({ from: accountsToDeploy[0] });
|
|
954
|
+
export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
955
|
+
await testSpan('setup:auth-registry', async () => {
|
|
956
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
957
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
958
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
|
|
959
|
+
}
|
|
960
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
961
|
+
await publishInstance(wallet, instance).send({ from });
|
|
962
|
+
}
|
|
963
|
+
await wallet.registerContract(instance, AuthRegistryArtifact);
|
|
964
|
+
});
|
|
820
965
|
}
|
|
821
966
|
|
|
822
967
|
/**
|
|
823
|
-
*
|
|
824
|
-
*
|
|
968
|
+
* Registers the public_checks contract class and publishes its standard instance if not already
|
|
969
|
+
* present, and registers the artifact with PXE. Required for any contract that calls
|
|
970
|
+
* `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
|
|
971
|
+
* deployed PublicChecks contract via an enqueued public call).
|
|
825
972
|
*/
|
|
826
|
-
export
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
for (let i = 0; i < deployedAccounts.length; i++) {
|
|
837
|
-
const accountManager = await wallet.createSchnorrAccount(
|
|
838
|
-
deployedAccounts[i].secret,
|
|
839
|
-
deployedAccounts[i].salt,
|
|
840
|
-
deployedAccounts[i].signingKey,
|
|
841
|
-
);
|
|
842
|
-
const deployMethod = await accountManager.getDeployMethod();
|
|
843
|
-
await deployMethod.send({
|
|
844
|
-
from: AztecAddress.ZERO,
|
|
845
|
-
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
return { deployedAccounts };
|
|
850
|
-
};
|
|
973
|
+
export async function ensurePublicChecksPublished(wallet: Wallet, from: AztecAddress) {
|
|
974
|
+
const { instance, contractClass } = await getStandardPublicChecks();
|
|
975
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
976
|
+
await (await publishContractClass(wallet, PublicChecksArtifact)).send({ from });
|
|
977
|
+
}
|
|
978
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
979
|
+
await publishInstance(wallet, instance).send({ from });
|
|
980
|
+
}
|
|
981
|
+
await wallet.registerContract(instance, PublicChecksArtifact);
|
|
982
|
+
}
|
|
851
983
|
|
|
852
984
|
/**
|
|
853
|
-
* Registers the contract class
|
|
854
|
-
*
|
|
985
|
+
* Registers the handshake_registry contract class and publishes its standard instance if not
|
|
986
|
+
* already present, and registers the artifact with PXE. Required for constrained-delivery flows
|
|
987
|
+
* that call into the HandshakeRegistry at its well-known address.
|
|
855
988
|
*/
|
|
856
|
-
export async function
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
) {
|
|
862
|
-
|
|
863
|
-
metadata => metadata.instance,
|
|
864
|
-
);
|
|
865
|
-
|
|
866
|
-
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
867
|
-
const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
|
|
868
|
-
|
|
869
|
-
const calls: ContractFunctionInteraction[] = await Promise.all([
|
|
870
|
-
...(!alreadyRegistered ? [publishContractClass(wallet, SchnorrAccountContractArtifact)] : []),
|
|
871
|
-
...instances.map(instance => publishInstance(wallet, instance!)),
|
|
872
|
-
]);
|
|
873
|
-
|
|
874
|
-
const batch = new BatchCall(wallet, calls);
|
|
875
|
-
|
|
876
|
-
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
877
|
-
if (waitUntilProven) {
|
|
878
|
-
if (!node) {
|
|
879
|
-
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
880
|
-
} else {
|
|
881
|
-
await waitForProven(node, txReceipt);
|
|
882
|
-
}
|
|
989
|
+
export async function ensureHandshakeRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
990
|
+
const { instance, contractClass } = await getStandardHandshakeRegistry();
|
|
991
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
992
|
+
await (await publishContractClass(wallet, HandshakeRegistryArtifact)).send({ from });
|
|
993
|
+
}
|
|
994
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
995
|
+
await publishInstance(wallet, instance).send({ from });
|
|
883
996
|
}
|
|
997
|
+
await wallet.registerContract(instance, HandshakeRegistryArtifact);
|
|
884
998
|
}
|
|
885
999
|
|
|
886
1000
|
/**
|