@aztec/end-to-end 0.0.1-commit.2ed92850 → 0.0.1-commit.3100065
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/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -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 +45 -48
- 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 +43 -48
- 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 +6 -6
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +65 -56
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +102 -8
- 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 +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +18 -14
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +84 -75
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +82 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +84 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +119 -0
- package/dest/fixtures/index.d.ts +3 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +2 -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 +120 -61
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +337 -327
- package/dest/fixtures/setup_p2p_test.d.ts +22 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +46 -35
- 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 +26 -8
- 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 +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/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 +22 -12
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +98 -37
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/p2p/reqresp/utils.js +193 -0
- 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 +44 -32
- 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 +26 -14
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +2 -2
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +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 +56 -44
- 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 +27 -15
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/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 +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 +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +124 -47
- package/dest/spartan/tx_metrics.d.ts +61 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +256 -21
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +11 -28
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +4 -1
- package/dest/spartan/utils/index.d.ts +6 -4
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +6 -2
- package/dest/spartan/utils/k8s.d.ts +31 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +124 -0
- package/dest/spartan/utils/nodes.d.ts +14 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +204 -33
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/spartan/utils/scripts.d.ts +18 -4
- package/dest/spartan/utils/scripts.d.ts.map +1 -1
- package/dest/spartan/utils/scripts.js +19 -4
- package/dest/test-wallet/test_wallet.d.ts +105 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +320 -0
- package/dest/test-wallet/utils.d.ts +76 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +126 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +56 -0
- package/dest/test-wallet/worker_wallet.d.ts +53 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +155 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +23 -0
- package/package.json +53 -46
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/contracts/fixtures/storage_proof.json +915 -0
- package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -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 +51 -61
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +50 -56
- 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 +106 -72
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/utils.ts +117 -8
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +102 -96
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +108 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +192 -0
- package/src/fixtures/index.ts +2 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +438 -445
- package/src/fixtures/setup_p2p_test.ts +54 -54
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +42 -7
- 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 +7 -4
- package/src/infra/README.md +12 -0
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -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 +124 -53
- package/src/p2p/reqresp/utils.ts +263 -0
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +44 -21
- package/src/shared/gas_portal_test_harness.ts +33 -15
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +15 -6
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +98 -56
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +33 -15
- package/src/simulators/token_simulator.ts +6 -30
- 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 +1054 -0
- package/src/spartan/setup_test_wallets.ts +168 -42
- package/src/spartan/tx_metrics.ts +234 -24
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +3 -0
- package/src/spartan/utils/index.ts +10 -1
- package/src/spartan/utils/k8s.ts +160 -0
- package/src/spartan/utils/nodes.ts +251 -31
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +43 -7
- package/src/test-wallet/test_wallet.ts +426 -0
- package/src/test-wallet/utils.ts +205 -0
- package/src/test-wallet/wallet_worker_script.ts +66 -0
- package/src/test-wallet/worker_wallet.ts +214 -0
- package/src/test-wallet/worker_wallet_schema.ts +14 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -53
- 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 -128
- 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 -94
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -342
- 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 -10
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -62
- 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 -56
- 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/shared.d.ts +0 -46
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -177
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -42
- 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 -194
- package/src/e2e_deploy_contract/deploy_test.ts +0 -85
- package/src/e2e_epochs/epochs_test.ts +0 -456
- package/src/e2e_fees/fees_test.ts +0 -339
- package/src/e2e_l1_publisher/write_json.ts +0 -82
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -73
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
- package/src/e2e_p2p/shared.ts +0 -280
- /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +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,22 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
4
|
-
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
1
|
+
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { type AztecNodeConfig, AztecNodeService, createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
3
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
6
|
-
import {
|
|
7
|
-
BatchCall,
|
|
8
|
-
type ContractFunctionInteraction,
|
|
9
|
-
type ContractMethod,
|
|
10
|
-
getContractClassFromArtifact,
|
|
11
|
-
waitForProven,
|
|
12
|
-
} from '@aztec/aztec.js/contracts';
|
|
4
|
+
import type { ContractMethod } from '@aztec/aztec.js/contracts';
|
|
13
5
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
14
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
15
7
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
16
|
-
import {
|
|
8
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
9
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
18
|
-
import {
|
|
19
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
10
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
20
11
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
21
12
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
22
13
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -30,36 +21,34 @@ import {
|
|
|
30
21
|
type ZKPassportArgs,
|
|
31
22
|
deployAztecL1Contracts,
|
|
32
23
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
createDelayedL1TxUtilsFromViemWallet,
|
|
38
|
-
startAnvil,
|
|
39
|
-
} from '@aztec/ethereum/test';
|
|
24
|
+
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
25
|
+
import { EthCheatCodes, EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
|
|
26
|
+
import type { Anvil } from '@aztec/ethereum/test';
|
|
27
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
40
28
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
41
29
|
import { SecretValue } from '@aztec/foundation/config';
|
|
42
30
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
43
31
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
44
|
-
import {
|
|
32
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
45
33
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
46
|
-
import { sleep } from '@aztec/foundation/sleep';
|
|
47
34
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
48
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
49
35
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
50
36
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
51
37
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
52
38
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
53
39
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
54
|
-
import
|
|
55
|
-
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
40
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
41
|
+
import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
|
|
56
42
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
57
|
-
import
|
|
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';
|
|
58
47
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
59
|
-
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
48
|
+
import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
60
49
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
61
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
62
50
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
51
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
63
52
|
import {
|
|
64
53
|
type TelemetryClient,
|
|
65
54
|
type TelemetryClientConfig,
|
|
@@ -67,10 +56,9 @@ import {
|
|
|
67
56
|
initTelemetryClient,
|
|
68
57
|
} from '@aztec/telemetry-client';
|
|
69
58
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
70
|
-
import {
|
|
59
|
+
import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
|
|
71
60
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
72
61
|
|
|
73
|
-
import type { Anvil } from '@viem/anvil';
|
|
74
62
|
import fs from 'fs/promises';
|
|
75
63
|
import { tmpdir } from 'os';
|
|
76
64
|
import path from 'path';
|
|
@@ -84,17 +72,17 @@ import {
|
|
|
84
72
|
} from 'viem/accounts';
|
|
85
73
|
import { type Chain, foundry } from 'viem/chains';
|
|
86
74
|
|
|
75
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
87
76
|
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
88
77
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
89
78
|
import { getBBConfig } from './get_bb_config.js';
|
|
90
79
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
80
|
+
import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
|
|
81
|
+
import { testSpan } from './timing.js';
|
|
91
82
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
92
83
|
|
|
93
84
|
export { startAnvil };
|
|
94
85
|
|
|
95
|
-
const { AZTEC_NODE_URL = '' } = process.env;
|
|
96
|
-
const getAztecUrl = () => AZTEC_NODE_URL;
|
|
97
|
-
|
|
98
86
|
let telemetry: TelemetryClient | undefined = undefined;
|
|
99
87
|
async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
|
|
100
88
|
if (!telemetry) {
|
|
@@ -123,16 +111,19 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
|
|
|
123
111
|
/**
|
|
124
112
|
* Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
|
|
125
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.
|
|
126
116
|
* @param opts - Partial configuration for the PXE.
|
|
127
117
|
* @param logger - The logger to be used.
|
|
128
|
-
* @param
|
|
118
|
+
* @param actor - Actor label to include in log output (e.g., 'pxe-test').
|
|
129
119
|
* @returns A test wallet, logger and teardown function.
|
|
130
120
|
*/
|
|
131
121
|
export async function setupPXEAndGetWallet(
|
|
132
122
|
aztecNode: AztecNode,
|
|
123
|
+
nodeDebug: AztecNodeDebug | undefined,
|
|
133
124
|
opts: Partial<PXEConfig> = {},
|
|
134
125
|
logger = getLogger(),
|
|
135
|
-
|
|
126
|
+
actor?: string,
|
|
136
127
|
): Promise<{
|
|
137
128
|
wallet: TestWallet;
|
|
138
129
|
logger: Logger;
|
|
@@ -151,7 +142,8 @@ export async function setupPXEAndGetWallet(
|
|
|
151
142
|
const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
|
|
152
143
|
|
|
153
144
|
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
154
|
-
|
|
145
|
+
loggerActorLabel: actor,
|
|
146
|
+
nodeDebug,
|
|
155
147
|
});
|
|
156
148
|
|
|
157
149
|
return {
|
|
@@ -162,7 +154,7 @@ export async function setupPXEAndGetWallet(
|
|
|
162
154
|
}
|
|
163
155
|
|
|
164
156
|
/** Options for the e2e tests setup */
|
|
165
|
-
export type SetupOptions = {
|
|
157
|
+
export type SetupOptions<TDeployExtraL1ContractsReturnType = unknown> = {
|
|
166
158
|
/** State load */
|
|
167
159
|
stateLoad?: string;
|
|
168
160
|
/** Whether to enable metrics collection, if undefined, metrics collection is disabled */
|
|
@@ -171,10 +163,11 @@ export type SetupOptions = {
|
|
|
171
163
|
deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
|
|
172
164
|
/** Initial fee juice for default accounts */
|
|
173
165
|
initialAccountFeeJuice?: Fr;
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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[];
|
|
178
171
|
/** An initial set of validators */
|
|
179
172
|
initialValidators?: (Operator & { privateKey: `0x${string}` })[];
|
|
180
173
|
/** Anvil Start time */
|
|
@@ -191,41 +184,78 @@ export type SetupOptions = {
|
|
|
191
184
|
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
192
185
|
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
193
186
|
mockGossipSubNetwork?: boolean;
|
|
194
|
-
/** Whether to
|
|
195
|
-
|
|
196
|
-
/**
|
|
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
|
+
*/
|
|
197
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>;
|
|
198
209
|
/** How many accounts to seed and unlock in anvil. */
|
|
199
210
|
anvilAccounts?: number;
|
|
200
211
|
/** Port to start anvil (defaults to 8545) */
|
|
201
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;
|
|
202
218
|
/** Key to use for publishing L1 contracts */
|
|
203
219
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
204
220
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
205
221
|
zkPassportArgs?: ZKPassportArgs;
|
|
206
222
|
/** Whether to fund the sponsored FPC in genesis (defaults to false). */
|
|
207
223
|
fundSponsoredFPC?: boolean;
|
|
208
|
-
/**
|
|
209
|
-
|
|
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[]>;
|
|
210
232
|
/** L1 contracts deployment arguments. */
|
|
211
233
|
l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
|
|
212
|
-
/** Wallet minimum fee padding multiplier
|
|
234
|
+
/** Wallet minimum fee padding multiplier */
|
|
213
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;
|
|
214
244
|
} & Partial<AztecNodeConfig>;
|
|
215
245
|
|
|
216
246
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
217
|
-
export type EndToEndContext = {
|
|
247
|
+
export type EndToEndContext<TDeployExtraL1ContractsReturnType = unknown> = {
|
|
218
248
|
/** The Anvil instance (only set if anvil was started locally). */
|
|
219
249
|
anvil: Anvil | undefined;
|
|
220
250
|
/** The Aztec Node service or client a connected to it. */
|
|
221
|
-
aztecNode: AztecNode;
|
|
222
|
-
/** The Aztec Node as a service
|
|
223
|
-
aztecNodeService: AztecNodeService
|
|
224
|
-
/** Client to the Aztec Node admin interface
|
|
225
|
-
aztecNodeAdmin: AztecNodeAdmin
|
|
226
|
-
/** The prover node
|
|
227
|
-
proverNode:
|
|
228
|
-
/** A client to the sequencer service
|
|
251
|
+
aztecNode: AztecNode & AztecNodeDebug;
|
|
252
|
+
/** The Aztec Node as a service. */
|
|
253
|
+
aztecNodeService: AztecNodeService;
|
|
254
|
+
/** Client to the Aztec Node admin interface. */
|
|
255
|
+
aztecNodeAdmin: AztecNodeAdmin;
|
|
256
|
+
/** The aztec node running the prover node subsystem (only set if startProverNode is true). */
|
|
257
|
+
proverNode: AztecNodeService | undefined;
|
|
258
|
+
/** A client to the sequencer service. */
|
|
229
259
|
sequencer: SequencerClient | undefined;
|
|
230
260
|
/** Return values from deployAztecL1Contracts function. */
|
|
231
261
|
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
@@ -233,8 +263,8 @@ export type EndToEndContext = {
|
|
|
233
263
|
config: AztecNodeConfig;
|
|
234
264
|
/** The Aztec Node configuration (alias for config for backward compatibility). */
|
|
235
265
|
aztecNodeConfig: AztecNodeConfig;
|
|
236
|
-
/**
|
|
237
|
-
|
|
266
|
+
/** Data for the extra accounts funded at genesis but not created by setup (the test creates/deploys them). */
|
|
267
|
+
additionallyFundedAccounts: InitialAccountData[];
|
|
238
268
|
/** The wallet to be used. */
|
|
239
269
|
wallet: TestWallet;
|
|
240
270
|
/** The wallets to be used. */
|
|
@@ -245,100 +275,54 @@ export type EndToEndContext = {
|
|
|
245
275
|
cheatCodes: CheatCodes;
|
|
246
276
|
/** The cheat codes for L1 */
|
|
247
277
|
ethCheatCodes: EthCheatCodes;
|
|
248
|
-
/**
|
|
249
|
-
|
|
250
|
-
/** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
|
|
251
|
-
dateProvider: TestDateProvider | undefined;
|
|
278
|
+
/** Allows tweaking current system time, used by the epoch cache only. */
|
|
279
|
+
dateProvider: TestDateProvider;
|
|
252
280
|
/** Telemetry client */
|
|
253
|
-
telemetryClient: TelemetryClient
|
|
281
|
+
telemetryClient: TelemetryClient;
|
|
254
282
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
255
283
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
256
|
-
/**
|
|
257
|
-
|
|
284
|
+
/** Delayer for sequencer L1 txs (only when enableDelayer is true). */
|
|
285
|
+
sequencerDelayer: Delayer | undefined;
|
|
286
|
+
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
287
|
+
proverDelayer: Delayer | undefined;
|
|
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;
|
|
258
292
|
/** ACVM config (only set if running locally). */
|
|
259
293
|
acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
|
|
260
294
|
/** BB config (only set if running locally). */
|
|
261
295
|
bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
|
|
262
296
|
/** Directory to cleanup on teardown. */
|
|
263
|
-
directoryToCleanup: string
|
|
297
|
+
directoryToCleanup: string;
|
|
264
298
|
/** Function to stop the started services. */
|
|
265
299
|
teardown: () => Promise<void>;
|
|
266
300
|
};
|
|
267
301
|
|
|
268
302
|
/**
|
|
269
|
-
*
|
|
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.
|
|
270
306
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
numberOfAccounts: number,
|
|
276
|
-
): Promise<EndToEndContext> {
|
|
277
|
-
const aztecNodeUrl = getAztecUrl();
|
|
278
|
-
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
279
|
-
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
280
|
-
await waitForNode(aztecNode, logger);
|
|
281
|
-
logger.verbose('JSON RPC client connected to Aztec Node');
|
|
282
|
-
logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
|
|
283
|
-
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
284
|
-
|
|
285
|
-
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
286
|
-
|
|
287
|
-
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
|
|
288
|
-
l1ContractAddresses,
|
|
289
|
-
l1Client,
|
|
290
|
-
rollupVersion,
|
|
291
|
-
};
|
|
292
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
293
|
-
const wallet = await TestWallet.create(aztecNode);
|
|
294
|
-
|
|
295
|
-
if (config.walletMinFeePadding !== undefined) {
|
|
296
|
-
wallet.setMinFeePadding(config.walletMinFeePadding);
|
|
307
|
+
function assertContractArtifactsVersion() {
|
|
308
|
+
const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
|
|
309
|
+
if (!expected) {
|
|
310
|
+
return;
|
|
297
311
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
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
|
+
);
|
|
307
325
|
}
|
|
308
|
-
|
|
309
|
-
const testAccounts = await Promise.all(
|
|
310
|
-
initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
|
|
311
|
-
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
312
|
-
return accountManager.address;
|
|
313
|
-
}),
|
|
314
|
-
);
|
|
315
|
-
|
|
316
|
-
return {
|
|
317
|
-
anvil: undefined,
|
|
318
|
-
aztecNode,
|
|
319
|
-
aztecNodeService: undefined,
|
|
320
|
-
aztecNodeAdmin: undefined,
|
|
321
|
-
sequencer: undefined,
|
|
322
|
-
proverNode: undefined,
|
|
323
|
-
deployL1ContractsValues,
|
|
324
|
-
config,
|
|
325
|
-
aztecNodeConfig: config,
|
|
326
|
-
initialFundedAccounts,
|
|
327
|
-
wallet,
|
|
328
|
-
accounts: testAccounts,
|
|
329
|
-
logger,
|
|
330
|
-
cheatCodes,
|
|
331
|
-
ethCheatCodes,
|
|
332
|
-
prefilledPublicData: undefined,
|
|
333
|
-
mockGossipSubNetwork: undefined,
|
|
334
|
-
watcher: undefined,
|
|
335
|
-
dateProvider: undefined,
|
|
336
|
-
telemetryClient: undefined,
|
|
337
|
-
acvmConfig: undefined,
|
|
338
|
-
bbConfig: undefined,
|
|
339
|
-
directoryToCleanup: undefined,
|
|
340
|
-
teardown,
|
|
341
|
-
};
|
|
342
326
|
}
|
|
343
327
|
|
|
344
328
|
/**
|
|
@@ -347,16 +331,43 @@ async function setupWithRemoteEnvironment(
|
|
|
347
331
|
* @param opts - Options to pass to the node initialization and to the setup script.
|
|
348
332
|
* @param pxeOpts - Options to pass to the PXE initialization.
|
|
349
333
|
*/
|
|
350
|
-
export
|
|
334
|
+
export function setup<TDeployExtraL1ContractsReturnType = unknown>(
|
|
351
335
|
numberOfAccounts = 1,
|
|
352
|
-
opts: SetupOptions = {},
|
|
336
|
+
opts: SetupOptions<TDeployExtraL1ContractsReturnType> = {},
|
|
353
337
|
pxeOpts: Partial<PXEConfig> = {},
|
|
354
338
|
chain: Chain = foundry,
|
|
355
|
-
): 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();
|
|
356
362
|
let anvil: Anvil | undefined;
|
|
357
363
|
try {
|
|
358
364
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
359
|
-
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');
|
|
360
371
|
|
|
361
372
|
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
362
373
|
// use initialValidators for the node config
|
|
@@ -366,11 +377,11 @@ export async function setup(
|
|
|
366
377
|
config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
|
|
367
378
|
// For tests we only want proving enabled if specifically requested
|
|
368
379
|
config.realProofs = !!opts.realProofs;
|
|
369
|
-
//
|
|
370
|
-
config.
|
|
380
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
381
|
+
config.enableDelayer = true;
|
|
371
382
|
config.listenAddress = '127.0.0.1';
|
|
372
383
|
|
|
373
|
-
|
|
384
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
374
385
|
|
|
375
386
|
// Create a temp directory for any services that need it and cleanup later
|
|
376
387
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
@@ -379,24 +390,25 @@ export async function setup(
|
|
|
379
390
|
config.dataDirectory = directoryToCleanup;
|
|
380
391
|
}
|
|
381
392
|
|
|
393
|
+
const dateProvider = new TestDateProvider();
|
|
394
|
+
|
|
382
395
|
if (!config.l1RpcUrls?.length) {
|
|
383
396
|
if (!isAnvilTestChain(chain.id)) {
|
|
384
397
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
385
398
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
port: opts.anvilPort,
|
|
396
|
-
});
|
|
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
|
+
);
|
|
397
408
|
anvil = res.anvil;
|
|
398
409
|
config.l1RpcUrls = [res.rpcUrl];
|
|
399
410
|
}
|
|
411
|
+
logger.trace('Started anvil and L1 RPC client');
|
|
400
412
|
|
|
401
413
|
// Enable logging metrics to a local file named after the test suite
|
|
402
414
|
if (isMetricsLoggingRequested()) {
|
|
@@ -404,8 +416,6 @@ export async function setup(
|
|
|
404
416
|
logger.info(`Logging metrics to ${filename}`);
|
|
405
417
|
setupMetricsLogger(filename);
|
|
406
418
|
}
|
|
407
|
-
|
|
408
|
-
const dateProvider = new TestDateProvider();
|
|
409
419
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
410
420
|
|
|
411
421
|
if (opts.stateLoad) {
|
|
@@ -415,6 +425,7 @@ export async function setup(
|
|
|
415
425
|
if (opts.l1StartTime) {
|
|
416
426
|
await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
|
|
417
427
|
}
|
|
428
|
+
logger.trace('Initialized L1 cheat codes and applied state/time overrides');
|
|
418
429
|
|
|
419
430
|
let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
|
|
420
431
|
let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
|
|
@@ -423,11 +434,11 @@ export async function setup(
|
|
|
423
434
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
424
435
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
425
436
|
} else if (
|
|
426
|
-
config.
|
|
427
|
-
config.
|
|
428
|
-
config.
|
|
437
|
+
config.sequencerPublisherPrivateKeys &&
|
|
438
|
+
config.sequencerPublisherPrivateKeys.length > 0 &&
|
|
439
|
+
config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
|
|
429
440
|
) {
|
|
430
|
-
publisherPrivKeyHex = config.
|
|
441
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
431
442
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
432
443
|
} else if (!MNEMONIC) {
|
|
433
444
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -436,23 +447,20 @@ export async function setup(
|
|
|
436
447
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
437
448
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
438
449
|
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
|
|
439
|
-
config.
|
|
450
|
+
config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
440
451
|
}
|
|
441
452
|
|
|
442
453
|
if (config.coinbase === undefined) {
|
|
443
454
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
444
455
|
}
|
|
456
|
+
logger.trace('Resolved L1 publisher account');
|
|
445
457
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
const initialFundedAccounts =
|
|
453
|
-
opts.initialFundedAccounts ??
|
|
454
|
-
(await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10)));
|
|
455
|
-
const addressesToFund = initialFundedAccounts.map(a => a.address);
|
|
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);
|
|
456
464
|
|
|
457
465
|
// Optionally fund the sponsored FPC
|
|
458
466
|
if (opts.fundSponsoredFPC) {
|
|
@@ -460,11 +468,29 @@ export async function setup(
|
|
|
460
468
|
addressesToFund.push(sponsoredFPCAddress);
|
|
461
469
|
}
|
|
462
470
|
|
|
463
|
-
|
|
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(
|
|
464
487
|
addressesToFund,
|
|
465
488
|
opts.initialAccountFeeJuice,
|
|
466
489
|
opts.genesisPublicData,
|
|
490
|
+
genesisTimestamp,
|
|
491
|
+
standardContractNullifiers,
|
|
467
492
|
);
|
|
493
|
+
logger.trace('Computed genesis values');
|
|
468
494
|
|
|
469
495
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
470
496
|
const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
|
|
@@ -474,18 +500,21 @@ export async function setup(
|
|
|
474
500
|
|
|
475
501
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
|
|
476
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
|
+
|
|
477
508
|
// Deploy Multicall3 if running locally
|
|
478
509
|
await deployMulticall3(l1Client, logger);
|
|
479
510
|
|
|
480
511
|
// Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
|
|
481
512
|
// This is necessary because deployMulticall3 sends multiple transactions and viem may cache a stale nonce
|
|
482
513
|
await l1Client.getTransactionCount({ address: l1Client.account.address });
|
|
514
|
+
logger.trace('Deployed Multicall3');
|
|
483
515
|
|
|
484
|
-
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await
|
|
485
|
-
config.l1RpcUrls[0],
|
|
486
|
-
publisherPrivKeyHex!,
|
|
487
|
-
chain.id,
|
|
488
|
-
{
|
|
516
|
+
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await testSpan('setup:env:l1-deploy', () =>
|
|
517
|
+
deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex!, chain.id, {
|
|
489
518
|
...getL1ContractsConfigEnvVars(),
|
|
490
519
|
...opts,
|
|
491
520
|
...opts.l1ContractsArgs,
|
|
@@ -495,76 +524,96 @@ export async function setup(
|
|
|
495
524
|
initialValidators: opts.initialValidators,
|
|
496
525
|
feeJuicePortalInitialBalance: fundingNeeded,
|
|
497
526
|
realVerifier: false,
|
|
498
|
-
},
|
|
527
|
+
}),
|
|
499
528
|
);
|
|
500
529
|
|
|
501
|
-
config
|
|
530
|
+
Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
|
|
502
531
|
config.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
503
532
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
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
|
+
}
|
|
508
549
|
}
|
|
509
550
|
|
|
510
|
-
|
|
511
|
-
|
|
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 });
|
|
512
564
|
}
|
|
513
565
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
517
|
-
deployL1ContractsValues.l1Client,
|
|
518
|
-
dateProvider,
|
|
519
|
-
);
|
|
520
|
-
if (!opts.disableAnvilTestWatcher) {
|
|
521
|
-
await watcher.start();
|
|
566
|
+
if (enableAutomine) {
|
|
567
|
+
await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
|
|
522
568
|
}
|
|
523
569
|
|
|
524
|
-
//
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
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
|
+
}
|
|
530
576
|
|
|
531
|
-
|
|
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');
|
|
532
594
|
|
|
533
|
-
const acvmConfig = await getACVMConfig(logger);
|
|
534
595
|
if (acvmConfig) {
|
|
535
596
|
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
536
597
|
config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
|
|
537
598
|
}
|
|
599
|
+
logger.trace('Resolved ACVM config');
|
|
538
600
|
|
|
539
|
-
const bbConfig = await getBBConfig(logger);
|
|
540
601
|
if (bbConfig) {
|
|
541
602
|
config.bbBinaryPath = bbConfig.bbBinaryPath;
|
|
542
603
|
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
543
604
|
}
|
|
605
|
+
logger.trace('Resolved Barretenberg config');
|
|
606
|
+
|
|
607
|
+
logger.verbose('Creating and synching an aztec node', config);
|
|
544
608
|
|
|
545
609
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
546
|
-
let p2pClientDeps: P2PClientDeps
|
|
610
|
+
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
547
611
|
|
|
548
612
|
if (opts.mockGossipSubNetwork) {
|
|
549
|
-
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
613
|
+
mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
|
|
550
614
|
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
551
615
|
}
|
|
552
616
|
|
|
553
|
-
// Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
|
|
554
|
-
// To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
|
|
555
|
-
// For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
|
|
556
|
-
// If no accounts need deployment, we await an empty block to confirm network progression.
|
|
557
|
-
const originalMinTxsPerBlock = config.minTxsPerBlock;
|
|
558
|
-
if (originalMinTxsPerBlock === undefined) {
|
|
559
|
-
throw new Error('minTxsPerBlock is undefined in e2e test setup');
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// Only set minTxsPerBlock=1 if we're going to deploy accounts and need reliable block inclusion
|
|
563
|
-
const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
|
|
564
|
-
// Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
|
|
565
|
-
const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
|
|
566
|
-
config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
|
|
567
|
-
|
|
568
617
|
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
569
618
|
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
570
619
|
|
|
@@ -574,50 +623,81 @@ export async function setup(
|
|
|
574
623
|
}
|
|
575
624
|
}
|
|
576
625
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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
|
+
),
|
|
645
|
+
),
|
|
581
646
|
);
|
|
582
647
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
648
|
+
logger.trace('Created and synced aztec node');
|
|
583
649
|
|
|
584
|
-
|
|
585
|
-
const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
|
|
586
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
let proverNode: ProverNode | undefined = undefined;
|
|
650
|
+
let proverNode: AztecNodeService | undefined = undefined;
|
|
590
651
|
if (opts.startProverNode) {
|
|
591
652
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
592
653
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
593
654
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
594
655
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
656
|
+
|
|
657
|
+
const p2pClientDeps: Partial<P2PClientDeps> = {
|
|
658
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
|
|
659
|
+
rpcTxProviders: [aztecNodeService],
|
|
599
660
|
};
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
661
|
+
|
|
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
|
+
),
|
|
673
|
+
));
|
|
674
|
+
logger.trace('Created prover node');
|
|
607
675
|
}
|
|
608
676
|
|
|
677
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
678
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
679
|
+
|
|
609
680
|
logger.verbose('Creating a pxe...');
|
|
610
681
|
const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
|
|
611
682
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
612
683
|
// For tests we only want proving enabled if specifically requested
|
|
613
684
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
614
|
-
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
|
+
);
|
|
615
693
|
|
|
616
694
|
if (opts.walletMinFeePadding !== undefined) {
|
|
617
695
|
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
618
696
|
}
|
|
697
|
+
logger.trace('Created PXE and test wallet');
|
|
619
698
|
|
|
620
699
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
|
|
700
|
+
logger.trace('Created cheat codes');
|
|
621
701
|
|
|
622
702
|
if (
|
|
623
703
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -631,64 +711,48 @@ export async function setup(
|
|
|
631
711
|
);
|
|
632
712
|
await cheatCodes.rollup.setupEpoch();
|
|
633
713
|
await cheatCodes.rollup.debugRollup();
|
|
714
|
+
logger.trace('Advanced chain to set up validator committee');
|
|
634
715
|
}
|
|
635
716
|
|
|
636
717
|
let accounts: AztecAddress[] = [];
|
|
637
718
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
);
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
accounts = accountManagers.map(accountManager => accountManager.address);
|
|
645
|
-
} else if (needsEmptyBlock) {
|
|
646
|
-
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
647
|
-
while ((await aztecNodeService.getBlockNumber()) === 0) {
|
|
648
|
-
await sleep(2000);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
// If skipAccountDeployment is true, we don't deploy or wait - tests will handle account deployment later
|
|
652
|
-
|
|
653
|
-
// Now we restore the original minTxsPerBlock setting if we changed it.
|
|
654
|
-
if (sequencerClient && config.minTxsPerBlock !== originalMinTxsPerBlock) {
|
|
655
|
-
sequencerClient.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
|
|
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);
|
|
656
725
|
}
|
|
726
|
+
logger.trace('Created funded test accounts');
|
|
657
727
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
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);
|
|
663
734
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
await tryStop(aztecNodeService, logger);
|
|
668
|
-
await tryStop(proverNode, logger);
|
|
735
|
+
if (acvmConfig?.cleanup) {
|
|
736
|
+
await acvmConfig.cleanup();
|
|
737
|
+
}
|
|
669
738
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
739
|
+
if (bbConfig?.cleanup) {
|
|
740
|
+
await bbConfig.cleanup();
|
|
741
|
+
}
|
|
673
742
|
|
|
674
|
-
|
|
675
|
-
await bbConfig.cleanup();
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
await tryStop(watcher, logger);
|
|
679
|
-
await tryStop(anvil, logger);
|
|
743
|
+
await tryStop(anvil, logger);
|
|
680
744
|
|
|
681
|
-
|
|
682
|
-
} catch (err) {
|
|
683
|
-
logger.error(`Error during e2e test teardown`, err);
|
|
684
|
-
} finally {
|
|
685
|
-
try {
|
|
686
|
-
await telemetryClient?.stop();
|
|
745
|
+
await tryRmDir(directoryToCleanup, logger);
|
|
687
746
|
} catch (err) {
|
|
688
|
-
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
|
+
}
|
|
689
754
|
}
|
|
690
|
-
}
|
|
691
|
-
};
|
|
755
|
+
});
|
|
692
756
|
|
|
693
757
|
return {
|
|
694
758
|
anvil,
|
|
@@ -701,17 +765,19 @@ export async function setup(
|
|
|
701
765
|
aztecNodeConfig: config,
|
|
702
766
|
dateProvider,
|
|
703
767
|
deployL1ContractsValues,
|
|
704
|
-
|
|
768
|
+
additionallyFundedAccounts,
|
|
705
769
|
logger,
|
|
706
770
|
mockGossipSubNetwork,
|
|
707
|
-
|
|
771
|
+
genesis,
|
|
772
|
+
extraL1DeployResult,
|
|
708
773
|
proverNode,
|
|
774
|
+
sequencerDelayer,
|
|
775
|
+
proverDelayer,
|
|
709
776
|
sequencer: sequencerClient,
|
|
710
777
|
teardown,
|
|
711
778
|
telemetryClient,
|
|
712
779
|
wallet,
|
|
713
780
|
accounts,
|
|
714
|
-
watcher,
|
|
715
781
|
acvmConfig,
|
|
716
782
|
bbConfig,
|
|
717
783
|
directoryToCleanup,
|
|
@@ -778,104 +844,71 @@ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
|
|
|
778
844
|
await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
|
|
779
845
|
}
|
|
780
846
|
|
|
781
|
-
export async function waitForProvenChain(
|
|
847
|
+
export async function waitForProvenChain(
|
|
848
|
+
node: AztecNode,
|
|
849
|
+
targetBlock?: BlockNumber,
|
|
850
|
+
timeoutSec = 60,
|
|
851
|
+
intervalSec = 0.25,
|
|
852
|
+
) {
|
|
782
853
|
targetBlock ??= await node.getBlockNumber();
|
|
783
854
|
|
|
784
855
|
await retryUntil(
|
|
785
|
-
async () => (await node.
|
|
856
|
+
async () => (await node.getBlockNumber('proven')) >= targetBlock,
|
|
786
857
|
'proven chain status',
|
|
787
858
|
timeoutSec,
|
|
788
859
|
intervalSec,
|
|
789
860
|
);
|
|
790
861
|
}
|
|
791
862
|
|
|
863
|
+
/**
|
|
864
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
865
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
866
|
+
*/
|
|
792
867
|
export function createAndSyncProverNode(
|
|
793
868
|
proverNodePrivateKey: `0x${string}`,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
const proverConfig: ProverNodeConfig = {
|
|
817
|
-
...aztecNodeConfig,
|
|
818
|
-
txCollectionNodeRpcUrls: [],
|
|
819
|
-
realProofs: false,
|
|
820
|
-
proverAgentCount: 2,
|
|
821
|
-
publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
822
|
-
proverNodeMaxPendingJobs: 10,
|
|
823
|
-
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
824
|
-
proverNodePollingIntervalMs: 200,
|
|
825
|
-
txGatheringIntervalMs: 1000,
|
|
826
|
-
txGatheringBatchSize: 10,
|
|
827
|
-
txGatheringMaxParallelRequestsPerNode: 10,
|
|
828
|
-
txGatheringTimeoutMs: 24_000,
|
|
829
|
-
proverNodeFailedEpochStore: undefined,
|
|
830
|
-
proverId: EthAddress.fromNumber(1),
|
|
831
|
-
proverNodeEpochProvingDelayMs: undefined,
|
|
832
|
-
...proverNodeConfig,
|
|
833
|
-
};
|
|
834
|
-
|
|
835
|
-
const l1TxUtils = createDelayedL1TxUtils(
|
|
836
|
-
aztecNodeConfig,
|
|
837
|
-
proverNodePrivateKey,
|
|
838
|
-
'prover-node',
|
|
839
|
-
proverNodeDeps.dateProvider,
|
|
869
|
+
baseConfig: AztecNodeConfig,
|
|
870
|
+
configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
|
|
871
|
+
deps: {
|
|
872
|
+
telemetry?: TelemetryClient;
|
|
873
|
+
dateProvider: DateProvider;
|
|
874
|
+
p2pClientDeps?: P2PClientDeps;
|
|
875
|
+
},
|
|
876
|
+
options: { genesis?: GenesisData; dontStart?: boolean },
|
|
877
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
878
|
+
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
879
|
+
const proverNode = await createAztecNodeService(
|
|
880
|
+
{
|
|
881
|
+
...baseConfig,
|
|
882
|
+
...configOverrides,
|
|
883
|
+
p2pPort: 0,
|
|
884
|
+
enableProverNode: true,
|
|
885
|
+
disableValidator: true,
|
|
886
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
887
|
+
},
|
|
888
|
+
deps,
|
|
889
|
+
{ genesis: options.genesis, dontStartProverNode: options.dontStart },
|
|
840
890
|
);
|
|
841
891
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
{ ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
|
|
845
|
-
{ prefilledPublicData },
|
|
846
|
-
);
|
|
847
|
-
getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
|
|
848
|
-
if (!proverNodeConfig.dontStart) {
|
|
849
|
-
await proverNode.start();
|
|
892
|
+
if (!proverNode.getProverNode()) {
|
|
893
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
850
894
|
}
|
|
851
|
-
return proverNode;
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
function createDelayedL1TxUtils(
|
|
856
|
-
aztecNodeConfig: AztecNodeConfig,
|
|
857
|
-
privateKey: `0x${string}`,
|
|
858
|
-
logName: string,
|
|
859
|
-
dateProvider?: DateProvider,
|
|
860
|
-
) {
|
|
861
|
-
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
862
895
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
return l1TxUtils;
|
|
896
|
+
getLogger().info(`Created and synced prover node`);
|
|
897
|
+
return { proverNode };
|
|
898
|
+
});
|
|
867
899
|
}
|
|
868
900
|
|
|
869
901
|
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
870
902
|
export function getBalancesFn(
|
|
871
903
|
symbol: string,
|
|
872
904
|
method: ContractMethod,
|
|
873
|
-
from: AztecAddress,
|
|
874
905
|
logger: any,
|
|
875
906
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
876
907
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
877
908
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
878
|
-
const b = await Promise.all(
|
|
909
|
+
const b = await Promise.all(
|
|
910
|
+
addresses.map(async address => (await method(address).simulate({ from: address })).result),
|
|
911
|
+
);
|
|
879
912
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
880
913
|
logger.verbose(debugString);
|
|
881
914
|
return b;
|
|
@@ -911,96 +944,56 @@ export async function expectMappingDelta<K, V extends number | bigint>(
|
|
|
911
944
|
}
|
|
912
945
|
|
|
913
946
|
/**
|
|
914
|
-
* Registers the contract class
|
|
915
|
-
*
|
|
947
|
+
* Registers the auth_registry contract class and publishes its standard instance if not already
|
|
948
|
+
* present, and registers the artifact with PXE. Publishing is required before exercising the public
|
|
949
|
+
* authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
|
|
950
|
+
* required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
|
|
951
|
+
* surface as generic "Assertion failed:" and tests that match on the real message fail).
|
|
916
952
|
*/
|
|
917
|
-
export async function
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
accountsAndAddresses
|
|
929
|
-
.filter(({ deployed }) => !deployed)
|
|
930
|
-
.map(({ address }) => wallet.getContractMetadata(address)),
|
|
931
|
-
)
|
|
932
|
-
).map(contractMetadata => contractMetadata.instance);
|
|
933
|
-
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
934
|
-
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
935
|
-
await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
|
|
936
|
-
}
|
|
937
|
-
const requests = instances.map(instance => publishInstance(wallet, instance!));
|
|
938
|
-
const batch = new BatchCall(wallet, requests);
|
|
939
|
-
await batch.send({ from: accountsToDeploy[0] });
|
|
953
|
+
export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
954
|
+
await testSpan('setup:auth-registry', async () => {
|
|
955
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
956
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
957
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
|
|
958
|
+
}
|
|
959
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
960
|
+
await publishInstance(wallet, instance).send({ from });
|
|
961
|
+
}
|
|
962
|
+
await wallet.registerContract(instance, AuthRegistryArtifact);
|
|
963
|
+
});
|
|
940
964
|
}
|
|
941
965
|
|
|
942
966
|
/**
|
|
943
|
-
*
|
|
944
|
-
*
|
|
967
|
+
* Registers the public_checks contract class and publishes its standard instance if not already
|
|
968
|
+
* present, and registers the artifact with PXE. Required for any contract that calls
|
|
969
|
+
* `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
|
|
970
|
+
* deployed PublicChecks contract via an enqueued public call).
|
|
945
971
|
*/
|
|
946
|
-
export
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
for (let i = 0; i < deployedAccounts.length; i++) {
|
|
957
|
-
const accountManager = await wallet.createSchnorrAccount(
|
|
958
|
-
deployedAccounts[i].secret,
|
|
959
|
-
deployedAccounts[i].salt,
|
|
960
|
-
deployedAccounts[i].signingKey,
|
|
961
|
-
);
|
|
962
|
-
const deployMethod = await accountManager.getDeployMethod();
|
|
963
|
-
await deployMethod.send({
|
|
964
|
-
from: AztecAddress.ZERO,
|
|
965
|
-
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
return { deployedAccounts };
|
|
970
|
-
};
|
|
972
|
+
export async function ensurePublicChecksPublished(wallet: Wallet, from: AztecAddress) {
|
|
973
|
+
const { instance, contractClass } = await getStandardPublicChecks();
|
|
974
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
975
|
+
await (await publishContractClass(wallet, PublicChecksArtifact)).send({ from });
|
|
976
|
+
}
|
|
977
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
978
|
+
await publishInstance(wallet, instance).send({ from });
|
|
979
|
+
}
|
|
980
|
+
await wallet.registerContract(instance, PublicChecksArtifact);
|
|
981
|
+
}
|
|
971
982
|
|
|
972
983
|
/**
|
|
973
|
-
* Registers the contract class
|
|
974
|
-
*
|
|
984
|
+
* Registers the handshake_registry contract class and publishes its standard instance if not
|
|
985
|
+
* already present, and registers the artifact with PXE. Required for constrained-delivery flows
|
|
986
|
+
* that call into the HandshakeRegistry at its well-known address.
|
|
975
987
|
*/
|
|
976
|
-
export async function
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
) {
|
|
982
|
-
|
|
983
|
-
metadata => metadata.instance,
|
|
984
|
-
);
|
|
985
|
-
|
|
986
|
-
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
987
|
-
const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
|
|
988
|
-
|
|
989
|
-
const calls: ContractFunctionInteraction[] = await Promise.all([
|
|
990
|
-
...(!alreadyRegistered ? [publishContractClass(wallet, SchnorrAccountContractArtifact)] : []),
|
|
991
|
-
...instances.map(instance => publishInstance(wallet, instance!)),
|
|
992
|
-
]);
|
|
993
|
-
|
|
994
|
-
const batch = new BatchCall(wallet, calls);
|
|
995
|
-
|
|
996
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
997
|
-
if (waitUntilProven) {
|
|
998
|
-
if (!node) {
|
|
999
|
-
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
1000
|
-
} else {
|
|
1001
|
-
await waitForProven(node, txReceipt);
|
|
1002
|
-
}
|
|
988
|
+
export async function ensureHandshakeRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
989
|
+
const { instance, contractClass } = await getStandardHandshakeRegistry();
|
|
990
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
991
|
+
await (await publishContractClass(wallet, HandshakeRegistryArtifact)).send({ from });
|
|
992
|
+
}
|
|
993
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
994
|
+
await publishInstance(wallet, instance).send({ from });
|
|
1003
995
|
}
|
|
996
|
+
await wallet.registerContract(instance, HandshakeRegistryArtifact);
|
|
1004
997
|
}
|
|
1005
998
|
|
|
1006
999
|
/**
|