@aztec/end-to-end 0.0.1-commit.4d79d1f2d → 0.0.1-commit.4d9804df
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/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +39 -52
- package/dest/automine/token/token_contract_test.d.ts +40 -0
- package/dest/automine/token/token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +37 -52
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +19 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +5 -5
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +62 -53
- package/dest/bench/client_flows/data_extractor.js +1 -0
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +102 -8
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +17 -13
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +82 -74
- 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 +83 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +86 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +4 -4
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +8 -3
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +99 -48
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +319 -262
- package/dest/fixtures/setup_p2p_test.d.ts +14 -7
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +21 -18
- package/dest/fixtures/timing.d.ts +42 -0
- package/dest/fixtures/timing.d.ts.map +1 -0
- package/dest/fixtures/timing.js +72 -0
- package/dest/fixtures/token_utils.d.ts +22 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +26 -8
- package/dest/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- package/dest/fixtures/wait_helpers.d.ts +135 -0
- package/dest/fixtures/wait_helpers.d.ts.map +1 -0
- package/dest/fixtures/wait_helpers.js +154 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/multi-node/block-production/setup.d.ts +97 -0
- package/dest/multi-node/block-production/setup.d.ts.map +1 -0
- package/dest/multi-node/block-production/setup.js +158 -0
- package/dest/multi-node/governance/setup.d.ts +67 -0
- package/dest/multi-node/governance/setup.d.ts.map +1 -0
- package/dest/multi-node/governance/setup.js +126 -0
- package/dest/multi-node/multi_node_test_context.d.ts +212 -0
- package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
- package/dest/multi-node/multi_node_test_context.js +347 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/inactivity_setup.js +111 -0
- package/dest/multi-node/slashing/setup.d.ts +167 -0
- package/dest/multi-node/slashing/setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/setup.js +275 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +21 -11
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +97 -37
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/reqresp/utils.js +67 -27
- package/dest/p2p/shared.d.ts +72 -0
- package/dest/p2p/shared.d.ts.map +1 -0
- package/dest/p2p/shared.js +212 -0
- package/dest/shared/cross_chain_test_harness.d.ts +6 -4
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +36 -31
- package/dest/shared/gas_portal_test_harness.d.ts +8 -5
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +26 -14
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +12 -5
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +365 -0
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +55 -45
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/lending_simulator.d.ts +10 -3
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +27 -15
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
- package/dest/single-node/fees/fees_test.d.ts +93 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/fees_test.js +89 -63
- 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 +11 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +121 -46
- package/dest/spartan/tx_metrics.d.ts +27 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +106 -21
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +10 -30
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +3 -1
- package/dest/spartan/utils/index.d.ts +4 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +5 -1
- package/dest/spartan/utils/k8s.d.ts +3 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +6 -0
- package/dest/spartan/utils/nodes.d.ts +4 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +11 -11
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +48 -25
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +197 -91
- package/dest/test-wallet/utils.d.ts +38 -3
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +65 -10
- package/dest/test-wallet/wallet_worker_script.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 +50 -47
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
- package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +44 -63
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +43 -58
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +21 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +102 -64
- package/src/bench/client_flows/data_extractor.ts +1 -0
- package/src/bench/utils.ts +116 -7
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +97 -93
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +110 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +14 -6
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +406 -351
- package/src/fixtures/setup_p2p_test.ts +23 -27
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +42 -7
- package/src/fixtures/utils.ts +2 -3
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +106 -0
- package/src/guides/up_quick_start.sh +5 -2
- 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/{e2e_p2p → p2p}/p2p_network.ts +116 -47
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +82 -26
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +42 -17
- package/src/shared/gas_portal_test_harness.ts +33 -15
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +13 -5
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +98 -54
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +33 -15
- package/src/simulators/token_simulator.ts +6 -2
- 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 +19 -5
- package/src/{e2e_fees → single-node/fees}/fees_test.ts +114 -70
- 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 +165 -41
- package/src/spartan/tx_metrics.ts +108 -24
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +2 -0
- package/src/spartan/utils/index.ts +7 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/spartan/utils/nodes.ts +17 -12
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +228 -107
- package/src/test-wallet/utils.ts +104 -11
- 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 -55
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -129
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -50
- package/dest/e2e_epochs/epochs_test.d.ts +0 -100
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -367
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -88
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -56
- package/dest/e2e_multi_validator/utils.d.ts +0 -12
- package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -56
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +0 -136
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.d.ts +0 -46
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -181
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -193
- package/src/e2e_deploy_contract/deploy_test.ts +0 -85
- package/src/e2e_epochs/epochs_test.ts +0 -487
- package/src/e2e_l1_publisher/write_json.ts +0 -77
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -73
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
- package/src/e2e_p2p/shared.ts +0 -290
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
- /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
- /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
|
@@ -1,27 +1,44 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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 { NO_FROM } from '@aztec/aztec.js/account';
|
|
5
6
|
import { SetPublicAuthwitContractInteraction, computeInnerAuthWitHashFromAction, isContractFunctionInteractionCallIntent, lookupValidity } from '@aztec/aztec.js/authorization';
|
|
7
|
+
import { ContractFunctionInteraction } from '@aztec/aztec.js/contracts';
|
|
6
8
|
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
9
|
+
import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
|
|
10
|
+
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
7
11
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
8
12
|
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
9
13
|
import { getPXEConfig } from '@aztec/pxe/config';
|
|
10
14
|
import { createPXE } from '@aztec/pxe/server';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
15
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
16
|
+
import { SimulationOverrides } from '@aztec/stdlib/tx';
|
|
14
17
|
import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
15
18
|
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
19
|
+
import { DEFAULT_MIN_FEE_PADDING } from '../fixtures/fixtures.js';
|
|
16
20
|
import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
17
21
|
/**
|
|
18
22
|
* Wallet implementation that stores accounts in memory and provides extra debugging
|
|
19
23
|
* utilities
|
|
20
24
|
* It is intended to be used in e2e tests.
|
|
21
|
-
*/
|
|
25
|
+
*/ /**
|
|
26
|
+
* Poll interval (in seconds) for in-process TestWallet tx waits. In-process nodes reach CHECKPOINTED synchronously
|
|
27
|
+
* under automine and cheaply otherwise, so a sub-second cadence removes almost-pure dead time from every send().wait().
|
|
28
|
+
* Spartan tests run against remote JSON-RPC nodes and restore the 1s default via setDefaultWaitInterval.
|
|
29
|
+
*/ export const IN_PROCESS_WAIT_INTERVAL_SECONDS = 0.25;
|
|
30
|
+
export class TestWallet extends BaseWallet {
|
|
22
31
|
nodeRef;
|
|
23
32
|
constructor(pxe, nodeRef){
|
|
24
|
-
super(pxe, nodeRef), this.nodeRef = nodeRef, this.accounts = new Map(), this.
|
|
33
|
+
super(pxe, nodeRef), this.nodeRef = nodeRef, this.stubClassIds = new Map(), this.accounts = new Map(), this.simulationMode = 'kernelless';
|
|
34
|
+
this.minFeePadding = DEFAULT_MIN_FEE_PADDING;
|
|
35
|
+
this.defaultWaitInterval = IN_PROCESS_WAIT_INTERVAL_SECONDS;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Overrides the poll interval (in seconds) used when a send().wait() caller does not specify one. Pass `undefined`
|
|
39
|
+
* to fall back to the DefaultWaitOpts cadence. Spartan tests set this to 1 so they do not hammer remote nodes.
|
|
40
|
+
*/ setDefaultWaitInterval(interval) {
|
|
41
|
+
this.defaultWaitInterval = interval;
|
|
25
42
|
}
|
|
26
43
|
static async create(node, overridePXEConfig, options = {
|
|
27
44
|
loggers: {}
|
|
@@ -32,7 +49,9 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
|
32
49
|
...overridePXEConfig
|
|
33
50
|
});
|
|
34
51
|
const pxe = await createPXE(nodeRef, pxeConfig, options);
|
|
35
|
-
|
|
52
|
+
const wallet = new TestWallet(pxe, nodeRef);
|
|
53
|
+
await wallet.initStubClasses();
|
|
54
|
+
return wallet;
|
|
36
55
|
}
|
|
37
56
|
/**
|
|
38
57
|
* Updates the underlying node that this wallet and its PXE communicate with.
|
|
@@ -41,95 +60,150 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
|
41
60
|
this.nodeRef.updateTargetNode(node);
|
|
42
61
|
}
|
|
43
62
|
createSchnorrAccount(secret, salt, signingKey) {
|
|
44
|
-
|
|
45
|
-
const accountData = {
|
|
63
|
+
return this.createAccount({
|
|
46
64
|
secret,
|
|
47
65
|
salt,
|
|
66
|
+
type: 'schnorr',
|
|
48
67
|
contract: new SchnorrAccountContract(signingKey)
|
|
49
|
-
};
|
|
50
|
-
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
createSchnorrInitializerlessAccount(secret, salt, signingKey) {
|
|
71
|
+
return this.createAccount({
|
|
72
|
+
secret,
|
|
73
|
+
salt,
|
|
74
|
+
type: 'schnorr_initializerless',
|
|
75
|
+
contract: new SchnorrInitializerlessAccountContract(signingKey)
|
|
76
|
+
});
|
|
51
77
|
}
|
|
52
78
|
createECDSARAccount(secret, salt, signingKey) {
|
|
53
|
-
|
|
79
|
+
return this.createAccount({
|
|
54
80
|
secret,
|
|
55
81
|
salt,
|
|
82
|
+
type: 'ecdsasecp256r1',
|
|
56
83
|
contract: new EcdsaRAccountContract(signingKey)
|
|
57
|
-
};
|
|
58
|
-
return this.createAccount(accountData);
|
|
84
|
+
});
|
|
59
85
|
}
|
|
60
86
|
createECDSAKAccount(secret, salt, signingKey) {
|
|
61
|
-
|
|
87
|
+
return this.createAccount({
|
|
62
88
|
secret,
|
|
63
89
|
salt,
|
|
90
|
+
type: 'ecdsasecp256k1',
|
|
64
91
|
contract: new EcdsaKAccountContract(signingKey)
|
|
65
|
-
};
|
|
66
|
-
return this.createAccount(accountData);
|
|
92
|
+
});
|
|
67
93
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
94
|
+
// Stub class ids, populated on wallet startup
|
|
95
|
+
// to avoid redundant work per simulation
|
|
96
|
+
stubClassIds;
|
|
97
|
+
/**
|
|
98
|
+
* Hashes and registers the stub class for every supported account type with PXE, populating
|
|
99
|
+
* stubClassIds. Called on wallet initialization.
|
|
100
|
+
*/ async initStubClasses() {
|
|
101
|
+
const { id: schnorrClassId } = await getContractClassFromArtifact(StubSchnorrAccountContractArtifact);
|
|
102
|
+
await this.pxe.registerContractClass(StubSchnorrAccountContractArtifact);
|
|
103
|
+
// ecdsa stubs share the same class id
|
|
104
|
+
const { id: ecdsaClassId } = await getContractClassFromArtifact(StubEcdsaAccountContractArtifact);
|
|
105
|
+
await this.pxe.registerContractClass(StubEcdsaAccountContractArtifact);
|
|
106
|
+
this.stubClassIds.set('schnorr', schnorrClassId);
|
|
107
|
+
// Initializerless accounts share the schnorr stub class for kernelless simulation.
|
|
108
|
+
this.stubClassIds.set('schnorr_initializerless', schnorrClassId);
|
|
109
|
+
this.stubClassIds.set('ecdsasecp256k1', ecdsaClassId);
|
|
110
|
+
this.stubClassIds.set('ecdsasecp256r1', ecdsaClassId);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Builds contract overrides for all provided addresses by replacing their account contracts with stub implementations.
|
|
114
|
+
*/ async buildAccountOverrides(addresses) {
|
|
115
|
+
const accounts = await this.getAccounts();
|
|
116
|
+
const contracts = {};
|
|
117
|
+
const filtered = accounts.filter((acc)=>addresses.some((addr)=>addr.equals(acc.item)));
|
|
118
|
+
for (const account of filtered){
|
|
119
|
+
const address = account.item;
|
|
120
|
+
const originalAccount = await this.getAccountFromAddress(address);
|
|
121
|
+
const completeAddress = originalAccount.getCompleteAddress();
|
|
122
|
+
const contractInstance = await this.pxe.getContractInstance(completeAddress.address);
|
|
123
|
+
if (!contractInstance) {
|
|
124
|
+
throw new Error(`No contract instance found for address: ${completeAddress.address} during account override building. This is a bug!`);
|
|
125
|
+
}
|
|
126
|
+
const type = this.getTypeFor(address);
|
|
127
|
+
const stubClassId = this.stubClassIds.get(type);
|
|
128
|
+
if (!stubClassId) {
|
|
129
|
+
throw new Error(`Stub class for account type '${type}' was not registered at wallet init. This is a bug — initStubClasses should cover every supported AccountType.`);
|
|
130
|
+
}
|
|
131
|
+
contracts[address.toString()] = {
|
|
132
|
+
instance: {
|
|
133
|
+
...contractInstance,
|
|
134
|
+
currentContractClassId: stubClassId
|
|
135
|
+
}
|
|
136
|
+
};
|
|
77
137
|
}
|
|
78
|
-
|
|
79
|
-
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
80
|
-
salt: Fr.random()
|
|
81
|
-
});
|
|
82
|
-
return {
|
|
83
|
-
account: stubAccount,
|
|
84
|
-
instance,
|
|
85
|
-
artifact: StubAccountContractArtifact
|
|
86
|
-
};
|
|
138
|
+
return contracts;
|
|
87
139
|
}
|
|
88
140
|
accounts;
|
|
141
|
+
getTypeFor(address) {
|
|
142
|
+
return this.accounts.get(address.toString())?.type ?? 'schnorr';
|
|
143
|
+
}
|
|
144
|
+
getStubAccountFor(address, completeAddress) {
|
|
145
|
+
const type = this.getTypeFor(address);
|
|
146
|
+
return type === 'schnorr' || type === 'schnorr_initializerless' ? createStubSchnorrAccount(completeAddress) : createStubEcdsaAccount(completeAddress);
|
|
147
|
+
}
|
|
89
148
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
enableSimulatedSimulations() {
|
|
98
|
-
this.simulatedSimulations = true;
|
|
99
|
-
}
|
|
100
|
-
disableSimulatedSimulations() {
|
|
101
|
-
this.simulatedSimulations = false;
|
|
149
|
+
* Controls how the test wallet simulates transactions:
|
|
150
|
+
* - `kernelless`: Skips kernel circuits but uses the real account contract. Default.
|
|
151
|
+
* - `kernelless-override`: Skips kernels and replaces the account with a stub that doesn't do authwit validation.
|
|
152
|
+
* - `full`: Uses real kernel circuits and real account contracts. Slow!
|
|
153
|
+
*/ simulationMode;
|
|
154
|
+
setSimulationMode(mode) {
|
|
155
|
+
this.simulationMode = mode;
|
|
102
156
|
}
|
|
103
157
|
setMinFeePadding(value) {
|
|
104
|
-
this.minFeePadding = value ??
|
|
158
|
+
this.minFeePadding = value ?? DEFAULT_MIN_FEE_PADDING;
|
|
105
159
|
}
|
|
106
160
|
getAccountFromAddress(address) {
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
account = new SignerlessAccount();
|
|
110
|
-
} else {
|
|
111
|
-
account = this.accounts.get(address?.toString() ?? '');
|
|
112
|
-
}
|
|
113
|
-
if (!account) {
|
|
161
|
+
const entry = this.accounts.get(address?.toString() ?? '');
|
|
162
|
+
if (!entry) {
|
|
114
163
|
throw new Error(`Account not found in wallet for address: ${address}`);
|
|
115
164
|
}
|
|
116
|
-
return Promise.resolve(account);
|
|
165
|
+
return Promise.resolve(entry.account);
|
|
117
166
|
}
|
|
118
167
|
getAccounts() {
|
|
119
|
-
return Promise.resolve(Array.from(this.accounts.values()).map((
|
|
168
|
+
return Promise.resolve(Array.from(this.accounts.values()).map((entry)=>({
|
|
120
169
|
alias: '',
|
|
121
|
-
item:
|
|
170
|
+
item: entry.account.getAddress()
|
|
122
171
|
})));
|
|
123
172
|
}
|
|
124
173
|
async createAccount(accountData) {
|
|
125
174
|
const secret = accountData?.secret ?? Fr.random();
|
|
126
175
|
const salt = accountData?.salt ?? Fr.random();
|
|
176
|
+
const type = accountData?.type ?? 'schnorr';
|
|
127
177
|
const contract = accountData?.contract ?? new SchnorrAccountContract(GrumpkinScalar.random());
|
|
128
|
-
|
|
178
|
+
// Initializerless accounts have no deployment tx: the address commits to the signing public key
|
|
179
|
+
// (via the contract's immutablesHash, resolved by AccountManager.create) and the constructor's
|
|
180
|
+
// storage writes are materialized locally via a simulated "store" call below.
|
|
181
|
+
// Mirrors EmbeddedWallet.createAccountInternal.
|
|
182
|
+
const accountManager = await AccountManager.create(this, secret, contract, {
|
|
183
|
+
salt
|
|
184
|
+
});
|
|
129
185
|
const instance = accountManager.getInstance();
|
|
130
186
|
const artifact = await contract.getContractArtifact();
|
|
131
187
|
await this.registerContract(instance, artifact, secret);
|
|
132
|
-
|
|
188
|
+
const address = accountManager.address.toString();
|
|
189
|
+
this.accounts.set(address, {
|
|
190
|
+
account: await accountManager.getAccount(),
|
|
191
|
+
type
|
|
192
|
+
});
|
|
193
|
+
if (contract instanceof SchnorrInitializerlessAccountContract) {
|
|
194
|
+
const constructorAbi = artifact.functions.find((f)=>f.name === 'constructor');
|
|
195
|
+
if (!constructorAbi) {
|
|
196
|
+
throw new Error('Could not create SchnorrInitializerlessAccount: constructor ABI not found');
|
|
197
|
+
}
|
|
198
|
+
const { x, y } = await contract.getSigningPublicKey();
|
|
199
|
+
const storeCall = new ContractFunctionInteraction(this, instance.address, constructorAbi, [
|
|
200
|
+
x,
|
|
201
|
+
y
|
|
202
|
+
]);
|
|
203
|
+
await storeCall.simulate({
|
|
204
|
+
from: instance.address
|
|
205
|
+
});
|
|
206
|
+
}
|
|
133
207
|
return accountManager;
|
|
134
208
|
}
|
|
135
209
|
lookupValidity(onBehalfOf, intent, witness) {
|
|
@@ -154,46 +228,71 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
|
154
228
|
}
|
|
155
229
|
return account.createAuthWit(intentInnerHash, chainInfo);
|
|
156
230
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return super.simulateViaEntrypoint(executionPayload, from, feeOptions, skipTxValidation, skipFeeEnforcement, scopes);
|
|
163
|
-
}
|
|
231
|
+
async simulateViaEntrypoint(executionPayload, opts) {
|
|
232
|
+
const { from, feeOptions, additionalScopes, skipTxValidation, skipFeeEnforcement, sendMessagesAs } = opts;
|
|
233
|
+
const scopes = this.scopesFrom(from, additionalScopes ?? [], sendMessagesAs);
|
|
234
|
+
const skipKernels = this.simulationMode !== 'full';
|
|
235
|
+
const useOverride = this.simulationMode === 'kernelless-override';
|
|
164
236
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
165
|
-
const executionOptions = {
|
|
166
|
-
txNonce: Fr.random(),
|
|
167
|
-
cancellable: this.cancellableTransactions,
|
|
168
|
-
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
|
|
169
|
-
};
|
|
170
237
|
const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
|
|
171
238
|
feeExecutionPayload,
|
|
172
239
|
executionPayload
|
|
173
240
|
]) : executionPayload;
|
|
174
|
-
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
175
241
|
const chainInfo = await this.getChainInfo();
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
242
|
+
let overrides = opts.overrides;
|
|
243
|
+
let txRequest;
|
|
244
|
+
if (useOverride) {
|
|
245
|
+
const accountOverrides = await this.buildAccountOverrides(scopes);
|
|
246
|
+
overrides = new SimulationOverrides({
|
|
247
|
+
publicStorage: overrides?.publicStorage,
|
|
248
|
+
contracts: {
|
|
249
|
+
...overrides?.contracts,
|
|
250
|
+
...accountOverrides
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
if (from === NO_FROM) {
|
|
255
|
+
const entrypoint = new DefaultEntrypoint();
|
|
256
|
+
txRequest = await entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
|
|
257
|
+
} else {
|
|
258
|
+
let fromAccount;
|
|
259
|
+
if (useOverride) {
|
|
260
|
+
const originalAccount = await this.getAccountFromAddress(from);
|
|
261
|
+
fromAccount = this.getStubAccountFor(from, originalAccount.getCompleteAddress());
|
|
262
|
+
} else {
|
|
263
|
+
fromAccount = await this.getAccountFromAddress(from);
|
|
181
264
|
}
|
|
182
|
-
|
|
183
|
-
|
|
265
|
+
const executionOptions = {
|
|
266
|
+
txNonce: Fr.random(),
|
|
267
|
+
cancellable: this.cancellableTransactions,
|
|
268
|
+
// If from is an address, feeOptions include the way the account contract should handle the fee payment
|
|
269
|
+
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
|
|
270
|
+
};
|
|
271
|
+
txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
272
|
+
}
|
|
273
|
+
const result = await this.pxe.simulateTx(txRequest, {
|
|
184
274
|
simulatePublic: true,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
275
|
+
skipKernels,
|
|
276
|
+
skipFeeEnforcement,
|
|
277
|
+
skipTxValidation,
|
|
278
|
+
overrides,
|
|
279
|
+
scopes,
|
|
280
|
+
senderForTags: this.senderForTagsFrom(from, sendMessagesAs)
|
|
191
281
|
});
|
|
282
|
+
const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
|
|
283
|
+
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
192
284
|
}
|
|
193
285
|
async proveTx(exec, opts) {
|
|
194
|
-
const fee = await this.completeFeeOptions(
|
|
286
|
+
const fee = await this.completeFeeOptions({
|
|
287
|
+
from: opts.from,
|
|
288
|
+
feePayer: exec.feePayer,
|
|
289
|
+
gasSettings: opts.fee?.gasSettings
|
|
290
|
+
});
|
|
195
291
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
196
|
-
const txProvingResult = await this.pxe.proveTx(txRequest,
|
|
292
|
+
const txProvingResult = await this.pxe.proveTx(txRequest, {
|
|
293
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes ?? [], opts.sendMessagesAs),
|
|
294
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
|
|
295
|
+
});
|
|
197
296
|
return new ProvenTx(this.aztecNode, await txProvingResult.toTx(), txProvingResult.getOffchainEffects(), txProvingResult.stats);
|
|
198
297
|
}
|
|
199
298
|
getTxReceipt(txHash) {
|
|
@@ -206,7 +305,14 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
|
206
305
|
return this.pxe.getSyncedBlockHeader();
|
|
207
306
|
}
|
|
208
307
|
sync() {
|
|
209
|
-
return this.pxe.
|
|
308
|
+
return this.pxe.sync();
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Registers a non-sender tagging-secret source (e.g. a raw out-of-band shared secret) so this PXE discovers messages
|
|
312
|
+
* tagged with it. Test-only surface over {@link PXE.registerTaggingSecretSource}, which the base `Wallet` does not
|
|
313
|
+
* expose. The `address-derived` (sender) variant is excluded: use {@link Wallet.registerSender} for that.
|
|
314
|
+
*/ registerTaggingSecretSource(source) {
|
|
315
|
+
return this.pxe.registerTaggingSecretSource(source);
|
|
210
316
|
}
|
|
211
317
|
stop() {
|
|
212
318
|
return this.pxe.stop();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { BatchCall, ContractFunctionInteraction, DeployMethod, type DeployOptions, type NoWait, type SendInteractionOptions, type WaitOpts } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import { type AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
3
5
|
import { type OffchainEffect, type ProvingStats, Tx, TxHash, type TxReceipt } from '@aztec/stdlib/tx';
|
|
4
6
|
import type { TestWallet } from './test_wallet.js';
|
|
5
7
|
export type ProvenTxSendOpts = {
|
|
@@ -15,9 +17,42 @@ export declare class ProvenTx extends Tx {
|
|
|
15
17
|
send<W extends ProvenTxSendOpts['wait']>(options: ProvenTxSendOpts & {
|
|
16
18
|
wait: W;
|
|
17
19
|
}): Promise<ProvenTxSendReturn<W>>;
|
|
20
|
+
private sendInner;
|
|
18
21
|
private contextualizeError;
|
|
19
22
|
}
|
|
20
|
-
export declare function proveInteraction(wallet: TestWallet, interaction: ContractFunctionInteraction | DeployMethod, options: SendInteractionOptions | DeployOptions): Promise<ProvenTx>;
|
|
23
|
+
export declare function proveInteraction(wallet: TestWallet, interaction: ContractFunctionInteraction | DeployMethod | BatchCall, options: SendInteractionOptions | DeployOptions): Promise<ProvenTx>;
|
|
24
|
+
/** Builds an interaction for index `i` of a batch. */
|
|
25
|
+
export type MakeBatchCall = (i: number) => ContractFunctionInteraction | DeployMethod | BatchCall;
|
|
26
|
+
/**
|
|
27
|
+
* Pre-proves `count` interactions built by `makeCall(i)` against `wallet`, all with the same
|
|
28
|
+
* `options`. Returns the proven txs so the caller can send them individually (e.g. with sleeps
|
|
29
|
+
* between sends, or anchored to intermediate tips). For the common "send the whole batch at once"
|
|
30
|
+
* case use {@link proveAndSendTxs}.
|
|
31
|
+
*/
|
|
32
|
+
export declare function proveTxs(wallet: TestWallet, count: number, makeCall: MakeBatchCall, options: SendInteractionOptions | DeployOptions): Promise<ProvenTx[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Pre-proves `count` interactions built by `makeCall(i)` and sends each one with `NO_WAIT`, all at
|
|
35
|
+
* once. Returns the tx hashes in batch order. Pairs with `waitForTxs` for the "send N, wait for N"
|
|
36
|
+
* arc. Use {@link proveTxs} instead when the sends need bespoke sequencing.
|
|
37
|
+
*/
|
|
38
|
+
export declare function proveAndSendTxs(wallet: TestWallet, count: number, makeCall: MakeBatchCall, options: SendInteractionOptions | DeployOptions): Promise<TxHash[]>;
|
|
39
|
+
/** Options for {@link startMempoolFeeder}. */
|
|
40
|
+
export type MempoolFeederOpts = {
|
|
41
|
+
/** The account the txs are sent from. */
|
|
42
|
+
from: AztecAddress;
|
|
43
|
+
/** Keep the pending-tx count at or above this threshold; defaults to 3. */
|
|
44
|
+
minPending?: number;
|
|
45
|
+
/** Milliseconds between top-up polls; defaults to 1000. */
|
|
46
|
+
intervalMs?: number;
|
|
47
|
+
/** Logger for verbose top-up traces. */
|
|
48
|
+
logger?: Logger;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Starts a background loop that keeps `node`'s mempool topped up: whenever the pending-tx count drops
|
|
52
|
+
* below `opts.minPending`, it proves and sends one interaction built by `makeCall()` (NO_WAIT). Errors
|
|
53
|
+
* are swallowed and retried. Returns an {@link AsyncDisposable}; disposing stops the loop and awaits it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function startMempoolFeeder(wallet: TestWallet, node: AztecNode, makeCall: () => ContractFunctionInteraction | DeployMethod | BatchCall, opts: MempoolFeederOpts): AsyncDisposable;
|
|
21
56
|
/**
|
|
22
57
|
* Extends AztecNode via declaration merging so instances can be used wherever AztecNode is expected.
|
|
23
58
|
* The actual method forwarding is handled by a Proxy in the class constructor.
|
|
@@ -38,4 +73,4 @@ export declare class AztecNodeProxy {
|
|
|
38
73
|
*/
|
|
39
74
|
updateTargetNode(node: AztecNode): void;
|
|
40
75
|
}
|
|
41
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
76
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0LXdhbGxldC91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUM5RCxPQUFPLEVBQ0wsU0FBUyxFQUNULDJCQUEyQixFQUMzQixZQUFZLEVBQ1osS0FBSyxhQUFhLEVBRWxCLEtBQUssTUFBTSxFQUNYLEtBQUssc0JBQXNCLEVBQzNCLEtBQUssUUFBUSxFQUVkLE1BQU0sMkJBQTJCLENBQUM7QUFDbkMsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUFhLE1BQU0sc0JBQXNCLENBQUM7QUFFakUsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHcEQsT0FBTyxFQUFFLEtBQUssY0FBYyxFQUFFLEtBQUssWUFBWSxFQUFFLEVBQUUsRUFBRSxNQUFNLEVBQUUsS0FBSyxTQUFTLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUt0RyxPQUFPLEtBQUssRUF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mLFFBQVEsRUFBRSxNQUFNLDJCQUEyQixHQUFHLFlBQVksR0FBRyxTQUFTLEVBQ3RFLElBQUksRUFBRSxpQkFBaUIsR0FDdEIsZUFBZSxDQTZCakI7QUFFRDs7O0dBR0c7QUFFSCxNQUFNLFdBQVcsY0FBZSxTQUFRLFNBQVM7Q0FBRztBQUVwRDs7OztHQUlHO0FBRUgscUJBQWEsY0FBYztJQUNiLE9BQU8sQ0FBQyxNQUFNO0lBQTFCLFlBQW9CLE1BQU0sRUFBRSxTQUFTLEVBWXBDO0lBRUQ7OztPQUdHO0lBQ0gsZ0JBQWdCLENBQUMsSUFBSSxFQUFFLFNBQVMsR0FBRyxJQUFJLENBRXRDO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test-wallet/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,YAAY,EACZ,KAAK,aAAa,EAElB,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EAEd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test-wallet/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACL,SAAS,EACT,2BAA2B,EAC3B,YAAY,EACZ,KAAK,aAAa,EAElB,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EAEd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,sBAAsB,CAAC;AAEjE,OAAO,K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import { waitForTx } from '@aztec/aztec.js/node';
|
|
3
|
+
import { timesAsync } from '@aztec/foundation/collection';
|
|
4
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
3
5
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
4
6
|
import { Tx } from '@aztec/stdlib/tx';
|
|
5
7
|
import { inspect } from 'util';
|
|
8
|
+
import { testSpan, withTestSpanOwner } from '../fixtures/timing.js';
|
|
6
9
|
export class ProvenTx extends Tx {
|
|
7
10
|
node;
|
|
8
11
|
offchainEffects;
|
|
@@ -10,7 +13,10 @@ export class ProvenTx extends Tx {
|
|
|
10
13
|
constructor(node, tx, offchainEffects, stats){
|
|
11
14
|
super(tx.getTxHash(), tx.data, tx.chonkProof, tx.contractClassLogFields, tx.publicFunctionCalldata), this.node = node, this.offchainEffects = offchainEffects, this.stats = stats;
|
|
12
15
|
}
|
|
13
|
-
|
|
16
|
+
send(options) {
|
|
17
|
+
return testSpan('tx:send', ()=>this.sendInner(options));
|
|
18
|
+
}
|
|
19
|
+
async sendInner(options) {
|
|
14
20
|
const txHash = this.getTxHash();
|
|
15
21
|
await this.node.sendTx(this).catch((err)=>{
|
|
16
22
|
throw this.contextualizeError(err, inspect(this));
|
|
@@ -32,14 +38,63 @@ export class ProvenTx extends Tx {
|
|
|
32
38
|
return err;
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
export function proveInteraction(wallet, interaction, options) {
|
|
42
|
+
return testSpan('tx:prove', async ()=>{
|
|
43
|
+
const execPayload = await interaction.request(options);
|
|
44
|
+
return wallet.proveTx(execPayload, toSendOptions(options));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Pre-proves `count` interactions built by `makeCall(i)` against `wallet`, all with the same
|
|
49
|
+
* `options`. Returns the proven txs so the caller can send them individually (e.g. with sleeps
|
|
50
|
+
* between sends, or anchored to intermediate tips). For the common "send the whole batch at once"
|
|
51
|
+
* case use {@link proveAndSendTxs}.
|
|
52
|
+
*/ export function proveTxs(wallet, count, makeCall, options) {
|
|
53
|
+
return timesAsync(count, (i)=>proveInteraction(wallet, makeCall(i), options));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Pre-proves `count` interactions built by `makeCall(i)` and sends each one with `NO_WAIT`, all at
|
|
57
|
+
* once. Returns the tx hashes in batch order. Pairs with `waitForTxs` for the "send N, wait for N"
|
|
58
|
+
* arc. Use {@link proveTxs} instead when the sends need bespoke sequencing.
|
|
59
|
+
*/ export async function proveAndSendTxs(wallet, count, makeCall, options) {
|
|
60
|
+
const txs = await proveTxs(wallet, count, makeCall, options);
|
|
61
|
+
return Promise.all(txs.map((tx)=>tx.send({
|
|
62
|
+
wait: NO_WAIT
|
|
63
|
+
})));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Starts a background loop that keeps `node`'s mempool topped up: whenever the pending-tx count drops
|
|
67
|
+
* below `opts.minPending`, it proves and sends one interaction built by `makeCall()` (NO_WAIT). Errors
|
|
68
|
+
* are swallowed and retried. Returns an {@link AsyncDisposable}; disposing stops the loop and awaits it.
|
|
69
|
+
*/ export function startMempoolFeeder(wallet, node, makeCall, opts) {
|
|
70
|
+
const minPending = opts.minPending ?? 3;
|
|
71
|
+
const intervalMs = opts.intervalMs ?? 1000;
|
|
72
|
+
let stopped = false;
|
|
73
|
+
// Pin the feeder's prove/send spans to a fixed non-test owner. It runs interleaved with arbitrary
|
|
74
|
+
// tests, so without this its tx:prove/tx:send spans would smear onto whichever test was current
|
|
75
|
+
// when each round fired; the pinned owner matches no test/suite record, excluding them cleanly.
|
|
76
|
+
const loop = withTestSpanOwner('other:mempool-feeder', async ()=>{
|
|
77
|
+
while(!stopped){
|
|
78
|
+
try {
|
|
79
|
+
const pendingCount = await node.getPendingTxCount();
|
|
80
|
+
if (pendingCount < minPending) {
|
|
81
|
+
await proveAndSendTxs(wallet, 1, makeCall, {
|
|
82
|
+
from: opts.from
|
|
83
|
+
});
|
|
84
|
+
opts.logger?.verbose(`Topped up mempool (was ${pendingCount})`);
|
|
85
|
+
}
|
|
86
|
+
} catch (err) {
|
|
87
|
+
opts.logger?.verbose(`Mempool top-up error (will retry): ${err}`);
|
|
88
|
+
}
|
|
89
|
+
await sleep(intervalMs);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
async [Symbol.asyncDispose] () {
|
|
94
|
+
stopped = true;
|
|
95
|
+
await loop;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
43
98
|
}
|
|
44
99
|
/**
|
|
45
100
|
* Mutable wrapper around an AztecNode that forwards all calls to the current target.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet_worker_script.d.ts","sourceRoot":"","sources":["../../src/test-wallet/wallet_worker_script.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DefaultWaitOpts } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
3
|
+
import { BackendType, BarretenbergSync } from '@aztec/bb.js';
|
|
4
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
5
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
+
import { getSchemaParameters, parseWithOptionals, schemaHasMethod } from '@aztec/foundation/schemas';
|
|
7
|
+
import { NodeListener, TransportServer } from '@aztec/foundation/transport';
|
|
8
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
9
|
+
import { workerData } from 'worker_threads';
|
|
10
|
+
import { TestWallet } from './test_wallet.js';
|
|
11
|
+
import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
12
|
+
const logger = createLogger('e2e:test-wallet:worker');
|
|
13
|
+
try {
|
|
14
|
+
const { nodeUrl, pxeConfig } = workerData;
|
|
15
|
+
logger.info('Initializing worker wallet', {
|
|
16
|
+
nodeUrl
|
|
17
|
+
});
|
|
18
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
19
|
+
// Worker sync bb use is limited to crypto and proof serialization helpers.
|
|
20
|
+
await BarretenbergSync.initSingleton({
|
|
21
|
+
backend: BackendType.Wasm
|
|
22
|
+
});
|
|
23
|
+
const wallet = await TestWallet.create(node, pxeConfig);
|
|
24
|
+
// Worker wallets are only used by spartan tests against remote JSON-RPC nodes: keep the 1s poll cadence.
|
|
25
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
26
|
+
logger.info('Worker wallet initialized');
|
|
27
|
+
const customMethods = {
|
|
28
|
+
proveTx: async (exec, opts)=>{
|
|
29
|
+
const provenTx = await wallet.proveTx(exec, opts);
|
|
30
|
+
return new Tx(provenTx.getTxHash(), provenTx.data, provenTx.chonkProof, provenTx.contractClassLogFields, provenTx.publicFunctionCalldata);
|
|
31
|
+
},
|
|
32
|
+
registerAccount: async (secret, salt, signingKey)=>{
|
|
33
|
+
const manager = await wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
34
|
+
return manager.address;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const schema = WorkerWalletSchema;
|
|
38
|
+
const listener = new NodeListener();
|
|
39
|
+
const server = new TransportServer(listener, async (msg)=>{
|
|
40
|
+
if (!schemaHasMethod(schema, msg.fn)) {
|
|
41
|
+
throw new Error(`Unknown method: ${msg.fn}`);
|
|
42
|
+
}
|
|
43
|
+
const jsonParams = JSON.parse(msg.args);
|
|
44
|
+
const args = await parseWithOptionals(jsonParams, getSchemaParameters(schema[msg.fn]));
|
|
45
|
+
// we have to erase the fn type in order to be able to spread ...args
|
|
46
|
+
const handler = msg.fn in customMethods ? customMethods[msg.fn] : undefined;
|
|
47
|
+
const result = handler ? await handler(...args) : await wallet[msg.fn](...args);
|
|
48
|
+
return jsonStringify(result);
|
|
49
|
+
});
|
|
50
|
+
server.start();
|
|
51
|
+
} catch (err) {
|
|
52
|
+
logger.error('Worker wallet initialization failed', {
|
|
53
|
+
error: err instanceof Error ? err.stack : String(err)
|
|
54
|
+
});
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|