@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.b6e433891
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/dest/bench/client_flows/benchmark.d.ts +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +21 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +22 -16
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +142 -124
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +7 -27
- package/dest/bench/utils.d.ts +8 -7
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +31 -19
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +9 -8
- 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 +107 -113
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +20 -14
- 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 +92 -70
- package/dest/e2e_deploy_contract/deploy_test.d.ts +6 -5
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -13
- package/dest/e2e_epochs/epochs_test.d.ts +27 -15
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +107 -54
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +5 -7
- package/dest/e2e_fees/fees_test.d.ts +21 -17
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +138 -143
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +18 -19
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +30 -39
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +7 -6
- package/dest/e2e_p2p/p2p_network.d.ts +229 -21
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +142 -114
- 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 +190 -0
- package/dest/e2e_p2p/shared.d.ts +31 -11
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +51 -22
- 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 +19 -10
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +100 -92
- 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 +30 -0
- package/dest/fixtures/e2e_prover_test.d.ts +15 -21
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +123 -138
- 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 +6 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +8 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/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 +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup.d.ts +239 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +606 -0
- package/dest/fixtures/setup_p2p_test.d.ts +17 -10
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +55 -36
- package/dest/fixtures/token_utils.d.ts +6 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +17 -10
- package/dest/fixtures/utils.d.ts +5 -192
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -648
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/index.d.ts +1 -1
- 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 +7 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +27 -27
- package/dest/shared/gas_portal_test_harness.d.ts +2 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +4 -4
- package/dest/shared/index.d.ts +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +58 -39
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +2 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +8 -6
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +18 -6
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +129 -24
- package/dest/spartan/tx_metrics.d.ts +88 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +422 -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 +45 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -218
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -749
- package/dest/test-wallet/test_wallet.d.ts +76 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +214 -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 +71 -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 +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +49 -44
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +163 -177
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +6 -28
- package/src/bench/utils.ts +36 -21
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +120 -145
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -125
- package/src/e2e_deploy_contract/deploy_test.ts +23 -16
- package/src/e2e_epochs/epochs_test.ts +176 -114
- package/src/e2e_fees/bridging_race.notest.ts +6 -12
- package/src/e2e_fees/fees_test.ts +179 -226
- package/src/e2e_l1_publisher/write_json.ts +20 -19
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +35 -55
- package/src/e2e_p2p/inactivity_slash_test.ts +8 -7
- package/src/e2e_p2p/p2p_network.ts +205 -178
- package/src/e2e_p2p/reqresp/utils.ts +256 -0
- package/src/e2e_p2p/shared.ts +90 -29
- 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 +121 -119
- package/src/fixtures/authwit_proxy.ts +50 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +144 -186
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +12 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/ha_setup.ts +186 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup.ts +903 -0
- package/src/fixtures/setup_p2p_test.ts +58 -48
- package/src/fixtures/token_utils.ts +12 -8
- package/src/fixtures/utils.ts +27 -947
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +4 -4
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +30 -43
- package/src/shared/gas_portal_test_harness.ts +4 -4
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +11 -16
- package/src/shared/uniswap_l1_l2.ts +86 -102
- package/src/simulators/lending_simulator.ts +11 -7
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +205 -29
- package/src/spartan/tx_metrics.ts +376 -0
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -942
- package/src/test-wallet/test_wallet.ts +294 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +213 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
4
5
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
5
6
|
import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
6
7
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
7
|
-
import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
8
|
+
import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
|
|
8
9
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { createEthereumChain
|
|
10
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
11
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
10
12
|
import type { Logger } from '@aztec/foundation/log';
|
|
11
13
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
12
14
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
13
15
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
14
|
-
import {
|
|
16
|
+
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
15
17
|
|
|
16
18
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
17
19
|
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
18
20
|
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
21
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
22
|
+
import { proveInteraction } from '../test-wallet/utils.js';
|
|
23
|
+
import { WorkerWallet } from '../test-wallet/worker_wallet.js';
|
|
19
24
|
|
|
20
25
|
export interface TestAccounts {
|
|
21
26
|
aztecNode: AztecNode;
|
|
@@ -28,6 +33,11 @@ export interface TestAccounts {
|
|
|
28
33
|
tokenAddress: AztecAddress;
|
|
29
34
|
}
|
|
30
35
|
|
|
36
|
+
export type TestAccountsWithoutTokens = Omit<
|
|
37
|
+
TestAccounts,
|
|
38
|
+
'tokenAddress' | 'tokenContract' | 'tokenName' | 'tokenAdminAddress'
|
|
39
|
+
>;
|
|
40
|
+
|
|
31
41
|
const TOKEN_NAME = 'USDC';
|
|
32
42
|
const TOKEN_SYMBOL = 'USD';
|
|
33
43
|
const TOKEN_DECIMALS = 18n;
|
|
@@ -42,14 +52,14 @@ export async function setupTestAccountsWithTokens(
|
|
|
42
52
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
43
53
|
const wallet = await TestWallet.create(aztecNode);
|
|
44
54
|
|
|
45
|
-
const [recipientAccount, ...accounts] = (await
|
|
55
|
+
const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
|
|
46
56
|
0,
|
|
47
57
|
ACCOUNT_COUNT + 1,
|
|
48
58
|
);
|
|
49
59
|
|
|
50
60
|
const tokenAdmin = accounts[0];
|
|
51
61
|
const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
|
|
52
|
-
const tokenContract =
|
|
62
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
53
63
|
|
|
54
64
|
return {
|
|
55
65
|
aztecNode,
|
|
@@ -63,7 +73,7 @@ export async function setupTestAccountsWithTokens(
|
|
|
63
73
|
};
|
|
64
74
|
}
|
|
65
75
|
|
|
66
|
-
export async function
|
|
76
|
+
export async function deploySponsoredTestAccountsWithTokens(
|
|
67
77
|
wallet: TestWallet,
|
|
68
78
|
aztecNode: AztecNode,
|
|
69
79
|
mintAmount: bigint,
|
|
@@ -78,11 +88,19 @@ export async function deploySponsoredTestAccounts(
|
|
|
78
88
|
|
|
79
89
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
80
90
|
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
81
|
-
await recipientDeployMethod.send({
|
|
91
|
+
await recipientDeployMethod.send({
|
|
92
|
+
from: AztecAddress.ZERO,
|
|
93
|
+
fee: { paymentMethod },
|
|
94
|
+
wait: { timeout: 2400 },
|
|
95
|
+
});
|
|
82
96
|
await Promise.all(
|
|
83
97
|
fundedAccounts.map(async a => {
|
|
84
98
|
const deployMethod = await a.getDeployMethod();
|
|
85
|
-
await deployMethod.send({
|
|
99
|
+
await deployMethod.send({
|
|
100
|
+
from: AztecAddress.ZERO,
|
|
101
|
+
fee: { paymentMethod },
|
|
102
|
+
wait: { timeout: 2400 },
|
|
103
|
+
}); // increase timeout on purpose in order to account for two empty epochs
|
|
86
104
|
logger.info(`Account deployed at ${a.address}`);
|
|
87
105
|
}),
|
|
88
106
|
);
|
|
@@ -96,7 +114,7 @@ export async function deploySponsoredTestAccounts(
|
|
|
96
114
|
new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
|
|
97
115
|
logger,
|
|
98
116
|
);
|
|
99
|
-
const tokenContract =
|
|
117
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
100
118
|
|
|
101
119
|
return {
|
|
102
120
|
aztecNode,
|
|
@@ -110,6 +128,119 @@ export async function deploySponsoredTestAccounts(
|
|
|
110
128
|
};
|
|
111
129
|
}
|
|
112
130
|
|
|
131
|
+
async function deployAccountWithDiagnostics(
|
|
132
|
+
account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
|
|
133
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
134
|
+
aztecNode: AztecNode,
|
|
135
|
+
logger: Logger,
|
|
136
|
+
accountLabel: string,
|
|
137
|
+
estimateGas?: boolean,
|
|
138
|
+
): Promise<void> {
|
|
139
|
+
const deployMethod = await account.getDeployMethod();
|
|
140
|
+
let txHash;
|
|
141
|
+
try {
|
|
142
|
+
let gasSettings;
|
|
143
|
+
if (estimateGas) {
|
|
144
|
+
const sim = await deployMethod.simulate({ from: AztecAddress.ZERO, fee: { paymentMethod } });
|
|
145
|
+
gasSettings = sim.estimatedGas;
|
|
146
|
+
logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
|
|
147
|
+
}
|
|
148
|
+
const deployResult = await deployMethod.send({
|
|
149
|
+
from: AztecAddress.ZERO,
|
|
150
|
+
fee: { paymentMethod, gasSettings },
|
|
151
|
+
wait: NO_WAIT,
|
|
152
|
+
});
|
|
153
|
+
txHash = deployResult.txHash;
|
|
154
|
+
await waitForTx(aztecNode, txHash, { timeout: 2400 });
|
|
155
|
+
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
const blockNumber = await aztecNode.getBlockNumber();
|
|
158
|
+
let receipt;
|
|
159
|
+
try {
|
|
160
|
+
receipt = await aztecNode.getTxReceipt(txHash);
|
|
161
|
+
} catch {
|
|
162
|
+
receipt = 'unavailable';
|
|
163
|
+
}
|
|
164
|
+
logger.error(`${accountLabel} deployment failed`, {
|
|
165
|
+
txHash: txHash.toString(),
|
|
166
|
+
receipt: JSON.stringify(receipt),
|
|
167
|
+
currentBlockNumber: blockNumber,
|
|
168
|
+
error: String(error),
|
|
169
|
+
});
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function deployAccountsInBatches(
|
|
175
|
+
accounts: {
|
|
176
|
+
getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
|
|
177
|
+
address: any;
|
|
178
|
+
}[],
|
|
179
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
180
|
+
aztecNode: AztecNode,
|
|
181
|
+
logger: Logger,
|
|
182
|
+
labelPrefix: string,
|
|
183
|
+
batchSize = 2,
|
|
184
|
+
estimateGas?: boolean,
|
|
185
|
+
): Promise<void> {
|
|
186
|
+
for (let i = 0; i < accounts.length; i += batchSize) {
|
|
187
|
+
const batch = accounts.slice(i, i + batchSize);
|
|
188
|
+
await Promise.all(
|
|
189
|
+
batch.map((account, idx) =>
|
|
190
|
+
deployAccountWithDiagnostics(
|
|
191
|
+
account,
|
|
192
|
+
paymentMethod,
|
|
193
|
+
aztecNode,
|
|
194
|
+
logger,
|
|
195
|
+
`${labelPrefix}${i + idx + 1}`,
|
|
196
|
+
estimateGas,
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export async function deploySponsoredTestAccounts(
|
|
204
|
+
wallet: TestWallet,
|
|
205
|
+
aztecNode: AztecNode,
|
|
206
|
+
logger: Logger,
|
|
207
|
+
numberOfFundedWallets = 1,
|
|
208
|
+
opts?: { estimateGas?: boolean },
|
|
209
|
+
): Promise<TestAccountsWithoutTokens> {
|
|
210
|
+
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
211
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
212
|
+
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
213
|
+
|
|
214
|
+
await registerSponsoredFPC(wallet);
|
|
215
|
+
|
|
216
|
+
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
217
|
+
|
|
218
|
+
await deployAccountWithDiagnostics(
|
|
219
|
+
recipientAccount,
|
|
220
|
+
paymentMethod,
|
|
221
|
+
aztecNode,
|
|
222
|
+
logger,
|
|
223
|
+
'Recipient account',
|
|
224
|
+
opts?.estimateGas,
|
|
225
|
+
);
|
|
226
|
+
await deployAccountsInBatches(
|
|
227
|
+
fundedAccounts,
|
|
228
|
+
paymentMethod,
|
|
229
|
+
aztecNode,
|
|
230
|
+
logger,
|
|
231
|
+
'Funded account ',
|
|
232
|
+
2,
|
|
233
|
+
opts?.estimateGas,
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
return {
|
|
237
|
+
aztecNode,
|
|
238
|
+
wallet,
|
|
239
|
+
accounts: fundedAccounts.map(acc => acc.address),
|
|
240
|
+
recipientAddress: recipientAccount.address,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
113
244
|
export async function deployTestAccountsWithTokens(
|
|
114
245
|
nodeUrl: string,
|
|
115
246
|
l1RpcUrls: string[],
|
|
@@ -138,7 +269,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
138
269
|
fundedAccounts.map(async (a, i) => {
|
|
139
270
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
140
271
|
const deployMethod = await a.getDeployMethod();
|
|
141
|
-
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } })
|
|
272
|
+
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } });
|
|
142
273
|
logger.info(`Account deployed at ${a.address}`);
|
|
143
274
|
}),
|
|
144
275
|
);
|
|
@@ -152,7 +283,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
152
283
|
undefined,
|
|
153
284
|
logger,
|
|
154
285
|
);
|
|
155
|
-
const tokenContract =
|
|
286
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
156
287
|
|
|
157
288
|
return {
|
|
158
289
|
aztecNode,
|
|
@@ -182,7 +313,7 @@ async function bridgeL1FeeJuice(
|
|
|
182
313
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
183
314
|
|
|
184
315
|
const isSynced = async () =>
|
|
185
|
-
(await aztecNode.
|
|
316
|
+
(await aztecNode.getL1ToL2MessageCheckpoint(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
186
317
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
187
318
|
|
|
188
319
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
@@ -214,25 +345,25 @@ async function deployTokenAndMint(
|
|
|
214
345
|
logger: Logger,
|
|
215
346
|
) {
|
|
216
347
|
logger.verbose(`Deploying TokenContract...`);
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
348
|
+
const {
|
|
349
|
+
receipt: { contract: tokenContract },
|
|
350
|
+
} = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS).send({
|
|
351
|
+
from: admin,
|
|
352
|
+
fee: {
|
|
353
|
+
paymentMethod,
|
|
354
|
+
},
|
|
355
|
+
wait: { timeout: 600, returnReceipt: true },
|
|
356
|
+
});
|
|
225
357
|
|
|
226
358
|
const tokenAddress = tokenContract.address;
|
|
227
359
|
|
|
228
360
|
logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
|
|
229
361
|
|
|
230
362
|
await Promise.all(
|
|
231
|
-
accounts.map(
|
|
232
|
-
|
|
233
|
-
.mint_to_public(acc, mintAmount)
|
|
234
|
-
.send({ from: admin, fee: { paymentMethod } })
|
|
235
|
-
.wait({ timeout: 600 }),
|
|
363
|
+
accounts.map(acc =>
|
|
364
|
+
TokenContract.at(tokenAddress, wallet)
|
|
365
|
+
.methods.mint_to_public(acc, mintAmount)
|
|
366
|
+
.send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
|
|
236
367
|
),
|
|
237
368
|
);
|
|
238
369
|
|
|
@@ -260,8 +391,8 @@ export async function performTransfers({
|
|
|
260
391
|
// Default to sponsored fee payment if no fee method is provided
|
|
261
392
|
const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
262
393
|
for (let i = 0; i < rounds; i++) {
|
|
263
|
-
const txs = testAccounts.accounts.map(
|
|
264
|
-
const token =
|
|
394
|
+
const txs = testAccounts.accounts.map(acc => {
|
|
395
|
+
const token = TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
|
|
265
396
|
return proveInteraction(wallet, token.methods.transfer_in_public(acc, recipient, transferAmount, 0), {
|
|
266
397
|
from: acc,
|
|
267
398
|
fee: {
|
|
@@ -272,17 +403,23 @@ export async function performTransfers({
|
|
|
272
403
|
|
|
273
404
|
const provenTxs = await Promise.all(txs);
|
|
274
405
|
|
|
275
|
-
await Promise.all(provenTxs.map(t => t.send(
|
|
406
|
+
await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600 } })));
|
|
276
407
|
|
|
277
408
|
logger.info(`Completed round ${i + 1} / ${rounds}`);
|
|
278
409
|
}
|
|
279
410
|
}
|
|
280
411
|
|
|
412
|
+
export type WalletWrapper = {
|
|
413
|
+
wallet: TestWallet;
|
|
414
|
+
aztecNode: AztecNode;
|
|
415
|
+
cleanup: () => Promise<void>;
|
|
416
|
+
};
|
|
417
|
+
|
|
281
418
|
export async function createWalletAndAztecNodeClient(
|
|
282
419
|
nodeUrl: string,
|
|
283
420
|
proverEnabled: boolean,
|
|
284
421
|
logger: Logger,
|
|
285
|
-
): Promise<
|
|
422
|
+
): Promise<WalletWrapper> {
|
|
286
423
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
287
424
|
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
288
425
|
const pxeConfig = {
|
|
@@ -304,3 +441,42 @@ export async function createWalletAndAztecNodeClient(
|
|
|
304
441
|
},
|
|
305
442
|
};
|
|
306
443
|
}
|
|
444
|
+
|
|
445
|
+
export type WorkerWalletWrapper = {
|
|
446
|
+
wallet: WorkerWallet;
|
|
447
|
+
aztecNode: AztecNode;
|
|
448
|
+
cleanup: () => Promise<void>;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
export async function createWorkerWalletClient(
|
|
452
|
+
nodeUrl: string,
|
|
453
|
+
proverEnabled: boolean,
|
|
454
|
+
logger: Logger,
|
|
455
|
+
): Promise<WorkerWalletWrapper> {
|
|
456
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
457
|
+
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
458
|
+
|
|
459
|
+
// Strip cleanup functions — they can't be structured-cloned for worker transfer
|
|
460
|
+
const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
|
|
461
|
+
const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
|
|
462
|
+
|
|
463
|
+
const pxeConfig = {
|
|
464
|
+
dataDirectory: undefined,
|
|
465
|
+
dataStoreMapSizeKb: 1024 * 1024,
|
|
466
|
+
...bbPaths,
|
|
467
|
+
...acvmPaths,
|
|
468
|
+
proverEnabled,
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
|
|
472
|
+
|
|
473
|
+
return {
|
|
474
|
+
wallet,
|
|
475
|
+
aztecNode,
|
|
476
|
+
async cleanup() {
|
|
477
|
+
await wallet.stop();
|
|
478
|
+
await bbCleanup?.();
|
|
479
|
+
await acvmCleanup?.();
|
|
480
|
+
},
|
|
481
|
+
};
|
|
482
|
+
}
|