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