@aztec/end-to-end 0.0.1-commit.c2eed6949 → 0.0.1-commit.c52d6e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +229 -14
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +23 -36
- package/dest/automine/token/token_contract_test.d.ts +40 -0
- package/dest/automine/token/token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +24 -39
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +19 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +56 -58
- package/dest/bench/client_flows/data_extractor.js +1 -0
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +97 -6
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.d.ts +1 -1
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -0
- package/dest/fixtures/e2e_prover_test.d.ts +12 -9
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +53 -35
- package/dest/fixtures/fixtures.d.ts +79 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +80 -0
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -2
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +2 -2
- 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 +81 -42
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +289 -198
- package/dest/fixtures/setup_p2p_test.d.ts +10 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +11 -11
- package/dest/fixtures/standard_contracts_genesis.d.ts +16 -0
- package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
- package/dest/fixtures/standard_contracts_genesis.js +25 -0
- package/dest/fixtures/timing.d.ts +42 -0
- package/dest/fixtures/timing.d.ts.map +1 -0
- package/dest/fixtures/timing.js +72 -0
- package/dest/fixtures/token_utils.d.ts +22 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +23 -6
- package/dest/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- package/dest/fixtures/wait_helpers.d.ts +135 -0
- package/dest/fixtures/wait_helpers.d.ts.map +1 -0
- package/dest/fixtures/wait_helpers.js +154 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/multi-node/block-production/setup.d.ts +97 -0
- package/dest/multi-node/block-production/setup.d.ts.map +1 -0
- package/dest/multi-node/block-production/setup.js +158 -0
- package/dest/multi-node/governance/setup.d.ts +67 -0
- package/dest/multi-node/governance/setup.d.ts.map +1 -0
- package/dest/multi-node/governance/setup.js +126 -0
- package/dest/multi-node/multi_node_test_context.d.ts +212 -0
- package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
- package/dest/multi-node/multi_node_test_context.js +347 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/inactivity_setup.js +111 -0
- package/dest/multi-node/slashing/setup.d.ts +167 -0
- package/dest/multi-node/slashing/setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/setup.js +275 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +19 -10
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +82 -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 +33 -21
- 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 +26 -15
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +12 -5
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +365 -0
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +50 -37
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/lending_simulator.d.ts +10 -3
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +24 -12
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
- package/dest/single-node/fees/fees_test.d.ts +95 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/single-node/fees/fees_test.js +344 -0
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +374 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +847 -0
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +84 -50
- package/dest/spartan/tx_metrics.d.ts +27 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +105 -20
- package/dest/spartan/utils/config.d.ts +9 -35
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +2 -2
- package/dest/test-wallet/test_wallet.d.ts +39 -10
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +166 -59
- package/dest/test-wallet/utils.d.ts +38 -3
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +65 -10
- package/dest/test-wallet/wallet_worker_script.js +12 -4
- package/dest/test-wallet/worker_wallet.d.ts +9 -8
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +10 -4
- package/dest/test-wallet/worker_wallet_schema.d.ts +3 -273
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet_schema.js +15 -2
- package/package.json +47 -42
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
- package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +24 -47
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +25 -48
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +21 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +106 -80
- 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 +68 -52
- package/src/fixtures/fixtures.ts +100 -0
- package/src/fixtures/get_acvm_config.ts +2 -8
- package/src/fixtures/get_bb_config.ts +1 -2
- 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 +361 -256
- package/src/fixtures/setup_p2p_test.ts +15 -11
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +40 -8
- package/src/fixtures/utils.ts +2 -3
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +106 -0
- package/src/guides/up_quick_start.sh +5 -2
- package/src/infra/README.md +12 -0
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/multi-node/README.md +96 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +95 -50
- 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 +36 -17
- package/src/shared/gas_portal_test_harness.ts +34 -17
- package/src/shared/submit-transactions.ts +13 -5
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +80 -43
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +28 -14
- package/src/single-node/README.md +66 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
- package/src/single-node/fees/fees_test.ts +434 -0
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1058 -0
- package/src/spartan/setup_test_wallets.ts +87 -47
- package/src/spartan/tx_metrics.ts +107 -23
- package/src/spartan/utils/nodes.ts +2 -2
- package/src/test-wallet/test_wallet.ts +185 -60
- package/src/test-wallet/utils.ts +104 -11
- package/src/test-wallet/wallet_worker_script.ts +11 -5
- package/src/test-wallet/worker_wallet.ts +19 -16
- package/src/test-wallet/worker_wallet_schema.ts +4 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -55
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -129
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -50
- package/dest/e2e_epochs/epochs_test.d.ts +0 -104
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -389
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -88
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.js +0 -255
- 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_fees/fees_test.ts +0 -331
- 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/src/fixtures/setup.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
1
|
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
|
-
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
|
-
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
|
+
import { type AztecNodeConfig, AztecNodeService, createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
3
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
6
|
-
import {
|
|
7
|
-
BatchCall,
|
|
8
|
-
type ContractFunctionInteraction,
|
|
9
|
-
type ContractMethod,
|
|
10
|
-
getContractClassFromArtifact,
|
|
11
|
-
waitForProven,
|
|
12
|
-
} from '@aztec/aztec.js/contracts';
|
|
4
|
+
import type { ContractMethod } from '@aztec/aztec.js/contracts';
|
|
13
5
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
14
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
15
7
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
16
8
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
9
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
18
|
-
import {
|
|
10
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
19
11
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
20
12
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
21
13
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -30,28 +22,33 @@ import {
|
|
|
30
22
|
deployAztecL1Contracts,
|
|
31
23
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
32
24
|
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
33
|
-
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
25
|
+
import { EthCheatCodes, EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
|
|
34
26
|
import type { Anvil } from '@aztec/ethereum/test';
|
|
27
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
35
28
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
36
29
|
import { SecretValue } from '@aztec/foundation/config';
|
|
37
30
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
38
31
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
39
32
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
40
33
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
41
|
-
import { sleep } from '@aztec/foundation/sleep';
|
|
42
34
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
43
35
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
44
36
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
45
37
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
46
38
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
47
39
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
48
|
-
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
49
|
-
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
40
|
+
import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
|
|
41
|
+
import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
|
|
50
42
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
43
|
+
import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
44
|
+
import { HandshakeRegistryArtifact, getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
|
|
45
|
+
import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
|
|
46
|
+
import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
|
|
51
47
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
52
|
-
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
48
|
+
import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
53
49
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
54
50
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
51
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
55
52
|
import {
|
|
56
53
|
type TelemetryClient,
|
|
57
54
|
type TelemetryClientConfig,
|
|
@@ -59,7 +56,7 @@ import {
|
|
|
59
56
|
initTelemetryClient,
|
|
60
57
|
} from '@aztec/telemetry-client';
|
|
61
58
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
62
|
-
import {
|
|
59
|
+
import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
|
|
63
60
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
64
61
|
|
|
65
62
|
import fs from 'fs/promises';
|
|
@@ -80,6 +77,8 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
|
|
|
80
77
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
81
78
|
import { getBBConfig } from './get_bb_config.js';
|
|
82
79
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
80
|
+
import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
|
|
81
|
+
import { testSpan } from './timing.js';
|
|
83
82
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
84
83
|
|
|
85
84
|
export { startAnvil };
|
|
@@ -112,6 +111,8 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
|
|
|
112
111
|
/**
|
|
113
112
|
* Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
|
|
114
113
|
* @param aztecNode - An instance of Aztec Node.
|
|
114
|
+
* @param nodeDebug - The node's debug API, used to register public function signatures for named traces; pass
|
|
115
|
+
* `undefined` when the node does not expose it.
|
|
115
116
|
* @param opts - Partial configuration for the PXE.
|
|
116
117
|
* @param logger - The logger to be used.
|
|
117
118
|
* @param actor - Actor label to include in log output (e.g., 'pxe-test').
|
|
@@ -119,6 +120,7 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
|
|
|
119
120
|
*/
|
|
120
121
|
export async function setupPXEAndGetWallet(
|
|
121
122
|
aztecNode: AztecNode,
|
|
123
|
+
nodeDebug: AztecNodeDebug | undefined,
|
|
122
124
|
opts: Partial<PXEConfig> = {},
|
|
123
125
|
logger = getLogger(),
|
|
124
126
|
actor?: string,
|
|
@@ -139,7 +141,10 @@ export async function setupPXEAndGetWallet(
|
|
|
139
141
|
|
|
140
142
|
const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
|
|
141
143
|
|
|
142
|
-
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
144
|
+
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
145
|
+
loggerActorLabel: actor,
|
|
146
|
+
nodeDebug,
|
|
147
|
+
});
|
|
143
148
|
|
|
144
149
|
return {
|
|
145
150
|
wallet,
|
|
@@ -149,7 +154,7 @@ export async function setupPXEAndGetWallet(
|
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
/** Options for the e2e tests setup */
|
|
152
|
-
export type SetupOptions = {
|
|
157
|
+
export type SetupOptions<TDeployExtraL1ContractsReturnType = unknown> = {
|
|
153
158
|
/** State load */
|
|
154
159
|
stateLoad?: string;
|
|
155
160
|
/** Whether to enable metrics collection, if undefined, metrics collection is disabled */
|
|
@@ -158,10 +163,11 @@ export type SetupOptions = {
|
|
|
158
163
|
deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
|
|
159
164
|
/** Initial fee juice for default accounts */
|
|
160
165
|
initialAccountFeeJuice?: Fr;
|
|
161
|
-
/**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Extra accounts to fund at genesis beyond the `numberOfAccounts` initializerless accounts that setup
|
|
168
|
+
* creates. Setup funds these but does NOT create or deploy them — the test creates/deploys them itself
|
|
169
|
+
*/
|
|
170
|
+
additionallyFundedAccounts?: InitialAccountData[];
|
|
165
171
|
/** An initial set of validators */
|
|
166
172
|
initialValidators?: (Operator & { privateKey: `0x${string}` })[];
|
|
167
173
|
/** Anvil Start time */
|
|
@@ -178,10 +184,28 @@ export type SetupOptions = {
|
|
|
178
184
|
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
179
185
|
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
180
186
|
mockGossipSubNetwork?: boolean;
|
|
181
|
-
/** Whether to
|
|
182
|
-
|
|
183
|
-
/**
|
|
187
|
+
/** Whether to add simulated latency to the mock gossipsub network (in ms) */
|
|
188
|
+
mockGossipSubNetworkLatency?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Whether to mine the L1 setup txs (Multicall3 + rollup contract deployment) under anvil automine
|
|
191
|
+
* instead of waiting on the block interval. Defaults to `true` (set in `setupInner`); only suites
|
|
192
|
+
* that assert on genesis-relative L1 timing need to opt out with `false`.
|
|
193
|
+
*/
|
|
184
194
|
automineL1Setup?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Hook invoked after the Aztec L1 rollup contracts are deployed but BEFORE the node/sequencer
|
|
197
|
+
* start, while anvil automine is still enabled (when `automineL1Setup` is true, the default).
|
|
198
|
+
* Deploy extra L1 contracts a test needs here (e.g. a cross-chain token portal + ERC20) so they
|
|
199
|
+
* mine instantly under automine instead of paying the L1 block interval once the node is running
|
|
200
|
+
* (and racing the live sequencer/archiver). The resolved value is exposed on the returned context
|
|
201
|
+
* as `extraL1DeployResult`. The hook receives setup's L1 deployer client (the same one used to
|
|
202
|
+
* deploy Multicall3).
|
|
203
|
+
*/
|
|
204
|
+
deployExtraL1Contracts?: (deps: {
|
|
205
|
+
l1Client: ExtendedViemWalletClient;
|
|
206
|
+
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
207
|
+
logger: Logger;
|
|
208
|
+
}) => Promise<TDeployExtraL1ContractsReturnType>;
|
|
185
209
|
/** How many accounts to seed and unlock in anvil. */
|
|
186
210
|
anvilAccounts?: number;
|
|
187
211
|
/** Port to start anvil (defaults to 8545) */
|
|
@@ -197,20 +221,34 @@ export type SetupOptions = {
|
|
|
197
221
|
zkPassportArgs?: ZKPassportArgs;
|
|
198
222
|
/** Whether to fund the sponsored FPC in genesis (defaults to false). */
|
|
199
223
|
fundSponsoredFPC?: boolean;
|
|
200
|
-
/**
|
|
201
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Compute extra addresses to fund at genesis from the accounts setup just generated (passed as the
|
|
226
|
+
* argument). Runs after the default accounts are created and before genesis values are computed, so a
|
|
227
|
+
* test can genesis-fund a contract whose address derives from a default account (e.g. an FPC whose
|
|
228
|
+
* admin is the first account) instead of bridging fee juice to it during setup. Each returned address
|
|
229
|
+
* is funded with the same fee juice as an initial account and included in the L1 portal `fundingNeeded`.
|
|
230
|
+
*/
|
|
231
|
+
computeExtraGenesisFundedAddresses?: (defaultAccounts: InitialAccountData[]) => Promise<AztecAddress[]>;
|
|
202
232
|
/** L1 contracts deployment arguments. */
|
|
203
233
|
l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
|
|
204
|
-
/** Wallet minimum fee padding multiplier
|
|
234
|
+
/** Wallet minimum fee padding multiplier */
|
|
205
235
|
walletMinFeePadding?: number;
|
|
236
|
+
/** Whether the initial node should be a lightweight RPC-only node (no sequencer, no validator).
|
|
237
|
+
* Use for tests that create their own validator nodes and don't need the initial sequencer. */
|
|
238
|
+
skipInitialSequencer?: boolean;
|
|
239
|
+
/** Whether to swap the production Sequencer for the minimal AutomineSequencer.
|
|
240
|
+
* Use only for single-sequencer non-block-building tests. See AUTOMINE_E2E_OPTS in `fixtures.ts`. */
|
|
241
|
+
useAutomineSequencer?: boolean;
|
|
242
|
+
/** Options forwarded to PXE creation (e.g. execution hooks). */
|
|
243
|
+
pxeCreationOptions?: PXECreationOptions;
|
|
206
244
|
} & Partial<AztecNodeConfig>;
|
|
207
245
|
|
|
208
246
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
209
|
-
export type EndToEndContext = {
|
|
247
|
+
export type EndToEndContext<TDeployExtraL1ContractsReturnType = unknown> = {
|
|
210
248
|
/** The Anvil instance (only set if anvil was started locally). */
|
|
211
249
|
anvil: Anvil | undefined;
|
|
212
250
|
/** The Aztec Node service or client a connected to it. */
|
|
213
|
-
aztecNode: AztecNode;
|
|
251
|
+
aztecNode: AztecNode & AztecNodeDebug;
|
|
214
252
|
/** The Aztec Node as a service. */
|
|
215
253
|
aztecNodeService: AztecNodeService;
|
|
216
254
|
/** Client to the Aztec Node admin interface. */
|
|
@@ -225,8 +263,8 @@ export type EndToEndContext = {
|
|
|
225
263
|
config: AztecNodeConfig;
|
|
226
264
|
/** The Aztec Node configuration (alias for config for backward compatibility). */
|
|
227
265
|
aztecNodeConfig: AztecNodeConfig;
|
|
228
|
-
/**
|
|
229
|
-
|
|
266
|
+
/** Data for the extra accounts funded at genesis but not created by setup (the test creates/deploys them). */
|
|
267
|
+
additionallyFundedAccounts: InitialAccountData[];
|
|
230
268
|
/** The wallet to be used. */
|
|
231
269
|
wallet: TestWallet;
|
|
232
270
|
/** The wallets to be used. */
|
|
@@ -237,8 +275,6 @@ export type EndToEndContext = {
|
|
|
237
275
|
cheatCodes: CheatCodes;
|
|
238
276
|
/** The cheat codes for L1 */
|
|
239
277
|
ethCheatCodes: EthCheatCodes;
|
|
240
|
-
/** The anvil test watcher. */
|
|
241
|
-
watcher: AnvilTestWatcher;
|
|
242
278
|
/** Allows tweaking current system time, used by the epoch cache only. */
|
|
243
279
|
dateProvider: TestDateProvider;
|
|
244
280
|
/** Telemetry client */
|
|
@@ -249,8 +285,10 @@ export type EndToEndContext = {
|
|
|
249
285
|
sequencerDelayer: Delayer | undefined;
|
|
250
286
|
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
251
287
|
proverDelayer: Delayer | undefined;
|
|
252
|
-
/**
|
|
253
|
-
|
|
288
|
+
/** Genesis data used for setting up nodes. */
|
|
289
|
+
genesis: GenesisData | undefined;
|
|
290
|
+
/** Resolved value of the `deployExtraL1Contracts` setup hook, if one was provided. */
|
|
291
|
+
extraL1DeployResult: TDeployExtraL1ContractsReturnType;
|
|
254
292
|
/** ACVM config (only set if running locally). */
|
|
255
293
|
acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
|
|
256
294
|
/** BB config (only set if running locally). */
|
|
@@ -261,22 +299,75 @@ export type EndToEndContext = {
|
|
|
261
299
|
teardown: () => Promise<void>;
|
|
262
300
|
};
|
|
263
301
|
|
|
302
|
+
/**
|
|
303
|
+
* When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
|
|
304
|
+
* aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
|
|
305
|
+
* actually swapped in the correct version.
|
|
306
|
+
*/
|
|
307
|
+
function assertContractArtifactsVersion() {
|
|
308
|
+
const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
|
|
309
|
+
if (!expected) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const { aztecVersion } = SponsoredFPCContract.artifact;
|
|
313
|
+
// TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
|
|
314
|
+
if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
|
|
315
|
+
createLogger('e2e:setup').info(
|
|
316
|
+
`Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`,
|
|
317
|
+
);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (aztecVersion !== expected) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
`Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` +
|
|
323
|
+
`The legacy artifact resolver may not have swapped in the correct version.`,
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
264
328
|
/**
|
|
265
329
|
* Sets up the environment for the end-to-end tests.
|
|
266
330
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
267
331
|
* @param opts - Options to pass to the node initialization and to the setup script.
|
|
268
332
|
* @param pxeOpts - Options to pass to the PXE initialization.
|
|
269
333
|
*/
|
|
270
|
-
export
|
|
334
|
+
export function setup<TDeployExtraL1ContractsReturnType = unknown>(
|
|
271
335
|
numberOfAccounts = 1,
|
|
272
|
-
opts: SetupOptions = {},
|
|
336
|
+
opts: SetupOptions<TDeployExtraL1ContractsReturnType> = {},
|
|
273
337
|
pxeOpts: Partial<PXEConfig> = {},
|
|
274
338
|
chain: Chain = foundry,
|
|
275
|
-
): Promise<EndToEndContext
|
|
339
|
+
): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
|
|
340
|
+
// Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
|
|
341
|
+
// swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
|
|
342
|
+
// (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
|
|
343
|
+
const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
|
|
344
|
+
return testSpan(`setup:env:${proverMode}`, async () => {
|
|
345
|
+
const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
|
|
346
|
+
if (process.env.EXIT_E2E_AFTER_SETUP) {
|
|
347
|
+
ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
|
|
348
|
+
throw new Error('EXIT_E2E_AFTER_SETUP');
|
|
349
|
+
}
|
|
350
|
+
return ctx;
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
async function setupInner<TDeployExtraL1ContractsReturnType = unknown>(
|
|
355
|
+
numberOfAccounts: number,
|
|
356
|
+
opts: SetupOptions<TDeployExtraL1ContractsReturnType>,
|
|
357
|
+
pxeOpts: Partial<PXEConfig>,
|
|
358
|
+
chain: Chain,
|
|
359
|
+
): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
|
|
360
|
+
assertContractArtifactsVersion();
|
|
361
|
+
const logger = getLogger();
|
|
276
362
|
let anvil: Anvil | undefined;
|
|
277
363
|
try {
|
|
278
364
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
279
|
-
opts.
|
|
365
|
+
opts.slasherEnabled ??= false;
|
|
366
|
+
// Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
|
|
367
|
+
// waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
|
|
368
|
+
// assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
|
|
369
|
+
opts.automineL1Setup ??= true;
|
|
370
|
+
logger.trace('Starting e2e test setup');
|
|
280
371
|
|
|
281
372
|
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
282
373
|
// use initialValidators for the node config
|
|
@@ -286,16 +377,12 @@ export async function setup(
|
|
|
286
377
|
config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
|
|
287
378
|
// For tests we only want proving enabled if specifically requested
|
|
288
379
|
config.realProofs = !!opts.realProofs;
|
|
289
|
-
// Only enforce the time table if requested
|
|
290
|
-
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
291
380
|
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
292
381
|
config.enableDelayer = true;
|
|
293
382
|
config.listenAddress = '127.0.0.1';
|
|
294
383
|
|
|
295
384
|
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
296
385
|
|
|
297
|
-
const logger = getLogger();
|
|
298
|
-
|
|
299
386
|
// Create a temp directory for any services that need it and cleanup later
|
|
300
387
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
301
388
|
await fs.mkdir(directoryToCleanup, { recursive: true });
|
|
@@ -309,16 +396,19 @@ export async function setup(
|
|
|
309
396
|
if (!isAnvilTestChain(chain.id)) {
|
|
310
397
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
311
398
|
}
|
|
312
|
-
const res = await
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
399
|
+
const res = await testSpan('setup:env:anvil', () =>
|
|
400
|
+
startAnvil({
|
|
401
|
+
l1BlockTime: opts.ethereumSlotDuration,
|
|
402
|
+
accounts: opts.anvilAccounts,
|
|
403
|
+
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
404
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
405
|
+
dateProvider,
|
|
406
|
+
}),
|
|
407
|
+
);
|
|
319
408
|
anvil = res.anvil;
|
|
320
409
|
config.l1RpcUrls = [res.rpcUrl];
|
|
321
410
|
}
|
|
411
|
+
logger.trace('Started anvil and L1 RPC client');
|
|
322
412
|
|
|
323
413
|
// Enable logging metrics to a local file named after the test suite
|
|
324
414
|
if (isMetricsLoggingRequested()) {
|
|
@@ -335,6 +425,7 @@ export async function setup(
|
|
|
335
425
|
if (opts.l1StartTime) {
|
|
336
426
|
await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
|
|
337
427
|
}
|
|
428
|
+
logger.trace('Initialized L1 cheat codes and applied state/time overrides');
|
|
338
429
|
|
|
339
430
|
let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
|
|
340
431
|
let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
|
|
@@ -362,12 +453,14 @@ export async function setup(
|
|
|
362
453
|
if (config.coinbase === undefined) {
|
|
363
454
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
364
455
|
}
|
|
456
|
+
logger.trace('Resolved L1 publisher account');
|
|
365
457
|
|
|
366
|
-
//
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const
|
|
458
|
+
// The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
|
|
459
|
+
// funded at genesis so they are immediately usable.
|
|
460
|
+
const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
|
|
461
|
+
// Extra accounts the test wants funded at genesis but will create/deploy itself.
|
|
462
|
+
const additionallyFundedAccounts = opts.additionallyFundedAccounts ?? [];
|
|
463
|
+
const addressesToFund = [...defaultAccounts, ...additionallyFundedAccounts].map(a => a.address);
|
|
371
464
|
|
|
372
465
|
// Optionally fund the sponsored FPC
|
|
373
466
|
if (opts.fundSponsoredFPC) {
|
|
@@ -375,11 +468,29 @@ export async function setup(
|
|
|
375
468
|
addressesToFund.push(sponsoredFPCAddress);
|
|
376
469
|
}
|
|
377
470
|
|
|
378
|
-
|
|
471
|
+
// Fund any extra addresses whose value depends on the just-generated accounts (e.g. an FPC admin'd
|
|
472
|
+
// by a default account), so a test can genesis-fund them instead of bridging fee juice during setup.
|
|
473
|
+
if (opts.computeExtraGenesisFundedAddresses) {
|
|
474
|
+
addressesToFund.push(...(await opts.computeExtraGenesisFundedAddresses(defaultAccounts)));
|
|
475
|
+
}
|
|
476
|
+
logger.trace('Generated test accounts to fund at genesis');
|
|
477
|
+
|
|
478
|
+
// Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) so their `ensure*Published` setup
|
|
479
|
+
// helpers short-circuit their publish txs. The archiver flag seeds the bytecode/instance into every spawned node's
|
|
480
|
+
// contract store; the genesis nullifiers make the AVM's deployment-nullifier check pass when they are called. Both
|
|
481
|
+
// must go together (flag alone would recreate the publish-collision bug), so the flag lives here beside the seeding.
|
|
482
|
+
config.testPreloadStandardContracts = true;
|
|
483
|
+
const standardContractNullifiers = await getStandardContractGenesisNullifiers();
|
|
484
|
+
|
|
485
|
+
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
486
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
|
|
379
487
|
addressesToFund,
|
|
380
488
|
opts.initialAccountFeeJuice,
|
|
381
489
|
opts.genesisPublicData,
|
|
490
|
+
genesisTimestamp,
|
|
491
|
+
standardContractNullifiers,
|
|
382
492
|
);
|
|
493
|
+
logger.trace('Computed genesis values');
|
|
383
494
|
|
|
384
495
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
385
496
|
const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
|
|
@@ -389,18 +500,21 @@ export async function setup(
|
|
|
389
500
|
|
|
390
501
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
|
|
391
502
|
|
|
503
|
+
// Warm both KZG trusted setups (ours + anvil's) in parallel
|
|
504
|
+
if (anvil && isAnvilTestChain(chain.id)) {
|
|
505
|
+
await warmBlobKzg(l1Client, logger);
|
|
506
|
+
}
|
|
507
|
+
|
|
392
508
|
// Deploy Multicall3 if running locally
|
|
393
509
|
await deployMulticall3(l1Client, logger);
|
|
394
510
|
|
|
395
511
|
// Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
|
|
396
512
|
// This is necessary because deployMulticall3 sends multiple transactions and viem may cache a stale nonce
|
|
397
513
|
await l1Client.getTransactionCount({ address: l1Client.account.address });
|
|
514
|
+
logger.trace('Deployed Multicall3');
|
|
398
515
|
|
|
399
|
-
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await
|
|
400
|
-
config.l1RpcUrls[0],
|
|
401
|
-
publisherPrivKeyHex!,
|
|
402
|
-
chain.id,
|
|
403
|
-
{
|
|
516
|
+
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await testSpan('setup:env:l1-deploy', () =>
|
|
517
|
+
deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex!, chain.id, {
|
|
404
518
|
...getL1ContractsConfigEnvVars(),
|
|
405
519
|
...opts,
|
|
406
520
|
...opts.l1ContractsArgs,
|
|
@@ -410,20 +524,52 @@ export async function setup(
|
|
|
410
524
|
initialValidators: opts.initialValidators,
|
|
411
525
|
feeJuicePortalInitialBalance: fundingNeeded,
|
|
412
526
|
realVerifier: false,
|
|
413
|
-
},
|
|
527
|
+
}),
|
|
414
528
|
);
|
|
415
529
|
|
|
416
|
-
config
|
|
530
|
+
Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
|
|
417
531
|
config.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
418
532
|
|
|
533
|
+
// Propagate L1-contracts-config overrides back to the node config so the archiver's
|
|
534
|
+
// `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
|
|
535
|
+
// Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
|
|
536
|
+
// but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
|
|
537
|
+
// `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
|
|
538
|
+
// `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
|
|
539
|
+
// Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
|
|
540
|
+
// by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
|
|
541
|
+
// as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
|
|
542
|
+
// in this function and crash `setupSharedBlobStorage`.
|
|
543
|
+
if (opts.l1ContractsArgs) {
|
|
544
|
+
for (const [key, value] of Object.entries(opts.l1ContractsArgs)) {
|
|
545
|
+
if (value !== undefined) {
|
|
546
|
+
(config as unknown as Record<string, unknown>)[key] = value;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// Deploy any test-specific L1 contracts while automine is still on and before the node starts,
|
|
552
|
+
// so they mine instantly rather than paying the L1 block interval once the sequencer is live.
|
|
553
|
+
let extraL1DeployResult: TDeployExtraL1ContractsReturnType = undefined as TDeployExtraL1ContractsReturnType;
|
|
554
|
+
if (opts.deployExtraL1Contracts) {
|
|
555
|
+
logger.trace('Running deployExtraL1Contracts hook');
|
|
556
|
+
extraL1DeployResult = await opts.deployExtraL1Contracts({
|
|
557
|
+
l1Client,
|
|
558
|
+
deployL1ContractsValues,
|
|
559
|
+
logger,
|
|
560
|
+
});
|
|
561
|
+
// The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
|
|
562
|
+
// stale cached nonce for later transactions on the publisher account.
|
|
563
|
+
await l1Client.getTransactionCount({ address: l1Client.account.address });
|
|
564
|
+
}
|
|
565
|
+
|
|
419
566
|
if (enableAutomine) {
|
|
420
|
-
await ethCheatCodes.
|
|
421
|
-
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
567
|
+
await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
|
|
422
568
|
}
|
|
423
569
|
|
|
424
570
|
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
425
|
-
// ahead of system time
|
|
426
|
-
//
|
|
571
|
+
// ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
|
|
572
|
+
// the stdout listener.
|
|
427
573
|
if (!anvil) {
|
|
428
574
|
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
429
575
|
}
|
|
@@ -431,61 +577,43 @@ export async function setup(
|
|
|
431
577
|
if (opts.l2StartTime) {
|
|
432
578
|
await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
|
|
433
579
|
}
|
|
580
|
+
logger.trace('Deployed L1 rollup contracts');
|
|
581
|
+
|
|
582
|
+
// These boot steps are independent and write disjoint config keys, so run them concurrently:
|
|
583
|
+
// telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
|
|
584
|
+
// and the ACVM/BB config resolvers write their own acvm*/bb* keys.
|
|
585
|
+
const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
|
|
586
|
+
// Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
|
|
587
|
+
opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
|
|
588
|
+
setupSharedBlobStorage(config),
|
|
589
|
+
getACVMConfig(logger),
|
|
590
|
+
getBBConfig(logger),
|
|
591
|
+
]);
|
|
592
|
+
logger.trace('Created telemetry client');
|
|
593
|
+
logger.trace('Set up shared blob storage');
|
|
434
594
|
|
|
435
|
-
const watcher = new AnvilTestWatcher(
|
|
436
|
-
new EthCheatCodesWithState(config.l1RpcUrls, dateProvider),
|
|
437
|
-
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
438
|
-
deployL1ContractsValues.l1Client,
|
|
439
|
-
dateProvider,
|
|
440
|
-
);
|
|
441
|
-
if (!opts.disableAnvilTestWatcher) {
|
|
442
|
-
await watcher.start();
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
|
|
446
|
-
const telemetryClient = opts.metricsPort
|
|
447
|
-
? await getEndToEndTestTelemetryClient(opts.metricsPort)
|
|
448
|
-
: await getTelemetryClient(opts.telemetryConfig);
|
|
449
|
-
|
|
450
|
-
await setupSharedBlobStorage(config);
|
|
451
|
-
|
|
452
|
-
logger.verbose('Creating and synching an aztec node', config);
|
|
453
|
-
|
|
454
|
-
const acvmConfig = await getACVMConfig(logger);
|
|
455
595
|
if (acvmConfig) {
|
|
456
596
|
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
457
597
|
config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
|
|
458
598
|
}
|
|
599
|
+
logger.trace('Resolved ACVM config');
|
|
459
600
|
|
|
460
|
-
const bbConfig = await getBBConfig(logger);
|
|
461
601
|
if (bbConfig) {
|
|
462
602
|
config.bbBinaryPath = bbConfig.bbBinaryPath;
|
|
463
603
|
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
464
604
|
}
|
|
605
|
+
logger.trace('Resolved Barretenberg config');
|
|
606
|
+
|
|
607
|
+
logger.verbose('Creating and synching an aztec node', config);
|
|
465
608
|
|
|
466
609
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
467
610
|
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
468
611
|
|
|
469
612
|
if (opts.mockGossipSubNetwork) {
|
|
470
|
-
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
613
|
+
mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
|
|
471
614
|
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
472
615
|
}
|
|
473
616
|
|
|
474
|
-
// Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
|
|
475
|
-
// To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
|
|
476
|
-
// For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
|
|
477
|
-
// If no accounts need deployment, we await an empty block to confirm network progression.
|
|
478
|
-
const originalMinTxsPerBlock = config.minTxsPerBlock;
|
|
479
|
-
if (originalMinTxsPerBlock === undefined) {
|
|
480
|
-
throw new Error('minTxsPerBlock is undefined in e2e test setup');
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
// Only set minTxsPerBlock=1 if we're going to deploy accounts and need reliable block inclusion
|
|
484
|
-
const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
|
|
485
|
-
// Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
|
|
486
|
-
const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
|
|
487
|
-
config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
|
|
488
|
-
|
|
489
617
|
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
490
618
|
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
491
619
|
|
|
@@ -495,14 +623,29 @@ export async function setup(
|
|
|
495
623
|
}
|
|
496
624
|
}
|
|
497
625
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
626
|
+
// When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
|
|
627
|
+
// We apply these overrides to a copy so they don't leak into the returned config.
|
|
628
|
+
// Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
|
|
629
|
+
const initialNodeConfig = opts.skipInitialSequencer
|
|
630
|
+
? {
|
|
631
|
+
...config,
|
|
632
|
+
disableValidator: true,
|
|
633
|
+
...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
|
|
634
|
+
}
|
|
635
|
+
: config;
|
|
636
|
+
logger.trace('Prepared aztec node config');
|
|
637
|
+
|
|
638
|
+
const aztecNodeService = await testSpan('setup:env:sequencer-start', () =>
|
|
639
|
+
withLoggerBindings({ actor: 'node-0' }, () =>
|
|
640
|
+
createAztecNodeService(
|
|
641
|
+
initialNodeConfig,
|
|
642
|
+
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
643
|
+
{ genesis, dontStartSequencer: opts.skipInitialSequencer },
|
|
644
|
+
),
|
|
503
645
|
),
|
|
504
646
|
);
|
|
505
647
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
648
|
+
logger.trace('Created and synced aztec node');
|
|
506
649
|
|
|
507
650
|
let proverNode: AztecNodeService | undefined = undefined;
|
|
508
651
|
if (opts.startProverNode) {
|
|
@@ -516,16 +659,19 @@ export async function setup(
|
|
|
516
659
|
rpcTxProviders: [aztecNodeService],
|
|
517
660
|
};
|
|
518
661
|
|
|
519
|
-
({ proverNode } = await
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
662
|
+
({ proverNode } = await testSpan('setup:env:prover-node', () =>
|
|
663
|
+
createAndSyncProverNode(
|
|
664
|
+
proverNodePrivateKeyHex,
|
|
665
|
+
config,
|
|
666
|
+
{
|
|
667
|
+
...config.proverNodeConfig,
|
|
668
|
+
dataDirectory: proverNodeDataDirectory,
|
|
669
|
+
},
|
|
670
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
671
|
+
{ genesis },
|
|
672
|
+
),
|
|
528
673
|
));
|
|
674
|
+
logger.trace('Created prover node');
|
|
529
675
|
}
|
|
530
676
|
|
|
531
677
|
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
@@ -536,13 +682,22 @@ export async function setup(
|
|
|
536
682
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
537
683
|
// For tests we only want proving enabled if specifically requested
|
|
538
684
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
539
|
-
const wallet = await
|
|
685
|
+
const wallet = await testSpan('setup:env:pxe', () =>
|
|
686
|
+
TestWallet.create(aztecNodeService, pxeConfig, {
|
|
687
|
+
loggerActorLabel: 'pxe-0',
|
|
688
|
+
// In-process node implements the debug API, so register public function signatures for named traces.
|
|
689
|
+
nodeDebug: aztecNodeService,
|
|
690
|
+
...opts.pxeCreationOptions,
|
|
691
|
+
}),
|
|
692
|
+
);
|
|
540
693
|
|
|
541
694
|
if (opts.walletMinFeePadding !== undefined) {
|
|
542
695
|
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
543
696
|
}
|
|
697
|
+
logger.trace('Created PXE and test wallet');
|
|
544
698
|
|
|
545
699
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
|
|
700
|
+
logger.trace('Created cheat codes');
|
|
546
701
|
|
|
547
702
|
if (
|
|
548
703
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -556,64 +711,48 @@ export async function setup(
|
|
|
556
711
|
);
|
|
557
712
|
await cheatCodes.rollup.setupEpoch();
|
|
558
713
|
await cheatCodes.rollup.debugRollup();
|
|
714
|
+
logger.trace('Advanced chain to set up validator committee');
|
|
559
715
|
}
|
|
560
716
|
|
|
561
717
|
let accounts: AztecAddress[] = [];
|
|
562
718
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
);
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
accounts = accountManagers.map(accountManager => accountManager.address);
|
|
570
|
-
} else if (needsEmptyBlock) {
|
|
571
|
-
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
572
|
-
while ((await aztecNodeService.getBlockNumber()) === 0) {
|
|
573
|
-
await sleep(2000);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
// If skipAccountDeployment is true, we don't deploy or wait - tests will handle account deployment later
|
|
577
|
-
|
|
578
|
-
// Now we restore the original minTxsPerBlock setting if we changed it.
|
|
579
|
-
if (sequencerClient && config.minTxsPerBlock !== originalMinTxsPerBlock) {
|
|
580
|
-
sequencerClient.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
584
|
-
throw new Error(
|
|
585
|
-
`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`,
|
|
586
|
-
);
|
|
719
|
+
// Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
|
|
720
|
+
// + a simulated store call) with no on-chain tx, independent of the sequencer.
|
|
721
|
+
if (numberOfAccounts > 0) {
|
|
722
|
+
logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
|
|
723
|
+
await testSpan('wallet:create', () => createFundedInitializerlessAccounts(wallet, defaultAccounts));
|
|
724
|
+
accounts = defaultAccounts.map(a => a.address);
|
|
587
725
|
}
|
|
726
|
+
logger.trace('Created funded test accounts');
|
|
588
727
|
|
|
589
|
-
const teardown =
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
728
|
+
const teardown = () =>
|
|
729
|
+
testSpan('teardown:env', async () => {
|
|
730
|
+
try {
|
|
731
|
+
await tryStop(wallet, logger);
|
|
732
|
+
await tryStop(aztecNodeService, logger);
|
|
733
|
+
await tryStop(proverNode, logger);
|
|
594
734
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
735
|
+
if (acvmConfig?.cleanup) {
|
|
736
|
+
await acvmConfig.cleanup();
|
|
737
|
+
}
|
|
598
738
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
739
|
+
if (bbConfig?.cleanup) {
|
|
740
|
+
await bbConfig.cleanup();
|
|
741
|
+
}
|
|
602
742
|
|
|
603
|
-
|
|
604
|
-
await tryStop(anvil, logger);
|
|
743
|
+
await tryStop(anvil, logger);
|
|
605
744
|
|
|
606
|
-
|
|
607
|
-
} catch (err) {
|
|
608
|
-
logger.error(`Error during e2e test teardown`, err);
|
|
609
|
-
} finally {
|
|
610
|
-
try {
|
|
611
|
-
await telemetryClient.stop();
|
|
745
|
+
await tryRmDir(directoryToCleanup, logger);
|
|
612
746
|
} catch (err) {
|
|
613
|
-
logger.error(`Error during
|
|
747
|
+
logger.error(`Error during e2e test teardown`, err);
|
|
748
|
+
} finally {
|
|
749
|
+
try {
|
|
750
|
+
await telemetryClient.stop();
|
|
751
|
+
} catch (err) {
|
|
752
|
+
logger.error(`Error during telemetry client stop`, err);
|
|
753
|
+
}
|
|
614
754
|
}
|
|
615
|
-
}
|
|
616
|
-
};
|
|
755
|
+
});
|
|
617
756
|
|
|
618
757
|
return {
|
|
619
758
|
anvil,
|
|
@@ -626,10 +765,11 @@ export async function setup(
|
|
|
626
765
|
aztecNodeConfig: config,
|
|
627
766
|
dateProvider,
|
|
628
767
|
deployL1ContractsValues,
|
|
629
|
-
|
|
768
|
+
additionallyFundedAccounts,
|
|
630
769
|
logger,
|
|
631
770
|
mockGossipSubNetwork,
|
|
632
|
-
|
|
771
|
+
genesis,
|
|
772
|
+
extraL1DeployResult,
|
|
633
773
|
proverNode,
|
|
634
774
|
sequencerDelayer,
|
|
635
775
|
proverDelayer,
|
|
@@ -638,7 +778,6 @@ export async function setup(
|
|
|
638
778
|
telemetryClient,
|
|
639
779
|
wallet,
|
|
640
780
|
accounts,
|
|
641
|
-
watcher,
|
|
642
781
|
acvmConfig,
|
|
643
782
|
bbConfig,
|
|
644
783
|
directoryToCleanup,
|
|
@@ -705,11 +844,16 @@ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
|
|
|
705
844
|
await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
|
|
706
845
|
}
|
|
707
846
|
|
|
708
|
-
export async function waitForProvenChain(
|
|
847
|
+
export async function waitForProvenChain(
|
|
848
|
+
node: AztecNode,
|
|
849
|
+
targetBlock?: BlockNumber,
|
|
850
|
+
timeoutSec = 60,
|
|
851
|
+
intervalSec = 0.25,
|
|
852
|
+
) {
|
|
709
853
|
targetBlock ??= await node.getBlockNumber();
|
|
710
854
|
|
|
711
855
|
await retryUntil(
|
|
712
|
-
async () => (await node.
|
|
856
|
+
async () => (await node.getBlockNumber('proven')) >= targetBlock,
|
|
713
857
|
'proven chain status',
|
|
714
858
|
timeoutSec,
|
|
715
859
|
intervalSec,
|
|
@@ -728,11 +872,12 @@ export function createAndSyncProverNode(
|
|
|
728
872
|
telemetry?: TelemetryClient;
|
|
729
873
|
dateProvider: DateProvider;
|
|
730
874
|
p2pClientDeps?: P2PClientDeps;
|
|
875
|
+
proverNodeDeps?: Partial<ProverNodeDeps>;
|
|
731
876
|
},
|
|
732
|
-
options: {
|
|
877
|
+
options: { genesis?: GenesisData; dontStart?: boolean },
|
|
733
878
|
): Promise<{ proverNode: AztecNodeService }> {
|
|
734
879
|
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
735
|
-
const proverNode = await
|
|
880
|
+
const proverNode = await createAztecNodeService(
|
|
736
881
|
{
|
|
737
882
|
...baseConfig,
|
|
738
883
|
...configOverrides,
|
|
@@ -742,7 +887,7 @@ export function createAndSyncProverNode(
|
|
|
742
887
|
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
743
888
|
},
|
|
744
889
|
deps,
|
|
745
|
-
{
|
|
890
|
+
{ genesis: options.genesis, dontStartProverNode: options.dontStart },
|
|
746
891
|
);
|
|
747
892
|
|
|
748
893
|
if (!proverNode.getProverNode()) {
|
|
@@ -800,96 +945,56 @@ export async function expectMappingDelta<K, V extends number | bigint>(
|
|
|
800
945
|
}
|
|
801
946
|
|
|
802
947
|
/**
|
|
803
|
-
* Registers the contract class
|
|
804
|
-
*
|
|
948
|
+
* Registers the auth_registry contract class and publishes its standard instance if not already
|
|
949
|
+
* present, and registers the artifact with PXE. Publishing is required before exercising the public
|
|
950
|
+
* authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
|
|
951
|
+
* required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
|
|
952
|
+
* surface as generic "Assertion failed:" and tests that match on the real message fail).
|
|
805
953
|
*/
|
|
806
|
-
export async function
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
accountsAndAddresses
|
|
818
|
-
.filter(({ deployed }) => !deployed)
|
|
819
|
-
.map(({ address }) => wallet.getContractMetadata(address)),
|
|
820
|
-
)
|
|
821
|
-
).map(contractMetadata => contractMetadata.instance);
|
|
822
|
-
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
823
|
-
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
824
|
-
await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
|
|
825
|
-
}
|
|
826
|
-
const requests = instances.map(instance => publishInstance(wallet, instance!));
|
|
827
|
-
const batch = new BatchCall(wallet, requests);
|
|
828
|
-
await batch.send({ from: accountsToDeploy[0] });
|
|
954
|
+
export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
955
|
+
await testSpan('setup:auth-registry', async () => {
|
|
956
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
957
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
958
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
|
|
959
|
+
}
|
|
960
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
961
|
+
await publishInstance(wallet, instance).send({ from });
|
|
962
|
+
}
|
|
963
|
+
await wallet.registerContract(instance, AuthRegistryArtifact);
|
|
964
|
+
});
|
|
829
965
|
}
|
|
830
966
|
|
|
831
967
|
/**
|
|
832
|
-
*
|
|
833
|
-
*
|
|
968
|
+
* Registers the public_checks contract class and publishes its standard instance if not already
|
|
969
|
+
* present, and registers the artifact with PXE. Required for any contract that calls
|
|
970
|
+
* `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
|
|
971
|
+
* deployed PublicChecks contract via an enqueued public call).
|
|
834
972
|
*/
|
|
835
|
-
export
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
for (let i = 0; i < deployedAccounts.length; i++) {
|
|
846
|
-
const accountManager = await wallet.createSchnorrAccount(
|
|
847
|
-
deployedAccounts[i].secret,
|
|
848
|
-
deployedAccounts[i].salt,
|
|
849
|
-
deployedAccounts[i].signingKey,
|
|
850
|
-
);
|
|
851
|
-
const deployMethod = await accountManager.getDeployMethod();
|
|
852
|
-
await deployMethod.send({
|
|
853
|
-
from: NO_FROM,
|
|
854
|
-
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
return { deployedAccounts };
|
|
859
|
-
};
|
|
973
|
+
export async function ensurePublicChecksPublished(wallet: Wallet, from: AztecAddress) {
|
|
974
|
+
const { instance, contractClass } = await getStandardPublicChecks();
|
|
975
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
976
|
+
await (await publishContractClass(wallet, PublicChecksArtifact)).send({ from });
|
|
977
|
+
}
|
|
978
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
979
|
+
await publishInstance(wallet, instance).send({ from });
|
|
980
|
+
}
|
|
981
|
+
await wallet.registerContract(instance, PublicChecksArtifact);
|
|
982
|
+
}
|
|
860
983
|
|
|
861
984
|
/**
|
|
862
|
-
* Registers the contract class
|
|
863
|
-
*
|
|
985
|
+
* Registers the handshake_registry contract class and publishes its standard instance if not
|
|
986
|
+
* already present, and registers the artifact with PXE. Required for constrained-delivery flows
|
|
987
|
+
* that call into the HandshakeRegistry at its well-known address.
|
|
864
988
|
*/
|
|
865
|
-
export async function
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
) {
|
|
871
|
-
|
|
872
|
-
metadata => metadata.instance,
|
|
873
|
-
);
|
|
874
|
-
|
|
875
|
-
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
876
|
-
const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
|
|
877
|
-
|
|
878
|
-
const calls: ContractFunctionInteraction[] = await Promise.all([
|
|
879
|
-
...(!alreadyRegistered ? [publishContractClass(wallet, SchnorrAccountContractArtifact)] : []),
|
|
880
|
-
...instances.map(instance => publishInstance(wallet, instance!)),
|
|
881
|
-
]);
|
|
882
|
-
|
|
883
|
-
const batch = new BatchCall(wallet, calls);
|
|
884
|
-
|
|
885
|
-
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
886
|
-
if (waitUntilProven) {
|
|
887
|
-
if (!node) {
|
|
888
|
-
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
889
|
-
} else {
|
|
890
|
-
await waitForProven(node, txReceipt);
|
|
891
|
-
}
|
|
989
|
+
export async function ensureHandshakeRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
990
|
+
const { instance, contractClass } = await getStandardHandshakeRegistry();
|
|
991
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
992
|
+
await (await publishContractClass(wallet, HandshakeRegistryArtifact)).send({ from });
|
|
993
|
+
}
|
|
994
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
995
|
+
await publishInstance(wallet, instance).send({ from });
|
|
892
996
|
}
|
|
997
|
+
await wallet.registerContract(instance, HandshakeRegistryArtifact);
|
|
893
998
|
}
|
|
894
999
|
|
|
895
1000
|
/**
|