@aztec/end-to-end 0.0.1-commit.96dac018d → 0.0.1-commit.9a89641
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 +37 -50
- 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 +35 -50
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +19 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +65 -59
- package/dest/bench/client_flows/data_extractor.js +1 -0
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +102 -8
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.d.ts +3 -3
- 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 +60 -44
- 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_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -2
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +6 -6
- package/dest/fixtures/ha_setup.d.ts +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 +88 -45
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +297 -202
- 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 +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 +21 -11
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +95 -48
- 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 +44 -32
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +28 -17
- package/dest/shared/jest_setup.js +32 -1
- 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 +55 -45
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/lending_simulator.d.ts +10 -3
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +27 -15
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
- package/dest/single-node/fees/fees_test.d.ts +95 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/single-node/fees/fees_test.js +344 -0
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +374 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +847 -0
- package/dest/spartan/setup_test_wallets.d.ts +4 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +93 -46
- package/dest/spartan/tx_metrics.d.ts +27 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +106 -21
- package/dest/spartan/utils/config.d.ts +10 -30
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +3 -1
- package/dest/spartan/utils/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 +3 -3
- 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 +50 -47
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
- package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +42 -61
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +41 -56
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +21 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +105 -70
- package/src/bench/client_flows/data_extractor.ts +1 -0
- package/src/bench/utils.ts +116 -7
- 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 +80 -64
- package/src/fixtures/fixtures.ts +100 -0
- package/src/fixtures/get_acvm_config.ts +2 -8
- package/src/fixtures/get_bb_config.ts +8 -8
- package/src/fixtures/ha_setup.ts +11 -5
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +379 -264
- 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 -6
- 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 +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/multi-node/README.md +96 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +115 -66
- 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 +44 -21
- package/src/shared/gas_portal_test_harness.ts +35 -18
- package/src/shared/jest_setup.ts +36 -1
- package/src/shared/submit-transactions.ts +13 -8
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +98 -54
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +33 -15
- package/src/simulators/token_simulator.ts +6 -2
- package/src/single-node/README.md +66 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
- package/src/single-node/fees/fees_test.ts +434 -0
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1058 -0
- package/src/spartan/setup_test_wallets.ts +117 -45
- package/src/spartan/tx_metrics.ts +108 -24
- package/src/spartan/utils/config.ts +2 -0
- package/src/spartan/utils/index.ts +6 -0
- package/src/spartan/utils/nodes.ts +3 -3
- 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 -56
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +0 -136
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.d.ts +0 -46
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -181
- 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 -324
- package/src/e2e_l1_publisher/write_json.ts +0 -77
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -73
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
- package/src/e2e_p2p/shared.ts +0 -290
- /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,9 +1,10 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
3
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { FeeJuiceContract } from '@aztec/aztec.js/protocol';
|
|
4
5
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { testSpan } from '../fixtures/timing.js';
|
|
7
|
+
import { waitForL1ToL2MessageSeen } from './wait_for_l1_to_l2_message.js';
|
|
7
8
|
export class FeeJuicePortalTestingHarnessFactory {
|
|
8
9
|
config;
|
|
9
10
|
constructor(config){
|
|
@@ -18,7 +19,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
18
19
|
if (feeJuiceAddress.isZero() || feeJuicePortalAddress.isZero()) {
|
|
19
20
|
throw new Error('Fee Juice portal not deployed on L1');
|
|
20
21
|
}
|
|
21
|
-
const gasL2 = FeeJuiceContract.
|
|
22
|
+
const gasL2 = FeeJuiceContract.withWallet(wallet);
|
|
22
23
|
return new GasBridgingTestHarness(aztecNode, aztecNodeAdmin, wallet, logger, gasL2, ethAccount, feeJuicePortalAddress, feeJuiceAddress, l1ContractAddresses.feeAssetHandlerAddress, l1Client);
|
|
23
24
|
}
|
|
24
25
|
static create(config) {
|
|
@@ -75,9 +76,9 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
async getL2PublicBalanceOf(owner) {
|
|
78
|
-
return await this.feeJuice.methods.balance_of_public(owner).simulate({
|
|
79
|
+
return (await this.feeJuice.methods.balance_of_public(owner).simulate({
|
|
79
80
|
from: owner
|
|
80
|
-
});
|
|
81
|
+
})).result;
|
|
81
82
|
}
|
|
82
83
|
async expectPublicBalanceOnL2(owner, expectedBalance) {
|
|
83
84
|
const balance = await this.getL2PublicBalanceOf(owner);
|
|
@@ -87,20 +88,27 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
87
88
|
const bridgeAmount = await this.l1TokenManager.getMintAmount();
|
|
88
89
|
await this.mintTokensOnL1();
|
|
89
90
|
const claim = await this.sendTokensToPortalPublic(bridgeAmount, owner);
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
await waitForL1ToL2MessageSeen(this.aztecNode, Fr.fromHexString(claim.messageHash), {
|
|
92
|
+
timeoutSeconds: 24
|
|
93
|
+
});
|
|
92
94
|
// Progress by 2 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
93
95
|
await this.advanceL2Block();
|
|
94
96
|
await this.advanceL2Block();
|
|
95
97
|
return claim;
|
|
96
98
|
}
|
|
97
99
|
async bridgeFromL1ToL2(owner, claimer) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
await testSpan('setup:bridge', async ()=>{
|
|
101
|
+
// Prepare the tokens on the L1 side
|
|
102
|
+
const claim = await this.prepareTokensOnL1(owner);
|
|
103
|
+
// Consume L1 -> L2 message and claim tokens privately on L2
|
|
104
|
+
await this.consumeMessageOnAztecAndClaimPrivately(owner, claimer, claim);
|
|
105
|
+
});
|
|
102
106
|
}
|
|
103
107
|
async advanceL2Block() {
|
|
108
|
+
if (this.aztecNode.mineBlock) {
|
|
109
|
+
await this.aztecNode.mineBlock();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
104
112
|
const initialBlockNumber = await this.aztecNode.getBlockNumber();
|
|
105
113
|
let minTxsPerBlock = undefined;
|
|
106
114
|
if (this.aztecNodeAdmin) {
|
|
@@ -109,11 +117,14 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
109
117
|
minTxsPerBlock: 0
|
|
110
118
|
}); // Set to 0 to ensure we can advance the block
|
|
111
119
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
try {
|
|
121
|
+
await retryUntil(async ()=>await this.aztecNode.getBlockNumber() >= initialBlockNumber + 1, 'gas portal block advance', 0, 0.25);
|
|
122
|
+
} finally{
|
|
123
|
+
if (this.aztecNodeAdmin && minTxsPerBlock !== undefined) {
|
|
124
|
+
await this.aztecNodeAdmin.setConfig({
|
|
125
|
+
minTxsPerBlock
|
|
126
|
+
});
|
|
127
|
+
}
|
|
117
128
|
}
|
|
118
129
|
}
|
|
119
|
-
}
|
|
130
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
-
import { afterEach, beforeEach, expect } from '@jest/globals';
|
|
2
|
+
import { afterAll, afterEach, beforeEach, expect } from '@jest/globals';
|
|
3
|
+
import { readlinkSync } from 'fs';
|
|
3
4
|
import { basename } from 'path';
|
|
4
5
|
import { EluMonitor } from '../fixtures/elu_monitor.js';
|
|
5
6
|
const eluMonitor = process.env.ELU_MONITOR_FILE ? new EluMonitor(process.env.ELU_MONITOR_FILE, Number(process.env.ELU_MONITOR_INTERVAL_MS) || undefined) : undefined;
|
|
@@ -18,3 +19,33 @@ beforeEach(()=>{
|
|
|
18
19
|
afterEach(()=>{
|
|
19
20
|
eluMonitor?.stopTest();
|
|
20
21
|
});
|
|
22
|
+
// Log leaked handles after all tests complete. This runs after test-level afterAll hooks,
|
|
23
|
+
// so any handles still alive at this point were not properly cleaned up during teardown.
|
|
24
|
+
// This diagnostic helps identify the source of exit hangs without masking them.
|
|
25
|
+
afterAll(()=>{
|
|
26
|
+
const handles = process._getActiveHandles();
|
|
27
|
+
if (handles.length > 0) {
|
|
28
|
+
const details = handles.map((h)=>{
|
|
29
|
+
const type = h?.constructor?.name ?? typeof h;
|
|
30
|
+
const fd = h?.fd ?? h?._handle?.fd ?? '?';
|
|
31
|
+
const destroyed = h?.destroyed ?? '?';
|
|
32
|
+
const hasRef = typeof h?.hasRef === 'function' ? h.hasRef() : '?';
|
|
33
|
+
const localAddr = h?.localAddress ?? '';
|
|
34
|
+
const remoteAddr = h?.remoteAddress ?? '';
|
|
35
|
+
const localPort = h?.localPort ?? '';
|
|
36
|
+
const remotePort = h?.remotePort ?? '';
|
|
37
|
+
const proto = Object.getPrototypeOf(h)?.constructor?.name ?? '?';
|
|
38
|
+
const keys = Object.keys(h).slice(0, 10).join(',');
|
|
39
|
+
let fdTarget = '';
|
|
40
|
+
if (typeof fd === 'number') {
|
|
41
|
+
try {
|
|
42
|
+
fdTarget = ` -> ${readlinkSync(`/proc/self/fd/${fd}`)}`;
|
|
43
|
+
} catch {
|
|
44
|
+
// ignore
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return ` ${type}(fd=${fd}, destroyed=${destroyed}, hasRef=${hasRef}${fdTarget}) proto=${proto} addr=${localAddr}:${localPort}->${remoteAddr}:${remotePort} keys=[${keys}]`;
|
|
48
|
+
});
|
|
49
|
+
process.stderr.write(`\n[jest_setup] WARNING: ${handles.length} handle(s) still active after teardown:\n${details.join('\n')}\n` + `These may prevent Jest from exiting. Investigate and fix the leak.\n\n`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
@@ -3,4 +3,4 @@ import type { Logger } from '@aztec/aztec.js/log';
|
|
|
3
3
|
import { TxHash } from '@aztec/aztec.js/tx';
|
|
4
4
|
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
5
5
|
export declare const submitTxsTo: (wallet: TestWallet, submitter: AztecAddress, numTxs: number, logger: Logger) => Promise<TxHash[]>;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3VibWl0LXRyYW5zYWN0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NoYXJlZC9zdWJtaXQtdHJhbnNhY3Rpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUd6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNsRCxPQUFPLEVBQUUsTUFBTSxFQUE0QixNQUFNLG9CQUFvQixDQUFDO0FBSXRFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBR2hFLGVBQU8sTUFBTSxXQUFXLG9HQTRCdkIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-transactions.d.ts","sourceRoot":"","sources":["../../src/shared/submit-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAA4B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"submit-transactions.d.ts","sourceRoot":"","sources":["../../src/shared/submit-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAA4B,MAAM,oBAAoB,CAAC;AAItE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,eAAO,MAAM,WAAW,oGA4BvB,CAAC"}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
|
-
import { Fr
|
|
1
|
+
import { NO_WAIT, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
3
|
import { TxStatus } from '@aztec/aztec.js/tx';
|
|
4
4
|
import { times } from '@aztec/foundation/collection';
|
|
5
|
+
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
5
6
|
// submits a set of transactions to the provided Wallet
|
|
6
7
|
export const submitTxsTo = async (wallet, submitter, numTxs, logger)=>{
|
|
8
|
+
// Register (without deploying) a single TestContract instance to source cheap throwaway txs from.
|
|
9
|
+
// emit_nullifier is #[noinitcheck], so it runs on a register-only instance — this avoids a full
|
|
10
|
+
// account-contract deployment per tx, which is all these callers were paying for a mined/gossiped tx.
|
|
11
|
+
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
12
|
+
salt: Fr.random()
|
|
13
|
+
});
|
|
14
|
+
await wallet.registerContract(testContractInstance, TestContractArtifact);
|
|
15
|
+
const contract = TestContract.at(testContractInstance.address, wallet);
|
|
7
16
|
const txHashes = [];
|
|
8
17
|
await Promise.all(times(numTxs, async ()=>{
|
|
9
|
-
const
|
|
10
|
-
const deployMethod = await accountManager.getDeployMethod();
|
|
11
|
-
const txHash = await deployMethod.send({
|
|
18
|
+
const { txHash } = await contract.methods.emit_nullifier(Fr.random()).send({
|
|
12
19
|
from: submitter,
|
|
13
20
|
wait: NO_WAIT
|
|
14
21
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** A single recorded span occurrence on the shared `performance.now()` clock. */ /**
|
|
2
|
+
* Groups `spans` by owner then tag, attaches a `spans` aggregate map to the matching record (or
|
|
3
|
+
* `suiteRecord` for `null`-owner spans), derives back-compat `setupFnMs` / `teardownFnMs`, drops spans
|
|
4
|
+
* whose owner matches no record, and returns the raw per-occurrence list (empty unless `emitSpanLines`).
|
|
5
|
+
*/ export { };
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { appendFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { basename } from 'node:path';
|
|
3
|
+
import CustomEnvironment from '../../../foundation/src/jest/env.mjs';
|
|
4
|
+
// Per-test e2e timing environment. Gated entirely on the TEST_TIMING_FILE env var: when unset, this
|
|
5
|
+
// behaves exactly like the base CustomEnvironment (it only delegates). When set, it records, per test
|
|
6
|
+
// worker process, the time spent in jest before/after hooks and the test body, and folds in the named
|
|
7
|
+
// spans recorded via the `testSpan()` wrapper (fixtures/timing.ts) through a collector shared on
|
|
8
|
+
// `this.global`.
|
|
9
|
+
//
|
|
10
|
+
// Output is one JSONL file per worker process (the env runs once per worker). Each line carries a
|
|
11
|
+
// `type` discriminator and is one of:
|
|
12
|
+
// - `type: 'test'` (`name` set): beforeEach hooks, the it() body, afterEach hooks for one test; or
|
|
13
|
+
// - `type: 'suite'` (`name: null`): the suite-scoped beforeAll/afterAll hooks for the whole file.
|
|
14
|
+
//
|
|
15
|
+
// Each line also gains a `spans` map: per `category:label` tag the test/suite touched, the collector
|
|
16
|
+
// records `{ count, totalMs, busyMs, maxMs }`. `busyMs` is the duration of the union of the spans'
|
|
17
|
+
// `[start, end)` intervals on the shared `performance.now()` clock, so concurrent spans (Promise.all
|
|
18
|
+
// fan-out) do not inflate it the way `totalMs` does. The legacy `setupFnMs`/`teardownFnMs` fields are
|
|
19
|
+
// kept for back-compat, derived from the `setup:env`/`teardown:env` spans.
|
|
20
|
+
//
|
|
21
|
+
// When `TEST_TIMING_SPANS=1`, the collector additionally retains every raw span occurrence and emits
|
|
22
|
+
// one `type:"span"` line per occurrence (owner, name, ms) for deep dives, at the cost of a larger file.
|
|
23
|
+
export default class TimingEnvironment extends CustomEnvironment {
|
|
24
|
+
constructor(config, context){
|
|
25
|
+
super(config, context);
|
|
26
|
+
this.timingFile = process.env.TEST_TIMING_FILE;
|
|
27
|
+
if (!this.timingFile) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.suite = basename(context?.testPath ?? config?.testPath ?? 'unknown').replace(/\.test\.[cm]?[jt]s$/, '');
|
|
31
|
+
this.meta = {
|
|
32
|
+
commit: process.env.COMMIT_HASH ?? null,
|
|
33
|
+
branch: process.env.TARGET_BRANCH ?? process.env.REF_NAME ?? null,
|
|
34
|
+
runId: process.env.RUN_ID ?? null
|
|
35
|
+
};
|
|
36
|
+
// Opt-in per-occurrence emission for deep dives (off by default keeps the JSONL one line per test).
|
|
37
|
+
this.emitSpanLines = process.env.TEST_TIMING_SPANS === '1';
|
|
38
|
+
// Shared collector. The instrumented helpers (running in the sandbox realm) read
|
|
39
|
+
// `globalThis.__e2eTimings`; this env (host realm) reads `this.global.__e2eTimings` — they are the
|
|
40
|
+
// same object. `current` is the full name of the test currently running (null during
|
|
41
|
+
// beforeAll/afterAll), used to attribute each span to a test or to the suite-scoped line. `spans`
|
|
42
|
+
// accumulates every recorded span until flush. The `start`/`end` timestamps come from the sandbox
|
|
43
|
+
// realm's `performance.now()`; Node's perf clock is process-wide (one monotonic origin across all
|
|
44
|
+
// realms), so merging the intervals here for `busyMs` is valid.
|
|
45
|
+
this.collector = {
|
|
46
|
+
current: null,
|
|
47
|
+
spans: []
|
|
48
|
+
};
|
|
49
|
+
this.global.__e2eTimings = this.collector;
|
|
50
|
+
// Records to flush as JSONL on teardown. One per test plus one suite-scoped record.
|
|
51
|
+
this.records = [];
|
|
52
|
+
this.recordsByName = new Map();
|
|
53
|
+
// The suite-scoped record (beforeAll/afterAll); bodyMs/totalMs are computed at flush time.
|
|
54
|
+
this.suiteRecord = {
|
|
55
|
+
name: null,
|
|
56
|
+
status: 'passed',
|
|
57
|
+
beforeHooksMs: 0,
|
|
58
|
+
afterHooksMs: 0
|
|
59
|
+
};
|
|
60
|
+
// Start times keyed by hook type (beforeAll/beforeEach/afterAll/afterEach).
|
|
61
|
+
this.hookStarts = {};
|
|
62
|
+
this.testStarts = new Map();
|
|
63
|
+
// Guards against double-flushing (we flush on both the teardown event and the teardown method).
|
|
64
|
+
this.flushed = false;
|
|
65
|
+
// Raw per-occurrence spans retained only when TEST_TIMING_SPANS=1, emitted as `type:"span"` lines.
|
|
66
|
+
this.rawSpans = [];
|
|
67
|
+
}
|
|
68
|
+
// Flush on the teardown method too: the jest lifecycle always calls this, whereas the 'teardown'
|
|
69
|
+
// event is not reliably delivered when a test run is interrupted. Whichever fires first wins.
|
|
70
|
+
async teardown() {
|
|
71
|
+
this.finalizeAndFlush();
|
|
72
|
+
await super.teardown();
|
|
73
|
+
}
|
|
74
|
+
async handleTestEvent(event, state) {
|
|
75
|
+
// Run the base env first so its unhandledRejection patching for after-hooks stays intact.
|
|
76
|
+
await super.handleTestEvent(event, state);
|
|
77
|
+
if (!this.timingFile) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const now = Date.now();
|
|
81
|
+
switch(event.name){
|
|
82
|
+
case 'hook_start':
|
|
83
|
+
{
|
|
84
|
+
this.hookStarts[event.hook.type] = now;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
case 'hook_success':
|
|
88
|
+
case 'hook_failure':
|
|
89
|
+
{
|
|
90
|
+
const start = this.hookStarts[event.hook.type];
|
|
91
|
+
if (start === undefined) {
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
delete this.hookStarts[event.hook.type];
|
|
95
|
+
const ms = now - start;
|
|
96
|
+
if (event.hook.type === 'beforeEach') {
|
|
97
|
+
this.addToCurrent('beforeHooksMs', ms);
|
|
98
|
+
} else if (event.hook.type === 'afterEach') {
|
|
99
|
+
this.addToCurrent('afterHooksMs', ms);
|
|
100
|
+
} else if (event.hook.type === 'beforeAll') {
|
|
101
|
+
this.suiteRecord.beforeHooksMs += ms;
|
|
102
|
+
} else if (event.hook.type === 'afterAll') {
|
|
103
|
+
this.suiteRecord.afterHooksMs += ms;
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case 'test_start':
|
|
108
|
+
{
|
|
109
|
+
const name = this.fullTestName(event.test);
|
|
110
|
+
const record = {
|
|
111
|
+
type: 'test',
|
|
112
|
+
name,
|
|
113
|
+
status: 'passed',
|
|
114
|
+
setupFnMs: 0,
|
|
115
|
+
beforeHooksMs: 0,
|
|
116
|
+
bodyMs: 0,
|
|
117
|
+
teardownFnMs: 0,
|
|
118
|
+
afterHooksMs: 0,
|
|
119
|
+
totalMs: 0,
|
|
120
|
+
startedAt: new Date(now).toISOString()
|
|
121
|
+
};
|
|
122
|
+
this.records.push(record);
|
|
123
|
+
this.recordsByName.set(name, record);
|
|
124
|
+
this.testStarts.set(name, now);
|
|
125
|
+
this.collector.current = name;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 'test_fn_start':
|
|
129
|
+
{
|
|
130
|
+
this.testStarts.set(`fn:${this.fullTestName(event.test)}`, now);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case 'test_fn_success':
|
|
134
|
+
case 'test_fn_failure':
|
|
135
|
+
{
|
|
136
|
+
const name = this.fullTestName(event.test);
|
|
137
|
+
const start = this.testStarts.get(`fn:${name}`);
|
|
138
|
+
const record = this.recordsByName.get(name);
|
|
139
|
+
if (record && start !== undefined) {
|
|
140
|
+
record.bodyMs = now - start;
|
|
141
|
+
}
|
|
142
|
+
if (record && event.name === 'test_fn_failure') {
|
|
143
|
+
record.status = 'failed';
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case 'test_done':
|
|
148
|
+
{
|
|
149
|
+
const name = this.fullTestName(event.test);
|
|
150
|
+
const record = this.recordsByName.get(name);
|
|
151
|
+
const start = this.testStarts.get(name);
|
|
152
|
+
if (record && start !== undefined) {
|
|
153
|
+
record.totalMs = now - start;
|
|
154
|
+
}
|
|
155
|
+
if (record && event.test?.errors?.length) {
|
|
156
|
+
record.status = 'failed';
|
|
157
|
+
}
|
|
158
|
+
this.collector.current = null;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case 'teardown':
|
|
162
|
+
{
|
|
163
|
+
this.finalizeAndFlush();
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
default:
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** The record for the test currently running, if any. */ currentRecord() {
|
|
171
|
+
return this.collector.current ? this.recordsByName.get(this.collector.current) : undefined;
|
|
172
|
+
}
|
|
173
|
+
/** Adds `ms` to a hook bucket on the current per-test record, or the suite record during beforeAll/afterAll. */ addToCurrent(field, ms) {
|
|
174
|
+
const record = this.currentRecord();
|
|
175
|
+
if (record) {
|
|
176
|
+
record[field] += ms;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/** Builds the full test name by walking up the describe blocks, matching jest's currentTestName. */ fullTestName(test) {
|
|
180
|
+
if (!test) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
const parts = [];
|
|
184
|
+
let node = test;
|
|
185
|
+
while(node && node.name && node.name !== 'ROOT_DESCRIBE_BLOCK'){
|
|
186
|
+
parts.unshift(node.name);
|
|
187
|
+
node = node.parent;
|
|
188
|
+
}
|
|
189
|
+
return parts.join(' ');
|
|
190
|
+
}
|
|
191
|
+
/** Folds the collected spans into the per-test / suite records via {@link foldSpansInto}, then drains the collector. */ foldSpans() {
|
|
192
|
+
const rawSpans = foldSpansInto(this.collector.spans, {
|
|
193
|
+
recordsByName: this.recordsByName,
|
|
194
|
+
suiteRecord: this.suiteRecord,
|
|
195
|
+
emitSpanLines: this.emitSpanLines
|
|
196
|
+
});
|
|
197
|
+
this.rawSpans.push(...rawSpans);
|
|
198
|
+
this.collector.spans = [];
|
|
199
|
+
}
|
|
200
|
+
/** Folds spans into records, finalizes the suite-scoped record, and writes all JSONL. */ finalizeAndFlush() {
|
|
201
|
+
if (this.flushed || !this.timingFile) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.flushed = true;
|
|
205
|
+
this.foldSpans();
|
|
206
|
+
const lines = [];
|
|
207
|
+
for (const record of this.records){
|
|
208
|
+
lines.push(this.toLine({
|
|
209
|
+
...record
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
lines.push(this.toLine({
|
|
213
|
+
type: 'suite',
|
|
214
|
+
name: null,
|
|
215
|
+
status: 'passed',
|
|
216
|
+
setupFnMs: this.suiteRecord.setupFnMs ?? 0,
|
|
217
|
+
beforeHooksMs: this.suiteRecord.beforeHooksMs,
|
|
218
|
+
teardownFnMs: this.suiteRecord.teardownFnMs ?? 0,
|
|
219
|
+
afterHooksMs: this.suiteRecord.afterHooksMs,
|
|
220
|
+
totalMs: this.suiteRecord.beforeHooksMs + this.suiteRecord.afterHooksMs,
|
|
221
|
+
spans: this.suiteRecord.spans
|
|
222
|
+
}));
|
|
223
|
+
for (const raw of this.rawSpans){
|
|
224
|
+
lines.push(this.toLine({
|
|
225
|
+
type: 'span',
|
|
226
|
+
name: raw.owner,
|
|
227
|
+
span: raw.name,
|
|
228
|
+
ms: raw.ms
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
const payload = lines.join('\n') + '\n';
|
|
232
|
+
try {
|
|
233
|
+
// One file per worker process, but a worker may run several suites: append so we keep them all.
|
|
234
|
+
appendFileSync(this.timingFile, payload);
|
|
235
|
+
} catch {
|
|
236
|
+
try {
|
|
237
|
+
writeFileSync(this.timingFile, payload);
|
|
238
|
+
} catch {
|
|
239
|
+
// Timing is best-effort; never fail a test because we couldn't write the file.
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/** Flattens metadata onto a record and serializes to a single JSON line, rounding all Ms fields. */ toLine(record) {
|
|
244
|
+
const obj = {
|
|
245
|
+
suite: this.suite,
|
|
246
|
+
...record,
|
|
247
|
+
...this.meta
|
|
248
|
+
};
|
|
249
|
+
for (const key of Object.keys(obj)){
|
|
250
|
+
if (key.endsWith('Ms') && typeof obj[key] === 'number') {
|
|
251
|
+
obj[key] = Math.round(obj[key]);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// Round the nested span aggregates' Ms fields too (totalMs/busyMs/maxMs per tag).
|
|
255
|
+
if (obj.spans && typeof obj.spans === 'object') {
|
|
256
|
+
for (const agg of Object.values(obj.spans)){
|
|
257
|
+
for (const key of Object.keys(agg)){
|
|
258
|
+
if (key.endsWith('Ms') && typeof agg[key] === 'number') {
|
|
259
|
+
agg[key] = Math.round(agg[key]);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return JSON.stringify(obj);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Aggregates a list of `{ start, end }` spans of one tag into `{ count, totalMs, busyMs, maxMs }`.
|
|
269
|
+
* `totalMs` is the naive sum of per-occurrence durations (correct for serial repeats); `busyMs` is
|
|
270
|
+
* the duration of the union of the `[start, end)` intervals (concurrency-correct — N concurrent
|
|
271
|
+
* spans collapse to their wall-clock span instead of summing to ~N×); `maxMs` is the longest single
|
|
272
|
+
* occurrence. All durations are on the shared process-wide `performance.now()` clock. Does not mutate
|
|
273
|
+
* the input array.
|
|
274
|
+
*/ export function aggregateSpans(spans) {
|
|
275
|
+
let totalMs = 0;
|
|
276
|
+
let maxMs = 0;
|
|
277
|
+
for (const span of spans){
|
|
278
|
+
const ms = span.end - span.start;
|
|
279
|
+
totalMs += ms;
|
|
280
|
+
if (ms > maxMs) {
|
|
281
|
+
maxMs = ms;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// busyMs: sort by start and merge overlapping intervals, summing the merged lengths.
|
|
285
|
+
const sorted = [
|
|
286
|
+
...spans
|
|
287
|
+
].sort((a, b)=>a.start - b.start);
|
|
288
|
+
let busyMs = 0;
|
|
289
|
+
let mergeStart = null;
|
|
290
|
+
let mergeEnd = null;
|
|
291
|
+
for (const span of sorted){
|
|
292
|
+
if (mergeStart === null) {
|
|
293
|
+
mergeStart = span.start;
|
|
294
|
+
mergeEnd = span.end;
|
|
295
|
+
} else if (span.start <= mergeEnd) {
|
|
296
|
+
if (span.end > mergeEnd) {
|
|
297
|
+
mergeEnd = span.end;
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
busyMs += mergeEnd - mergeStart;
|
|
301
|
+
mergeStart = span.start;
|
|
302
|
+
mergeEnd = span.end;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (mergeStart !== null) {
|
|
306
|
+
busyMs += mergeEnd - mergeStart;
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
count: spans.length,
|
|
310
|
+
totalMs,
|
|
311
|
+
busyMs,
|
|
312
|
+
maxMs
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Groups `spans` by owner, then by tag, and attaches a `spans` map of aggregates to the matching
|
|
317
|
+
* per-test record (looked up in `recordsByName`) or, for `null`-owner spans, to `suiteRecord`. Also
|
|
318
|
+
* derives the back-compat `setupFnMs` / `teardownFnMs` fields from the `setup:env:<mode>` /
|
|
319
|
+
* `teardown:env` aggregates (additive over any pre-existing value). Spans whose owner matches no
|
|
320
|
+
* record (e.g. the pinned `other:mempool-feeder` owner) are dropped. Returns the raw per-occurrence
|
|
321
|
+
* list (`{ owner, name, ms }`), which is empty unless `emitSpanLines` is set.
|
|
322
|
+
*/ export function foldSpansInto(spans, { recordsByName, suiteRecord, emitSpanLines = false }) {
|
|
323
|
+
const rawSpans = [];
|
|
324
|
+
// Group by owner (null owner → suite record), then by tag.
|
|
325
|
+
const byOwner = new Map();
|
|
326
|
+
for (const span of spans){
|
|
327
|
+
const owner = span.owner ?? null;
|
|
328
|
+
let byName = byOwner.get(owner);
|
|
329
|
+
if (!byName) {
|
|
330
|
+
byName = new Map();
|
|
331
|
+
byOwner.set(owner, byName);
|
|
332
|
+
}
|
|
333
|
+
let list = byName.get(span.name);
|
|
334
|
+
if (!list) {
|
|
335
|
+
list = [];
|
|
336
|
+
byName.set(span.name, list);
|
|
337
|
+
}
|
|
338
|
+
list.push(span);
|
|
339
|
+
if (emitSpanLines) {
|
|
340
|
+
rawSpans.push({
|
|
341
|
+
owner,
|
|
342
|
+
name: span.name,
|
|
343
|
+
ms: span.end - span.start
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
for (const [owner, byName] of byOwner){
|
|
348
|
+
const record = owner === null ? suiteRecord : recordsByName.get(owner);
|
|
349
|
+
if (!record) {
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
const aggregates = {};
|
|
353
|
+
for (const [name, list] of byName){
|
|
354
|
+
aggregates[name] = aggregateSpans(list);
|
|
355
|
+
}
|
|
356
|
+
record.spans = aggregates;
|
|
357
|
+
// Back-compat: the legacy fn-span buckets are derived from the top-level env setup/teardown tags.
|
|
358
|
+
// The top-level setup is tagged `setup:env:<proverMode>` (the mode is a closed set, distinct from
|
|
359
|
+
// the `:anvil`/`:l1-deploy`/... sub-phase tags), so sum those three exact tags.
|
|
360
|
+
const setupFnMs = (aggregates['setup:env:none']?.totalMs ?? 0) + (aggregates['setup:env:fake']?.totalMs ?? 0) + (aggregates['setup:env:real']?.totalMs ?? 0);
|
|
361
|
+
record.setupFnMs = setupFnMs + (record.setupFnMs ?? 0);
|
|
362
|
+
record.teardownFnMs = (aggregates['teardown:env']?.totalMs ?? 0) + (record.teardownFnMs ?? 0);
|
|
363
|
+
}
|
|
364
|
+
return rawSpans;
|
|
365
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type EndToEndContext } from '../fixtures/utils.js';
|
|
2
2
|
export declare const uniswapL1L2TestSuite: (setup: () => Promise<EndToEndContext>, cleanup: () => Promise<void>, expectedForkBlockNumber?: number) => void;
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5pc3dhcF9sMV9sMi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NoYXJlZC91bmlzd2FwX2wxX2wyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXVCQSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQStCLE1BQU0sc0JBQXNCLENBQUM7QUFhekYsZUFBTyxNQUFNLG9CQUFvQixpSEE0Z0NoQyxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,sBAAsB,CAAC;AAazF,eAAO,MAAM,oBAAoB,iHA4gChC,CAAC"}
|