@aztec/end-to-end 0.0.1-commit.d431d1c → 0.0.1-commit.d58ff9d0

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 (366) hide show
  1. package/README.md +217 -14
  2. package/dest/automine/automine_test_context.d.ts +85 -0
  3. package/dest/automine/automine_test_context.d.ts.map +1 -0
  4. package/dest/automine/automine_test_context.js +98 -0
  5. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
  6. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  7. package/dest/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
  8. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
  9. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
  10. package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -0
  11. package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
  12. package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
  13. package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
  14. package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
  15. package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
  16. package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
  17. package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
  18. package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
  19. package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +50 -54
  20. package/dest/automine/token/token_contract_test.d.ts +40 -0
  21. package/dest/automine/token/token_contract_test.d.ts.map +1 -0
  22. package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +44 -49
  23. package/dest/automine/token/token_test_helpers.d.ts +73 -0
  24. package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
  25. package/dest/automine/token/token_test_helpers.js +97 -0
  26. package/dest/bench/client_flows/benchmark.d.ts +15 -1
  27. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  28. package/dest/bench/client_flows/benchmark.js +19 -0
  29. package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
  30. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  31. package/dest/bench/client_flows/client_flows_benchmark.js +68 -44
  32. package/dest/bench/client_flows/config.d.ts +2 -2
  33. package/dest/bench/client_flows/config.d.ts.map +1 -1
  34. package/dest/bench/client_flows/config.js +18 -0
  35. package/dest/bench/client_flows/data_extractor.js +1 -0
  36. package/dest/bench/utils.d.ts +7 -6
  37. package/dest/bench/utils.d.ts.map +1 -1
  38. package/dest/bench/utils.js +108 -12
  39. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  40. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  41. package/dest/composed/ha/ha_full_setup.js +383 -0
  42. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  43. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  44. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  45. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  46. package/dest/fixtures/authwit_proxy.js +34 -0
  47. package/dest/fixtures/e2e_prover_test.d.ts +18 -14
  48. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  49. package/dest/fixtures/e2e_prover_test.js +85 -74
  50. package/dest/fixtures/elu_monitor.d.ts +21 -0
  51. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  52. package/dest/fixtures/elu_monitor.js +102 -0
  53. package/dest/fixtures/fixtures.d.ts +83 -1
  54. package/dest/fixtures/fixtures.d.ts.map +1 -1
  55. package/dest/fixtures/fixtures.js +86 -0
  56. package/dest/fixtures/get_bb_config.d.ts +1 -1
  57. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  58. package/dest/fixtures/get_bb_config.js +5 -5
  59. package/dest/fixtures/ha_setup.d.ts +71 -0
  60. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  61. package/dest/fixtures/ha_setup.js +119 -0
  62. package/dest/fixtures/index.d.ts +3 -1
  63. package/dest/fixtures/index.d.ts.map +1 -1
  64. package/dest/fixtures/index.js +2 -0
  65. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  66. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  67. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  68. package/dest/fixtures/setup.d.ts +113 -60
  69. package/dest/fixtures/setup.d.ts.map +1 -1
  70. package/dest/fixtures/setup.js +330 -326
  71. package/dest/fixtures/setup_p2p_test.d.ts +22 -11
  72. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  73. package/dest/fixtures/setup_p2p_test.js +46 -35
  74. package/dest/fixtures/timing.d.ts +42 -0
  75. package/dest/fixtures/timing.d.ts.map +1 -0
  76. package/dest/fixtures/timing.js +72 -0
  77. package/dest/fixtures/token_utils.d.ts +22 -4
  78. package/dest/fixtures/token_utils.d.ts.map +1 -1
  79. package/dest/fixtures/token_utils.js +28 -7
  80. package/dest/fixtures/utils.d.ts +2 -2
  81. package/dest/fixtures/utils.d.ts.map +1 -1
  82. package/dest/fixtures/utils.js +1 -1
  83. package/dest/fixtures/wait_helpers.d.ts +135 -0
  84. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  85. package/dest/fixtures/wait_helpers.js +154 -0
  86. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  87. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  88. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  89. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  90. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  91. package/dest/forward-compatibility/wallet_service.js +109 -0
  92. package/dest/install_legacy_contracts.d.cts +10 -0
  93. package/dest/install_legacy_contracts.d.cts.map +1 -0
  94. package/dest/legacy-jest-resolver.d.cts +3 -0
  95. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  96. package/dest/multi-node/block-production/setup.d.ts +97 -0
  97. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  98. package/dest/multi-node/block-production/setup.js +158 -0
  99. package/dest/multi-node/governance/setup.d.ts +67 -0
  100. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  101. package/dest/multi-node/governance/setup.js +126 -0
  102. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  103. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  104. package/dest/multi-node/multi_node_test_context.js +347 -0
  105. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  106. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  107. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  108. package/dest/multi-node/slashing/setup.d.ts +167 -0
  109. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  110. package/dest/multi-node/slashing/setup.js +275 -0
  111. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +22 -12
  112. package/dest/p2p/p2p_network.d.ts.map +1 -0
  113. package/dest/{e2e_p2p → p2p}/p2p_network.js +99 -35
  114. package/dest/p2p/reqresp/utils.d.ts +19 -0
  115. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  116. package/dest/p2p/reqresp/utils.js +193 -0
  117. package/dest/p2p/shared.d.ts +72 -0
  118. package/dest/p2p/shared.d.ts.map +1 -0
  119. package/dest/p2p/shared.js +212 -0
  120. package/dest/shared/cross_chain_test_harness.d.ts +8 -7
  121. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  122. package/dest/shared/cross_chain_test_harness.js +44 -39
  123. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  124. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  125. package/dest/shared/gas_portal_test_harness.js +27 -15
  126. package/dest/shared/index.d.ts +2 -1
  127. package/dest/shared/index.d.ts.map +1 -1
  128. package/dest/shared/index.js +1 -0
  129. package/dest/shared/jest_setup.js +41 -1
  130. package/dest/shared/mock_state_view.d.ts +86 -0
  131. package/dest/shared/mock_state_view.d.ts.map +1 -0
  132. package/dest/shared/mock_state_view.js +186 -0
  133. package/dest/shared/submit-transactions.d.ts +4 -4
  134. package/dest/shared/submit-transactions.d.ts.map +1 -1
  135. package/dest/shared/submit-transactions.js +19 -14
  136. package/dest/shared/timing_env.d.js +5 -0
  137. package/dest/shared/timing_env.js +365 -0
  138. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  139. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  140. package/dest/shared/uniswap_l1_l2.js +67 -55
  141. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  142. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  143. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  144. package/dest/simulators/lending_simulator.d.ts +10 -3
  145. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  146. package/dest/simulators/lending_simulator.js +29 -17
  147. package/dest/simulators/token_simulator.d.ts +1 -1
  148. package/dest/simulators/token_simulator.d.ts.map +1 -1
  149. package/dest/simulators/token_simulator.js +3 -24
  150. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  151. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  152. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  153. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  154. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  155. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  156. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  157. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  158. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +18 -5
  159. package/dest/single-node/fees/fees_test.d.ts +93 -0
  160. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  161. package/dest/{e2e_fees → single-node/fees}/fees_test.js +96 -70
  162. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  163. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  164. package/dest/single-node/l1-reorgs/setup.js +57 -0
  165. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  166. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  167. package/dest/single-node/partial-proofs/setup.js +5 -0
  168. package/dest/single-node/proving/setup.d.ts +5 -0
  169. package/dest/single-node/proving/setup.d.ts.map +1 -0
  170. package/dest/single-node/proving/setup.js +5 -0
  171. package/dest/single-node/recovery/setup.d.ts +5 -0
  172. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  173. package/dest/single-node/recovery/setup.js +5 -0
  174. package/dest/single-node/setup.d.ts +49 -0
  175. package/dest/single-node/setup.d.ts.map +1 -0
  176. package/dest/single-node/setup.js +56 -0
  177. package/dest/single-node/single_node_test_context.d.ts +360 -0
  178. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  179. package/dest/single-node/single_node_test_context.js +833 -0
  180. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  181. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  182. package/dest/spartan/setup_test_wallets.js +153 -49
  183. package/dest/spartan/tx_metrics.d.ts +64 -5
  184. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  185. package/dest/spartan/tx_metrics.js +280 -21
  186. package/dest/spartan/utils/bot.d.ts +28 -0
  187. package/dest/spartan/utils/bot.d.ts.map +1 -0
  188. package/dest/spartan/utils/bot.js +142 -0
  189. package/dest/spartan/utils/chaos.d.ts +79 -0
  190. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  191. package/dest/spartan/utils/chaos.js +142 -0
  192. package/dest/spartan/utils/clients.d.ts +39 -0
  193. package/dest/spartan/utils/clients.d.ts.map +1 -0
  194. package/dest/spartan/utils/clients.js +90 -0
  195. package/dest/spartan/utils/config.d.ts +19 -0
  196. package/dest/spartan/utils/config.d.ts.map +1 -0
  197. package/dest/spartan/utils/config.js +23 -0
  198. package/dest/spartan/utils/health.d.ts +63 -0
  199. package/dest/spartan/utils/health.d.ts.map +1 -0
  200. package/dest/spartan/utils/health.js +202 -0
  201. package/dest/spartan/utils/helm.d.ts +15 -0
  202. package/dest/spartan/utils/helm.d.ts.map +1 -0
  203. package/dest/spartan/utils/helm.js +47 -0
  204. package/dest/spartan/utils/index.d.ts +11 -0
  205. package/dest/spartan/utils/index.d.ts.map +1 -0
  206. package/dest/spartan/utils/index.js +22 -0
  207. package/dest/spartan/utils/k8s.d.ts +128 -0
  208. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  209. package/dest/spartan/utils/k8s.js +381 -0
  210. package/dest/spartan/utils/nodes.d.ts +40 -0
  211. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  212. package/dest/spartan/utils/nodes.js +461 -0
  213. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  214. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  215. package/dest/spartan/utils/pod_logs.js +74 -0
  216. package/dest/spartan/utils/scripts.d.ts +30 -0
  217. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  218. package/dest/spartan/utils/scripts.js +81 -0
  219. package/dest/spartan/utils.d.ts +2 -260
  220. package/dest/spartan/utils.d.ts.map +1 -1
  221. package/dest/spartan/utils.js +1 -942
  222. package/dest/test-wallet/test_wallet.d.ts +105 -0
  223. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  224. package/dest/test-wallet/test_wallet.js +320 -0
  225. package/dest/test-wallet/utils.d.ts +76 -0
  226. package/dest/test-wallet/utils.d.ts.map +1 -0
  227. package/dest/test-wallet/utils.js +126 -0
  228. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  229. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  230. package/dest/test-wallet/wallet_worker_script.js +56 -0
  231. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  232. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  233. package/dest/test-wallet/worker_wallet.js +157 -0
  234. package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
  235. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  236. package/dest/test-wallet/worker_wallet_schema.js +23 -0
  237. package/package.json +53 -46
  238. package/src/automine/README.md +60 -0
  239. package/src/automine/automine_test_context.ts +153 -0
  240. package/src/automine/contracts/fixtures/storage_proof.json +915 -0
  241. package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
  242. package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
  243. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  244. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  245. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +56 -69
  246. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +51 -59
  247. package/src/automine/token/token_test_helpers.ts +138 -0
  248. package/src/bench/client_flows/benchmark.ts +21 -0
  249. package/src/bench/client_flows/client_flows_benchmark.ts +111 -90
  250. package/src/bench/client_flows/config.ts +9 -1
  251. package/src/bench/client_flows/data_extractor.ts +1 -0
  252. package/src/bench/utils.ts +123 -12
  253. package/src/composed/ha/ha_full_setup.ts +466 -0
  254. package/src/fixtures/authwit_proxy.ts +54 -0
  255. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  256. package/src/fixtures/e2e_prover_test.ts +102 -103
  257. package/src/fixtures/elu_monitor.ts +126 -0
  258. package/src/fixtures/fixtures.ts +110 -0
  259. package/src/fixtures/get_bb_config.ts +7 -6
  260. package/src/fixtures/ha_setup.ts +192 -0
  261. package/src/fixtures/index.ts +2 -0
  262. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  263. package/src/fixtures/setup.ts +421 -444
  264. package/src/fixtures/setup_p2p_test.ts +54 -54
  265. package/src/fixtures/timing.ts +97 -0
  266. package/src/fixtures/token_utils.ts +46 -10
  267. package/src/fixtures/utils.ts +2 -3
  268. package/src/fixtures/wait_helpers.ts +333 -0
  269. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  270. package/src/forward-compatibility/wallet_service.ts +106 -0
  271. package/src/guides/up_quick_start.sh +7 -4
  272. package/src/infra/README.md +12 -0
  273. package/src/install_legacy_contracts.cjs +75 -0
  274. package/src/legacy-jest-resolver.cjs +112 -0
  275. package/src/multi-node/README.md +95 -0
  276. package/src/multi-node/block-production/setup.ts +272 -0
  277. package/src/multi-node/governance/setup.ts +172 -0
  278. package/src/multi-node/multi_node_test_context.ts +447 -0
  279. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  280. package/src/multi-node/slashing/setup.ts +433 -0
  281. package/src/p2p/README.md +78 -0
  282. package/src/{e2e_p2p → p2p}/p2p_network.ts +132 -57
  283. package/src/p2p/reqresp/utils.ts +263 -0
  284. package/src/p2p/shared.ts +329 -0
  285. package/src/shared/cross_chain_test_harness.ts +52 -41
  286. package/src/shared/gas_portal_test_harness.ts +34 -16
  287. package/src/shared/index.ts +1 -0
  288. package/src/shared/jest_setup.ts +51 -1
  289. package/src/shared/mock_state_view.ts +188 -0
  290. package/src/shared/submit-transactions.ts +22 -19
  291. package/src/shared/timing_env.d.mts +39 -0
  292. package/src/shared/timing_env.mjs +363 -0
  293. package/src/shared/uniswap_l1_l2.ts +109 -74
  294. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  295. package/src/simulators/lending_simulator.ts +35 -17
  296. package/src/simulators/token_simulator.ts +6 -30
  297. package/src/single-node/README.md +60 -0
  298. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  299. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  300. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +20 -9
  301. package/src/{e2e_fees → single-node/fees}/fees_test.ts +120 -95
  302. package/src/single-node/l1-reorgs/setup.ts +93 -0
  303. package/src/single-node/partial-proofs/setup.ts +8 -0
  304. package/src/single-node/proving/setup.ts +15 -0
  305. package/src/single-node/recovery/setup.ts +8 -0
  306. package/src/single-node/setup.ts +63 -0
  307. package/src/single-node/single_node_test_context.ts +1041 -0
  308. package/src/spartan/setup_test_wallets.ts +208 -34
  309. package/src/spartan/tx_metrics.ts +255 -26
  310. package/src/spartan/utils/bot.ts +188 -0
  311. package/src/spartan/utils/chaos.ts +253 -0
  312. package/src/spartan/utils/clients.ts +100 -0
  313. package/src/spartan/utils/config.ts +29 -0
  314. package/src/spartan/utils/health.ts +255 -0
  315. package/src/spartan/utils/helm.ts +84 -0
  316. package/src/spartan/utils/index.ts +71 -0
  317. package/src/spartan/utils/k8s.ts +535 -0
  318. package/src/spartan/utils/nodes.ts +543 -0
  319. package/src/spartan/utils/pod_logs.ts +99 -0
  320. package/src/spartan/utils/scripts.ts +99 -0
  321. package/src/spartan/utils.ts +1 -1246
  322. package/src/test-wallet/test_wallet.ts +426 -0
  323. package/src/test-wallet/utils.ts +205 -0
  324. package/src/test-wallet/wallet_worker_script.ts +66 -0
  325. package/src/test-wallet/worker_wallet.ts +216 -0
  326. package/src/test-wallet/worker_wallet_schema.ts +14 -0
  327. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -53
  328. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  329. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
  330. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  331. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -128
  332. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  333. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  334. package/dest/e2e_deploy_contract/deploy_test.js +0 -50
  335. package/dest/e2e_epochs/epochs_test.d.ts +0 -94
  336. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  337. package/dest/e2e_epochs/epochs_test.js +0 -339
  338. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  339. package/dest/e2e_fees/fees_test.d.ts +0 -88
  340. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  341. package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
  342. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  343. package/dest/e2e_l1_publisher/write_json.js +0 -62
  344. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  345. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  346. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  347. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  348. package/dest/e2e_nested_contract/nested_contract_test.js +0 -56
  349. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  350. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  351. package/dest/e2e_p2p/inactivity_slash_test.js +0 -136
  352. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  353. package/dest/e2e_p2p/shared.d.ts +0 -46
  354. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  355. package/dest/e2e_p2p/shared.js +0 -184
  356. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -42
  357. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  358. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -194
  359. package/src/e2e_deploy_contract/deploy_test.ts +0 -85
  360. package/src/e2e_epochs/epochs_test.ts +0 -451
  361. package/src/e2e_l1_publisher/write_json.ts +0 -82
  362. package/src/e2e_nested_contract/nested_contract_test.ts +0 -75
  363. package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
  364. package/src/e2e_p2p/shared.ts +0 -290
  365. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  366. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -1,15 +1,10 @@
1
- import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import { generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
3
- import { createArchiver } from '@aztec/archiver';
4
- import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
- import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
6
- import { BatchCall, getContractClassFromArtifact, waitForProven } from '@aztec/aztec.js/contracts';
1
+ import { generateSchnorrAccounts } from '@aztec/accounts/testing';
2
+ import { createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
3
+ import { EthAddress } from '@aztec/aztec.js/addresses';
7
4
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
8
5
  import { Fr } from '@aztec/aztec.js/fields';
9
6
  import { createLogger } from '@aztec/aztec.js/log';
10
- import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
11
- import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
12
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
7
+ import { CheatCodes } from '@aztec/aztec/testing';
13
8
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
14
9
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
15
10
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -17,40 +12,42 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
17
12
  import { NULL_KEY } from '@aztec/ethereum/constants';
18
13
  import { deployMulticall3 } from '@aztec/ethereum/contracts';
19
14
  import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
20
- import { DelayedTxUtils, EthCheatCodes, EthCheatCodesWithState, createDelayedL1TxUtilsFromViemWallet, startAnvil } from '@aztec/ethereum/test';
15
+ import { EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
21
16
  import { EpochNumber } from '@aztec/foundation/branded-types';
22
17
  import { SecretValue } from '@aztec/foundation/config';
23
18
  import { randomBytes } from '@aztec/foundation/crypto/random';
24
19
  import { tryRmDir } from '@aztec/foundation/fs';
25
- import { withLogNameSuffix } from '@aztec/foundation/log';
20
+ import { withLoggerBindings } from '@aztec/foundation/log/server';
26
21
  import { retryUntil } from '@aztec/foundation/retry';
27
- import { sleep } from '@aztec/foundation/sleep';
28
- import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
22
+ import { TestDateProvider } from '@aztec/foundation/timer';
29
23
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
30
24
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
31
25
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
32
26
  import { protocolContractsHash } from '@aztec/protocol-contracts';
33
- import { createProverNode } from '@aztec/prover-node';
34
27
  import { getPXEConfig } from '@aztec/pxe/server';
28
+ import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
29
+ import { HandshakeRegistryArtifact, getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
30
+ import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
31
+ import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
35
32
  import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
36
33
  import { tryStop } from '@aztec/stdlib/interfaces/server';
37
34
  import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
38
35
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
39
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
36
+ import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
40
37
  import { getGenesisValues } from '@aztec/world-state/testing';
41
38
  import fs from 'fs/promises';
42
39
  import { tmpdir } from 'os';
43
40
  import path from 'path';
44
41
  import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
45
42
  import { foundry } from 'viem/chains';
43
+ import { TestWallet } from '../test-wallet/test_wallet.js';
46
44
  import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
47
45
  import { getACVMConfig } from './get_acvm_config.js';
48
46
  import { getBBConfig } from './get_bb_config.js';
49
47
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
48
+ import { testSpan } from './timing.js';
50
49
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
51
50
  export { startAnvil };
52
- const { AZTEC_NODE_URL = '' } = process.env;
53
- const getAztecUrl = ()=>AZTEC_NODE_URL;
54
51
  let telemetry = undefined;
55
52
  async function getTelemetryClient(partialConfig = {}) {
56
53
  if (!telemetry) {
@@ -84,11 +81,13 @@ export const getPrivateKeyFromIndex = (index)=>{
84
81
  /**
85
82
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
86
83
  * @param aztecNode - An instance of Aztec Node.
84
+ * @param nodeDebug - The node's debug API, used to register public function signatures for named traces; pass
85
+ * `undefined` when the node does not expose it.
87
86
  * @param opts - Partial configuration for the PXE.
88
87
  * @param logger - The logger to be used.
89
- * @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
88
+ * @param actor - Actor label to include in log output (e.g., 'pxe-test').
90
89
  * @returns A test wallet, logger and teardown function.
91
- */ export async function setupPXEAndGetWallet(aztecNode, opts = {}, logger = getLogger(), useLogSuffix = false) {
90
+ */ export async function setupPXEAndGetWallet(aztecNode, nodeDebug, opts = {}, logger = getLogger(), actor) {
92
91
  const PXEConfig = {
93
92
  ...getPXEConfig(),
94
93
  ...opts
@@ -102,7 +101,8 @@ export const getPrivateKeyFromIndex = (index)=>{
102
101
  }
103
102
  const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(PXEConfig.dataDirectory);
104
103
  const wallet = await TestWallet.create(aztecNode, PXEConfig, {
105
- useLogSuffix
104
+ loggerActorLabel: actor,
105
+ nodeDebug
106
106
  });
107
107
  return {
108
108
  wallet,
@@ -111,71 +111,55 @@ export const getPrivateKeyFromIndex = (index)=>{
111
111
  };
112
112
  }
113
113
  /**
114
- * Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
115
- */ async function setupWithRemoteEnvironment(account, config, logger, numberOfAccounts) {
116
- const aztecNodeUrl = getAztecUrl();
117
- logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
118
- const aztecNode = createAztecNodeClient(aztecNodeUrl);
119
- await waitForNode(aztecNode, logger);
120
- logger.verbose('JSON RPC client connected to Aztec Node');
121
- logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
122
- const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
123
- const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
124
- const deployL1ContractsValues = {
125
- l1ContractAddresses,
126
- l1Client,
127
- rollupVersion
128
- };
129
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
130
- const wallet = await TestWallet.create(aztecNode);
131
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
132
- const teardown = ()=>Promise.resolve();
133
- logger.verbose('Populating wallet from already registered accounts...');
134
- const initialFundedAccounts = await getInitialTestAccountsData();
135
- if (initialFundedAccounts.length < numberOfAccounts) {
136
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
114
+ * When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
115
+ * aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
116
+ * actually swapped in the correct version.
117
+ */ function assertContractArtifactsVersion() {
118
+ const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
119
+ if (!expected) {
120
+ return;
121
+ }
122
+ const { aztecVersion } = SponsoredFPCContract.artifact;
123
+ // TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
124
+ if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
125
+ createLogger('e2e:setup').info(`Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`);
126
+ return;
127
+ }
128
+ if (aztecVersion !== expected) {
129
+ throw new Error(`Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` + `The legacy artifact resolver may not have swapped in the correct version.`);
137
130
  }
138
- const testAccounts = await Promise.all(initialFundedAccounts.slice(0, numberOfAccounts).map(async (account)=>{
139
- const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
140
- return accountManager.address;
141
- }));
142
- return {
143
- anvil: undefined,
144
- aztecNode,
145
- aztecNodeService: undefined,
146
- aztecNodeAdmin: undefined,
147
- sequencer: undefined,
148
- proverNode: undefined,
149
- deployL1ContractsValues,
150
- config,
151
- aztecNodeConfig: config,
152
- initialFundedAccounts,
153
- wallet,
154
- accounts: testAccounts,
155
- logger,
156
- cheatCodes,
157
- ethCheatCodes,
158
- prefilledPublicData: undefined,
159
- mockGossipSubNetwork: undefined,
160
- watcher: undefined,
161
- dateProvider: undefined,
162
- telemetryClient: undefined,
163
- acvmConfig: undefined,
164
- bbConfig: undefined,
165
- directoryToCleanup: undefined,
166
- teardown
167
- };
168
131
  }
169
132
  /**
170
133
  * Sets up the environment for the end-to-end tests.
171
134
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
172
135
  * @param opts - Options to pass to the node initialization and to the setup script.
173
136
  * @param pxeOpts - Options to pass to the PXE initialization.
174
- */ export async function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
137
+ */ export function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
138
+ // Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
139
+ // swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
140
+ // (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
141
+ const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
142
+ return testSpan(`setup:env:${proverMode}`, async ()=>{
143
+ const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
144
+ if (process.env.EXIT_E2E_AFTER_SETUP) {
145
+ ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
146
+ throw new Error('EXIT_E2E_AFTER_SETUP');
147
+ }
148
+ return ctx;
149
+ });
150
+ }
151
+ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
152
+ assertContractArtifactsVersion();
153
+ const logger = getLogger();
175
154
  let anvil;
176
155
  try {
177
156
  opts.aztecTargetCommitteeSize ??= 0;
178
- opts.slasherFlavor ??= 'none';
157
+ opts.slasherEnabled ??= false;
158
+ // Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
159
+ // waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
160
+ // assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
161
+ opts.automineL1Setup ??= true;
162
+ logger.trace('Starting e2e test setup');
179
163
  const config = {
180
164
  ...getConfigEnvVars(),
181
165
  ...opts
@@ -186,10 +170,10 @@ export const getPrivateKeyFromIndex = (index)=>{
186
170
  config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
187
171
  // For tests we only want proving enabled if specifically requested
188
172
  config.realProofs = !!opts.realProofs;
189
- // Only enforce the time table if requested
190
- config.enforceTimeTable = !!opts.enforceTimeTable;
173
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
174
+ config.enableDelayer = true;
191
175
  config.listenAddress = '127.0.0.1';
192
- const logger = getLogger();
176
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
193
177
  // Create a temp directory for any services that need it and cleanup later
194
178
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
195
179
  await fs.mkdir(directoryToCleanup, {
@@ -198,30 +182,30 @@ export const getPrivateKeyFromIndex = (index)=>{
198
182
  if (!config.dataDirectory) {
199
183
  config.dataDirectory = directoryToCleanup;
200
184
  }
185
+ const dateProvider = new TestDateProvider();
201
186
  if (!config.l1RpcUrls?.length) {
202
187
  if (!isAnvilTestChain(chain.id)) {
203
188
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
204
189
  }
205
- if (AZTEC_NODE_URL) {
206
- throw new Error(`AZTEC_NODE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`);
207
- }
208
- const res = await startAnvil({
209
- l1BlockTime: opts.ethereumSlotDuration,
210
- accounts: opts.anvilAccounts,
211
- port: opts.anvilPort
212
- });
190
+ const res = await testSpan('setup:env:anvil', ()=>startAnvil({
191
+ l1BlockTime: opts.ethereumSlotDuration,
192
+ accounts: opts.anvilAccounts,
193
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
194
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
195
+ dateProvider
196
+ }));
213
197
  anvil = res.anvil;
214
198
  config.l1RpcUrls = [
215
199
  res.rpcUrl
216
200
  ];
217
201
  }
202
+ logger.trace('Started anvil and L1 RPC client');
218
203
  // Enable logging metrics to a local file named after the test suite
219
204
  if (isMetricsLoggingRequested()) {
220
205
  const filename = path.join('log', getJobName() + '.jsonl');
221
206
  logger.info(`Logging metrics to ${filename}`);
222
207
  setupMetricsLogger(filename);
223
208
  }
224
- const dateProvider = new TestDateProvider();
225
209
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
226
210
  if (opts.stateLoad) {
227
211
  await ethCheatCodes.loadChainState(opts.stateLoad);
@@ -231,13 +215,14 @@ export const getPrivateKeyFromIndex = (index)=>{
231
215
  resetBlockInterval: true
232
216
  });
233
217
  }
218
+ logger.trace('Initialized L1 cheat codes and applied state/time overrides');
234
219
  let publisherPrivKeyHex = undefined;
235
220
  let publisherHdAccount = undefined;
236
221
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
237
222
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
238
223
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
239
- } else if (config.publisherPrivateKeys && config.publisherPrivateKeys.length > 0 && config.publisherPrivateKeys[0].getValue() != NULL_KEY) {
240
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
224
+ } else if (config.sequencerPublisherPrivateKeys && config.sequencerPublisherPrivateKeys.length > 0 && config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY) {
225
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
241
226
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
242
227
  } else if (!MNEMONIC) {
243
228
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -248,32 +233,42 @@ export const getPrivateKeyFromIndex = (index)=>{
248
233
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
249
234
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
250
235
  publisherPrivKeyHex = `0x${publisherPrivKey.toString('hex')}`;
251
- config.publisherPrivateKeys = [
236
+ config.sequencerPublisherPrivateKeys = [
252
237
  new SecretValue(publisherPrivKeyHex)
253
238
  ];
254
239
  }
255
240
  if (config.coinbase === undefined) {
256
241
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
257
242
  }
258
- if (AZTEC_NODE_URL) {
259
- // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
260
- return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
261
- }
262
- // Determine which addresses to fund in genesis
263
- const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10));
264
- const addressesToFund = initialFundedAccounts.map((a)=>a.address);
243
+ logger.trace('Resolved L1 publisher account');
244
+ // The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
245
+ // funded at genesis so they are immediately usable.
246
+ const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
247
+ // Extra accounts the test wants funded at genesis but will create/deploy itself.
248
+ const additionallyFundedAccounts = opts.additionallyFundedAccounts ?? [];
249
+ const addressesToFund = [
250
+ ...defaultAccounts,
251
+ ...additionallyFundedAccounts
252
+ ].map((a)=>a.address);
265
253
  // Optionally fund the sponsored FPC
266
254
  if (opts.fundSponsoredFPC) {
267
255
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
268
256
  addressesToFund.push(sponsoredFPCAddress);
269
257
  }
270
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData);
258
+ logger.trace('Generated test accounts to fund at genesis');
259
+ const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
260
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp);
261
+ logger.trace('Computed genesis values');
271
262
  const wasAutomining = await ethCheatCodes.isAutoMining();
272
263
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
273
264
  if (enableAutomine) {
274
265
  await ethCheatCodes.setAutomine(true);
275
266
  }
276
267
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount, chain);
268
+ // Warm both KZG trusted setups (ours + anvil's) in parallel
269
+ if (anvil && isAnvilTestChain(chain.id)) {
270
+ await warmBlobKzg(l1Client, logger);
271
+ }
277
272
  // Deploy Multicall3 if running locally
278
273
  await deployMulticall3(l1Client, logger);
279
274
  // Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
@@ -281,68 +276,99 @@ export const getPrivateKeyFromIndex = (index)=>{
281
276
  await l1Client.getTransactionCount({
282
277
  address: l1Client.account.address
283
278
  });
284
- const deployL1ContractsValues = await deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
285
- ...getL1ContractsConfigEnvVars(),
286
- ...opts,
287
- ...opts.l1ContractsArgs,
288
- vkTreeRoot: getVKTreeRoot(),
289
- protocolContractsHash,
290
- genesisArchiveRoot,
291
- initialValidators: opts.initialValidators,
292
- feeJuicePortalInitialBalance: fundingNeeded,
293
- realVerifier: false
294
- });
295
- config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
279
+ logger.trace('Deployed Multicall3');
280
+ const deployL1ContractsValues = await testSpan('setup:env:l1-deploy', ()=>deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
281
+ ...getL1ContractsConfigEnvVars(),
282
+ ...opts,
283
+ ...opts.l1ContractsArgs,
284
+ vkTreeRoot: getVKTreeRoot(),
285
+ protocolContractsHash,
286
+ genesisArchiveRoot,
287
+ initialValidators: opts.initialValidators,
288
+ feeJuicePortalInitialBalance: fundingNeeded,
289
+ realVerifier: false
290
+ }));
291
+ Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
296
292
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
293
+ // Propagate L1-contracts-config overrides back to the node config so the archiver's
294
+ // `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
295
+ // Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
296
+ // but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
297
+ // `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
298
+ // `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
299
+ // Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
300
+ // by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
301
+ // as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
302
+ // in this function and crash `setupSharedBlobStorage`.
303
+ if (opts.l1ContractsArgs) {
304
+ for (const [key, value] of Object.entries(opts.l1ContractsArgs)){
305
+ if (value !== undefined) {
306
+ config[key] = value;
307
+ }
308
+ }
309
+ }
310
+ // Deploy any test-specific L1 contracts while automine is still on and before the node starts,
311
+ // so they mine instantly rather than paying the L1 block interval once the sequencer is live.
312
+ let extraL1DeployResult = undefined;
313
+ if (opts.deployExtraL1Contracts) {
314
+ logger.trace('Running deployExtraL1Contracts hook');
315
+ extraL1DeployResult = await opts.deployExtraL1Contracts({
316
+ l1Client,
317
+ deployL1ContractsValues,
318
+ logger
319
+ });
320
+ // The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
321
+ // stale cached nonce for later transactions on the publisher account.
322
+ await l1Client.getTransactionCount({
323
+ address: l1Client.account.address
324
+ });
325
+ }
297
326
  if (enableAutomine) {
298
- await ethCheatCodes.setAutomine(false);
299
- await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
300
- dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
327
+ await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
328
+ }
329
+ // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
330
+ // ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
331
+ // the stdout listener.
332
+ if (!anvil) {
333
+ dateProvider.setTime(await ethCheatCodes.lastBlockTimestamp() * 1000);
301
334
  }
302
335
  if (opts.l2StartTime) {
303
336
  await ethCheatCodes.warp(opts.l2StartTime, {
304
337
  resetBlockInterval: true
305
338
  });
306
339
  }
307
- const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
308
- if (!opts.disableAnvilTestWatcher) {
309
- await watcher.start();
310
- }
311
- // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
312
- const telemetryClient = opts.metricsPort ? await getEndToEndTestTelemetryClient(opts.metricsPort) : await getTelemetryClient(opts.telemetryConfig);
313
- await setupSharedBlobStorage(config);
314
- logger.verbose('Creating and synching an aztec node', config);
315
- const acvmConfig = await getACVMConfig(logger);
340
+ logger.trace('Deployed L1 rollup contracts');
341
+ // These boot steps are independent and write disjoint config keys, so run them concurrently:
342
+ // telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
343
+ // and the ACVM/BB config resolvers write their own acvm*/bb* keys.
344
+ const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
345
+ // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
346
+ opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
347
+ setupSharedBlobStorage(config),
348
+ getACVMConfig(logger),
349
+ getBBConfig(logger)
350
+ ]);
351
+ logger.trace('Created telemetry client');
352
+ logger.trace('Set up shared blob storage');
316
353
  if (acvmConfig) {
317
354
  config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
318
355
  config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
319
356
  }
320
- const bbConfig = await getBBConfig(logger);
357
+ logger.trace('Resolved ACVM config');
321
358
  if (bbConfig) {
322
359
  config.bbBinaryPath = bbConfig.bbBinaryPath;
323
360
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
324
361
  }
362
+ logger.trace('Resolved Barretenberg config');
363
+ logger.verbose('Creating and synching an aztec node', config);
325
364
  let mockGossipSubNetwork;
326
365
  let p2pClientDeps = undefined;
327
366
  if (opts.mockGossipSubNetwork) {
328
- mockGossipSubNetwork = new MockGossipSubNetwork();
367
+ mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
329
368
  p2pClientDeps = {
330
369
  p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
331
370
  };
332
371
  }
333
- // Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
334
- // To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
335
- // For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
336
- // If no accounts need deployment, we await an empty block to confirm network progression.
337
- const originalMinTxsPerBlock = config.minTxsPerBlock;
338
- if (originalMinTxsPerBlock === undefined) {
339
- throw new Error('minTxsPerBlock is undefined in e2e test setup');
340
- }
341
- // Only set minTxsPerBlock=1 if we're going to deploy accounts and need reliable block inclusion
342
- const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
343
- // Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
344
- const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
345
- config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
346
372
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
347
373
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
348
374
  if (!config.disableValidator) {
@@ -352,32 +378,56 @@ export const getPrivateKeyFromIndex = (index)=>{
352
378
  ]);
353
379
  }
354
380
  }
355
- const aztecNodeService = await AztecNodeService.createAndSync(config, {
356
- dateProvider,
357
- telemetry: telemetryClient,
358
- p2pClientDeps,
359
- logger: createLogger('node:MAIN-aztec-node')
360
- }, {
361
- prefilledPublicData
362
- });
381
+ // When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
382
+ // We apply these overrides to a copy so they don't leak into the returned config.
383
+ // Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
384
+ const initialNodeConfig = opts.skipInitialSequencer ? {
385
+ ...config,
386
+ disableValidator: true,
387
+ ...opts.mockGossipSubNetwork ? {} : {
388
+ p2pEnabled: false,
389
+ bootstrapNodes: []
390
+ }
391
+ } : config;
392
+ logger.trace('Prepared aztec node config');
393
+ const aztecNodeService = await testSpan('setup:env:sequencer-start', ()=>withLoggerBindings({
394
+ actor: 'node-0'
395
+ }, ()=>createAztecNodeService(initialNodeConfig, {
396
+ dateProvider,
397
+ telemetry: telemetryClient,
398
+ p2pClientDeps
399
+ }, {
400
+ genesis,
401
+ dontStartSequencer: opts.skipInitialSequencer
402
+ })));
363
403
  const sequencerClient = aztecNodeService.getSequencer();
364
- if (sequencerClient) {
365
- const publisher = sequencerClient.sequencer.publisher;
366
- publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
367
- }
404
+ logger.trace('Created and synced aztec node');
368
405
  let proverNode = undefined;
369
406
  if (opts.startProverNode) {
370
407
  logger.verbose('Creating and syncing a simulated prover node...');
371
408
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
372
409
  const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
373
410
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
374
- const proverNodeConfig = {
375
- ...config.proverNodeConfig,
376
- dataDirectory: proverNodeDataDirectory,
377
- p2pEnabled: false
411
+ const p2pClientDeps = {
412
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork),
413
+ rpcTxProviders: [
414
+ aztecNodeService
415
+ ]
378
416
  };
379
- proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config, proverNodeConfig, aztecNodeService, prefilledPublicData);
417
+ ({ proverNode } = await testSpan('setup:env:prover-node', ()=>createAndSyncProverNode(proverNodePrivateKeyHex, config, {
418
+ ...config.proverNodeConfig,
419
+ dataDirectory: proverNodeDataDirectory
420
+ }, {
421
+ dateProvider,
422
+ p2pClientDeps,
423
+ telemetry: telemetryClient
424
+ }, {
425
+ genesis
426
+ })));
427
+ logger.trace('Created prover node');
380
428
  }
429
+ const sequencerDelayer = sequencerClient?.getDelayer();
430
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
381
431
  logger.verbose('Creating a pxe...');
382
432
  const pxeConfig = {
383
433
  ...getPXEConfig(),
@@ -386,60 +436,57 @@ export const getPrivateKeyFromIndex = (index)=>{
386
436
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
387
437
  // For tests we only want proving enabled if specifically requested
388
438
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
389
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
439
+ const wallet = await testSpan('setup:env:pxe', ()=>TestWallet.create(aztecNodeService, pxeConfig, {
440
+ loggerActorLabel: 'pxe-0',
441
+ // In-process node implements the debug API, so register public function signatures for named traces.
442
+ nodeDebug: aztecNodeService,
443
+ ...opts.pxeCreationOptions
444
+ }));
445
+ if (opts.walletMinFeePadding !== undefined) {
446
+ wallet.setMinFeePadding(opts.walletMinFeePadding);
447
+ }
448
+ logger.trace('Created PXE and test wallet');
390
449
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
450
+ logger.trace('Created cheat codes');
391
451
  if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
392
452
  // We need to advance such that the committee is set up.
393
453
  await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1)));
394
454
  await cheatCodes.rollup.setupEpoch();
395
455
  await cheatCodes.rollup.debugRollup();
456
+ logger.trace('Advanced chain to set up validator committee');
396
457
  }
397
458
  let accounts = [];
398
- if (shouldDeployAccounts) {
399
- logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`);
400
- const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
401
- const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNodeService, accountsData);
402
- accounts = accountManagers.map((accountManager)=>accountManager.address);
403
- } else if (needsEmptyBlock) {
404
- logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
405
- while(await aztecNodeService.getBlockNumber() === 0){
406
- await sleep(2000);
407
- }
408
- }
409
- // If skipAccountDeployment is true, we don't deploy or wait - tests will handle account deployment later
410
- // Now we restore the original minTxsPerBlock setting if we changed it.
411
- if (sequencerClient && config.minTxsPerBlock !== originalMinTxsPerBlock) {
412
- sequencerClient.getSequencer().updateConfig({
413
- minTxsPerBlock: originalMinTxsPerBlock
414
- });
459
+ // Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
460
+ // + a simulated store call) with no on-chain tx, independent of the sequencer.
461
+ if (numberOfAccounts > 0) {
462
+ logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
463
+ await testSpan('wallet:create', ()=>createFundedInitializerlessAccounts(wallet, defaultAccounts));
464
+ accounts = defaultAccounts.map((a)=>a.address);
415
465
  }
416
- if (initialFundedAccounts.length < numberOfAccounts) {
417
- throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
418
- }
419
- const teardown = async ()=>{
420
- try {
421
- await tryStop(wallet, logger);
422
- await tryStop(aztecNodeService, logger);
423
- await tryStop(proverNode, logger);
424
- if (acvmConfig?.cleanup) {
425
- await acvmConfig.cleanup();
426
- }
427
- if (bbConfig?.cleanup) {
428
- await bbConfig.cleanup();
429
- }
430
- await tryStop(watcher, logger);
431
- await tryStop(anvil, logger);
432
- await tryRmDir(directoryToCleanup, logger);
433
- } catch (err) {
434
- logger.error(`Error during e2e test teardown`, err);
435
- } finally{
466
+ logger.trace('Created funded test accounts');
467
+ const teardown = ()=>testSpan('teardown:env', async ()=>{
436
468
  try {
437
- await telemetryClient?.stop();
469
+ await tryStop(wallet, logger);
470
+ await tryStop(aztecNodeService, logger);
471
+ await tryStop(proverNode, logger);
472
+ if (acvmConfig?.cleanup) {
473
+ await acvmConfig.cleanup();
474
+ }
475
+ if (bbConfig?.cleanup) {
476
+ await bbConfig.cleanup();
477
+ }
478
+ await tryStop(anvil, logger);
479
+ await tryRmDir(directoryToCleanup, logger);
438
480
  } catch (err) {
439
- logger.error(`Error during telemetry client stop`, err);
481
+ logger.error(`Error during e2e test teardown`, err);
482
+ } finally{
483
+ try {
484
+ await telemetryClient.stop();
485
+ } catch (err) {
486
+ logger.error(`Error during telemetry client stop`, err);
487
+ }
440
488
  }
441
- }
442
- };
489
+ });
443
490
  return {
444
491
  anvil,
445
492
  aztecNode: aztecNodeService,
@@ -451,17 +498,19 @@ export const getPrivateKeyFromIndex = (index)=>{
451
498
  aztecNodeConfig: config,
452
499
  dateProvider,
453
500
  deployL1ContractsValues,
454
- initialFundedAccounts,
501
+ additionallyFundedAccounts,
455
502
  logger,
456
503
  mockGossipSubNetwork,
457
- prefilledPublicData,
504
+ genesis,
505
+ extraL1DeployResult,
458
506
  proverNode,
507
+ sequencerDelayer,
508
+ proverDelayer,
459
509
  sequencer: sequencerClient,
460
510
  teardown,
461
511
  telemetryClient,
462
512
  wallet,
463
513
  accounts,
464
- watcher,
465
514
  acvmConfig,
466
515
  bbConfig,
467
516
  directoryToCleanup
@@ -512,79 +561,45 @@ export const getPrivateKeyFromIndex = (index)=>{
512
561
  */ export async function registerSponsoredFPC(wallet) {
513
562
  await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
514
563
  }
515
- export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 1) {
564
+ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 0.25) {
516
565
  targetBlock ??= await node.getBlockNumber();
517
- await retryUntil(async ()=>await node.getProvenBlockNumber() >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
566
+ await retryUntil(async ()=>await node.getBlockNumber('proven') >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
518
567
  }
519
- export function createAndSyncProverNode(proverNodePrivateKey, aztecNodeConfig, proverNodeConfig, aztecNode, prefilledPublicData = [], proverNodeDeps = {}) {
520
- return withLogNameSuffix('prover-node', async ()=>{
521
- const aztecNodeTxProvider = aztecNode && {
522
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
523
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
524
- stop: ()=>Promise.resolve()
525
- };
526
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
527
- const archiverConfig = {
528
- ...aztecNodeConfig,
529
- dataDirectory: proverNodeConfig.dataDirectory
530
- };
531
- const archiver = await createArchiver(archiverConfig, {
532
- blobClient,
533
- dateProvider: proverNodeDeps.dateProvider
534
- }, {
535
- blockUntilSync: true
536
- });
537
- const proverConfig = {
538
- ...aztecNodeConfig,
539
- txCollectionNodeRpcUrls: [],
540
- realProofs: false,
541
- proverAgentCount: 2,
542
- publisherPrivateKeys: [
568
+ /**
569
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
570
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
571
+ */ export function createAndSyncProverNode(proverNodePrivateKey, baseConfig, configOverrides, deps, options) {
572
+ return withLoggerBindings({
573
+ actor: 'prover-0'
574
+ }, async ()=>{
575
+ const proverNode = await createAztecNodeService({
576
+ ...baseConfig,
577
+ ...configOverrides,
578
+ p2pPort: 0,
579
+ enableProverNode: true,
580
+ disableValidator: true,
581
+ proverPublisherPrivateKeys: [
543
582
  new SecretValue(proverNodePrivateKey)
544
- ],
545
- proverNodeMaxPendingJobs: 10,
546
- proverNodeMaxParallelBlocksPerEpoch: 32,
547
- proverNodePollingIntervalMs: 200,
548
- txGatheringIntervalMs: 1000,
549
- txGatheringBatchSize: 10,
550
- txGatheringMaxParallelRequestsPerNode: 10,
551
- txGatheringTimeoutMs: 24_000,
552
- proverNodeFailedEpochStore: undefined,
553
- proverId: EthAddress.fromNumber(1),
554
- proverNodeEpochProvingDelayMs: undefined,
555
- ...proverNodeConfig
556
- };
557
- const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node', proverNodeDeps.dateProvider);
558
- const proverNode = await createProverNode(proverConfig, {
559
- ...proverNodeDeps,
560
- aztecNodeTxProvider,
561
- archiver: archiver,
562
- l1TxUtils
563
- }, {
564
- prefilledPublicData
583
+ ]
584
+ }, deps, {
585
+ genesis: options.genesis,
586
+ dontStartProverNode: options.dontStart
565
587
  });
566
- getLogger().info(`Created and synced prover node`, {
567
- publisherAddress: l1TxUtils.client.account.address
568
- });
569
- if (!proverNodeConfig.dontStart) {
570
- await proverNode.start();
588
+ if (!proverNode.getProverNode()) {
589
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
571
590
  }
572
- return proverNode;
591
+ getLogger().info(`Created and synced prover node`);
592
+ return {
593
+ proverNode
594
+ };
573
595
  });
574
596
  }
575
- function createDelayedL1TxUtils(aztecNodeConfig, privateKey, logName, dateProvider) {
576
- const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
577
- const log = createLogger(logName);
578
- const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
579
- l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
580
- return l1TxUtils;
581
- }
582
- export function getBalancesFn(symbol, method, from, logger) {
597
+ export function getBalancesFn(symbol, method, logger) {
583
598
  const balances = async (...addressLikes)=>{
584
599
  const addresses = addressLikes.map((addressLike)=>'address' in addressLike ? addressLike.address : addressLike);
585
- const b = await Promise.all(addresses.map((address)=>method(address).simulate({
586
- from
587
- })));
600
+ const b = await Promise.all(addresses.map(async (address)=>(await method(address).simulate({
601
+ from: address
602
+ })).result));
588
603
  const debugString = `${symbol} balances: ${addresses.map((address, i)=>`${address}: ${b[i]}`).join(', ')}`;
589
604
  logger.verbose(debugString);
590
605
  return b;
@@ -603,74 +618,63 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
603
618
  expect(diffs).toEqual(expectedDiffs);
604
619
  }
605
620
  /**
606
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
607
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
608
- */ export async function ensureAccountContractsPublished(wallet, accountsToDeploy) {
609
- const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (address)=>{
610
- return {
611
- address,
612
- deployed: (await wallet.getContractMetadata(address)).isContractPublished
613
- };
614
- }));
615
- const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>wallet.getContractMetadata(address)))).map((contractMetadata)=>contractMetadata.instance);
616
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
621
+ * Registers the auth_registry contract class and publishes its standard instance if not already
622
+ * present, and registers the artifact with PXE. Publishing is required before exercising the public
623
+ * authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
624
+ * required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
625
+ * surface as generic "Assertion failed:" and tests that match on the real message fail).
626
+ */ export async function ensureAuthRegistryPublished(wallet, from) {
627
+ await testSpan('setup:auth-registry', async ()=>{
628
+ const { instance, contractClass } = await getStandardAuthRegistry();
629
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
630
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
631
+ from
632
+ });
633
+ }
634
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
635
+ await publishInstance(wallet, instance).send({
636
+ from
637
+ });
638
+ }
639
+ await wallet.registerContract(instance, AuthRegistryArtifact);
640
+ });
641
+ }
642
+ /**
643
+ * Registers the public_checks contract class and publishes its standard instance if not already
644
+ * present, and registers the artifact with PXE. Required for any contract that calls
645
+ * `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
646
+ * deployed PublicChecks contract via an enqueued public call).
647
+ */ export async function ensurePublicChecksPublished(wallet, from) {
648
+ const { instance, contractClass } = await getStandardPublicChecks();
617
649
  if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
618
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({
619
- from: accountsToDeploy[0]
620
- }).wait();
650
+ await (await publishContractClass(wallet, PublicChecksArtifact)).send({
651
+ from
652
+ });
653
+ }
654
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
655
+ await publishInstance(wallet, instance).send({
656
+ from
657
+ });
621
658
  }
622
- const requests = instances.map((instance)=>publishInstance(wallet, instance));
623
- const batch = new BatchCall(wallet, requests);
624
- await batch.send({
625
- from: accountsToDeploy[0]
626
- }).wait();
659
+ await wallet.registerContract(instance, PublicChecksArtifact);
627
660
  }
628
661
  /**
629
- * Helper function to deploy accounts.
630
- * Returns deployed account data that can be used by tests.
631
- */ export const deployAccounts = (numberOfAccounts, logger)=>async ({ wallet, initialFundedAccounts })=>{
632
- if (initialFundedAccounts.length < numberOfAccounts) {
633
- throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
634
- }
635
- logger.verbose('Deploying accounts funded with fee juice...');
636
- const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
637
- // Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
638
- for(let i = 0; i < deployedAccounts.length; i++){
639
- const accountManager = await wallet.createSchnorrAccount(deployedAccounts[i].secret, deployedAccounts[i].salt, deployedAccounts[i].signingKey);
640
- const deployMethod = await accountManager.getDeployMethod();
641
- await deployMethod.send({
642
- from: AztecAddress.ZERO,
643
- skipClassPublication: i !== 0
644
- }).wait();
645
- }
646
- return {
647
- deployedAccounts
648
- };
649
- };
650
- /**
651
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
652
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
653
- */ export async function publicDeployAccounts(wallet, accountsToDeploy, waitUntilProven = false, node) {
654
- const instances = (await Promise.all(accountsToDeploy.map((account)=>wallet.getContractMetadata(account)))).map((metadata)=>metadata.instance);
655
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
656
- const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
657
- const calls = await Promise.all([
658
- ...!alreadyRegistered ? [
659
- publishContractClass(wallet, SchnorrAccountContractArtifact)
660
- ] : [],
661
- ...instances.map((instance)=>publishInstance(wallet, instance))
662
- ]);
663
- const batch = new BatchCall(wallet, calls);
664
- const txReceipt = await batch.send({
665
- from: accountsToDeploy[0]
666
- }).wait();
667
- if (waitUntilProven) {
668
- if (!node) {
669
- throw new Error('Need to provide an AztecNode to wait for proven.');
670
- } else {
671
- await waitForProven(node, txReceipt);
672
- }
662
+ * Registers the handshake_registry contract class and publishes its standard instance if not
663
+ * already present, and registers the artifact with PXE. Required for constrained-delivery flows
664
+ * that call into the HandshakeRegistry at its well-known address.
665
+ */ export async function ensureHandshakeRegistryPublished(wallet, from) {
666
+ const { instance, contractClass } = await getStandardHandshakeRegistry();
667
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
668
+ await (await publishContractClass(wallet, HandshakeRegistryArtifact)).send({
669
+ from
670
+ });
671
+ }
672
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
673
+ await publishInstance(wallet, instance).send({
674
+ from
675
+ });
673
676
  }
677
+ await wallet.registerContract(instance, HandshakeRegistryArtifact);
674
678
  }
675
679
  /**
676
680
  * Destroys the current context.