@aztec/end-to-end 0.0.1-commit.f2ce05ee → 0.0.1-commit.f5a9928
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +229 -14
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +45 -48
- package/dest/automine/token/token_contract_test.d.ts +40 -0
- package/dest/automine/token/token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +43 -48
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +19 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +65 -56
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +102 -8
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +18 -14
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +83 -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 +120 -60
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +332 -327
- 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/standard_contracts_genesis.d.ts +16 -0
- package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
- package/dest/fixtures/standard_contracts_genesis.js +25 -0
- package/dest/fixtures/timing.d.ts +42 -0
- package/dest/fixtures/timing.d.ts.map +1 -0
- package/dest/fixtures/timing.js +72 -0
- package/dest/fixtures/token_utils.d.ts +22 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +26 -8
- package/dest/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- package/dest/fixtures/wait_helpers.d.ts +135 -0
- package/dest/fixtures/wait_helpers.d.ts.map +1 -0
- package/dest/fixtures/wait_helpers.js +154 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +13 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/multi-node/block-production/setup.d.ts +97 -0
- package/dest/multi-node/block-production/setup.d.ts.map +1 -0
- package/dest/multi-node/block-production/setup.js +158 -0
- package/dest/multi-node/governance/setup.d.ts +67 -0
- package/dest/multi-node/governance/setup.d.ts.map +1 -0
- package/dest/multi-node/governance/setup.js +126 -0
- package/dest/multi-node/multi_node_test_context.d.ts +212 -0
- package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
- package/dest/multi-node/multi_node_test_context.js +347 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/inactivity_setup.js +111 -0
- package/dest/multi-node/slashing/setup.d.ts +167 -0
- package/dest/multi-node/slashing/setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/setup.js +275 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +22 -12
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +98 -37
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/{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 +44 -32
- package/dest/shared/gas_portal_test_harness.d.ts +8 -5
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +26 -14
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +2 -2
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +12 -5
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +365 -0
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +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 +3 -24
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
- package/dest/single-node/fees/fees_test.d.ts +95 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/single-node/fees/fees_test.js +347 -0
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +374 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +847 -0
- package/dest/spartan/setup_test_wallets.d.ts +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +124 -47
- package/dest/spartan/tx_metrics.d.ts +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/gossip_metrics.d.ts +9 -0
- package/dest/spartan/utils/gossip_metrics.d.ts.map +1 -0
- package/dest/spartan/utils/gossip_metrics.js +77 -0
- package/dest/spartan/utils/index.d.ts +5 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +7 -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 +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 +51 -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 +51 -61
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +50 -56
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +21 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +106 -72
- package/src/bench/utils.ts +117 -8
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +101 -95
- 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 +436 -442
- package/src/fixtures/setup_p2p_test.ts +23 -27
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +42 -7
- package/src/fixtures/utils.ts +2 -3
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +106 -0
- package/src/guides/up_quick_start.sh +7 -4
- package/src/infra/README.md +12 -0
- package/src/install_legacy_contracts.cjs +81 -0
- package/src/legacy-jest-resolver.cjs +98 -0
- package/src/multi-node/README.md +96 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +124 -53
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +86 -30
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +44 -21
- package/src/shared/gas_portal_test_harness.ts +33 -15
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +15 -6
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +99 -55
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +33 -15
- package/src/simulators/token_simulator.ts +6 -30
- package/src/single-node/README.md +66 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
- package/src/single-node/fees/fees_test.ts +437 -0
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1058 -0
- package/src/spartan/setup_test_wallets.ts +168 -42
- 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/gossip_metrics.ts +108 -0
- package/src/spartan/utils/index.ts +10 -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 +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 -53
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -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 -362
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -88
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.js +0 -248
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -56
- package/dest/e2e_multi_validator/utils.d.ts +0 -12
- package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -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 -180
- 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 -42
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -193
- package/src/e2e_deploy_contract/deploy_test.ts +0 -85
- package/src/e2e_epochs/epochs_test.ts +0 -478
- package/src/e2e_fees/fees_test.ts +0 -339
- 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 -289
- /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
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
4
|
+
import { INITIAL_L2_BLOCK_NUM } from '@aztec/aztec.js/protocol';
|
|
5
|
+
import type { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
6
|
+
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
7
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
8
|
+
import type { Sequencer, SequencerEvents, SequencerState } from '@aztec/sequencer-client';
|
|
9
|
+
import type { L2BlockTag } from '@aztec/stdlib/block';
|
|
10
|
+
import type { AztecNode, CheckpointTag } from '@aztec/stdlib/interfaces/client';
|
|
11
|
+
import type { L2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
|
|
12
|
+
import type { TxHash, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
13
|
+
|
|
14
|
+
import { testSpan } from './timing.js';
|
|
15
|
+
|
|
16
|
+
/** Options for the block-number polling helpers. */
|
|
17
|
+
export type WaitForBlockOpts = {
|
|
18
|
+
/** Which chain tip to read; defaults to 'proposed'. */
|
|
19
|
+
tag?: L2BlockTag;
|
|
20
|
+
/** How the node's block number must relate to `target`; defaults to `(actual, target) => actual >= target`. */
|
|
21
|
+
compare?: (actual: number, target: number) => boolean;
|
|
22
|
+
/** Seconds before the poll rejects; defaults to 60. */
|
|
23
|
+
timeout?: number;
|
|
24
|
+
/** Seconds between polls; defaults to 0.25. */
|
|
25
|
+
interval?: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Polls `node.getBlockNumber(tag)` until `opts.compare(actual, target)` holds (default `>=`). Replaces
|
|
30
|
+
* the ad-hoc `retryUntil(() => node.getBlockNumber(tag) <op> target)` polls scattered across the suite,
|
|
31
|
+
* where the node may sync forward or prune backward — the caller passes the comparator for whichever it
|
|
32
|
+
* expects.
|
|
33
|
+
* @returns The block number once the comparison holds.
|
|
34
|
+
*/
|
|
35
|
+
export function waitForBlockNumber(node: AztecNode, target: number, opts: WaitForBlockOpts = {}): Promise<BlockNumber> {
|
|
36
|
+
const tag = opts.tag ?? 'proposed';
|
|
37
|
+
const compare = opts.compare ?? ((actual, target) => actual >= target);
|
|
38
|
+
return testSpan(`wait:${tag}`, () =>
|
|
39
|
+
// Wrap the matched value: retryUntil treats any falsy return as "keep polling", so a legitimate
|
|
40
|
+
// match of block 0 (e.g. a freshly-pruned tip) would otherwise loop until timeout.
|
|
41
|
+
retryUntil(
|
|
42
|
+
async () => {
|
|
43
|
+
const blockNumber = await node.getBlockNumber(tag);
|
|
44
|
+
return compare(blockNumber, target) ? { blockNumber } : undefined;
|
|
45
|
+
},
|
|
46
|
+
`block ${tag} ${compare} ${target}`,
|
|
47
|
+
opts.timeout ?? 60,
|
|
48
|
+
opts.interval ?? 0.25,
|
|
49
|
+
).then(({ blockNumber }) => blockNumber),
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Convenience for {@link waitForBlockNumber} on the proven tip. */
|
|
54
|
+
export function waitForProvenBlock(
|
|
55
|
+
node: AztecNode,
|
|
56
|
+
target: number,
|
|
57
|
+
opts: Omit<WaitForBlockOpts, 'tag'> = {},
|
|
58
|
+
): Promise<BlockNumber> {
|
|
59
|
+
return waitForBlockNumber(node, target, { ...opts, tag: 'proven' });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Compares the node's checkpoint number against the target; defaults to `>=`. */
|
|
63
|
+
export type CheckpointComparator = (actual: number, target: number) => boolean;
|
|
64
|
+
|
|
65
|
+
/** Options for {@link waitForNodeCheckpoint}. */
|
|
66
|
+
export type WaitForCheckpointOpts = {
|
|
67
|
+
/** Which checkpoint tip to read; defaults to 'checkpointed'. */
|
|
68
|
+
tag?: CheckpointTag;
|
|
69
|
+
/** How the node's checkpoint number must relate to `target`; defaults to `(actual, target) => actual >= target`. */
|
|
70
|
+
compare?: CheckpointComparator;
|
|
71
|
+
/** Seconds before the poll rejects; defaults to 30. */
|
|
72
|
+
timeout?: number;
|
|
73
|
+
/** Seconds between polls; defaults to 0.5. */
|
|
74
|
+
interval?: number;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Polls a single node's checkpoint number until `opts.compare(actual, target)` holds. Replaces the
|
|
79
|
+
* `retryUntil(() => node.getChainTips().then(tips => tips.<tag>.checkpoint.number <op> target))` polls
|
|
80
|
+
* duplicated across the reorg/proving tests, where the node may sync forward, prune backward, or land
|
|
81
|
+
* exactly on a value — the caller passes the comparator lambda for whichever it expects.
|
|
82
|
+
* @returns The node's checkpoint number once the comparison holds.
|
|
83
|
+
*/
|
|
84
|
+
export function waitForNodeCheckpoint(
|
|
85
|
+
node: AztecNode,
|
|
86
|
+
target: number,
|
|
87
|
+
opts: WaitForCheckpointOpts = {},
|
|
88
|
+
): Promise<CheckpointNumber> {
|
|
89
|
+
const tag = opts.tag ?? 'checkpointed';
|
|
90
|
+
const compare = opts.compare ?? ((actual, target) => actual >= target);
|
|
91
|
+
return testSpan(tag === 'proven' ? 'wait:proven-checkpoint' : 'wait:checkpoint', () =>
|
|
92
|
+
// Wrap the matched value: retryUntil treats any falsy return as "keep polling", so a legitimate
|
|
93
|
+
// match of checkpoint 0 (e.g. proven === 0 or checkpointed <= 1 after a prune) would otherwise
|
|
94
|
+
// loop until timeout instead of resolving.
|
|
95
|
+
retryUntil(
|
|
96
|
+
async () => {
|
|
97
|
+
const checkpointNumber = await node.getCheckpointNumber(tag);
|
|
98
|
+
return compare(checkpointNumber, target) ? { checkpointNumber } : undefined;
|
|
99
|
+
},
|
|
100
|
+
`node checkpoint ${tag} ${compare} ${target}`,
|
|
101
|
+
opts.timeout ?? 30,
|
|
102
|
+
opts.interval ?? 0.5,
|
|
103
|
+
).then(({ checkpointNumber }) => checkpointNumber),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Convenience for {@link waitForNodeCheckpoint} on the proven tip. */
|
|
108
|
+
export function waitForNodeProvenCheckpoint(
|
|
109
|
+
node: AztecNode,
|
|
110
|
+
target: number,
|
|
111
|
+
opts: Omit<WaitForCheckpointOpts, 'tag'> = {},
|
|
112
|
+
): Promise<CheckpointNumber> {
|
|
113
|
+
return waitForNodeCheckpoint(node, target, { ...opts, tag: 'proven' });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Waits for all of `txHashes` to reach the desired status on `node`. The plural form of
|
|
118
|
+
* {@link waitForTx}; resolves with the receipts in input order.
|
|
119
|
+
*/
|
|
120
|
+
export function waitForTxs(node: AztecNode, txHashes: TxHash[], opts?: WaitOpts): Promise<TxReceipt[]> {
|
|
121
|
+
const optsWithInterval = { ...opts, interval: opts?.interval ?? 0.25 };
|
|
122
|
+
return testSpan('wait:tx-mined', () =>
|
|
123
|
+
Promise.all(txHashes.map(txHash => waitForTx(node, txHash, optsWithInterval))),
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Options for {@link waitForBlocksAtSlots}. */
|
|
128
|
+
export type WaitForBlocksAtSlotsOpts = {
|
|
129
|
+
/** Block number to start scanning from; defaults to the initial L2 block. */
|
|
130
|
+
from?: BlockNumber;
|
|
131
|
+
/** How many blocks to fetch per poll; defaults to 10. */
|
|
132
|
+
limit?: number;
|
|
133
|
+
/** Seconds before the poll rejects; defaults to 20. */
|
|
134
|
+
timeout?: number;
|
|
135
|
+
/** Seconds between polls; defaults to 0.25. */
|
|
136
|
+
interval?: number;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Polls `node.getBlocks` until every slot in `slots` is present among the fetched blocks' slot
|
|
141
|
+
* numbers. Replaces the hand-rolled `retryUntil` over `getBlocks(...).map(getSlot)` membership check.
|
|
142
|
+
*/
|
|
143
|
+
export async function waitForBlocksAtSlots(
|
|
144
|
+
node: AztecNode,
|
|
145
|
+
slots: SlotNumber[],
|
|
146
|
+
opts: WaitForBlocksAtSlotsOpts = {},
|
|
147
|
+
): Promise<void> {
|
|
148
|
+
const from = opts.from ?? INITIAL_L2_BLOCK_NUM;
|
|
149
|
+
const limit = opts.limit ?? 10;
|
|
150
|
+
await testSpan('wait:block', () =>
|
|
151
|
+
retryUntil(
|
|
152
|
+
async () => {
|
|
153
|
+
const blocks = await node.getBlocks(from, limit);
|
|
154
|
+
const foundSlots = blocks.map(block => block.header.getSlot());
|
|
155
|
+
return slots.every(slot => foundSlots.includes(slot)) || undefined;
|
|
156
|
+
},
|
|
157
|
+
`blocks at slots ${slots.join(', ')}`,
|
|
158
|
+
opts.timeout ?? 20,
|
|
159
|
+
opts.interval ?? 0.25,
|
|
160
|
+
),
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Polls `node.getL2ToL1MembershipWitness(txHash, message)` until a witness is available, resolving
|
|
166
|
+
* with it. Wraps the `retryUntil` the cross-chain tests hand-roll while waiting for an L2-to-L1
|
|
167
|
+
* message's membership witness to become provable.
|
|
168
|
+
*/
|
|
169
|
+
export function waitForL2ToL1Witness(
|
|
170
|
+
node: AztecNode,
|
|
171
|
+
txHash: TxHash,
|
|
172
|
+
message: Fr,
|
|
173
|
+
opts: { timeout?: number; interval?: number } = {},
|
|
174
|
+
): Promise<L2ToL1MembershipWitness> {
|
|
175
|
+
return testSpan('wait:l2-to-l1-witness', () =>
|
|
176
|
+
retryUntil(
|
|
177
|
+
() => node.getL2ToL1MembershipWitness(txHash, message),
|
|
178
|
+
`L2-to-L1 membership witness for ${txHash.toString()}`,
|
|
179
|
+
opts.timeout ?? 30,
|
|
180
|
+
opts.interval ?? 0.25,
|
|
181
|
+
),
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Options for the tx-receipt polling helpers. */
|
|
186
|
+
export type WaitForTxReceiptOpts = {
|
|
187
|
+
/** Seconds before the poll rejects; defaults to 30. */
|
|
188
|
+
timeout?: number;
|
|
189
|
+
/** Seconds between polls; defaults to 0.25. */
|
|
190
|
+
interval?: number;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Polls `node.getTxReceipt(txHash)` until `predicate(receipt)` holds, resolving with the receipt.
|
|
195
|
+
* Wraps the `retryUntil` that the block-building reorg tests hand-roll while waiting for a tx to
|
|
196
|
+
* transition between statuses (pruned, re-included, ...).
|
|
197
|
+
* @returns The receipt once the predicate holds.
|
|
198
|
+
*/
|
|
199
|
+
export function waitForTxReceipt(
|
|
200
|
+
node: AztecNode,
|
|
201
|
+
txHash: TxHash,
|
|
202
|
+
predicate: (receipt: TxReceipt) => boolean,
|
|
203
|
+
opts: WaitForTxReceiptOpts = {},
|
|
204
|
+
): Promise<TxReceipt> {
|
|
205
|
+
return testSpan('wait:tx-mined', () =>
|
|
206
|
+
retryUntil(
|
|
207
|
+
async () => {
|
|
208
|
+
const receipt = await node.getTxReceipt(txHash);
|
|
209
|
+
return predicate(receipt) ? { receipt } : undefined;
|
|
210
|
+
},
|
|
211
|
+
`tx receipt for ${txHash.toString()}`,
|
|
212
|
+
opts.timeout ?? 30,
|
|
213
|
+
opts.interval ?? 0.25,
|
|
214
|
+
).then(({ receipt }) => receipt),
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** Polls until `node.getTxReceipt(txHash).status === status`. Thin wrapper over {@link waitForTxReceipt}. */
|
|
219
|
+
export function waitForTxStatus(
|
|
220
|
+
node: AztecNode,
|
|
221
|
+
txHash: TxHash,
|
|
222
|
+
status: TxStatus,
|
|
223
|
+
opts: WaitForTxReceiptOpts = {},
|
|
224
|
+
): Promise<TxReceipt> {
|
|
225
|
+
return waitForTxReceipt(node, txHash, receipt => receipt.status === status, opts);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** Compares the node's pending-tx count against the target; defaults to `>=`. */
|
|
229
|
+
export type PendingTxCountComparator = (actual: number, target: number) => boolean;
|
|
230
|
+
|
|
231
|
+
/** Options for {@link waitForPendingTxCount}. */
|
|
232
|
+
export type WaitForPendingTxCountOpts = {
|
|
233
|
+
/** How the node's pending-tx count must relate to `target`; defaults to `(actual, target) => actual >= target`. */
|
|
234
|
+
compare?: PendingTxCountComparator;
|
|
235
|
+
/** Seconds before the poll rejects; defaults to 30. */
|
|
236
|
+
timeout?: number;
|
|
237
|
+
/** Seconds between polls; defaults to 0.25. */
|
|
238
|
+
interval?: number;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Polls `node.getPendingTxCount()` until `opts.compare(actual, target)` holds (default `>=`).
|
|
243
|
+
* Replaces the hand-rolled mempool-size poll in the slashing tests.
|
|
244
|
+
* @returns The pending-tx count once the comparison holds.
|
|
245
|
+
*/
|
|
246
|
+
export function waitForPendingTxCount(
|
|
247
|
+
node: AztecNode,
|
|
248
|
+
target: number,
|
|
249
|
+
opts: WaitForPendingTxCountOpts = {},
|
|
250
|
+
): Promise<number> {
|
|
251
|
+
const compare = opts.compare ?? ((actual, target) => actual >= target);
|
|
252
|
+
return testSpan('wait:pending-tx', () =>
|
|
253
|
+
// Wrap the matched value: retryUntil treats any falsy return as "keep polling", so a legitimate
|
|
254
|
+
// match of 0 pending txs would otherwise loop until timeout instead of resolving.
|
|
255
|
+
retryUntil(
|
|
256
|
+
async () => {
|
|
257
|
+
const count = await node.getPendingTxCount();
|
|
258
|
+
return compare(count, target) ? { count } : undefined;
|
|
259
|
+
},
|
|
260
|
+
`pending tx count ${compare} ${target}`,
|
|
261
|
+
opts.timeout ?? 30,
|
|
262
|
+
opts.interval ?? 0.25,
|
|
263
|
+
).then(({ count }) => count),
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Options for {@link waitForSequencerState}. */
|
|
268
|
+
export type WaitForSequencerStateOpts = {
|
|
269
|
+
/** Milliseconds before the wait rejects; defaults to 30000. */
|
|
270
|
+
timeout?: number;
|
|
271
|
+
/**
|
|
272
|
+
* Action to run after subscribing to the sequencer but before awaiting the transition. Subscribing
|
|
273
|
+
* first guarantees the state change the action triggers is not missed between the action and the
|
|
274
|
+
* listener attaching.
|
|
275
|
+
*/
|
|
276
|
+
after?: () => unknown;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Resolves once `sequencer` reaches `state`. Subscribes to the `state-changed` event first, then (if
|
|
281
|
+
* `opts.after` is given) runs the action, then resolves immediately if the sequencer is already at
|
|
282
|
+
* `state`, otherwise waits for the transition. The listener is cleaned up on both resolve and timeout.
|
|
283
|
+
* Replaces the hand-rolled `state-changed` on/off subscriptions duplicated across the fee, cross-chain,
|
|
284
|
+
* and keystore-reload tests.
|
|
285
|
+
*/
|
|
286
|
+
export function waitForSequencerState(
|
|
287
|
+
sequencer: Sequencer,
|
|
288
|
+
state: SequencerState,
|
|
289
|
+
opts: WaitForSequencerStateOpts = {},
|
|
290
|
+
): Promise<void> {
|
|
291
|
+
return testSpan('wait:sequencer-state', () => waitForSequencerStateInner(sequencer, state, opts));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async function waitForSequencerStateInner(
|
|
295
|
+
sequencer: Sequencer,
|
|
296
|
+
state: SequencerState,
|
|
297
|
+
opts: WaitForSequencerStateOpts,
|
|
298
|
+
): Promise<void> {
|
|
299
|
+
const timeout = opts.timeout ?? 30000;
|
|
300
|
+
const { promise, resolve, reject } = promiseWithResolvers<void>();
|
|
301
|
+
|
|
302
|
+
let settled = false;
|
|
303
|
+
const handler = (args: Parameters<SequencerEvents['state-changed']>[0]) => {
|
|
304
|
+
if (args.newState === state) {
|
|
305
|
+
finish(resolve);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
const timer = setTimeout(
|
|
309
|
+
() => finish(() => reject(new Error(`Timeout waiting for sequencer ${state} state`))),
|
|
310
|
+
timeout,
|
|
311
|
+
);
|
|
312
|
+
function finish(complete: () => void) {
|
|
313
|
+
if (settled) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
settled = true;
|
|
317
|
+
clearTimeout(timer);
|
|
318
|
+
sequencer.off('state-changed', handler);
|
|
319
|
+
complete();
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
sequencer.on('state-changed', handler);
|
|
323
|
+
try {
|
|
324
|
+
await opts.after?.();
|
|
325
|
+
if (sequencer.status().state === state) {
|
|
326
|
+
finish(resolve);
|
|
327
|
+
}
|
|
328
|
+
await promise;
|
|
329
|
+
} catch (err) {
|
|
330
|
+
finish(() => {});
|
|
331
|
+
throw err;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
2
|
+
import { WalletSchema } from '@aztec/aztec.js/wallet';
|
|
3
|
+
import { createSafeJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a JSON-RPC client that connects to a remote wallet service.
|
|
7
|
+
* The returned object implements the {@link Wallet} interface, proxying all calls over HTTP to the specified URL.
|
|
8
|
+
*/
|
|
9
|
+
export function createWalletClient(url: string): Wallet {
|
|
10
|
+
return createSafeJsonRpcClient<Wallet>(url, WalletSchema, {
|
|
11
|
+
namespaceMethods: 'wallet',
|
|
12
|
+
fetch: makeFetch([1, 2, 3], false),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings
|
|
2
|
+
/**
|
|
3
|
+
* Standalone entrypoint that spins up a local Aztec network (L1 + node) and exposes a {@link NodeEmbeddedWallet} over
|
|
4
|
+
* JSON-RPC.
|
|
5
|
+
*
|
|
6
|
+
* Intended for forward-compatibility testing: an **old** release image runs this script so that **new** tests can send
|
|
7
|
+
* new artifacts to old runtime code (loadContractArtifact, ACIR simulator, class-ID computation, entrypoint encoding,
|
|
8
|
+
* etc.).
|
|
9
|
+
*/
|
|
10
|
+
import { getSchnorrAccountContractAddress } from '@aztec/accounts/schnorr';
|
|
11
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
12
|
+
import { createLocalNetwork } from '@aztec/aztec';
|
|
13
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
14
|
+
import { WalletSchema } from '@aztec/aztec.js/wallet';
|
|
15
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
16
|
+
import { createNamespacedSafeJsonRpcServer, startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
17
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
18
|
+
import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
19
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
20
|
+
|
|
21
|
+
const logger = createLogger('wallet-service');
|
|
22
|
+
|
|
23
|
+
const { ETHEREUM_HOSTS = 'http://localhost:8545', NODE_PORT = '8080', WALLET_PORT = '8081' } = process.env;
|
|
24
|
+
|
|
25
|
+
async function main() {
|
|
26
|
+
const l1RpcUrls = ETHEREUM_HOSTS.split(',').map(url => url.trim());
|
|
27
|
+
|
|
28
|
+
// Some tests (e.g. AMM) need 4 accounts but only 3 are funded via genesis. Generate deterministic keys for a 4th
|
|
29
|
+
// account so we can compute its address before network startup and include it in genesis funding. We cannot do this
|
|
30
|
+
// in the test because Wallet interface does not expose account creation functionality (only TestWallet exposes that
|
|
31
|
+
// but that's not used in forward compatibility testing).
|
|
32
|
+
const extraAccountSecret = Fr.fromHexString('0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef');
|
|
33
|
+
const extraAccountSalt = Fr.ZERO;
|
|
34
|
+
const extraAccountSigningKey = GrumpkinScalar.random();
|
|
35
|
+
const extraAccountAddress = await getSchnorrAccountContractAddress(
|
|
36
|
+
extraAccountSigningKey,
|
|
37
|
+
extraAccountSalt,
|
|
38
|
+
extraAccountSecret,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
logger.info('Starting wallet service...', { l1RpcUrls });
|
|
42
|
+
|
|
43
|
+
// createLocalNetwork deploys L1 contracts, starts the node, and optionally deploys funded test accounts (when
|
|
44
|
+
// TEST_ACCOUNTS=true via env). We are not proving anything just like is done when local network is started by
|
|
45
|
+
// the `aztecStart` function. The extra account address is passed via prefundAddresses so it gets fee juice at genesis.
|
|
46
|
+
const { node, stop: stopNetwork } = await createLocalNetwork(
|
|
47
|
+
{ l1RpcUrls, realProofs: false, prefundAddresses: [extraAccountAddress.toString()] },
|
|
48
|
+
logger.info,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
// Create an ephemeral embedded wallet backed by the local node.
|
|
52
|
+
const wallet = await EmbeddedWallet.create(node, { ephemeral: true });
|
|
53
|
+
|
|
54
|
+
// Re-register the initial test accounts so they are available via wallet.getAccounts(). createLocalNetwork deploys
|
|
55
|
+
// them onchain but uses a temporary wallet that is then stopped.
|
|
56
|
+
//
|
|
57
|
+
// We use the non-lazy import path (@aztec/accounts/testing, not /lazy) to avoid the dynamic JSON import that is
|
|
58
|
+
// incompatible with Node.js import attribute enforcement.
|
|
59
|
+
const testAccountsData = await getInitialTestAccountsData();
|
|
60
|
+
const accounts = await Promise.all(
|
|
61
|
+
testAccountsData.map(({ secret, salt, signingKey }) =>
|
|
62
|
+
wallet.createSchnorrInitializerlessAccount(secret, salt, signingKey),
|
|
63
|
+
),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// Register and deploy the 4th account.
|
|
67
|
+
const extraAccount = await wallet.createSchnorrAccount(extraAccountSecret, extraAccountSalt, extraAccountSigningKey);
|
|
68
|
+
const deployMethod = await extraAccount.getDeployMethod();
|
|
69
|
+
await deployMethod.send({ from: accounts[0].address });
|
|
70
|
+
|
|
71
|
+
logger.info('Embedded wallet created', {
|
|
72
|
+
accounts: [...accounts, extraAccount].map(a => a.address.toString()),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Contract artifacts are large, so allow generous body sizes for RPC requests.
|
|
76
|
+
const rpcOptions = { maxBodySizeBytes: '50mb' };
|
|
77
|
+
|
|
78
|
+
// Serve node RPC
|
|
79
|
+
const nodeRpcServer = createNamespacedSafeJsonRpcServer({ aztec: [node, AztecNodeApiSchema] }, rpcOptions);
|
|
80
|
+
const nodeHttpServer = await startHttpRpcServer(nodeRpcServer, { port: NODE_PORT });
|
|
81
|
+
logger.info(`Node JSON-RPC server listening on port ${nodeHttpServer.port}`);
|
|
82
|
+
|
|
83
|
+
// Serve wallet RPC
|
|
84
|
+
const walletRpcServer = createNamespacedSafeJsonRpcServer({ wallet: [wallet, WalletSchema] }, rpcOptions);
|
|
85
|
+
const walletHttpServer = await startHttpRpcServer(walletRpcServer, { port: WALLET_PORT });
|
|
86
|
+
logger.info(`Wallet JSON-RPC server listening on port ${walletHttpServer.port}`);
|
|
87
|
+
|
|
88
|
+
const shutdown = async () => {
|
|
89
|
+
logger.info('Shutting down...');
|
|
90
|
+
nodeHttpServer.close();
|
|
91
|
+
walletHttpServer.close();
|
|
92
|
+
await wallet.stop();
|
|
93
|
+
await stopNetwork();
|
|
94
|
+
process.exit(0);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
98
|
+
process.once('SIGINT', shutdown);
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
100
|
+
process.once('SIGTERM', shutdown);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
main().catch(err => {
|
|
104
|
+
logger.error('Wallet service failed to start', err);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
});
|
|
@@ -18,10 +18,10 @@ aztec-wallet() {
|
|
|
18
18
|
|
|
19
19
|
aztec-wallet import-test-accounts
|
|
20
20
|
|
|
21
|
-
# docs:start:declare-accounts
|
|
22
21
|
aztec-wallet create-account -a alice -f test0
|
|
23
22
|
aztec-wallet create-account -a bob -f test0
|
|
24
|
-
|
|
23
|
+
|
|
24
|
+
aztec-wallet bridge-fee-juice 1000000000000000000000 accounts:alice --mint --no-wait
|
|
25
25
|
|
|
26
26
|
DEPLOY_OUTPUT=$(aztec-wallet deploy ../noir-contracts.js/artifacts/token_contract-Token.json --args accounts:test0 Test TST 18 -f test0)
|
|
27
27
|
TOKEN_ADDRESS=$(echo "$DEPLOY_OUTPUT" | grep -oE 'Contract deployed at 0x[0-9a-fA-F]+' | cut -d ' ' -f4)
|
|
@@ -38,9 +38,12 @@ fi
|
|
|
38
38
|
|
|
39
39
|
TRANSFER_AMOUNT=42
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
# Alice's bridged fee-juice claim is only consumable inboxLag (2) checkpoints after the L1->L2 message
|
|
42
|
+
# is inserted. The token deploy and mint above produced two blocks; force one more here (a public mint
|
|
43
|
+
# from test0, which leaves the alice/bob private balances untouched) so the claim is available below.
|
|
44
|
+
aztec-wallet send mint_to_public -ca last --args accounts:test0 1 -f test0
|
|
42
45
|
|
|
43
|
-
aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT
|
|
46
|
+
aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 0 -f alice --payment method=fee_juice,claim
|
|
44
47
|
|
|
45
48
|
# Test end result
|
|
46
49
|
ALICE_BALANCE=$(aztec-wallet simulate balance_of_private -ca last --args accounts:alice -f alice)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# `infra` e2e test category
|
|
2
|
+
|
|
3
|
+
Infrastructure tests cover deployment, network targeting, and ops scenarios that are not about a
|
|
4
|
+
single protocol behavior. A test belongs here when its primary concern is network targeting or
|
|
5
|
+
operational smoke-testing rather than correctness of a specific consensus, block-building, or
|
|
6
|
+
proving behavior.
|
|
7
|
+
|
|
8
|
+
## Tests
|
|
9
|
+
|
|
10
|
+
| File | Contents |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `public_testnet_transfer.test.ts` | Deploy and transfer on a public L1 network (Sepolia) or local Anvil, parameterized by `L1_CHAIN_ID`. With no `L1_CHAIN_ID` set the test targets local Anvil and runs in CI; with Sepolia credentials (`SEQ_PUBLISHER_PRIVATE_KEY`, `ETHEREUM_HOSTS`, `L1_CHAIN_ID=11155111`) it runs against the live public testnet. |
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Unpacks the committed legacy artifact tarballs (legacy-contracts/<version>.tar.gz) into the
|
|
3
|
+
// gitignored .legacy-contracts/<version>/ cache. See legacy-contracts/README.md for the tarball
|
|
4
|
+
// layout and how versions are added.
|
|
5
|
+
//
|
|
6
|
+
// Called from legacy-jest-resolver.cjs, which unpacks on demand at first use — both locally and in
|
|
7
|
+
// the isolated CI test containers (which bind-mount the checkout read-write).
|
|
8
|
+
//
|
|
9
|
+
// Idempotent and concurrency-safe: extraction goes to a temp dir and is renamed into place, so
|
|
10
|
+
// parallel callers (e.g. compat test containers starting together) race benignly.
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
12
|
+
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const { execFileSync } = require('child_process');
|
|
16
|
+
|
|
17
|
+
// Package dir names whose artifacts/*.json the jest resolver redirects to historical versions.
|
|
18
|
+
const REDIRECTED = ['noir-contracts.js', 'noir-test-contracts.js', 'accounts'];
|
|
19
|
+
|
|
20
|
+
const e2eRoot = path.resolve(__dirname, '..');
|
|
21
|
+
const tarballDir = path.join(e2eRoot, 'legacy-contracts');
|
|
22
|
+
const cacheBase = path.join(e2eRoot, '.legacy-contracts');
|
|
23
|
+
|
|
24
|
+
function cacheRoot(version) {
|
|
25
|
+
return path.join(cacheBase, version);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Versions with committed artifacts, derived from the tarballs present. */
|
|
29
|
+
function listVersions() {
|
|
30
|
+
if (!fs.existsSync(tarballDir)) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
return fs
|
|
34
|
+
.readdirSync(tarballDir)
|
|
35
|
+
.filter(f => f.endsWith('.tar.gz'))
|
|
36
|
+
.map(f => f.slice(0, -'.tar.gz'.length))
|
|
37
|
+
.sort();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function installLegacyContracts(version) {
|
|
41
|
+
if (!version) {
|
|
42
|
+
throw new Error('installLegacyContracts: version is required');
|
|
43
|
+
}
|
|
44
|
+
const dest = cacheRoot(version);
|
|
45
|
+
if (fs.existsSync(dest)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const tarball = path.join(tarballDir, `${version}.tar.gz`);
|
|
49
|
+
if (!fs.existsSync(tarball)) {
|
|
50
|
+
throw new Error(`[legacy-contracts] no committed artifacts for ${version} (expected ${tarball})`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
fs.mkdirSync(cacheBase, { recursive: true });
|
|
54
|
+
// Extract to a temp sibling and rename into place: rename is atomic on the same filesystem, so a
|
|
55
|
+
// concurrent caller either sees the complete cache or none of it.
|
|
56
|
+
const tmp = fs.mkdtempSync(path.join(cacheBase, `.${version}.tmp-`));
|
|
57
|
+
try {
|
|
58
|
+
process.stderr.write(`[legacy-contracts] unpacking ${path.basename(tarball)} -> ${dest}\n`);
|
|
59
|
+
execFileSync('tar', ['-xzf', tarball, '-C', tmp], { stdio: ['ignore', 'ignore', 'inherit'] });
|
|
60
|
+
for (const pkg of REDIRECTED) {
|
|
61
|
+
if (!fs.existsSync(path.join(tmp, version, pkg, 'artifacts'))) {
|
|
62
|
+
throw new Error(`[legacy-contracts] ${path.basename(tarball)} is missing ${pkg}/artifacts`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
fs.renameSync(path.join(tmp, version), dest);
|
|
67
|
+
} catch (err) {
|
|
68
|
+
if (!fs.existsSync(dest)) {
|
|
69
|
+
throw err;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} finally {
|
|
73
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = { installLegacyContracts, listVersions, cacheRoot, REDIRECTED };
|
|
78
|
+
|
|
79
|
+
if (require.main === module) {
|
|
80
|
+
installLegacyContracts(process.argv[2]);
|
|
81
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Custom Jest resolver. When CONTRACT_ARTIFACTS_VERSION is set, redirects *only* JSON artifact files under
|
|
2
|
+
// @aztec/noir-contracts.js/artifacts/, @aztec/noir-test-contracts.js/artifacts/, and @aztec/accounts/artifacts/ to
|
|
3
|
+
// that version's historical artifacts, committed as legacy-contracts/<version>.tar.gz and unpacked on demand into
|
|
4
|
+
// .legacy-contracts/<version>/ by install_legacy_contracts.cjs.
|
|
5
|
+
//
|
|
6
|
+
// Why JSON-only: the JSON artifact is the actual interchange surface a "deployed contract" exposes. The TS wrapper is
|
|
7
|
+
// generated client-side ergonomics that's tightly coupled to the current @aztec/aztec.js API. Redirecting the wrapper
|
|
8
|
+
// would couple this test to a moving aztec.js surface and break at import time on unrelated breaking changes; we want
|
|
9
|
+
// to fail only on actual artifact-compat regressions.
|
|
10
|
+
//
|
|
11
|
+
// Missing artifacts: legacy version tarballs are immutable, so an artifact missing from the unpacked cache means the
|
|
12
|
+
// contract was added after that release — there's nothing to compat-test. Rather than failing or silently falling
|
|
13
|
+
// back to the workspace artifact (which would turn the compat run into a regular e2e run that always passes), we log
|
|
14
|
+
// the miss and exit the process cleanly with code 0. The test never runs, but the per-test CI log captures the
|
|
15
|
+
// explanatory line so the reason is auditable. This keeps the change scoped to this resolver, avoiding a new
|
|
16
|
+
// exit-code contract in the shared ci3 test runner.
|
|
17
|
+
//
|
|
18
|
+
// Activated by env var; passthrough otherwise.
|
|
19
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
20
|
+
|
|
21
|
+
const path = require('path');
|
|
22
|
+
const fs = require('fs');
|
|
23
|
+
const { installLegacyContracts, REDIRECTED, cacheRoot } = require('./install_legacy_contracts.cjs');
|
|
24
|
+
|
|
25
|
+
const version = process.env.CONTRACT_ARTIFACTS_VERSION;
|
|
26
|
+
const cacheDir = version ? cacheRoot(version) : null;
|
|
27
|
+
|
|
28
|
+
// Unpack on demand at first use. Idempotent and concurrency-safe, so parallel jest workers and
|
|
29
|
+
// isolated test containers (which share the checkout) race benignly.
|
|
30
|
+
if (version) {
|
|
31
|
+
installLegacyContracts(version);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let bannerPrinted = false;
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
|
|
37
|
+
function printBannerOnce() {
|
|
38
|
+
if (bannerPrinted || !version) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
bannerPrinted = true;
|
|
42
|
+
const lines = ['='.repeat(60), `[legacy-contracts][jest] CONTRACT_ARTIFACTS_VERSION=${version}`];
|
|
43
|
+
for (const pkg of REDIRECTED) {
|
|
44
|
+
lines.push(`[legacy-contracts][jest] redirecting ${pkg}/artifacts/*.json -> .legacy-contracts/${version}/...`);
|
|
45
|
+
}
|
|
46
|
+
lines.push('='.repeat(60));
|
|
47
|
+
process.stderr.write(lines.join('\n') + '\n');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Match a resolved absolute path against the workspace artifacts dirs and return the legacy cache equivalent, or null
|
|
51
|
+
// if it's not an artifact path we should redirect.
|
|
52
|
+
function legacyArtifactPath(resolved) {
|
|
53
|
+
if (!resolved.endsWith('.json')) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
for (const pkg of REDIRECTED) {
|
|
57
|
+
// pkg = 'noir-contracts.js' -> match '/noir-contracts.js/artifacts/'
|
|
58
|
+
const marker = `/${pkg}/artifacts/`;
|
|
59
|
+
const idx = resolved.indexOf(marker);
|
|
60
|
+
if (idx === -1) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const basename = resolved.slice(idx + marker.length);
|
|
64
|
+
return path.join(cacheDir, pkg, 'artifacts', basename);
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = function legacyResolver(request, options) {
|
|
70
|
+
// Always run the default resolver first. We only inspect (and possibly rewrite) the *result*; this catches both
|
|
71
|
+
// bare-specifier imports of `@aztec/noir-contracts.js/artifacts/foo.json` and the relative `../artifacts/foo.json`
|
|
72
|
+
// imports inside the workspace TS wrapper classes — both resolve to the same workspace artifact path that we then
|
|
73
|
+
// redirect.
|
|
74
|
+
const resolved = options.defaultResolver(request, options);
|
|
75
|
+
if (!version) {
|
|
76
|
+
return resolved;
|
|
77
|
+
}
|
|
78
|
+
printBannerOnce();
|
|
79
|
+
const legacy = legacyArtifactPath(resolved);
|
|
80
|
+
if (!legacy) {
|
|
81
|
+
return resolved;
|
|
82
|
+
}
|
|
83
|
+
if (!fs.existsSync(legacy)) {
|
|
84
|
+
// Contract was added after this historical release, there is nothing to compat-test for it. Exit the process
|
|
85
|
+
// cleanly with code 0 so the test runner reports the run as passed.
|
|
86
|
+
fs.writeSync(
|
|
87
|
+
2,
|
|
88
|
+
`[legacy-contracts][jest] artifact ${path.basename(legacy)} not in legacy cache @${version}; ` +
|
|
89
|
+
`assumed added after this release. No compat coverage applicable for this version, treating as passed.\n`,
|
|
90
|
+
);
|
|
91
|
+
process.exit(0);
|
|
92
|
+
}
|
|
93
|
+
if (!seen.has(resolved)) {
|
|
94
|
+
seen.add(resolved);
|
|
95
|
+
process.stderr.write(`[legacy-contracts][jest] redirected ${path.basename(legacy)} -> ${legacy}\n`);
|
|
96
|
+
}
|
|
97
|
+
return legacy;
|
|
98
|
+
};
|