@aztec/end-to-end 0.0.1-commit.b6e433891 → 0.0.1-commit.b8a057fa
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/onchain_delivery_harness.d.ts +17 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +123 -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 +53 -52
- 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 +15 -11
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +55 -40
- package/dest/fixtures/fixtures.d.ts +78 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +78 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +4 -4
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +5 -2
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +71 -41
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +283 -201
- 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 +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 +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 +25 -13
- 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 +83 -49
- 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 +38 -9
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +186 -77
- 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 +10 -2
- package/dest/test-wallet/worker_wallet.d.ts +7 -6
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +6 -2
- 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 +14 -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/onchain_delivery_harness.ts +177 -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 +103 -73
- 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 +66 -63
- package/src/fixtures/fixtures.ts +98 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +11 -5
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +342 -258
- package/src/fixtures/setup_p2p_test.ts +15 -11
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +40 -8
- package/src/fixtures/utils.ts +2 -3
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +106 -0
- package/src/guides/up_quick_start.sh +5 -2
- package/src/infra/README.md +12 -0
- package/src/install_legacy_contracts.cjs +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 +29 -13
- 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 +79 -44
- package/src/spartan/tx_metrics.ts +107 -23
- package/src/spartan/utils/nodes.ts +2 -2
- package/src/test-wallet/test_wallet.ts +213 -78
- package/src/test-wallet/utils.ts +104 -11
- package/src/test-wallet/wallet_worker_script.ts +8 -2
- package/src/test-wallet/worker_wallet.ts +12 -11
- 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
package/README.md
CHANGED
|
@@ -1,26 +1,229 @@
|
|
|
1
|
-
# End
|
|
1
|
+
# End-to-end tests
|
|
2
2
|
|
|
3
|
-
This package
|
|
4
|
-
|
|
3
|
+
This package holds Aztec's end-to-end (e2e) tests: full-stack scenarios that spin up an Aztec node (or
|
|
4
|
+
several), a PXE, and an L1 (anvil) and exercise the system the way a real deployment would. It is the
|
|
5
|
+
integration layer above the per-package unit tests.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
> **Two audiences.** The top of this document is a quick orientation for humans. The
|
|
8
|
+
> [Reference for agents](#reference-for-agents) section at the bottom is the detailed, exhaustive
|
|
9
|
+
> version — read that when you are placing, moving, or wiring up a test.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
## Quick start
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
Run a single test (spawns its own in-process anvil):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn test:e2e src/automine/token/access_control.parallel.test.ts
|
|
17
|
+
yarn test:e2e src/single-node/block-building/block_building.test.ts -t 'rejects double spend'
|
|
14
18
|
```
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
Turn up logging with `LOG_LEVEL` (`verbose` is the useful default; `debug:sequencer,archiver` scopes it):
|
|
17
21
|
|
|
22
|
+
```bash
|
|
23
|
+
LOG_LEVEL=verbose yarn test:e2e src/single-node/proving/empty_blocks.test.ts
|
|
18
24
|
```
|
|
19
|
-
|
|
25
|
+
|
|
26
|
+
Compose-based tests (those under `src/composed/`) need a running local network — see
|
|
27
|
+
[Compose / HA / web3signer tests](#compose--ha--web3signer-tests).
|
|
28
|
+
|
|
29
|
+
## Test categories
|
|
30
|
+
|
|
31
|
+
Tests are grouped by **node topology** — the shape of the network a test needs. The top-level folder is
|
|
32
|
+
the category; the second level names the behavior under test. Each category owns a base class that builds
|
|
33
|
+
its environment, so a test file only describes the scenario, not the wiring.
|
|
34
|
+
|
|
35
|
+
| Category | Topology | A test belongs here when… | README |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| [`automine/`](src/automine/README.md) | One node, deterministic `AutomineSequencer` — one block per tx, no committee/prover/validator. Fast. | it exercises contract or protocol behavior that doesn't depend on real block-building or consensus (transfers, nested calls, note discovery, tx semantics). | yes |
|
|
38
|
+
| [`single-node/`](src/single-node/README.md) | One node, production sequencer (interval block production), optional prover. | it asserts on sequencer, proving, partial-proof, L1-reorg, recovery, fee, or cross-chain behavior on a single sequencer. | yes |
|
|
39
|
+
| [`multi-node/`](src/multi-node/README.md) | N validators on an in-memory mock-gossip bus. | it needs a committee: consensus, attestations, slashing, governance, or multi-validator block production. | yes |
|
|
40
|
+
| `p2p/` | Real libp2p transport between nodes. | the networking transport itself is under test (gossip, rediscovery, req/resp). | — |
|
|
41
|
+
| [`infra/`](src/infra/README.md) | Targets a deployed/external network (local anvil or a public testnet). | its concern is deployment or network targeting, not a specific protocol behavior. | yes |
|
|
42
|
+
|
|
43
|
+
A handful of tests live **outside** this package, next to the code they test — see
|
|
44
|
+
[Tests that live elsewhere](#tests-that-live-elsewhere). Other non-category test groups (`composed/`,
|
|
45
|
+
`guides/`, `bench/`) are described in the reference section.
|
|
46
|
+
|
|
47
|
+
## Where does my test go?
|
|
48
|
+
|
|
49
|
+
1. **Does it need real networking transport?** → `p2p/`.
|
|
50
|
+
2. **Does it need a validator committee (consensus/slashing/governance)?** → `multi-node/`.
|
|
51
|
+
3. **Does it assert on the production sequencer, proving, reorgs, fees, or cross-chain flows?** →
|
|
52
|
+
`single-node/`.
|
|
53
|
+
4. **Is it pure contract/protocol behavior that's happy with one-block-per-tx?** → `automine/` (the
|
|
54
|
+
default home for most contract tests).
|
|
55
|
+
5. **Is it really a unit/integration test of one package with no Aztec node?** → it probably belongs in
|
|
56
|
+
that package, not here (see [Tests that live elsewhere](#tests-that-live-elsewhere)).
|
|
57
|
+
|
|
58
|
+
When in doubt, prefer `automine/` for contract behavior and `single-node/` for anything that watches the
|
|
59
|
+
chain advance.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Reference for agents
|
|
64
|
+
|
|
65
|
+
This section is the detailed contract for adding, moving, and wiring tests. It assumes you've read the
|
|
66
|
+
overview above.
|
|
67
|
+
|
|
68
|
+
### Category base classes
|
|
69
|
+
|
|
70
|
+
Each category centralizes its environment in a base class. The hierarchy:
|
|
71
|
+
|
|
72
|
+
- `single-node/single_node_test_context.ts` → **`SingleNodeTestContext`**. Owns the environment
|
|
73
|
+
(in-process anvil + L1 deploy), node spawning (`createNonValidatorNode`, `createProverNode`), the
|
|
74
|
+
`ChainMonitor`, and the epoch/checkpoint/proof-window/reorg waiters.
|
|
75
|
+
- `multi-node/multi_node_test_context.ts` → **`MultiNodeTestContext extends SingleNodeTestContext`**.
|
|
76
|
+
Adds the N-validator topology over a mock-gossip bus, inheriting the base environment and waiters.
|
|
77
|
+
- `automine/automine_test_context.ts` → **`AutomineTestContext`**. A sibling of `SingleNodeTestContext`
|
|
78
|
+
(both wrap `fixtures/setup.ts:setup()`), but fixes the automine topology and makes `AUTOMINE_E2E_OPTS`
|
|
79
|
+
the default. Exposes `markProvenAndWarp`, `registerContract`, `applyManualParentChild`.
|
|
80
|
+
- `p2p/p2p_network.ts` → **`P2PNetworkTest`**. Real libp2p; node creation goes through
|
|
81
|
+
`setup_p2p_test.ts`.
|
|
82
|
+
- `infra/` has no shared base — its tests target a network selected by `L1_CHAIN_ID` (local anvil in CI,
|
|
83
|
+
a public testnet with credentials).
|
|
84
|
+
|
|
85
|
+
All of the above ultimately wrap `fixtures/setup.ts:setup(numberOfAccounts, opts)`, the single entry point
|
|
86
|
+
that deploys L1 contracts, starts the node(s), and provisions a PXE and accounts.
|
|
87
|
+
|
|
88
|
+
### Setup factories
|
|
89
|
+
|
|
90
|
+
Categories expose thin factories over their base's static `setup`, named by what the test wants, so a test
|
|
91
|
+
calls the factory instead of spreading option presets:
|
|
92
|
+
|
|
93
|
+
- `single-node/setup.ts`: `setupWithProver` (fake in-process prover — the single-node default) and
|
|
94
|
+
`setupBlockProducer` (no prover; raises `aztecProofSubmissionEpochs` to `1024` so unproven blocks
|
|
95
|
+
aren't pruned, and points the PXE at `syncChainTip: 'proposed'`).
|
|
96
|
+
- `automine` tests call `AutomineTestContext.setup({ numberOfAccounts })` directly.
|
|
97
|
+
|
|
98
|
+
### The harness pattern (domain setup on top of a category)
|
|
99
|
+
|
|
100
|
+
A test suite with bespoke domain setup does **not** fork `setup()`. It subclasses the category base and
|
|
101
|
+
overrides a `protected hydrateFromContext(context)` split out of `setup`, so it reuses the base's
|
|
102
|
+
rollup/epoch-cache/chain-monitor/waiter/teardown machinery while adding its own domain state. Examples:
|
|
103
|
+
|
|
104
|
+
- `single-node/prover/` → `FullProverTest` (real Barretenberg env) extends `SingleNodeTestContext`.
|
|
105
|
+
- `single-node/fees/` → `FeesTest`; `single-node/cross-chain/` → `CrossChainMessagingTest`.
|
|
106
|
+
- `automine/token/` → `TokenContractTest` and `BlacklistTokenContractTest` extend `AutomineTestContext`
|
|
107
|
+
and run their `TokenSimulator`/snapshot setup after `super.setup()`.
|
|
108
|
+
|
|
109
|
+
When two suites share behavior: if their public APIs are nearly identical, use inheritance; if behavior
|
|
110
|
+
overlaps but APIs differ, compose. Don't duplicate a category's environment wiring.
|
|
111
|
+
|
|
112
|
+
### The `.parallel` suffix
|
|
113
|
+
|
|
114
|
+
CI splits each `it` in a `.parallel.test.ts` file into its own docker job, running it in isolation via
|
|
115
|
+
`jest --testNamePattern` (the names come from `extract_test_names` in `bootstrap.sh`, which matches
|
|
116
|
+
`it`/`test` at **any** nesting depth, not just top level). When an `it` runs alone its enclosing
|
|
117
|
+
`beforeAll`/`beforeEach` hooks still run, but sibling `it`s do not. Rules:
|
|
118
|
+
|
|
119
|
+
- The `.parallel` suffix is for files whose `it`s are **independent**: every `it` must pass when run
|
|
120
|
+
entirely on its own. That holds only when all shared state is built in `beforeAll`/`beforeEach` and no
|
|
121
|
+
`it` reads or asserts on state produced by a sibling `it`.
|
|
122
|
+
- A file with sequential or stateful `it`s (progressive mutation across `it`s, a describe-scope variable
|
|
123
|
+
assigned in one `it` and read in another, a note/token created in an earlier `it` and used later) stays
|
|
124
|
+
a plain `.test.ts` **even if it has many top-level `it`s** — it runs as one ordered job. Adding
|
|
125
|
+
`.parallel` to such a file breaks CI, because each `it` then runs without its predecessors.
|
|
126
|
+
- A file with a single top-level `it` is a plain `.test.ts`.
|
|
127
|
+
- `it`/`test` names in a `.parallel` file must avoid regex/shell-special characters —
|
|
128
|
+
`"` `(` `)` `[` `]` `{` `}` `$` `\` and backtick. The split passes each name to
|
|
129
|
+
`run_test.sh ... "<name>"` as a shell-quoted `--testNamePattern` regex: an embedded `"` closes the
|
|
130
|
+
quote early and hard-fails the job, while regex metacharacters (`(` `)` `[` `]` `+` `*` `?` `|` `{` `}`)
|
|
131
|
+
silently match zero tests so the shard runs nothing and passes green — a coverage gap that hides the
|
|
132
|
+
test. Plain `.test.ts` files run as one job and are unaffected, so any name is fine there.
|
|
133
|
+
(`.` `!` `#` `-` `:` `,` are safe in `.parallel` names.)
|
|
134
|
+
- Each file has exactly one top-level `describe`, named to match its path
|
|
135
|
+
(e.g. `describe('automine/token/transfer', …)`).
|
|
136
|
+
|
|
137
|
+
### CI test discovery — `bootstrap.sh`
|
|
138
|
+
|
|
139
|
+
`end-to-end/bootstrap.sh` enumerates tests in two arrays, and a test must appear in the relevant one or it
|
|
140
|
+
**won't run in CI**:
|
|
141
|
+
|
|
142
|
+
- `test_cmds` (~line 37) — the standard run.
|
|
143
|
+
- `compat_test_cmds` (~line 290) — the forward/legacy-compat run (a subset).
|
|
144
|
+
|
|
145
|
+
Each leaf folder needs its own single-level glob line (e.g. `src/automine/token/*.test.ts`) in each array;
|
|
146
|
+
globs are not recursive, so every sub-folder is listed explicitly. Folders that organize by behavior get
|
|
147
|
+
one line per leaf. Bespoke handling to be aware of:
|
|
148
|
+
|
|
149
|
+
- **`avm_simulator`** (`automine/simulation/avm_simulator.test.ts`) has a dedicated line in `test_cmds`
|
|
150
|
+
that sets `DUMP_AVM_INPUTS_TO_DIR` (feeds the downstream `avm_check_circuit` job) and is therefore
|
|
151
|
+
excluded from the generic `simulation/` glob there (`!(avm_simulator)`). In `compat_test_cmds` it runs
|
|
152
|
+
as a regular test (no dump line), so it is **not** excluded there.
|
|
153
|
+
- **`kernelless_simulation`** is excluded from `compat_test_cmds` only.
|
|
154
|
+
|
|
155
|
+
After editing the arrays, confirm every `*.test.ts` resolves through exactly one line (no duplicate, no
|
|
156
|
+
omission). Per-test bash `TIMEOUT` overrides live in the `case` block in `test_cmds` and must stay in sync
|
|
157
|
+
with the test's `jest.setTimeout`.
|
|
158
|
+
|
|
159
|
+
### Flaky tests — `.test_patterns.yml`
|
|
160
|
+
|
|
161
|
+
Flaky/owner entries live in `.test_patterns.yml` at the **git root** (not in this package), keyed on the
|
|
162
|
+
test path. A bare entry flags the test as flaky whenever it fails; add `error_regex` to flag only on a
|
|
163
|
+
matching message; `skip: true` disables it. Blanket regex entries (e.g. `src/automine/.*\.test\.ts`) are
|
|
164
|
+
depth-agnostic and survive folder renames; path-specific entries must be updated when a file moves.
|
|
165
|
+
|
|
166
|
+
### Compose / HA / web3signer tests
|
|
167
|
+
|
|
168
|
+
`src/composed/` tests run against a **running local network** rather than an in-process stack, via
|
|
169
|
+
`scripts/run_test.sh` in different modes:
|
|
170
|
+
|
|
171
|
+
- `src/composed/*.test.ts` → `compose` mode (e.g. `e2e_persistence`, `uniswap_trade_on_l1_from_l2`,
|
|
172
|
+
`e2e_cheat_codes` — the compose variant, distinct from the relocated unit-style one).
|
|
173
|
+
- `src/composed/web3signer/*.test.ts` → `web3signer` mode (remote-signer scenarios).
|
|
174
|
+
- `src/composed/ha/*.test.ts` → `ha` mode (high-availability multi-process scenarios).
|
|
175
|
+
- `src/guides/*.test.ts` → tutorial/guide flows; `src/bench/` → benchmarks (see `bench_cmds`).
|
|
176
|
+
|
|
177
|
+
Run one compose test locally with `yarn test:compose <name>` (anvil + the test runner are spawned for
|
|
178
|
+
you), or `docker-compose up` for separate containers.
|
|
179
|
+
|
|
180
|
+
### Tests that live elsewhere
|
|
181
|
+
|
|
182
|
+
Tests with **no Aztec node** that exercise one package belong in that package, not here:
|
|
183
|
+
|
|
184
|
+
- L1 cheat-code behavior (`EthCheatCodes`/`RollupCheatCodes` against raw anvil) → `@aztec/ethereum`
|
|
185
|
+
(`ethereum/src/test/eth_cheat_codes.test.ts`).
|
|
186
|
+
- The `SequencerPublisher` integration test (anvil + L1 deploy, no node) → `@aztec/sequencer-client`
|
|
187
|
+
(`sequencer-client/src/publisher/`).
|
|
188
|
+
|
|
189
|
+
These run in their own package's test lane (both packages already run anvil-backed integration tests).
|
|
190
|
+
|
|
191
|
+
### Support directories (not test categories)
|
|
192
|
+
|
|
193
|
+
- `fixtures/` — the shared `setup()`, option presets (`fixtures.ts`), `CrossChainTestHarness`,
|
|
194
|
+
`l1_to_l2_messaging`, and common utils.
|
|
195
|
+
- `shared/` — shared test bodies and `timing_env.mjs`, a **custom jest `testEnvironment`** referenced from
|
|
196
|
+
this package's `package.json`. `yarn prepare` / the package-json check will try to revert it to the
|
|
197
|
+
default — don't let it.
|
|
198
|
+
- `simulators/` — in-TS reference models (`TokenSimulator`, `LendingSimulator`) used to assert contract
|
|
199
|
+
behavior.
|
|
200
|
+
- `test-wallet/`, `bench/`, `spartan/`, `quality_of_service/`, `forward-compatibility/` — helpers,
|
|
201
|
+
benchmarks, and network/ops tests outside the topology categories.
|
|
202
|
+
|
|
203
|
+
### Running tests against legacy contract artifacts
|
|
204
|
+
|
|
205
|
+
To verify that contracts deployed from a previous release still work against the current stack, set
|
|
206
|
+
`CONTRACT_ARTIFACTS_VERSION` to a published version of `@aztec/noir-contracts.js` /
|
|
207
|
+
`@aztec/noir-test-contracts.js`:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
CONTRACT_ARTIFACTS_VERSION=4.1.3 yarn test:e2e src/automine/token/access_control.parallel.test.ts
|
|
20
211
|
```
|
|
21
212
|
|
|
22
|
-
|
|
213
|
+
Only the JSON artifact files (`.../artifacts/*.json`) are redirected. The TypeScript wrapper classes
|
|
214
|
+
(e.g. `TokenContract`) continue to load from the current workspace and use the current `@aztec/aztec.js` —
|
|
215
|
+
so this exercises whether a deployed contract's ABI / bytecode / notes still work through the *new* client,
|
|
216
|
+
not whether the legacy wrapper code still imports cleanly.
|
|
23
217
|
|
|
24
|
-
|
|
218
|
+
The first run downloads the pinned packages into `.legacy-contracts/<version>/node_modules/` (cached across
|
|
219
|
+
runs). A startup banner and a per-redirect line are printed to stderr so you can confirm the legacy
|
|
220
|
+
artifacts were actually loaded:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
[legacy-contracts][jest] CONTRACT_ARTIFACTS_VERSION=4.1.3
|
|
224
|
+
[legacy-contracts][jest] redirecting @aztec/noir-contracts.js/artifacts/*.json -> .legacy-contracts/4.1.3/...
|
|
225
|
+
[legacy-contracts][jest] redirected token_contract-Token.json -> /abs/.../.legacy-contracts/4.1.3/.../token_contract-Token.json
|
|
226
|
+
```
|
|
25
227
|
|
|
26
|
-
|
|
228
|
+
When `CONTRACT_ARTIFACTS_VERSION` is unset the test run is byte-identical to the default behaviour. The
|
|
229
|
+
cache is populated automatically on first use.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { type ContractBase } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
+
import type { PublicKeys } from '@aztec/aztec.js/keys';
|
|
6
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
7
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
8
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
|
+
import type { CheatCodes } from '@aztec/aztec/testing';
|
|
10
|
+
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
11
|
+
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
12
|
+
import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
|
|
13
|
+
import type { PXEConfig } from '@aztec/pxe/config';
|
|
14
|
+
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
15
|
+
import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
16
|
+
import { type EndToEndContext, type SetupOptions } from '../fixtures/setup.js';
|
|
17
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
18
|
+
export type AutomineTestOpts = Partial<SetupOptions> & {
|
|
19
|
+
/** Number of accounts to create and deploy during setup. */
|
|
20
|
+
numberOfAccounts?: number;
|
|
21
|
+
/** Options forwarded to PXE creation. */
|
|
22
|
+
pxeOpts?: Partial<PXEConfig>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Base class for the automine-sequencer test topology: a single in-process node running the
|
|
26
|
+
* deterministic {@link AUTOMINE_E2E_OPTS} preset (one block per submitted tx, synchronous L1 publish,
|
|
27
|
+
* no committee, no prover, no validator client). Owns the environment (in-proc anvil in automine mode
|
|
28
|
+
* plus the L1 deploy) and exposes the handles every automine test uses (`wallet`, `aztecNode`,
|
|
29
|
+
* `cheatCodes`, `sequencer`, `accounts`, `logger`).
|
|
30
|
+
*
|
|
31
|
+
* The sibling of {@link SingleNodeTestContext}: both wrap the same underlying `fixtures/setup.ts:setup()`
|
|
32
|
+
* but fix opposite sequencer topologies. Making {@link AUTOMINE_E2E_OPTS} the base default removes the
|
|
33
|
+
* per-test-file spread every automine test would otherwise repeat.
|
|
34
|
+
*
|
|
35
|
+
* Domain harnesses (the token simulators) compose on top by extending this base and overriding
|
|
36
|
+
* {@link setup} to run their domain steps after `super.setup()`.
|
|
37
|
+
*/
|
|
38
|
+
export declare class AutomineTestContext {
|
|
39
|
+
context: EndToEndContext;
|
|
40
|
+
logger: Logger;
|
|
41
|
+
wallet: TestWallet;
|
|
42
|
+
aztecNode: AztecNode & AztecNodeDebug;
|
|
43
|
+
aztecNodeAdmin: AztecNodeAdmin;
|
|
44
|
+
cheatCodes: CheatCodes;
|
|
45
|
+
sequencer: SequencerClient;
|
|
46
|
+
accounts: AztecAddress[];
|
|
47
|
+
defaultAccountAddress: AztecAddress;
|
|
48
|
+
parentContract: ParentContract;
|
|
49
|
+
childContract: ChildContract;
|
|
50
|
+
static setup<T extends AutomineTestContext>(this: new () => T, opts?: AutomineTestOpts): Promise<T>;
|
|
51
|
+
setup(opts?: AutomineTestOpts): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Populates the context-derived handles from an already-built {@link EndToEndContext}. Split out of
|
|
54
|
+
* {@link setup} so domain harnesses that build the environment with their own bespoke `setup(...)`
|
|
55
|
+
* opts can still reuse the shared handle wiring.
|
|
56
|
+
*/
|
|
57
|
+
protected hydrateFromContext(context: EndToEndContext): Promise<void>;
|
|
58
|
+
teardown(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Marks the current pending checkpoints as proven, then warps the L2 clock forward by `seconds`.
|
|
61
|
+
*
|
|
62
|
+
* Under {@link AUTOMINE_E2E_OPTS} a long warp crosses many epochs with no proofs being submitted, so
|
|
63
|
+
* without a prior `markAsProven()` the rollup contract's pruning window resets the chain tip to genesis
|
|
64
|
+
* and the warp's own empty-checkpoint propose fails with `Rollup__InvalidArchive`. Marking proven before
|
|
65
|
+
* warping keeps the pending chain alive. Composes the existing `cheatCodes.rollup.markAsProven` and
|
|
66
|
+
* `warpL2TimeAtLeastBy` with that required ordering.
|
|
67
|
+
*/
|
|
68
|
+
markProvenAndWarp(seconds: number | bigint): Promise<void>;
|
|
69
|
+
/** Computes and registers a contract instance in the wallet without deploying it on-chain. */
|
|
70
|
+
registerContract<T extends ContractBase>(wallet: Wallet, contractArtifact: ContractArtifactClass<T>, opts?: {
|
|
71
|
+
salt?: Fr;
|
|
72
|
+
publicKeys?: PublicKeys;
|
|
73
|
+
initArgs?: any[];
|
|
74
|
+
constructorName?: string;
|
|
75
|
+
deployer?: AztecAddress;
|
|
76
|
+
}): Promise<T>;
|
|
77
|
+
/** Deploys a Parent and a Child contract from the default account for the nested-call tests. */
|
|
78
|
+
applyManualParentChild(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
|
|
81
|
+
export type ContractArtifactClass<T extends ContractBase> = {
|
|
82
|
+
at(address: AztecAddress, wallet: Wallet): T;
|
|
83
|
+
artifact: ContractArtifact;
|
|
84
|
+
};
|
|
85
|
+
//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F,gBAAgB,CAAC,CAAC,SAAS,YAAY,EAClD,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAC1C,IAAI,GAAE;QACJ,IAAI,CAAC,EAAE,EAAE,CAAC;QACV,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,YAAY,CAAC;KACpB,GACL,OAAO,CAAC,CAAC,CAAC,CAWZ;IAED,gGAAgG;IACnF,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQnD;CACF;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;AAElG,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,YAAY,IAAI;IAC1D,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC;IAC7C,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
4
|
+
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
5
|
+
import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js';
|
|
6
|
+
import { setup, teardown } from '../fixtures/setup.js';
|
|
7
|
+
/**
|
|
8
|
+
* Base class for the automine-sequencer test topology: a single in-process node running the
|
|
9
|
+
* deterministic {@link AUTOMINE_E2E_OPTS} preset (one block per submitted tx, synchronous L1 publish,
|
|
10
|
+
* no committee, no prover, no validator client). Owns the environment (in-proc anvil in automine mode
|
|
11
|
+
* plus the L1 deploy) and exposes the handles every automine test uses (`wallet`, `aztecNode`,
|
|
12
|
+
* `cheatCodes`, `sequencer`, `accounts`, `logger`).
|
|
13
|
+
*
|
|
14
|
+
* The sibling of {@link SingleNodeTestContext}: both wrap the same underlying `fixtures/setup.ts:setup()`
|
|
15
|
+
* but fix opposite sequencer topologies. Making {@link AUTOMINE_E2E_OPTS} the base default removes the
|
|
16
|
+
* per-test-file spread every automine test would otherwise repeat.
|
|
17
|
+
*
|
|
18
|
+
* Domain harnesses (the token simulators) compose on top by extending this base and overriding
|
|
19
|
+
* {@link setup} to run their domain steps after `super.setup()`.
|
|
20
|
+
*/ export class AutomineTestContext {
|
|
21
|
+
context;
|
|
22
|
+
logger;
|
|
23
|
+
wallet;
|
|
24
|
+
aztecNode;
|
|
25
|
+
aztecNodeAdmin;
|
|
26
|
+
cheatCodes;
|
|
27
|
+
sequencer;
|
|
28
|
+
accounts;
|
|
29
|
+
defaultAccountAddress;
|
|
30
|
+
parentContract;
|
|
31
|
+
childContract;
|
|
32
|
+
static async setup(opts = {}) {
|
|
33
|
+
const test = new this();
|
|
34
|
+
await test.setup(opts);
|
|
35
|
+
return test;
|
|
36
|
+
}
|
|
37
|
+
async setup(opts = {}) {
|
|
38
|
+
const { numberOfAccounts = 1, pxeOpts, ...setupOpts } = opts;
|
|
39
|
+
const context = await setup(numberOfAccounts, {
|
|
40
|
+
...AUTOMINE_E2E_OPTS,
|
|
41
|
+
fundSponsoredFPC: true,
|
|
42
|
+
...setupOpts
|
|
43
|
+
}, pxeOpts);
|
|
44
|
+
await this.hydrateFromContext(context);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Populates the context-derived handles from an already-built {@link EndToEndContext}. Split out of
|
|
48
|
+
* {@link setup} so domain harnesses that build the environment with their own bespoke `setup(...)`
|
|
49
|
+
* opts can still reuse the shared handle wiring.
|
|
50
|
+
*/ hydrateFromContext(context) {
|
|
51
|
+
this.context = context;
|
|
52
|
+
this.logger = context.logger;
|
|
53
|
+
this.wallet = context.wallet;
|
|
54
|
+
this.aztecNode = context.aztecNodeService;
|
|
55
|
+
this.aztecNodeAdmin = context.aztecNodeService;
|
|
56
|
+
this.cheatCodes = context.cheatCodes;
|
|
57
|
+
this.sequencer = context.sequencer;
|
|
58
|
+
this.accounts = context.accounts;
|
|
59
|
+
this.defaultAccountAddress = context.accounts[0];
|
|
60
|
+
return Promise.resolve();
|
|
61
|
+
}
|
|
62
|
+
async teardown() {
|
|
63
|
+
await teardown(this.context);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Marks the current pending checkpoints as proven, then warps the L2 clock forward by `seconds`.
|
|
67
|
+
*
|
|
68
|
+
* Under {@link AUTOMINE_E2E_OPTS} a long warp crosses many epochs with no proofs being submitted, so
|
|
69
|
+
* without a prior `markAsProven()` the rollup contract's pruning window resets the chain tip to genesis
|
|
70
|
+
* and the warp's own empty-checkpoint propose fails with `Rollup__InvalidArchive`. Marking proven before
|
|
71
|
+
* warping keeps the pending chain alive. Composes the existing `cheatCodes.rollup.markAsProven` and
|
|
72
|
+
* `warpL2TimeAtLeastBy` with that required ordering.
|
|
73
|
+
*/ async markProvenAndWarp(seconds) {
|
|
74
|
+
await this.cheatCodes.rollup.markAsProven();
|
|
75
|
+
await this.cheatCodes.warpL2TimeAtLeastBy(this.aztecNode, seconds);
|
|
76
|
+
}
|
|
77
|
+
/** Computes and registers a contract instance in the wallet without deploying it on-chain. */ async registerContract(wallet, contractArtifact, opts = {}) {
|
|
78
|
+
const { salt, publicKeys, initArgs, constructorName, deployer } = opts;
|
|
79
|
+
const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, {
|
|
80
|
+
constructorArgs: initArgs ?? [],
|
|
81
|
+
constructorArtifact: constructorName,
|
|
82
|
+
salt: salt ?? Fr.random(),
|
|
83
|
+
publicKeys,
|
|
84
|
+
deployer
|
|
85
|
+
});
|
|
86
|
+
await wallet.registerContract(instance, contractArtifact.artifact);
|
|
87
|
+
return contractArtifact.at(instance.address, wallet);
|
|
88
|
+
}
|
|
89
|
+
/** Deploys a Parent and a Child contract from the default account for the nested-call tests. */ async applyManualParentChild() {
|
|
90
|
+
this.logger.info('Deploying parent and child contracts');
|
|
91
|
+
({ contract: this.parentContract } = await ParentContract.deploy(this.wallet).send({
|
|
92
|
+
from: this.defaultAccountAddress
|
|
93
|
+
}));
|
|
94
|
+
({ contract: this.childContract } = await ChildContract.deploy(this.wallet).send({
|
|
95
|
+
from: this.defaultAccountAddress
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmFnZV9wcm9vZl9mZXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXV0b21pbmUvY29udHJhY3RzL2ZpeHR1cmVzL3N0b3JhZ2VfcHJvb2ZfZmV0Y2hlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage_proof_fetcher.d.ts","sourceRoot":"","sources":["../../../../src/automine/contracts/fixtures/storage_proof_fetcher.ts"],"names":[],"mappings":""}
|
|
@@ -15,4 +15,4 @@ export type StorageProofArgs = {
|
|
|
15
15
|
export declare function loadStorageProofArgs(): StorageProofArgs;
|
|
16
16
|
/** Builds all the capsules the StorageProofTest contract expects during private execution. */
|
|
17
17
|
export declare function buildStorageProofCapsules(contractAddress: AztecAddress): Promise<Capsule[]>;
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmFnZV9wcm9vZl9maXh0dXJlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXV0b21pbmUvY29udHJhY3RzL2ZpeHR1cmVzL3N0b3JhZ2VfcHJvb2ZfZml4dHVyZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUc5RCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDM0QsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBd0YzQyxnRkFBZ0Y7QUFDaEYsTUFBTSxNQUFNLGdCQUFnQixHQUFHO0lBQzdCLFVBQVUsRUFBRSxVQUFVLENBQUM7SUFDdkIsT0FBTyxFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQ2xCLFlBQVksRUFBRTtRQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsQ0FBQztRQUFDLFlBQVksRUFBRSxNQUFNLENBQUE7S0FBRSxDQUFDO0lBQ3hELElBQUksRUFBRSxNQUFNLEVBQUUsQ0FBQztDQUNoQixDQUFDO0FBRUYsK0VBQStFO0FBQy9FLHdCQUFnQixvQkFBb0IsSUFBSSxnQkFBZ0IsQ0FhdkQ7QUFFRCw4RkFBOEY7QUFDOUYsd0JBQXNCLHlCQUF5QixDQUFDLGVBQWUsRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDLENBdURqRyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage_proof_fixture.d.ts","sourceRoot":"","sources":["../../../../src/automine/contracts/fixtures/storage_proof_fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAwF3C,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,+EAA+E;AAC/E,wBAAgB,oBAAoB,IAAI,gBAAgB,CAavD;AAED,8FAA8F;AAC9F,wBAAsB,yBAAyB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAuDjG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { PXECreationOptions } from '@aztec/pxe/server';
|
|
3
|
+
import { TestWallet } from '../../test-wallet/test_wallet.js';
|
|
4
|
+
export type SenderHook = NonNullable<NonNullable<PXECreationOptions['hooks']>['resolveTaggingSecretStrategy']>;
|
|
5
|
+
export type Mode = 'constrained' | 'unconstrained';
|
|
6
|
+
export type DeliveryMode = Mode | {
|
|
7
|
+
events: Mode;
|
|
8
|
+
notes: Mode;
|
|
9
|
+
};
|
|
10
|
+
export declare function buildMessageDeliveryTest(opts: {
|
|
11
|
+
strategy: string;
|
|
12
|
+
mode: DeliveryMode;
|
|
13
|
+
senderHook: SenderHook;
|
|
14
|
+
recipientRegistration?: (recipient: TestWallet, recipientAddress: AztecAddress, sender: AztecAddress) => Promise<void>;
|
|
15
|
+
additionalTests?: () => void;
|
|
16
|
+
}): void;
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib25jaGFpbl9kZWxpdmVyeV9oYXJuZXNzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXV0b21pbmUvZGVsaXZlcnkvb25jaGFpbl9kZWxpdmVyeV9oYXJuZXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBSTlELE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFPNUQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBSTlELE1BQU0sTUFBTSxVQUFVLEdBQUcsV0FBVyxDQUFDLFdBQVcsQ0FBQyxrQkFBa0IsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLDhCQUE4QixDQUFDLENBQUMsQ0FBQztBQUUvRyxNQUFNLE1BQU0sSUFBSSxHQUFHLGFBQWEsR0FBRyxlQUFlLENBQUM7QUFJbkQsTUFBTSxNQUFNLFlBQVksR0FBRyxJQUFJLEdBQUc7SUFBRSxNQUFNLEVBQUUsSUFBSSxDQUFDO0lBQUMsS0FBSyxFQUFFLElBQUksQ0FBQTtDQUFFLENBQUM7QUFZaEUsd0JBQWdCLHdCQUF3QixDQUFDLElBQUksRUFBRTtJQUc3QyxRQUFRLEVBQUUsTUFBTSxDQUFDO0lBQ2pCLElBQUksRUFBRSxZQUFZLENBQUM7SUFFbkIsVUFBVSxFQUFFLFVBQVUsQ0FBQztJQUV2QixxQkFBcUIsQ0FBQyxFQUFFLENBQ3RCLFNBQVMsRUFBRSxVQUFVLEVBQ3JCLGdCQUFnQixFQUFFLFlBQVksRUFDOUIsTUFBTSxFQUFFLFlBQVksS0FDakIsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBSW5CLGVBQWUsQ0FBQyxFQUFFLE1BQU0sSUFBSSxDQUFDO0NBQzlCLFFBMkhBIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onchain_delivery_harness.d.ts","sourceRoot":"","sources":["../../../src/automine/delivery/onchain_delivery_harness.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAO5D,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAI9D,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAE/G,MAAM,MAAM,IAAI,GAAG,aAAa,GAAG,eAAe,CAAC;AAInD,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAAC;AAYhE,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAG7C,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,YAAY,CAAC;IAEnB,UAAU,EAAE,UAAU,CAAC;IAEvB,qBAAqB,CAAC,EAAE,CACtB,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,YAAY,EAC9B,MAAM,EAAE,YAAY,KACjB,OAAO,CAAC,IAAI,CAAC,CAAC;IAInB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B,QA2HA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
3
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import { OnchainDeliveryTestContract } from '@aztec/noir-test-contracts.js/OnchainDeliveryTest';
|
|
5
|
+
import { jest } from '@jest/globals';
|
|
6
|
+
import { AUTOMINE_E2E_OPTS } from '../../fixtures/fixtures.js';
|
|
7
|
+
import { ensureHandshakeRegistryPublished, setup, setupPXEAndGetWallet } from '../../fixtures/setup.js';
|
|
8
|
+
const formatMode = (mode)=>typeof mode === 'string' ? mode : `${mode.events}->${mode.notes}`;
|
|
9
|
+
// Onchain private delivery has two orthogonal axes: the delivery MODE (constrained = nullifier-chained sequence;
|
|
10
|
+
// unconstrained = no nullifier, windowed scan) and the tagging-secret SOURCE, which the wallet's
|
|
11
|
+
// `resolveTaggingSecretStrategy` hook selects. This harness exercises (strategy, mode) cells end to end across two
|
|
12
|
+
// PXEs that share only a node: the sender PXE sends, the recipient PXE discovers purely from onchain logs plus the
|
|
13
|
+
// HandshakeRegistry.
|
|
14
|
+
//
|
|
15
|
+
// Cross-PXE is the meaningful setup: the recipient PXE holds no sender state, so a cell only "discovers" a message if
|
|
16
|
+
// the source truly reached it.
|
|
17
|
+
export function buildMessageDeliveryTest(opts) {
|
|
18
|
+
const { strategy, mode, senderHook, recipientRegistration, additionalTests } = opts;
|
|
19
|
+
const description = `${strategy} x ${formatMode(mode)}`;
|
|
20
|
+
describe(description, ()=>{
|
|
21
|
+
jest.setTimeout(300_000);
|
|
22
|
+
const eventValues = [
|
|
23
|
+
10n,
|
|
24
|
+
20n,
|
|
25
|
+
30n
|
|
26
|
+
];
|
|
27
|
+
const noteValues = [
|
|
28
|
+
40n,
|
|
29
|
+
50n,
|
|
30
|
+
60n
|
|
31
|
+
];
|
|
32
|
+
let aztecNode;
|
|
33
|
+
let walletSender;
|
|
34
|
+
let walletRecipient;
|
|
35
|
+
let sender;
|
|
36
|
+
let recipient;
|
|
37
|
+
let contractSender;
|
|
38
|
+
let teardownSender;
|
|
39
|
+
let teardownRecipient;
|
|
40
|
+
// Discovery results captured in beforeAll, so the assertions in the actual tests below stay pure.
|
|
41
|
+
// A failure during delivery fails beforeAll loudly instead of being swallowed as an expected red.
|
|
42
|
+
let discoveredEvents;
|
|
43
|
+
let readNotes;
|
|
44
|
+
const { events: eventMode, notes: noteMode } = typeof mode === 'string' ? {
|
|
45
|
+
events: mode,
|
|
46
|
+
notes: mode
|
|
47
|
+
} : mode;
|
|
48
|
+
const sendEvent = (value)=>eventMode === 'constrained' ? contractSender.methods.emit_event(recipient, value) : contractSender.methods.emit_event_unconstrained(recipient, value);
|
|
49
|
+
const sendNote = (value)=>noteMode === 'constrained' ? contractSender.methods.emit_note(recipient, value) : contractSender.methods.emit_note_unconstrained(recipient, value);
|
|
50
|
+
beforeAll(async ()=>{
|
|
51
|
+
// The sender PXE holds the sender and carries this cell's tagging-secret-strategy hook. The recipient is funded
|
|
52
|
+
// at genesis here but created and deployed on the isolated recipient PXE below, so it carries no sender state
|
|
53
|
+
// from other cells.
|
|
54
|
+
let additionallyFundedAccounts;
|
|
55
|
+
({ aztecNode, additionallyFundedAccounts, wallet: walletSender, accounts: [sender], teardown: teardownSender } = await setup(1, {
|
|
56
|
+
...AUTOMINE_E2E_OPTS,
|
|
57
|
+
additionallyFundedAccounts: await generateSchnorrAccounts(1, 'schnorr'),
|
|
58
|
+
pxeCreationOptions: {
|
|
59
|
+
hooks: {
|
|
60
|
+
resolveTaggingSecretStrategy: senderHook
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
({ wallet: walletRecipient, teardown: teardownRecipient } = await setupPXEAndGetWallet(aztecNode, aztecNode, {}, undefined, 'pxe-recipient'));
|
|
65
|
+
const recipientAccount = await walletRecipient.createSchnorrAccount(additionallyFundedAccounts[0].secret, additionallyFundedAccounts[0].salt, additionallyFundedAccounts[0].signingKey);
|
|
66
|
+
await (await recipientAccount.getDeployMethod()).send({
|
|
67
|
+
from: NO_FROM
|
|
68
|
+
});
|
|
69
|
+
recipient = recipientAccount.address;
|
|
70
|
+
await ensureHandshakeRegistryPublished(walletSender, sender);
|
|
71
|
+
const { contract: deployed, instance } = await OnchainDeliveryTestContract.deploy(walletSender).send({
|
|
72
|
+
from: sender
|
|
73
|
+
});
|
|
74
|
+
contractSender = deployed;
|
|
75
|
+
await ensureHandshakeRegistryPublished(walletRecipient, recipient);
|
|
76
|
+
await walletRecipient.registerContract(instance, OnchainDeliveryTestContract.artifact);
|
|
77
|
+
await recipientRegistration?.(walletRecipient, recipient, sender);
|
|
78
|
+
// Constrained sends to one pair are strictly ordered, so deliver one tx at a time. The first send bootstraps the
|
|
79
|
+
// handshake (when the source is a handshake); the rest reuse it.
|
|
80
|
+
const blockNumbers = [];
|
|
81
|
+
for (const value of eventValues){
|
|
82
|
+
const { receipt } = await sendEvent(value).send({
|
|
83
|
+
from: sender
|
|
84
|
+
});
|
|
85
|
+
blockNumbers.push(receipt.blockNumber);
|
|
86
|
+
}
|
|
87
|
+
for (const value of noteValues){
|
|
88
|
+
await sendNote(value).send({
|
|
89
|
+
from: sender
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
await walletRecipient.sync();
|
|
93
|
+
const events = await walletRecipient.getPrivateEvents(OnchainDeliveryTestContract.events.DeliveryEvent, {
|
|
94
|
+
contractAddress: contractSender.address,
|
|
95
|
+
fromBlock: BlockNumber(Math.min(...blockNumbers)),
|
|
96
|
+
toBlock: BlockNumber(Math.max(...blockNumbers) + 1),
|
|
97
|
+
scopes: [
|
|
98
|
+
recipient
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
discoveredEvents = events.map((e)=>e.event.value);
|
|
102
|
+
const contractRecipient = OnchainDeliveryTestContract.at(contractSender.address, walletRecipient);
|
|
103
|
+
const { result } = await contractRecipient.methods.get_note_values(recipient).simulate({
|
|
104
|
+
from: recipient
|
|
105
|
+
});
|
|
106
|
+
readNotes = result.storage.slice(0, Number(result.len));
|
|
107
|
+
});
|
|
108
|
+
afterAll(async ()=>{
|
|
109
|
+
await teardownRecipient();
|
|
110
|
+
await teardownSender();
|
|
111
|
+
});
|
|
112
|
+
it('the recipient PXE discovers the events delivered by the sender PXE', ()=>{
|
|
113
|
+
expect(discoveredEvents.length).toBe(eventValues.length);
|
|
114
|
+
for (const value of eventValues){
|
|
115
|
+
expect(discoveredEvents).toContainEqual(value);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
it('the recipient PXE reads back the notes delivered by the sender PXE', ()=>{
|
|
119
|
+
expect(readNotes).toEqual(noteValues);
|
|
120
|
+
});
|
|
121
|
+
additionalTests?.();
|
|
122
|
+
});
|
|
123
|
+
}
|