@aztec/end-to-end 0.0.1-commit.f504929 → 0.0.1-commit.f5a9928
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +229 -14
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +23 -36
- 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 +24 -39
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +19 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +5 -5
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +62 -54
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +97 -6
- 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 +1 -1
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -0
- package/dest/fixtures/e2e_prover_test.d.ts +15 -11
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +56 -40
- package/dest/fixtures/fixtures.d.ts +79 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +80 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +4 -4
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +5 -2
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +86 -42
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +295 -200
- package/dest/fixtures/setup_p2p_test.d.ts +10 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +11 -11
- 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 +23 -6
- package/dest/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- package/dest/fixtures/wait_helpers.d.ts +135 -0
- package/dest/fixtures/wait_helpers.d.ts.map +1 -0
- package/dest/fixtures/wait_helpers.js +154 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +13 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/multi-node/block-production/setup.d.ts +97 -0
- package/dest/multi-node/block-production/setup.d.ts.map +1 -0
- package/dest/multi-node/block-production/setup.js +158 -0
- package/dest/multi-node/governance/setup.d.ts +67 -0
- package/dest/multi-node/governance/setup.d.ts.map +1 -0
- package/dest/multi-node/governance/setup.js +126 -0
- package/dest/multi-node/multi_node_test_context.d.ts +212 -0
- package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
- package/dest/multi-node/multi_node_test_context.js +347 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/inactivity_setup.js +111 -0
- package/dest/multi-node/slashing/setup.d.ts +167 -0
- package/dest/multi-node/slashing/setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/setup.js +275 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +20 -11
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +83 -39
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/reqresp/utils.js +45 -29
- 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 +33 -21
- 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 +24 -12
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +12 -5
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +365 -0
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +50 -40
- 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 +25 -13
- package/dest/simulators/token_simulator.js +1 -1
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
- package/dest/single-node/fees/fees_test.d.ts +95 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/single-node/fees/fees_test.js +347 -0
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +374 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +847 -0
- package/dest/spartan/setup_test_wallets.d.ts +4 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +94 -48
- 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 +105 -20
- package/dest/spartan/utils/config.d.ts +9 -32
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +1 -0
- package/dest/spartan/utils/gossip_metrics.d.ts +9 -0
- package/dest/spartan/utils/gossip_metrics.d.ts.map +1 -0
- package/dest/spartan/utils/gossip_metrics.js +77 -0
- package/dest/spartan/utils/index.d.ts +3 -1
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +4 -0
- package/dest/spartan/utils/nodes.js +2 -2
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +47 -25
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +197 -91
- package/dest/test-wallet/utils.d.ts +38 -3
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +65 -10
- package/dest/test-wallet/wallet_worker_script.js +12 -4
- package/dest/test-wallet/worker_wallet.d.ts +9 -8
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +10 -4
- package/dest/test-wallet/worker_wallet_schema.d.ts +3 -273
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet_schema.js +15 -2
- package/package.json +48 -44
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
- package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +24 -47
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +25 -48
- 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 +108 -75
- package/src/bench/utils.ts +110 -6
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/e2e_prover_test.ts +73 -63
- package/src/fixtures/fixtures.ts +100 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +11 -5
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +372 -258
- package/src/fixtures/setup_p2p_test.ts +15 -11
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +40 -8
- package/src/fixtures/utils.ts +2 -3
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +106 -0
- package/src/guides/up_quick_start.sh +5 -2
- package/src/infra/README.md +12 -0
- package/src/install_legacy_contracts.cjs +81 -0
- package/src/legacy-jest-resolver.cjs +98 -0
- package/src/multi-node/README.md +96 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +96 -51
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +56 -28
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +36 -17
- package/src/shared/gas_portal_test_harness.ts +32 -14
- package/src/shared/submit-transactions.ts +13 -5
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +92 -50
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +29 -13
- package/src/simulators/token_simulator.ts +1 -1
- package/src/single-node/README.md +66 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
- package/src/single-node/fees/fees_test.ts +437 -0
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1058 -0
- package/src/spartan/setup_test_wallets.ts +124 -45
- package/src/spartan/tx_metrics.ts +107 -23
- package/src/spartan/utils/config.ts +1 -0
- package/src/spartan/utils/gossip_metrics.ts +108 -0
- package/src/spartan/utils/index.ts +6 -0
- package/src/spartan/utils/nodes.ts +2 -2
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +227 -107
- package/src/test-wallet/utils.ts +104 -11
- package/src/test-wallet/wallet_worker_script.ts +11 -5
- package/src/test-wallet/worker_wallet.ts +19 -16
- package/src/test-wallet/worker_wallet_schema.ts +4 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -55
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -129
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -50
- package/dest/e2e_epochs/epochs_test.d.ts +0 -102
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -386
- 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 -54
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +0 -136
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.d.ts +0 -60
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -204
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -193
- package/src/e2e_deploy_contract/deploy_test.ts +0 -85
- package/src/e2e_epochs/epochs_test.ts +0 -487
- package/src/e2e_fees/fees_test.ts +0 -328
- package/src/e2e_l1_publisher/write_json.ts +0 -77
- 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 -333
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
- /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
- /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
3
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { DefaultWaitOpts, NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
4
5
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
5
6
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
6
7
|
import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
7
8
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
9
|
+
import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
8
10
|
import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
|
|
9
11
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
10
12
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
11
13
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
12
14
|
import type { Logger } from '@aztec/foundation/log';
|
|
13
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
15
|
+
import { makeBackoff, retry, retryUntil } from '@aztec/foundation/retry';
|
|
14
16
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
17
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
15
18
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
19
|
+
import { TxStatus } from '@aztec/stdlib/tx';
|
|
20
|
+
import { getGasLimits } from '@aztec/wallet-sdk/base-wallet';
|
|
16
21
|
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
17
22
|
|
|
18
23
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
@@ -51,6 +56,8 @@ export async function setupTestAccountsWithTokens(
|
|
|
51
56
|
|
|
52
57
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
53
58
|
const wallet = await TestWallet.create(aztecNode);
|
|
59
|
+
// Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
|
|
60
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
54
61
|
|
|
55
62
|
const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
|
|
56
63
|
0,
|
|
@@ -81,15 +88,17 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
81
88
|
numberOfFundedWallets = 1,
|
|
82
89
|
): Promise<TestAccounts> {
|
|
83
90
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
84
|
-
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
85
|
-
const fundedAccounts = await Promise.all(
|
|
91
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
|
|
92
|
+
const fundedAccounts = await Promise.all(
|
|
93
|
+
funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
|
|
94
|
+
);
|
|
86
95
|
|
|
87
96
|
await registerSponsoredFPC(wallet);
|
|
88
97
|
|
|
89
98
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
90
99
|
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
91
100
|
await recipientDeployMethod.send({
|
|
92
|
-
from:
|
|
101
|
+
from: NO_FROM,
|
|
93
102
|
fee: { paymentMethod },
|
|
94
103
|
wait: { timeout: 2400 },
|
|
95
104
|
});
|
|
@@ -97,7 +106,7 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
97
106
|
fundedAccounts.map(async a => {
|
|
98
107
|
const deployMethod = await a.getDeployMethod();
|
|
99
108
|
await deployMethod.send({
|
|
100
|
-
from:
|
|
109
|
+
from: NO_FROM,
|
|
101
110
|
fee: { paymentMethod },
|
|
102
111
|
wait: { timeout: 2400 },
|
|
103
112
|
}); // increase timeout on purpose in order to account for two empty epochs
|
|
@@ -129,50 +138,92 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
129
138
|
}
|
|
130
139
|
|
|
131
140
|
async function deployAccountWithDiagnostics(
|
|
132
|
-
account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
|
|
141
|
+
account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
|
|
133
142
|
paymentMethod: SponsoredFeePaymentMethod,
|
|
134
143
|
aztecNode: AztecNode,
|
|
135
144
|
logger: Logger,
|
|
136
145
|
accountLabel: string,
|
|
146
|
+
estimateGas?: boolean,
|
|
137
147
|
): Promise<void> {
|
|
138
148
|
const deployMethod = await account.getDeployMethod();
|
|
139
|
-
let
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
logger.info(`${accountLabel}
|
|
145
|
-
} catch (error) {
|
|
146
|
-
const blockNumber = await aztecNode.getBlockNumber();
|
|
147
|
-
let receipt;
|
|
148
|
-
try {
|
|
149
|
-
receipt = await aztecNode.getTxReceipt(txHash);
|
|
150
|
-
} catch {
|
|
151
|
-
receipt = 'unavailable';
|
|
152
|
-
}
|
|
153
|
-
logger.error(`${accountLabel} deployment failed`, {
|
|
154
|
-
txHash: txHash.toString(),
|
|
155
|
-
receipt: JSON.stringify(receipt),
|
|
156
|
-
currentBlockNumber: blockNumber,
|
|
157
|
-
error: String(error),
|
|
158
|
-
});
|
|
159
|
-
throw error;
|
|
149
|
+
let gasSettings: any;
|
|
150
|
+
if (estimateGas) {
|
|
151
|
+
const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod }, includeMetadata: true });
|
|
152
|
+
const { txsLimits } = await aztecNode.getNodeInfo();
|
|
153
|
+
gasSettings = getGasLimits(sim.gasUsed!, Gas.from(txsLimits.gas));
|
|
154
|
+
logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
|
|
160
155
|
}
|
|
156
|
+
|
|
157
|
+
// Track the tx hash across retries so we don't re-send when the previous tx is still pending.
|
|
158
|
+
let sentTxHash: { txHash: any } | undefined;
|
|
159
|
+
|
|
160
|
+
await retry(
|
|
161
|
+
async () => {
|
|
162
|
+
// Check if already deployed (handles case where previous attempt succeeded but waitForTx timed out)
|
|
163
|
+
const existing = await aztecNode.getContract(account.address);
|
|
164
|
+
if (existing) {
|
|
165
|
+
logger.info(`${accountLabel} already deployed at ${account.address}, skipping`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// If we already sent a tx, check if it was dropped before deciding to re-send.
|
|
170
|
+
if (sentTxHash) {
|
|
171
|
+
const prevReceipt = await aztecNode.getTxReceipt(sentTxHash.txHash);
|
|
172
|
+
if (prevReceipt.isDropped()) {
|
|
173
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} was dropped, re-sending`);
|
|
174
|
+
sentTxHash = undefined;
|
|
175
|
+
} else {
|
|
176
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} still pending, waiting again...`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (!sentTxHash) {
|
|
181
|
+
const deployResult = await deployMethod.send({
|
|
182
|
+
from: NO_FROM,
|
|
183
|
+
fee: { paymentMethod, gasSettings },
|
|
184
|
+
wait: NO_WAIT,
|
|
185
|
+
});
|
|
186
|
+
sentTxHash = { txHash: deployResult.txHash };
|
|
187
|
+
logger.info(`${accountLabel} tx sent`, { txHash: sentTxHash.txHash.toString() });
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const receipt = await waitForTx(aztecNode, sentTxHash.txHash, { timeout: 600 });
|
|
191
|
+
if (receipt.isDropped()) {
|
|
192
|
+
sentTxHash = undefined;
|
|
193
|
+
throw new Error(`${accountLabel} tx was dropped, retrying...`);
|
|
194
|
+
}
|
|
195
|
+
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
196
|
+
},
|
|
197
|
+
`deploy ${accountLabel}`,
|
|
198
|
+
makeBackoff([1, 2, 4, 8, 16]),
|
|
199
|
+
logger,
|
|
200
|
+
);
|
|
161
201
|
}
|
|
162
202
|
|
|
163
203
|
async function deployAccountsInBatches(
|
|
164
|
-
accounts: {
|
|
204
|
+
accounts: {
|
|
205
|
+
getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
|
|
206
|
+
address: any;
|
|
207
|
+
}[],
|
|
165
208
|
paymentMethod: SponsoredFeePaymentMethod,
|
|
166
209
|
aztecNode: AztecNode,
|
|
167
210
|
logger: Logger,
|
|
168
211
|
labelPrefix: string,
|
|
169
212
|
batchSize = 2,
|
|
213
|
+
estimateGas?: boolean,
|
|
170
214
|
): Promise<void> {
|
|
171
215
|
for (let i = 0; i < accounts.length; i += batchSize) {
|
|
172
216
|
const batch = accounts.slice(i, i + batchSize);
|
|
173
217
|
await Promise.all(
|
|
174
218
|
batch.map((account, idx) =>
|
|
175
|
-
deployAccountWithDiagnostics(
|
|
219
|
+
deployAccountWithDiagnostics(
|
|
220
|
+
account,
|
|
221
|
+
paymentMethod,
|
|
222
|
+
aztecNode,
|
|
223
|
+
logger,
|
|
224
|
+
`${labelPrefix}${i + idx + 1}`,
|
|
225
|
+
estimateGas,
|
|
226
|
+
),
|
|
176
227
|
),
|
|
177
228
|
);
|
|
178
229
|
}
|
|
@@ -183,17 +234,35 @@ export async function deploySponsoredTestAccounts(
|
|
|
183
234
|
aztecNode: AztecNode,
|
|
184
235
|
logger: Logger,
|
|
185
236
|
numberOfFundedWallets = 1,
|
|
237
|
+
opts?: { estimateGas?: boolean },
|
|
186
238
|
): Promise<TestAccountsWithoutTokens> {
|
|
187
239
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
188
|
-
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
189
|
-
const fundedAccounts = await Promise.all(
|
|
240
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
|
|
241
|
+
const fundedAccounts = await Promise.all(
|
|
242
|
+
funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
|
|
243
|
+
);
|
|
190
244
|
|
|
191
245
|
await registerSponsoredFPC(wallet);
|
|
192
246
|
|
|
193
247
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
194
248
|
|
|
195
|
-
await deployAccountWithDiagnostics(
|
|
196
|
-
|
|
249
|
+
await deployAccountWithDiagnostics(
|
|
250
|
+
recipientAccount,
|
|
251
|
+
paymentMethod,
|
|
252
|
+
aztecNode,
|
|
253
|
+
logger,
|
|
254
|
+
'Recipient account',
|
|
255
|
+
opts?.estimateGas,
|
|
256
|
+
);
|
|
257
|
+
await deployAccountsInBatches(
|
|
258
|
+
fundedAccounts,
|
|
259
|
+
paymentMethod,
|
|
260
|
+
aztecNode,
|
|
261
|
+
logger,
|
|
262
|
+
'Funded account ',
|
|
263
|
+
2,
|
|
264
|
+
opts?.estimateGas,
|
|
265
|
+
);
|
|
197
266
|
|
|
198
267
|
return {
|
|
199
268
|
aztecNode,
|
|
@@ -213,10 +282,14 @@ export async function deployTestAccountsWithTokens(
|
|
|
213
282
|
): Promise<TestAccounts> {
|
|
214
283
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
215
284
|
const wallet = await TestWallet.create(aztecNode);
|
|
285
|
+
// Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
|
|
286
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
216
287
|
|
|
217
288
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
218
|
-
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
219
|
-
const fundedAccounts = await Promise.all(
|
|
289
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
|
|
290
|
+
const fundedAccounts = await Promise.all(
|
|
291
|
+
funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
|
|
292
|
+
);
|
|
220
293
|
|
|
221
294
|
const claims = await Promise.all(
|
|
222
295
|
fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, aztecNode, a.address, undefined, logger)),
|
|
@@ -231,7 +304,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
231
304
|
fundedAccounts.map(async (a, i) => {
|
|
232
305
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
233
306
|
const deployMethod = await a.getDeployMethod();
|
|
234
|
-
await deployMethod.send({ from:
|
|
307
|
+
await deployMethod.send({ from: NO_FROM, fee: { paymentMethod } });
|
|
235
308
|
logger.info(`Account deployed at ${a.address}`);
|
|
236
309
|
}),
|
|
237
310
|
);
|
|
@@ -274,9 +347,7 @@ async function bridgeL1FeeJuice(
|
|
|
274
347
|
const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
|
|
275
348
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
276
349
|
|
|
277
|
-
|
|
278
|
-
(await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
279
|
-
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
350
|
+
await waitForL1ToL2MessageReady(aztecNode, Fr.fromHexString(claim.messageHash), { timeoutSeconds: 24 });
|
|
280
351
|
|
|
281
352
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
282
353
|
return claim;
|
|
@@ -307,14 +378,18 @@ async function deployTokenAndMint(
|
|
|
307
378
|
logger: Logger,
|
|
308
379
|
) {
|
|
309
380
|
logger.verbose(`Deploying TokenContract...`);
|
|
310
|
-
const {
|
|
311
|
-
|
|
312
|
-
|
|
381
|
+
const { contract: tokenContract } = await TokenContract.deploy(
|
|
382
|
+
wallet,
|
|
383
|
+
admin,
|
|
384
|
+
TOKEN_NAME,
|
|
385
|
+
TOKEN_SYMBOL,
|
|
386
|
+
TOKEN_DECIMALS,
|
|
387
|
+
).send({
|
|
313
388
|
from: admin,
|
|
314
389
|
fee: {
|
|
315
390
|
paymentMethod,
|
|
316
391
|
},
|
|
317
|
-
wait: { timeout: 600
|
|
392
|
+
wait: { timeout: 600 },
|
|
318
393
|
});
|
|
319
394
|
|
|
320
395
|
const tokenAddress = tokenContract.address;
|
|
@@ -365,7 +440,9 @@ export async function performTransfers({
|
|
|
365
440
|
|
|
366
441
|
const provenTxs = await Promise.all(txs);
|
|
367
442
|
|
|
368
|
-
|
|
443
|
+
// Wait only for the txs to be proposed, not checkpointed. This is enough to keep the chain
|
|
444
|
+
// loaded for the reorg scenario, and avoids each round blocking on the (slower) checkpoint lag.
|
|
445
|
+
await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600, waitForStatus: TxStatus.PROPOSED } })));
|
|
369
446
|
|
|
370
447
|
logger.info(`Completed round ${i + 1} / ${rounds}`);
|
|
371
448
|
}
|
|
@@ -392,6 +469,8 @@ export async function createWalletAndAztecNodeClient(
|
|
|
392
469
|
proverEnabled,
|
|
393
470
|
};
|
|
394
471
|
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
472
|
+
// Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
|
|
473
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
395
474
|
|
|
396
475
|
return {
|
|
397
476
|
wallet,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BlockResponse } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import type { TopicType } from '@aztec/stdlib/p2p';
|
|
5
5
|
import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
@@ -134,9 +134,12 @@ export class ProvingMetrics {
|
|
|
134
134
|
|
|
135
135
|
export type TxInclusionData = {
|
|
136
136
|
txHash: string;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
/** Wall-clock at client when the tx was submitted, in ms (Date.now()). */
|
|
138
|
+
sentAtMs: number;
|
|
139
|
+
/** Wall-clock at client when the block containing the tx first became visible, in ms (Date.now()). -1 if never observed. */
|
|
140
|
+
minedAtMs: number;
|
|
141
|
+
/** Reserved for future attestation-observed-at signal; -1 today. */
|
|
142
|
+
attestedAtMs: number;
|
|
140
143
|
blocknumber: number;
|
|
141
144
|
priorityFee: number;
|
|
142
145
|
totalFee: number;
|
|
@@ -147,7 +150,7 @@ export type TxInclusionData = {
|
|
|
147
150
|
export class TxInclusionMetrics {
|
|
148
151
|
private data = new Map<string, TxInclusionData>();
|
|
149
152
|
private groups = new Set<string>();
|
|
150
|
-
private blocks = new Map<number, Promise<
|
|
153
|
+
private blocks = new Map<number, Promise<BlockResponse<{ includeTransactions: true }> | undefined>>();
|
|
151
154
|
|
|
152
155
|
private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
|
|
153
156
|
|
|
@@ -158,6 +161,7 @@ export class TxInclusionMetrics {
|
|
|
158
161
|
private mempoolMinedDelay:
|
|
159
162
|
| { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
|
|
160
163
|
| undefined;
|
|
164
|
+
private inclusionOutcome: { mined: number; failed: number } | undefined;
|
|
161
165
|
|
|
162
166
|
constructor(
|
|
163
167
|
private aztecNode: AztecNode,
|
|
@@ -174,9 +178,9 @@ export class TxInclusionMetrics {
|
|
|
174
178
|
|
|
175
179
|
this.data.set(txHash, {
|
|
176
180
|
txHash,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
sentAtMs: Date.now(),
|
|
182
|
+
minedAtMs: -1,
|
|
183
|
+
attestedAtMs: -1,
|
|
180
184
|
blocknumber: -1,
|
|
181
185
|
priorityFee: Number(priorityFees.feePerDaGas + priorityFees.feePerL2Gas),
|
|
182
186
|
totalFee: -1,
|
|
@@ -186,6 +190,28 @@ export class TxInclusionMetrics {
|
|
|
186
190
|
this.groups.add(group);
|
|
187
191
|
}
|
|
188
192
|
|
|
193
|
+
/**
|
|
194
|
+
* Stamp mined-at metadata for any tracked tx contained in this block, using
|
|
195
|
+
* `observedAtMs` (caller-supplied wall-clock at the moment they first saw the
|
|
196
|
+
* block). Idempotent: existing minedAtMs is preserved so the first observer
|
|
197
|
+
* wins (typically the block-watcher; recordMinedTx is a fallback).
|
|
198
|
+
*/
|
|
199
|
+
observeBlockForMinedTxs(
|
|
200
|
+
blockNumber: number,
|
|
201
|
+
txHashes: ReadonlyArray<{ toString(): string }>,
|
|
202
|
+
observedAtMs: number,
|
|
203
|
+
): void {
|
|
204
|
+
txHashes.forEach((txHash, position) => {
|
|
205
|
+
const data = this.data.get(txHash.toString());
|
|
206
|
+
if (!data || data.minedAtMs !== -1) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
data.blocknumber = blockNumber;
|
|
210
|
+
data.minedAtMs = observedAtMs;
|
|
211
|
+
data.positionInBlock = position;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
189
215
|
async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
|
|
190
216
|
const { txHash, blockNumber } = txReceipt;
|
|
191
217
|
if (!txReceipt.isMined() || !txReceipt.hasExecutionSucceeded() || !blockNumber) {
|
|
@@ -197,26 +223,53 @@ export class TxInclusionMetrics {
|
|
|
197
223
|
return;
|
|
198
224
|
}
|
|
199
225
|
|
|
200
|
-
if (!this.blocks.has(blockNumber)) {
|
|
201
|
-
this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const block = await this.blocks.get(blockNumber)!;
|
|
205
|
-
if (!block) {
|
|
206
|
-
this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
226
|
const data = this.data.get(txHash.toString());
|
|
210
227
|
if (!data) {
|
|
211
228
|
const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
|
|
212
229
|
this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
|
|
213
230
|
throw new Error(message);
|
|
214
231
|
}
|
|
215
|
-
data.blocknumber = blockNumber;
|
|
216
|
-
data.minedAt = Number(block.header.globalVariables.timestamp);
|
|
217
|
-
data.attestedAt = -1;
|
|
218
232
|
data.totalFee = Number(txReceipt.transactionFee ?? 0n);
|
|
219
|
-
|
|
233
|
+
|
|
234
|
+
// Fallback path for txs the block-watcher missed (e.g. observed only after
|
|
235
|
+
// the watcher stopped). Stamp with the block's L2 slot timestamp; this is
|
|
236
|
+
// earlier than the true client-observed time by attestation+propagation
|
|
237
|
+
// lag, but it's the only deterministic timestamp available post-hoc.
|
|
238
|
+
if (data.minedAtMs === -1) {
|
|
239
|
+
if (!this.blocks.has(blockNumber)) {
|
|
240
|
+
this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber, { includeTransactions: true }));
|
|
241
|
+
}
|
|
242
|
+
const block = await this.blocks.get(blockNumber)!;
|
|
243
|
+
if (!block) {
|
|
244
|
+
this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
data.blocknumber = blockNumber;
|
|
248
|
+
data.minedAtMs = Number(block.header.globalVariables.timestamp) * 1000;
|
|
249
|
+
data.positionInBlock = block.body.txEffects.findIndex(txEffect => txEffect.txHash.equals(txHash));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Whether this tx was ever observed in a block (by the block-watcher or a mined receipt).
|
|
255
|
+
* Idempotent first-sighting semantics: a later reorg / pool eviction never clears it, so callers
|
|
256
|
+
* can treat "ever mined" as included regardless of what happens to the tx afterwards.
|
|
257
|
+
*/
|
|
258
|
+
public wasMined(txHash: string): boolean {
|
|
259
|
+
const d = this.data.get(txHash);
|
|
260
|
+
return !!d && d.minedAtMs !== -1;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Per-tx inclusion records for a group. Used to serialise out for downstream tooling. */
|
|
264
|
+
getInclusionRecords(group?: string): TxInclusionData[] {
|
|
265
|
+
const out: TxInclusionData[] = [];
|
|
266
|
+
for (const tx of this.data.values()) {
|
|
267
|
+
if (group !== undefined && tx.group !== group) {
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
out.push({ ...tx });
|
|
271
|
+
}
|
|
272
|
+
return out;
|
|
220
273
|
}
|
|
221
274
|
|
|
222
275
|
public inclusionTimeInSeconds(group: string): {
|
|
@@ -229,12 +282,28 @@ export class TxInclusionMetrics {
|
|
|
229
282
|
p99: number;
|
|
230
283
|
} {
|
|
231
284
|
const histogram = createHistogram({});
|
|
285
|
+
let nonPositive = 0;
|
|
232
286
|
for (const tx of this.data.values()) {
|
|
233
|
-
if (!tx.blocknumber || tx.group !== group || tx.
|
|
287
|
+
if (!tx.blocknumber || tx.group !== group || tx.minedAtMs === -1) {
|
|
234
288
|
continue;
|
|
235
289
|
}
|
|
236
290
|
|
|
237
|
-
|
|
291
|
+
// Both timestamps are client wall-clock (ms). A negative delta should be
|
|
292
|
+
// impossible since the watcher stamps minedAtMs strictly after sentAtMs,
|
|
293
|
+
// but the fallback path (recordMinedTx via L2 slot timestamp) can stamp
|
|
294
|
+
// earlier than sentAtMs. perf_hooks.createHistogram rejects <=0; skip
|
|
295
|
+
// those instead of crashing.
|
|
296
|
+
const deltaMs = tx.minedAtMs - tx.sentAtMs;
|
|
297
|
+
if (deltaMs <= 0) {
|
|
298
|
+
nonPositive++;
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
// Histogram is recorded in seconds (rounded) to match the existing
|
|
302
|
+
// toGithubActionBenchmarkJSON output unit; per-tx records carry the raw ms.
|
|
303
|
+
histogram.record(Math.max(1, Math.round(deltaMs / 1000)));
|
|
304
|
+
}
|
|
305
|
+
if (nonPositive > 0) {
|
|
306
|
+
this.logger?.debug(`Dropped ${nonPositive} tx inclusion samples with non-positive delta`, { group });
|
|
238
307
|
}
|
|
239
308
|
|
|
240
309
|
if (histogram.count === 0) {
|
|
@@ -284,6 +353,11 @@ export class TxInclusionMetrics {
|
|
|
284
353
|
this.mempoolMinedDelay = { txP50, txP95, attestationP50, attestationP95 };
|
|
285
354
|
}
|
|
286
355
|
|
|
356
|
+
/** Mined vs failed counts for the high-value lane — recorded instead of asserting strict 1:1 inclusion. */
|
|
357
|
+
public recordInclusionOutcome(mined: number, failed: number): void {
|
|
358
|
+
this.inclusionOutcome = { mined, failed };
|
|
359
|
+
}
|
|
360
|
+
|
|
287
361
|
toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
|
|
288
362
|
const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
|
|
289
363
|
for (const group of this.groups) {
|
|
@@ -365,6 +439,16 @@ export class TxInclusionMetrics {
|
|
|
365
439
|
);
|
|
366
440
|
}
|
|
367
441
|
|
|
442
|
+
if (this.inclusionOutcome) {
|
|
443
|
+
const { mined, failed } = this.inclusionOutcome;
|
|
444
|
+
const total = mined + failed;
|
|
445
|
+
data.push(
|
|
446
|
+
{ name: 'inclusion/mined_count', unit: 'count', value: mined },
|
|
447
|
+
{ name: 'inclusion/failed_count', unit: 'count', value: failed },
|
|
448
|
+
{ name: 'inclusion/success_ratio', unit: 'ratio', value: total > 0 ? mined / total : 0 },
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
|
|
368
452
|
const scenario = process.env.BENCH_SCENARIO?.trim();
|
|
369
453
|
if (!scenario) {
|
|
370
454
|
return data;
|
|
@@ -8,6 +8,7 @@ const logger = createLogger('e2e:k8s-utils');
|
|
|
8
8
|
const testConfigSchema = z.object({
|
|
9
9
|
NAMESPACE: z.string().default('scenario'),
|
|
10
10
|
REAL_VERIFIER: schemas.Boolean.optional().default(true),
|
|
11
|
+
DEBUG_FORCE_TX_PROOF_VERIFICATION: schemas.Boolean.optional().default(true),
|
|
11
12
|
CREATE_ETH_DEVNET: schemas.Boolean.optional().default(false),
|
|
12
13
|
L1_RPC_URLS_JSON: z.string().optional(),
|
|
13
14
|
L1_ACCOUNT_MNEMONIC: z.string().optional(),
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
|
|
3
|
+
import type { PrometheusClient } from '../../quality_of_service/prometheus_client.js';
|
|
4
|
+
|
|
5
|
+
/** Runs a PromQL query and returns each series as a label-record plus value. Returns [] on error. */
|
|
6
|
+
async function queryVector(
|
|
7
|
+
prometheus: PrometheusClient,
|
|
8
|
+
query: string,
|
|
9
|
+
logger: Logger,
|
|
10
|
+
): Promise<{ labels: Record<string, string>; value: number }[]> {
|
|
11
|
+
try {
|
|
12
|
+
const resp = await prometheus.queryRaw(query);
|
|
13
|
+
if (resp.status !== 'success' || resp.data.resultType !== 'vector') {
|
|
14
|
+
logger.warn(`Unexpected Prometheus response for query`, { query, resp });
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
return resp.data.result.map(({ metric, value }) => ({
|
|
18
|
+
labels: (metric ?? {}) as Record<string, string>,
|
|
19
|
+
value: parseFloat(value[1]),
|
|
20
|
+
}));
|
|
21
|
+
} catch (err) {
|
|
22
|
+
logger.warn(`Failed to run Prometheus query: ${err}`, { query });
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Formats a grouped vector result as a { labelValue: value } record for structured logging. */
|
|
28
|
+
function toRecord(series: { labels: Record<string, string>; value: number }[], label: string): Record<string, number> {
|
|
29
|
+
const out: Record<string, number> = {};
|
|
30
|
+
for (const { labels, value } of series) {
|
|
31
|
+
out[labels[label] ?? 'unknown'] = Math.round(value * 100) / 100;
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Scrapes and logs gossip tx validation timing breakdowns from Prometheus: per-stage validation
|
|
38
|
+
* durations, tx pool serial queue wait/execution times, and chonk (IVC) proof verifier timings.
|
|
39
|
+
* Used by the spartan TPS benchmarks to attribute slow gossip validations to a specific stage.
|
|
40
|
+
*/
|
|
41
|
+
export async function logGossipTxValidationMetrics(
|
|
42
|
+
prometheus: PrometheusClient,
|
|
43
|
+
namespace: string,
|
|
44
|
+
windowSeconds: number,
|
|
45
|
+
logger: Logger,
|
|
46
|
+
): Promise<void> {
|
|
47
|
+
const ns = `k8s_namespace_name="${namespace}"`;
|
|
48
|
+
const window = `[${Math.max(60, Math.ceil(windowSeconds))}s]`;
|
|
49
|
+
|
|
50
|
+
const stageQuantile = (perc: string) =>
|
|
51
|
+
`histogram_quantile(${perc}, sum(rate(aztec_p2p_gossip_tx_validation_stage_duration_milliseconds_bucket{${ns}}${window})) by (le, aztec_p2p_tx_validation_stage))`;
|
|
52
|
+
const stageAvg = () =>
|
|
53
|
+
`sum(rate(aztec_p2p_gossip_tx_validation_stage_duration_milliseconds_sum{${ns}}${window})) by (aztec_p2p_tx_validation_stage) / ` +
|
|
54
|
+
`sum(rate(aztec_p2p_gossip_tx_validation_stage_duration_milliseconds_count{${ns}}${window})) by (aztec_p2p_tx_validation_stage)`;
|
|
55
|
+
const validationQuantile = (perc: string) =>
|
|
56
|
+
`histogram_quantile(${perc}, sum(rate(aztec_p2p_gossip_message_validation_duration_milliseconds_bucket{${ns}}${window})) by (le, aztec_gossip_topic_name))`;
|
|
57
|
+
const queueQuantile = (metric: string, perc: string) =>
|
|
58
|
+
`topk(10, histogram_quantile(${perc}, sum(rate(${metric}{${ns}}${window})) by (le, aztec_mempool_operation)))`;
|
|
59
|
+
const ivcQuantile = (metric: string, perc: string) =>
|
|
60
|
+
`histogram_quantile(${perc}, sum(rate(${metric}{${ns}}${window})) by (le))`;
|
|
61
|
+
|
|
62
|
+
const stageLabel = 'aztec_p2p_tx_validation_stage';
|
|
63
|
+
const topicLabel = 'aztec_gossip_topic_name';
|
|
64
|
+
const operationLabel = 'aztec_mempool_operation';
|
|
65
|
+
|
|
66
|
+
const [stageP50, stageP95, stageAvgs, validationP95, slowCount] = await Promise.all([
|
|
67
|
+
queryVector(prometheus, stageQuantile('0.50'), logger),
|
|
68
|
+
queryVector(prometheus, stageQuantile('0.95'), logger),
|
|
69
|
+
queryVector(prometheus, stageAvg(), logger),
|
|
70
|
+
queryVector(prometheus, validationQuantile('0.95'), logger),
|
|
71
|
+
queryVector(prometheus, `sum(aztec_p2p_gossip_slow_validation_count{${ns}}) by (${topicLabel})`, logger),
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
logger.info('Gossip tx validation stage timings (ms)', {
|
|
75
|
+
stageP50: toRecord(stageP50, stageLabel),
|
|
76
|
+
stageP95: toRecord(stageP95, stageLabel),
|
|
77
|
+
stageAvg: toRecord(stageAvgs, stageLabel),
|
|
78
|
+
validationP95ByTopic: toRecord(validationP95, topicLabel),
|
|
79
|
+
slowValidationCountByTopic: toRecord(slowCount, topicLabel),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const [queueWaitP95, queueExecutionP95, queueLengthMax] = await Promise.all([
|
|
83
|
+
queryVector(prometheus, queueQuantile('aztec_mempool_tx_pool_v2_queue_wait_milliseconds_bucket', '0.95'), logger),
|
|
84
|
+
queryVector(
|
|
85
|
+
prometheus,
|
|
86
|
+
queueQuantile('aztec_mempool_tx_pool_v2_queue_execution_milliseconds_bucket', '0.95'),
|
|
87
|
+
logger,
|
|
88
|
+
),
|
|
89
|
+
queryVector(prometheus, `max(max_over_time(aztec_mempool_tx_pool_v2_queue_length{${ns}}${window}))`, logger),
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
logger.info('Tx pool serial queue stats (ms)', {
|
|
93
|
+
queueWaitP95: toRecord(queueWaitP95, operationLabel),
|
|
94
|
+
queueExecutionP95: toRecord(queueExecutionP95, operationLabel),
|
|
95
|
+
queueLengthMax: queueLengthMax[0]?.value,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const [ivcVerifyP95, ivcTotalP95] = await Promise.all([
|
|
99
|
+
queryVector(prometheus, ivcQuantile('aztec_ivc_verifier_time_milliseconds_bucket', '0.95'), logger),
|
|
100
|
+
queryVector(prometheus, ivcQuantile('aztec_ivc_verifier_total_time_milliseconds_bucket', '0.95'), logger),
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
// A large gap between total (queue + verify) and verify indicates a pile-up in the verifier queue.
|
|
104
|
+
logger.info('Chonk (IVC) proof verifier timings (ms)', {
|
|
105
|
+
verifyP95: ivcVerifyP95[0]?.value,
|
|
106
|
+
totalP95: ivcTotalP95[0]?.value,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
@@ -66,3 +66,9 @@ export { getPublicViemClient, getL1DeploymentAddresses, getNodeClient } from './
|
|
|
66
66
|
|
|
67
67
|
// Health checks
|
|
68
68
|
export { ChainHealth, type ChainHealthSnapshot } from './health.js';
|
|
69
|
+
|
|
70
|
+
// Pod log extraction
|
|
71
|
+
export { type BlockBuiltLogEntry, fetchBlockBuiltLogs } from './pod_logs.js';
|
|
72
|
+
|
|
73
|
+
// Gossip validation metrics scraping
|
|
74
|
+
export { logGossipTxValidationMetrics } from './gossip_metrics.js';
|
|
@@ -71,7 +71,7 @@ export async function waitForProvenToAdvance(
|
|
|
71
71
|
// Get current proven block number
|
|
72
72
|
let initialProvenBlock: number;
|
|
73
73
|
try {
|
|
74
|
-
const tips = await node.
|
|
74
|
+
const tips = await node.getChainTips();
|
|
75
75
|
initialProvenBlock = Number(tips.proven.block.number);
|
|
76
76
|
log.info(`Current proven block: ${initialProvenBlock}. Waiting for it to increase...`);
|
|
77
77
|
} catch (err) {
|
|
@@ -82,7 +82,7 @@ export async function waitForProvenToAdvance(
|
|
|
82
82
|
await retryUntil(
|
|
83
83
|
async () => {
|
|
84
84
|
try {
|
|
85
|
-
const tips = await node.
|
|
85
|
+
const tips = await node.getChainTips();
|
|
86
86
|
const currentProvenBlock = Number(tips.proven.block.number);
|
|
87
87
|
const proposedBlock = Number(tips.proposed.number);
|
|
88
88
|
|