@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -14
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +17 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +123 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/automine/token/blacklist_token_contract_test.js +166 -0
- package/dest/automine/token/token_contract_test.d.ts +40 -0
- package/dest/automine/token/token_contract_test.d.ts.map +1 -0
- package/dest/automine/token/token_contract_test.js +119 -0
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +17 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +40 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -20
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +159 -140
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +8 -27
- package/dest/bench/utils.d.ts +10 -9
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +126 -23
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +1 -1
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +27 -29
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +156 -156
- 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 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +86 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +119 -0
- package/dest/fixtures/index.d.ts +3 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +2 -0
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +269 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +688 -0
- package/dest/fixtures/setup_p2p_test.d.ts +22 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +60 -41
- 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 +26 -5
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +33 -9
- package/dest/fixtures/utils.d.ts +5 -192
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -648
- package/dest/fixtures/wait_helpers.d.ts +135 -0
- package/dest/fixtures/wait_helpers.d.ts.map +1 -0
- package/dest/fixtures/wait_helpers.js +154 -0
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/index.d.ts +1 -1
- 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/p2p/p2p_network.d.ts +325 -0
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/p2p/p2p_network.js +389 -0
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/p2p/reqresp/utils.js +193 -0
- package/dest/p2p/shared.d.ts +72 -0
- package/dest/p2p/shared.d.ts.map +1 -0
- package/dest/p2p/shared.js +212 -0
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +11 -8
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +45 -40
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +28 -16
- package/dest/shared/index.d.ts +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +19 -14
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +365 -0
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +86 -54
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +11 -4
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +33 -19
- 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/single-node/fees/bridging_race.notest.d.ts +2 -0
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +21 -10
- package/dest/single-node/fees/fees_test.d.ts +93 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/single-node/fees/fees_test.js +274 -0
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +360 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +833 -0
- package/dest/spartan/setup_test_wallets.d.ts +18 -6
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +169 -30
- package/dest/spartan/tx_metrics.d.ts +111 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +507 -0
- package/dest/spartan/utils/bot.d.ts +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +19 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -218
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -749
- 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 +323 -0
- package/dest/test-wallet/utils.d.ts +76 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +126 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +56 -0
- package/dest/test-wallet/worker_wallet.d.ts +53 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +155 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +22 -0
- package/package.json +57 -47
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/contracts/fixtures/storage_proof.json +915 -0
- package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +177 -0
- package/src/automine/token/blacklist_token_contract_test.ts +208 -0
- package/src/automine/token/token_contract_test.ts +146 -0
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +45 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +227 -211
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +7 -28
- package/src/bench/utils.ts +144 -25
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +1 -1
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +175 -214
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +110 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +192 -0
- package/src/fixtures/index.ts +2 -0
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +987 -0
- package/src/fixtures/setup_p2p_test.ts +72 -58
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +47 -11
- package/src/fixtures/utils.ts +26 -947
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +106 -0
- package/src/guides/up_quick_start.sh +8 -5
- package/src/infra/README.md +12 -0
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/multi-node/README.md +95 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/p2p/p2p_network.ts +542 -0
- package/src/p2p/reqresp/utils.ts +263 -0
- package/src/p2p/shared.ts +329 -0
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +51 -43
- package/src/shared/gas_portal_test_harness.ts +36 -18
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +22 -19
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +136 -115
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +40 -20
- package/src/simulators/token_simulator.ts +6 -30
- package/src/single-node/README.md +60 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +23 -15
- package/src/single-node/fees/fees_test.ts +368 -0
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1041 -0
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +243 -32
- package/src/spartan/tx_metrics.ts +460 -0
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -942
- package/src/test-wallet/test_wallet.ts +429 -0
- package/src/test-wallet/utils.ts +205 -0
- package/src/test-wallet/wallet_worker_script.ts +66 -0
- package/src/test-wallet/worker_wallet.ts +214 -0
- package/src/test-wallet/worker_wallet_schema.ts +14 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -54
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +0 -185
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -41
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -107
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -45
- package/dest/e2e_epochs/epochs_test.d.ts +0 -92
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -336
- package/dest/e2e_fees/bridging_race.notest.d.ts +0 -2
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -84
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.js +0 -260
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -57
- package/dest/e2e_multi_validator/utils.d.ts +0 -12
- package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -29
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -63
- 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 -135
- package/dest/e2e_p2p/p2p_network.d.ts +0 -108
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/p2p_network.js +0 -318
- 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 -183
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -35
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/dest/e2e_token_contract/token_contract_test.js +0 -126
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +0 -256
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -178
- package/src/e2e_deploy_contract/deploy_test.ts +0 -78
- package/src/e2e_epochs/epochs_test.ts +0 -437
- package/src/e2e_fees/fees_test.ts +0 -378
- package/src/e2e_l1_publisher/write_json.ts +0 -76
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -95
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -178
- package/src/e2e_p2p/p2p_network.ts +0 -472
- package/src/e2e_p2p/shared.ts +0 -282
- package/src/e2e_token_contract/token_contract_test.ts +0 -167
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Test fixtures and utilities to set up and run a test using multiple validators
|
|
3
3
|
*/
|
|
4
|
-
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
+
import { type AztecNodeConfig, AztecNodeService, createAztecNodeService } from '@aztec/aztec-node';
|
|
5
|
+
import { range } from '@aztec/foundation/array';
|
|
5
6
|
import { SecretValue } from '@aztec/foundation/config';
|
|
6
|
-
import {
|
|
7
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
7
8
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
8
9
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
9
|
-
import type {
|
|
10
|
-
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
10
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
11
11
|
|
|
12
12
|
import getPort from 'get-port';
|
|
13
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
14
13
|
|
|
15
14
|
import { TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
16
15
|
import { createAndSyncProverNode, getPrivateKeyFromIndex } from './utils.js';
|
|
@@ -21,6 +20,11 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
21
20
|
// to avoid running validators with the same key
|
|
22
21
|
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
23
22
|
|
|
23
|
+
// Global counters for actor naming (start at 1)
|
|
24
|
+
let validatorCounter = 1;
|
|
25
|
+
let nodeCounter = 1;
|
|
26
|
+
let proverCounter = 1;
|
|
27
|
+
|
|
24
28
|
export function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[] {
|
|
25
29
|
const privateKeys: `0x${string}`[] = [];
|
|
26
30
|
// Do not start from 0 as it is used during setup
|
|
@@ -36,33 +40,34 @@ export async function createNodes(
|
|
|
36
40
|
bootstrapNodeEnr: string,
|
|
37
41
|
numNodes: number,
|
|
38
42
|
bootNodePort: number,
|
|
39
|
-
|
|
43
|
+
genesis?: GenesisData,
|
|
40
44
|
dataDirectory?: string,
|
|
41
45
|
metricsPort?: number,
|
|
42
46
|
indexOffset = 0,
|
|
47
|
+
validatorsPerNode = 1,
|
|
43
48
|
): Promise<AztecNodeService[]> {
|
|
44
49
|
const nodePromises: Promise<AztecNodeService>[] = [];
|
|
45
|
-
const loggerIdStorage = new AsyncLocalStorage<string>();
|
|
46
|
-
const logNameHandler = (module: string) =>
|
|
47
|
-
loggerIdStorage.getStore() ? `${module}:${loggerIdStorage.getStore()}` : module;
|
|
48
|
-
addLogNameHandler(logNameHandler);
|
|
49
50
|
|
|
50
51
|
for (let i = 0; i < numNodes; i++) {
|
|
51
52
|
const index = indexOffset + i;
|
|
52
53
|
// We run on ports from the bootnode upwards
|
|
53
54
|
const port = bootNodePort + 1 + index;
|
|
54
55
|
|
|
56
|
+
// Determine validator indices for this node
|
|
57
|
+
const validatorIndices = validatorsPerNode === 1 ? index : range(validatorsPerNode, validatorsPerNode * index);
|
|
58
|
+
|
|
59
|
+
// Assign data directory
|
|
55
60
|
const dataDir = dataDirectory ? `${dataDirectory}-${index}` : undefined;
|
|
61
|
+
|
|
56
62
|
const nodePromise = createNode(
|
|
57
63
|
config,
|
|
58
64
|
dateProvider,
|
|
59
65
|
port,
|
|
60
66
|
bootstrapNodeEnr,
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
validatorIndices,
|
|
68
|
+
genesis,
|
|
63
69
|
dataDir,
|
|
64
70
|
metricsPort,
|
|
65
|
-
loggerIdStorage,
|
|
66
71
|
);
|
|
67
72
|
nodePromises.push(nodePromise);
|
|
68
73
|
}
|
|
@@ -74,32 +79,42 @@ export async function createNodes(
|
|
|
74
79
|
throw new Error('Sequencer not found');
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
removeLogNameHandler(logNameHandler);
|
|
78
82
|
return nodes;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
/**
|
|
85
|
+
/** Extended config type for createNode with test-specific overrides. */
|
|
86
|
+
export type CreateNodeConfig = AztecNodeConfig & {
|
|
87
|
+
/** Whether to skip starting the sequencer. */
|
|
88
|
+
dontStartSequencer?: boolean;
|
|
89
|
+
/** Override the private key (instead of deriving from addressIndex). */
|
|
90
|
+
validatorPrivateKey?: `0x${string}`;
|
|
91
|
+
/** Corrupt only the block proposal at this indexWithinCheckpoint (testing only). */
|
|
92
|
+
invalidBlockProposalIndexWithinCheckpoint?: number;
|
|
93
|
+
/** Accept proposal gossip regardless of slot timing (testing only). */
|
|
94
|
+
skipProposalSlotValidation?: boolean;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** Creates a P2P enabled instance of Aztec Node Service with a validator. */
|
|
82
98
|
export async function createNode(
|
|
83
|
-
config:
|
|
99
|
+
config: CreateNodeConfig,
|
|
84
100
|
dateProvider: DateProvider,
|
|
85
101
|
tcpPort: number,
|
|
86
102
|
bootstrapNode: string | undefined,
|
|
87
|
-
addressIndex: number,
|
|
88
|
-
|
|
103
|
+
addressIndex: number | number[],
|
|
104
|
+
genesis?: GenesisData,
|
|
89
105
|
dataDirectory?: string,
|
|
90
106
|
metricsPort?: number,
|
|
91
|
-
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
92
107
|
) {
|
|
93
|
-
const
|
|
108
|
+
const actorIndex = validatorCounter++;
|
|
109
|
+
return await withLoggerBindings({ actor: `validator-${actorIndex}` }, async () => {
|
|
94
110
|
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
95
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
96
|
-
return await
|
|
111
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
112
|
+
return await createAztecNodeService(
|
|
97
113
|
validatorConfig,
|
|
98
114
|
{ telemetry, dateProvider },
|
|
99
|
-
{
|
|
115
|
+
{ genesis, dontStartSequencer: config.dontStartSequencer },
|
|
100
116
|
);
|
|
101
|
-
};
|
|
102
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
117
|
+
});
|
|
103
118
|
}
|
|
104
119
|
|
|
105
120
|
/** Creates a P2P enabled instance of Aztec Node Service without a validator */
|
|
@@ -108,23 +123,22 @@ export async function createNonValidatorNode(
|
|
|
108
123
|
dateProvider: DateProvider,
|
|
109
124
|
tcpPort: number,
|
|
110
125
|
bootstrapNode: string | undefined,
|
|
111
|
-
|
|
126
|
+
genesis?: GenesisData,
|
|
112
127
|
dataDirectory?: string,
|
|
113
128
|
metricsPort?: number,
|
|
114
|
-
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
115
129
|
) {
|
|
116
|
-
const
|
|
130
|
+
const actorIndex = nodeCounter++;
|
|
131
|
+
return await withLoggerBindings({ actor: `node-${actorIndex}` }, async () => {
|
|
117
132
|
const p2pConfig = await createP2PConfig(baseConfig, bootstrapNode, tcpPort, dataDirectory);
|
|
118
133
|
const config: AztecNodeConfig = {
|
|
119
134
|
...p2pConfig,
|
|
120
135
|
disableValidator: true,
|
|
121
136
|
validatorPrivateKeys: undefined,
|
|
122
|
-
|
|
137
|
+
sequencerPublisherPrivateKeys: [],
|
|
123
138
|
};
|
|
124
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
125
|
-
return await
|
|
126
|
-
};
|
|
127
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
139
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
140
|
+
return await createAztecNodeService(config, { telemetry, dateProvider }, { genesis });
|
|
141
|
+
});
|
|
128
142
|
}
|
|
129
143
|
|
|
130
144
|
export async function createProverNode(
|
|
@@ -132,34 +146,26 @@ export async function createProverNode(
|
|
|
132
146
|
tcpPort: number,
|
|
133
147
|
bootstrapNode: string | undefined,
|
|
134
148
|
addressIndex: number,
|
|
135
|
-
|
|
136
|
-
|
|
149
|
+
deps: { dateProvider: DateProvider },
|
|
150
|
+
genesis?: GenesisData,
|
|
137
151
|
dataDirectory?: string,
|
|
138
152
|
metricsPort?: number,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
154
|
+
const actorIndex = proverCounter++;
|
|
155
|
+
return await withLoggerBindings({ actor: `prover-${actorIndex}` }, async () => {
|
|
142
156
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
|
|
143
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
157
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
144
158
|
|
|
145
|
-
const
|
|
146
|
-
config,
|
|
147
|
-
bootstrapNode,
|
|
148
|
-
tcpPort,
|
|
149
|
-
dataDirectory,
|
|
150
|
-
);
|
|
159
|
+
const p2pConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
|
|
151
160
|
|
|
152
|
-
const aztecNodeRpcTxProvider = undefined;
|
|
153
161
|
return await createAndSyncProverNode(
|
|
154
162
|
bufferToHex(proverNodePrivateKey),
|
|
155
|
-
config,
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
{ ...proverNodeDeps, telemetry },
|
|
163
|
+
{ ...config, ...p2pConfig },
|
|
164
|
+
{ dataDirectory },
|
|
165
|
+
{ ...deps, telemetry },
|
|
166
|
+
{ genesis },
|
|
160
167
|
);
|
|
161
|
-
};
|
|
162
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createProverNode) : createProverNode();
|
|
168
|
+
});
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
export async function createP2PConfig(
|
|
@@ -185,19 +191,27 @@ export async function createP2PConfig(
|
|
|
185
191
|
}
|
|
186
192
|
|
|
187
193
|
export async function createValidatorConfig(
|
|
188
|
-
config:
|
|
194
|
+
config: CreateNodeConfig,
|
|
189
195
|
bootstrapNodeEnr?: string,
|
|
190
196
|
port?: number,
|
|
191
|
-
addressIndex: number = 1,
|
|
197
|
+
addressIndex: number | number[] = 1,
|
|
192
198
|
dataDirectory?: string,
|
|
193
199
|
) {
|
|
194
|
-
const
|
|
200
|
+
const addressIndices = Array.isArray(addressIndex) ? addressIndex : [addressIndex];
|
|
201
|
+
if (addressIndices.length === 0 && !config.validatorPrivateKey) {
|
|
202
|
+
throw new Error('At least one address index must be provided to create a validator config');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Use override private key if provided, otherwise derive from address indices
|
|
206
|
+
const attesterPrivateKeys = config.validatorPrivateKey
|
|
207
|
+
? [config.validatorPrivateKey]
|
|
208
|
+
: addressIndices.map(index => bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!));
|
|
195
209
|
const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
|
|
196
210
|
const nodeConfig: AztecNodeConfig = {
|
|
197
211
|
...config,
|
|
198
212
|
...p2pConfig,
|
|
199
|
-
validatorPrivateKeys: new SecretValue(
|
|
200
|
-
|
|
213
|
+
validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
|
|
214
|
+
sequencerPublisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
|
|
201
215
|
};
|
|
202
216
|
|
|
203
217
|
return nodeConfig;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2e span instrumentation. Wrapping a shared test helper in {@link testSpan} / {@link testSpanSync}
|
|
3
|
+
* records how long it ran, attributed to the test (or suite) that was executing, so a full CI run can
|
|
4
|
+
* be aggregated into a ranked list of where the suite spends wall-clock (setup, protocol waits, client
|
|
5
|
+
* proving, warp scans, ...). See the A-1178 timing environment in `shared/timing_env.mjs`.
|
|
6
|
+
*
|
|
7
|
+
* Everything here is gated on the collector installed by that environment, which only exists when
|
|
8
|
+
* `TEST_TIMING_FILE` is set. When it is unset, {@link testSpan} calls `fn()` directly with no extra work
|
|
9
|
+
* and no clock reads — instrumentation is exactly zero-cost and cannot change a test's behavior or
|
|
10
|
+
* timing.
|
|
11
|
+
*/
|
|
12
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Async-context owner override. A span normally attributes itself to the running test
|
|
16
|
+
* (`collector.current`), but a background producer (e.g. the mempool feeder) runs interleaved with
|
|
17
|
+
* arbitrary tests, so its spans would smear across whichever test happened to be current when each
|
|
18
|
+
* round fired. Running such work inside {@link withTestSpanOwner} pins every span in that async call
|
|
19
|
+
* tree to a fixed owner instead — isolated by async context from concurrent test-body spans.
|
|
20
|
+
*/
|
|
21
|
+
const ownerOverride = new AsyncLocalStorage<string | null>();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Runs `fn` with every {@link testSpan} inside its async call tree attributed to `owner` instead of the
|
|
25
|
+
* currently running test. Use a non-test sentinel owner (e.g. `other:mempool-feeder`) to keep a
|
|
26
|
+
* background producer's spans out of the per-test view.
|
|
27
|
+
*/
|
|
28
|
+
export function withTestSpanOwner<T>(owner: string, fn: () => Promise<T>): Promise<T> {
|
|
29
|
+
return ownerOverride.run(owner, fn);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** One recorded span occurrence on the process-wide `performance.now()` clock. */
|
|
33
|
+
export type TimingSpan = {
|
|
34
|
+
/** Full name of the test running when the span started, or `null` if inside a beforeAll/afterAll hook. */
|
|
35
|
+
owner: string | null;
|
|
36
|
+
/** Stable `category:label` tag, aggregated across occurrences (e.g. `wait:checkpoint`, `setup:node`). */
|
|
37
|
+
name: string;
|
|
38
|
+
/** `performance.now()` at span start. */
|
|
39
|
+
start: number;
|
|
40
|
+
/** `performance.now()` at span end. */
|
|
41
|
+
end: number;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The collector shared by the timing environment on `globalThis.__e2eTimings`. `current` is the full
|
|
46
|
+
* name of the test currently running (`null` during beforeAll/afterAll); the environment sets it. The
|
|
47
|
+
* `spans` array accumulates every recorded span until the environment folds it into the per-test /
|
|
48
|
+
* per-suite JSONL line at flush.
|
|
49
|
+
*/
|
|
50
|
+
export type SpanCollector = {
|
|
51
|
+
/** Full name of the running test, or `null` during a beforeAll/afterAll hook. */
|
|
52
|
+
current: string | null;
|
|
53
|
+
/** All recorded spans, drained by the timing environment at flush time. */
|
|
54
|
+
spans: TimingSpan[];
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
function getCollector(): SpanCollector | undefined {
|
|
58
|
+
return (globalThis as { __e2eTimings?: SpanCollector }).__e2eTimings;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Times `fn` and records a span tagged `name`, attributed to the test (or suite) running when it
|
|
63
|
+
* started. The span is recorded even when `fn` throws. Pure passthrough: when no collector is
|
|
64
|
+
* installed (i.e. `TEST_TIMING_FILE` is unset) this calls `fn()` directly with zero overhead.
|
|
65
|
+
*
|
|
66
|
+
* Use stable `category:label` tags and prefer wrapping at the leaf wait/setup/tx level — labels are
|
|
67
|
+
* forever aggregation keys, and leaf-level tagging keeps spans additive. See `SPEEDUP_FOLLOWUPS` and
|
|
68
|
+
* the A-1179 design doc for the tag taxonomy.
|
|
69
|
+
*/
|
|
70
|
+
export async function testSpan<T>(name: string, fn: () => Promise<T>): Promise<T> {
|
|
71
|
+
const collector = getCollector();
|
|
72
|
+
if (!collector) {
|
|
73
|
+
return fn();
|
|
74
|
+
}
|
|
75
|
+
const owner = ownerOverride.getStore() ?? collector.current;
|
|
76
|
+
const start = performance.now();
|
|
77
|
+
try {
|
|
78
|
+
return await fn();
|
|
79
|
+
} finally {
|
|
80
|
+
collector.spans.push({ owner, name, start, end: performance.now() });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Synchronous variant of {@link testSpan} for non-async helpers. Same zero-cost guarantee when unset. */
|
|
85
|
+
export function testSpanSync<T>(name: string, fn: () => T): T {
|
|
86
|
+
const collector = getCollector();
|
|
87
|
+
if (!collector) {
|
|
88
|
+
return fn();
|
|
89
|
+
}
|
|
90
|
+
const owner = ownerOverride.getStore() ?? collector.current;
|
|
91
|
+
const start = performance.now();
|
|
92
|
+
try {
|
|
93
|
+
return fn();
|
|
94
|
+
} finally {
|
|
95
|
+
collector.spans.push({ owner, name, start, end: performance.now() });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -3,12 +3,47 @@ import { BatchCall } from '@aztec/aztec.js/contracts';
|
|
|
3
3
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
4
4
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
5
5
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
6
|
+
import { TestTokenContract } from '@aztec/noir-test-contracts.js/TestToken';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Either token flavour. Canonical `TokenContract` uses constrained message delivery (production / docs
|
|
10
|
+
* source of truth); `TestTokenContract` is its codegen'd unconstrained-delivery sibling, used by tests
|
|
11
|
+
* where a token is just a unit-of-account vehicle. The two share an identical ABI, so helpers that only
|
|
12
|
+
* read balances or mint accept either.
|
|
13
|
+
*/
|
|
14
|
+
export type AnyTokenContract = TokenContract | TestTokenContract;
|
|
6
15
|
|
|
7
16
|
export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
|
|
8
17
|
logger.info(`Deploying Token contract...`);
|
|
9
|
-
const contract = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
|
|
19
|
+
from: admin,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (initialAdminBalance > 0n) {
|
|
23
|
+
await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
logger.info('L2 contract deployed');
|
|
27
|
+
|
|
28
|
+
return { contract, instance };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Deploys the unconstrained-delivery `TestTokenContract`. Use this in tests where the token is a
|
|
33
|
+
* unit-of-account vehicle rather than the subject, so they don't pay constrained delivery's first-send
|
|
34
|
+
* handshake cost (which distorts step/log counts that benches assert on). Use {@link deployToken} when a
|
|
35
|
+
* test exercises canonical Token semantics or note discovery.
|
|
36
|
+
*/
|
|
37
|
+
export async function deployTestToken(
|
|
38
|
+
wallet: Wallet,
|
|
39
|
+
admin: AztecAddress,
|
|
40
|
+
initialAdminBalance: bigint,
|
|
41
|
+
logger: Logger,
|
|
42
|
+
) {
|
|
43
|
+
logger.info(`Deploying TestToken contract...`);
|
|
44
|
+
const { contract, instance } = await TestTokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
|
|
45
|
+
from: admin,
|
|
46
|
+
});
|
|
12
47
|
|
|
13
48
|
if (initialAdminBalance > 0n) {
|
|
14
49
|
await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
|
|
@@ -16,28 +51,29 @@ export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAd
|
|
|
16
51
|
|
|
17
52
|
logger.info('L2 contract deployed');
|
|
18
53
|
|
|
19
|
-
return contract;
|
|
54
|
+
return { contract, instance };
|
|
20
55
|
}
|
|
21
56
|
|
|
22
57
|
export async function mintTokensToPrivate(
|
|
23
|
-
token:
|
|
58
|
+
token: AnyTokenContract,
|
|
24
59
|
minter: AztecAddress,
|
|
25
60
|
recipient: AztecAddress,
|
|
26
61
|
amount: bigint,
|
|
62
|
+
additionalScopes?: AztecAddress[],
|
|
27
63
|
) {
|
|
28
|
-
await token.methods.mint_to_private(recipient, amount).send({ from: minter })
|
|
64
|
+
await token.methods.mint_to_private(recipient, amount).send({ from: minter, additionalScopes });
|
|
29
65
|
}
|
|
30
66
|
|
|
31
67
|
export async function expectTokenBalance(
|
|
32
68
|
wallet: Wallet,
|
|
33
|
-
token:
|
|
69
|
+
token: AnyTokenContract,
|
|
34
70
|
owner: AztecAddress,
|
|
35
71
|
expectedBalance: bigint,
|
|
36
72
|
logger: Logger,
|
|
37
73
|
) {
|
|
38
74
|
// Then check the balance
|
|
39
|
-
const contractWithWallet =
|
|
40
|
-
const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
75
|
+
const contractWithWallet = token.withWallet(wallet);
|
|
76
|
+
const { result: balance } = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
41
77
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
42
78
|
expect(balance).toBe(expectedBalance);
|
|
43
79
|
}
|
|
@@ -46,7 +82,7 @@ export async function mintNotes(
|
|
|
46
82
|
wallet: Wallet,
|
|
47
83
|
minter: AztecAddress,
|
|
48
84
|
recipient: AztecAddress,
|
|
49
|
-
asset:
|
|
85
|
+
asset: AnyTokenContract,
|
|
50
86
|
noteAmounts: bigint[],
|
|
51
87
|
): Promise<bigint> {
|
|
52
88
|
// We can only mint 5 notes at a time, since that's the maximum number of calls our entrypoints allow
|
|
@@ -55,7 +91,7 @@ export async function mintNotes(
|
|
|
55
91
|
for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
|
|
56
92
|
const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
|
|
57
93
|
const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
|
|
58
|
-
await new BatchCall(wallet, actions).send({ from: minter })
|
|
94
|
+
await new BatchCall(wallet, actions).send({ from: minter });
|
|
59
95
|
}
|
|
60
96
|
|
|
61
97
|
return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
|