@aztec/end-to-end 0.0.1-commit.d431d1c → 0.0.1-commit.d58ff9d0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -14
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +50 -54
- 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 +44 -49
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +19 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +68 -44
- 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 +7 -6
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +108 -12
- 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 +85 -74
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +83 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +86 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +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 +113 -60
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +330 -326
- 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 +46 -35
- package/dest/fixtures/timing.d.ts +42 -0
- package/dest/fixtures/timing.d.ts.map +1 -0
- package/dest/fixtures/timing.js +72 -0
- package/dest/fixtures/token_utils.d.ts +22 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +28 -7
- package/dest/fixtures/utils.d.ts +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 +99 -35
- 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 +8 -7
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +44 -39
- package/dest/shared/gas_portal_test_harness.d.ts +8 -5
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +27 -15
- 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 +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 +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +67 -55
- 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 +29 -17
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +18 -5
- package/dest/single-node/fees/fees_test.d.ts +93 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/fees_test.js +96 -70
- 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 +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +153 -49
- package/dest/spartan/tx_metrics.d.ts +64 -5
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +280 -21
- 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 -260
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -942
- 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 +56 -69
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +51 -59
- 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 +111 -90
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +1 -0
- package/src/bench/utils.ts +123 -12
- 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 +102 -103
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +110 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +192 -0
- package/src/fixtures/index.ts +2 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +421 -444
- package/src/fixtures/setup_p2p_test.ts +54 -54
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +46 -10
- 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 +95 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +132 -57
- package/src/p2p/reqresp/utils.ts +263 -0
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +52 -41
- package/src/shared/gas_portal_test_harness.ts +34 -16
- 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 +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 +109 -74
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +35 -17
- 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 +20 -9
- package/src/{e2e_fees → single-node/fees}/fees_test.ts +120 -95
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1041 -0
- package/src/spartan/setup_test_wallets.ts +208 -34
- package/src/spartan/tx_metrics.ts +255 -26
- 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 -1246
- 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 -94
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -339
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -88
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -62
- 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 -184
- 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 -451
- package/src/e2e_l1_publisher/write_json.ts +0 -82
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -75
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
- package/src/e2e_p2p/shared.ts +0 -290
- /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,126 @@
|
|
|
1
|
+
import { appendFileSync } from 'node:fs';
|
|
2
|
+
import { type EventLoopUtilization, type IntervalHistogram, monitorEventLoopDelay, performance } from 'node:perf_hooks';
|
|
3
|
+
|
|
4
|
+
const NANOS_PER_MS = 1_000_000;
|
|
5
|
+
|
|
6
|
+
/** Samples event-loop utilization, delay histogram, and heap usage per test, writing columnar text to a file. */
|
|
7
|
+
export class EluMonitor {
|
|
8
|
+
private filePath: string;
|
|
9
|
+
private intervalMs: number;
|
|
10
|
+
private timer: ReturnType<typeof setInterval> | undefined;
|
|
11
|
+
private lastELU: EventLoopUtilization | undefined;
|
|
12
|
+
private histogram: IntervalHistogram;
|
|
13
|
+
private testName: string | undefined;
|
|
14
|
+
private testStart: number | undefined;
|
|
15
|
+
private eluSamples: number[] = [];
|
|
16
|
+
|
|
17
|
+
constructor(filePath: string, intervalMs?: number) {
|
|
18
|
+
this.filePath = filePath;
|
|
19
|
+
this.intervalMs = intervalMs ?? 2000;
|
|
20
|
+
this.histogram = monitorEventLoopDelay({ resolution: 20 });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Begin sampling for a test. Writes a header line and starts the periodic sampler. */
|
|
24
|
+
startTest(testName: string): void {
|
|
25
|
+
this.stopTest();
|
|
26
|
+
|
|
27
|
+
this.testName = testName;
|
|
28
|
+
this.testStart = performance.now();
|
|
29
|
+
this.eluSamples = [];
|
|
30
|
+
|
|
31
|
+
appendFileSync(this.filePath, `\n=== Test: ${testName} ===\n`);
|
|
32
|
+
appendFileSync(
|
|
33
|
+
this.filePath,
|
|
34
|
+
padColumns('TIME', 'ELU', 'EL_DLY_P50', 'EL_DLY_P99', 'EL_DLY_MAX', 'HEAP_MB') + '\n',
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
this.lastELU = performance.eventLoopUtilization();
|
|
38
|
+
this.histogram.enable();
|
|
39
|
+
|
|
40
|
+
this.timer = setInterval(() => this.sample(), this.intervalMs);
|
|
41
|
+
// Allow the process to exit even if the timer is still running.
|
|
42
|
+
this.timer.unref();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Stop sampling and write a summary line. */
|
|
46
|
+
stopTest(): void {
|
|
47
|
+
if (!this.timer) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Take a final sample before stopping.
|
|
52
|
+
this.sample();
|
|
53
|
+
|
|
54
|
+
clearInterval(this.timer);
|
|
55
|
+
this.timer = undefined;
|
|
56
|
+
this.histogram.disable();
|
|
57
|
+
this.histogram.reset();
|
|
58
|
+
|
|
59
|
+
this.writeSummary();
|
|
60
|
+
|
|
61
|
+
this.lastELU = undefined;
|
|
62
|
+
this.testName = undefined;
|
|
63
|
+
this.testStart = undefined;
|
|
64
|
+
this.eluSamples = [];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Alias for stopTest — call on process exit to flush any remaining data. */
|
|
68
|
+
stop(): void {
|
|
69
|
+
this.stopTest();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private sample(): void {
|
|
73
|
+
const newELU = performance.eventLoopUtilization();
|
|
74
|
+
const delta = performance.eventLoopUtilization(newELU, this.lastELU);
|
|
75
|
+
this.lastELU = newELU;
|
|
76
|
+
|
|
77
|
+
const elu = delta.utilization;
|
|
78
|
+
this.eluSamples.push(elu);
|
|
79
|
+
|
|
80
|
+
const p50 = this.histogram.percentile(50) / NANOS_PER_MS;
|
|
81
|
+
const p99 = this.histogram.percentile(99) / NANOS_PER_MS;
|
|
82
|
+
const max = this.histogram.max / NANOS_PER_MS;
|
|
83
|
+
const heapMb = Math.round(process.memoryUsage().heapUsed / (1024 * 1024));
|
|
84
|
+
|
|
85
|
+
const now = new Date();
|
|
86
|
+
const time = [now.getHours(), now.getMinutes(), now.getSeconds()].map(n => String(n).padStart(2, '0')).join(':');
|
|
87
|
+
|
|
88
|
+
const line = padColumns(
|
|
89
|
+
time,
|
|
90
|
+
elu.toFixed(2),
|
|
91
|
+
`${p50.toFixed(1)}ms`,
|
|
92
|
+
`${p99.toFixed(1)}ms`,
|
|
93
|
+
`${max.toFixed(1)}ms`,
|
|
94
|
+
String(heapMb),
|
|
95
|
+
);
|
|
96
|
+
appendFileSync(this.filePath, line + '\n');
|
|
97
|
+
|
|
98
|
+
// Reset histogram so next sample only reflects the new interval.
|
|
99
|
+
this.histogram.reset();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private writeSummary(): void {
|
|
103
|
+
if (this.eluSamples.length === 0 || this.testStart === undefined) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const mean = this.eluSamples.reduce((a, b) => a + b, 0) / this.eluSamples.length;
|
|
108
|
+
const maxElu = Math.max(...this.eluSamples);
|
|
109
|
+
const sorted = [...this.eluSamples].sort((a, b) => a - b);
|
|
110
|
+
const p90Elu = sorted[Math.floor(sorted.length * 0.9)] ?? maxElu;
|
|
111
|
+
const durationS = ((performance.now() - this.testStart) / 1000).toFixed(1);
|
|
112
|
+
|
|
113
|
+
let summary = `--- Summary: mean_elu=${mean.toFixed(2)} max_elu=${maxElu.toFixed(2)} p90_elu=${p90Elu.toFixed(2)} duration=${durationS}s`;
|
|
114
|
+
if (maxElu > 0.85) {
|
|
115
|
+
summary += ' WARNING:ELU>0.85';
|
|
116
|
+
}
|
|
117
|
+
summary += ' ---\n';
|
|
118
|
+
|
|
119
|
+
appendFileSync(this.filePath, summary);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function padColumns(...cols: string[]): string {
|
|
124
|
+
const widths = [11, 7, 12, 12, 12, 8];
|
|
125
|
+
return cols.map((col, i) => col.padEnd(widths[i] ?? 10)).join('');
|
|
126
|
+
}
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -1,5 +1,97 @@
|
|
|
1
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
|
+
import { TEST_FEE_PADDING } from '@aztec/aztec/testing';
|
|
3
|
+
import type { GasFees } from '@aztec/stdlib/gas';
|
|
4
|
+
|
|
1
5
|
export const METRICS_PORT = 4318;
|
|
2
6
|
|
|
7
|
+
/** Default fee padding applied to predicted min fees in e2e tests. */
|
|
8
|
+
export const DEFAULT_MIN_FEE_PADDING = 5;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Large fee padding for txs that may be mined significantly later than when they were created,
|
|
12
|
+
* such as cloned txs in throughput/capacity benchmarks, where fees may spike between creation and mining.
|
|
13
|
+
*/
|
|
14
|
+
export const LARGE_MIN_FEE_PADDING = 15;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Fee padding used by tests running under proposer pipelining. Under pipelining the fee-asset
|
|
18
|
+
* price modifier evolves faster across the build/publish gap, so client-set maxFeesPerGas (sized
|
|
19
|
+
* for the default 5x padding) was getting bumped past by the time the tx mined a few slots later.
|
|
20
|
+
* Observed worst case in CI: fee evolved ~20x between PXE snapshot and inclusion, exceeding even
|
|
21
|
+
* LARGE_MIN_FEE_PADDING (15x). Same multiplier and same class of problem as the published
|
|
22
|
+
* {@link TEST_FEE_PADDING}, re-exported under a name that captures the pipelining rationale.
|
|
23
|
+
*/
|
|
24
|
+
export const PIPELINED_FEE_PADDING = TEST_FEE_PADDING;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Setup option preset that opts a test into proposer pipelining. Use with `setup()`:
|
|
28
|
+
*
|
|
29
|
+
* await setup(N, { ...PIPELINING_SETUP_OPTS, ...otherOpts });
|
|
30
|
+
*
|
|
31
|
+
* The preset runs the production Sequencer with the always-enforced timetable at real (wall-clock)
|
|
32
|
+
* timing, yielding exactly 2 blocks per slot. It sets:
|
|
33
|
+
* - `inboxLag: 2` so the sequencer sources L1->L2 messages from checkpoint N-1 (already sealed),
|
|
34
|
+
* avoiding `L1ToL2MessagesNotReadyError` when building for slot N during slot N-1.
|
|
35
|
+
* - `minTxsPerBlock: 0` so empty checkpoints land even when a tx arrives late in the build window
|
|
36
|
+
* (otherwise the chain stalls on alternating slots).
|
|
37
|
+
* - `aztecSlotDuration: 12` / `ethereumSlotDuration: 4` so the pipelined cycle fits inside the
|
|
38
|
+
* default 300s Jest hook budget. Tests that depend on the env-default 72s/12s should override.
|
|
39
|
+
* - `blockDurationMs: 3000` to cut exactly 2 blocks per slot. With `ethereumSlotDuration < 8` the
|
|
40
|
+
* timing model normalizes to `init=0.5`, `assemble=0.5`, `P=0`, `minExec=1`, so
|
|
41
|
+
* `maxBlocks = floor((S - init - (assemble + 2P + D)) / D) = floor((12 - 0.5 - (0.5 + 0 + 3)) / 3)
|
|
42
|
+
* = floor(8/3) = 2`. (`blockDurationMs: 2000` would give 4 blocks/slot; 3000 also matches the
|
|
43
|
+
* production default.)
|
|
44
|
+
* - `walletMinFeePadding: PIPELINED_FEE_PADDING` (30x) to absorb the wider fee evolution window.
|
|
45
|
+
*/
|
|
46
|
+
export const PIPELINING_SETUP_OPTS = {
|
|
47
|
+
inboxLag: 2,
|
|
48
|
+
minTxsPerBlock: 0,
|
|
49
|
+
aztecSlotDuration: 12,
|
|
50
|
+
ethereumSlotDuration: 4,
|
|
51
|
+
blockDurationMs: 3000,
|
|
52
|
+
walletMinFeePadding: PIPELINED_FEE_PADDING,
|
|
53
|
+
} as const;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Setup option preset that opts a test into the deterministic AutomineSequencer path.
|
|
57
|
+
* Use only for single-sequencer tests that don't exercise block-building or consensus
|
|
58
|
+
* (e.g. e2e_token, e2e_amm, e2e_authwit). Not compatible with `p2p/*`,
|
|
59
|
+
* `multi-node/*`, `e2e_block_building`, or any multi-validator suite.
|
|
60
|
+
*
|
|
61
|
+
* await setup(N, { ...AUTOMINE_E2E_OPTS, ...otherOpts });
|
|
62
|
+
*
|
|
63
|
+
* The preset:
|
|
64
|
+
* - Swaps the production Sequencer for an AutomineSequencer that builds one block per
|
|
65
|
+
* submitted tx, publishes synchronously to L1, and owns all time control through a
|
|
66
|
+
* serial queue (see `sequencer-client/src/sequencer/automine/automine_sequencer.ts`).
|
|
67
|
+
* - Disables the validator client (the AutomineSequencer needs none).
|
|
68
|
+
* - Uses `inboxLag: 1` (synchronous) since the AutomineSequencer publishes one block per tx.
|
|
69
|
+
* - Runs anvil at a 4s interval (`ethereumSlotDuration: 4`); at runtime the AutomineSequencer
|
|
70
|
+
* flips anvil into automine so each submitted tx mines its L1 block immediately. Initial L1
|
|
71
|
+
* contract deployment (which runs before the sequencer starts) is mined immediately too via the
|
|
72
|
+
* global `automineL1Setup` default in `setup()`, instead of stalling on the 4s interval.
|
|
73
|
+
*
|
|
74
|
+
* Requires `aztecTargetCommitteeSize: 0`, which is the e2e default at `setup.ts:317`.
|
|
75
|
+
*/
|
|
76
|
+
export const AUTOMINE_E2E_OPTS = {
|
|
77
|
+
useAutomineSequencer: true,
|
|
78
|
+
inboxLag: 1,
|
|
79
|
+
minTxsPerBlock: 0,
|
|
80
|
+
aztecSlotDuration: 12,
|
|
81
|
+
ethereumSlotDuration: 4,
|
|
82
|
+
walletMinFeePadding: TEST_FEE_PADDING,
|
|
83
|
+
} as const;
|
|
84
|
+
|
|
85
|
+
/** Returns worst-case predicted min fees with padding applied, mirroring the BaseWallet pattern. */
|
|
86
|
+
export async function getPaddedMaxFeesPerGas(node: AztecNode, padding = DEFAULT_MIN_FEE_PADDING): Promise<GasFees> {
|
|
87
|
+
const predicted = await node.getPredictedMinFees();
|
|
88
|
+
const worstCase =
|
|
89
|
+
predicted.length > 0
|
|
90
|
+
? predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst))
|
|
91
|
+
: await node.getCurrentMinFees();
|
|
92
|
+
return worstCase.mul(1 + padding);
|
|
93
|
+
}
|
|
94
|
+
|
|
3
95
|
export const shouldCollectMetrics = () => {
|
|
4
96
|
if (process.env.COLLECT_METRICS) {
|
|
5
97
|
return METRICS_PORT;
|
|
@@ -7,10 +99,28 @@ export const shouldCollectMetrics = () => {
|
|
|
7
99
|
return undefined;
|
|
8
100
|
};
|
|
9
101
|
|
|
102
|
+
/** Returns the boot node UDP port from environment variable or default value. */
|
|
103
|
+
export function getBootNodeUdpPort(): number {
|
|
104
|
+
return process.env.BOOT_NODE_UDP_PORT ? parseInt(process.env.BOOT_NODE_UDP_PORT, 10) : 4500;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Returns the anvil port from environment variable or default value. */
|
|
108
|
+
export function getAnvilPort(): number {
|
|
109
|
+
return process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT, 10) : 8545;
|
|
110
|
+
}
|
|
111
|
+
|
|
10
112
|
export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
11
113
|
export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
|
|
12
114
|
|
|
13
115
|
export const MNEMONIC = 'test test test test test test test test test test test junk';
|
|
116
|
+
|
|
117
|
+
// Mnemonic account index for tests that issue direct L1 writes (e.g. bridging fee juice) while a
|
|
118
|
+
// sequencer is running. The deployer/sequencer publisher uses index 0, the prover index 2, and
|
|
119
|
+
// validators index 3+. Test-side viem writes and the publisher's l1-tx-utils track nonces
|
|
120
|
+
// independently, so sharing an account causes "replacement transaction underpriced" races; index 1
|
|
121
|
+
// is otherwise unused, so issuing those writes from it keeps them off the publisher's nonce stream.
|
|
122
|
+
export const L1_DIRECT_WRITE_ACCOUNT_INDEX = 1;
|
|
123
|
+
|
|
14
124
|
export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
|
|
15
125
|
export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
|
|
16
126
|
|
|
@@ -13,8 +13,10 @@ const {
|
|
|
13
13
|
BB_SKIP_CLEANUP = '',
|
|
14
14
|
TEMP_DIR = tmpdir(),
|
|
15
15
|
BB_WORKING_DIRECTORY = '',
|
|
16
|
-
BB_NUM_IVC_VERIFIERS = '
|
|
16
|
+
BB_NUM_IVC_VERIFIERS = '8',
|
|
17
17
|
BB_IVC_CONCURRENCY = '1',
|
|
18
|
+
BB_CHONK_VERIFY_MAX_BATCH = '16',
|
|
19
|
+
BB_CHONK_VERIFY_BATCH_CONCURRENCY = '6',
|
|
18
20
|
} = process.env;
|
|
19
21
|
|
|
20
22
|
export const getBBConfig = async (
|
|
@@ -41,16 +43,15 @@ export const getBBConfig = async (
|
|
|
41
43
|
const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
|
|
42
44
|
const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
|
|
43
45
|
|
|
44
|
-
const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
|
|
45
|
-
const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
|
|
46
|
-
|
|
47
46
|
return {
|
|
48
47
|
bbSkipCleanup,
|
|
49
48
|
bbBinaryPath,
|
|
50
49
|
bbWorkingDirectory,
|
|
51
50
|
cleanup,
|
|
52
|
-
numConcurrentIVCVerifiers:
|
|
53
|
-
bbIVCConcurrency:
|
|
51
|
+
numConcurrentIVCVerifiers: Number(BB_NUM_IVC_VERIFIERS),
|
|
52
|
+
bbIVCConcurrency: Number(BB_IVC_CONCURRENCY),
|
|
53
|
+
bbChonkVerifyMaxBatch: Number(BB_CHONK_VERIFY_MAX_BATCH),
|
|
54
|
+
bbChonkVerifyConcurrency: Number(BB_CHONK_VERIFY_BATCH_CONCURRENCY),
|
|
54
55
|
};
|
|
55
56
|
} catch (err) {
|
|
56
57
|
logger.error(`Native BB not available, error: ${err}`);
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
4
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
5
|
+
|
|
6
|
+
import { Pool } from 'pg';
|
|
7
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for HA database connection
|
|
11
|
+
*/
|
|
12
|
+
export interface HADatabaseConfig {
|
|
13
|
+
/** PostgreSQL connection URL */
|
|
14
|
+
databaseUrl: SecretValue<string>;
|
|
15
|
+
/** Node ID for HA coordination */
|
|
16
|
+
nodeId: string;
|
|
17
|
+
/** Enable HA signing */
|
|
18
|
+
haSigningEnabled: boolean;
|
|
19
|
+
/** Polling interval in ms */
|
|
20
|
+
pollingIntervalMs: number;
|
|
21
|
+
/** How long to wait for a peer node's in-progress signing in ms */
|
|
22
|
+
peerSigningTimeoutMs: number;
|
|
23
|
+
/** Max stuck duties age in ms */
|
|
24
|
+
maxStuckDutiesAgeMs: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get database configuration from environment variables
|
|
29
|
+
*/
|
|
30
|
+
export function createHADatabaseConfig(nodeId: string): HADatabaseConfig {
|
|
31
|
+
const databaseUrl = new SecretValue(
|
|
32
|
+
process.env.DATABASE_URL || 'postgresql://aztec:aztec@localhost:5432/aztec_ha_test',
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
databaseUrl,
|
|
37
|
+
nodeId,
|
|
38
|
+
haSigningEnabled: true,
|
|
39
|
+
pollingIntervalMs: 100,
|
|
40
|
+
peerSigningTimeoutMs: 3000,
|
|
41
|
+
maxStuckDutiesAgeMs: 72000,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Setup PostgreSQL database connection pool for HA tests
|
|
47
|
+
*
|
|
48
|
+
* Note: Database migrations should be run separately before starting tests,
|
|
49
|
+
* either via docker-compose entrypoint or manually with: aztec migrate-ha-db up
|
|
50
|
+
*/
|
|
51
|
+
export function setupHADatabase(databaseUrl: string, logger?: Logger): Pool {
|
|
52
|
+
try {
|
|
53
|
+
// Create connection pool for test usage
|
|
54
|
+
// Migrations are already run by docker-compose entrypoint before tests start
|
|
55
|
+
const pool = new Pool({ connectionString: databaseUrl });
|
|
56
|
+
|
|
57
|
+
// pg-pool re-emits idle-client errors on the pool; with no listener the emit throws - in production this crashes
|
|
58
|
+
// the validator process.
|
|
59
|
+
pool.on('error', (err: Error) => logger?.warn(`HA database pool error: ${err.message}`));
|
|
60
|
+
|
|
61
|
+
logger?.info('Connected to HA database (migrations should already be applied)');
|
|
62
|
+
|
|
63
|
+
return pool;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
logger?.error(`Failed to connect to HA database: ${error}`);
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Clean up HA database - drop all tables
|
|
72
|
+
* Use this between tests to ensure clean state
|
|
73
|
+
*/
|
|
74
|
+
export async function cleanupHADatabase(pool: Pool, logger?: Logger): Promise<void> {
|
|
75
|
+
try {
|
|
76
|
+
// Drop all HA tables
|
|
77
|
+
await pool.query('DROP TABLE IF EXISTS validator_duties CASCADE');
|
|
78
|
+
await pool.query('DROP TABLE IF EXISTS schema_version CASCADE');
|
|
79
|
+
// Drop migration tracking table (node-pg-migrate uses 'pgmigrations' by default)
|
|
80
|
+
// This ensures migrations will run fresh on next startup
|
|
81
|
+
await pool.query('DROP TABLE IF EXISTS pgmigrations CASCADE');
|
|
82
|
+
|
|
83
|
+
logger?.info('HA database cleaned up successfully');
|
|
84
|
+
} catch (error) {
|
|
85
|
+
logger?.error(`Failed to cleanup HA database: ${error}`);
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Query validator duties from the database
|
|
92
|
+
*/
|
|
93
|
+
export async function getValidatorDuties(
|
|
94
|
+
pool: Pool,
|
|
95
|
+
slot: bigint,
|
|
96
|
+
dutyType?: 'ATTESTATION' | 'BLOCK_PROPOSAL' | 'GOVERNANCE_VOTE' | 'SLASHING_VOTE',
|
|
97
|
+
): Promise<
|
|
98
|
+
Array<{
|
|
99
|
+
slot: string;
|
|
100
|
+
dutyType: string;
|
|
101
|
+
validatorAddress: string;
|
|
102
|
+
nodeId: string;
|
|
103
|
+
startedAt: Date;
|
|
104
|
+
completedAt: Date | undefined;
|
|
105
|
+
}>
|
|
106
|
+
> {
|
|
107
|
+
const query = dutyType
|
|
108
|
+
? 'SELECT slot, duty_type, validator_address, node_id, started_at, completed_at FROM validator_duties WHERE slot = $1 AND duty_type = $2 ORDER BY started_at'
|
|
109
|
+
: 'SELECT slot, duty_type, validator_address, node_id, started_at, completed_at FROM validator_duties WHERE slot = $1 ORDER BY started_at';
|
|
110
|
+
|
|
111
|
+
const params = dutyType ? [slot.toString(), dutyType] : [slot.toString()];
|
|
112
|
+
|
|
113
|
+
const result = await pool.query<{
|
|
114
|
+
slot: string;
|
|
115
|
+
duty_type: string;
|
|
116
|
+
validator_address: string;
|
|
117
|
+
node_id: string;
|
|
118
|
+
started_at: Date;
|
|
119
|
+
completed_at: Date | undefined;
|
|
120
|
+
}>(query, params);
|
|
121
|
+
|
|
122
|
+
return result.rows.map(row => ({
|
|
123
|
+
slot: row.slot,
|
|
124
|
+
dutyType: row.duty_type,
|
|
125
|
+
validatorAddress: row.validator_address,
|
|
126
|
+
nodeId: row.node_id,
|
|
127
|
+
startedAt: row.started_at,
|
|
128
|
+
completedAt: row.completed_at,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Convert private keys to Ethereum addresses
|
|
134
|
+
*/
|
|
135
|
+
export function getAddressesFromPrivateKeys(privateKeys: `0x${string}`[]): string[] {
|
|
136
|
+
return privateKeys.map(pk => {
|
|
137
|
+
const account = privateKeyToAccount(pk);
|
|
138
|
+
return account.address;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Create initial validators from private keys for L1 contract deployment
|
|
144
|
+
*/
|
|
145
|
+
export function createInitialValidatorsFromPrivateKeys(attesterPrivateKeys: `0x${string}`[]): Array<{
|
|
146
|
+
attester: EthAddress;
|
|
147
|
+
withdrawer: EthAddress;
|
|
148
|
+
privateKey: `0x${string}`;
|
|
149
|
+
bn254SecretKey: SecretValue<bigint>;
|
|
150
|
+
}> {
|
|
151
|
+
return attesterPrivateKeys.map(pk => {
|
|
152
|
+
const account = privateKeyToAccount(pk);
|
|
153
|
+
return {
|
|
154
|
+
attester: EthAddress.fromString(account.address),
|
|
155
|
+
withdrawer: EthAddress.fromString(account.address),
|
|
156
|
+
privateKey: pk,
|
|
157
|
+
bn254SecretKey: new SecretValue(Fr.random().toBigInt()),
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Verify no duplicate attestations per validator (HA coordination check)
|
|
164
|
+
* Groups duties by validator address and verifies each validator attested exactly once
|
|
165
|
+
*/
|
|
166
|
+
export function verifyNoDuplicateAttestations(
|
|
167
|
+
attestationDuties: Array<{
|
|
168
|
+
validatorAddress: string;
|
|
169
|
+
nodeId: string;
|
|
170
|
+
completedAt: Date | undefined;
|
|
171
|
+
}>,
|
|
172
|
+
logger?: Logger,
|
|
173
|
+
): Map<string, typeof attestationDuties> {
|
|
174
|
+
const dutiesByValidator = new Map<string, typeof attestationDuties>();
|
|
175
|
+
for (const duty of attestationDuties) {
|
|
176
|
+
const existing = dutiesByValidator.get(duty.validatorAddress) || [];
|
|
177
|
+
existing.push(duty);
|
|
178
|
+
dutiesByValidator.set(duty.validatorAddress, existing);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
for (const [validatorAddress, validatorDuties] of dutiesByValidator.entries()) {
|
|
182
|
+
if (validatorDuties.length !== 1) {
|
|
183
|
+
throw new Error(`Validator ${validatorAddress} attested ${validatorDuties.length} times (expected exactly once)`);
|
|
184
|
+
}
|
|
185
|
+
if (!validatorDuties[0].completedAt) {
|
|
186
|
+
throw new Error(`Validator ${validatorAddress} attestation duty not completed`);
|
|
187
|
+
}
|
|
188
|
+
logger?.info(`Validator ${validatorAddress} attested once via node ${validatorDuties[0].nodeId}`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return dutiesByValidator;
|
|
192
|
+
}
|
package/src/fixtures/index.ts
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DefaultAccountContract } from '@aztec/accounts/defaults';
|
|
2
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
3
|
+
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
4
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
5
|
+
import { AuthWitness } from '@aztec/aztec.js/authorization';
|
|
6
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
7
|
+
import { Schnorr } from '@aztec/foundation/crypto/schnorr';
|
|
8
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
9
|
+
import { SchnorrHardcodedAccountContractArtifact } from '@aztec/noir-contracts.js/SchnorrHardcodedAccount';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The private key that matches the hardcoded public key in the SchnorrHardcodedAccountContract.
|
|
13
|
+
* The corresponding public key is baked into the Noir contract as a global constant.
|
|
14
|
+
*/
|
|
15
|
+
export const SCHNORR_HARDCODED_PRIVATE_KEY = GrumpkinScalar.fromHexString(
|
|
16
|
+
'0xd35d743ac0dfe3d6dbe6be8c877cb524a00ab1e3d52d7bada095dfc8894ccfa',
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Account contract backed by the SchnorrHardcodedAccount Noir contract.
|
|
21
|
+
* This contract verifies Schnorr signatures against a public key that is hardcoded
|
|
22
|
+
* in the contract artifact (not stored in a note), so it does not require on-chain
|
|
23
|
+
* deployment or initialization. Useful for tests that need a working account without
|
|
24
|
+
* mining any blocks.
|
|
25
|
+
*/
|
|
26
|
+
export class SchnorrHardcodedKeyAccountContract extends DefaultAccountContract {
|
|
27
|
+
constructor(private privateKey: GrumpkinScalar = SCHNORR_HARDCODED_PRIVATE_KEY) {
|
|
28
|
+
super();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override getContractArtifact(): Promise<ContractArtifact> {
|
|
32
|
+
return Promise.resolve(SchnorrHardcodedAccountContractArtifact);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getInitializationFunctionAndArgs() {
|
|
36
|
+
return Promise.resolve(undefined);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider {
|
|
40
|
+
const privateKey = this.privateKey;
|
|
41
|
+
return {
|
|
42
|
+
async createAuthWit(messageHash: Fr): Promise<AuthWitness> {
|
|
43
|
+
const signer = new Schnorr();
|
|
44
|
+
const signature = await signer.constructSignature(messageHash, privateKey);
|
|
45
|
+
return new AuthWitness(messageHash, signature.toLimbFields());
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|