@aztec/end-to-end 0.0.1-commit.4d3c002 → 0.0.1-commit.4d9804df
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -14
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/{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 +45 -29
- 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 +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 +12 -9
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +50 -30
- 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/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 +71 -41
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +277 -198
- 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/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 +21 -1
- 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 +19 -10
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +81 -38
- 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 +32 -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 +25 -20
- 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 -37
- 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 +24 -12
- 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 +93 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/fees_test.js +78 -59
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +360 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +833 -0
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +28 -12
- 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 -35
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +2 -2
- package/dest/test-wallet/test_wallet.d.ts +39 -10
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +166 -59
- 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 +47 -42
- 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 +77 -56
- package/src/bench/client_flows/data_extractor.ts +1 -0
- 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 +64 -48
- package/src/fixtures/fixtures.ts +100 -0
- 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 +336 -255
- package/src/fixtures/setup_p2p_test.ts +15 -11
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +39 -4
- 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 +95 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +92 -49
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +35 -28
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +35 -14
- 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 +80 -43
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +28 -14
- package/src/single-node/README.md +60 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
- package/src/{e2e_fees → single-node/fees}/fees_test.ts +103 -66
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1041 -0
- package/src/spartan/setup_test_wallets.ts +30 -13
- package/src/spartan/tx_metrics.ts +107 -23
- package/src/spartan/utils/nodes.ts +2 -2
- package/src/test-wallet/test_wallet.ts +185 -60
- 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 -104
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -389
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -88
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -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 -66
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -212
- 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 -499
- 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 -343
- /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
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
2
|
+
import { INITIAL_L2_BLOCK_NUM } from '@aztec/aztec.js/protocol';
|
|
3
|
+
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
4
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
5
|
+
import { testSpan } from './timing.js';
|
|
6
|
+
/**
|
|
7
|
+
* Polls `node.getBlockNumber(tag)` until `opts.compare(actual, target)` holds (default `>=`). Replaces
|
|
8
|
+
* the ad-hoc `retryUntil(() => node.getBlockNumber(tag) <op> target)` polls scattered across the suite,
|
|
9
|
+
* where the node may sync forward or prune backward — the caller passes the comparator for whichever it
|
|
10
|
+
* expects.
|
|
11
|
+
* @returns The block number once the comparison holds.
|
|
12
|
+
*/ export function waitForBlockNumber(node, target, opts = {}) {
|
|
13
|
+
const tag = opts.tag ?? 'proposed';
|
|
14
|
+
const compare = opts.compare ?? ((actual, target)=>actual >= target);
|
|
15
|
+
return testSpan(`wait:${tag}`, ()=>// Wrap the matched value: retryUntil treats any falsy return as "keep polling", so a legitimate
|
|
16
|
+
// match of block 0 (e.g. a freshly-pruned tip) would otherwise loop until timeout.
|
|
17
|
+
retryUntil(async ()=>{
|
|
18
|
+
const blockNumber = await node.getBlockNumber(tag);
|
|
19
|
+
return compare(blockNumber, target) ? {
|
|
20
|
+
blockNumber
|
|
21
|
+
} : undefined;
|
|
22
|
+
}, `block ${tag} ${compare} ${target}`, opts.timeout ?? 60, opts.interval ?? 0.25).then(({ blockNumber })=>blockNumber));
|
|
23
|
+
}
|
|
24
|
+
/** Convenience for {@link waitForBlockNumber} on the proven tip. */ export function waitForProvenBlock(node, target, opts = {}) {
|
|
25
|
+
return waitForBlockNumber(node, target, {
|
|
26
|
+
...opts,
|
|
27
|
+
tag: 'proven'
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Polls a single node's checkpoint number until `opts.compare(actual, target)` holds. Replaces the
|
|
32
|
+
* `retryUntil(() => node.getChainTips().then(tips => tips.<tag>.checkpoint.number <op> target))` polls
|
|
33
|
+
* duplicated across the reorg/proving tests, where the node may sync forward, prune backward, or land
|
|
34
|
+
* exactly on a value — the caller passes the comparator lambda for whichever it expects.
|
|
35
|
+
* @returns The node's checkpoint number once the comparison holds.
|
|
36
|
+
*/ export function waitForNodeCheckpoint(node, target, opts = {}) {
|
|
37
|
+
const tag = opts.tag ?? 'checkpointed';
|
|
38
|
+
const compare = opts.compare ?? ((actual, target)=>actual >= target);
|
|
39
|
+
return testSpan(tag === 'proven' ? 'wait:proven-checkpoint' : 'wait:checkpoint', ()=>// Wrap the matched value: retryUntil treats any falsy return as "keep polling", so a legitimate
|
|
40
|
+
// match of checkpoint 0 (e.g. proven === 0 or checkpointed <= 1 after a prune) would otherwise
|
|
41
|
+
// loop until timeout instead of resolving.
|
|
42
|
+
retryUntil(async ()=>{
|
|
43
|
+
const checkpointNumber = await node.getCheckpointNumber(tag);
|
|
44
|
+
return compare(checkpointNumber, target) ? {
|
|
45
|
+
checkpointNumber
|
|
46
|
+
} : undefined;
|
|
47
|
+
}, `node checkpoint ${tag} ${compare} ${target}`, opts.timeout ?? 30, opts.interval ?? 0.5).then(({ checkpointNumber })=>checkpointNumber));
|
|
48
|
+
}
|
|
49
|
+
/** Convenience for {@link waitForNodeCheckpoint} on the proven tip. */ export function waitForNodeProvenCheckpoint(node, target, opts = {}) {
|
|
50
|
+
return waitForNodeCheckpoint(node, target, {
|
|
51
|
+
...opts,
|
|
52
|
+
tag: 'proven'
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Waits for all of `txHashes` to reach the desired status on `node`. The plural form of
|
|
57
|
+
* {@link waitForTx}; resolves with the receipts in input order.
|
|
58
|
+
*/ export function waitForTxs(node, txHashes, opts) {
|
|
59
|
+
const optsWithInterval = {
|
|
60
|
+
...opts,
|
|
61
|
+
interval: opts?.interval ?? 0.25
|
|
62
|
+
};
|
|
63
|
+
return testSpan('wait:tx-mined', ()=>Promise.all(txHashes.map((txHash)=>waitForTx(node, txHash, optsWithInterval))));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Polls `node.getBlocks` until every slot in `slots` is present among the fetched blocks' slot
|
|
67
|
+
* numbers. Replaces the hand-rolled `retryUntil` over `getBlocks(...).map(getSlot)` membership check.
|
|
68
|
+
*/ export async function waitForBlocksAtSlots(node, slots, opts = {}) {
|
|
69
|
+
const from = opts.from ?? INITIAL_L2_BLOCK_NUM;
|
|
70
|
+
const limit = opts.limit ?? 10;
|
|
71
|
+
await testSpan('wait:block', ()=>retryUntil(async ()=>{
|
|
72
|
+
const blocks = await node.getBlocks(from, limit);
|
|
73
|
+
const foundSlots = blocks.map((block)=>block.header.getSlot());
|
|
74
|
+
return slots.every((slot)=>foundSlots.includes(slot)) || undefined;
|
|
75
|
+
}, `blocks at slots ${slots.join(', ')}`, opts.timeout ?? 20, opts.interval ?? 0.25));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Polls `node.getL2ToL1MembershipWitness(txHash, message)` until a witness is available, resolving
|
|
79
|
+
* with it. Wraps the `retryUntil` the cross-chain tests hand-roll while waiting for an L2-to-L1
|
|
80
|
+
* message's membership witness to become provable.
|
|
81
|
+
*/ export function waitForL2ToL1Witness(node, txHash, message, opts = {}) {
|
|
82
|
+
return testSpan('wait:l2-to-l1-witness', ()=>retryUntil(()=>node.getL2ToL1MembershipWitness(txHash, message), `L2-to-L1 membership witness for ${txHash.toString()}`, opts.timeout ?? 30, opts.interval ?? 0.25));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Polls `node.getTxReceipt(txHash)` until `predicate(receipt)` holds, resolving with the receipt.
|
|
86
|
+
* Wraps the `retryUntil` that the block-building reorg tests hand-roll while waiting for a tx to
|
|
87
|
+
* transition between statuses (pruned, re-included, ...).
|
|
88
|
+
* @returns The receipt once the predicate holds.
|
|
89
|
+
*/ export function waitForTxReceipt(node, txHash, predicate, opts = {}) {
|
|
90
|
+
return testSpan('wait:tx-mined', ()=>retryUntil(async ()=>{
|
|
91
|
+
const receipt = await node.getTxReceipt(txHash);
|
|
92
|
+
return predicate(receipt) ? {
|
|
93
|
+
receipt
|
|
94
|
+
} : undefined;
|
|
95
|
+
}, `tx receipt for ${txHash.toString()}`, opts.timeout ?? 30, opts.interval ?? 0.25).then(({ receipt })=>receipt));
|
|
96
|
+
}
|
|
97
|
+
/** Polls until `node.getTxReceipt(txHash).status === status`. Thin wrapper over {@link waitForTxReceipt}. */ export function waitForTxStatus(node, txHash, status, opts = {}) {
|
|
98
|
+
return waitForTxReceipt(node, txHash, (receipt)=>receipt.status === status, opts);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Polls `node.getPendingTxCount()` until `opts.compare(actual, target)` holds (default `>=`).
|
|
102
|
+
* Replaces the hand-rolled mempool-size poll in the slashing tests.
|
|
103
|
+
* @returns The pending-tx count once the comparison holds.
|
|
104
|
+
*/ export function waitForPendingTxCount(node, target, opts = {}) {
|
|
105
|
+
const compare = opts.compare ?? ((actual, target)=>actual >= target);
|
|
106
|
+
return testSpan('wait:pending-tx', ()=>// Wrap the matched value: retryUntil treats any falsy return as "keep polling", so a legitimate
|
|
107
|
+
// match of 0 pending txs would otherwise loop until timeout instead of resolving.
|
|
108
|
+
retryUntil(async ()=>{
|
|
109
|
+
const count = await node.getPendingTxCount();
|
|
110
|
+
return compare(count, target) ? {
|
|
111
|
+
count
|
|
112
|
+
} : undefined;
|
|
113
|
+
}, `pending tx count ${compare} ${target}`, opts.timeout ?? 30, opts.interval ?? 0.25).then(({ count })=>count));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Resolves once `sequencer` reaches `state`. Subscribes to the `state-changed` event first, then (if
|
|
117
|
+
* `opts.after` is given) runs the action, then resolves immediately if the sequencer is already at
|
|
118
|
+
* `state`, otherwise waits for the transition. The listener is cleaned up on both resolve and timeout.
|
|
119
|
+
* Replaces the hand-rolled `state-changed` on/off subscriptions duplicated across the fee, cross-chain,
|
|
120
|
+
* and keystore-reload tests.
|
|
121
|
+
*/ export function waitForSequencerState(sequencer, state, opts = {}) {
|
|
122
|
+
return testSpan('wait:sequencer-state', ()=>waitForSequencerStateInner(sequencer, state, opts));
|
|
123
|
+
}
|
|
124
|
+
async function waitForSequencerStateInner(sequencer, state, opts) {
|
|
125
|
+
const timeout = opts.timeout ?? 30000;
|
|
126
|
+
const { promise, resolve, reject } = promiseWithResolvers();
|
|
127
|
+
let settled = false;
|
|
128
|
+
const handler = (args)=>{
|
|
129
|
+
if (args.newState === state) {
|
|
130
|
+
finish(resolve);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const timer = setTimeout(()=>finish(()=>reject(new Error(`Timeout waiting for sequencer ${state} state`))), timeout);
|
|
134
|
+
function finish(complete) {
|
|
135
|
+
if (settled) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
settled = true;
|
|
139
|
+
clearTimeout(timer);
|
|
140
|
+
sequencer.off('state-changed', handler);
|
|
141
|
+
complete();
|
|
142
|
+
}
|
|
143
|
+
sequencer.on('state-changed', handler);
|
|
144
|
+
try {
|
|
145
|
+
await opts.after?.();
|
|
146
|
+
if (sequencer.status().state === state) {
|
|
147
|
+
finish(resolve);
|
|
148
|
+
}
|
|
149
|
+
await promise;
|
|
150
|
+
} catch (err) {
|
|
151
|
+
finish(()=>{});
|
|
152
|
+
throw err;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a JSON-RPC client that connects to a remote wallet service.
|
|
4
|
+
* The returned object implements the {@link Wallet} interface, proxying all calls over HTTP to the specified URL.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createWalletClient(url: string): Wallet;
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0X3JwY19jbGllbnQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9mb3J3YXJkLWNvbXBhdGliaWxpdHkvd2FsbGV0X3JwY19jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFJckQ7OztHQUdHO0FBQ0gsd0JBQWdCLGtCQUFrQixDQUFDLEdBQUcsRUFBRSxNQUFNLEdBQUcsTUFBTSxDQUt0RCJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet_rpc_client.d.ts","sourceRoot":"","sources":["../../src/forward-compatibility/wallet_rpc_client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAIrD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKtD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WalletSchema } from '@aztec/aztec.js/wallet';
|
|
2
|
+
import { createSafeJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a JSON-RPC client that connects to a remote wallet service.
|
|
5
|
+
* The returned object implements the {@link Wallet} interface, proxying all calls over HTTP to the specified URL.
|
|
6
|
+
*/ export function createWalletClient(url) {
|
|
7
|
+
return createSafeJsonRpcClient(url, WalletSchema, {
|
|
8
|
+
namespaceMethods: 'wallet',
|
|
9
|
+
fetch: makeFetch([
|
|
10
|
+
1,
|
|
11
|
+
2,
|
|
12
|
+
3
|
|
13
|
+
], false)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings
|
|
2
|
+
export {};
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0X3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9mb3J3YXJkLWNvbXBhdGliaWxpdHkvd2FsbGV0X3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet_service.d.ts","sourceRoot":"","sources":["../../src/forward-compatibility/wallet_service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings
|
|
2
|
+
/**
|
|
3
|
+
* Standalone entrypoint that spins up a local Aztec network (L1 + node) and exposes a {@link NodeEmbeddedWallet} over
|
|
4
|
+
* JSON-RPC.
|
|
5
|
+
*
|
|
6
|
+
* Intended for forward-compatibility testing: an **old** release image runs this script so that **new** tests can send
|
|
7
|
+
* new artifacts to old runtime code (loadContractArtifact, ACIR simulator, class-ID computation, entrypoint encoding,
|
|
8
|
+
* etc.).
|
|
9
|
+
*/ import { getSchnorrAccountContractAddress } from '@aztec/accounts/schnorr';
|
|
10
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
11
|
+
import { createLocalNetwork } from '@aztec/aztec';
|
|
12
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
13
|
+
import { WalletSchema } from '@aztec/aztec.js/wallet';
|
|
14
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
15
|
+
import { createNamespacedSafeJsonRpcServer, startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
16
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
17
|
+
import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
18
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
19
|
+
const logger = createLogger('wallet-service');
|
|
20
|
+
const { ETHEREUM_HOSTS = 'http://localhost:8545', NODE_PORT = '8080', WALLET_PORT = '8081' } = process.env;
|
|
21
|
+
async function main() {
|
|
22
|
+
const l1RpcUrls = ETHEREUM_HOSTS.split(',').map((url)=>url.trim());
|
|
23
|
+
// Some tests (e.g. AMM) need 4 accounts but only 3 are funded via genesis. Generate deterministic keys for a 4th
|
|
24
|
+
// account so we can compute its address before network startup and include it in genesis funding. We cannot do this
|
|
25
|
+
// in the test because Wallet interface does not expose account creation functionality (only TestWallet exposes that
|
|
26
|
+
// but that's not used in forward compatibility testing).
|
|
27
|
+
const extraAccountSecret = Fr.fromHexString('0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef');
|
|
28
|
+
const extraAccountSalt = Fr.ZERO;
|
|
29
|
+
const extraAccountSigningKey = GrumpkinScalar.random();
|
|
30
|
+
const extraAccountAddress = await getSchnorrAccountContractAddress(extraAccountSigningKey, extraAccountSalt, extraAccountSecret);
|
|
31
|
+
logger.info('Starting wallet service...', {
|
|
32
|
+
l1RpcUrls
|
|
33
|
+
});
|
|
34
|
+
// createLocalNetwork deploys L1 contracts, starts the node, and optionally deploys funded test accounts (when
|
|
35
|
+
// TEST_ACCOUNTS=true via env). We are not proving anything just like is done when local network is started by
|
|
36
|
+
// the `aztecStart` function. The extra account address is passed via prefundAddresses so it gets fee juice at genesis.
|
|
37
|
+
const { node, stop: stopNetwork } = await createLocalNetwork({
|
|
38
|
+
l1RpcUrls,
|
|
39
|
+
realProofs: false,
|
|
40
|
+
prefundAddresses: [
|
|
41
|
+
extraAccountAddress.toString()
|
|
42
|
+
]
|
|
43
|
+
}, logger.info);
|
|
44
|
+
// Create an ephemeral embedded wallet backed by the local node.
|
|
45
|
+
const wallet = await EmbeddedWallet.create(node, {
|
|
46
|
+
ephemeral: true
|
|
47
|
+
});
|
|
48
|
+
// Re-register the initial test accounts so they are available via wallet.getAccounts(). createLocalNetwork deploys
|
|
49
|
+
// them onchain but uses a temporary wallet that is then stopped.
|
|
50
|
+
//
|
|
51
|
+
// We use the non-lazy import path (@aztec/accounts/testing, not /lazy) to avoid the dynamic JSON import that is
|
|
52
|
+
// incompatible with Node.js import attribute enforcement.
|
|
53
|
+
const testAccountsData = await getInitialTestAccountsData();
|
|
54
|
+
const accounts = await Promise.all(testAccountsData.map(({ secret, salt, signingKey })=>wallet.createSchnorrInitializerlessAccount(secret, salt, signingKey)));
|
|
55
|
+
// Register and deploy the 4th account.
|
|
56
|
+
const extraAccount = await wallet.createSchnorrAccount(extraAccountSecret, extraAccountSalt, extraAccountSigningKey);
|
|
57
|
+
const deployMethod = await extraAccount.getDeployMethod();
|
|
58
|
+
await deployMethod.send({
|
|
59
|
+
from: accounts[0].address
|
|
60
|
+
});
|
|
61
|
+
logger.info('Embedded wallet created', {
|
|
62
|
+
accounts: [
|
|
63
|
+
...accounts,
|
|
64
|
+
extraAccount
|
|
65
|
+
].map((a)=>a.address.toString())
|
|
66
|
+
});
|
|
67
|
+
// Contract artifacts are large, so allow generous body sizes for RPC requests.
|
|
68
|
+
const rpcOptions = {
|
|
69
|
+
maxBodySizeBytes: '50mb'
|
|
70
|
+
};
|
|
71
|
+
// Serve node RPC
|
|
72
|
+
const nodeRpcServer = createNamespacedSafeJsonRpcServer({
|
|
73
|
+
aztec: [
|
|
74
|
+
node,
|
|
75
|
+
AztecNodeApiSchema
|
|
76
|
+
]
|
|
77
|
+
}, rpcOptions);
|
|
78
|
+
const nodeHttpServer = await startHttpRpcServer(nodeRpcServer, {
|
|
79
|
+
port: NODE_PORT
|
|
80
|
+
});
|
|
81
|
+
logger.info(`Node JSON-RPC server listening on port ${nodeHttpServer.port}`);
|
|
82
|
+
// Serve wallet RPC
|
|
83
|
+
const walletRpcServer = createNamespacedSafeJsonRpcServer({
|
|
84
|
+
wallet: [
|
|
85
|
+
wallet,
|
|
86
|
+
WalletSchema
|
|
87
|
+
]
|
|
88
|
+
}, rpcOptions);
|
|
89
|
+
const walletHttpServer = await startHttpRpcServer(walletRpcServer, {
|
|
90
|
+
port: WALLET_PORT
|
|
91
|
+
});
|
|
92
|
+
logger.info(`Wallet JSON-RPC server listening on port ${walletHttpServer.port}`);
|
|
93
|
+
const shutdown = async ()=>{
|
|
94
|
+
logger.info('Shutting down...');
|
|
95
|
+
nodeHttpServer.close();
|
|
96
|
+
walletHttpServer.close();
|
|
97
|
+
await wallet.stop();
|
|
98
|
+
await stopNetwork();
|
|
99
|
+
process.exit(0);
|
|
100
|
+
};
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
102
|
+
process.once('SIGINT', shutdown);
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
104
|
+
process.once('SIGTERM', shutdown);
|
|
105
|
+
}
|
|
106
|
+
main().catch((err)=>{
|
|
107
|
+
logger.error('Wallet service failed to start', err);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare function cacheRoot(version: any): string;
|
|
3
|
+
declare function installLegacyContracts(version: any): void;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
installLegacyContracts: typeof installLegacyContracts;
|
|
6
|
+
REDIRECTED: string[];
|
|
7
|
+
cacheRoot: typeof cacheRoot;
|
|
8
|
+
};
|
|
9
|
+
export = _default;
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5zdGFsbF9sZWdhY3lfY29udHJhY3RzLmQuY3RzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2luc3RhbGxfbGVnYWN5X2NvbnRyYWN0cy5janMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQW9CQSxpQkFBUyxTQUFTLENBQUMsT0FBTyxLQUFBLFVBRXpCO0FBTUQsaUJBQVMsc0JBQXNCLENBQUMsT0FBTyxLQUFBLFFBd0N0Qzs7Ozs7O0FBRUQsa0JBQWtFIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install_legacy_contracts.d.cts","sourceRoot":"","sources":["../src/install_legacy_contracts.cjs"],"names":[],"mappings":";AAoBA,iBAAS,SAAS,CAAC,OAAO,KAAA,UAEzB;AAMD,iBAAS,sBAAsB,CAAC,OAAO,KAAA,QAwCtC;;;;;;AAED,kBAAkE"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: (request: any, options: any) => any;
|
|
2
|
+
export = _default;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGVnYWN5LWplc3QtcmVzb2x2ZXIuZC5jdHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvbGVnYWN5LWplc3QtcmVzb2x2ZXIuY2pzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFrRkEsa0JBNkJDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-jest-resolver.d.cts","sourceRoot":"","sources":["../src/legacy-jest-resolver.cjs"],"names":[],"mappings":";AAkFA,kBA6BC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { Archiver } from '@aztec/archiver';
|
|
2
|
+
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
5
|
+
import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
|
|
6
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
7
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
8
|
+
import { isL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
9
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
10
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
11
|
+
import { waitUntilL1Timestamp } from '@aztec/ethereum/l1-tx-utils';
|
|
12
|
+
import { asyncMap } from '@aztec/foundation/async-map';
|
|
13
|
+
import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
14
|
+
import { timesAsync } from '@aztec/foundation/collection';
|
|
15
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
16
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
17
|
+
import { executeTimeout } from '@aztec/foundation/timer';
|
|
18
|
+
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
19
|
+
import type { SequencerEvents } from '@aztec/sequencer-client';
|
|
20
|
+
import { getSlotAtTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
21
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
22
|
+
import { TxStatus } from '@aztec/stdlib/tx';
|
|
23
|
+
import { jest } from '@jest/globals';
|
|
24
|
+
import { sendL1ToL2Message } from '../../fixtures/l1_to_l2_messaging.js';
|
|
25
|
+
import type { EndToEndContext } from '../../fixtures/utils.js';
|
|
26
|
+
import { waitForBlockNumber, waitForTxs } from '../../fixtures/wait_helpers.js';
|
|
27
|
+
import type { TestWallet } from '../../test-wallet/test_wallet.js';
|
|
28
|
+
import { proveInteraction } from '../../test-wallet/utils.js';
|
|
29
|
+
import { type BlockProposedEvent, MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING, MultiNodeTestContext, type MultiNodeTestOpts, type RegisteredValidator, type TrackedSequencerEvent, WIDE_SLOT_TIMING, buildMockGossipValidators } from '../multi_node_test_context.js';
|
|
30
|
+
export declare const NODE_COUNT = 4;
|
|
31
|
+
export declare const TX_COUNT = 10;
|
|
32
|
+
/** The validator cluster + context produced by {@link setupSimpleBlockProduction}. */
|
|
33
|
+
export type SimpleBlockProductionFixture = {
|
|
34
|
+
test: MultiNodeTestContext;
|
|
35
|
+
context: EndToEndContext;
|
|
36
|
+
logger: Logger;
|
|
37
|
+
validators: RegisteredValidator[];
|
|
38
|
+
nodes: AztecNodeService[];
|
|
39
|
+
from: AztecAddress;
|
|
40
|
+
};
|
|
41
|
+
/** State shared by the wide-slot `it`s (handles 4 validators + prover + a wallet pointed at node 0). */
|
|
42
|
+
export type BlockProductionWithProverFixture = {
|
|
43
|
+
test: MultiNodeTestContext;
|
|
44
|
+
context: EndToEndContext;
|
|
45
|
+
logger: Logger;
|
|
46
|
+
rollup: RollupContract;
|
|
47
|
+
archiver: Archiver;
|
|
48
|
+
validators: RegisteredValidator[];
|
|
49
|
+
nodes: AztecNodeService[];
|
|
50
|
+
contract: TestContract;
|
|
51
|
+
wallet: TestWallet;
|
|
52
|
+
from: AztecAddress;
|
|
53
|
+
failEvents: TrackedSequencerEvent[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Stands up the `block-production` validator cluster shared by the `MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING` tests
|
|
57
|
+
* (`simple`, `high_tps`): builds `nodeCount` mock-gossip validators, sets up the context with the
|
|
58
|
+
* block-production timing profile, spawns one validator node per validator, and returns the cluster. The
|
|
59
|
+
* per-test divergence (`fakeProcessingDelayPerTxMs`, `txDelayerMaxInclusionTimeIntoSlot`,
|
|
60
|
+
* min/maxTxsPerBlock, whether sequencers start eagerly, contract type) passes through `opts`. Mirrors
|
|
61
|
+
* how {@link setupBlockProductionWithProver} factors out the prover-backed setup; the test still registers its own contract.
|
|
62
|
+
*/
|
|
63
|
+
export declare function setupSimpleBlockProduction(opts: {
|
|
64
|
+
nodeCount: number;
|
|
65
|
+
setupOpts?: Partial<MultiNodeTestOpts>;
|
|
66
|
+
nodeOpts?: Partial<AztecNodeConfig> & {
|
|
67
|
+
dontStartSequencer?: boolean;
|
|
68
|
+
};
|
|
69
|
+
}): Promise<SimpleBlockProductionFixture>;
|
|
70
|
+
/**
|
|
71
|
+
* Creates validators and sets up a wide-slot test context with the pipelining timing profile and a prover
|
|
72
|
+
* node, then starts (paused) validator nodes and points the wallet at node 0. Mirrors the per-test
|
|
73
|
+
* setup from the dissolved `mbps.parallel` file. The blob-promotion and pipeline-prune suites layer their
|
|
74
|
+
* adverse-network shape on via `mockGossipSubNetworkLatency`, `maxTxsPerCheckpoint`, `clearInheritedCoinbase`,
|
|
75
|
+
* and `disableCheckpointPromotionOnFirstNode`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function setupBlockProductionWithProver(opts: {
|
|
78
|
+
syncChainTip: 'proposed' | 'checkpointed';
|
|
79
|
+
minTxsPerBlock?: number;
|
|
80
|
+
maxTxsPerBlock?: number;
|
|
81
|
+
maxTxsPerCheckpoint?: number;
|
|
82
|
+
buildCheckpointIfEmpty?: boolean;
|
|
83
|
+
skipPushProposedBlocksToArchiver?: boolean;
|
|
84
|
+
/** Injects artificial mock-gossip propagation latency (ms) to model adverse network conditions. */
|
|
85
|
+
mockGossipSubNetworkLatency?: number;
|
|
86
|
+
/** Clears each validator node's inherited coinbase so it derives one from its own attester key. */
|
|
87
|
+
clearInheritedCoinbase?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Disables checkpoint promotion on node 0 (`skipPromoteProposedCheckpointDuringL1Sync`), so node 0 fetches
|
|
90
|
+
* blobs during L1 sync while its peers promote their own proposed checkpoints and skip the blob fetch.
|
|
91
|
+
*/
|
|
92
|
+
disableCheckpointPromotionOnFirstNode?: boolean;
|
|
93
|
+
}): Promise<BlockProductionWithProverFixture>;
|
|
94
|
+
/** Waits until a specific multi-block checkpoint is proven, verifying that proving succeeds with multiple-blocks-per-slot. */
|
|
95
|
+
export declare function waitForProvenCheckpoint(fixture: BlockProductionWithProverFixture, targetCheckpoint: CheckpointNumber): Promise<void>;
|
|
96
|
+
export { type Archiver, type AztecNodeConfig, type AztecNodeService, AztecAddress, EthAddress, NO_WAIT, generateClaimSecret, Fr, type Logger, isL1ToL2MessageReady, waitForTx, RollupContract, waitUntilL1Timestamp, asyncMap, BlockNumber, CheckpointNumber, SlotNumber, timesAsync, retryUntil, sleep, executeTimeout, TestContract, type SequencerEvents, getSlotAtTimestamp, getTimestampForSlot, GasFees, TxStatus, jest, sendL1ToL2Message, type EndToEndContext, waitForBlockNumber, waitForTxs, type TestWallet, proveInteraction, type BlockProposedEvent, WIDE_SLOT_TIMING, MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING, MultiNodeTestContext, type RegisteredValidator, type TrackedSequencerEvent, buildMockGossipValidators, };
|
|
97
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0dXAuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3N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B,CAAC,EAAE,OAAO,CAAC;IACjC,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,mGAAmG;IACnG,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,mGAAmG;IACnG,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,qCAAqC,CAAC,EAAE,OAAO,CAAC;CACjD,GAAG,OAAO,CAAC,gCAAgC,CAAC,CA8C5C;AAED,8HAA8H;AAC9H,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,gCAAgC,EACzC,gBAAgB,EAAE,gBAAgB,iBAuBnC;AAED,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,YAAY,EACZ,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,EAAE,EACF,KAAK,MAAM,EACX,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,UAAU,EACV,KAAK,EACL,cAAc,EACd,YAAY,EACZ,KAAK,eAAe,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,iBAAiB,EACjB,KAAK,eAAe,EACpB,kBAAkB,EAClB,UAAU,EACV,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,gBAAgB,EAChB,uCAAuC,EACvC,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,yBAAyB,GAC1B,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
|
|
4
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
+
import { isL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
6
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
7
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
8
|
+
import { waitUntilL1Timestamp } from '@aztec/ethereum/l1-tx-utils';
|
|
9
|
+
import { asyncMap } from '@aztec/foundation/async-map';
|
|
10
|
+
import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
11
|
+
import { timesAsync } from '@aztec/foundation/collection';
|
|
12
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
13
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
14
|
+
import { executeTimeout } from '@aztec/foundation/timer';
|
|
15
|
+
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
16
|
+
import { getSlotAtTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
17
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
18
|
+
import { TxStatus } from '@aztec/stdlib/tx';
|
|
19
|
+
import { jest } from '@jest/globals';
|
|
20
|
+
import { sendL1ToL2Message } from '../../fixtures/l1_to_l2_messaging.js';
|
|
21
|
+
import { testSpan } from '../../fixtures/timing.js';
|
|
22
|
+
import { waitForBlockNumber, waitForTxs } from '../../fixtures/wait_helpers.js';
|
|
23
|
+
import { proveInteraction } from '../../test-wallet/utils.js';
|
|
24
|
+
import { MOCK_GOSSIP_MULTI_VALIDATOR_OPTS, MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING, MultiNodeTestContext, WIDE_SLOT_TIMING, buildMockGossipValidators } from '../multi_node_test_context.js';
|
|
25
|
+
jest.setTimeout(1000 * 60 * 20);
|
|
26
|
+
export const NODE_COUNT = 4;
|
|
27
|
+
// Send enough transactions to trigger multiple blocks within a checkpoint assuming 2 txs per block.
|
|
28
|
+
// If we start including txs at the 2nd block of a checkpoint, we can ensure a 3-block checkpoint
|
|
29
|
+
// if we produce 10 txs:
|
|
30
|
+
// - Checkpoint 1: Block 1 (0 txs), Block 2 (2 txs), Block 3 (2 txs)
|
|
31
|
+
// - Checkpoint 2: Block 1 (2 txs), Block 2 (2 txs), Block 3 (2 txs)
|
|
32
|
+
export const TX_COUNT = 10;
|
|
33
|
+
/** Shared spine: builds N mock-gossip validators, sets up the context, spawns one node per validator. */ async function buildValidatorCluster(opts) {
|
|
34
|
+
const validators = buildMockGossipValidators(opts.nodeCount);
|
|
35
|
+
const test = await MultiNodeTestContext.setup({
|
|
36
|
+
...opts.setupOpts,
|
|
37
|
+
initialValidators: validators
|
|
38
|
+
});
|
|
39
|
+
const { context, logger } = test;
|
|
40
|
+
const from = context.accounts[0];
|
|
41
|
+
logger.warn(`Initial setup complete. Starting ${opts.nodeCount} validator nodes.`);
|
|
42
|
+
const nodes = await asyncMap(validators, ({ privateKey }, i)=>test.createValidatorNode([
|
|
43
|
+
privateKey
|
|
44
|
+
], typeof opts.nodeOpts === 'function' ? opts.nodeOpts(i) : {
|
|
45
|
+
...opts.nodeOpts
|
|
46
|
+
}));
|
|
47
|
+
logger.warn(`Started ${opts.nodeCount} validator nodes.`, {
|
|
48
|
+
validators: validators.map((v)=>v.attester.toString())
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
test,
|
|
52
|
+
context,
|
|
53
|
+
logger,
|
|
54
|
+
validators,
|
|
55
|
+
nodes,
|
|
56
|
+
from
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Stands up the `block-production` validator cluster shared by the `MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING` tests
|
|
61
|
+
* (`simple`, `high_tps`): builds `nodeCount` mock-gossip validators, sets up the context with the
|
|
62
|
+
* block-production timing profile, spawns one validator node per validator, and returns the cluster. The
|
|
63
|
+
* per-test divergence (`fakeProcessingDelayPerTxMs`, `txDelayerMaxInclusionTimeIntoSlot`,
|
|
64
|
+
* min/maxTxsPerBlock, whether sequencers start eagerly, contract type) passes through `opts`. Mirrors
|
|
65
|
+
* how {@link setupBlockProductionWithProver} factors out the prover-backed setup; the test still registers its own contract.
|
|
66
|
+
*/ export function setupSimpleBlockProduction(opts) {
|
|
67
|
+
return buildValidatorCluster({
|
|
68
|
+
nodeCount: opts.nodeCount,
|
|
69
|
+
setupOpts: {
|
|
70
|
+
...MOCK_GOSSIP_MULTI_VALIDATOR_OPTS,
|
|
71
|
+
...MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING,
|
|
72
|
+
...opts.setupOpts
|
|
73
|
+
},
|
|
74
|
+
nodeOpts: opts.nodeOpts
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Creates validators and sets up a wide-slot test context with the pipelining timing profile and a prover
|
|
79
|
+
* node, then starts (paused) validator nodes and points the wallet at node 0. Mirrors the per-test
|
|
80
|
+
* setup from the dissolved `mbps.parallel` file. The blob-promotion and pipeline-prune suites layer their
|
|
81
|
+
* adverse-network shape on via `mockGossipSubNetworkLatency`, `maxTxsPerCheckpoint`, `clearInheritedCoinbase`,
|
|
82
|
+
* and `disableCheckpointPromotionOnFirstNode`.
|
|
83
|
+
*/ export async function setupBlockProductionWithProver(opts) {
|
|
84
|
+
const { syncChainTip = 'checkpointed', clearInheritedCoinbase = false, disableCheckpointPromotionOnFirstNode = false, ...setupOpts } = opts;
|
|
85
|
+
// WIDE_SLOT_TIMING is the wide 72s/12s pipelining cadence (see A-914 on why the tighter 36s/4s breaks
|
|
86
|
+
// non-proposer nodes); the JSDoc on the profile carries the full rationale.
|
|
87
|
+
const { test, context, logger, validators, nodes, from } = await buildValidatorCluster({
|
|
88
|
+
nodeCount: NODE_COUNT,
|
|
89
|
+
setupOpts: {
|
|
90
|
+
...WIDE_SLOT_TIMING,
|
|
91
|
+
numberOfAccounts: 0,
|
|
92
|
+
mockGossipSubNetwork: true,
|
|
93
|
+
startProverNode: true,
|
|
94
|
+
...setupOpts,
|
|
95
|
+
pxeOpts: {
|
|
96
|
+
syncChainTip
|
|
97
|
+
},
|
|
98
|
+
skipInitialSequencer: true,
|
|
99
|
+
inboxLag: 2
|
|
100
|
+
},
|
|
101
|
+
nodeOpts: (index)=>({
|
|
102
|
+
dontStartSequencer: true,
|
|
103
|
+
...clearInheritedCoinbase ? {
|
|
104
|
+
coinbase: undefined
|
|
105
|
+
} : {},
|
|
106
|
+
...disableCheckpointPromotionOnFirstNode && index === 0 ? {
|
|
107
|
+
skipPromoteProposedCheckpointDuringL1Sync: true
|
|
108
|
+
} : {}
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
const { rollup } = test;
|
|
112
|
+
const wallet = context.wallet;
|
|
113
|
+
const { failEvents } = test.watchNodeSequencerEvents(nodes);
|
|
114
|
+
// Point the wallet at a validator node. The initial node-0 has all validator keys in its config,
|
|
115
|
+
// so it rejects block proposals from validators thinking they come from itself. By redirecting
|
|
116
|
+
// the wallet to a validator node, the PXE correctly tracks proposed blocks.
|
|
117
|
+
wallet.updateNode(nodes[0]);
|
|
118
|
+
const archiver = nodes[0].getBlockSource();
|
|
119
|
+
// Register contract for sending txs.
|
|
120
|
+
const contract = await test.registerTestContract(wallet);
|
|
121
|
+
logger.warn(`Test setup completed.`, {
|
|
122
|
+
validators: validators.map((v)=>v.attester.toString())
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
test,
|
|
126
|
+
context,
|
|
127
|
+
logger,
|
|
128
|
+
rollup,
|
|
129
|
+
archiver,
|
|
130
|
+
validators,
|
|
131
|
+
nodes,
|
|
132
|
+
contract,
|
|
133
|
+
wallet,
|
|
134
|
+
from,
|
|
135
|
+
failEvents
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** Waits until a specific multi-block checkpoint is proven, verifying that proving succeeds with multiple-blocks-per-slot. */ export async function waitForProvenCheckpoint(fixture, targetCheckpoint) {
|
|
139
|
+
const { test, nodes, logger, failEvents } = fixture;
|
|
140
|
+
test.assertNoFailuresFromSequencers(failEvents);
|
|
141
|
+
logger.warn(`Stopping validator sequencers before waiting for checkpoint ${targetCheckpoint} to be proven`);
|
|
142
|
+
await Promise.all(nodes.map((n)=>n.getSequencer()?.stop()));
|
|
143
|
+
// With the sequencers stopped, no further blocks are produced, so waiting out the rest of the epoch in
|
|
144
|
+
// wall-clock is dead time. Warp the L1 clock forward past the epoch boundary so the epoch containing
|
|
145
|
+
// targetCheckpoint closes and the fake prover can prove+submit it; the subsequent wait then only covers
|
|
146
|
+
// the (real-time) proving+submission. A single next-epoch jump stays inside the proof-submission window
|
|
147
|
+
// (proofSubmissionEpochs >= 1), so it never crosses the submission deadline. Skipped if already proven,
|
|
148
|
+
// and forward-only since advanceToNextEpoch never rewinds.
|
|
149
|
+
const { proven } = await test.context.cheatCodes.rollup.getTips();
|
|
150
|
+
if (proven < targetCheckpoint) {
|
|
151
|
+
await testSpan('warp:proven-checkpoint-epoch', ()=>test.context.cheatCodes.rollup.advanceToNextEpoch());
|
|
152
|
+
}
|
|
153
|
+
const provenTimeout = test.L2_SLOT_DURATION_IN_S * test.epochDuration * 4;
|
|
154
|
+
logger.warn(`Waiting for checkpoint ${targetCheckpoint} to be proven (timeout=${provenTimeout}s)`);
|
|
155
|
+
await test.waitUntilProvenCheckpointNumber(targetCheckpoint, provenTimeout);
|
|
156
|
+
logger.warn(`Proven checkpoint advanced to ${test.monitor.provenCheckpointNumber}`);
|
|
157
|
+
}
|
|
158
|
+
export { AztecAddress, EthAddress, NO_WAIT, generateClaimSecret, Fr, isL1ToL2MessageReady, waitForTx, RollupContract, waitUntilL1Timestamp, asyncMap, BlockNumber, CheckpointNumber, SlotNumber, timesAsync, retryUntil, sleep, executeTimeout, TestContract, getSlotAtTimestamp, getTimestampForSlot, GasFees, TxStatus, jest, sendL1ToL2Message, waitForBlockNumber, waitForTxs, proveInteraction, WIDE_SLOT_TIMING, MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING, MultiNodeTestContext, buildMockGossipValidators };
|