@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.
Files changed (274) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +3 -2
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/benchmark.js +21 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +22 -16
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +142 -124
  7. package/dest/bench/client_flows/config.d.ts +2 -2
  8. package/dest/bench/client_flows/config.d.ts.map +1 -1
  9. package/dest/bench/client_flows/config.js +18 -0
  10. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  11. package/dest/bench/client_flows/data_extractor.js +7 -27
  12. package/dest/bench/utils.d.ts +8 -7
  13. package/dest/bench/utils.d.ts.map +1 -1
  14. package/dest/bench/utils.js +31 -19
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +9 -8
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  17. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +107 -113
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +20 -14
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  20. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +92 -70
  21. package/dest/e2e_deploy_contract/deploy_test.d.ts +6 -5
  22. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  23. package/dest/e2e_deploy_contract/deploy_test.js +18 -13
  24. package/dest/e2e_epochs/epochs_test.d.ts +27 -15
  25. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  26. package/dest/e2e_epochs/epochs_test.js +107 -54
  27. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  28. package/dest/e2e_fees/bridging_race.notest.js +5 -7
  29. package/dest/e2e_fees/fees_test.d.ts +21 -17
  30. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  31. package/dest/e2e_fees/fees_test.js +138 -143
  32. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  33. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  34. package/dest/e2e_l1_publisher/write_json.js +18 -19
  35. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  36. package/dest/e2e_multi_validator/utils.js +1 -1
  37. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
  38. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  39. package/dest/e2e_nested_contract/nested_contract_test.js +30 -39
  40. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  41. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  42. package/dest/e2e_p2p/inactivity_slash_test.js +7 -6
  43. package/dest/e2e_p2p/p2p_network.d.ts +229 -21
  44. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  45. package/dest/e2e_p2p/p2p_network.js +142 -114
  46. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  47. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  48. package/dest/e2e_p2p/reqresp/utils.js +190 -0
  49. package/dest/e2e_p2p/shared.d.ts +31 -11
  50. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  51. package/dest/e2e_p2p/shared.js +51 -22
  52. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  53. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  54. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  55. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  56. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  57. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  58. package/dest/e2e_token_contract/token_contract_test.d.ts +19 -10
  59. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  60. package/dest/e2e_token_contract/token_contract_test.js +100 -92
  61. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  62. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  63. package/dest/fixtures/authwit_proxy.js +30 -0
  64. package/dest/fixtures/e2e_prover_test.d.ts +15 -21
  65. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  66. package/dest/fixtures/e2e_prover_test.js +123 -138
  67. package/dest/fixtures/elu_monitor.d.ts +21 -0
  68. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  69. package/dest/fixtures/elu_monitor.js +102 -0
  70. package/dest/fixtures/fixtures.d.ts +6 -3
  71. package/dest/fixtures/fixtures.d.ts.map +1 -1
  72. package/dest/fixtures/fixtures.js +8 -3
  73. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  74. package/dest/fixtures/get_acvm_config.js +1 -1
  75. package/dest/fixtures/get_bb_config.d.ts +1 -1
  76. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  77. package/dest/fixtures/ha_setup.d.ts +71 -0
  78. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  79. package/dest/fixtures/ha_setup.js +116 -0
  80. package/dest/fixtures/index.d.ts +2 -1
  81. package/dest/fixtures/index.d.ts.map +1 -1
  82. package/dest/fixtures/index.js +1 -0
  83. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  84. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  85. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  86. package/dest/fixtures/logging.d.ts +1 -1
  87. package/dest/fixtures/setup.d.ts +239 -0
  88. package/dest/fixtures/setup.d.ts.map +1 -0
  89. package/dest/fixtures/setup.js +606 -0
  90. package/dest/fixtures/setup_p2p_test.d.ts +17 -10
  91. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  92. package/dest/fixtures/setup_p2p_test.js +55 -36
  93. package/dest/fixtures/token_utils.d.ts +6 -3
  94. package/dest/fixtures/token_utils.d.ts.map +1 -1
  95. package/dest/fixtures/token_utils.js +17 -10
  96. package/dest/fixtures/utils.d.ts +5 -192
  97. package/dest/fixtures/utils.d.ts.map +1 -1
  98. package/dest/fixtures/utils.js +4 -648
  99. package/dest/fixtures/web3signer.d.ts +1 -1
  100. package/dest/fixtures/web3signer.js +1 -1
  101. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  102. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  103. package/dest/fixtures/with_telemetry_utils.js +2 -2
  104. package/dest/index.d.ts +1 -1
  105. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  106. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  107. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  108. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  109. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  110. package/dest/quality_of_service/prometheus_client.js +67 -0
  111. package/dest/shared/cross_chain_test_harness.d.ts +7 -6
  112. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  113. package/dest/shared/cross_chain_test_harness.js +27 -27
  114. package/dest/shared/gas_portal_test_harness.d.ts +2 -2
  115. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  116. package/dest/shared/gas_portal_test_harness.js +4 -4
  117. package/dest/shared/index.d.ts +3 -2
  118. package/dest/shared/index.d.ts.map +1 -1
  119. package/dest/shared/index.js +1 -0
  120. package/dest/shared/jest_setup.d.ts +1 -1
  121. package/dest/shared/jest_setup.js +41 -1
  122. package/dest/shared/mock_state_view.d.ts +86 -0
  123. package/dest/shared/mock_state_view.d.ts.map +1 -0
  124. package/dest/shared/mock_state_view.js +186 -0
  125. package/dest/shared/submit-transactions.d.ts +4 -4
  126. package/dest/shared/submit-transactions.d.ts.map +1 -1
  127. package/dest/shared/submit-transactions.js +9 -11
  128. package/dest/shared/uniswap_l1_l2.d.ts +3 -27
  129. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  130. package/dest/shared/uniswap_l1_l2.js +58 -39
  131. package/dest/simulators/index.d.ts +1 -1
  132. package/dest/simulators/lending_simulator.d.ts +2 -2
  133. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  134. package/dest/simulators/lending_simulator.js +8 -6
  135. package/dest/simulators/token_simulator.d.ts +1 -1
  136. package/dest/simulators/token_simulator.d.ts.map +1 -1
  137. package/dest/simulators/token_simulator.js +3 -24
  138. package/dest/spartan/setup_test_wallets.d.ts +18 -6
  139. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  140. package/dest/spartan/setup_test_wallets.js +129 -24
  141. package/dest/spartan/tx_metrics.d.ts +88 -0
  142. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  143. package/dest/spartan/tx_metrics.js +422 -0
  144. package/dest/spartan/utils/bot.d.ts +28 -0
  145. package/dest/spartan/utils/bot.d.ts.map +1 -0
  146. package/dest/spartan/utils/bot.js +142 -0
  147. package/dest/spartan/utils/chaos.d.ts +79 -0
  148. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  149. package/dest/spartan/utils/chaos.js +142 -0
  150. package/dest/spartan/utils/clients.d.ts +39 -0
  151. package/dest/spartan/utils/clients.d.ts.map +1 -0
  152. package/dest/spartan/utils/clients.js +90 -0
  153. package/dest/spartan/utils/config.d.ts +45 -0
  154. package/dest/spartan/utils/config.d.ts.map +1 -0
  155. package/dest/spartan/utils/config.js +23 -0
  156. package/dest/spartan/utils/health.d.ts +63 -0
  157. package/dest/spartan/utils/health.d.ts.map +1 -0
  158. package/dest/spartan/utils/health.js +202 -0
  159. package/dest/spartan/utils/helm.d.ts +15 -0
  160. package/dest/spartan/utils/helm.d.ts.map +1 -0
  161. package/dest/spartan/utils/helm.js +47 -0
  162. package/dest/spartan/utils/index.d.ts +11 -0
  163. package/dest/spartan/utils/index.d.ts.map +1 -0
  164. package/dest/spartan/utils/index.js +22 -0
  165. package/dest/spartan/utils/k8s.d.ts +128 -0
  166. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  167. package/dest/spartan/utils/k8s.js +381 -0
  168. package/dest/spartan/utils/nodes.d.ts +40 -0
  169. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  170. package/dest/spartan/utils/nodes.js +461 -0
  171. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  172. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  173. package/dest/spartan/utils/pod_logs.js +74 -0
  174. package/dest/spartan/utils/scripts.d.ts +30 -0
  175. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  176. package/dest/spartan/utils/scripts.js +81 -0
  177. package/dest/spartan/utils.d.ts +2 -218
  178. package/dest/spartan/utils.d.ts.map +1 -1
  179. package/dest/spartan/utils.js +1 -749
  180. package/dest/test-wallet/test_wallet.d.ts +76 -0
  181. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  182. package/dest/test-wallet/test_wallet.js +214 -0
  183. package/dest/test-wallet/utils.d.ts +41 -0
  184. package/dest/test-wallet/utils.d.ts.map +1 -0
  185. package/dest/test-wallet/utils.js +71 -0
  186. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  187. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  188. package/dest/test-wallet/wallet_worker_script.js +48 -0
  189. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  190. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  191. package/dest/test-wallet/worker_wallet.js +151 -0
  192. package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
  193. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  194. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  195. package/package.json +49 -44
  196. package/src/bench/client_flows/benchmark.ts +24 -2
  197. package/src/bench/client_flows/client_flows_benchmark.ts +163 -177
  198. package/src/bench/client_flows/config.ts +9 -1
  199. package/src/bench/client_flows/data_extractor.ts +6 -28
  200. package/src/bench/utils.ts +36 -21
  201. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +120 -145
  202. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -125
  203. package/src/e2e_deploy_contract/deploy_test.ts +23 -16
  204. package/src/e2e_epochs/epochs_test.ts +176 -114
  205. package/src/e2e_fees/bridging_race.notest.ts +6 -12
  206. package/src/e2e_fees/fees_test.ts +179 -226
  207. package/src/e2e_l1_publisher/write_json.ts +20 -19
  208. package/src/e2e_multi_validator/utils.ts +1 -1
  209. package/src/e2e_nested_contract/nested_contract_test.ts +35 -55
  210. package/src/e2e_p2p/inactivity_slash_test.ts +8 -7
  211. package/src/e2e_p2p/p2p_network.ts +205 -178
  212. package/src/e2e_p2p/reqresp/utils.ts +256 -0
  213. package/src/e2e_p2p/shared.ts +90 -29
  214. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  215. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  216. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  217. package/src/e2e_token_contract/token_contract_test.ts +121 -119
  218. package/src/fixtures/authwit_proxy.ts +50 -0
  219. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  220. package/src/fixtures/e2e_prover_test.ts +144 -186
  221. package/src/fixtures/elu_monitor.ts +126 -0
  222. package/src/fixtures/fixtures.ts +12 -5
  223. package/src/fixtures/get_acvm_config.ts +1 -1
  224. package/src/fixtures/ha_setup.ts +186 -0
  225. package/src/fixtures/index.ts +1 -0
  226. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  227. package/src/fixtures/setup.ts +903 -0
  228. package/src/fixtures/setup_p2p_test.ts +58 -48
  229. package/src/fixtures/token_utils.ts +12 -8
  230. package/src/fixtures/utils.ts +27 -947
  231. package/src/fixtures/web3signer.ts +1 -1
  232. package/src/fixtures/with_telemetry_utils.ts +2 -2
  233. package/src/guides/up_quick_start.sh +4 -4
  234. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
  235. package/src/quality_of_service/prometheus_client.ts +113 -0
  236. package/src/shared/cross_chain_test_harness.ts +30 -43
  237. package/src/shared/gas_portal_test_harness.ts +4 -4
  238. package/src/shared/index.ts +2 -1
  239. package/src/shared/jest_setup.ts +51 -1
  240. package/src/shared/mock_state_view.ts +188 -0
  241. package/src/shared/submit-transactions.ts +11 -16
  242. package/src/shared/uniswap_l1_l2.ts +86 -102
  243. package/src/simulators/lending_simulator.ts +11 -7
  244. package/src/simulators/token_simulator.ts +6 -30
  245. package/src/spartan/DEVELOP.md +7 -0
  246. package/src/spartan/setup_test_wallets.ts +205 -29
  247. package/src/spartan/tx_metrics.ts +376 -0
  248. package/src/spartan/utils/bot.ts +188 -0
  249. package/src/spartan/utils/chaos.ts +253 -0
  250. package/src/spartan/utils/clients.ts +100 -0
  251. package/src/spartan/utils/config.ts +29 -0
  252. package/src/spartan/utils/health.ts +255 -0
  253. package/src/spartan/utils/helm.ts +84 -0
  254. package/src/spartan/utils/index.ts +71 -0
  255. package/src/spartan/utils/k8s.ts +535 -0
  256. package/src/spartan/utils/nodes.ts +543 -0
  257. package/src/spartan/utils/pod_logs.ts +99 -0
  258. package/src/spartan/utils/scripts.ts +99 -0
  259. package/src/spartan/utils.ts +1 -942
  260. package/src/test-wallet/test_wallet.ts +294 -0
  261. package/src/test-wallet/utils.ts +112 -0
  262. package/src/test-wallet/wallet_worker_script.ts +60 -0
  263. package/src/test-wallet/worker_wallet.ts +213 -0
  264. package/src/test-wallet/worker_wallet_schema.ts +13 -0
  265. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  266. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  267. package/dest/fixtures/setup_l1_contracts.js +0 -17
  268. package/dest/fixtures/snapshot_manager.d.ts +0 -95
  269. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  270. package/dest/fixtures/snapshot_manager.js +0 -505
  271. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  272. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  273. package/src/fixtures/setup_l1_contracts.ts +0 -26
  274. 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, createExtendedL1Client } from '@aztec/ethereum';
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 { TestWallet, proveInteraction, registerInitialSandboxAccountsInWallet } from '@aztec/test-wallet/server';
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 registerInitialSandboxAccountsInWallet(wallet)).slice(
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 = await TokenContract.at(tokenAddress, wallet);
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 deploySponsoredTestAccounts(
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({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
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({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
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 = await TokenContract.at(tokenAddress, wallet);
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 } }).wait();
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 = await TokenContract.at(tokenAddress, wallet);
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.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
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 tokenContract = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
218
- .send({
219
- from: admin,
220
- fee: {
221
- paymentMethod,
222
- },
223
- })
224
- .deployed({ timeout: 600 });
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(async acc =>
232
- (await TokenContract.at(tokenAddress, wallet)).methods
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(async acc => {
264
- const token = await TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
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().wait({ timeout: 600 })));
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<{ wallet: TestWallet; aztecNode: AztecNode; cleanup: () => Promise<void> }> {
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
+ }