@aztec/end-to-end 0.0.1-commit.b655e406 → 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/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -0
- package/dest/automine/delivery/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/automine/token/blacklist_token_contract_test.js +166 -0
- 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/automine/token/token_contract_test.js +119 -0
- 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 +17 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +40 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -20
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +159 -140
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +8 -27
- package/dest/bench/utils.d.ts +10 -9
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +126 -23
- 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/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +1 -1
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +27 -29
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +156 -156
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +83 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +86 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +119 -0
- package/dest/fixtures/index.d.ts +3 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +2 -0
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- 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 +269 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +688 -0
- package/dest/fixtures/setup_p2p_test.d.ts +22 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +60 -41
- 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 +26 -5
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +33 -9
- package/dest/fixtures/utils.d.ts +5 -192
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -648
- 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/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- 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/index.d.ts +1 -1
- 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/p2p/p2p_network.d.ts +325 -0
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/p2p/p2p_network.js +389 -0
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/p2p/reqresp/utils.js +193 -0
- package/dest/p2p/shared.d.ts +72 -0
- package/dest/p2p/shared.d.ts.map +1 -0
- package/dest/p2p/shared.js +212 -0
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +11 -8
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +45 -40
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +28 -16
- package/dest/shared/index.d.ts +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +19 -14
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +365 -0
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +86 -54
- 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/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +11 -4
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +33 -19
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/single-node/fees/bridging_race.notest.d.ts +2 -0
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +21 -10
- 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/single-node/fees/fees_test.js +274 -0
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +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 +18 -6
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +169 -30
- package/dest/spartan/tx_metrics.d.ts +111 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +507 -0
- package/dest/spartan/utils/bot.d.ts +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +19 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -218
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -749
- package/dest/test-wallet/test_wallet.d.ts +105 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +323 -0
- package/dest/test-wallet/utils.d.ts +76 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +126 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +56 -0
- package/dest/test-wallet/worker_wallet.d.ts +53 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +155 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +22 -0
- package/package.json +57 -47
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/contracts/fixtures/storage_proof.json +915 -0
- package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +177 -0
- package/src/automine/token/blacklist_token_contract_test.ts +208 -0
- package/src/automine/token/token_contract_test.ts +146 -0
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +45 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +227 -211
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +7 -28
- package/src/bench/utils.ts +144 -25
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +1 -1
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +175 -214
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +110 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +192 -0
- package/src/fixtures/index.ts +2 -0
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +987 -0
- package/src/fixtures/setup_p2p_test.ts +72 -58
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +47 -11
- package/src/fixtures/utils.ts +26 -947
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- 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 +8 -5
- 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/p2p/p2p_network.ts +542 -0
- package/src/p2p/reqresp/utils.ts +263 -0
- package/src/p2p/shared.ts +329 -0
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +51 -43
- package/src/shared/gas_portal_test_harness.ts +36 -18
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +22 -19
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +136 -115
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +40 -20
- package/src/simulators/token_simulator.ts +6 -30
- package/src/single-node/README.md +60 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +23 -15
- package/src/single-node/fees/fees_test.ts +368 -0
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1041 -0
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +243 -32
- package/src/spartan/tx_metrics.ts +460 -0
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -942
- package/src/test-wallet/test_wallet.ts +429 -0
- package/src/test-wallet/utils.ts +205 -0
- package/src/test-wallet/wallet_worker_script.ts +66 -0
- package/src/test-wallet/worker_wallet.ts +214 -0
- package/src/test-wallet/worker_wallet_schema.ts +14 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -54
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +0 -185
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -41
- 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 -107
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -45
- package/dest/e2e_epochs/epochs_test.d.ts +0 -92
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -336
- package/dest/e2e_fees/bridging_race.notest.d.ts +0 -2
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -84
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.js +0 -260
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -57
- 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 -29
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -63
- 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 -135
- package/dest/e2e_p2p/p2p_network.d.ts +0 -108
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/p2p_network.js +0 -318
- package/dest/e2e_p2p/shared.d.ts +0 -46
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -183
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -35
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/dest/e2e_token_contract/token_contract_test.js +0 -126
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +0 -256
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -178
- package/src/e2e_deploy_contract/deploy_test.ts +0 -78
- package/src/e2e_epochs/epochs_test.ts +0 -437
- package/src/e2e_fees/fees_test.ts +0 -378
- package/src/e2e_l1_publisher/write_json.ts +0 -76
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -95
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -178
- package/src/e2e_p2p/p2p_network.ts +0 -472
- package/src/e2e_p2p/shared.ts +0 -282
- package/src/e2e_token_contract/token_contract_test.ts +0 -167
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches a ERC20 balance storage proof from the Ethereum mainnet and saves it to a Prover.toml compatible JSON.
|
|
3
|
+
* The JSON can be converted to toml for use with nargo, or used directly as a JSON file when used in
|
|
4
|
+
* Aztec contracts. This script is not using any Aztec library code, so it's easily portable.
|
|
5
|
+
*/
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import { dirname, join } from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { createPublicClient, encodeAbiParameters, fromRlp, hexToBytes, http, keccak256 } from 'viem';
|
|
10
|
+
import { mainnet } from 'viem/chains';
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
|
|
14
|
+
const RPC_URL = process.env.RPC_URL;
|
|
15
|
+
const ERC20_CONTRACT = (process.env.ERC20_CONTRACT || '0xdAC17F958D2ee523a2206206994597C13D831ec7') as `0x${string}`;
|
|
16
|
+
const HOLDER = (process.env.HOLDER || '0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a') as `0x${string}`;
|
|
17
|
+
const SLOT = BigInt(process.env.SLOT || '2');
|
|
18
|
+
const BLOCK_TAG = process.env.BLOCK_NUMBER ? BigInt(process.env.BLOCK_NUMBER) : 'latest';
|
|
19
|
+
const MAX_ACCOUNT_PATH = 15;
|
|
20
|
+
const MAX_STORAGE_PATH = 10;
|
|
21
|
+
|
|
22
|
+
function padTo(arr: number[], len: number) {
|
|
23
|
+
return [...arr, ...Array(len - arr.length).fill(0)].slice(0, len);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function toBytes(hex: `0x${string}`) {
|
|
27
|
+
return Array.from(hexToBytes(hex));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function bytesToU64s(bytes: number[]) {
|
|
31
|
+
const paddedBytes = padTo(bytes, 32);
|
|
32
|
+
return Array.from({ length: 4 }, (_, i) => {
|
|
33
|
+
let val = 0n;
|
|
34
|
+
for (let j = 0; j < 8; j++) {
|
|
35
|
+
val += BigInt(paddedBytes[i * 8 + j]) << BigInt(j * 8);
|
|
36
|
+
}
|
|
37
|
+
return val.toString();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function toBytesAndLen(val: bigint | number) {
|
|
42
|
+
if (val === 0n || val === 0) {
|
|
43
|
+
return { bytes: [0], length: 0 };
|
|
44
|
+
}
|
|
45
|
+
let hex = val.toString(16);
|
|
46
|
+
if (hex.length % 2) {
|
|
47
|
+
hex = '0' + hex;
|
|
48
|
+
}
|
|
49
|
+
const bytes = toBytes(`0x${hex}`);
|
|
50
|
+
return { bytes, length: bytes.length };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function parseNode(rlp: `0x${string}`) {
|
|
54
|
+
// Should be safe when working with branches and extensions without embedded children.
|
|
55
|
+
const decoded = fromRlp(rlp) as `0x${string}`[];
|
|
56
|
+
const node = {
|
|
57
|
+
rows: Array(16)
|
|
58
|
+
.fill(0)
|
|
59
|
+
.map(() => Array(32).fill(0)),
|
|
60
|
+
row_exist: Array(16).fill(false),
|
|
61
|
+
node_type: 0,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (decoded.length === 17) {
|
|
65
|
+
for (let i = 0; i < 16; i++) {
|
|
66
|
+
if (decoded[i] !== '0x') {
|
|
67
|
+
node.row_exist[i] = true;
|
|
68
|
+
node.rows[i] = padTo(toBytes(decoded[i]), 32);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} else if (decoded.length === 2) {
|
|
72
|
+
const keyBytes = toBytes(decoded[0]);
|
|
73
|
+
const prefix = keyBytes[0];
|
|
74
|
+
if (prefix >> 4 >= 2) {
|
|
75
|
+
throw new Error('Unsupported: leaf node in proof path');
|
|
76
|
+
}
|
|
77
|
+
node.node_type = 1;
|
|
78
|
+
// Extension header format expected by the noir code: check out storage_proof types.nr.
|
|
79
|
+
node.rows[0][0] = prefix >> 4;
|
|
80
|
+
node.rows[0][8] = prefix & 0x0f;
|
|
81
|
+
node.rows[0][16] = keyBytes.length - 1;
|
|
82
|
+
|
|
83
|
+
for (let i = 1; i < keyBytes.length && i < 32; i++) {
|
|
84
|
+
node.rows[1][i - 1] = keyBytes[i];
|
|
85
|
+
}
|
|
86
|
+
node.rows[2] = padTo(toBytes(decoded[1]), 32);
|
|
87
|
+
node.row_exist[0] = node.row_exist[1] = node.row_exist[2] = true;
|
|
88
|
+
}
|
|
89
|
+
return node;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function parseProof(proof: `0x${string}`[], maxLen: number) {
|
|
93
|
+
const nodes = proof.slice(0, -1).slice(0, maxLen).map(parseNode);
|
|
94
|
+
while (nodes.length < maxLen) {
|
|
95
|
+
nodes.push({
|
|
96
|
+
rows: Array(16)
|
|
97
|
+
.fill(0)
|
|
98
|
+
.map(() => Array(32).fill(0)),
|
|
99
|
+
row_exist: Array(16).fill(false),
|
|
100
|
+
node_type: 0,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return nodes;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function nodeToLibFormat(node: { rows: number[][]; row_exist: boolean[]; node_type: number }) {
|
|
107
|
+
return {
|
|
108
|
+
rows: node.rows.map(bytesToU64s),
|
|
109
|
+
row_exist: node.row_exist,
|
|
110
|
+
node_type: String(node.node_type),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async function main() {
|
|
115
|
+
if (!RPC_URL) {
|
|
116
|
+
throw new Error('RPC_URL is not set');
|
|
117
|
+
}
|
|
118
|
+
const storageKey = keccak256(encodeAbiParameters([{ type: 'address' }, { type: 'uint256' }], [HOLDER, SLOT]));
|
|
119
|
+
console.log(`Fetching storage proof for ${ERC20_CONTRACT}, holder ${HOLDER}, slot ${SLOT}`);
|
|
120
|
+
console.log(`Storage key: ${storageKey}`);
|
|
121
|
+
|
|
122
|
+
const client = createPublicClient({
|
|
123
|
+
chain: mainnet,
|
|
124
|
+
transport: http(RPC_URL),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const [blockNumber, proof, block] = await Promise.all([
|
|
128
|
+
client.getBlockNumber(),
|
|
129
|
+
client.getProof({
|
|
130
|
+
address: ERC20_CONTRACT,
|
|
131
|
+
storageKeys: [storageKey],
|
|
132
|
+
blockNumber: BLOCK_TAG === 'latest' ? undefined : BLOCK_TAG,
|
|
133
|
+
}),
|
|
134
|
+
client.getBlock({
|
|
135
|
+
blockNumber: BLOCK_TAG === 'latest' ? undefined : BLOCK_TAG,
|
|
136
|
+
}),
|
|
137
|
+
]);
|
|
138
|
+
|
|
139
|
+
const storageProof = proof.storageProof[0];
|
|
140
|
+
console.log(
|
|
141
|
+
`Block: ${blockNumber}, Account nodes: ${proof.accountProof.length}, Storage nodes: ${storageProof.proof.length}`,
|
|
142
|
+
);
|
|
143
|
+
console.log(`Value: ${storageProof.value}`);
|
|
144
|
+
|
|
145
|
+
// The -1 is because the last node in the proof is the leaf, which is excluded from path verification.
|
|
146
|
+
const accountPathLen = proof.accountProof.length - 1;
|
|
147
|
+
const storagePathLen = storageProof.proof.length - 1;
|
|
148
|
+
if (accountPathLen > MAX_ACCOUNT_PATH) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
`Account proof path length ${accountPathLen} exceeds MAX_ACCOUNT_PATH ${MAX_ACCOUNT_PATH}. Increase the limit.`,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
if (storagePathLen > MAX_STORAGE_PATH) {
|
|
154
|
+
throw new Error(
|
|
155
|
+
`Storage proof path length ${storagePathLen} exceeds MAX_STORAGE_PATH ${MAX_STORAGE_PATH}. Increase the limit.`,
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const nonce = toBytesAndLen(proof.nonce);
|
|
160
|
+
const balance = toBytesAndLen(proof.balance);
|
|
161
|
+
const slotValue = toBytesAndLen(storageProof.value);
|
|
162
|
+
|
|
163
|
+
const data = {
|
|
164
|
+
account_nodes: parseProof(proof.accountProof, MAX_ACCOUNT_PATH).map(nodeToLibFormat),
|
|
165
|
+
account_node_length: String(accountPathLen),
|
|
166
|
+
storage_nodes: parseProof(storageProof.proof, MAX_STORAGE_PATH).map(nodeToLibFormat),
|
|
167
|
+
storage_node_length: String(storagePathLen),
|
|
168
|
+
account: {
|
|
169
|
+
nonce: padTo(nonce.bytes, 8).map(String),
|
|
170
|
+
nonce_length: String(nonce.length),
|
|
171
|
+
balance: padTo(balance.bytes, 32).map(String),
|
|
172
|
+
balance_length: String(balance.length),
|
|
173
|
+
address: toBytes(ERC20_CONTRACT).map(String),
|
|
174
|
+
storage_hash: bytesToU64s(toBytes(proof.storageHash)),
|
|
175
|
+
code_hash: bytesToU64s(toBytes(proof.codeHash)),
|
|
176
|
+
},
|
|
177
|
+
slot: {
|
|
178
|
+
value: padTo(slotValue.bytes, 32).map(String),
|
|
179
|
+
value_length: String(slotValue.length),
|
|
180
|
+
},
|
|
181
|
+
slot_key: toBytes(storageKey).map(String),
|
|
182
|
+
root: bytesToU64s(toBytes(block.stateRoot)),
|
|
183
|
+
block_number: String(blockNumber),
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
fs.writeFileSync(join(__dirname, 'storage_proof.json'), JSON.stringify(data, null, 2));
|
|
187
|
+
console.log('storage_proof.json generated');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { Capsule } from '@aztec/stdlib/tx';
|
|
6
|
+
|
|
7
|
+
import { readFileSync } from 'fs';
|
|
8
|
+
import { dirname, join } from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
|
|
11
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const FIXTURE_PATH = join(__dirname, './storage_proof.json');
|
|
13
|
+
|
|
14
|
+
// Constants matching the Noir contract
|
|
15
|
+
const ACCOUNT_CAPSULE_KEY_SEPARATOR = 100;
|
|
16
|
+
const ACCOUNT_PROOF_CAPSULE_KEY_SEPARATOR = 101;
|
|
17
|
+
const STORAGE_PROOF_CAPSULE_KEY_SEPARATOR = 102;
|
|
18
|
+
const STORAGE_PROOF_NODE_CAPSULE_KEY_SEPARATOR = 103;
|
|
19
|
+
const MAX_ACCOUNT_PROOF_LENGTH = 15;
|
|
20
|
+
/** Node: rows [[u64;4];16] (64) + row_exist [bool;16] (16) + node_type u8 (1) = 81 fields */
|
|
21
|
+
const NODE_FIELD_COUNT = 81;
|
|
22
|
+
|
|
23
|
+
// --- JSON fixture types ---
|
|
24
|
+
|
|
25
|
+
type JsonNode = { rows: string[][]; row_exist: boolean[]; node_type: string };
|
|
26
|
+
|
|
27
|
+
type JsonAccount = {
|
|
28
|
+
nonce: string[];
|
|
29
|
+
balance: string[];
|
|
30
|
+
address: string[];
|
|
31
|
+
nonce_length: string;
|
|
32
|
+
balance_length: string;
|
|
33
|
+
storage_hash: string[];
|
|
34
|
+
code_hash: string[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type StorageProofJSON = {
|
|
38
|
+
root: string[];
|
|
39
|
+
slot_key: string[];
|
|
40
|
+
account_node_length: string;
|
|
41
|
+
storage_node_length: string;
|
|
42
|
+
account_nodes: JsonNode[];
|
|
43
|
+
storage_nodes: JsonNode[];
|
|
44
|
+
account: JsonAccount;
|
|
45
|
+
slot: { value: string[]; value_length: string };
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// --- Serialization helpers (Noir struct Serialize layout) ---
|
|
49
|
+
|
|
50
|
+
function serializeNode(node: JsonNode): Fr[] {
|
|
51
|
+
const fields: Fr[] = [];
|
|
52
|
+
for (const row of node.rows) {
|
|
53
|
+
for (const val of row) {
|
|
54
|
+
fields.push(new Fr(BigInt(val)));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (const exists of node.row_exist) {
|
|
58
|
+
fields.push(new Fr(exists ? 1n : 0n));
|
|
59
|
+
}
|
|
60
|
+
fields.push(new Fr(BigInt(node.node_type)));
|
|
61
|
+
return fields;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Account: nonce [u8;8] + balance [u8;32] + address [u8;20] + nonce_length u8 + balance_length u8 + storage_hash [u64;4] + code_hash [u64;4] = 70 fields */
|
|
65
|
+
function serializeAccount(account: JsonAccount): Fr[] {
|
|
66
|
+
const fields: Fr[] = [];
|
|
67
|
+
for (const v of account.nonce) {
|
|
68
|
+
fields.push(new Fr(BigInt(v)));
|
|
69
|
+
}
|
|
70
|
+
for (const v of account.balance) {
|
|
71
|
+
fields.push(new Fr(BigInt(v)));
|
|
72
|
+
}
|
|
73
|
+
for (const v of account.address) {
|
|
74
|
+
fields.push(new Fr(BigInt(v)));
|
|
75
|
+
}
|
|
76
|
+
fields.push(new Fr(BigInt(account.nonce_length)));
|
|
77
|
+
fields.push(new Fr(BigInt(account.balance_length)));
|
|
78
|
+
for (const v of account.storage_hash) {
|
|
79
|
+
fields.push(new Fr(BigInt(v)));
|
|
80
|
+
}
|
|
81
|
+
for (const v of account.code_hash) {
|
|
82
|
+
fields.push(new Fr(BigInt(v)));
|
|
83
|
+
}
|
|
84
|
+
return fields;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function zeroNode(): Fr[] {
|
|
88
|
+
return Array(NODE_FIELD_COUNT).fill(Fr.ZERO);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// --- Public API ---
|
|
92
|
+
|
|
93
|
+
/** Parsed + typed fixture data ready for use as contract function arguments. */
|
|
94
|
+
export type StorageProofArgs = {
|
|
95
|
+
ethAddress: EthAddress;
|
|
96
|
+
slotKey: number[];
|
|
97
|
+
slotContents: { value: number[]; value_length: number };
|
|
98
|
+
root: bigint[];
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** Loads the storage proof fixture from disk and returns the contract args. */
|
|
102
|
+
export function loadStorageProofArgs(): StorageProofArgs {
|
|
103
|
+
const fixture: StorageProofJSON = JSON.parse(readFileSync(FIXTURE_PATH, 'utf8'));
|
|
104
|
+
const addressBytes = Buffer.from(fixture.account.address.map(v => Number(v)));
|
|
105
|
+
return {
|
|
106
|
+
ethAddress: EthAddress.fromString('0x' + addressBytes.toString('hex')),
|
|
107
|
+
slotKey: fixture.slot_key.map(v => Number(v)),
|
|
108
|
+
slotContents: {
|
|
109
|
+
value: fixture.slot.value.map(v => Number(v)),
|
|
110
|
+
// eslint-disable-next-line camelcase
|
|
111
|
+
value_length: Number(fixture.slot.value_length),
|
|
112
|
+
},
|
|
113
|
+
root: fixture.root.map(v => BigInt(v)),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Builds all the capsules the StorageProofTest contract expects during private execution. */
|
|
118
|
+
export async function buildStorageProofCapsules(contractAddress: AztecAddress): Promise<Capsule[]> {
|
|
119
|
+
const fixture: StorageProofJSON = JSON.parse(readFileSync(FIXTURE_PATH, 'utf8'));
|
|
120
|
+
|
|
121
|
+
const root = fixture.root.map(v => BigInt(v));
|
|
122
|
+
const slotKey = fixture.slot_key.map(v => Number(v));
|
|
123
|
+
const accountNodeLength = Number(fixture.account_node_length);
|
|
124
|
+
const storageNodeLength = Number(fixture.storage_node_length);
|
|
125
|
+
const ethAddress = EthAddress.fromBuffer(Buffer.from(fixture.account.address.map(v => Number(v))));
|
|
126
|
+
|
|
127
|
+
// Compute capsule keys (must match the Noir contract's poseidon2_hash computations)
|
|
128
|
+
const addressCapsuleKey = await poseidon2Hash([
|
|
129
|
+
new Fr(ACCOUNT_CAPSULE_KEY_SEPARATOR),
|
|
130
|
+
...root.map(v => new Fr(v)),
|
|
131
|
+
ethAddress.toField(),
|
|
132
|
+
]);
|
|
133
|
+
|
|
134
|
+
const accountProofCapsuleKey = await poseidon2Hash([new Fr(ACCOUNT_PROOF_CAPSULE_KEY_SEPARATOR), addressCapsuleKey]);
|
|
135
|
+
|
|
136
|
+
const storageProofCapsuleKey = await poseidon2Hash([
|
|
137
|
+
new Fr(STORAGE_PROOF_CAPSULE_KEY_SEPARATOR),
|
|
138
|
+
addressCapsuleKey,
|
|
139
|
+
...slotKey.map(v => new Fr(v)),
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
// Build capsule data
|
|
143
|
+
|
|
144
|
+
// 1. Account data
|
|
145
|
+
const accountData = serializeAccount(fixture.account);
|
|
146
|
+
|
|
147
|
+
// 2. Account proof nodes padded to MAX_ACCOUNT_PROOF_LENGTH
|
|
148
|
+
const accountProofData: Fr[] = [new Fr(accountNodeLength)];
|
|
149
|
+
for (let i = 0; i < MAX_ACCOUNT_PROOF_LENGTH; i++) {
|
|
150
|
+
accountProofData.push(...(i < fixture.account_nodes.length ? serializeNode(fixture.account_nodes[i]) : zeroNode()));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// 3. Storage proof length (u32)
|
|
154
|
+
const storageProofLengthData = [new Fr(storageNodeLength)];
|
|
155
|
+
|
|
156
|
+
const capsules: Capsule[] = [
|
|
157
|
+
new Capsule(contractAddress, addressCapsuleKey, accountData),
|
|
158
|
+
new Capsule(contractAddress, accountProofCapsuleKey, accountProofData),
|
|
159
|
+
new Capsule(contractAddress, storageProofCapsuleKey, storageProofLengthData),
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
// 4. Individual storage node capsules for private recursion.
|
|
163
|
+
for (let i = 0; i < storageNodeLength; i++) {
|
|
164
|
+
const nodeCapsuleKey = await poseidon2Hash([
|
|
165
|
+
new Fr(STORAGE_PROOF_NODE_CAPSULE_KEY_SEPARATOR),
|
|
166
|
+
storageProofCapsuleKey,
|
|
167
|
+
new Fr(i),
|
|
168
|
+
]);
|
|
169
|
+
capsules.push(new Capsule(contractAddress, nodeCapsuleKey, serializeNode(fixture.storage_nodes[i])));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return capsules;
|
|
173
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import type { FieldLike } from '@aztec/aztec.js/abi';
|
|
3
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
4
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
5
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
7
|
+
import { type DeliveryEvent, OnchainDeliveryTestContract } from '@aztec/noir-test-contracts.js/OnchainDeliveryTest';
|
|
8
|
+
import type { PXECreationOptions } from '@aztec/pxe/server';
|
|
9
|
+
import type { AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
10
|
+
|
|
11
|
+
import { jest } from '@jest/globals';
|
|
12
|
+
|
|
13
|
+
import { AUTOMINE_E2E_OPTS } from '../../fixtures/fixtures.js';
|
|
14
|
+
import { ensureHandshakeRegistryPublished, setup, setupPXEAndGetWallet } from '../../fixtures/setup.js';
|
|
15
|
+
import { TestWallet } from '../../test-wallet/test_wallet.js';
|
|
16
|
+
|
|
17
|
+
// The wallet hook that selects a message's tagging-secret source. Derived from the exported PXE options
|
|
18
|
+
// rather than importing the hook type, which `@aztec/pxe/server` does not re-export.
|
|
19
|
+
export type SenderHook = NonNullable<NonNullable<PXECreationOptions['hooks']>['resolveTaggingSecretStrategy']>;
|
|
20
|
+
|
|
21
|
+
export type Mode = 'constrained' | 'unconstrained';
|
|
22
|
+
|
|
23
|
+
// A single mode applies to both the event and note sends; `{ events, notes }` sends each in its own mode, which
|
|
24
|
+
// exercises cross-mode handshake reuse: bootstrap in one mode, deliver in the other on the same handshake.
|
|
25
|
+
export type DeliveryMode = Mode | { events: Mode; notes: Mode };
|
|
26
|
+
|
|
27
|
+
const formatMode = (mode: DeliveryMode): string => (typeof mode === 'string' ? mode : `${mode.events}->${mode.notes}`);
|
|
28
|
+
|
|
29
|
+
// Onchain private delivery has two orthogonal axes: the delivery MODE (constrained = nullifier-chained sequence;
|
|
30
|
+
// unconstrained = no nullifier, windowed scan) and the tagging-secret SOURCE, which the wallet's
|
|
31
|
+
// `resolveTaggingSecretStrategy` hook selects. This harness exercises (strategy, mode) cells end to end across two
|
|
32
|
+
// PXEs that share only a node: the sender PXE sends, the recipient PXE discovers purely from onchain logs plus the
|
|
33
|
+
// HandshakeRegistry.
|
|
34
|
+
//
|
|
35
|
+
// Cross-PXE is the meaningful setup: the recipient PXE holds no sender state, so a cell only "discovers" a message if
|
|
36
|
+
// the source truly reached it.
|
|
37
|
+
export function buildMessageDeliveryTest(opts: {
|
|
38
|
+
// Names the tagging-secret source, e.g. 'non-interactive handshake' or 'arbitrary secret'. The describe title is
|
|
39
|
+
// derived as `${strategy} x ${mode}`.
|
|
40
|
+
strategy: string;
|
|
41
|
+
mode: DeliveryMode;
|
|
42
|
+
// Required: every cell states its source explicitly rather than leaning on the PXE default (covered by unit tests).
|
|
43
|
+
senderHook: SenderHook;
|
|
44
|
+
// Recipient-side setup the source requires (e.g. registering a raw arbitrary secret); runs once after deployment.
|
|
45
|
+
recipientRegistration?: (
|
|
46
|
+
recipient: TestWallet,
|
|
47
|
+
recipientAddress: AztecAddress,
|
|
48
|
+
sender: AztecAddress,
|
|
49
|
+
) => Promise<void>;
|
|
50
|
+
// Extra `it()`s to register in this cell's suite, e.g. assertions against state a custom `senderHook` recorded.
|
|
51
|
+
// Called inside the same `describe`, after the two baseline assertions below, so it shares their `beforeAll`
|
|
52
|
+
// instead of depending on Jest's cross-`describe` execution order.
|
|
53
|
+
additionalTests?: () => void;
|
|
54
|
+
}) {
|
|
55
|
+
const { strategy, mode, senderHook, recipientRegistration, additionalTests } = opts;
|
|
56
|
+
const description = `${strategy} x ${formatMode(mode)}`;
|
|
57
|
+
|
|
58
|
+
describe(description, () => {
|
|
59
|
+
jest.setTimeout(300_000);
|
|
60
|
+
|
|
61
|
+
const eventValues = [10n, 20n, 30n];
|
|
62
|
+
const noteValues = [40n, 50n, 60n];
|
|
63
|
+
|
|
64
|
+
let aztecNode: AztecNode & AztecNodeDebug;
|
|
65
|
+
let walletSender: TestWallet;
|
|
66
|
+
let walletRecipient: TestWallet;
|
|
67
|
+
let sender: AztecAddress;
|
|
68
|
+
let recipient: AztecAddress;
|
|
69
|
+
let contractSender: OnchainDeliveryTestContract;
|
|
70
|
+
let teardownSender: () => Promise<void>;
|
|
71
|
+
let teardownRecipient: () => Promise<void>;
|
|
72
|
+
// Discovery results captured in beforeAll, so the assertions in the actual tests below stay pure.
|
|
73
|
+
// A failure during delivery fails beforeAll loudly instead of being swallowed as an expected red.
|
|
74
|
+
let discoveredEvents: FieldLike[];
|
|
75
|
+
let readNotes: bigint[];
|
|
76
|
+
|
|
77
|
+
const { events: eventMode, notes: noteMode } = typeof mode === 'string' ? { events: mode, notes: mode } : mode;
|
|
78
|
+
const sendEvent = (value: bigint) =>
|
|
79
|
+
eventMode === 'constrained'
|
|
80
|
+
? contractSender.methods.emit_event(recipient, value)
|
|
81
|
+
: contractSender.methods.emit_event_unconstrained(recipient, value);
|
|
82
|
+
const sendNote = (value: bigint) =>
|
|
83
|
+
noteMode === 'constrained'
|
|
84
|
+
? contractSender.methods.emit_note(recipient, value)
|
|
85
|
+
: contractSender.methods.emit_note_unconstrained(recipient, value);
|
|
86
|
+
|
|
87
|
+
beforeAll(async () => {
|
|
88
|
+
// The sender PXE holds the sender and carries this cell's tagging-secret-strategy hook. The recipient is funded
|
|
89
|
+
// at genesis here but created and deployed on the isolated recipient PXE below, so it carries no sender state
|
|
90
|
+
// from other cells.
|
|
91
|
+
let additionallyFundedAccounts: InitialAccountData[];
|
|
92
|
+
({
|
|
93
|
+
aztecNode,
|
|
94
|
+
additionallyFundedAccounts,
|
|
95
|
+
wallet: walletSender,
|
|
96
|
+
accounts: [sender],
|
|
97
|
+
teardown: teardownSender,
|
|
98
|
+
} = await setup(1, {
|
|
99
|
+
...AUTOMINE_E2E_OPTS,
|
|
100
|
+
additionallyFundedAccounts: await generateSchnorrAccounts(1, 'schnorr'),
|
|
101
|
+
pxeCreationOptions: { hooks: { resolveTaggingSecretStrategy: senderHook } },
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
({ wallet: walletRecipient, teardown: teardownRecipient } = await setupPXEAndGetWallet(
|
|
105
|
+
aztecNode,
|
|
106
|
+
aztecNode,
|
|
107
|
+
{},
|
|
108
|
+
undefined,
|
|
109
|
+
'pxe-recipient',
|
|
110
|
+
));
|
|
111
|
+
const recipientAccount = await walletRecipient.createSchnorrAccount(
|
|
112
|
+
additionallyFundedAccounts[0].secret,
|
|
113
|
+
additionallyFundedAccounts[0].salt,
|
|
114
|
+
additionallyFundedAccounts[0].signingKey,
|
|
115
|
+
);
|
|
116
|
+
await (await recipientAccount.getDeployMethod()).send({ from: NO_FROM });
|
|
117
|
+
recipient = recipientAccount.address;
|
|
118
|
+
|
|
119
|
+
await ensureHandshakeRegistryPublished(walletSender, sender);
|
|
120
|
+
const { contract: deployed, instance } = await OnchainDeliveryTestContract.deploy(walletSender).send({
|
|
121
|
+
from: sender,
|
|
122
|
+
});
|
|
123
|
+
contractSender = deployed;
|
|
124
|
+
|
|
125
|
+
await ensureHandshakeRegistryPublished(walletRecipient, recipient);
|
|
126
|
+
await walletRecipient.registerContract(instance, OnchainDeliveryTestContract.artifact);
|
|
127
|
+
|
|
128
|
+
await recipientRegistration?.(walletRecipient, recipient, sender);
|
|
129
|
+
|
|
130
|
+
// Constrained sends to one pair are strictly ordered, so deliver one tx at a time. The first send bootstraps the
|
|
131
|
+
// handshake (when the source is a handshake); the rest reuse it.
|
|
132
|
+
const blockNumbers: number[] = [];
|
|
133
|
+
for (const value of eventValues) {
|
|
134
|
+
const { receipt } = await sendEvent(value).send({ from: sender });
|
|
135
|
+
blockNumbers.push(receipt.blockNumber!);
|
|
136
|
+
}
|
|
137
|
+
for (const value of noteValues) {
|
|
138
|
+
await sendNote(value).send({ from: sender });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
await walletRecipient.sync();
|
|
142
|
+
|
|
143
|
+
const events = await walletRecipient.getPrivateEvents<DeliveryEvent>(
|
|
144
|
+
OnchainDeliveryTestContract.events.DeliveryEvent,
|
|
145
|
+
{
|
|
146
|
+
contractAddress: contractSender.address,
|
|
147
|
+
fromBlock: BlockNumber(Math.min(...blockNumbers)),
|
|
148
|
+
toBlock: BlockNumber(Math.max(...blockNumbers) + 1),
|
|
149
|
+
scopes: [recipient],
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
discoveredEvents = events.map(e => e.event.value);
|
|
153
|
+
|
|
154
|
+
const contractRecipient = OnchainDeliveryTestContract.at(contractSender.address, walletRecipient);
|
|
155
|
+
const { result } = await contractRecipient.methods.get_note_values(recipient).simulate({ from: recipient });
|
|
156
|
+
readNotes = result.storage.slice(0, Number(result.len));
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
afterAll(async () => {
|
|
160
|
+
await teardownRecipient();
|
|
161
|
+
await teardownSender();
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('the recipient PXE discovers the events delivered by the sender PXE', () => {
|
|
165
|
+
expect(discoveredEvents.length).toBe(eventValues.length);
|
|
166
|
+
for (const value of eventValues) {
|
|
167
|
+
expect(discoveredEvents).toContainEqual(value);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('the recipient PXE reads back the notes delivered by the sender PXE', () => {
|
|
172
|
+
expect(readNotes).toEqual(noteValues);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
additionalTests?.();
|
|
176
|
+
});
|
|
177
|
+
}
|