@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.
Files changed (316) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/benchmark.d.ts +76 -0
  3. package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
  4. package/dest/bench/client_flows/benchmark.js +298 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
  6. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
  7. package/dest/bench/client_flows/client_flows_benchmark.js +318 -0
  8. package/dest/bench/client_flows/config.d.ts +14 -0
  9. package/dest/bench/client_flows/config.d.ts.map +1 -0
  10. package/dest/bench/client_flows/config.js +124 -0
  11. package/dest/bench/client_flows/data_extractor.d.ts +2 -0
  12. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
  13. package/dest/bench/client_flows/data_extractor.js +79 -0
  14. package/dest/bench/utils.d.ts +16 -41
  15. package/dest/bench/utils.d.ts.map +1 -1
  16. package/dest/bench/utils.js +46 -72
  17. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +30 -20
  18. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  19. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +137 -106
  20. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +44 -33
  21. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  22. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +136 -103
  23. package/dest/e2e_deploy_contract/deploy_test.d.ts +20 -11
  24. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  25. package/dest/e2e_deploy_contract/deploy_test.js +28 -28
  26. package/dest/e2e_epochs/epochs_test.d.ts +98 -24
  27. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  28. package/dest/e2e_epochs/epochs_test.js +366 -61
  29. package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
  30. package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
  31. package/dest/e2e_fees/bridging_race.notest.js +61 -0
  32. package/dest/e2e_fees/fees_test.d.ts +42 -24
  33. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  34. package/dest/e2e_fees/fees_test.js +194 -182
  35. package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
  36. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
  37. package/dest/e2e_l1_publisher/write_json.js +56 -0
  38. package/dest/e2e_multi_validator/utils.d.ts +12 -0
  39. package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
  40. package/dest/e2e_multi_validator/utils.js +214 -0
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts +16 -16
  42. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  43. package/dest/e2e_nested_contract/nested_contract_test.js +38 -43
  44. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  45. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  46. package/dest/e2e_p2p/inactivity_slash_test.js +137 -0
  47. package/dest/e2e_p2p/p2p_network.d.ts +287 -31
  48. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  49. package/dest/e2e_p2p/p2p_network.js +281 -183
  50. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  51. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  52. package/dest/e2e_p2p/reqresp/utils.js +206 -0
  53. package/dest/e2e_p2p/shared.d.ts +73 -8
  54. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  55. package/dest/e2e_p2p/shared.js +205 -27
  56. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  57. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  58. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  59. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  60. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  61. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  62. package/dest/e2e_token_contract/token_contract_test.d.ts +30 -15
  63. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  64. package/dest/e2e_token_contract/token_contract_test.js +110 -76
  65. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  66. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  67. package/dest/fixtures/authwit_proxy.js +34 -0
  68. package/dest/fixtures/e2e_prover_test.d.ts +56 -0
  69. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  70. package/dest/fixtures/e2e_prover_test.js +267 -0
  71. package/dest/fixtures/elu_monitor.d.ts +21 -0
  72. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  73. package/dest/fixtures/elu_monitor.js +102 -0
  74. package/dest/fixtures/fixtures.d.ts +79 -8
  75. package/dest/fixtures/fixtures.d.ts.map +1 -1
  76. package/dest/fixtures/fixtures.js +76 -5
  77. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  78. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  79. package/dest/fixtures/get_acvm_config.js +3 -15
  80. package/dest/fixtures/get_bb_config.d.ts +2 -2
  81. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  82. package/dest/fixtures/get_bb_config.js +10 -17
  83. package/dest/fixtures/ha_setup.d.ts +71 -0
  84. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  85. package/dest/fixtures/ha_setup.js +116 -0
  86. package/dest/fixtures/index.d.ts +2 -1
  87. package/dest/fixtures/index.d.ts.map +1 -1
  88. package/dest/fixtures/index.js +1 -0
  89. package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
  90. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  91. package/dest/fixtures/l1_to_l2_messaging.js +45 -19
  92. package/dest/fixtures/logging.d.ts +1 -1
  93. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  94. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  95. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  96. package/dest/fixtures/setup.d.ts +272 -0
  97. package/dest/fixtures/setup.d.ts.map +1 -0
  98. package/dest/fixtures/setup.js +735 -0
  99. package/dest/fixtures/setup_p2p_test.d.ts +28 -16
  100. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  101. package/dest/fixtures/setup_p2p_test.js +103 -32
  102. package/dest/fixtures/token_utils.d.ts +10 -4
  103. package/dest/fixtures/token_utils.d.ts.map +1 -1
  104. package/dest/fixtures/token_utils.js +30 -13
  105. package/dest/fixtures/utils.d.ts +5 -153
  106. package/dest/fixtures/utils.d.ts.map +1 -1
  107. package/dest/fixtures/utils.js +4 -552
  108. package/dest/fixtures/web3signer.d.ts +5 -0
  109. package/dest/fixtures/web3signer.d.ts.map +1 -0
  110. package/dest/fixtures/web3signer.js +53 -0
  111. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  112. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  113. package/dest/fixtures/with_telemetry_utils.js +2 -2
  114. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  115. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  116. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  117. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  118. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  119. package/dest/forward-compatibility/wallet_service.js +109 -0
  120. package/dest/index.d.ts +1 -1
  121. package/dest/install_legacy_contracts.d.cts +10 -0
  122. package/dest/install_legacy_contracts.d.cts.map +1 -0
  123. package/dest/legacy-jest-resolver.d.cts +3 -0
  124. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  125. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  126. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  127. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  128. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  129. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  130. package/dest/quality_of_service/prometheus_client.js +67 -0
  131. package/dest/shared/cross_chain_test_harness.d.ts +46 -27
  132. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  133. package/dest/shared/cross_chain_test_harness.js +113 -55
  134. package/dest/shared/gas_portal_test_harness.d.ts +39 -28
  135. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  136. package/dest/shared/gas_portal_test_harness.js +64 -34
  137. package/dest/shared/index.d.ts +3 -2
  138. package/dest/shared/index.d.ts.map +1 -1
  139. package/dest/shared/index.js +1 -0
  140. package/dest/shared/jest_setup.d.ts +1 -1
  141. package/dest/shared/jest_setup.js +42 -2
  142. package/dest/shared/mock_state_view.d.ts +86 -0
  143. package/dest/shared/mock_state_view.d.ts.map +1 -0
  144. package/dest/shared/mock_state_view.js +186 -0
  145. package/dest/shared/submit-transactions.d.ts +6 -4
  146. package/dest/shared/submit-transactions.d.ts.map +1 -1
  147. package/dest/shared/submit-transactions.js +15 -16
  148. package/dest/shared/uniswap_l1_l2.d.ts +3 -25
  149. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  150. package/dest/shared/uniswap_l1_l2.js +202 -135
  151. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  152. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  153. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  154. package/dest/simulators/index.d.ts +1 -1
  155. package/dest/simulators/lending_simulator.d.ts +16 -9
  156. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  157. package/dest/simulators/lending_simulator.js +38 -27
  158. package/dest/simulators/token_simulator.d.ts +6 -3
  159. package/dest/simulators/token_simulator.d.ts.map +1 -1
  160. package/dest/simulators/token_simulator.js +12 -30
  161. package/dest/spartan/setup_test_wallets.d.ts +36 -11
  162. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  163. package/dest/spartan/setup_test_wallets.js +301 -63
  164. package/dest/spartan/tx_metrics.d.ts +102 -0
  165. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  166. package/dest/spartan/tx_metrics.js +475 -0
  167. package/dest/spartan/utils/bot.d.ts +28 -0
  168. package/dest/spartan/utils/bot.d.ts.map +1 -0
  169. package/dest/spartan/utils/bot.js +142 -0
  170. package/dest/spartan/utils/chaos.d.ts +79 -0
  171. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  172. package/dest/spartan/utils/chaos.js +142 -0
  173. package/dest/spartan/utils/clients.d.ts +39 -0
  174. package/dest/spartan/utils/clients.d.ts.map +1 -0
  175. package/dest/spartan/utils/clients.js +90 -0
  176. package/dest/spartan/utils/config.d.ts +19 -0
  177. package/dest/spartan/utils/config.d.ts.map +1 -0
  178. package/dest/spartan/utils/config.js +23 -0
  179. package/dest/spartan/utils/health.d.ts +63 -0
  180. package/dest/spartan/utils/health.d.ts.map +1 -0
  181. package/dest/spartan/utils/health.js +202 -0
  182. package/dest/spartan/utils/helm.d.ts +15 -0
  183. package/dest/spartan/utils/helm.d.ts.map +1 -0
  184. package/dest/spartan/utils/helm.js +47 -0
  185. package/dest/spartan/utils/index.d.ts +11 -0
  186. package/dest/spartan/utils/index.d.ts.map +1 -0
  187. package/dest/spartan/utils/index.js +22 -0
  188. package/dest/spartan/utils/k8s.d.ts +128 -0
  189. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  190. package/dest/spartan/utils/k8s.js +381 -0
  191. package/dest/spartan/utils/nodes.d.ts +40 -0
  192. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  193. package/dest/spartan/utils/nodes.js +461 -0
  194. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  195. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  196. package/dest/spartan/utils/pod_logs.js +74 -0
  197. package/dest/spartan/utils/scripts.d.ts +30 -0
  198. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  199. package/dest/spartan/utils/scripts.js +81 -0
  200. package/dest/spartan/utils.d.ts +2 -415
  201. package/dest/spartan/utils.d.ts.map +1 -1
  202. package/dest/spartan/utils.js +1 -445
  203. package/dest/test-wallet/test_wallet.d.ts +85 -0
  204. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  205. package/dest/test-wallet/test_wallet.js +273 -0
  206. package/dest/test-wallet/utils.d.ts +41 -0
  207. package/dest/test-wallet/utils.d.ts.map +1 -0
  208. package/dest/test-wallet/utils.js +66 -0
  209. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  210. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  211. package/dest/test-wallet/wallet_worker_script.js +53 -0
  212. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  213. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  214. package/dest/test-wallet/worker_wallet.js +155 -0
  215. package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
  216. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  217. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  218. package/package.json +79 -64
  219. package/src/bench/client_flows/benchmark.ts +382 -0
  220. package/src/bench/client_flows/client_flows_benchmark.ts +399 -0
  221. package/src/bench/client_flows/config.ts +69 -0
  222. package/src/bench/client_flows/data_extractor.ts +89 -0
  223. package/src/bench/utils.ts +49 -87
  224. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +164 -172
  225. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +194 -183
  226. package/src/e2e_deploy_contract/deploy_test.ts +42 -49
  227. package/src/e2e_epochs/epochs_test.ts +451 -93
  228. package/src/e2e_fees/bridging_race.notest.ts +74 -0
  229. package/src/e2e_fees/fees_test.ts +249 -262
  230. package/src/e2e_l1_publisher/write_json.ts +77 -0
  231. package/src/e2e_multi_validator/utils.ts +258 -0
  232. package/src/e2e_nested_contract/nested_contract_test.ts +51 -60
  233. package/src/e2e_p2p/inactivity_slash_test.ts +180 -0
  234. package/src/e2e_p2p/p2p_network.ts +391 -240
  235. package/src/e2e_p2p/reqresp/utils.ts +274 -0
  236. package/src/e2e_p2p/shared.ts +304 -39
  237. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  238. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  239. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  240. package/src/e2e_token_contract/token_contract_test.ts +140 -124
  241. package/src/fixtures/authwit_proxy.ts +54 -0
  242. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  243. package/src/fixtures/e2e_prover_test.ts +329 -0
  244. package/src/fixtures/elu_monitor.ts +126 -0
  245. package/src/fixtures/fixtures.ts +98 -7
  246. package/src/fixtures/get_acvm_config.ts +4 -12
  247. package/src/fixtures/get_bb_config.ts +19 -13
  248. package/src/fixtures/ha_setup.ts +188 -0
  249. package/src/fixtures/index.ts +1 -0
  250. package/src/fixtures/l1_to_l2_messaging.ts +56 -24
  251. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  252. package/src/fixtures/setup.ts +1056 -0
  253. package/src/fixtures/setup_p2p_test.ts +142 -54
  254. package/src/fixtures/token_utils.ts +34 -16
  255. package/src/fixtures/utils.ts +29 -820
  256. package/src/fixtures/web3signer.ts +63 -0
  257. package/src/fixtures/with_telemetry_utils.ts +2 -2
  258. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  259. package/src/forward-compatibility/wallet_service.ts +104 -0
  260. package/src/guides/up_quick_start.sh +9 -19
  261. package/src/install_legacy_contracts.cjs +75 -0
  262. package/src/legacy-jest-resolver.cjs +112 -0
  263. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
  264. package/src/quality_of_service/prometheus_client.ts +113 -0
  265. package/src/shared/cross_chain_test_harness.ts +116 -90
  266. package/src/shared/gas_portal_test_harness.ts +75 -56
  267. package/src/shared/index.ts +2 -1
  268. package/src/shared/jest_setup.ts +52 -2
  269. package/src/shared/mock_state_view.ts +188 -0
  270. package/src/shared/submit-transactions.ts +19 -20
  271. package/src/shared/uniswap_l1_l2.ts +259 -234
  272. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  273. package/src/simulators/lending_simulator.ts +43 -26
  274. package/src/simulators/token_simulator.ts +18 -34
  275. package/src/spartan/DEVELOP.md +128 -0
  276. package/src/spartan/setup_test_wallets.ts +420 -96
  277. package/src/spartan/tx_metrics.ts +434 -0
  278. package/src/spartan/utils/bot.ts +188 -0
  279. package/src/spartan/utils/chaos.ts +253 -0
  280. package/src/spartan/utils/clients.ts +100 -0
  281. package/src/spartan/utils/config.ts +29 -0
  282. package/src/spartan/utils/health.ts +255 -0
  283. package/src/spartan/utils/helm.ts +84 -0
  284. package/src/spartan/utils/index.ts +71 -0
  285. package/src/spartan/utils/k8s.ts +535 -0
  286. package/src/spartan/utils/nodes.ts +543 -0
  287. package/src/spartan/utils/pod_logs.ts +99 -0
  288. package/src/spartan/utils/scripts.ts +99 -0
  289. package/src/spartan/utils.ts +1 -582
  290. package/src/test-wallet/test_wallet.ts +376 -0
  291. package/src/test-wallet/utils.ts +108 -0
  292. package/src/test-wallet/wallet_worker_script.ts +63 -0
  293. package/src/test-wallet/worker_wallet.ts +218 -0
  294. package/src/test-wallet/worker_wallet_schema.ts +13 -0
  295. package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
  296. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  297. package/dest/e2e_prover/e2e_prover_test.js +0 -291
  298. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  299. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  300. package/dest/fixtures/setup_l1_contracts.js +0 -17
  301. package/dest/fixtures/snapshot_manager.d.ts +0 -87
  302. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  303. package/dest/fixtures/snapshot_manager.js +0 -479
  304. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  305. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  306. package/dest/sample-dapp/connect.js +0 -12
  307. package/dest/sample-dapp/contracts.js +0 -10
  308. package/dest/sample-dapp/deploy.js +0 -35
  309. package/dest/sample-dapp/index.js +0 -98
  310. package/src/e2e_prover/e2e_prover_test.ts +0 -418
  311. package/src/fixtures/setup_l1_contracts.ts +0 -27
  312. package/src/fixtures/snapshot_manager.ts +0 -617
  313. package/src/sample-dapp/connect.mjs +0 -16
  314. package/src/sample-dapp/contracts.mjs +0 -14
  315. package/src/sample-dapp/deploy.mjs +0 -40
  316. package/src/sample-dapp/index.mjs +0 -128
@@ -0,0 +1,218 @@
1
+ import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
2
+ import type { InteractionWaitOptions, SendReturn } from '@aztec/aztec.js/contracts';
3
+ import type {
4
+ Aliased,
5
+ AppCapabilities,
6
+ BatchResults,
7
+ BatchedMethod,
8
+ ContractClassMetadata,
9
+ ContractMetadata,
10
+ ExecuteUtilityOptions,
11
+ PrivateEvent,
12
+ PrivateEventFilter,
13
+ ProfileOptions,
14
+ SendOptions,
15
+ SimulateOptions,
16
+ TxSimulationResultWithAppOffset,
17
+ Wallet,
18
+ WalletCapabilities,
19
+ } from '@aztec/aztec.js/wallet';
20
+ import type { ChainInfo } from '@aztec/entrypoints/interfaces';
21
+ import type { Fr } from '@aztec/foundation/curves/bn254';
22
+ import { jsonStringify } from '@aztec/foundation/json-rpc';
23
+ import { createLogger } from '@aztec/foundation/log';
24
+ import { promiseWithResolvers } from '@aztec/foundation/promise';
25
+ import { type ApiSchema, getSchemaReturnType } from '@aztec/foundation/schemas';
26
+ import { sleep } from '@aztec/foundation/sleep';
27
+ import { NodeConnector, TransportClient } from '@aztec/foundation/transport';
28
+ import type { PXEConfig } from '@aztec/pxe/config';
29
+ import type { ContractArtifact, EventMetadataDefinition, FunctionCall } from '@aztec/stdlib/abi';
30
+ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
31
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
32
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
33
+ import type { ExecutionPayload, TxProfileResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
34
+ import { Tx } from '@aztec/stdlib/tx';
35
+
36
+ import { Worker } from 'worker_threads';
37
+
38
+ import { WorkerWalletSchema } from './worker_wallet_schema.js';
39
+
40
+ type WorkerMsg = { fn: string; args: string };
41
+
42
+ const log = createLogger('e2e:test-wallet:worker-wallet');
43
+
44
+ const WORKER_READY_TIMEOUT_MS = 120_000;
45
+
46
+ /**
47
+ * Wallet implementation that offloads all work to a worker thread.
48
+ * Implements the Wallet interface by proxying calls over a transport layer
49
+ * using JSON serialization with Zod schema parsing on both ends.
50
+ */
51
+ export class WorkerWallet implements Wallet {
52
+ private constructor(
53
+ private worker: Worker,
54
+ private client: TransportClient<WorkerMsg>,
55
+ ) {}
56
+
57
+ /**
58
+ * Creates a WorkerWallet by spawning a worker thread that creates a TestWallet internally.
59
+ * @param nodeUrl - URL of the Aztec node to connect to.
60
+ * @param pxeConfig - Optional PXE configuration overrides.
61
+ * @returns A WorkerWallet ready to use.
62
+ */
63
+ static async create(nodeUrl: string, pxeConfig?: Partial<PXEConfig>): Promise<WorkerWallet> {
64
+ // replace stc/ with dest/ so the wallet works in Jest tests
65
+ const workerUrl = new URL('./wallet_worker_script.js', import.meta.url);
66
+ workerUrl.pathname = workerUrl.pathname.replace('/src/', '/dest/');
67
+ // remove JEST_WORKER_ID so the worker uses pino-pretty transport instead of Jest's raw output.
68
+ const { JEST_WORKER_ID: _, ...parentEnv } = process.env;
69
+ const worker = new Worker(workerUrl, {
70
+ workerData: { nodeUrl, pxeConfig },
71
+ env: {
72
+ ...parentEnv,
73
+ ...(process.stderr.isTTY || process.env.FORCE_COLOR ? { FORCE_COLOR: '1' } : {}),
74
+ LOG_LEVEL: process.env.WORKER_LOG_LEVEL ?? 'info',
75
+ },
76
+ });
77
+
78
+ const connector = new NodeConnector(worker);
79
+ const client = new TransportClient<WorkerMsg>(connector);
80
+ await client.open();
81
+
82
+ const wallet = new WorkerWallet(worker, client);
83
+
84
+ const { promise: workerDied, reject: rejectWorkerDied } = promiseWithResolvers<void>();
85
+ // reject if the worker exits or errors before the warmup completes.
86
+ const onError = (err: Error): void => {
87
+ worker.off('exit', onExit!);
88
+ rejectWorkerDied(new Error(`Worker wallet thread error: ${err.message}`));
89
+ };
90
+
91
+ const onExit = (code: number): void => {
92
+ worker.off('error', onError!);
93
+ rejectWorkerDied(new Error(`Worker wallet thread exited with code ${code} before becoming ready`));
94
+ };
95
+
96
+ worker.once('error', onError);
97
+ worker.once('exit', onExit);
98
+
99
+ const timeout = sleep(WORKER_READY_TIMEOUT_MS).then(() => {
100
+ throw new Error(`Worker wallet creation timed out after ${WORKER_READY_TIMEOUT_MS / 1000}s`);
101
+ });
102
+
103
+ try {
104
+ // wait for worker wallet to start
105
+ await Promise.race([wallet.getChainInfo(), workerDied, timeout]);
106
+ } catch (err) {
107
+ log.error('Worker wallet creation failed, cleaning up', { error: String(err) });
108
+ client.close();
109
+ await worker.terminate();
110
+ throw err;
111
+ } finally {
112
+ worker.off('error', onError);
113
+ worker.off('exit', onExit);
114
+ }
115
+
116
+ return wallet;
117
+ }
118
+
119
+ private async callRaw(fn: string, ...args: any[]): Promise<string> {
120
+ const argsJson = jsonStringify(args);
121
+ return (await this.client.request({ fn, args: argsJson })) as string;
122
+ }
123
+
124
+ private async call(fn: string, ...args: any[]): Promise<any> {
125
+ const resultJson = await this.callRaw(fn, ...args);
126
+ const methodSchema = (WorkerWalletSchema as ApiSchema)[fn];
127
+ return getSchemaReturnType(methodSchema).parseAsync(JSON.parse(resultJson));
128
+ }
129
+
130
+ getChainInfo(): Promise<ChainInfo> {
131
+ return this.call('getChainInfo');
132
+ }
133
+
134
+ getContractMetadata(address: AztecAddress): Promise<ContractMetadata> {
135
+ return this.call('getContractMetadata', address);
136
+ }
137
+
138
+ getContractClassMetadata(id: Fr): Promise<ContractClassMetadata> {
139
+ return this.call('getContractClassMetadata', id);
140
+ }
141
+
142
+ getPrivateEvents<T>(
143
+ eventMetadata: EventMetadataDefinition,
144
+ eventFilter: PrivateEventFilter,
145
+ ): Promise<PrivateEvent<T>[]> {
146
+ return this.call('getPrivateEvents', eventMetadata, eventFilter);
147
+ }
148
+
149
+ registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress> {
150
+ return this.call('registerSender', address, alias);
151
+ }
152
+
153
+ getAddressBook(): Promise<Aliased<AztecAddress>[]> {
154
+ return this.call('getAddressBook');
155
+ }
156
+
157
+ getAccounts(): Promise<Aliased<AztecAddress>[]> {
158
+ return this.call('getAccounts');
159
+ }
160
+
161
+ registerContract(
162
+ instance: ContractInstanceWithAddress,
163
+ artifact?: ContractArtifact,
164
+ secretKey?: Fr,
165
+ ): Promise<ContractInstanceWithAddress> {
166
+ return this.call('registerContract', instance, artifact, secretKey);
167
+ }
168
+
169
+ registerContractClass(artifact: ContractArtifact): Promise<void> {
170
+ return this.call('registerContractClass', artifact);
171
+ }
172
+
173
+ simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResultWithAppOffset> {
174
+ return this.call('simulateTx', exec, opts);
175
+ }
176
+
177
+ executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult> {
178
+ return this.call('executeUtility', call, opts);
179
+ }
180
+
181
+ profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult> {
182
+ return this.call('profileTx', exec, opts);
183
+ }
184
+
185
+ sendTx<W extends InteractionWaitOptions = undefined>(
186
+ exec: ExecutionPayload,
187
+ opts: SendOptions<W>,
188
+ ): Promise<SendReturn<W>> {
189
+ return this.call('sendTx', exec, opts);
190
+ }
191
+
192
+ proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<Tx> {
193
+ return this.call('proveTx', exec, opts);
194
+ }
195
+
196
+ /** Registers an account inside the worker's TestWallet, populating its accounts map. */
197
+ registerAccount(secret: Fr, salt: Fr): Promise<AztecAddress> {
198
+ return this.call('registerAccount', secret, salt);
199
+ }
200
+
201
+ createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness> {
202
+ return this.call('createAuthWit', from, messageHashOrIntent);
203
+ }
204
+
205
+ requestCapabilities(manifest: AppCapabilities): Promise<WalletCapabilities> {
206
+ return this.call('requestCapabilities', manifest);
207
+ }
208
+
209
+ batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>> {
210
+ return this.call('batch', methods);
211
+ }
212
+
213
+ /** Shuts down the worker thread and closes the transport. */
214
+ async stop(): Promise<void> {
215
+ this.client.close();
216
+ await this.worker.terminate();
217
+ }
218
+ }
@@ -0,0 +1,13 @@
1
+ import { ExecutionPayloadSchema, SendOptionsSchema, WalletSchema } from '@aztec/aztec.js/wallet';
2
+ import { schemas } from '@aztec/foundation/schemas';
3
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import { Tx } from '@aztec/stdlib/tx';
5
+
6
+ import { z } from 'zod';
7
+
8
+ /** Schema for the WorkerWallet API — extends WalletSchema with proveTx and registerAccount. */
9
+ export const WorkerWalletSchema = {
10
+ ...WalletSchema,
11
+ proveTx: z.function({ input: z.tuple([ExecutionPayloadSchema, SendOptionsSchema]), output: Tx.schema }),
12
+ registerAccount: z.function({ input: z.tuple([schemas.Fr, schemas.Fr]), output: AztecAddress.schema }),
13
+ };
@@ -1,56 +0,0 @@
1
- import type { InitialAccountData } from '@aztec/accounts/testing';
2
- import { type AccountWalletWithSecretKey, type AztecNode, type CheatCodes, type CompleteAddress, type DeployL1ContractsReturnType, EthAddress, type Logger } from '@aztec/aztec.js';
3
- import { type ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
4
- import type { BlobSinkServer } from '@aztec/blob-sink/server';
5
- import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
- import type { PXEService } from '@aztec/pxe/server';
7
- import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
8
- import { TokenSimulator } from '../simulators/token_simulator.js';
9
- /**
10
- * Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
11
- * However, we then setup a second PXE with a full prover instance.
12
- * We configure this instance with all of the accounts and contracts.
13
- * We then prove and verify transactions created via this full prover PXE.
14
- */
15
- export declare class FullProverTest {
16
- private minNumberOfTxsPerBlock;
17
- private realProofs;
18
- static TOKEN_NAME: string;
19
- static TOKEN_SYMBOL: string;
20
- static TOKEN_DECIMALS: bigint;
21
- private snapshotManager;
22
- logger: Logger;
23
- deployedAccounts: InitialAccountData[];
24
- wallets: AccountWalletWithSecretKey[];
25
- accounts: CompleteAddress[];
26
- fakeProofsAsset: TokenContract;
27
- tokenSim: TokenSimulator;
28
- aztecNode: AztecNode;
29
- pxe: PXEService;
30
- cheatCodes: CheatCodes;
31
- blobSink: BlobSinkServer;
32
- private provenComponents;
33
- private bbConfigCleanup?;
34
- private acvmConfigCleanup?;
35
- circuitProofVerifier?: ClientProtocolCircuitVerifier;
36
- provenAssets: TokenContract[];
37
- private context;
38
- private proverNode;
39
- private simulatedProverNode;
40
- l1Contracts: DeployL1ContractsReturnType;
41
- proverAddress: EthAddress;
42
- constructor(testName: string, minNumberOfTxsPerBlock: number, coinbase: EthAddress, realProofs?: boolean);
43
- /**
44
- * Adds two state shifts to snapshot manager.
45
- * 1. Add 2 accounts.
46
- * 2. Publicly deploy accounts, deploy token contract
47
- */
48
- applyBaseSnapshots(): Promise<void>;
49
- setup(): Promise<this>;
50
- private mintL1ERC20;
51
- snapshot: <T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>) => Promise<void>;
52
- teardown(): Promise<void>;
53
- applyMintSnapshot(): Promise<void>;
54
- deployVerifier(): Promise<void>;
55
- }
56
- //# sourceMappingURL=e2e_prover_test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"e2e_prover_test.d.ts","sourceRoot":"","sources":["../../src/e2e_prover/e2e_prover_test.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,UAAU,EACV,KAAK,MAAM,EAIZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAqB,KAAK,6BAA6B,EAAuB,MAAM,kBAAkB,CAAC;AAE9G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQpD,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AASlE;;;;;GAKG;AAEH,qBAAa,cAAc;IA4BvB,OAAO,CAAC,sBAAsB;IAE9B,OAAO,CAAC,UAAU;IA7BpB,MAAM,CAAC,UAAU,SAAU;IAC3B,MAAM,CAAC,YAAY,SAAS;IAC5B,MAAM,CAAC,cAAc,SAAO;IAC5B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,kBAAkB,EAAE,CAAM;IAC5C,OAAO,EAAE,0BAA0B,EAAE,CAAM;IAC3C,QAAQ,EAAE,eAAe,EAAE,CAAM;IACjC,eAAe,EAAG,aAAa,CAAC;IAChC,QAAQ,EAAG,cAAc,CAAC;IAC1B,SAAS,EAAG,SAAS,CAAC;IACtB,GAAG,EAAG,UAAU,CAAC;IACjB,UAAU,EAAG,UAAU,CAAC;IACxB,QAAQ,EAAG,cAAc,CAAC;IAC1B,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,eAAe,CAAC,CAAsB;IAC9C,OAAO,CAAC,iBAAiB,CAAC,CAAsB;IAChD,oBAAoB,CAAC,EAAE,6BAA6B,CAAC;IACrD,YAAY,EAAE,aAAa,EAAE,CAAM;IACnC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,mBAAmB,CAAc;IAClC,WAAW,EAAG,2BAA2B,CAAC;IAC1C,aAAa,EAAG,UAAU,CAAC;gBAGhC,QAAQ,EAAE,MAAM,EACR,sBAAsB,EAAE,MAAM,EACtC,QAAQ,EAAE,UAAU,EACZ,UAAU,UAAO;IAW3B;;;;OAIG;IACG,kBAAkB;IAqDlB,KAAK;YA0JG,WAAW;IAQzB,QAAQ,YACA,MAAM,SACL,CAAC,OAAO,EAAE,iBAAiB,KAAK,QAAQ,CAAC,CAAC,YACxC,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,QAAQ,IAAI,CAAC,KACtE,QAAQ,IAAI,CAAC,CAAwD;IAElE,QAAQ;IAeR,iBAAiB;IAiDjB,cAAc;CA4BrB"}
@@ -1,291 +0,0 @@
1
- import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
2
- import { createArchiver } from '@aztec/archiver';
3
- import { EthAddress, createLogger, deployL1Contract } from '@aztec/aztec.js';
4
- import { BBCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
5
- import { createBlobSinkClient } from '@aztec/blob-sink/client';
6
- import { Buffer32 } from '@aztec/foundation/buffer';
7
- import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
8
- import { TokenContract } from '@aztec/noir-contracts.js/Token';
9
- import { createProverNode } from '@aztec/prover-node';
10
- import { getGenesisValues } from '@aztec/world-state/testing';
11
- import { getContract } from 'viem';
12
- import { privateKeyToAddress } from 'viem/accounts';
13
- import { getACVMConfig } from '../fixtures/get_acvm_config.js';
14
- import { getBBConfig } from '../fixtures/get_bb_config.js';
15
- import { createSnapshotManager, deployAccounts, publicDeployAccounts } from '../fixtures/snapshot_manager.js';
16
- import { getPrivateKeyFromIndex, setupPXEService } from '../fixtures/utils.js';
17
- import { TokenSimulator } from '../simulators/token_simulator.js';
18
- const { E2E_DATA_PATH: dataPath } = process.env;
19
- /**
20
- * Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
21
- * However, we then setup a second PXE with a full prover instance.
22
- * We configure this instance with all of the accounts and contracts.
23
- * We then prove and verify transactions created via this full prover PXE.
24
- */ export class FullProverTest {
25
- minNumberOfTxsPerBlock;
26
- realProofs;
27
- static TOKEN_NAME = 'USDC';
28
- static TOKEN_SYMBOL = 'USD';
29
- static TOKEN_DECIMALS = 18n;
30
- snapshotManager;
31
- logger;
32
- deployedAccounts;
33
- wallets;
34
- accounts;
35
- fakeProofsAsset;
36
- tokenSim;
37
- aztecNode;
38
- pxe;
39
- cheatCodes;
40
- blobSink;
41
- provenComponents;
42
- bbConfigCleanup;
43
- acvmConfigCleanup;
44
- circuitProofVerifier;
45
- provenAssets;
46
- context;
47
- proverNode;
48
- simulatedProverNode;
49
- l1Contracts;
50
- proverAddress;
51
- constructor(testName, minNumberOfTxsPerBlock, coinbase, realProofs = true){
52
- this.minNumberOfTxsPerBlock = minNumberOfTxsPerBlock;
53
- this.realProofs = realProofs;
54
- this.deployedAccounts = [];
55
- this.wallets = [];
56
- this.accounts = [];
57
- this.provenComponents = [];
58
- this.provenAssets = [];
59
- this.snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
60
- this.logger = createLogger(`e2e:full_prover_test:${testName}`);
61
- this.snapshotManager = createSnapshotManager(`full_prover_integration/${testName}`, dataPath, {
62
- startProverNode: true,
63
- fundRewardDistributor: true,
64
- coinbase
65
- }, {});
66
- }
67
- /**
68
- * Adds two state shifts to snapshot manager.
69
- * 1. Add 2 accounts.
70
- * 2. Publicly deploy accounts, deploy token contract
71
- */ async applyBaseSnapshots() {
72
- await this.snapshotManager.snapshot('2_accounts', deployAccounts(2, this.logger), async ({ deployedAccounts }, { pxe })=>{
73
- this.deployedAccounts = deployedAccounts;
74
- this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWalletWithSecretKey(pxe, a.secret, a.signingKey, a.salt)));
75
- this.accounts = this.wallets.map((w)=>w.getCompleteAddress());
76
- this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
77
- });
78
- await this.snapshotManager.snapshot('client_prover_integration', async ()=>{
79
- // Create the token contract state.
80
- // Move this account thing to addAccounts above?
81
- this.logger.verbose(`Public deploy accounts...`);
82
- await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2), false);
83
- this.logger.verbose(`Deploying TokenContract...`);
84
- const asset = await TokenContract.deploy(this.wallets[0], this.accounts[0], FullProverTest.TOKEN_NAME, FullProverTest.TOKEN_SYMBOL, FullProverTest.TOKEN_DECIMALS).send().deployed();
85
- this.logger.verbose(`Token deployed to ${asset.address}`);
86
- return {
87
- tokenContractAddress: asset.address
88
- };
89
- }, async ({ tokenContractAddress })=>{
90
- // Restore the token contract state.
91
- this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallets[0]);
92
- this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
93
- this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallets[0], this.logger, this.accounts.map((a)=>a.address));
94
- expect(await this.fakeProofsAsset.methods.get_admin().simulate()).toBe(this.accounts[0].address.toBigInt());
95
- });
96
- }
97
- async setup() {
98
- this.context = await this.snapshotManager.setup();
99
- // We don't wish to mark as proven automatically, so we set the flag to false
100
- this.context.watcher.setIsMarkingAsProven(false);
101
- this.simulatedProverNode = this.context.proverNode;
102
- ({ pxe: this.pxe, aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes, blobSink: this.blobSink } = this.context);
103
- const blobSinkClient = createBlobSinkClient({
104
- blobSinkUrl: `http://localhost:${this.blobSink.port}`
105
- });
106
- // Configure a full prover PXE
107
- let acvmConfig;
108
- let bbConfig;
109
- if (this.realProofs) {
110
- [acvmConfig, bbConfig] = await Promise.all([
111
- getACVMConfig(this.logger),
112
- getBBConfig(this.logger)
113
- ]);
114
- if (!acvmConfig || !bbConfig) {
115
- throw new Error('Missing ACVM or BB config');
116
- }
117
- this.acvmConfigCleanup = acvmConfig.cleanup;
118
- this.bbConfigCleanup = bbConfig.cleanup;
119
- if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
120
- throw new Error(`Test must be run with BB native configuration`);
121
- }
122
- this.circuitProofVerifier = await BBCircuitVerifier.new(bbConfig);
123
- this.logger.debug(`Configuring the node for real proofs...`);
124
- await this.aztecNode.setConfig({
125
- realProofs: true,
126
- minTxsPerBlock: this.minNumberOfTxsPerBlock
127
- });
128
- } else {
129
- this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
130
- this.circuitProofVerifier = new TestCircuitVerifier();
131
- await this.aztecNode.setConfig({
132
- minTxsPerBlock: this.minNumberOfTxsPerBlock
133
- });
134
- }
135
- this.logger.verbose(`Move to a clean epoch`);
136
- await this.context.cheatCodes.rollup.advanceToNextEpoch();
137
- this.logger.verbose(`Marking current block as proven`);
138
- await this.context.cheatCodes.rollup.markAsProven();
139
- this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
140
- for(let i = 0; i < 2; i++){
141
- const result = await setupPXEService(this.aztecNode, {
142
- proverEnabled: this.realProofs,
143
- bbBinaryPath: bbConfig?.bbBinaryPath,
144
- bbWorkingDirectory: bbConfig?.bbWorkingDirectory
145
- }, undefined, true);
146
- this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
147
- await result.pxe.registerContract(this.fakeProofsAsset);
148
- for(let i = 0; i < 2; i++){
149
- await result.pxe.registerAccount(this.deployedAccounts[i].secret, this.wallets[i].getCompleteAddress().partialAddress);
150
- await this.pxe.registerAccount(this.deployedAccounts[i].secret, this.wallets[i].getCompleteAddress().partialAddress);
151
- }
152
- const account = await getSchnorrAccount(result.pxe, this.deployedAccounts[0].secret, this.deployedAccounts[0].signingKey, this.deployedAccounts[0].salt);
153
- await result.pxe.registerContract({
154
- instance: account.getInstance(),
155
- artifact: SchnorrAccountContractArtifact
156
- });
157
- const provenWallet = await account.getWallet();
158
- const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
159
- this.provenComponents.push({
160
- pxe: result.pxe,
161
- teardown: result.teardown
162
- });
163
- this.provenAssets.push(asset);
164
- }
165
- this.logger.info(`Full prover PXE started`);
166
- // Shutdown the current, simulated prover node
167
- this.logger.verbose('Shutting down simulated prover node');
168
- await this.simulatedProverNode.stop();
169
- // Creating temp store and archiver for fully proven prover node
170
- this.logger.verbose('Starting archiver for new prover node');
171
- const archiver = await createArchiver({
172
- ...this.context.aztecNodeConfig,
173
- dataDirectory: undefined
174
- }, blobSinkClient, {
175
- blockUntilSync: true
176
- });
177
- // The simulated prover node (now shutdown) used private key index 2
178
- const proverNodePrivateKey = getPrivateKeyFromIndex(2);
179
- const proverNodeSenderAddress = privateKeyToAddress(new Buffer32(proverNodePrivateKey).toString());
180
- this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
181
- this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
182
- await this.mintL1ERC20(proverNodeSenderAddress, 100_000_000n);
183
- this.logger.verbose('Starting prover node');
184
- const proverConfig = {
185
- ...this.context.aztecNodeConfig,
186
- proverCoordinationNodeUrl: undefined,
187
- dataDirectory: undefined,
188
- proverId: this.proverAddress.toField(),
189
- realProofs: this.realProofs,
190
- proverAgentCount: 2,
191
- publisherPrivateKey: `0x${proverNodePrivateKey.toString('hex')}`,
192
- proverNodeMaxPendingJobs: 100,
193
- proverNodeMaxParallelBlocksPerEpoch: 32,
194
- proverNodePollingIntervalMs: 100,
195
- txGatheringTimeoutMs: 60000,
196
- txGatheringIntervalMs: 1000,
197
- txGatheringMaxParallelRequests: 100
198
- };
199
- const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map((a)=>a.address));
200
- this.proverNode = await createProverNode(proverConfig, {
201
- aztecNodeTxProvider: this.aztecNode,
202
- archiver: archiver,
203
- blobSinkClient
204
- }, {
205
- prefilledPublicData
206
- });
207
- this.proverNode.start();
208
- this.logger.warn(`Proofs are now enabled`);
209
- return this;
210
- }
211
- async mintL1ERC20(recipient, amount) {
212
- const erc20Address = this.context.deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress;
213
- const client = this.context.deployL1ContractsValues.walletClient;
214
- const erc20 = getContract({
215
- abi: TestERC20Abi,
216
- address: erc20Address.toString(),
217
- client
218
- });
219
- const hash = await erc20.write.mint([
220
- recipient,
221
- amount
222
- ]);
223
- await this.context.deployL1ContractsValues.publicClient.waitForTransactionReceipt({
224
- hash
225
- });
226
- }
227
- snapshot;
228
- async teardown() {
229
- await this.snapshotManager.teardown();
230
- // Cleanup related to the full prover PXEs
231
- for(let i = 0; i < this.provenComponents.length; i++){
232
- await this.provenComponents[i].teardown();
233
- }
234
- // clean up the full prover node
235
- await this.proverNode.stop();
236
- await this.bbConfigCleanup?.();
237
- await this.acvmConfigCleanup?.();
238
- }
239
- async applyMintSnapshot() {
240
- await this.snapshotManager.snapshot('mint', async ()=>{
241
- const { fakeProofsAsset: asset, accounts } = this;
242
- const privateAmount = 10000n;
243
- const publicAmount = 10000n;
244
- const waitOpts = {
245
- proven: false
246
- };
247
- this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
248
- await asset.methods.mint_to_public(accounts[0].address, privateAmount + publicAmount).send().wait(waitOpts);
249
- this.logger.verbose(`Transferring ${privateAmount} to private...`);
250
- await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait(waitOpts);
251
- this.logger.verbose(`Minting complete.`);
252
- return {
253
- amount: publicAmount
254
- };
255
- }, async ({ amount })=>{
256
- const { fakeProofsAsset: asset, accounts: [{ address }], tokenSim } = this;
257
- tokenSim.mintPublic(address, amount);
258
- const publicBalance = await asset.methods.balance_of_public(address).simulate();
259
- this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
260
- expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
261
- tokenSim.mintPrivate(address, amount);
262
- const privateBalance = await asset.methods.balance_of_private(address).simulate();
263
- this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
264
- expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
265
- const totalSupply = await asset.methods.total_supply().simulate();
266
- this.logger.verbose(`Total supply: ${totalSupply}`);
267
- expect(totalSupply).toEqual(tokenSim.totalSupply);
268
- return Promise.resolve();
269
- });
270
- }
271
- async deployVerifier() {
272
- if (!this.realProofs) {
273
- return;
274
- }
275
- if (!this.circuitProofVerifier) {
276
- throw new Error('No verifier');
277
- }
278
- const { walletClient, publicClient, l1ContractAddresses } = this.context.deployL1ContractsValues;
279
- const rollup = getContract({
280
- abi: RollupAbi,
281
- address: l1ContractAddresses.rollupAddress.toString(),
282
- client: walletClient
283
- });
284
- const { address: verifierAddress } = await deployL1Contract(walletClient, publicClient, HonkVerifierAbi, HonkVerifierBytecode);
285
- this.logger.info(`Deployed honk verifier at ${verifierAddress}`);
286
- await rollup.write.setEpochVerifier([
287
- verifierAddress.toString()
288
- ]);
289
- this.logger.info('Rollup only accepts valid proofs now');
290
- }
291
- }
@@ -1,6 +0,0 @@
1
- import { type Logger } from '@aztec/aztec.js';
2
- import type { DeployL1ContractsArgs, L1ContractsConfig } from '@aztec/ethereum';
3
- import type { HDAccount, PrivateKeyAccount } from 'viem';
4
- export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
5
- export declare const setupL1Contracts: (l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, logger: Logger, args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'genesisBlockHash' | 'initialValidators'> & L1ContractsConfig) => Promise<import("@aztec/aztec.js").DeployL1ContractsReturnType>;
6
- //# sourceMappingURL=setup_l1_contracts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup_l1_contracts.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_l1_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAqB,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIhF,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAGzD,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAEnG,eAAO,MAAM,gBAAgB,aACjB,MAAM,WACP,SAAS,GAAG,iBAAiB,UAC9B,MAAM,QACR,KAAK,qBAAqB,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC,GAChG,iBAAiB,mEAWpB,CAAC"}
@@ -1,17 +0,0 @@
1
- import { deployL1Contracts } from '@aztec/aztec.js';
2
- import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
3
- import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts';
4
- import { foundry } from 'viem/chains';
5
- export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
6
- export const setupL1Contracts = async (l1RpcUrl, account, logger, args)=>{
7
- const l1Data = await deployL1Contracts([
8
- l1RpcUrl
9
- ], account, foundry, logger, {
10
- l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
11
- vkTreeRoot: getVKTreeRoot(),
12
- protocolContractTreeRoot,
13
- salt: undefined,
14
- ...args
15
- });
16
- return l1Data;
17
- };