@aztec/end-to-end 0.0.1-commit.c31f2472 → 0.0.1-commit.c52d6e7
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/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{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 +7 -7
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +68 -62
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/client_flows/data_extractor.js +1 -0
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +102 -8
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +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_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -2
- 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 +6 -6
- 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/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 +22 -10
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +26 -20
- 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 +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/multi-node/block-production/setup.d.ts +97 -0
- package/dest/multi-node/block-production/setup.d.ts.map +1 -0
- package/dest/multi-node/block-production/setup.js +158 -0
- package/dest/multi-node/governance/setup.d.ts +67 -0
- package/dest/multi-node/governance/setup.d.ts.map +1 -0
- package/dest/multi-node/governance/setup.js +126 -0
- package/dest/multi-node/multi_node_test_context.d.ts +212 -0
- package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
- package/dest/multi-node/multi_node_test_context.js +347 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/inactivity_setup.js +111 -0
- package/dest/multi-node/slashing/setup.d.ts +167 -0
- package/dest/multi-node/slashing/setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/setup.js +275 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +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/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/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 +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +28 -17
- 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 +56 -44
- 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 +344 -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 +11 -28
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +4 -1
- package/dest/spartan/utils/index.d.ts +6 -4
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +6 -2
- package/dest/spartan/utils/k8s.d.ts +31 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +124 -0
- package/dest/spartan/utils/nodes.d.ts +14 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +204 -33
- 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 +18 -4
- package/dest/spartan/utils/scripts.d.ts.map +1 -1
- package/dest/spartan/utils/scripts.js +19 -4
- 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 +53 -46
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/contracts/fixtures/storage_proof.json +915 -0
- package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
- package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
- package/src/{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 +109 -78
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +1 -0
- 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_acvm_config.ts +2 -8
- package/src/fixtures/get_bb_config.ts +8 -8
- package/src/fixtures/ha_setup.ts +192 -0
- package/src/fixtures/index.ts +2 -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 +39 -34
- 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 +75 -0
- package/src/legacy-jest-resolver.cjs +112 -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/p2p/reqresp/utils.ts +263 -0
- 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 +35 -18
- 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 +98 -56
- 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 +434 -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 +3 -0
- package/src/spartan/utils/index.ts +10 -1
- package/src/spartan/utils/k8s.ts +160 -0
- package/src/spartan/utils/nodes.ts +251 -31
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +43 -7
- 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 -128
- 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 -361
- 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/shared.d.ts +0 -46
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -177
- 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 -194
- package/src/e2e_deploy_contract/deploy_test.ts +0 -85
- package/src/e2e_epochs/epochs_test.ts +0 -477
- 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 -288
- /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
- /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ContractFunctionInteraction, SendInteractionOptions, SimulateInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import type { GenericProxyContract } from '@aztec/noir-test-contracts.js/GenericProxy';
|
|
3
|
+
/**
|
|
4
|
+
* Sends a contract call through the authwit proxy.
|
|
5
|
+
* The proxy becomes msg_sender in the target (triggering authwit validation),
|
|
6
|
+
* while the actual tx sender retains their keys in scope.
|
|
7
|
+
*/
|
|
8
|
+
export declare function sendThroughAuthwitProxy(proxy: GenericProxyContract, action: ContractFunctionInteraction, options: SendInteractionOptions): Promise<import("@aztec/aztec.js/contracts").TxSendResultMined<import("@aztec/stdlib/tx").TxReceipt>>;
|
|
9
|
+
/**
|
|
10
|
+
* Simulates a contract call through the authwit proxy.
|
|
11
|
+
* The proxy becomes msg_sender in the target (triggering authwit validation),
|
|
12
|
+
* while the actual tx sender retains their keys in scope.
|
|
13
|
+
*/
|
|
14
|
+
export declare function simulateThroughAuthwitProxy(proxy: GenericProxyContract, action: ContractFunctionInteraction, options: SimulateInteractionOptions): Promise<import("@aztec/aztec.js/contracts").SimulationResult>;
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aHdpdF9wcm94eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpeHR1cmVzL2F1dGh3aXRfcHJveHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQ1YsMkJBQTJCLEVBQzNCLHNCQUFzQixFQUN0QiwwQkFBMEIsRUFDM0IsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDRDQUE0QyxDQUFDO0FBc0J2Rjs7OztHQUlHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUMzQyxLQUFLLEVBQUUsb0JBQW9CLEVBQzNCLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsT0FBTyxFQUFFLHNCQUFzQix3R0FJaEM7QUFFRDs7OztHQUlHO0FBQ0gsd0JBQXNCLDJCQUEyQixDQUMvQyxLQUFLLEVBQUUsb0JBQW9CLEVBQzNCLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsT0FBTyxFQUFFLDBCQUEwQixpRUFJcEMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authwit_proxy.d.ts","sourceRoot":"","sources":["../../src/fixtures/authwit_proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAsBvF;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,2BAA2B,EACnC,OAAO,EAAE,sBAAsB,wGAIhC;AAED;;;;GAIG;AACH,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,2BAA2B,EACnC,OAAO,EAAE,0BAA0B,iEAIpC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a proxy forwarding call from an action, selecting the right forward_private_N method.
|
|
3
|
+
*/ async function buildProxyCall(proxy, action) {
|
|
4
|
+
const call = await action.getFunctionCall();
|
|
5
|
+
const argCount = call.args.length;
|
|
6
|
+
if (argCount === 2) {
|
|
7
|
+
return proxy.methods.forward_private_2(call.to, call.selector, call.args);
|
|
8
|
+
} else if (argCount === 3) {
|
|
9
|
+
return proxy.methods.forward_private_3(call.to, call.selector, call.args);
|
|
10
|
+
} else if (argCount === 4) {
|
|
11
|
+
return proxy.methods.forward_private_4(call.to, call.selector, call.args);
|
|
12
|
+
} else if (argCount === 5) {
|
|
13
|
+
return proxy.methods.forward_private_5(call.to, call.selector, call.args);
|
|
14
|
+
} else if (argCount === 6) {
|
|
15
|
+
return proxy.methods.forward_private_6(call.to, call.selector, call.args);
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`No forward_private_${argCount} method on proxy`);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Sends a contract call through the authwit proxy.
|
|
21
|
+
* The proxy becomes msg_sender in the target (triggering authwit validation),
|
|
22
|
+
* while the actual tx sender retains their keys in scope.
|
|
23
|
+
*/ export async function sendThroughAuthwitProxy(proxy, action, options) {
|
|
24
|
+
const proxyCall = await buildProxyCall(proxy, action);
|
|
25
|
+
return proxyCall.send(options);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Simulates a contract call through the authwit proxy.
|
|
29
|
+
* The proxy becomes msg_sender in the target (triggering authwit validation),
|
|
30
|
+
* while the actual tx sender retains their keys in scope.
|
|
31
|
+
*/ export async function simulateThroughAuthwitProxy(proxy, action, options) {
|
|
32
|
+
const proxyCall = await buildProxyCall(proxy, action);
|
|
33
|
+
return proxyCall.simulate(options);
|
|
34
|
+
}
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { type Logger } from '@aztec/aztec.js/log';
|
|
4
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
5
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
6
|
-
import {
|
|
5
|
+
import type { ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
|
|
7
6
|
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
8
7
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
9
8
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
10
9
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
11
|
-
import { TestWallet } from '@aztec/test-wallet/server';
|
|
12
10
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
13
|
-
import { type
|
|
11
|
+
import { SingleNodeTestContext, type SingleNodeTestOpts } from '../single-node/single_node_test_context.js';
|
|
12
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
14
13
|
/**
|
|
15
14
|
* Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
|
|
16
15
|
* However, we then setup a second PXE with a full prover instance.
|
|
17
16
|
* We configure this instance with all of the accounts and contracts.
|
|
18
17
|
* We then prove and verify transactions created via this full prover PXE.
|
|
18
|
+
*
|
|
19
|
+
* The real-prover sub-base of the single-node topology: extends {@link SingleNodeTestContext} so it
|
|
20
|
+
* reuses the base node tracking / chain monitor / teardown machinery, but builds its environment with
|
|
21
|
+
* the bespoke prover opts below (real BB, `realVerifier` L1, the snapshot/account + TokenSimulator
|
|
22
|
+
* harness, and a hand-built prover node) rather than the base's default fake-prover config.
|
|
19
23
|
*/
|
|
20
|
-
export declare class FullProverTest {
|
|
24
|
+
export declare class FullProverTest extends SingleNodeTestContext {
|
|
21
25
|
static TOKEN_NAME: string;
|
|
22
26
|
static TOKEN_SYMBOL: string;
|
|
23
27
|
static TOKEN_DECIMALS: bigint;
|
|
24
|
-
logger: Logger;
|
|
25
28
|
wallet: TestWallet;
|
|
26
29
|
provenWallet: TestWallet;
|
|
27
30
|
accounts: AztecAddress[];
|
|
28
|
-
|
|
31
|
+
fundedAccounts: InitialAccountData[];
|
|
29
32
|
fakeProofsAsset: TokenContract;
|
|
30
33
|
fakeProofsAssetInstance: ContractInstanceWithAddress;
|
|
31
34
|
tokenSim: TokenSimulator;
|
|
@@ -35,21 +38,22 @@ export declare class FullProverTest {
|
|
|
35
38
|
private provenComponents;
|
|
36
39
|
private bbConfigCleanup?;
|
|
37
40
|
private acvmConfigCleanup?;
|
|
38
|
-
|
|
41
|
+
/** Returns the proof verifier from the prover node (for test assertions). */
|
|
42
|
+
get circuitProofVerifier(): ClientProtocolCircuitVerifier | undefined;
|
|
39
43
|
provenAsset: TokenContract;
|
|
40
|
-
|
|
41
|
-
private
|
|
42
|
-
private simulatedProverNode;
|
|
44
|
+
private proverAztecNode;
|
|
45
|
+
private simulatedProverAztecNode;
|
|
43
46
|
l1Contracts: DeployAztecL1ContractsReturnType;
|
|
44
47
|
proverAddress: EthAddress;
|
|
48
|
+
private testName;
|
|
45
49
|
private minNumberOfTxsPerBlock;
|
|
46
50
|
private coinbase;
|
|
47
51
|
private realProofs;
|
|
48
52
|
constructor(testName: string, minNumberOfTxsPerBlock: number, coinbase: EthAddress, realProofs?: boolean);
|
|
49
53
|
private applyBaseSetup;
|
|
50
|
-
setup(): Promise<
|
|
54
|
+
setup(opts?: SingleNodeTestOpts): Promise<void>;
|
|
51
55
|
private mintFeeJuice;
|
|
52
56
|
teardown(): Promise<void>;
|
|
53
57
|
private applyMint;
|
|
54
58
|
}
|
|
55
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZTJlX3Byb3Zlcl90ZXN0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZml4dHVyZXMvZTJlX3Byb3Zlcl90ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUEyQixNQUFNLHlCQUF5QixDQUFDO0FBRTNGLE9BQU8sRUFBRSxZQUFZLEVBQUUsVUFBVSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFckUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDdEQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ2xELE9BQU8sS0FBSyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFdEUsT0FBTyxLQUFLLEVBQUUsZ0NBQWdDLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUlsRyxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDL0QsT0FBTyxLQUFLLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUMxRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQU10RSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDbEUsT0FBTyxFQUFFLHFCQUFxQixFQUFFLEtBQUssa0JBQWtCLEVBQUUsTUFBTSw0Q0FBNEMsQ0FBQztBQUM1RyxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFXM0Q7Ozs7Ozs7Ozs7R0FVRztBQUVILHFCQUFhLGNBQWUsU0FBUSxxQkFBcUI7SUFDdkQsTUFBTSxDQUFDLFVBQVUsU0FBVTtJQUMzQixNQUFNLENBQUMsWUFBWSxTQUFTO0lBQzVCLE1BQU0sQ0FBQyxjQUFjLFNBQU87SUFDNUIsTUFBTSxFQUFHLFVBQVUsQ0FBQztJQUNwQixZQUFZLEVBQUcsVUFBVSxDQUFDO0lBQzFCLFFBQVEsRUFBRSxZQUFZLEVBQUUsQ0FBTTtJQUM5QixjQUFjLEVBQUcsa0JBQWtCLEVBQUUsQ0FBQztJQUN0QyxlQUFlLEVBQUcsYUFBYSxDQUFDO0lBQ2hDLHVCQUF1QixFQUFHLDJCQUEyQixDQUFDO0lBQ3RELFFBQVEsRUFBRyxjQUFjLENBQUM7SUFDMUIsU0FBUyxFQUFHLFNBQVMsQ0FBQztJQUN0QixjQUFjLEVBQUcsY0FBYyxDQUFDO0lBQ2hDLFVBQVUsRUFBRyxVQUFVLENBQUM7SUFDeEIsT0FBTyxDQUFDLGdCQUFnQixDQUFxQjtJQUM3QyxPQUFPLENBQUMsZUFBZSxDQUFDLENBQXNCO0lBQzlDLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxDQUFzQjtJQUNoRCw2RUFBNkU7SUFDN0UsSUFBSSxvQkFBb0IsSUFBSSw2QkFBNkIsR0FBRyxTQUFTLENBRXBFO0lBQ0QsV0FBVyxFQUFHLGFBQWEsQ0FBQztJQUM1QixPQUFPLENBQUMsZUFBZSxDQUFvQjtJQUMzQyxPQUFPLENBQUMsd0JBQXdCLENBQW9CO0lBQzdDLFdBQVcsRUFBRyxnQ0FBZ0MsQ0FBQztJQUMvQyxhQUFhLEVBQUcsVUFBVSxDQUFDO0lBQ2xDLE9BQU8sQ0FBQyxRQUFRLENBQVM7SUFDekIsT0FBTyxDQUFDLHNCQUFzQixDQUFTO0lBQ3ZDLE9BQU8sQ0FBQyxRQUFRLENBQWE7SUFDN0IsT0FBTyxDQUFDLFVBQVUsQ0FBVTtJQUU1QixZQUFZLFFBQVEsRUFBRSxNQUFNLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBRSxVQUFVLEVBQUUsVUFBVSxVQUFPLEVBT3BHO1lBS2EsY0FBYztJQThCYixLQUFLLENBQUMsSUFBSSxHQUFFLGtCQUF1QixpQkE0SmpEO1lBRWEsWUFBWTtJQVNYLFFBQVEsa0JBZ0J0QjtZQUVhLFNBQVM7Q0FzQ3hCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e_prover_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/e2e_prover_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"e2e_prover_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/e2e_prover_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA2B,MAAM,yBAAyB,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAIlG,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAMtE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAC5G,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAW3D;;;;;;;;;;GAUG;AAEH,qBAAa,cAAe,SAAQ,qBAAqB;IACvD,MAAM,CAAC,UAAU,SAAU;IAC3B,MAAM,CAAC,YAAY,SAAS;IAC5B,MAAM,CAAC,cAAc,SAAO;IAC5B,MAAM,EAAG,UAAU,CAAC;IACpB,YAAY,EAAG,UAAU,CAAC;IAC1B,QAAQ,EAAE,YAAY,EAAE,CAAM;IAC9B,cAAc,EAAG,kBAAkB,EAAE,CAAC;IACtC,eAAe,EAAG,aAAa,CAAC;IAChC,uBAAuB,EAAG,2BAA2B,CAAC;IACtD,QAAQ,EAAG,cAAc,CAAC;IAC1B,SAAS,EAAG,SAAS,CAAC;IACtB,cAAc,EAAG,cAAc,CAAC;IAChC,UAAU,EAAG,UAAU,CAAC;IACxB,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,eAAe,CAAC,CAAsB;IAC9C,OAAO,CAAC,iBAAiB,CAAC,CAAsB;IAChD,6EAA6E;IAC7E,IAAI,oBAAoB,IAAI,6BAA6B,GAAG,SAAS,CAEpE;IACD,WAAW,EAAG,aAAa,CAAC;IAC5B,OAAO,CAAC,eAAe,CAAoB;IAC3C,OAAO,CAAC,wBAAwB,CAAoB;IAC7C,WAAW,EAAG,gCAAgC,CAAC;IAC/C,aAAa,EAAG,UAAU,CAAC;IAClC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,UAAU,CAAU;IAE5B,YAAY,QAAQ,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,UAAO,EAOpG;YAKa,cAAc;IA8Bb,KAAK,CAAC,IAAI,GAAE,kBAAuB,iBA4JjD;YAEa,YAAY;IASX,QAAQ,kBAgBtB;YAEa,SAAS;CAsCxB"}
|
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { createAztecNodeService } from '@aztec/aztec-node';
|
|
2
3
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
4
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
4
|
-
import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
5
5
|
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
6
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
7
6
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
8
7
|
import { SecretValue } from '@aztec/foundation/config';
|
|
9
8
|
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
10
9
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
11
|
-
import { createProverNode } from '@aztec/prover-node';
|
|
12
10
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
13
11
|
import { getContract } from 'viem';
|
|
14
12
|
import { privateKeyToAddress } from 'viem/accounts';
|
|
15
13
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
14
|
+
import { SingleNodeTestContext } from '../single-node/single_node_test_context.js';
|
|
16
15
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
17
16
|
import { getBBConfig } from './get_bb_config.js';
|
|
18
|
-
import {
|
|
17
|
+
import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setup, setupPXEAndGetWallet } from './setup.js';
|
|
18
|
+
import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
|
|
19
19
|
/**
|
|
20
20
|
* Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
|
|
21
21
|
* However, we then setup a second PXE with a full prover instance.
|
|
22
22
|
* We configure this instance with all of the accounts and contracts.
|
|
23
23
|
* We then prove and verify transactions created via this full prover PXE.
|
|
24
|
-
|
|
24
|
+
*
|
|
25
|
+
* The real-prover sub-base of the single-node topology: extends {@link SingleNodeTestContext} so it
|
|
26
|
+
* reuses the base node tracking / chain monitor / teardown machinery, but builds its environment with
|
|
27
|
+
* the bespoke prover opts below (real BB, `realVerifier` L1, the snapshot/account + TokenSimulator
|
|
28
|
+
* harness, and a hand-built prover node) rather than the base's default fake-prover config.
|
|
29
|
+
*/ export class FullProverTest extends SingleNodeTestContext {
|
|
25
30
|
static TOKEN_NAME = 'USDC';
|
|
26
31
|
static TOKEN_SYMBOL = 'USD';
|
|
27
32
|
static TOKEN_DECIMALS = 18n;
|
|
28
|
-
logger;
|
|
29
33
|
wallet;
|
|
30
34
|
provenWallet;
|
|
31
35
|
accounts = [];
|
|
32
|
-
|
|
36
|
+
fundedAccounts;
|
|
33
37
|
fakeProofsAsset;
|
|
34
38
|
fakeProofsAssetInstance;
|
|
35
39
|
tokenSim;
|
|
@@ -39,17 +43,21 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
39
43
|
provenComponents = [];
|
|
40
44
|
bbConfigCleanup;
|
|
41
45
|
acvmConfigCleanup;
|
|
42
|
-
circuitProofVerifier
|
|
46
|
+
/** Returns the proof verifier from the prover node (for test assertions). */ get circuitProofVerifier() {
|
|
47
|
+
return this.proverAztecNode?.getProofVerifier();
|
|
48
|
+
}
|
|
43
49
|
provenAsset;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
simulatedProverNode;
|
|
50
|
+
proverAztecNode;
|
|
51
|
+
simulatedProverAztecNode;
|
|
47
52
|
l1Contracts;
|
|
48
53
|
proverAddress;
|
|
54
|
+
testName;
|
|
49
55
|
minNumberOfTxsPerBlock;
|
|
50
56
|
coinbase;
|
|
51
57
|
realProofs;
|
|
52
58
|
constructor(testName, minNumberOfTxsPerBlock, coinbase, realProofs = true){
|
|
59
|
+
super();
|
|
60
|
+
this.testName = testName;
|
|
53
61
|
this.logger = createLogger(`e2e:full_prover_test:${testName}`);
|
|
54
62
|
this.minNumberOfTxsPerBlock = minNumberOfTxsPerBlock;
|
|
55
63
|
this.coinbase = coinbase;
|
|
@@ -58,55 +66,52 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
58
66
|
/**
|
|
59
67
|
* Applies base setup: deploys 2 accounts and token contract.
|
|
60
68
|
*/ async applyBaseSetup() {
|
|
61
|
-
this.logger.info('Applying base setup:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
initialFundedAccounts: this.context.initialFundedAccounts
|
|
65
|
-
});
|
|
66
|
-
this.deployedAccounts = deployedAccounts;
|
|
67
|
-
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
69
|
+
this.logger.info('Applying base setup: registering funded accounts');
|
|
70
|
+
this.fundedAccounts = this.context.additionallyFundedAccounts;
|
|
71
|
+
this.accounts = this.fundedAccounts.map((a)=>a.address);
|
|
68
72
|
this.wallet = this.context.wallet;
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
for (const { secret, salt, signingKey } of this.fundedAccounts){
|
|
74
|
+
await this.wallet.createSchnorrInitializerlessAccount(secret, salt, signingKey);
|
|
75
|
+
}
|
|
71
76
|
this.logger.info('Applying base setup: deploying token contract');
|
|
72
77
|
const { contract: asset, instance } = await TokenContract.deploy(this.wallet, this.accounts[0], FullProverTest.TOKEN_NAME, FullProverTest.TOKEN_SYMBOL, FullProverTest.TOKEN_DECIMALS).send({
|
|
73
|
-
from: this.accounts[0]
|
|
74
|
-
wait: {
|
|
75
|
-
returnReceipt: true
|
|
76
|
-
}
|
|
78
|
+
from: this.accounts[0]
|
|
77
79
|
});
|
|
78
80
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
79
81
|
this.fakeProofsAsset = asset;
|
|
80
82
|
this.fakeProofsAssetInstance = instance;
|
|
81
83
|
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
82
84
|
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallet, this.accounts[0], this.logger, this.accounts);
|
|
83
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate({
|
|
85
|
+
expect((await this.fakeProofsAsset.methods.get_admin().simulate({
|
|
84
86
|
from: this.accounts[0]
|
|
85
|
-
})).toBe(this.accounts[0].toBigInt());
|
|
87
|
+
})).result).toBe(this.accounts[0].toBigInt());
|
|
86
88
|
}
|
|
87
|
-
async setup() {
|
|
89
|
+
async setup(opts = {}) {
|
|
88
90
|
this.logger.info('Setting up subsystems from fresh');
|
|
89
|
-
|
|
91
|
+
const context = await setup(0, {
|
|
92
|
+
...opts,
|
|
90
93
|
startProverNode: true,
|
|
91
94
|
coinbase: this.coinbase,
|
|
92
95
|
fundSponsoredFPC: true,
|
|
93
|
-
|
|
96
|
+
additionallyFundedAccounts: await generateSchnorrAccounts(2),
|
|
94
97
|
l1ContractsArgs: {
|
|
95
98
|
realVerifier: this.realProofs
|
|
96
99
|
}
|
|
97
100
|
});
|
|
101
|
+
// Reuse the base context machinery (rollup, epoch cache, chain monitor, node tracking, teardown)
|
|
102
|
+
// over the environment built above. Restore the FullProverTest-named logger afterwards, since
|
|
103
|
+
// hydrateFromContext repoints `this.logger` at the context logger.
|
|
104
|
+
await this.hydrateFromContext(context);
|
|
105
|
+
this.logger = createLogger(`e2e:full_prover_test:${this.testName}`);
|
|
98
106
|
await this.applyBaseSetup();
|
|
99
107
|
await this.applyMint();
|
|
100
108
|
this.logger.info(`Enabling proving`, {
|
|
101
109
|
realProofs: this.realProofs
|
|
102
110
|
});
|
|
103
|
-
|
|
104
|
-
this.context.watcher.setIsMarkingAsProven(false);
|
|
105
|
-
this.simulatedProverNode = this.context.proverNode;
|
|
111
|
+
this.simulatedProverAztecNode = this.context.proverNode;
|
|
106
112
|
({ aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes } = this.context);
|
|
107
113
|
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
108
114
|
const config = this.context.aztecNodeConfig;
|
|
109
|
-
const blobClient = await createBlobClientWithFileStores(config, this.logger);
|
|
110
115
|
// Configure a full prover PXE
|
|
111
116
|
let acvmConfig;
|
|
112
117
|
let bbConfig;
|
|
@@ -123,8 +128,6 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
123
128
|
await Barretenberg.initSingleton({
|
|
124
129
|
backend: BackendType.NativeUnixSocket
|
|
125
130
|
});
|
|
126
|
-
const verifier = await BBCircuitVerifier.new(bbConfig);
|
|
127
|
-
this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
|
|
128
131
|
this.logger.debug(`Configuring the node for real proofs...`);
|
|
129
132
|
await this.aztecNodeAdmin.setConfig({
|
|
130
133
|
realProofs: true,
|
|
@@ -132,7 +135,6 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
132
135
|
});
|
|
133
136
|
} else {
|
|
134
137
|
this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
|
|
135
|
-
this.circuitProofVerifier = new TestCircuitVerifier();
|
|
136
138
|
await this.aztecNodeAdmin.setConfig({
|
|
137
139
|
minTxsPerBlock: this.minNumberOfTxsPerBlock
|
|
138
140
|
});
|
|
@@ -142,14 +144,16 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
142
144
|
this.logger.verbose(`Marking current block as proven`);
|
|
143
145
|
await this.context.cheatCodes.rollup.markAsProven();
|
|
144
146
|
this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
|
|
145
|
-
const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(this.aztecNode, {
|
|
147
|
+
const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(this.aztecNode, this.context.aztecNode, {
|
|
146
148
|
proverEnabled: this.realProofs
|
|
147
149
|
}, undefined, 'pxe-proven');
|
|
148
150
|
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
149
151
|
await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
|
|
150
152
|
for(let i = 0; i < 2; i++){
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
// Mirror the initializerless funded accounts (created via createFundedAccounts) in both wallets so
|
|
154
|
+
// their addresses match the genesis-funded ones.
|
|
155
|
+
await provenWallet.createSchnorrInitializerlessAccount(this.fundedAccounts[i].secret, this.fundedAccounts[i].salt, this.fundedAccounts[i].signingKey);
|
|
156
|
+
await this.wallet.createSchnorrInitializerlessAccount(this.fundedAccounts[i].secret, this.fundedAccounts[i].salt, this.fundedAccounts[i].signingKey);
|
|
153
157
|
}
|
|
154
158
|
const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
155
159
|
this.provenComponents.push({
|
|
@@ -159,36 +163,30 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
159
163
|
this.provenAsset = asset;
|
|
160
164
|
this.provenWallet = provenWallet;
|
|
161
165
|
this.logger.info(`Full prover PXE started`);
|
|
162
|
-
// Shutdown the current, simulated prover node
|
|
166
|
+
// Shutdown the current, simulated prover node (by stopping its hosting aztec node)
|
|
163
167
|
this.logger.verbose('Shutting down simulated prover node');
|
|
164
|
-
await this.
|
|
165
|
-
// Creating temp store and archiver for fully proven prover node
|
|
166
|
-
this.logger.verbose('Starting archiver for new prover node');
|
|
167
|
-
const archiver = await createArchiver({
|
|
168
|
-
...this.context.aztecNodeConfig,
|
|
169
|
-
dataDirectory: undefined
|
|
170
|
-
}, {
|
|
171
|
-
blobClient,
|
|
172
|
-
dateProvider: this.context.dateProvider
|
|
173
|
-
}, {
|
|
174
|
-
blockUntilSync: true
|
|
175
|
-
});
|
|
168
|
+
await this.simulatedProverAztecNode.stop();
|
|
176
169
|
// The simulated prover node (now shutdown) used private key index 2
|
|
177
170
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
171
|
+
const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
|
|
178
172
|
const proverNodeSenderAddress = privateKeyToAddress(new Buffer32(proverNodePrivateKey).toString());
|
|
179
173
|
this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
|
|
180
174
|
this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
|
|
181
175
|
await this.mintFeeJuice(proverNodeSenderAddress);
|
|
182
176
|
this.logger.verbose('Starting prover node');
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
178
|
+
const { genesis } = await getGenesisValues(this.context.additionallyFundedAccounts.map((a)=>a.address).concat(sponsoredFPCAddress), undefined, undefined, this.context.genesis.genesisTimestamp, await getStandardContractGenesisNullifiers());
|
|
179
|
+
const proverNodeConfig = {
|
|
180
|
+
...config,
|
|
181
|
+
enableProverNode: true,
|
|
182
|
+
disableValidator: true,
|
|
186
183
|
dataDirectory: undefined,
|
|
184
|
+
txCollectionNodeRpcUrls: [],
|
|
187
185
|
proverId: this.proverAddress,
|
|
188
186
|
realProofs: this.realProofs,
|
|
189
187
|
proverAgentCount: 2,
|
|
190
|
-
|
|
191
|
-
new SecretValue(
|
|
188
|
+
proverPublisherPrivateKeys: [
|
|
189
|
+
new SecretValue(proverNodePrivateKeyHex)
|
|
192
190
|
],
|
|
193
191
|
proverNodeMaxPendingJobs: 100,
|
|
194
192
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
@@ -196,23 +194,32 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
196
194
|
txGatheringIntervalMs: 1000,
|
|
197
195
|
txGatheringBatchSize: 10,
|
|
198
196
|
txGatheringMaxParallelRequestsPerNode: 100,
|
|
199
|
-
|
|
197
|
+
// The test warps the L1 clock forward a full epoch via cheatcodes; the prover-node
|
|
198
|
+
// tracks L1 time, so an in-flight tx-gather would see its deadline jump into the
|
|
199
|
+
// past. Use a generous window so the deadline survives the warp.
|
|
200
|
+
txGatheringTimeoutMs: 10 * 60 * 1000,
|
|
200
201
|
proverNodeFailedEpochStore: undefined,
|
|
201
|
-
proverNodeEpochProvingDelayMs: undefined
|
|
202
|
+
proverNodeEpochProvingDelayMs: undefined,
|
|
203
|
+
validatorPrivateKeys: new SecretValue([])
|
|
202
204
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
this.proverAztecNode = await createAztecNodeService(proverNodeConfig, {
|
|
206
|
+
dateProvider: this.context.dateProvider,
|
|
207
|
+
p2pClientDeps: {
|
|
208
|
+
rpcTxProviders: [
|
|
209
|
+
this.aztecNode
|
|
210
|
+
]
|
|
211
|
+
}
|
|
208
212
|
}, {
|
|
209
|
-
|
|
213
|
+
genesis
|
|
210
214
|
});
|
|
211
|
-
|
|
215
|
+
// Track the real prover node so the base teardown stops it (the simulated one created by `setup`
|
|
216
|
+
// was already stopped above).
|
|
217
|
+
this.proverNodes = [
|
|
218
|
+
this.proverAztecNode
|
|
219
|
+
];
|
|
212
220
|
this.logger.warn(`Proofs are now enabled`, {
|
|
213
221
|
realProofs: this.realProofs
|
|
214
222
|
});
|
|
215
|
-
return this;
|
|
216
223
|
}
|
|
217
224
|
async mintFeeJuice(recipient) {
|
|
218
225
|
const handlerAddress = this.context.deployL1ContractsValues.l1ContractAddresses.feeAssetHandlerAddress;
|
|
@@ -235,12 +242,14 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
235
242
|
for(let i = 0; i < this.provenComponents.length; i++){
|
|
236
243
|
await this.provenComponents[i].teardown();
|
|
237
244
|
}
|
|
238
|
-
//
|
|
239
|
-
await this.
|
|
245
|
+
// Stop the prover node before destroying the BB singleton it proves with.
|
|
246
|
+
await this.proverAztecNode.stop();
|
|
240
247
|
await Barretenberg.destroySingleton();
|
|
241
248
|
await this.bbConfigCleanup?.();
|
|
242
249
|
await this.acvmConfigCleanup?.();
|
|
243
|
-
|
|
250
|
+
// Stops the chain monitor, the tracked nodes (main node + the already-stopped prover node, a
|
|
251
|
+
// safe no-op), and the context.
|
|
252
|
+
await super.teardown();
|
|
244
253
|
}
|
|
245
254
|
async applyMint() {
|
|
246
255
|
this.logger.info('Applying mint setup');
|
|
@@ -258,18 +267,18 @@ import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicD
|
|
|
258
267
|
this.logger.info(`Minting complete`);
|
|
259
268
|
const { fakeProofsAsset, accounts: [address], tokenSim } = this;
|
|
260
269
|
tokenSim.mintPublic(address, publicAmount);
|
|
261
|
-
const publicBalance = await fakeProofsAsset.methods.balance_of_public(address).simulate({
|
|
270
|
+
const { result: publicBalance } = await fakeProofsAsset.methods.balance_of_public(address).simulate({
|
|
262
271
|
from: address
|
|
263
272
|
});
|
|
264
273
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
265
274
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
266
275
|
tokenSim.mintPrivate(address, publicAmount);
|
|
267
|
-
const privateBalance = await fakeProofsAsset.methods.balance_of_private(address).simulate({
|
|
276
|
+
const { result: privateBalance } = await fakeProofsAsset.methods.balance_of_private(address).simulate({
|
|
268
277
|
from: address
|
|
269
278
|
});
|
|
270
279
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
271
280
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
272
|
-
const totalSupply = await fakeProofsAsset.methods.total_supply().simulate({
|
|
281
|
+
const { result: totalSupply } = await fakeProofsAsset.methods.total_supply().simulate({
|
|
273
282
|
from: address
|
|
274
283
|
});
|
|
275
284
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Samples event-loop utilization, delay histogram, and heap usage per test, writing columnar text to a file. */
|
|
2
|
+
export declare class EluMonitor {
|
|
3
|
+
private filePath;
|
|
4
|
+
private intervalMs;
|
|
5
|
+
private timer;
|
|
6
|
+
private lastELU;
|
|
7
|
+
private histogram;
|
|
8
|
+
private testName;
|
|
9
|
+
private testStart;
|
|
10
|
+
private eluSamples;
|
|
11
|
+
constructor(filePath: string, intervalMs?: number);
|
|
12
|
+
/** Begin sampling for a test. Writes a header line and starts the periodic sampler. */
|
|
13
|
+
startTest(testName: string): void;
|
|
14
|
+
/** Stop sampling and write a summary line. */
|
|
15
|
+
stopTest(): void;
|
|
16
|
+
/** Alias for stopTest — call on process exit to flush any remaining data. */
|
|
17
|
+
stop(): void;
|
|
18
|
+
private sample;
|
|
19
|
+
private writeSummary;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWx1X21vbml0b3IuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maXh0dXJlcy9lbHVfbW9uaXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxpSEFBaUg7QUFDakgscUJBQWEsVUFBVTtJQUNyQixPQUFPLENBQUMsUUFBUSxDQUFTO0lBQ3pCLE9BQU8sQ0FBQyxVQUFVLENBQVM7SUFDM0IsT0FBTyxDQUFDLEtBQUssQ0FBNkM7SUFDMUQsT0FBTyxDQUFDLE9BQU8sQ0FBbUM7SUFDbEQsT0FBTyxDQUFDLFNBQVMsQ0FBb0I7SUFDckMsT0FBTyxDQUFDLFFBQVEsQ0FBcUI7SUFDckMsT0FBTyxDQUFDLFNBQVMsQ0FBcUI7SUFDdEMsT0FBTyxDQUFDLFVBQVUsQ0FBZ0I7SUFFbEMsWUFBWSxRQUFRLEVBQUUsTUFBTSxFQUFFLFVBQVUsQ0FBQyxFQUFFLE1BQU0sRUFJaEQ7SUFFRCx1RkFBdUY7SUFDdkYsU0FBUyxDQUFDLFFBQVEsRUFBRSxNQUFNLEdBQUcsSUFBSSxDQW1CaEM7SUFFRCw4Q0FBOEM7SUFDOUMsUUFBUSxJQUFJLElBQUksQ0FtQmY7SUFFRCwrRUFBNkU7SUFDN0UsSUFBSSxJQUFJLElBQUksQ0FFWDtJQUVELE9BQU8sQ0FBQyxNQUFNO0lBOEJkLE9BQU8sQ0FBQyxZQUFZO0NBbUJyQiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elu_monitor.d.ts","sourceRoot":"","sources":["../../src/fixtures/elu_monitor.ts"],"names":[],"mappings":"AAKA,iHAAiH;AACjH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,UAAU,CAAgB;IAElC,YAAY,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAIhD;IAED,uFAAuF;IACvF,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAmBhC;IAED,8CAA8C;IAC9C,QAAQ,IAAI,IAAI,CAmBf;IAED,+EAA6E;IAC7E,IAAI,IAAI,IAAI,CAEX;IAED,OAAO,CAAC,MAAM;IA8Bd,OAAO,CAAC,YAAY;CAmBrB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { appendFileSync } from 'node:fs';
|
|
2
|
+
import { monitorEventLoopDelay, performance } from 'node:perf_hooks';
|
|
3
|
+
const NANOS_PER_MS = 1_000_000;
|
|
4
|
+
/** Samples event-loop utilization, delay histogram, and heap usage per test, writing columnar text to a file. */ export class EluMonitor {
|
|
5
|
+
filePath;
|
|
6
|
+
intervalMs;
|
|
7
|
+
timer;
|
|
8
|
+
lastELU;
|
|
9
|
+
histogram;
|
|
10
|
+
testName;
|
|
11
|
+
testStart;
|
|
12
|
+
eluSamples = [];
|
|
13
|
+
constructor(filePath, intervalMs){
|
|
14
|
+
this.filePath = filePath;
|
|
15
|
+
this.intervalMs = intervalMs ?? 2000;
|
|
16
|
+
this.histogram = monitorEventLoopDelay({
|
|
17
|
+
resolution: 20
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** Begin sampling for a test. Writes a header line and starts the periodic sampler. */ startTest(testName) {
|
|
21
|
+
this.stopTest();
|
|
22
|
+
this.testName = testName;
|
|
23
|
+
this.testStart = performance.now();
|
|
24
|
+
this.eluSamples = [];
|
|
25
|
+
appendFileSync(this.filePath, `\n=== Test: ${testName} ===\n`);
|
|
26
|
+
appendFileSync(this.filePath, padColumns('TIME', 'ELU', 'EL_DLY_P50', 'EL_DLY_P99', 'EL_DLY_MAX', 'HEAP_MB') + '\n');
|
|
27
|
+
this.lastELU = performance.eventLoopUtilization();
|
|
28
|
+
this.histogram.enable();
|
|
29
|
+
this.timer = setInterval(()=>this.sample(), this.intervalMs);
|
|
30
|
+
// Allow the process to exit even if the timer is still running.
|
|
31
|
+
this.timer.unref();
|
|
32
|
+
}
|
|
33
|
+
/** Stop sampling and write a summary line. */ stopTest() {
|
|
34
|
+
if (!this.timer) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Take a final sample before stopping.
|
|
38
|
+
this.sample();
|
|
39
|
+
clearInterval(this.timer);
|
|
40
|
+
this.timer = undefined;
|
|
41
|
+
this.histogram.disable();
|
|
42
|
+
this.histogram.reset();
|
|
43
|
+
this.writeSummary();
|
|
44
|
+
this.lastELU = undefined;
|
|
45
|
+
this.testName = undefined;
|
|
46
|
+
this.testStart = undefined;
|
|
47
|
+
this.eluSamples = [];
|
|
48
|
+
}
|
|
49
|
+
/** Alias for stopTest — call on process exit to flush any remaining data. */ stop() {
|
|
50
|
+
this.stopTest();
|
|
51
|
+
}
|
|
52
|
+
sample() {
|
|
53
|
+
const newELU = performance.eventLoopUtilization();
|
|
54
|
+
const delta = performance.eventLoopUtilization(newELU, this.lastELU);
|
|
55
|
+
this.lastELU = newELU;
|
|
56
|
+
const elu = delta.utilization;
|
|
57
|
+
this.eluSamples.push(elu);
|
|
58
|
+
const p50 = this.histogram.percentile(50) / NANOS_PER_MS;
|
|
59
|
+
const p99 = this.histogram.percentile(99) / NANOS_PER_MS;
|
|
60
|
+
const max = this.histogram.max / NANOS_PER_MS;
|
|
61
|
+
const heapMb = Math.round(process.memoryUsage().heapUsed / (1024 * 1024));
|
|
62
|
+
const now = new Date();
|
|
63
|
+
const time = [
|
|
64
|
+
now.getHours(),
|
|
65
|
+
now.getMinutes(),
|
|
66
|
+
now.getSeconds()
|
|
67
|
+
].map((n)=>String(n).padStart(2, '0')).join(':');
|
|
68
|
+
const line = padColumns(time, elu.toFixed(2), `${p50.toFixed(1)}ms`, `${p99.toFixed(1)}ms`, `${max.toFixed(1)}ms`, String(heapMb));
|
|
69
|
+
appendFileSync(this.filePath, line + '\n');
|
|
70
|
+
// Reset histogram so next sample only reflects the new interval.
|
|
71
|
+
this.histogram.reset();
|
|
72
|
+
}
|
|
73
|
+
writeSummary() {
|
|
74
|
+
if (this.eluSamples.length === 0 || this.testStart === undefined) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const mean = this.eluSamples.reduce((a, b)=>a + b, 0) / this.eluSamples.length;
|
|
78
|
+
const maxElu = Math.max(...this.eluSamples);
|
|
79
|
+
const sorted = [
|
|
80
|
+
...this.eluSamples
|
|
81
|
+
].sort((a, b)=>a - b);
|
|
82
|
+
const p90Elu = sorted[Math.floor(sorted.length * 0.9)] ?? maxElu;
|
|
83
|
+
const durationS = ((performance.now() - this.testStart) / 1000).toFixed(1);
|
|
84
|
+
let summary = `--- Summary: mean_elu=${mean.toFixed(2)} max_elu=${maxElu.toFixed(2)} p90_elu=${p90Elu.toFixed(2)} duration=${durationS}s`;
|
|
85
|
+
if (maxElu > 0.85) {
|
|
86
|
+
summary += ' WARNING:ELU>0.85';
|
|
87
|
+
}
|
|
88
|
+
summary += ' ---\n';
|
|
89
|
+
appendFileSync(this.filePath, summary);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function padColumns(...cols) {
|
|
93
|
+
const widths = [
|
|
94
|
+
11,
|
|
95
|
+
7,
|
|
96
|
+
12,
|
|
97
|
+
12,
|
|
98
|
+
12,
|
|
99
|
+
8
|
|
100
|
+
];
|
|
101
|
+
return cols.map((col, i)=>col.padEnd(widths[i] ?? 10)).join('');
|
|
102
|
+
}
|