@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
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
|
+
import { StubEcdsaAccountContractArtifact, createStubEcdsaAccount } from '@aztec/accounts/ecdsa/stub';
|
|
3
|
+
import { SchnorrAccountContract, SchnorrInitializerlessAccountContract } from '@aztec/accounts/schnorr';
|
|
4
|
+
import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/schnorr/stub';
|
|
5
|
+
import { type Account, type AccountContract, NO_FROM } from '@aztec/aztec.js/account';
|
|
6
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
7
|
+
import {
|
|
8
|
+
type CallIntent,
|
|
9
|
+
type ContractFunctionInteractionCallIntent,
|
|
10
|
+
type IntentInnerHash,
|
|
11
|
+
SetPublicAuthwitContractInteraction,
|
|
12
|
+
computeInnerAuthWitHashFromAction,
|
|
13
|
+
isContractFunctionInteractionCallIntent,
|
|
14
|
+
lookupValidity,
|
|
15
|
+
} from '@aztec/aztec.js/authorization';
|
|
16
|
+
import { ContractFunctionInteraction } from '@aztec/aztec.js/contracts';
|
|
17
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
18
|
+
import { AccountManager, type SendOptions } from '@aztec/aztec.js/wallet';
|
|
19
|
+
import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
|
|
20
|
+
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
21
|
+
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
22
|
+
import { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
23
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
24
|
+
import type { NotesFilter } from '@aztec/pxe/client/lazy';
|
|
25
|
+
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/config';
|
|
26
|
+
import { PXE, type PXECreationOptions, type TaggingSecretSource, createPXE } from '@aztec/pxe/server';
|
|
27
|
+
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
28
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
29
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
30
|
+
import type { NoteDao } from '@aztec/stdlib/note';
|
|
31
|
+
import {
|
|
32
|
+
type BlockHeader,
|
|
33
|
+
type ContractOverrides,
|
|
34
|
+
SimulationOverrides,
|
|
35
|
+
type TxExecutionRequest,
|
|
36
|
+
type TxHash,
|
|
37
|
+
type TxReceipt,
|
|
38
|
+
} from '@aztec/stdlib/tx';
|
|
39
|
+
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
40
|
+
import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
41
|
+
import type { AccountType } from '@aztec/wallets/embedded';
|
|
42
|
+
|
|
43
|
+
import { DEFAULT_MIN_FEE_PADDING } from '../fixtures/fixtures.js';
|
|
44
|
+
import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Data for generating an account.
|
|
48
|
+
*/
|
|
49
|
+
export interface AccountData {
|
|
50
|
+
secret: Fr;
|
|
51
|
+
salt: Fr;
|
|
52
|
+
type?: AccountType;
|
|
53
|
+
contract: AccountContract;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Wallet implementation that stores accounts in memory and provides extra debugging
|
|
58
|
+
* utilities
|
|
59
|
+
* It is intended to be used in e2e tests.
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* Poll interval (in seconds) for in-process TestWallet tx waits. In-process nodes reach CHECKPOINTED synchronously
|
|
63
|
+
* under automine and cheaply otherwise, so a sub-second cadence removes almost-pure dead time from every send().wait().
|
|
64
|
+
* Spartan tests run against remote JSON-RPC nodes and restore the 1s default via setDefaultWaitInterval.
|
|
65
|
+
*/
|
|
66
|
+
export const IN_PROCESS_WAIT_INTERVAL_SECONDS = 0.25;
|
|
67
|
+
|
|
68
|
+
export class TestWallet extends BaseWallet {
|
|
69
|
+
constructor(
|
|
70
|
+
pxe: PXE,
|
|
71
|
+
private readonly nodeRef: AztecNodeProxy,
|
|
72
|
+
) {
|
|
73
|
+
super(pxe, nodeRef);
|
|
74
|
+
this.minFeePadding = DEFAULT_MIN_FEE_PADDING;
|
|
75
|
+
this.defaultWaitInterval = IN_PROCESS_WAIT_INTERVAL_SECONDS;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Overrides the poll interval (in seconds) used when a send().wait() caller does not specify one. Pass `undefined`
|
|
80
|
+
* to fall back to the DefaultWaitOpts cadence. Spartan tests set this to 1 so they do not hammer remote nodes.
|
|
81
|
+
*/
|
|
82
|
+
setDefaultWaitInterval(interval?: number): void {
|
|
83
|
+
this.defaultWaitInterval = interval;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static async create(
|
|
87
|
+
node: AztecNode,
|
|
88
|
+
overridePXEConfig?: Partial<PXEConfig>,
|
|
89
|
+
options: PXECreationOptions = { loggers: {} },
|
|
90
|
+
): Promise<TestWallet> {
|
|
91
|
+
const nodeRef = new AztecNodeProxy(node);
|
|
92
|
+
const pxeConfig = Object.assign(getPXEConfig(), {
|
|
93
|
+
proverEnabled: overridePXEConfig?.proverEnabled ?? false,
|
|
94
|
+
...overridePXEConfig,
|
|
95
|
+
});
|
|
96
|
+
const pxe = await createPXE(nodeRef, pxeConfig, options);
|
|
97
|
+
const wallet = new TestWallet(pxe, nodeRef);
|
|
98
|
+
await wallet.initStubClasses();
|
|
99
|
+
return wallet;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Updates the underlying node that this wallet and its PXE communicate with.
|
|
104
|
+
* @param node - The new AztecNode to forward all calls to.
|
|
105
|
+
*/
|
|
106
|
+
updateNode(node: AztecNode): void {
|
|
107
|
+
this.nodeRef.updateTargetNode(node);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
createSchnorrAccount(secret: Fr, salt: Fr, signingKey: Fq): Promise<AccountManager> {
|
|
111
|
+
return this.createAccount({ secret, salt, type: 'schnorr', contract: new SchnorrAccountContract(signingKey) });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
createSchnorrInitializerlessAccount(secret: Fr, salt: Fr, signingKey: Fq): Promise<AccountManager> {
|
|
115
|
+
return this.createAccount({
|
|
116
|
+
secret,
|
|
117
|
+
salt,
|
|
118
|
+
type: 'schnorr_initializerless',
|
|
119
|
+
contract: new SchnorrInitializerlessAccountContract(signingKey),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
|
|
124
|
+
return this.createAccount({
|
|
125
|
+
secret,
|
|
126
|
+
salt,
|
|
127
|
+
type: 'ecdsasecp256r1',
|
|
128
|
+
contract: new EcdsaRAccountContract(signingKey),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
|
|
133
|
+
return this.createAccount({
|
|
134
|
+
secret,
|
|
135
|
+
salt,
|
|
136
|
+
type: 'ecdsasecp256k1',
|
|
137
|
+
contract: new EcdsaKAccountContract(signingKey),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Stub class ids, populated on wallet startup
|
|
142
|
+
// to avoid redundant work per simulation
|
|
143
|
+
private stubClassIds = new Map<AccountType, Fr>();
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Hashes and registers the stub class for every supported account type with PXE, populating
|
|
147
|
+
* stubClassIds. Called on wallet initialization.
|
|
148
|
+
*/
|
|
149
|
+
private async initStubClasses(): Promise<void> {
|
|
150
|
+
const { id: schnorrClassId } = await getContractClassFromArtifact(StubSchnorrAccountContractArtifact);
|
|
151
|
+
await this.pxe.registerContractClass(StubSchnorrAccountContractArtifact);
|
|
152
|
+
|
|
153
|
+
// ecdsa stubs share the same class id
|
|
154
|
+
const { id: ecdsaClassId } = await getContractClassFromArtifact(StubEcdsaAccountContractArtifact);
|
|
155
|
+
await this.pxe.registerContractClass(StubEcdsaAccountContractArtifact);
|
|
156
|
+
|
|
157
|
+
this.stubClassIds.set('schnorr', schnorrClassId);
|
|
158
|
+
// Initializerless accounts share the schnorr stub class for kernelless simulation.
|
|
159
|
+
this.stubClassIds.set('schnorr_initializerless', schnorrClassId);
|
|
160
|
+
this.stubClassIds.set('ecdsasecp256k1', ecdsaClassId);
|
|
161
|
+
this.stubClassIds.set('ecdsasecp256r1', ecdsaClassId);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Builds contract overrides for all provided addresses by replacing their account contracts with stub implementations.
|
|
166
|
+
*/
|
|
167
|
+
protected async buildAccountOverrides(addresses: AztecAddress[]): Promise<ContractOverrides> {
|
|
168
|
+
const accounts = await this.getAccounts();
|
|
169
|
+
const contracts: ContractOverrides = {};
|
|
170
|
+
|
|
171
|
+
const filtered = accounts.filter(acc => addresses.some(addr => addr.equals(acc.item)));
|
|
172
|
+
|
|
173
|
+
for (const account of filtered) {
|
|
174
|
+
const address = account.item;
|
|
175
|
+
const originalAccount = await this.getAccountFromAddress(address);
|
|
176
|
+
const completeAddress = originalAccount.getCompleteAddress();
|
|
177
|
+
const contractInstance = await this.pxe.getContractInstance(completeAddress.address);
|
|
178
|
+
if (!contractInstance) {
|
|
179
|
+
throw new Error(
|
|
180
|
+
`No contract instance found for address: ${completeAddress.address} during account override building. This is a bug!`,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const type = this.getTypeFor(address);
|
|
185
|
+
const stubClassId = this.stubClassIds.get(type);
|
|
186
|
+
if (!stubClassId) {
|
|
187
|
+
throw new Error(
|
|
188
|
+
`Stub class for account type '${type}' was not registered at wallet init. This is a bug — initStubClasses should cover every supported AccountType.`,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
contracts[address.toString()] = {
|
|
193
|
+
instance: { ...contractInstance, currentContractClassId: stubClassId },
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return contracts;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
protected accounts: Map<string, { account: Account; type: AccountType }> = new Map();
|
|
201
|
+
|
|
202
|
+
private getTypeFor(address: AztecAddress): AccountType {
|
|
203
|
+
return this.accounts.get(address.toString())?.type ?? 'schnorr';
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
private getStubAccountFor(address: AztecAddress, completeAddress: CompleteAddress) {
|
|
207
|
+
const type = this.getTypeFor(address);
|
|
208
|
+
return type === 'schnorr' || type === 'schnorr_initializerless'
|
|
209
|
+
? createStubSchnorrAccount(completeAddress)
|
|
210
|
+
: createStubEcdsaAccount(completeAddress);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Controls how the test wallet simulates transactions:
|
|
215
|
+
* - `kernelless`: Skips kernel circuits but uses the real account contract. Default.
|
|
216
|
+
* - `kernelless-override`: Skips kernels and replaces the account with a stub that doesn't do authwit validation.
|
|
217
|
+
* - `full`: Uses real kernel circuits and real account contracts. Slow!
|
|
218
|
+
*/
|
|
219
|
+
private simulationMode: 'kernelless' | 'kernelless-override' | 'full' = 'kernelless';
|
|
220
|
+
|
|
221
|
+
setSimulationMode(mode: 'kernelless' | 'kernelless-override' | 'full') {
|
|
222
|
+
this.simulationMode = mode;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
setMinFeePadding(value?: number) {
|
|
226
|
+
this.minFeePadding = value ?? DEFAULT_MIN_FEE_PADDING;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
protected getAccountFromAddress(address: AztecAddress): Promise<Account> {
|
|
230
|
+
const entry = this.accounts.get(address?.toString() ?? '');
|
|
231
|
+
|
|
232
|
+
if (!entry) {
|
|
233
|
+
throw new Error(`Account not found in wallet for address: ${address}`);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return Promise.resolve(entry.account);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
getAccounts() {
|
|
240
|
+
return Promise.resolve(
|
|
241
|
+
Array.from(this.accounts.values()).map(entry => ({ alias: '', item: entry.account.getAddress() })),
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async createAccount(accountData?: AccountData): Promise<AccountManager> {
|
|
246
|
+
const secret = accountData?.secret ?? Fr.random();
|
|
247
|
+
const salt = accountData?.salt ?? Fr.random();
|
|
248
|
+
const type = accountData?.type ?? 'schnorr';
|
|
249
|
+
const contract = accountData?.contract ?? new SchnorrAccountContract(GrumpkinScalar.random());
|
|
250
|
+
|
|
251
|
+
// Initializerless accounts have no deployment tx: the address commits to the signing public key
|
|
252
|
+
// (via the contract's immutablesHash, resolved by AccountManager.create) and the constructor's
|
|
253
|
+
// storage writes are materialized locally via a simulated "store" call below.
|
|
254
|
+
// Mirrors EmbeddedWallet.createAccountInternal.
|
|
255
|
+
const accountManager = await AccountManager.create(this, secret, contract, { salt });
|
|
256
|
+
|
|
257
|
+
const instance = accountManager.getInstance();
|
|
258
|
+
const artifact = await contract.getContractArtifact();
|
|
259
|
+
|
|
260
|
+
await this.registerContract(instance, artifact, secret);
|
|
261
|
+
|
|
262
|
+
const address = accountManager.address.toString();
|
|
263
|
+
this.accounts.set(address, { account: await accountManager.getAccount(), type });
|
|
264
|
+
|
|
265
|
+
if (contract instanceof SchnorrInitializerlessAccountContract) {
|
|
266
|
+
const constructorAbi = artifact.functions.find(f => f.name === 'constructor');
|
|
267
|
+
if (!constructorAbi) {
|
|
268
|
+
throw new Error('Could not create SchnorrInitializerlessAccount: constructor ABI not found');
|
|
269
|
+
}
|
|
270
|
+
const { x, y } = await contract.getSigningPublicKey();
|
|
271
|
+
const storeCall = new ContractFunctionInteraction(this, instance.address, constructorAbi, [x, y]);
|
|
272
|
+
await storeCall.simulate({ from: instance.address });
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return accountManager;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
lookupValidity(
|
|
279
|
+
onBehalfOf: AztecAddress,
|
|
280
|
+
intent: IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
|
|
281
|
+
witness: AuthWitness,
|
|
282
|
+
): Promise<{
|
|
283
|
+
isValidInPrivate: boolean;
|
|
284
|
+
isValidInPublic: boolean;
|
|
285
|
+
}> {
|
|
286
|
+
return lookupValidity(this, onBehalfOf, intent, witness);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
public setPublicAuthWit(
|
|
290
|
+
from: AztecAddress,
|
|
291
|
+
messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
|
|
292
|
+
authorized: boolean,
|
|
293
|
+
): Promise<SetPublicAuthwitContractInteraction> {
|
|
294
|
+
return SetPublicAuthwitContractInteraction.create(this, from, messageHashOrIntent, authorized);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
public override async createAuthWit(
|
|
298
|
+
from: AztecAddress,
|
|
299
|
+
intent: IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
|
|
300
|
+
): Promise<AuthWitness> {
|
|
301
|
+
const account = await this.getAccountFromAddress(from);
|
|
302
|
+
const chainInfo = await this.getChainInfo();
|
|
303
|
+
let intentInnerHash: IntentInnerHash;
|
|
304
|
+
if ('caller' in intent) {
|
|
305
|
+
const call = isContractFunctionInteractionCallIntent(intent)
|
|
306
|
+
? await intent.action.getFunctionCall()
|
|
307
|
+
: intent.call;
|
|
308
|
+
const innerHash = await computeInnerAuthWitHashFromAction(intent.caller, call);
|
|
309
|
+
intentInnerHash = { innerHash, consumer: call.to };
|
|
310
|
+
} else {
|
|
311
|
+
intentInnerHash = intent;
|
|
312
|
+
}
|
|
313
|
+
return account.createAuthWit(intentInnerHash, chainInfo);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
protected override async simulateViaEntrypoint(
|
|
317
|
+
executionPayload: ExecutionPayload,
|
|
318
|
+
opts: SimulateViaEntrypointOptions,
|
|
319
|
+
): Promise<TxSimulationResultWithAppOffset> {
|
|
320
|
+
const { from, feeOptions, additionalScopes, skipTxValidation, skipFeeEnforcement, sendMessagesAs } = opts;
|
|
321
|
+
const scopes = this.scopesFrom(from, additionalScopes ?? [], sendMessagesAs);
|
|
322
|
+
const skipKernels = this.simulationMode !== 'full';
|
|
323
|
+
const useOverride = this.simulationMode === 'kernelless-override';
|
|
324
|
+
|
|
325
|
+
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
326
|
+
const finalExecutionPayload = feeExecutionPayload
|
|
327
|
+
? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
|
|
328
|
+
: executionPayload;
|
|
329
|
+
const chainInfo = await this.getChainInfo();
|
|
330
|
+
|
|
331
|
+
let overrides = opts.overrides;
|
|
332
|
+
let txRequest: TxExecutionRequest;
|
|
333
|
+
if (useOverride) {
|
|
334
|
+
const accountOverrides = await this.buildAccountOverrides(scopes);
|
|
335
|
+
overrides = new SimulationOverrides({
|
|
336
|
+
publicStorage: overrides?.publicStorage,
|
|
337
|
+
contracts: { ...overrides?.contracts, ...accountOverrides },
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (from === NO_FROM) {
|
|
342
|
+
const entrypoint = new DefaultEntrypoint();
|
|
343
|
+
txRequest = await entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
|
|
344
|
+
} else {
|
|
345
|
+
let fromAccount: Account;
|
|
346
|
+
if (useOverride) {
|
|
347
|
+
const originalAccount = await this.getAccountFromAddress(from);
|
|
348
|
+
fromAccount = this.getStubAccountFor(from, originalAccount.getCompleteAddress());
|
|
349
|
+
} else {
|
|
350
|
+
fromAccount = await this.getAccountFromAddress(from);
|
|
351
|
+
}
|
|
352
|
+
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
353
|
+
txNonce: Fr.random(),
|
|
354
|
+
cancellable: this.cancellableTransactions,
|
|
355
|
+
// If from is an address, feeOptions include the way the account contract should handle the fee payment
|
|
356
|
+
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions!,
|
|
357
|
+
};
|
|
358
|
+
txRequest = await fromAccount.createTxExecutionRequest(
|
|
359
|
+
finalExecutionPayload,
|
|
360
|
+
feeOptions.gasSettings,
|
|
361
|
+
chainInfo,
|
|
362
|
+
executionOptions,
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const result = await this.pxe.simulateTx(txRequest, {
|
|
367
|
+
simulatePublic: true,
|
|
368
|
+
skipKernels,
|
|
369
|
+
skipFeeEnforcement,
|
|
370
|
+
skipTxValidation,
|
|
371
|
+
overrides,
|
|
372
|
+
scopes,
|
|
373
|
+
senderForTags: this.senderForTagsFrom(from, sendMessagesAs),
|
|
374
|
+
});
|
|
375
|
+
const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
|
|
376
|
+
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
async proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<ProvenTx> {
|
|
380
|
+
const fee = await this.completeFeeOptions({
|
|
381
|
+
from: opts.from,
|
|
382
|
+
feePayer: exec.feePayer,
|
|
383
|
+
gasSettings: opts.fee?.gasSettings,
|
|
384
|
+
});
|
|
385
|
+
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
386
|
+
const txProvingResult = await this.pxe.proveTx(txRequest, {
|
|
387
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes ?? [], opts.sendMessagesAs),
|
|
388
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
|
|
389
|
+
});
|
|
390
|
+
return new ProvenTx(
|
|
391
|
+
this.aztecNode,
|
|
392
|
+
await txProvingResult.toTx(),
|
|
393
|
+
txProvingResult.getOffchainEffects(),
|
|
394
|
+
txProvingResult.stats,
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
getTxReceipt(txHash: TxHash): Promise<TxReceipt> {
|
|
399
|
+
return this.aztecNode.getTxReceipt(txHash);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
getNotes(filter: NotesFilter): Promise<NoteDao[]> {
|
|
403
|
+
return this.pxe.debug.getNotes(filter);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
getSyncedBlockHeader(): Promise<BlockHeader> {
|
|
407
|
+
return this.pxe.getSyncedBlockHeader();
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
sync(): Promise<void> {
|
|
411
|
+
return this.pxe.sync();
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Registers a non-sender tagging-secret source (e.g. a raw out-of-band shared secret) so this PXE discovers messages
|
|
416
|
+
* tagged with it. Test-only surface over {@link PXE.registerTaggingSecretSource}, which the base `Wallet` does not
|
|
417
|
+
* expose. The `address-derived` (sender) variant is excluded: use {@link Wallet.registerSender} for that.
|
|
418
|
+
*/
|
|
419
|
+
registerTaggingSecretSource(source: Exclude<TaggingSecretSource, { kind: 'address-derived' }>): Promise<void> {
|
|
420
|
+
return this.pxe.registerTaggingSecretSource(source);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
stop(): Promise<void> {
|
|
424
|
+
return this.pxe.stop();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import {
|
|
3
|
+
BatchCall,
|
|
4
|
+
ContractFunctionInteraction,
|
|
5
|
+
DeployMethod,
|
|
6
|
+
type DeployOptions,
|
|
7
|
+
NO_WAIT,
|
|
8
|
+
type NoWait,
|
|
9
|
+
type SendInteractionOptions,
|
|
10
|
+
type WaitOpts,
|
|
11
|
+
toSendOptions,
|
|
12
|
+
} from '@aztec/aztec.js/contracts';
|
|
13
|
+
import { type AztecNode, waitForTx } from '@aztec/aztec.js/node';
|
|
14
|
+
import { timesAsync } from '@aztec/foundation/collection';
|
|
15
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
16
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
17
|
+
import { SimulationError } from '@aztec/stdlib/errors';
|
|
18
|
+
import { type OffchainEffect, type ProvingStats, Tx, TxHash, type TxReceipt } from '@aztec/stdlib/tx';
|
|
19
|
+
|
|
20
|
+
import { inspect } from 'util';
|
|
21
|
+
|
|
22
|
+
import { testSpan, withTestSpanOwner } from '../fixtures/timing.js';
|
|
23
|
+
import type { TestWallet } from './test_wallet.js';
|
|
24
|
+
|
|
25
|
+
export type ProvenTxSendOpts = {
|
|
26
|
+
wait?: NoWait | WaitOpts;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type ProvenTxSendReturn<T extends NoWait | WaitOpts | undefined> = T extends NoWait ? TxHash : TxReceipt;
|
|
30
|
+
|
|
31
|
+
export class ProvenTx extends Tx {
|
|
32
|
+
constructor(
|
|
33
|
+
private node: AztecNode,
|
|
34
|
+
tx: Tx,
|
|
35
|
+
public offchainEffects: OffchainEffect[],
|
|
36
|
+
public stats?: ProvingStats,
|
|
37
|
+
) {
|
|
38
|
+
super(tx.getTxHash(), tx.data, tx.chonkProof, tx.contractClassLogFields, tx.publicFunctionCalldata);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
send(options?: Omit<ProvenTxSendOpts, 'wait'>): Promise<TxReceipt>;
|
|
42
|
+
send<W extends ProvenTxSendOpts['wait']>(options: ProvenTxSendOpts & { wait: W }): Promise<ProvenTxSendReturn<W>>;
|
|
43
|
+
send(options?: ProvenTxSendOpts): Promise<TxHash | TxReceipt> {
|
|
44
|
+
return testSpan('tx:send', () => this.sendInner(options));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private async sendInner(options?: ProvenTxSendOpts): Promise<TxHash | TxReceipt> {
|
|
48
|
+
const txHash = this.getTxHash();
|
|
49
|
+
await this.node.sendTx(this).catch(err => {
|
|
50
|
+
throw this.contextualizeError(err, inspect(this));
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (options?.wait === NO_WAIT) {
|
|
54
|
+
return txHash;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const waitOpts = typeof options?.wait === 'object' ? options.wait : undefined;
|
|
58
|
+
return await waitForTx(this.node, txHash, waitOpts);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private contextualizeError(err: Error, ...context: string[]): Error {
|
|
62
|
+
let contextStr = '';
|
|
63
|
+
if (context.length > 0) {
|
|
64
|
+
contextStr = `\nContext:\n${context.join('\n')}`;
|
|
65
|
+
}
|
|
66
|
+
if (err instanceof SimulationError) {
|
|
67
|
+
err.setAztecContext(contextStr);
|
|
68
|
+
}
|
|
69
|
+
return err;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function proveInteraction(
|
|
74
|
+
wallet: TestWallet,
|
|
75
|
+
interaction: ContractFunctionInteraction | DeployMethod | BatchCall,
|
|
76
|
+
options: SendInteractionOptions | DeployOptions,
|
|
77
|
+
): Promise<ProvenTx> {
|
|
78
|
+
return testSpan('tx:prove', async () => {
|
|
79
|
+
const execPayload = await interaction.request(options);
|
|
80
|
+
return wallet.proveTx(execPayload, toSendOptions(options));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Builds an interaction for index `i` of a batch. */
|
|
85
|
+
export type MakeBatchCall = (i: number) => ContractFunctionInteraction | DeployMethod | BatchCall;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Pre-proves `count` interactions built by `makeCall(i)` against `wallet`, all with the same
|
|
89
|
+
* `options`. Returns the proven txs so the caller can send them individually (e.g. with sleeps
|
|
90
|
+
* between sends, or anchored to intermediate tips). For the common "send the whole batch at once"
|
|
91
|
+
* case use {@link proveAndSendTxs}.
|
|
92
|
+
*/
|
|
93
|
+
export function proveTxs(
|
|
94
|
+
wallet: TestWallet,
|
|
95
|
+
count: number,
|
|
96
|
+
makeCall: MakeBatchCall,
|
|
97
|
+
options: SendInteractionOptions | DeployOptions,
|
|
98
|
+
): Promise<ProvenTx[]> {
|
|
99
|
+
return timesAsync(count, i => proveInteraction(wallet, makeCall(i), options));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Pre-proves `count` interactions built by `makeCall(i)` and sends each one with `NO_WAIT`, all at
|
|
104
|
+
* once. Returns the tx hashes in batch order. Pairs with `waitForTxs` for the "send N, wait for N"
|
|
105
|
+
* arc. Use {@link proveTxs} instead when the sends need bespoke sequencing.
|
|
106
|
+
*/
|
|
107
|
+
export async function proveAndSendTxs(
|
|
108
|
+
wallet: TestWallet,
|
|
109
|
+
count: number,
|
|
110
|
+
makeCall: MakeBatchCall,
|
|
111
|
+
options: SendInteractionOptions | DeployOptions,
|
|
112
|
+
): Promise<TxHash[]> {
|
|
113
|
+
const txs = await proveTxs(wallet, count, makeCall, options);
|
|
114
|
+
return Promise.all(txs.map(tx => tx.send({ wait: NO_WAIT })));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Options for {@link startMempoolFeeder}. */
|
|
118
|
+
export type MempoolFeederOpts = {
|
|
119
|
+
/** The account the txs are sent from. */
|
|
120
|
+
from: AztecAddress;
|
|
121
|
+
/** Keep the pending-tx count at or above this threshold; defaults to 3. */
|
|
122
|
+
minPending?: number;
|
|
123
|
+
/** Milliseconds between top-up polls; defaults to 1000. */
|
|
124
|
+
intervalMs?: number;
|
|
125
|
+
/** Logger for verbose top-up traces. */
|
|
126
|
+
logger?: Logger;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Starts a background loop that keeps `node`'s mempool topped up: whenever the pending-tx count drops
|
|
131
|
+
* below `opts.minPending`, it proves and sends one interaction built by `makeCall()` (NO_WAIT). Errors
|
|
132
|
+
* are swallowed and retried. Returns an {@link AsyncDisposable}; disposing stops the loop and awaits it.
|
|
133
|
+
*/
|
|
134
|
+
export function startMempoolFeeder(
|
|
135
|
+
wallet: TestWallet,
|
|
136
|
+
node: AztecNode,
|
|
137
|
+
makeCall: () => ContractFunctionInteraction | DeployMethod | BatchCall,
|
|
138
|
+
opts: MempoolFeederOpts,
|
|
139
|
+
): AsyncDisposable {
|
|
140
|
+
const minPending = opts.minPending ?? 3;
|
|
141
|
+
const intervalMs = opts.intervalMs ?? 1000;
|
|
142
|
+
let stopped = false;
|
|
143
|
+
|
|
144
|
+
// Pin the feeder's prove/send spans to a fixed non-test owner. It runs interleaved with arbitrary
|
|
145
|
+
// tests, so without this its tx:prove/tx:send spans would smear onto whichever test was current
|
|
146
|
+
// when each round fired; the pinned owner matches no test/suite record, excluding them cleanly.
|
|
147
|
+
const loop = withTestSpanOwner('other:mempool-feeder', async () => {
|
|
148
|
+
while (!stopped) {
|
|
149
|
+
try {
|
|
150
|
+
const pendingCount = await node.getPendingTxCount();
|
|
151
|
+
if (pendingCount < minPending) {
|
|
152
|
+
await proveAndSendTxs(wallet, 1, makeCall, { from: opts.from });
|
|
153
|
+
opts.logger?.verbose(`Topped up mempool (was ${pendingCount})`);
|
|
154
|
+
}
|
|
155
|
+
} catch (err) {
|
|
156
|
+
opts.logger?.verbose(`Mempool top-up error (will retry): ${err}`);
|
|
157
|
+
}
|
|
158
|
+
await sleep(intervalMs);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
async [Symbol.asyncDispose]() {
|
|
164
|
+
stopped = true;
|
|
165
|
+
await loop;
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Extends AztecNode via declaration merging so instances can be used wherever AztecNode is expected.
|
|
172
|
+
* The actual method forwarding is handled by a Proxy in the class constructor.
|
|
173
|
+
*/
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
175
|
+
export interface AztecNodeProxy extends AztecNode {}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Mutable wrapper around an AztecNode that forwards all calls to the current target.
|
|
179
|
+
* Allows swapping the underlying node at runtime via updateTargetNode, which is useful
|
|
180
|
+
* for tests that need to redirect a wallet from one node to another without recreating it.
|
|
181
|
+
*/
|
|
182
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
183
|
+
export class AztecNodeProxy {
|
|
184
|
+
constructor(private target: AztecNode) {
|
|
185
|
+
return new Proxy(this, {
|
|
186
|
+
get: (obj, prop, receiver) => {
|
|
187
|
+
// Own properties and methods (updateTargetNode, target) are served directly.
|
|
188
|
+
if (Reflect.has(obj, prop)) {
|
|
189
|
+
return Reflect.get(obj, prop, receiver);
|
|
190
|
+
}
|
|
191
|
+
// Everything else is forwarded to the current target node.
|
|
192
|
+
const val = (obj.target as unknown as Record<string | symbol, unknown>)[prop];
|
|
193
|
+
return typeof val === 'function' ? val.bind(obj.target) : val;
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Updates the underlying node that this reference points to.
|
|
200
|
+
* @param node - The new node to forward calls to.
|
|
201
|
+
*/
|
|
202
|
+
updateTargetNode(node: AztecNode): void {
|
|
203
|
+
this.target = node;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DefaultWaitOpts } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
3
|
+
import type { SendOptions } from '@aztec/aztec.js/wallet';
|
|
4
|
+
import { BackendType, BarretenbergSync } from '@aztec/bb.js';
|
|
5
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
6
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import type { ApiSchema, Fq, Fr } from '@aztec/foundation/schemas';
|
|
8
|
+
import { getSchemaParameters, parseWithOptionals, schemaHasMethod } from '@aztec/foundation/schemas';
|
|
9
|
+
import { NodeListener, TransportServer } from '@aztec/foundation/transport';
|
|
10
|
+
import { ExecutionPayload, Tx } from '@aztec/stdlib/tx';
|
|
11
|
+
|
|
12
|
+
import { workerData } from 'worker_threads';
|
|
13
|
+
|
|
14
|
+
import { TestWallet } from './test_wallet.js';
|
|
15
|
+
import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
16
|
+
|
|
17
|
+
const logger = createLogger('e2e:test-wallet:worker');
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const { nodeUrl, pxeConfig } = workerData as { nodeUrl: string; pxeConfig?: Record<string, unknown> };
|
|
21
|
+
|
|
22
|
+
logger.info('Initializing worker wallet', { nodeUrl });
|
|
23
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
24
|
+
// Worker sync bb use is limited to crypto and proof serialization helpers.
|
|
25
|
+
await BarretenbergSync.initSingleton({ backend: BackendType.Wasm });
|
|
26
|
+
const wallet = await TestWallet.create(node, pxeConfig);
|
|
27
|
+
// Worker wallets are only used by spartan tests against remote JSON-RPC nodes: keep the 1s poll cadence.
|
|
28
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
29
|
+
logger.info('Worker wallet initialized');
|
|
30
|
+
|
|
31
|
+
const customMethods = {
|
|
32
|
+
proveTx: async (exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>) => {
|
|
33
|
+
const provenTx = await wallet.proveTx(exec, opts);
|
|
34
|
+
return new Tx(
|
|
35
|
+
provenTx.getTxHash(),
|
|
36
|
+
provenTx.data,
|
|
37
|
+
provenTx.chonkProof,
|
|
38
|
+
provenTx.contractClassLogFields,
|
|
39
|
+
provenTx.publicFunctionCalldata,
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
registerAccount: async (secret: Fr, salt: Fr, signingKey: Fq) => {
|
|
43
|
+
const manager = await wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
44
|
+
return manager.address;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const schema = WorkerWalletSchema as ApiSchema;
|
|
49
|
+
const listener = new NodeListener();
|
|
50
|
+
const server = new TransportServer<{ fn: string; args: string }>(listener, async msg => {
|
|
51
|
+
if (!schemaHasMethod(schema, msg.fn)) {
|
|
52
|
+
throw new Error(`Unknown method: ${msg.fn}`);
|
|
53
|
+
}
|
|
54
|
+
const jsonParams = JSON.parse(msg.args) as unknown[];
|
|
55
|
+
const args: any[] = await parseWithOptionals(jsonParams, getSchemaParameters(schema[msg.fn]));
|
|
56
|
+
// we have to erase the fn type in order to be able to spread ...args
|
|
57
|
+
const handler: ((...args: any[]) => Promise<any>) | undefined =
|
|
58
|
+
msg.fn in customMethods ? customMethods[msg.fn as keyof typeof customMethods] : undefined;
|
|
59
|
+
const result = handler ? await handler(...args) : await (wallet as any)[msg.fn](...args);
|
|
60
|
+
return jsonStringify(result);
|
|
61
|
+
});
|
|
62
|
+
server.start();
|
|
63
|
+
} catch (err: unknown) {
|
|
64
|
+
logger.error('Worker wallet initialization failed', { error: err instanceof Error ? err.stack : String(err) });
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|