@aztec/end-to-end 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0
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 +217 -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/automine/token/blacklist_token_contract_test.js +166 -0
- 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/automine/token/token_contract_test.js +119 -0
- 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 +17 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +40 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +19 -20
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +155 -159
- 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/client_flows/data_extractor.js +4 -1
- package/dest/bench/utils.d.ts +11 -10
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +126 -23
- 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/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +1 -1
- 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 +25 -29
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +147 -151
- 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 +84 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +87 -2
- package/dest/fixtures/get_acvm_config.js +1 -1
- 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/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- 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 +269 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +688 -0
- 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 +49 -38
- 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 +28 -7
- package/dest/fixtures/utils.d.ts +5 -638
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -647
- 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/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- 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 +33 -21
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/p2p/p2p_network.js +389 -0
- 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/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +22 -9
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +45 -40
- package/dest/shared/gas_portal_test_harness.d.ts +19 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +27 -15
- package/dest/shared/index.d.ts +3 -2
- 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 +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +19 -14
- 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 +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +86 -54
- 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 +15 -4
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +29 -17
- 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 +21 -10
- package/dest/single-node/fees/fees_test.d.ts +93 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/single-node/fees/fees_test.js +274 -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 +360 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +833 -0
- package/dest/spartan/setup_test_wallets.d.ts +15 -5
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +155 -50
- package/dest/spartan/tx_metrics.d.ts +111 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +507 -0
- package/dest/spartan/utils/bot.d.ts +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +19 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- 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 +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -221
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -782
- 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 +157 -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 +54 -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/automine/token/blacklist_token_contract_test.ts +208 -0
- package/src/automine/token/token_contract_test.ts +146 -0
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +45 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +222 -251
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +2 -1
- package/src/bench/utils.ts +144 -25
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +1 -1
- 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 +172 -205
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +111 -3
- package/src/fixtures/get_acvm_config.ts +1 -1
- 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/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +987 -0
- package/src/fixtures/setup_p2p_test.ts +57 -57
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +46 -10
- package/src/fixtures/utils.ts +26 -966
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- 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 +95 -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/p2p/p2p_network.ts +542 -0
- package/src/p2p/reqresp/utils.ts +263 -0
- package/src/p2p/shared.ts +329 -0
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +51 -44
- package/src/shared/gas_portal_test_harness.ts +35 -17
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +22 -19
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +136 -115
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +36 -18
- package/src/simulators/token_simulator.ts +6 -30
- package/src/single-node/README.md +60 -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 +23 -15
- package/src/single-node/fees/fees_test.ts +368 -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 +1041 -0
- package/src/spartan/setup_test_wallets.ts +217 -36
- package/src/spartan/tx_metrics.ts +460 -0
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -983
- 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 +216 -0
- package/src/test-wallet/worker_wallet_schema.ts +14 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -54
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +0 -185
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -41
- 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 -108
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -45
- package/dest/e2e_epochs/epochs_test.d.ts +0 -93
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -337
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -85
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.js +0 -263
- 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 -58
- 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 -29
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -64
- 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 -139
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/p2p_network.js +0 -320
- 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 -184
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -35
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/dest/e2e_token_contract/token_contract_test.js +0 -126
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +0 -256
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -179
- package/src/e2e_deploy_contract/deploy_test.ts +0 -78
- package/src/e2e_epochs/epochs_test.ts +0 -438
- package/src/e2e_fees/fees_test.ts +0 -382
- package/src/e2e_l1_publisher/write_json.ts +0 -77
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -96
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -182
- package/src/e2e_p2p/p2p_network.ts +0 -476
- package/src/e2e_p2p/shared.ts +0 -285
- package/src/e2e_token_contract/token_contract_test.ts +0 -167
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
-
import { GSEContract, MultiAdderArtifact, RollupContract, createL1TxUtilsFromViemWallet, deployL1Contract, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
4
|
-
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
|
-
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
6
|
-
import { SecretValue } from '@aztec/foundation/config';
|
|
7
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
8
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
9
|
-
import { RollupAbi, SlasherAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
10
|
-
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
11
|
-
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
|
|
12
|
-
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
13
|
-
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
14
|
-
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
15
|
-
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
16
|
-
import getPort from 'get-port';
|
|
17
|
-
import { getAddress, getContract } from 'viem';
|
|
18
|
-
import { privateKeyToAccount } from 'viem/accounts';
|
|
19
|
-
import { ATTESTER_PRIVATE_KEYS_START_INDEX, createValidatorConfig, generatePrivateKeys } from '../fixtures/setup_p2p_test.js';
|
|
20
|
-
import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
21
|
-
import { getPrivateKeyFromIndex, getSponsoredFPCAddress } from '../fixtures/utils.js';
|
|
22
|
-
import { getEndToEndTestTelemetryClient } from '../fixtures/with_telemetry_utils.js';
|
|
23
|
-
// Use a fixed bootstrap node private key so that we can re-use the same snapshot and the nodes can find each other
|
|
24
|
-
const BOOTSTRAP_NODE_PRIVATE_KEY = '080212208f988fc0899e4a73a5aee4d271a5f20670603a756ad8d84f2c94263a6427c591';
|
|
25
|
-
const l1ContractsConfig = getL1ContractsConfigEnvVars();
|
|
26
|
-
export const WAIT_FOR_TX_TIMEOUT = l1ContractsConfig.aztecSlotDuration * 3;
|
|
27
|
-
export const SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES = {
|
|
28
|
-
aztecSlotDuration: 12,
|
|
29
|
-
ethereumSlotDuration: 4,
|
|
30
|
-
aztecProofSubmissionWindow: 640
|
|
31
|
-
};
|
|
32
|
-
export class P2PNetworkTest {
|
|
33
|
-
testName;
|
|
34
|
-
bootstrapNodeEnr;
|
|
35
|
-
bootNodePort;
|
|
36
|
-
numberOfValidators;
|
|
37
|
-
numberOfNodes;
|
|
38
|
-
metricsPort;
|
|
39
|
-
snapshotManager;
|
|
40
|
-
baseAccountPrivateKey;
|
|
41
|
-
baseAccount;
|
|
42
|
-
logger;
|
|
43
|
-
monitor;
|
|
44
|
-
ctx;
|
|
45
|
-
attesterPrivateKeys;
|
|
46
|
-
attesterPublicKeys;
|
|
47
|
-
peerIdPrivateKeys;
|
|
48
|
-
validators;
|
|
49
|
-
deployedAccounts;
|
|
50
|
-
prefilledPublicData;
|
|
51
|
-
// The re-execution test needs a wallet and a spam contract
|
|
52
|
-
wallet;
|
|
53
|
-
defaultAccountAddress;
|
|
54
|
-
spamContract;
|
|
55
|
-
bootstrapNode;
|
|
56
|
-
constructor(testName, bootstrapNodeEnr, bootNodePort, numberOfValidators, initialValidatorConfig, numberOfNodes = 0, // If set enable metrics collection
|
|
57
|
-
metricsPort, startProverNode, mockZkPassportVerifier){
|
|
58
|
-
this.testName = testName;
|
|
59
|
-
this.bootstrapNodeEnr = bootstrapNodeEnr;
|
|
60
|
-
this.bootNodePort = bootNodePort;
|
|
61
|
-
this.numberOfValidators = numberOfValidators;
|
|
62
|
-
this.numberOfNodes = numberOfNodes;
|
|
63
|
-
this.metricsPort = metricsPort;
|
|
64
|
-
this.attesterPrivateKeys = [];
|
|
65
|
-
this.attesterPublicKeys = [];
|
|
66
|
-
this.peerIdPrivateKeys = [];
|
|
67
|
-
this.validators = [];
|
|
68
|
-
this.deployedAccounts = [];
|
|
69
|
-
this.prefilledPublicData = [];
|
|
70
|
-
this.logger = createLogger(`e2e:e2e_p2p:${testName}`);
|
|
71
|
-
// Set up the base account and node private keys for the initial network deployment
|
|
72
|
-
this.baseAccountPrivateKey = `0x${getPrivateKeyFromIndex(1).toString('hex')}`;
|
|
73
|
-
this.baseAccount = privateKeyToAccount(this.baseAccountPrivateKey);
|
|
74
|
-
this.attesterPrivateKeys = generatePrivateKeys(ATTESTER_PRIVATE_KEYS_START_INDEX + numberOfNodes, numberOfValidators);
|
|
75
|
-
this.attesterPublicKeys = this.attesterPrivateKeys.map((privateKey)=>privateKeyToAccount(privateKey).address);
|
|
76
|
-
const zkPassportParams = ZkPassportProofParams.random();
|
|
77
|
-
this.snapshotManager = createSnapshotManager(`e2e_p2p_network/${testName}`, process.env.E2E_DATA_PATH, {
|
|
78
|
-
...initialValidatorConfig,
|
|
79
|
-
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
|
|
80
|
-
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
81
|
-
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
|
|
82
|
-
aztecProofSubmissionEpochs: initialValidatorConfig.aztecProofSubmissionEpochs ?? l1ContractsConfig.aztecProofSubmissionEpochs,
|
|
83
|
-
slashingRoundSizeInEpochs: initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
|
|
84
|
-
slasherFlavor: initialValidatorConfig.slasherFlavor ?? 'tally',
|
|
85
|
-
aztecTargetCommitteeSize: numberOfValidators,
|
|
86
|
-
salt: 420,
|
|
87
|
-
metricsPort: metricsPort,
|
|
88
|
-
numberOfInitialFundedAccounts: 2,
|
|
89
|
-
startProverNode
|
|
90
|
-
}, {
|
|
91
|
-
...initialValidatorConfig,
|
|
92
|
-
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
93
|
-
slashingRoundSizeInEpochs: initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
|
|
94
|
-
slasherFlavor: initialValidatorConfig.slasherFlavor ?? 'tally',
|
|
95
|
-
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
|
|
96
|
-
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
|
|
97
|
-
aztecProofSubmissionEpochs: initialValidatorConfig.aztecProofSubmissionEpochs ?? l1ContractsConfig.aztecProofSubmissionEpochs,
|
|
98
|
-
aztecTargetCommitteeSize: numberOfValidators,
|
|
99
|
-
initialValidators: [],
|
|
100
|
-
zkPassportArgs: {
|
|
101
|
-
mockZkPassportVerifier,
|
|
102
|
-
zkPassportDomain: zkPassportParams.domain,
|
|
103
|
-
zkPassportScope: zkPassportParams.scope
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
static async create({ testName, numberOfNodes, numberOfValidators, basePort, metricsPort, initialConfig, startProverNode, mockZkPassportVerifier }) {
|
|
108
|
-
const port = basePort || await getPort();
|
|
109
|
-
const bootstrapNodeENR = await getBootstrapNodeEnr(BOOTSTRAP_NODE_PRIVATE_KEY, port);
|
|
110
|
-
const bootstrapNodeEnr = bootstrapNodeENR.encodeTxt();
|
|
111
|
-
const initialValidatorConfig = await createValidatorConfig(initialConfig ?? {}, bootstrapNodeEnr);
|
|
112
|
-
return new P2PNetworkTest(testName, bootstrapNodeEnr, port, numberOfValidators, initialValidatorConfig, numberOfNodes, metricsPort, startProverNode, mockZkPassportVerifier);
|
|
113
|
-
}
|
|
114
|
-
get fundedAccount() {
|
|
115
|
-
if (!this.deployedAccounts[0]) {
|
|
116
|
-
throw new Error('Call snapshot t.setupAccount to create a funded account.');
|
|
117
|
-
}
|
|
118
|
-
return this.deployedAccounts[0];
|
|
119
|
-
}
|
|
120
|
-
async addBootstrapNode() {
|
|
121
|
-
await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig })=>{
|
|
122
|
-
const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
|
|
123
|
-
this.bootstrapNode = await createBootstrapNodeFromPrivateKey(BOOTSTRAP_NODE_PRIVATE_KEY, this.bootNodePort, telemetry, aztecNodeConfig);
|
|
124
|
-
// Overwrite enr with updated info
|
|
125
|
-
this.bootstrapNodeEnr = this.bootstrapNode.getENR().encodeTxt();
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
getValidators() {
|
|
129
|
-
const validators = [];
|
|
130
|
-
for(let i = 0; i < this.numberOfValidators; i++){
|
|
131
|
-
const keyIndex = i;
|
|
132
|
-
const attester = privateKeyToAccount(this.attesterPrivateKeys[keyIndex]);
|
|
133
|
-
validators.push({
|
|
134
|
-
attester: EthAddress.fromString(attester.address),
|
|
135
|
-
withdrawer: EthAddress.fromString(attester.address),
|
|
136
|
-
bn254SecretKey: new SecretValue(Fr.random().toBigInt())
|
|
137
|
-
});
|
|
138
|
-
this.logger.info(`Adding attester ${attester.address} as validator`);
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
validators
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
async applyBaseSnapshots() {
|
|
145
|
-
await this.addBootstrapNode();
|
|
146
|
-
await this.snapshotManager.snapshot('add-validators', async ({ deployL1ContractsValues, cheatCodes })=>{
|
|
147
|
-
const rollup = getContract({
|
|
148
|
-
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
149
|
-
abi: RollupAbi,
|
|
150
|
-
client: deployL1ContractsValues.l1Client
|
|
151
|
-
});
|
|
152
|
-
this.logger.info(`Adding ${this.numberOfValidators} validators`);
|
|
153
|
-
const stakingAsset = getContract({
|
|
154
|
-
address: deployL1ContractsValues.l1ContractAddresses.stakingAssetAddress.toString(),
|
|
155
|
-
abi: TestERC20Abi,
|
|
156
|
-
client: deployL1ContractsValues.l1Client
|
|
157
|
-
});
|
|
158
|
-
const { address: multiAdderAddress } = await deployL1Contract(deployL1ContractsValues.l1Client, MultiAdderArtifact.contractAbi, MultiAdderArtifact.contractBytecode, [
|
|
159
|
-
rollup.address,
|
|
160
|
-
deployL1ContractsValues.l1Client.account.address
|
|
161
|
-
]);
|
|
162
|
-
const multiAdder = getContract({
|
|
163
|
-
address: multiAdderAddress.toString(),
|
|
164
|
-
abi: MultiAdderArtifact.contractAbi,
|
|
165
|
-
client: deployL1ContractsValues.l1Client
|
|
166
|
-
});
|
|
167
|
-
const stakeNeeded = await rollup.read.getActivationThreshold() * BigInt(this.numberOfValidators);
|
|
168
|
-
await Promise.all([
|
|
169
|
-
await stakingAsset.write.mint([
|
|
170
|
-
multiAdder.address,
|
|
171
|
-
stakeNeeded
|
|
172
|
-
], {})
|
|
173
|
-
].map((txHash)=>deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
174
|
-
hash: txHash
|
|
175
|
-
})));
|
|
176
|
-
const { validators } = this.getValidators();
|
|
177
|
-
this.validators = validators;
|
|
178
|
-
const gseAddress = deployL1ContractsValues.l1ContractAddresses.gseAddress;
|
|
179
|
-
if (!gseAddress) {
|
|
180
|
-
throw new Error('GSE contract not deployed');
|
|
181
|
-
}
|
|
182
|
-
const gseContract = new GSEContract(deployL1ContractsValues.l1Client, gseAddress.toString());
|
|
183
|
-
const makeValidatorTuples = async (validator)=>{
|
|
184
|
-
const registrationTuple = await gseContract.makeRegistrationTuple(validator.bn254SecretKey.getValue());
|
|
185
|
-
return {
|
|
186
|
-
attester: validator.attester.toString(),
|
|
187
|
-
withdrawer: validator.withdrawer.toString(),
|
|
188
|
-
...registrationTuple
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
const validatorTuples = await Promise.all(validators.map(makeValidatorTuples));
|
|
192
|
-
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
193
|
-
hash: await multiAdder.write.addValidators([
|
|
194
|
-
validatorTuples
|
|
195
|
-
])
|
|
196
|
-
});
|
|
197
|
-
await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + await rollup.read.getLagInEpochsForValidatorSet() + 1n));
|
|
198
|
-
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
199
|
-
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
async setupAccount() {
|
|
203
|
-
await this.snapshotManager.snapshot('setup-account', deployAccounts(1, this.logger), ({ deployedAccounts }, { wallet })=>{
|
|
204
|
-
this.deployedAccounts = deployedAccounts;
|
|
205
|
-
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
206
|
-
this.wallet = wallet;
|
|
207
|
-
return Promise.resolve();
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
async deploySpamContract() {
|
|
211
|
-
await this.snapshotManager.snapshot('add-spam-contract', async ()=>{
|
|
212
|
-
if (!this.wallet) {
|
|
213
|
-
throw new Error('Call snapshot t.setupAccount before deploying account contract');
|
|
214
|
-
}
|
|
215
|
-
const spamContract = await SpamContract.deploy(this.wallet).send({
|
|
216
|
-
from: this.defaultAccountAddress
|
|
217
|
-
}).deployed();
|
|
218
|
-
return {
|
|
219
|
-
contractAddress: spamContract.address
|
|
220
|
-
};
|
|
221
|
-
}, ({ contractAddress })=>{
|
|
222
|
-
if (!this.wallet) {
|
|
223
|
-
throw new Error('Call snapshot t.setupAccount before deploying account contract');
|
|
224
|
-
}
|
|
225
|
-
this.spamContract = SpamContract.at(contractAddress, this.wallet);
|
|
226
|
-
return Promise.resolve();
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
async removeInitialNode() {
|
|
230
|
-
await this.snapshotManager.snapshot('remove-initial-validator', async ({ deployL1ContractsValues, aztecNode, dateProvider })=>{
|
|
231
|
-
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
232
|
-
const { receipt } = await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
233
|
-
const block = await deployL1ContractsValues.l1Client.getBlock({
|
|
234
|
-
blockNumber: receipt.blockNumber
|
|
235
|
-
});
|
|
236
|
-
dateProvider.setTime(Number(block.timestamp) * 1000);
|
|
237
|
-
await aztecNode.stop();
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
async sendDummyTx() {
|
|
241
|
-
return await this._sendDummyTx(this.ctx.deployL1ContractsValues.l1Client);
|
|
242
|
-
}
|
|
243
|
-
async _sendDummyTx(l1Client) {
|
|
244
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client);
|
|
245
|
-
return await l1TxUtils.sendAndMonitorTransaction({
|
|
246
|
-
to: l1Client.account.address,
|
|
247
|
-
value: 1n
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
async setup() {
|
|
251
|
-
this.ctx = await this.snapshotManager.setup();
|
|
252
|
-
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
253
|
-
const initialFundedAccounts = [
|
|
254
|
-
...this.ctx.initialFundedAccounts.map((a)=>a.address),
|
|
255
|
-
sponsoredFPCAddress
|
|
256
|
-
];
|
|
257
|
-
const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
258
|
-
this.prefilledPublicData = prefilledPublicData;
|
|
259
|
-
const rollupContract = RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues);
|
|
260
|
-
this.monitor = new ChainMonitor(rollupContract, this.ctx.dateProvider).start();
|
|
261
|
-
this.monitor.on('l1-block', ({ timestamp })=>this.ctx.dateProvider.setTime(Number(timestamp) * 1000));
|
|
262
|
-
}
|
|
263
|
-
async stopNodes(nodes) {
|
|
264
|
-
this.logger.info('Stopping nodes');
|
|
265
|
-
if (!nodes || !nodes.length) {
|
|
266
|
-
this.logger.info('No nodes to stop');
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
await Promise.all(nodes.map((node)=>node.stop()));
|
|
270
|
-
this.logger.info('Nodes stopped');
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Wait for P2P mesh to be fully formed across all nodes.
|
|
274
|
-
* This ensures that all nodes are connected to each other before proceeding,
|
|
275
|
-
* preventing race conditions where validators propose blocks before the network is ready.
|
|
276
|
-
*
|
|
277
|
-
* @param nodes - Array of nodes to check for P2P connectivity
|
|
278
|
-
* @param expectedNodeCount - Expected number of nodes in the network (defaults to nodes.length)
|
|
279
|
-
* @param timeoutSeconds - Maximum time to wait for connections (default: 30 seconds)
|
|
280
|
-
* @param checkIntervalSeconds - How often to check connectivity (default: 0.1 seconds)
|
|
281
|
-
*/ async waitForP2PMeshConnectivity(nodes, expectedNodeCount, timeoutSeconds = 30, checkIntervalSeconds = 0.1) {
|
|
282
|
-
const nodeCount = expectedNodeCount ?? nodes.length;
|
|
283
|
-
const minPeerCount = nodeCount - 1;
|
|
284
|
-
this.logger.warn(`Waiting for all ${nodeCount} nodes to connect to P2P mesh (at least ${minPeerCount} peers each)...`);
|
|
285
|
-
await Promise.all(nodes.map(async (node, index)=>{
|
|
286
|
-
const p2p = node.getP2P();
|
|
287
|
-
await retryUntil(async ()=>{
|
|
288
|
-
const peers = await p2p.getPeers();
|
|
289
|
-
// Each node should be connected to at least N-1 other nodes
|
|
290
|
-
return peers.length >= minPeerCount ? true : undefined;
|
|
291
|
-
}, `Node ${index} to connect to at least ${minPeerCount} peers`, timeoutSeconds, checkIntervalSeconds);
|
|
292
|
-
}));
|
|
293
|
-
this.logger.warn('All nodes connected to P2P mesh');
|
|
294
|
-
}
|
|
295
|
-
async teardown() {
|
|
296
|
-
await this.monitor.stop();
|
|
297
|
-
await tryStop(this.bootstrapNode, this.logger);
|
|
298
|
-
await this.snapshotManager.teardown();
|
|
299
|
-
}
|
|
300
|
-
async getContracts() {
|
|
301
|
-
if (!this.ctx.deployL1ContractsValues) {
|
|
302
|
-
throw new Error('DeployL1ContractsValues not set');
|
|
303
|
-
}
|
|
304
|
-
const rollup = new RollupContract(this.ctx.deployL1ContractsValues.l1Client, this.ctx.deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
305
|
-
const slasherContract = getContract({
|
|
306
|
-
address: getAddress(await rollup.getSlasherAddress()),
|
|
307
|
-
abi: SlasherAbi,
|
|
308
|
-
client: this.ctx.deployL1ContractsValues.l1Client
|
|
309
|
-
});
|
|
310
|
-
// Get the actual slashing proposer from rollup (which handles both empire and tally)
|
|
311
|
-
const slashingProposer = await rollup.getSlashingProposer();
|
|
312
|
-
const slashFactory = new SlashFactoryContract(this.ctx.deployL1ContractsValues.l1Client, getAddress(this.ctx.deployL1ContractsValues.l1ContractAddresses.slashFactoryAddress.toString()));
|
|
313
|
-
return {
|
|
314
|
-
rollup,
|
|
315
|
-
slasherContract,
|
|
316
|
-
slashingProposer,
|
|
317
|
-
slashFactory
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
}
|
package/dest/e2e_p2p/shared.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
-
import { type SentTx } from '@aztec/aztec.js/contracts';
|
|
5
|
-
import type { Logger } from '@aztec/aztec.js/log';
|
|
6
|
-
import { Tx } from '@aztec/aztec.js/tx';
|
|
7
|
-
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
8
|
-
import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
|
|
9
|
-
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
10
|
-
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
11
|
-
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
12
|
-
export declare const submitComplexTxsTo: (logger: Logger, from: AztecAddress, spamContract: SpamContract, numTxs: number, opts?: {
|
|
13
|
-
callPublic?: boolean | undefined;
|
|
14
|
-
}) => Promise<SentTx[]>;
|
|
15
|
-
export declare const submitTransactions: (logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData) => Promise<SentTx[]>;
|
|
16
|
-
export declare function prepareTransactions(logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData): Promise<Tx[]>;
|
|
17
|
-
export declare function awaitProposalExecution(slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract, timeoutSeconds: number, logger: Logger): Promise<bigint>;
|
|
18
|
-
export declare function awaitCommitteeExists({ rollup, logger }: {
|
|
19
|
-
rollup: RollupContract;
|
|
20
|
-
logger: Logger;
|
|
21
|
-
}): Promise<readonly `0x${string}`[]>;
|
|
22
|
-
export declare function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, waitUntilOffenseCount, timeoutSeconds }: {
|
|
23
|
-
nodeAdmin: AztecNodeAdmin;
|
|
24
|
-
logger: Logger;
|
|
25
|
-
slashingRoundSize: number;
|
|
26
|
-
epochDuration: number;
|
|
27
|
-
waitUntilOffenseCount?: number;
|
|
28
|
-
timeoutSeconds?: number;
|
|
29
|
-
}): Promise<import("@aztec/slasher").Offense[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Await the committee to be slashed out of the validator set.
|
|
32
|
-
* Currently assumes that the committee is the same size as the validator set.
|
|
33
|
-
*/
|
|
34
|
-
export declare function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, aztecEpochDuration, logger, offenseEpoch }: {
|
|
35
|
-
rollup: RollupContract;
|
|
36
|
-
cheatCodes: RollupCheatCodes;
|
|
37
|
-
committee: readonly `0x${string}`[];
|
|
38
|
-
slashFactory: SlashFactoryContract;
|
|
39
|
-
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
40
|
-
slashingRoundSize: number;
|
|
41
|
-
aztecSlotDuration: number;
|
|
42
|
-
aztecEpochDuration: number;
|
|
43
|
-
logger: Logger;
|
|
44
|
-
offenseEpoch: number;
|
|
45
|
-
}): Promise<void>;
|
|
46
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZTJlX3AycC9zaGFyZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNsRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQzFELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQThDLE1BQU0sMkJBQTJCLENBQUM7QUFFcEcsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDbEQsT0FBTyxFQUFFLEVBQUUsRUFBWSxNQUFNLG9CQUFvQixDQUFDO0FBQ2xELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sc0JBQXNCLEN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MAAM,EAAE,EAAE,CAAC,CAYpC;AAED,wBAAsB,oBAAoB,CAAC,EACzC,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,cAAoB,EACrB,EAAE;IACD,SAAS,EAAE,cAAc,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,+CAkBA;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,EACN,YAAY,EACb,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,SAAS,EAAE,SAAS,KAAK,MAAM,EAAE,EAAE,CAAC;IACpC,YAAY,EAAE,oBAAoB,CAAC;IACnC,gBAAgB,EAAE,8BAA8B,GAAG,6BAA6B,GAAG,SAAS,CAAC;IAC7F,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,iBA6EA"}
|
package/dest/e2e_p2p/shared.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
2
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
-
import { TxStatus } from '@aztec/aztec.js/tx';
|
|
4
|
-
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
5
|
-
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
6
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
7
|
-
import { pluralize } from '@aztec/foundation/string';
|
|
8
|
-
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
9
|
-
import { getPXEConfig, getPXEConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
10
|
-
import { getRoundForOffense } from '@aztec/slasher';
|
|
11
|
-
import { TestWallet, proveInteraction } from '@aztec/test-wallet/server';
|
|
12
|
-
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
13
|
-
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
14
|
-
export const submitComplexTxsTo = async (logger, from, spamContract, numTxs, opts = {})=>{
|
|
15
|
-
const txs = [];
|
|
16
|
-
const seed = 1234n;
|
|
17
|
-
const spamCount = 15;
|
|
18
|
-
for(let i = 0; i < numTxs; i++){
|
|
19
|
-
const tx = spamContract.methods.spam(seed + BigInt(i * spamCount), spamCount, !!opts.callPublic).send({
|
|
20
|
-
from
|
|
21
|
-
});
|
|
22
|
-
const txHash = await tx.getTxHash();
|
|
23
|
-
logger.info(`Tx sent with hash ${txHash.toString()}`);
|
|
24
|
-
const receipt = await tx.getReceipt();
|
|
25
|
-
expect(receipt).toEqual(expect.objectContaining({
|
|
26
|
-
status: TxStatus.PENDING,
|
|
27
|
-
error: ''
|
|
28
|
-
}));
|
|
29
|
-
logger.info(`Receipt received for ${txHash.toString()}`);
|
|
30
|
-
txs.push(tx);
|
|
31
|
-
}
|
|
32
|
-
return txs;
|
|
33
|
-
};
|
|
34
|
-
// creates a wallet and submit a given number of transactions through it.
|
|
35
|
-
export const submitTransactions = async (logger, node, numTxs, fundedAccount)=>{
|
|
36
|
-
const rpcConfig = getRpcConfig();
|
|
37
|
-
rpcConfig.proverEnabled = false;
|
|
38
|
-
const wallet = await TestWallet.create(node, {
|
|
39
|
-
...getPXEConfig(),
|
|
40
|
-
proverEnabled: false
|
|
41
|
-
}, {
|
|
42
|
-
useLogSuffix: true
|
|
43
|
-
});
|
|
44
|
-
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
45
|
-
return submitTxsTo(wallet, fundedAccountManager.address, numTxs, logger);
|
|
46
|
-
};
|
|
47
|
-
export async function prepareTransactions(logger, node, numTxs, fundedAccount) {
|
|
48
|
-
const rpcConfig = getRpcConfig();
|
|
49
|
-
rpcConfig.proverEnabled = false;
|
|
50
|
-
const wallet = await TestWallet.create(node, {
|
|
51
|
-
...getPXEConfig(),
|
|
52
|
-
proverEnabled: false
|
|
53
|
-
}, {
|
|
54
|
-
useLogSuffix: true
|
|
55
|
-
});
|
|
56
|
-
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
57
|
-
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
58
|
-
salt: Fr.random()
|
|
59
|
-
});
|
|
60
|
-
await wallet.registerContract(testContractInstance, TestContractArtifact);
|
|
61
|
-
const contract = TestContract.at(testContractInstance.address, wallet);
|
|
62
|
-
return timesAsync(numTxs, async ()=>{
|
|
63
|
-
const tx = await proveInteraction(wallet, contract.methods.emit_nullifier(Fr.random()), {
|
|
64
|
-
from: fundedAccountManager.address
|
|
65
|
-
});
|
|
66
|
-
const txHash = tx.getTxHash();
|
|
67
|
-
logger.info(`Tx prepared with hash ${txHash}`);
|
|
68
|
-
return tx;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
export function awaitProposalExecution(slashingProposer, timeoutSeconds, logger) {
|
|
72
|
-
return new Promise((resolve, reject)=>{
|
|
73
|
-
const timeout = setTimeout(()=>{
|
|
74
|
-
logger.warn(`Timed out waiting for proposal execution`);
|
|
75
|
-
reject(new Error(`Timeout waiting for proposal execution after ${timeoutSeconds}s`));
|
|
76
|
-
}, timeoutSeconds * 1000);
|
|
77
|
-
if (slashingProposer.type === 'empire') {
|
|
78
|
-
const unwatch = slashingProposer.listenToPayloadSubmitted((args)=>{
|
|
79
|
-
logger.warn(`Proposal ${args.payload} from round ${args.round} executed`);
|
|
80
|
-
clearTimeout(timeout);
|
|
81
|
-
unwatch();
|
|
82
|
-
resolve(args.round);
|
|
83
|
-
});
|
|
84
|
-
} else if (slashingProposer.type === 'tally') {
|
|
85
|
-
const unwatch = slashingProposer.listenToRoundExecuted((args)=>{
|
|
86
|
-
logger.warn(`Slash from round ${args.round} executed`);
|
|
87
|
-
clearTimeout(timeout);
|
|
88
|
-
unwatch();
|
|
89
|
-
resolve(args.round);
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
clearTimeout(timeout);
|
|
93
|
-
reject(new Error(`Unknown slashing proposer type: ${slashingProposer.type}`));
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
export async function awaitCommitteeExists({ rollup, logger }) {
|
|
98
|
-
logger.info(`Waiting for committee to be set`);
|
|
99
|
-
let committee;
|
|
100
|
-
await retryUntil(async ()=>{
|
|
101
|
-
committee = await rollup.getCurrentEpochCommittee();
|
|
102
|
-
return committee && committee.length > 0;
|
|
103
|
-
}, 'non-empty committee', 60);
|
|
104
|
-
return committee;
|
|
105
|
-
}
|
|
106
|
-
export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, waitUntilOffenseCount, timeoutSeconds = 120 }) {
|
|
107
|
-
const targetOffenseCount = waitUntilOffenseCount ?? 1;
|
|
108
|
-
logger.warn(`Waiting for ${pluralize('offense', targetOffenseCount)} to be detected`);
|
|
109
|
-
const offenses = await retryUntil(async ()=>{
|
|
110
|
-
const offenses = await nodeAdmin.getSlashOffenses('all');
|
|
111
|
-
if (offenses.length >= targetOffenseCount) {
|
|
112
|
-
return offenses;
|
|
113
|
-
}
|
|
114
|
-
}, 'non-empty offenses', timeoutSeconds);
|
|
115
|
-
logger.info(`Hit ${offenses.length} offenses on rounds ${unique(offenses.map((o)=>getRoundForOffense(o, {
|
|
116
|
-
slashingRoundSize,
|
|
117
|
-
epochDuration
|
|
118
|
-
})))}`, {
|
|
119
|
-
offenses
|
|
120
|
-
});
|
|
121
|
-
return offenses;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Await the committee to be slashed out of the validator set.
|
|
125
|
-
* Currently assumes that the committee is the same size as the validator set.
|
|
126
|
-
*/ export async function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, aztecEpochDuration, logger, offenseEpoch }) {
|
|
127
|
-
if (!slashingProposer) {
|
|
128
|
-
throw new Error('No slashing proposer configured. Cannot test slashing.');
|
|
129
|
-
}
|
|
130
|
-
await cheatCodes.debugRollup();
|
|
131
|
-
if (slashingProposer.type === 'empire') {
|
|
132
|
-
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
133
|
-
const targetEpoch = BigInt(await cheatCodes.getEpoch()) + await rollup.getLagInEpochsForValidatorSet() + 1n;
|
|
134
|
-
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
135
|
-
await cheatCodes.advanceToEpoch(EpochNumber.fromBigInt(targetEpoch));
|
|
136
|
-
const slashPayloadEvents = await retryUntil(async ()=>{
|
|
137
|
-
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
138
|
-
return events.length > 0 ? events : undefined;
|
|
139
|
-
}, 'slash payload created', 120, 1);
|
|
140
|
-
expect(slashPayloadEvents.length).toBe(1);
|
|
141
|
-
// The uniqueness check is needed since a validator may be slashed more than once on the same round (eg because they let two epochs be pruned)
|
|
142
|
-
expect(unique(slashPayloadEvents[0].slashes.map((slash)=>slash.validator.toString()))).toHaveLength(committee.length);
|
|
143
|
-
} else {
|
|
144
|
-
// Use the slash offset to ensure we are in the right epoch for tally
|
|
145
|
-
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
146
|
-
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
147
|
-
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
148
|
-
const firstEpochInOffenseRound = offenseEpoch - offenseEpoch % slashingRoundSizeInEpochs;
|
|
149
|
-
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
150
|
-
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
151
|
-
await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), {
|
|
152
|
-
offset: -aztecSlotDuration / 2
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
const attestersPre = await rollup.getAttesters();
|
|
156
|
-
expect(attestersPre.length).toBe(committee.length);
|
|
157
|
-
for (const attester of attestersPre){
|
|
158
|
-
const attesterInfo = await rollup.getAttesterView(attester);
|
|
159
|
-
expect(attesterInfo.status).toEqual(1); // Validating
|
|
160
|
-
}
|
|
161
|
-
const timeout = slashingRoundSize * 2 * aztecSlotDuration + 30;
|
|
162
|
-
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
163
|
-
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
164
|
-
// The attesters should still form the committee but they should be reduced to the "living" status
|
|
165
|
-
await cheatCodes.debugRollup();
|
|
166
|
-
const committeePostSlashing = await rollup.getCurrentEpochCommittee();
|
|
167
|
-
expect(committeePostSlashing?.length).toBe(attestersPre.length);
|
|
168
|
-
const attestersPostSlashing = await rollup.getAttesters();
|
|
169
|
-
expect(attestersPostSlashing.length).toBe(0);
|
|
170
|
-
for (const attester of attestersPre){
|
|
171
|
-
const attesterInfo = await rollup.getAttesterView(attester);
|
|
172
|
-
expect(attesterInfo.status).toEqual(2); // Living
|
|
173
|
-
}
|
|
174
|
-
logger.info(`Advancing to check current committee`);
|
|
175
|
-
await cheatCodes.debugRollup();
|
|
176
|
-
await cheatCodes.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.getEpoch()) + await rollup.getLagInEpochsForValidatorSet() + 1n));
|
|
177
|
-
await cheatCodes.debugRollup();
|
|
178
|
-
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|
|
179
|
-
// The committee should be undefined, since the validator set is empty
|
|
180
|
-
// and the tests currently using this helper always set a target committee size.
|
|
181
|
-
expect(committeeNextEpoch).toBeUndefined();
|
|
182
|
-
const attestersNextEpoch = await rollup.getAttesters();
|
|
183
|
-
expect(attestersNextEpoch.length).toBe(0);
|
|
184
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { type Logger } from '@aztec/aztec.js/log';
|
|
3
|
-
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
-
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
|
-
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
6
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
7
|
-
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
8
|
-
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
9
|
-
export declare class TokenContractTest {
|
|
10
|
-
static TOKEN_NAME: string;
|
|
11
|
-
static TOKEN_SYMBOL: string;
|
|
12
|
-
static TOKEN_DECIMALS: bigint;
|
|
13
|
-
private snapshotManager;
|
|
14
|
-
logger: Logger;
|
|
15
|
-
asset: TokenContract;
|
|
16
|
-
tokenSim: TokenSimulator;
|
|
17
|
-
node: AztecNode;
|
|
18
|
-
badAccount: InvalidAccountContract;
|
|
19
|
-
wallet: TestWallet;
|
|
20
|
-
adminAddress: AztecAddress;
|
|
21
|
-
account1Address: AztecAddress;
|
|
22
|
-
account2Address: AztecAddress;
|
|
23
|
-
constructor(testName: string);
|
|
24
|
-
/**
|
|
25
|
-
* Adds two state shifts to snapshot manager.
|
|
26
|
-
* 1. Add 3 accounts.
|
|
27
|
-
* 2. Publicly deploy accounts, deploy token contract and a "bad account".
|
|
28
|
-
*/
|
|
29
|
-
applyBaseSnapshots(): Promise<void>;
|
|
30
|
-
setup(): Promise<void>;
|
|
31
|
-
snapshot: <T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>) => Promise<void>;
|
|
32
|
-
teardown(): Promise<void>;
|
|
33
|
-
applyMintSnapshot(): Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5fY29udHJhY3RfdGVzdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2UyZV90b2tlbl9jb250cmFjdC90b2tlbl9jb250cmFjdF90ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0scUJBQXFCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDdEQsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQy9ELE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3RGLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBSTVELE9BQU8sRUFFTCxLQUFLLGlCQUFpQixFQUl2QixNQUFNLGlDQUFpQyxDQUFDO0FBRXpDLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUlsRSxxQkFBYSxpQkFBaUI7SUFDNUIsTUFBTSxDQUFDLFVBQVUsU0FBVTtJQUMzQixNQUFNLENBQUMsWUFBWSxTQUFTO0lBQzVCLE1BQU0sQ0FBQyxjQUFjLFNBQU87SUFDNUIsT0FBTyxDQUFDLGVBQWUsQ0FBbUI7SUFDMUMsTUFBTSxFQUFFLE1BQU0sQ0FB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