@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.017a351
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 +27 -0
- package/dest/bench/client_flows/benchmark.d.ts +76 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +298 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +318 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +124 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +79 -0
- package/dest/bench/utils.d.ts +16 -41
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +46 -72
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +30 -20
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +137 -106
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +44 -33
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +136 -103
- package/dest/e2e_deploy_contract/deploy_test.d.ts +20 -11
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +28 -28
- package/dest/e2e_epochs/epochs_test.d.ts +98 -24
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +366 -61
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +61 -0
- package/dest/e2e_fees/fees_test.d.ts +42 -24
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +194 -182
- package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +56 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +16 -16
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +38 -43
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +137 -0
- package/dest/e2e_p2p/p2p_network.d.ts +287 -31
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +281 -183
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +206 -0
- package/dest/e2e_p2p/shared.d.ts +73 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +205 -27
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts +30 -15
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +110 -76
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +56 -0
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/fixtures/e2e_prover_test.js +267 -0
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +79 -8
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +76 -5
- package/dest/fixtures/get_acvm_config.d.ts +2 -2
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +3 -15
- package/dest/fixtures/get_bb_config.d.ts +2 -2
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +10 -17
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- 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/l1_to_l2_messaging.d.ts +11 -7
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +45 -19
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +272 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +735 -0
- package/dest/fixtures/setup_p2p_test.d.ts +28 -16
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +103 -32
- package/dest/fixtures/token_utils.d.ts +10 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +30 -13
- package/dest/fixtures/utils.d.ts +5 -153
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -552
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/index.d.ts +1 -1
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +46 -27
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +113 -55
- package/dest/shared/gas_portal_test_harness.d.ts +39 -28
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +64 -34
- package/dest/shared/index.d.ts +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +42 -2
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +6 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +15 -16
- package/dest/shared/uniswap_l1_l2.d.ts +3 -25
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +202 -135
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +16 -9
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +38 -27
- package/dest/simulators/token_simulator.d.ts +6 -3
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +12 -30
- package/dest/spartan/setup_test_wallets.d.ts +36 -11
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +301 -63
- package/dest/spartan/tx_metrics.d.ts +102 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +475 -0
- package/dest/spartan/utils/bot.d.ts +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +19 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -415
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -445
- package/dest/test-wallet/test_wallet.d.ts +85 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +273 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +66 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +53 -0
- package/dest/test-wallet/worker_wallet.d.ts +53 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +155 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +22 -0
- package/package.json +79 -64
- package/src/bench/client_flows/benchmark.ts +382 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +399 -0
- package/src/bench/client_flows/config.ts +69 -0
- package/src/bench/client_flows/data_extractor.ts +89 -0
- package/src/bench/utils.ts +49 -87
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +164 -172
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +194 -183
- package/src/e2e_deploy_contract/deploy_test.ts +42 -49
- package/src/e2e_epochs/epochs_test.ts +451 -93
- package/src/e2e_fees/bridging_race.notest.ts +74 -0
- package/src/e2e_fees/fees_test.ts +249 -262
- package/src/e2e_l1_publisher/write_json.ts +77 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +51 -60
- package/src/e2e_p2p/inactivity_slash_test.ts +180 -0
- package/src/e2e_p2p/p2p_network.ts +391 -240
- package/src/e2e_p2p/reqresp/utils.ts +274 -0
- package/src/e2e_p2p/shared.ts +304 -39
- package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
- package/src/e2e_token_contract/token_contract_test.ts +140 -124
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +329 -0
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +98 -7
- package/src/fixtures/get_acvm_config.ts +4 -12
- package/src/fixtures/get_bb_config.ts +19 -13
- package/src/fixtures/ha_setup.ts +188 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/l1_to_l2_messaging.ts +56 -24
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +1056 -0
- package/src/fixtures/setup_p2p_test.ts +142 -54
- package/src/fixtures/token_utils.ts +34 -16
- package/src/fixtures/utils.ts +29 -820
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +9 -19
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +116 -90
- package/src/shared/gas_portal_test_harness.ts +75 -56
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +52 -2
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +19 -20
- package/src/shared/uniswap_l1_l2.ts +259 -234
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +43 -26
- package/src/simulators/token_simulator.ts +18 -34
- package/src/spartan/DEVELOP.md +128 -0
- package/src/spartan/setup_test_wallets.ts +420 -96
- package/src/spartan/tx_metrics.ts +434 -0
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -582
- package/src/test-wallet/test_wallet.ts +376 -0
- package/src/test-wallet/utils.ts +108 -0
- package/src/test-wallet/wallet_worker_script.ts +63 -0
- package/src/test-wallet/worker_wallet.ts +218 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
- package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/e2e_prover/e2e_prover_test.js +0 -291
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -87
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -479
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/e2e_prover/e2e_prover_test.ts +0 -418
- package/src/fixtures/setup_l1_contracts.ts +0 -27
- package/src/fixtures/snapshot_manager.ts +0 -617
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
|
@@ -1,150 +1,393 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '@aztec/aztec.js';
|
|
15
|
-
import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
|
|
1
|
+
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
3
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
5
|
+
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
6
|
+
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
7
|
+
import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
8
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
9
|
+
import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
10
|
+
import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
|
|
11
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
12
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
13
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
16
14
|
import type { Logger } from '@aztec/foundation/log';
|
|
15
|
+
import { makeBackoff, retry, retryUntil } from '@aztec/foundation/retry';
|
|
17
16
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
17
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
18
|
+
import { TxStatus } from '@aztec/stdlib/tx';
|
|
19
|
+
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
22
|
+
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
23
|
+
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
24
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
25
|
+
import { proveInteraction } from '../test-wallet/utils.js';
|
|
26
|
+
import { WorkerWallet } from '../test-wallet/worker_wallet.js';
|
|
27
|
+
|
|
28
|
+
export interface TestAccounts {
|
|
29
|
+
aztecNode: AztecNode;
|
|
30
|
+
wallet: TestWallet;
|
|
31
|
+
accounts: AztecAddress[];
|
|
32
|
+
tokenContract: TokenContract;
|
|
33
|
+
tokenAdminAddress: AztecAddress;
|
|
23
34
|
tokenName: string;
|
|
24
|
-
|
|
35
|
+
recipientAddress: AztecAddress;
|
|
25
36
|
tokenAddress: AztecAddress;
|
|
26
37
|
}
|
|
27
38
|
|
|
39
|
+
export type TestAccountsWithoutTokens = Omit<
|
|
40
|
+
TestAccounts,
|
|
41
|
+
'tokenAddress' | 'tokenContract' | 'tokenName' | 'tokenAdminAddress'
|
|
42
|
+
>;
|
|
43
|
+
|
|
28
44
|
const TOKEN_NAME = 'USDC';
|
|
29
45
|
const TOKEN_SYMBOL = 'USD';
|
|
30
46
|
const TOKEN_DECIMALS = 18n;
|
|
31
47
|
|
|
32
|
-
export async function
|
|
33
|
-
|
|
48
|
+
export async function setupTestAccountsWithTokens(
|
|
49
|
+
nodeUrl: string,
|
|
50
|
+
mintAmount: bigint,
|
|
51
|
+
logger: Logger,
|
|
52
|
+
): Promise<TestAccounts> {
|
|
53
|
+
const ACCOUNT_COUNT = 1; // TODO fix this to allow for 16 wallets again
|
|
54
|
+
|
|
55
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
56
|
+
const wallet = await TestWallet.create(aztecNode);
|
|
57
|
+
|
|
58
|
+
const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
|
|
59
|
+
0,
|
|
60
|
+
ACCOUNT_COUNT + 1,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const tokenAdmin = accounts[0];
|
|
64
|
+
const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
|
|
65
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
aztecNode,
|
|
69
|
+
accounts,
|
|
70
|
+
wallet,
|
|
71
|
+
tokenAdminAddress: tokenAdmin,
|
|
72
|
+
tokenName: TOKEN_NAME,
|
|
73
|
+
tokenAddress,
|
|
74
|
+
tokenContract,
|
|
75
|
+
recipientAddress: recipientAccount,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function deploySponsoredTestAccountsWithTokens(
|
|
80
|
+
wallet: TestWallet,
|
|
81
|
+
aztecNode: AztecNode,
|
|
34
82
|
mintAmount: bigint,
|
|
35
83
|
logger: Logger,
|
|
36
|
-
|
|
37
|
-
|
|
84
|
+
numberOfFundedWallets = 1,
|
|
85
|
+
): Promise<TestAccounts> {
|
|
86
|
+
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
87
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
88
|
+
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
89
|
+
|
|
90
|
+
await registerSponsoredFPC(wallet);
|
|
91
|
+
|
|
92
|
+
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
93
|
+
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
94
|
+
await recipientDeployMethod.send({
|
|
95
|
+
from: NO_FROM,
|
|
96
|
+
fee: { paymentMethod },
|
|
97
|
+
wait: { timeout: 2400 },
|
|
98
|
+
});
|
|
99
|
+
await Promise.all(
|
|
100
|
+
fundedAccounts.map(async a => {
|
|
101
|
+
const deployMethod = await a.getDeployMethod();
|
|
102
|
+
await deployMethod.send({
|
|
103
|
+
from: NO_FROM,
|
|
104
|
+
fee: { paymentMethod },
|
|
105
|
+
wait: { timeout: 2400 },
|
|
106
|
+
}); // increase timeout on purpose in order to account for two empty epochs
|
|
107
|
+
logger.info(`Account deployed at ${a.address}`);
|
|
108
|
+
}),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const tokenAdmin = fundedAccounts[0];
|
|
112
|
+
const tokenAddress = await deployTokenAndMint(
|
|
113
|
+
wallet,
|
|
114
|
+
fundedAccounts.map(acc => acc.address),
|
|
115
|
+
tokenAdmin.address,
|
|
116
|
+
mintAmount,
|
|
117
|
+
new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
|
|
118
|
+
logger,
|
|
119
|
+
);
|
|
120
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
aztecNode,
|
|
124
|
+
wallet,
|
|
125
|
+
accounts: fundedAccounts.map(acc => acc.address),
|
|
126
|
+
tokenAdminAddress: tokenAdmin.address,
|
|
127
|
+
tokenName: TOKEN_NAME,
|
|
128
|
+
tokenAddress,
|
|
129
|
+
tokenContract,
|
|
130
|
+
recipientAddress: recipientAccount.address,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function deployAccountWithDiagnostics(
|
|
135
|
+
account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
|
|
136
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
137
|
+
aztecNode: AztecNode,
|
|
138
|
+
logger: Logger,
|
|
139
|
+
accountLabel: string,
|
|
140
|
+
estimateGas?: boolean,
|
|
141
|
+
): Promise<void> {
|
|
142
|
+
const deployMethod = await account.getDeployMethod();
|
|
143
|
+
let gasSettings: any;
|
|
144
|
+
if (estimateGas) {
|
|
145
|
+
const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod } });
|
|
146
|
+
gasSettings = sim.estimatedGas;
|
|
147
|
+
logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Track the tx hash across retries so we don't re-send when the previous tx is still pending.
|
|
151
|
+
let sentTxHash: { txHash: any } | undefined;
|
|
152
|
+
|
|
153
|
+
await retry(
|
|
154
|
+
async () => {
|
|
155
|
+
// Check if already deployed (handles case where previous attempt succeeded but waitForTx timed out)
|
|
156
|
+
const existing = await aztecNode.getContract(account.address);
|
|
157
|
+
if (existing) {
|
|
158
|
+
logger.info(`${accountLabel} already deployed at ${account.address}, skipping`);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// If we already sent a tx, check if it was dropped before deciding to re-send.
|
|
163
|
+
if (sentTxHash) {
|
|
164
|
+
const prevReceipt = await aztecNode.getTxReceipt(sentTxHash.txHash);
|
|
165
|
+
if (prevReceipt.isDropped()) {
|
|
166
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} was dropped, re-sending`);
|
|
167
|
+
sentTxHash = undefined;
|
|
168
|
+
} else {
|
|
169
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} still pending, waiting again...`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!sentTxHash) {
|
|
174
|
+
const deployResult = await deployMethod.send({
|
|
175
|
+
from: NO_FROM,
|
|
176
|
+
fee: { paymentMethod, gasSettings },
|
|
177
|
+
wait: NO_WAIT,
|
|
178
|
+
});
|
|
179
|
+
sentTxHash = { txHash: deployResult.txHash };
|
|
180
|
+
logger.info(`${accountLabel} tx sent`, { txHash: sentTxHash.txHash.toString() });
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const receipt = await waitForTx(aztecNode, sentTxHash.txHash, { timeout: 600 });
|
|
184
|
+
if (receipt.isDropped()) {
|
|
185
|
+
sentTxHash = undefined;
|
|
186
|
+
throw new Error(`${accountLabel} tx was dropped, retrying...`);
|
|
187
|
+
}
|
|
188
|
+
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
189
|
+
},
|
|
190
|
+
`deploy ${accountLabel}`,
|
|
191
|
+
makeBackoff([1, 2, 4, 8, 16]),
|
|
192
|
+
logger,
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async function deployAccountsInBatches(
|
|
197
|
+
accounts: {
|
|
198
|
+
getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
|
|
199
|
+
address: any;
|
|
200
|
+
}[],
|
|
201
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
202
|
+
aztecNode: AztecNode,
|
|
203
|
+
logger: Logger,
|
|
204
|
+
labelPrefix: string,
|
|
205
|
+
batchSize = 2,
|
|
206
|
+
estimateGas?: boolean,
|
|
207
|
+
): Promise<void> {
|
|
208
|
+
for (let i = 0; i < accounts.length; i += batchSize) {
|
|
209
|
+
const batch = accounts.slice(i, i + batchSize);
|
|
210
|
+
await Promise.all(
|
|
211
|
+
batch.map((account, idx) =>
|
|
212
|
+
deployAccountWithDiagnostics(
|
|
213
|
+
account,
|
|
214
|
+
paymentMethod,
|
|
215
|
+
aztecNode,
|
|
216
|
+
logger,
|
|
217
|
+
`${labelPrefix}${i + idx + 1}`,
|
|
218
|
+
estimateGas,
|
|
219
|
+
),
|
|
220
|
+
),
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export async function deploySponsoredTestAccounts(
|
|
226
|
+
wallet: TestWallet,
|
|
227
|
+
aztecNode: AztecNode,
|
|
228
|
+
logger: Logger,
|
|
229
|
+
numberOfFundedWallets = 1,
|
|
230
|
+
opts?: { estimateGas?: boolean },
|
|
231
|
+
): Promise<TestAccountsWithoutTokens> {
|
|
232
|
+
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
233
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
234
|
+
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
38
235
|
|
|
39
|
-
|
|
236
|
+
await registerSponsoredFPC(wallet);
|
|
40
237
|
|
|
41
|
-
const
|
|
238
|
+
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
42
239
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
240
|
+
await deployAccountWithDiagnostics(
|
|
241
|
+
recipientAccount,
|
|
242
|
+
paymentMethod,
|
|
243
|
+
aztecNode,
|
|
244
|
+
logger,
|
|
245
|
+
'Recipient account',
|
|
246
|
+
opts?.estimateGas,
|
|
247
|
+
);
|
|
248
|
+
await deployAccountsInBatches(
|
|
249
|
+
fundedAccounts,
|
|
250
|
+
paymentMethod,
|
|
251
|
+
aztecNode,
|
|
252
|
+
logger,
|
|
253
|
+
'Funded account ',
|
|
254
|
+
2,
|
|
255
|
+
opts?.estimateGas,
|
|
256
|
+
);
|
|
46
257
|
|
|
47
|
-
return {
|
|
258
|
+
return {
|
|
259
|
+
aztecNode,
|
|
260
|
+
wallet,
|
|
261
|
+
accounts: fundedAccounts.map(acc => acc.address),
|
|
262
|
+
recipientAddress: recipientAccount.address,
|
|
263
|
+
};
|
|
48
264
|
}
|
|
49
265
|
|
|
50
|
-
export async function
|
|
51
|
-
pxeUrl: string,
|
|
266
|
+
export async function deployTestAccountsWithTokens(
|
|
52
267
|
nodeUrl: string,
|
|
53
|
-
|
|
268
|
+
l1RpcUrls: string[],
|
|
54
269
|
mnemonicOrPrivateKey: string,
|
|
55
270
|
mintAmount: bigint,
|
|
56
271
|
logger: Logger,
|
|
57
272
|
numberOfFundedWallets = 1,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const node = createAztecNodeClient(nodeUrl);
|
|
273
|
+
): Promise<TestAccounts> {
|
|
274
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
275
|
+
const wallet = await TestWallet.create(aztecNode);
|
|
62
276
|
|
|
63
277
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
recipient.secret,
|
|
67
|
-
recipient.signingKey,
|
|
68
|
-
recipient.salt,
|
|
69
|
-
);
|
|
70
|
-
const fundedAccounts = await Promise.all(funded.map(a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
|
|
278
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
279
|
+
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
71
280
|
|
|
72
281
|
const claims = await Promise.all(
|
|
73
|
-
fundedAccounts.map(a =>
|
|
74
|
-
bridgeL1FeeJuice(l1RpcUrl, mnemonicOrPrivateKey, pxe, a.getAddress(), initialFeeJuice, logger),
|
|
75
|
-
),
|
|
282
|
+
fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, aztecNode, a.address, undefined, logger)),
|
|
76
283
|
);
|
|
77
284
|
|
|
78
|
-
// Progress by
|
|
79
|
-
await advanceL2Block(
|
|
80
|
-
await advanceL2Block(
|
|
285
|
+
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
286
|
+
await advanceL2Block(aztecNode);
|
|
287
|
+
await advanceL2Block(aztecNode);
|
|
288
|
+
await advanceL2Block(aztecNode);
|
|
81
289
|
|
|
82
|
-
|
|
290
|
+
await Promise.all(
|
|
83
291
|
fundedAccounts.map(async (a, i) => {
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
await
|
|
87
|
-
logger.info(`Account deployed at ${a.
|
|
88
|
-
return wallet;
|
|
292
|
+
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
293
|
+
const deployMethod = await a.getDeployMethod();
|
|
294
|
+
await deployMethod.send({ from: NO_FROM, fee: { paymentMethod } });
|
|
295
|
+
logger.info(`Account deployed at ${a.address}`);
|
|
89
296
|
}),
|
|
90
297
|
);
|
|
91
298
|
|
|
92
|
-
const tokenAdmin =
|
|
93
|
-
const tokenAddress = await deployTokenAndMint(
|
|
94
|
-
|
|
299
|
+
const tokenAdmin = fundedAccounts[0];
|
|
300
|
+
const tokenAddress = await deployTokenAndMint(
|
|
301
|
+
wallet,
|
|
302
|
+
fundedAccounts.map(acc => acc.address),
|
|
303
|
+
tokenAdmin.address,
|
|
304
|
+
mintAmount,
|
|
305
|
+
undefined,
|
|
306
|
+
logger,
|
|
307
|
+
);
|
|
308
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
95
309
|
|
|
96
|
-
return {
|
|
310
|
+
return {
|
|
311
|
+
aztecNode,
|
|
312
|
+
wallet,
|
|
313
|
+
accounts: fundedAccounts.map(acc => acc.address),
|
|
314
|
+
tokenAdminAddress: tokenAdmin.address,
|
|
315
|
+
tokenName: TOKEN_NAME,
|
|
316
|
+
tokenAddress,
|
|
317
|
+
tokenContract,
|
|
318
|
+
recipientAddress: recipientAccount.address,
|
|
319
|
+
};
|
|
97
320
|
}
|
|
98
321
|
|
|
99
322
|
async function bridgeL1FeeJuice(
|
|
100
|
-
|
|
323
|
+
l1RpcUrls: string[],
|
|
101
324
|
mnemonicOrPrivateKey: string,
|
|
102
|
-
|
|
325
|
+
aztecNode: AztecNode,
|
|
103
326
|
recipient: AztecAddress,
|
|
104
|
-
amount: bigint,
|
|
327
|
+
amount: bigint | undefined,
|
|
105
328
|
log: Logger,
|
|
106
329
|
) {
|
|
107
|
-
const { l1ChainId } = await
|
|
108
|
-
const chain = createEthereumChain(
|
|
109
|
-
const
|
|
330
|
+
const { l1ChainId } = await aztecNode.getNodeInfo();
|
|
331
|
+
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
332
|
+
const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
110
333
|
|
|
111
|
-
const portal = await L1FeeJuicePortalManager.new(
|
|
334
|
+
const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
|
|
112
335
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
113
336
|
|
|
114
|
-
|
|
115
|
-
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
337
|
+
await waitForL1ToL2MessageReady(aztecNode, Fr.fromHexString(claim.messageHash), { timeoutSeconds: 24 });
|
|
116
338
|
|
|
117
339
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
118
340
|
return claim;
|
|
119
341
|
}
|
|
120
342
|
|
|
121
|
-
async function advanceL2Block(
|
|
122
|
-
const initialBlockNumber = await
|
|
123
|
-
|
|
124
|
-
|
|
343
|
+
async function advanceL2Block(aztecNode: AztecNode, nodeAdmin?: AztecNodeAdmin) {
|
|
344
|
+
const initialBlockNumber = await aztecNode.getBlockNumber();
|
|
345
|
+
|
|
346
|
+
let minTxsPerBlock = undefined;
|
|
347
|
+
if (nodeAdmin) {
|
|
348
|
+
({ minTxsPerBlock } = await nodeAdmin.getConfig());
|
|
349
|
+
await nodeAdmin.setConfig({ minTxsPerBlock: 0 }); // Set to 0 to ensure we can advance the block
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
await retryUntil(async () => (await aztecNode.getBlockNumber()) >= initialBlockNumber + 1);
|
|
353
|
+
|
|
354
|
+
if (nodeAdmin && minTxsPerBlock !== undefined) {
|
|
355
|
+
await nodeAdmin.setConfig({ minTxsPerBlock });
|
|
356
|
+
}
|
|
125
357
|
}
|
|
126
358
|
|
|
127
359
|
async function deployTokenAndMint(
|
|
128
|
-
|
|
360
|
+
wallet: Wallet,
|
|
361
|
+
accounts: AztecAddress[],
|
|
129
362
|
admin: AztecAddress,
|
|
130
363
|
mintAmount: bigint,
|
|
364
|
+
paymentMethod: FeePaymentMethod | undefined,
|
|
131
365
|
logger: Logger,
|
|
132
366
|
) {
|
|
133
367
|
logger.verbose(`Deploying TokenContract...`);
|
|
134
|
-
const tokenContract = await TokenContract.deploy(
|
|
135
|
-
|
|
136
|
-
|
|
368
|
+
const { contract: tokenContract } = await TokenContract.deploy(
|
|
369
|
+
wallet,
|
|
370
|
+
admin,
|
|
371
|
+
TOKEN_NAME,
|
|
372
|
+
TOKEN_SYMBOL,
|
|
373
|
+
TOKEN_DECIMALS,
|
|
374
|
+
).send({
|
|
375
|
+
from: admin,
|
|
376
|
+
fee: {
|
|
377
|
+
paymentMethod,
|
|
378
|
+
},
|
|
379
|
+
wait: { timeout: 600 },
|
|
380
|
+
});
|
|
137
381
|
|
|
138
382
|
const tokenAddress = tokenContract.address;
|
|
139
383
|
|
|
140
|
-
logger.verbose(`Minting ${mintAmount} public assets to the ${
|
|
384
|
+
logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
|
|
141
385
|
|
|
142
386
|
await Promise.all(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
.mint_to_public(
|
|
146
|
-
.send()
|
|
147
|
-
.wait({ timeout: 600 }),
|
|
387
|
+
accounts.map(acc =>
|
|
388
|
+
TokenContract.at(tokenAddress, wallet)
|
|
389
|
+
.methods.mint_to_public(acc, mintAmount)
|
|
390
|
+
.send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
|
|
148
391
|
),
|
|
149
392
|
);
|
|
150
393
|
|
|
@@ -154,31 +397,112 @@ async function deployTokenAndMint(
|
|
|
154
397
|
}
|
|
155
398
|
|
|
156
399
|
export async function performTransfers({
|
|
157
|
-
|
|
400
|
+
wallet,
|
|
401
|
+
testAccounts,
|
|
158
402
|
rounds,
|
|
159
403
|
transferAmount,
|
|
160
404
|
logger,
|
|
405
|
+
feePaymentMethod,
|
|
161
406
|
}: {
|
|
162
|
-
|
|
407
|
+
wallet: TestWallet;
|
|
408
|
+
testAccounts: TestAccounts;
|
|
163
409
|
rounds: number;
|
|
164
410
|
transferAmount: bigint;
|
|
165
411
|
logger: Logger;
|
|
412
|
+
feePaymentMethod?: FeePaymentMethod;
|
|
166
413
|
}) {
|
|
167
|
-
const recipient =
|
|
168
|
-
|
|
414
|
+
const recipient = testAccounts.recipientAddress;
|
|
415
|
+
// Default to sponsored fee payment if no fee method is provided
|
|
416
|
+
const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
169
417
|
for (let i = 0; i < rounds; i++) {
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
418
|
+
const txs = testAccounts.accounts.map(acc => {
|
|
419
|
+
const token = TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
|
|
420
|
+
return proveInteraction(wallet, token.methods.transfer_in_public(acc, recipient, transferAmount, 0), {
|
|
421
|
+
from: acc,
|
|
422
|
+
fee: {
|
|
423
|
+
paymentMethod: defaultFeePaymentMethod,
|
|
424
|
+
},
|
|
425
|
+
});
|
|
426
|
+
});
|
|
177
427
|
|
|
178
|
-
const
|
|
428
|
+
const provenTxs = await Promise.all(txs);
|
|
179
429
|
|
|
180
|
-
|
|
430
|
+
// Wait only for the txs to be proposed, not checkpointed. This is enough to keep the chain
|
|
431
|
+
// loaded for the reorg scenario, and avoids each round blocking on the (slower) checkpoint lag.
|
|
432
|
+
await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600, waitForStatus: TxStatus.PROPOSED } })));
|
|
181
433
|
|
|
182
434
|
logger.info(`Completed round ${i + 1} / ${rounds}`);
|
|
183
435
|
}
|
|
184
436
|
}
|
|
437
|
+
|
|
438
|
+
export type WalletWrapper = {
|
|
439
|
+
wallet: TestWallet;
|
|
440
|
+
aztecNode: AztecNode;
|
|
441
|
+
cleanup: () => Promise<void>;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
export async function createWalletAndAztecNodeClient(
|
|
445
|
+
nodeUrl: string,
|
|
446
|
+
proverEnabled: boolean,
|
|
447
|
+
logger: Logger,
|
|
448
|
+
): Promise<WalletWrapper> {
|
|
449
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
450
|
+
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
451
|
+
const pxeConfig = {
|
|
452
|
+
dataDirectory: undefined,
|
|
453
|
+
dataStoreMapSizeKb: 1024 * 1024,
|
|
454
|
+
...bbConfig,
|
|
455
|
+
...acvmConfig,
|
|
456
|
+
proverEnabled,
|
|
457
|
+
};
|
|
458
|
+
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
459
|
+
|
|
460
|
+
return {
|
|
461
|
+
wallet,
|
|
462
|
+
aztecNode,
|
|
463
|
+
async cleanup() {
|
|
464
|
+
await wallet.stop();
|
|
465
|
+
await bbConfig?.cleanup();
|
|
466
|
+
await acvmConfig?.cleanup();
|
|
467
|
+
},
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export type WorkerWalletWrapper = {
|
|
472
|
+
wallet: WorkerWallet;
|
|
473
|
+
aztecNode: AztecNode;
|
|
474
|
+
cleanup: () => Promise<void>;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
export async function createWorkerWalletClient(
|
|
478
|
+
nodeUrl: string,
|
|
479
|
+
proverEnabled: boolean,
|
|
480
|
+
logger: Logger,
|
|
481
|
+
): Promise<WorkerWalletWrapper> {
|
|
482
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
483
|
+
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
484
|
+
|
|
485
|
+
// Strip cleanup functions — they can't be structured-cloned for worker transfer
|
|
486
|
+
const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
|
|
487
|
+
const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
|
|
488
|
+
|
|
489
|
+
const pxeConfig = {
|
|
490
|
+
dataDirectory: undefined,
|
|
491
|
+
dataStoreMapSizeKb: 1024 * 1024,
|
|
492
|
+
...bbPaths,
|
|
493
|
+
...acvmPaths,
|
|
494
|
+
proverEnabled,
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
|
|
498
|
+
|
|
499
|
+
return {
|
|
500
|
+
wallet,
|
|
501
|
+
aztecNode,
|
|
502
|
+
async cleanup() {
|
|
503
|
+
await wallet.stop();
|
|
504
|
+
await bbCleanup?.();
|
|
505
|
+
await acvmCleanup?.();
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
}
|