@aztec/end-to-end 0.0.1-commit.a072138 → 0.0.1-commit.a4600f49

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 (344) 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/onchain_delivery_harness.d.ts +17 -0
  12. package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
  13. package/dest/automine/delivery/onchain_delivery_harness.js +123 -0
  14. package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
  15. package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
  16. package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +45 -48
  17. package/dest/automine/token/token_contract_test.d.ts +40 -0
  18. package/dest/automine/token/token_contract_test.d.ts.map +1 -0
  19. package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +43 -48
  20. package/dest/automine/token/token_test_helpers.d.ts +73 -0
  21. package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
  22. package/dest/automine/token/token_test_helpers.js +97 -0
  23. package/dest/bench/client_flows/benchmark.d.ts +15 -1
  24. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  25. package/dest/bench/client_flows/benchmark.js +19 -0
  26. package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
  27. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  28. package/dest/bench/client_flows/client_flows_benchmark.js +63 -54
  29. package/dest/bench/client_flows/config.d.ts +2 -2
  30. package/dest/bench/client_flows/config.d.ts.map +1 -1
  31. package/dest/bench/client_flows/config.js +18 -0
  32. package/dest/bench/client_flows/data_extractor.js +1 -0
  33. package/dest/bench/utils.d.ts +3 -3
  34. package/dest/bench/utils.d.ts.map +1 -1
  35. package/dest/bench/utils.js +102 -8
  36. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  37. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  38. package/dest/composed/ha/ha_full_setup.js +383 -0
  39. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  40. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  41. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  42. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  43. package/dest/fixtures/authwit_proxy.js +34 -0
  44. package/dest/fixtures/e2e_prover_test.d.ts +18 -14
  45. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  46. package/dest/fixtures/e2e_prover_test.js +82 -74
  47. package/dest/fixtures/elu_monitor.d.ts +21 -0
  48. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  49. package/dest/fixtures/elu_monitor.js +102 -0
  50. package/dest/fixtures/fixtures.d.ts +82 -1
  51. package/dest/fixtures/fixtures.d.ts.map +1 -1
  52. package/dest/fixtures/fixtures.js +84 -0
  53. package/dest/fixtures/get_bb_config.d.ts +1 -1
  54. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  55. package/dest/fixtures/get_bb_config.js +5 -5
  56. package/dest/fixtures/ha_setup.d.ts +71 -0
  57. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  58. package/dest/fixtures/ha_setup.js +119 -0
  59. package/dest/fixtures/index.d.ts +3 -1
  60. package/dest/fixtures/index.d.ts.map +1 -1
  61. package/dest/fixtures/index.js +2 -0
  62. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  63. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  64. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  65. package/dest/fixtures/setup.d.ts +111 -60
  66. package/dest/fixtures/setup.d.ts.map +1 -1
  67. package/dest/fixtures/setup.js +320 -327
  68. package/dest/fixtures/setup_p2p_test.d.ts +22 -10
  69. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  70. package/dest/fixtures/setup_p2p_test.js +26 -20
  71. package/dest/fixtures/timing.d.ts +42 -0
  72. package/dest/fixtures/timing.d.ts.map +1 -0
  73. package/dest/fixtures/timing.js +72 -0
  74. package/dest/fixtures/token_utils.d.ts +22 -4
  75. package/dest/fixtures/token_utils.d.ts.map +1 -1
  76. package/dest/fixtures/token_utils.js +26 -8
  77. package/dest/fixtures/utils.d.ts +2 -2
  78. package/dest/fixtures/utils.d.ts.map +1 -1
  79. package/dest/fixtures/utils.js +1 -1
  80. package/dest/fixtures/wait_helpers.d.ts +135 -0
  81. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  82. package/dest/fixtures/wait_helpers.js +154 -0
  83. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  84. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  85. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  86. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  87. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  88. package/dest/forward-compatibility/wallet_service.js +109 -0
  89. package/dest/install_legacy_contracts.d.cts +10 -0
  90. package/dest/install_legacy_contracts.d.cts.map +1 -0
  91. package/dest/legacy-jest-resolver.d.cts +3 -0
  92. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  93. package/dest/multi-node/block-production/setup.d.ts +97 -0
  94. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  95. package/dest/multi-node/block-production/setup.js +158 -0
  96. package/dest/multi-node/governance/setup.d.ts +67 -0
  97. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  98. package/dest/multi-node/governance/setup.js +126 -0
  99. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  100. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  101. package/dest/multi-node/multi_node_test_context.js +347 -0
  102. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  103. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  104. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  105. package/dest/multi-node/slashing/setup.d.ts +167 -0
  106. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  107. package/dest/multi-node/slashing/setup.js +275 -0
  108. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +22 -12
  109. package/dest/p2p/p2p_network.d.ts.map +1 -0
  110. package/dest/{e2e_p2p → p2p}/p2p_network.js +97 -37
  111. package/dest/p2p/reqresp/utils.d.ts +19 -0
  112. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  113. package/dest/{e2e_p2p → p2p}/reqresp/utils.js +67 -27
  114. package/dest/p2p/shared.d.ts +72 -0
  115. package/dest/p2p/shared.d.ts.map +1 -0
  116. package/dest/p2p/shared.js +212 -0
  117. package/dest/shared/cross_chain_test_harness.d.ts +6 -4
  118. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  119. package/dest/shared/cross_chain_test_harness.js +36 -31
  120. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  121. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  122. package/dest/shared/gas_portal_test_harness.js +26 -14
  123. package/dest/shared/index.d.ts +2 -1
  124. package/dest/shared/index.d.ts.map +1 -1
  125. package/dest/shared/index.js +1 -0
  126. package/dest/shared/jest_setup.js +41 -1
  127. package/dest/shared/mock_state_view.d.ts +86 -0
  128. package/dest/shared/mock_state_view.d.ts.map +1 -0
  129. package/dest/shared/mock_state_view.js +186 -0
  130. package/dest/shared/submit-transactions.d.ts +2 -2
  131. package/dest/shared/submit-transactions.d.ts.map +1 -1
  132. package/dest/shared/submit-transactions.js +12 -5
  133. package/dest/shared/timing_env.d.js +5 -0
  134. package/dest/shared/timing_env.js +365 -0
  135. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  136. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  137. package/dest/shared/uniswap_l1_l2.js +56 -44
  138. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  139. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  140. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  141. package/dest/simulators/lending_simulator.d.ts +10 -3
  142. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  143. package/dest/simulators/lending_simulator.js +27 -15
  144. package/dest/simulators/token_simulator.d.ts +1 -1
  145. package/dest/simulators/token_simulator.d.ts.map +1 -1
  146. package/dest/simulators/token_simulator.js +3 -24
  147. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  148. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  149. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  150. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  151. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  152. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  153. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  154. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  155. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
  156. package/dest/single-node/fees/fees_test.d.ts +93 -0
  157. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  158. package/dest/{e2e_fees → single-node/fees}/fees_test.js +94 -68
  159. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  160. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  161. package/dest/single-node/l1-reorgs/setup.js +57 -0
  162. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  163. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  164. package/dest/single-node/partial-proofs/setup.js +5 -0
  165. package/dest/single-node/proving/setup.d.ts +5 -0
  166. package/dest/single-node/proving/setup.d.ts.map +1 -0
  167. package/dest/single-node/proving/setup.js +5 -0
  168. package/dest/single-node/recovery/setup.d.ts +5 -0
  169. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  170. package/dest/single-node/recovery/setup.js +5 -0
  171. package/dest/single-node/setup.d.ts +49 -0
  172. package/dest/single-node/setup.d.ts.map +1 -0
  173. package/dest/single-node/setup.js +56 -0
  174. package/dest/single-node/single_node_test_context.d.ts +360 -0
  175. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  176. package/dest/single-node/single_node_test_context.js +833 -0
  177. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  178. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  179. package/dest/spartan/setup_test_wallets.js +118 -41
  180. package/dest/spartan/tx_metrics.d.ts +27 -4
  181. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  182. package/dest/spartan/tx_metrics.js +106 -21
  183. package/dest/spartan/utils/bot.d.ts +3 -2
  184. package/dest/spartan/utils/bot.d.ts.map +1 -1
  185. package/dest/spartan/utils/bot.js +2 -1
  186. package/dest/spartan/utils/config.d.ts +11 -28
  187. package/dest/spartan/utils/config.d.ts.map +1 -1
  188. package/dest/spartan/utils/config.js +4 -1
  189. package/dest/spartan/utils/index.d.ts +5 -3
  190. package/dest/spartan/utils/index.d.ts.map +1 -1
  191. package/dest/spartan/utils/index.js +5 -1
  192. package/dest/spartan/utils/k8s.d.ts +3 -1
  193. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  194. package/dest/spartan/utils/k8s.js +6 -0
  195. package/dest/spartan/utils/nodes.d.ts +4 -5
  196. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  197. package/dest/spartan/utils/nodes.js +11 -11
  198. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  199. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  200. package/dest/spartan/utils/pod_logs.js +74 -0
  201. package/dest/spartan/utils/scripts.d.ts +18 -4
  202. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  203. package/dest/spartan/utils/scripts.js +19 -4
  204. package/dest/test-wallet/test_wallet.d.ts +105 -0
  205. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  206. package/dest/test-wallet/test_wallet.js +323 -0
  207. package/dest/test-wallet/utils.d.ts +76 -0
  208. package/dest/test-wallet/utils.d.ts.map +1 -0
  209. package/dest/test-wallet/utils.js +126 -0
  210. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  211. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  212. package/dest/test-wallet/wallet_worker_script.js +56 -0
  213. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  214. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  215. package/dest/test-wallet/worker_wallet.js +155 -0
  216. package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
  217. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  218. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  219. package/package.json +53 -46
  220. package/src/automine/README.md +60 -0
  221. package/src/automine/automine_test_context.ts +153 -0
  222. package/src/automine/contracts/fixtures/storage_proof.json +915 -0
  223. package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
  224. package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
  225. package/src/automine/delivery/onchain_delivery_harness.ts +177 -0
  226. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +51 -61
  227. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +50 -56
  228. package/src/automine/token/token_test_helpers.ts +138 -0
  229. package/src/bench/client_flows/benchmark.ts +21 -0
  230. package/src/bench/client_flows/client_flows_benchmark.ts +104 -70
  231. package/src/bench/client_flows/config.ts +9 -1
  232. package/src/bench/client_flows/data_extractor.ts +1 -0
  233. package/src/bench/utils.ts +117 -8
  234. package/src/composed/ha/ha_full_setup.ts +466 -0
  235. package/src/fixtures/authwit_proxy.ts +54 -0
  236. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  237. package/src/fixtures/e2e_prover_test.ts +94 -95
  238. package/src/fixtures/elu_monitor.ts +126 -0
  239. package/src/fixtures/fixtures.ts +108 -0
  240. package/src/fixtures/get_bb_config.ts +7 -6
  241. package/src/fixtures/ha_setup.ts +192 -0
  242. package/src/fixtures/index.ts +2 -0
  243. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  244. package/src/fixtures/setup.ts +412 -442
  245. package/src/fixtures/setup_p2p_test.ts +39 -34
  246. package/src/fixtures/timing.ts +97 -0
  247. package/src/fixtures/token_utils.ts +42 -7
  248. package/src/fixtures/utils.ts +2 -3
  249. package/src/fixtures/wait_helpers.ts +333 -0
  250. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  251. package/src/forward-compatibility/wallet_service.ts +106 -0
  252. package/src/guides/up_quick_start.sh +7 -4
  253. package/src/infra/README.md +12 -0
  254. package/src/install_legacy_contracts.cjs +75 -0
  255. package/src/legacy-jest-resolver.cjs +112 -0
  256. package/src/multi-node/README.md +95 -0
  257. package/src/multi-node/block-production/setup.ts +272 -0
  258. package/src/multi-node/governance/setup.ts +172 -0
  259. package/src/multi-node/multi_node_test_context.ts +447 -0
  260. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  261. package/src/multi-node/slashing/setup.ts +433 -0
  262. package/src/p2p/README.md +78 -0
  263. package/src/{e2e_p2p → p2p}/p2p_network.ts +121 -52
  264. package/src/{e2e_p2p → p2p}/reqresp/utils.ts +86 -30
  265. package/src/p2p/shared.ts +329 -0
  266. package/src/shared/cross_chain_test_harness.ts +42 -17
  267. package/src/shared/gas_portal_test_harness.ts +33 -15
  268. package/src/shared/index.ts +1 -0
  269. package/src/shared/jest_setup.ts +51 -1
  270. package/src/shared/mock_state_view.ts +188 -0
  271. package/src/shared/submit-transactions.ts +15 -6
  272. package/src/shared/timing_env.d.mts +39 -0
  273. package/src/shared/timing_env.mjs +363 -0
  274. package/src/shared/uniswap_l1_l2.ts +98 -56
  275. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  276. package/src/simulators/lending_simulator.ts +33 -15
  277. package/src/simulators/token_simulator.ts +6 -30
  278. package/src/single-node/README.md +60 -0
  279. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  280. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  281. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
  282. package/src/{e2e_fees → single-node/fees}/fees_test.ts +118 -89
  283. package/src/single-node/l1-reorgs/setup.ts +93 -0
  284. package/src/single-node/partial-proofs/setup.ts +8 -0
  285. package/src/single-node/proving/setup.ts +15 -0
  286. package/src/single-node/recovery/setup.ts +8 -0
  287. package/src/single-node/setup.ts +63 -0
  288. package/src/single-node/single_node_test_context.ts +1041 -0
  289. package/src/spartan/setup_test_wallets.ts +156 -36
  290. package/src/spartan/tx_metrics.ts +108 -24
  291. package/src/spartan/utils/bot.ts +4 -1
  292. package/src/spartan/utils/config.ts +3 -0
  293. package/src/spartan/utils/index.ts +8 -1
  294. package/src/spartan/utils/k8s.ts +8 -0
  295. package/src/spartan/utils/nodes.ts +17 -12
  296. package/src/spartan/utils/pod_logs.ts +99 -0
  297. package/src/spartan/utils/scripts.ts +43 -7
  298. package/src/test-wallet/test_wallet.ts +429 -0
  299. package/src/test-wallet/utils.ts +205 -0
  300. package/src/test-wallet/wallet_worker_script.ts +66 -0
  301. package/src/test-wallet/worker_wallet.ts +214 -0
  302. package/src/test-wallet/worker_wallet_schema.ts +14 -0
  303. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -53
  304. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  305. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
  306. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  307. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -128
  308. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  309. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  310. package/dest/e2e_deploy_contract/deploy_test.js +0 -50
  311. package/dest/e2e_epochs/epochs_test.d.ts +0 -100
  312. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  313. package/dest/e2e_epochs/epochs_test.js +0 -361
  314. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  315. package/dest/e2e_fees/fees_test.d.ts +0 -88
  316. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  317. package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
  318. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  319. package/dest/e2e_l1_publisher/write_json.js +0 -56
  320. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  321. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  322. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  323. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  324. package/dest/e2e_nested_contract/nested_contract_test.js +0 -56
  325. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  326. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  327. package/dest/e2e_p2p/inactivity_slash_test.js +0 -136
  328. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  329. package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
  330. package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
  331. package/dest/e2e_p2p/shared.d.ts +0 -46
  332. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  333. package/dest/e2e_p2p/shared.js +0 -177
  334. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -42
  335. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  336. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -194
  337. package/src/e2e_deploy_contract/deploy_test.ts +0 -85
  338. package/src/e2e_epochs/epochs_test.ts +0 -477
  339. package/src/e2e_l1_publisher/write_json.ts +0 -77
  340. package/src/e2e_nested_contract/nested_contract_test.ts +0 -73
  341. package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
  342. package/src/e2e_p2p/shared.ts +0 -288
  343. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  344. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -1,22 +1,13 @@
1
- import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import { type InitialAccountData, generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
3
- import { type Archiver, createArchiver } from '@aztec/archiver';
4
- import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
1
+ import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
2
+ import { type AztecNodeConfig, AztecNodeService, createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
3
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
6
- import {
7
- BatchCall,
8
- type ContractFunctionInteraction,
9
- type ContractMethod,
10
- getContractClassFromArtifact,
11
- waitForProven,
12
- } from '@aztec/aztec.js/contracts';
4
+ import type { ContractMethod } from '@aztec/aztec.js/contracts';
13
5
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
14
6
  import { Fr } from '@aztec/aztec.js/fields';
15
7
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
16
- import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
8
+ import type { AztecNode } from '@aztec/aztec.js/node';
17
9
  import type { Wallet } from '@aztec/aztec.js/wallet';
18
- import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
19
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
10
+ import { CheatCodes } from '@aztec/aztec/testing';
20
11
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
21
12
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
22
13
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -30,36 +21,34 @@ import {
30
21
  type ZKPassportArgs,
31
22
  deployAztecL1Contracts,
32
23
  } from '@aztec/ethereum/deploy-aztec-l1-contracts';
33
- import {
34
- DelayedTxUtils,
35
- EthCheatCodes,
36
- EthCheatCodesWithState,
37
- createDelayedL1TxUtilsFromViemWallet,
38
- startAnvil,
39
- } from '@aztec/ethereum/test';
24
+ import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
25
+ import { EthCheatCodes, EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
26
+ import type { Anvil } from '@aztec/ethereum/test';
27
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
40
28
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
41
29
  import { SecretValue } from '@aztec/foundation/config';
42
30
  import { randomBytes } from '@aztec/foundation/crypto/random';
43
31
  import { tryRmDir } from '@aztec/foundation/fs';
44
32
  import { withLoggerBindings } from '@aztec/foundation/log/server';
45
33
  import { retryUntil } from '@aztec/foundation/retry';
46
- import { sleep } from '@aztec/foundation/sleep';
47
34
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
48
- import type { DataStoreConfig } from '@aztec/kv-store/config';
49
35
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
50
36
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
51
37
  import type { P2PClientDeps } from '@aztec/p2p';
52
38
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
53
39
  import { protocolContractsHash } from '@aztec/protocol-contracts';
54
- import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
55
- import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
40
+ import type { ProverNodeConfig } from '@aztec/prover-node';
41
+ import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
56
42
  import type { SequencerClient } from '@aztec/sequencer-client';
57
- import type { TestSequencerClient } from '@aztec/sequencer-client/test';
43
+ import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
44
+ import { HandshakeRegistryArtifact, getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
45
+ import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
46
+ import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
58
47
  import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
59
- import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
48
+ import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
60
49
  import { tryStop } from '@aztec/stdlib/interfaces/server';
61
- import type { P2PClientType } from '@aztec/stdlib/p2p';
62
50
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
51
+ import type { GenesisData } from '@aztec/stdlib/world-state';
63
52
  import {
64
53
  type TelemetryClient,
65
54
  type TelemetryClientConfig,
@@ -67,10 +56,9 @@ import {
67
56
  initTelemetryClient,
68
57
  } from '@aztec/telemetry-client';
69
58
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
70
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
59
+ import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
71
60
  import { getGenesisValues } from '@aztec/world-state/testing';
72
61
 
73
- import type { Anvil } from '@viem/anvil';
74
62
  import fs from 'fs/promises';
75
63
  import { tmpdir } from 'os';
76
64
  import path from 'path';
@@ -84,17 +72,16 @@ import {
84
72
  } from 'viem/accounts';
85
73
  import { type Chain, foundry } from 'viem/chains';
86
74
 
75
+ import { TestWallet } from '../test-wallet/test_wallet.js';
87
76
  import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
88
77
  import { getACVMConfig } from './get_acvm_config.js';
89
78
  import { getBBConfig } from './get_bb_config.js';
90
79
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
80
+ import { testSpan } from './timing.js';
91
81
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
92
82
 
93
83
  export { startAnvil };
94
84
 
95
- const { AZTEC_NODE_URL = '' } = process.env;
96
- const getAztecUrl = () => AZTEC_NODE_URL;
97
-
98
85
  let telemetry: TelemetryClient | undefined = undefined;
99
86
  async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
100
87
  if (!telemetry) {
@@ -123,6 +110,8 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
123
110
  /**
124
111
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
125
112
  * @param aztecNode - An instance of Aztec Node.
113
+ * @param nodeDebug - The node's debug API, used to register public function signatures for named traces; pass
114
+ * `undefined` when the node does not expose it.
126
115
  * @param opts - Partial configuration for the PXE.
127
116
  * @param logger - The logger to be used.
128
117
  * @param actor - Actor label to include in log output (e.g., 'pxe-test').
@@ -130,6 +119,7 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
130
119
  */
131
120
  export async function setupPXEAndGetWallet(
132
121
  aztecNode: AztecNode,
122
+ nodeDebug: AztecNodeDebug | undefined,
133
123
  opts: Partial<PXEConfig> = {},
134
124
  logger = getLogger(),
135
125
  actor?: string,
@@ -150,7 +140,10 @@ export async function setupPXEAndGetWallet(
150
140
 
151
141
  const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
152
142
 
153
- const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
143
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, {
144
+ loggerActorLabel: actor,
145
+ nodeDebug,
146
+ });
154
147
 
155
148
  return {
156
149
  wallet,
@@ -160,7 +153,7 @@ export async function setupPXEAndGetWallet(
160
153
  }
161
154
 
162
155
  /** Options for the e2e tests setup */
163
- export type SetupOptions = {
156
+ export type SetupOptions<TDeployExtraL1ContractsReturnType = unknown> = {
164
157
  /** State load */
165
158
  stateLoad?: string;
166
159
  /** Whether to enable metrics collection, if undefined, metrics collection is disabled */
@@ -169,10 +162,11 @@ export type SetupOptions = {
169
162
  deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
170
163
  /** Initial fee juice for default accounts */
171
164
  initialAccountFeeJuice?: Fr;
172
- /** Number of initial accounts funded with fee juice */
173
- numberOfInitialFundedAccounts?: number;
174
- /** Data of the initial funded accounts */
175
- initialFundedAccounts?: InitialAccountData[];
165
+ /**
166
+ * Extra accounts to fund at genesis beyond the `numberOfAccounts` initializerless accounts that setup
167
+ * creates. Setup funds these but does NOT create or deploy them — the test creates/deploys them itself
168
+ */
169
+ additionallyFundedAccounts?: InitialAccountData[];
176
170
  /** An initial set of validators */
177
171
  initialValidators?: (Operator & { privateKey: `0x${string}` })[];
178
172
  /** Anvil Start time */
@@ -189,41 +183,70 @@ export type SetupOptions = {
189
183
  proverNodeConfig?: Partial<ProverNodeConfig>;
190
184
  /** Whether to use a mock gossip sub network for p2p clients. */
191
185
  mockGossipSubNetwork?: boolean;
192
- /** Whether to disable the anvil test watcher (can still be manually started) */
193
- disableAnvilTestWatcher?: boolean;
194
- /** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
186
+ /** Whether to add simulated latency to the mock gossipsub network (in ms) */
187
+ mockGossipSubNetworkLatency?: number;
188
+ /**
189
+ * Whether to mine the L1 setup txs (Multicall3 + rollup contract deployment) under anvil automine
190
+ * instead of waiting on the block interval. Defaults to `true` (set in `setupInner`); only suites
191
+ * that assert on genesis-relative L1 timing need to opt out with `false`.
192
+ */
195
193
  automineL1Setup?: boolean;
194
+ /**
195
+ * Hook invoked after the Aztec L1 rollup contracts are deployed but BEFORE the node/sequencer
196
+ * start, while anvil automine is still enabled (when `automineL1Setup` is true, the default).
197
+ * Deploy extra L1 contracts a test needs here (e.g. a cross-chain token portal + ERC20) so they
198
+ * mine instantly under automine instead of paying the L1 block interval once the node is running
199
+ * (and racing the live sequencer/archiver). The resolved value is exposed on the returned context
200
+ * as `extraL1DeployResult`. The hook receives setup's L1 deployer client (the same one used to
201
+ * deploy Multicall3).
202
+ */
203
+ deployExtraL1Contracts?: (deps: {
204
+ l1Client: ExtendedViemWalletClient;
205
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
206
+ logger: Logger;
207
+ }) => Promise<TDeployExtraL1ContractsReturnType>;
196
208
  /** How many accounts to seed and unlock in anvil. */
197
209
  anvilAccounts?: number;
198
210
  /** Port to start anvil (defaults to 8545) */
199
211
  anvilPort?: number;
212
+ /**
213
+ * Number of slots per epoch for Anvil's finality simulation.
214
+ * Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
215
+ */
216
+ anvilSlotsInAnEpoch?: number;
200
217
  /** Key to use for publishing L1 contracts */
201
218
  l1PublisherKey?: SecretValue<`0x${string}`>;
202
219
  /** ZkPassport configuration (domain, scope, mock verifier) */
203
220
  zkPassportArgs?: ZKPassportArgs;
204
221
  /** Whether to fund the sponsored FPC in genesis (defaults to false). */
205
222
  fundSponsoredFPC?: boolean;
206
- /** Whether to skip deploying accounts during setup (legacy behavior for tests using deployAccounts helper). */
207
- skipAccountDeployment?: boolean;
208
223
  /** L1 contracts deployment arguments. */
209
224
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
210
- /** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
225
+ /** Wallet minimum fee padding multiplier */
211
226
  walletMinFeePadding?: number;
227
+ /** Whether the initial node should be a lightweight RPC-only node (no sequencer, no validator).
228
+ * Use for tests that create their own validator nodes and don't need the initial sequencer. */
229
+ skipInitialSequencer?: boolean;
230
+ /** Whether to swap the production Sequencer for the minimal AutomineSequencer.
231
+ * Use only for single-sequencer non-block-building tests. See AUTOMINE_E2E_OPTS in `fixtures.ts`. */
232
+ useAutomineSequencer?: boolean;
233
+ /** Options forwarded to PXE creation (e.g. execution hooks). */
234
+ pxeCreationOptions?: PXECreationOptions;
212
235
  } & Partial<AztecNodeConfig>;
213
236
 
214
237
  /** Context for an end-to-end test as returned by the `setup` function */
215
- export type EndToEndContext = {
238
+ export type EndToEndContext<TDeployExtraL1ContractsReturnType = unknown> = {
216
239
  /** The Anvil instance (only set if anvil was started locally). */
217
240
  anvil: Anvil | undefined;
218
241
  /** The Aztec Node service or client a connected to it. */
219
- aztecNode: AztecNode;
220
- /** The Aztec Node as a service (only set if running locally). */
221
- aztecNodeService: AztecNodeService | undefined;
222
- /** Client to the Aztec Node admin interface (undefined if connected to remote environment) */
223
- aztecNodeAdmin: AztecNodeAdmin | undefined;
224
- /** The prover node service (only set if startProverNode is true) */
225
- proverNode: ProverNode | undefined;
226
- /** A client to the sequencer service (undefined if connected to remote environment) */
242
+ aztecNode: AztecNode & AztecNodeDebug;
243
+ /** The Aztec Node as a service. */
244
+ aztecNodeService: AztecNodeService;
245
+ /** Client to the Aztec Node admin interface. */
246
+ aztecNodeAdmin: AztecNodeAdmin;
247
+ /** The aztec node running the prover node subsystem (only set if startProverNode is true). */
248
+ proverNode: AztecNodeService | undefined;
249
+ /** A client to the sequencer service. */
227
250
  sequencer: SequencerClient | undefined;
228
251
  /** Return values from deployAztecL1Contracts function. */
229
252
  deployL1ContractsValues: DeployAztecL1ContractsReturnType;
@@ -231,8 +254,8 @@ export type EndToEndContext = {
231
254
  config: AztecNodeConfig;
232
255
  /** The Aztec Node configuration (alias for config for backward compatibility). */
233
256
  aztecNodeConfig: AztecNodeConfig;
234
- /** The data for the initial funded accounts. */
235
- initialFundedAccounts: InitialAccountData[];
257
+ /** Data for the extra accounts funded at genesis but not created by setup (the test creates/deploys them). */
258
+ additionallyFundedAccounts: InitialAccountData[];
236
259
  /** The wallet to be used. */
237
260
  wallet: TestWallet;
238
261
  /** The wallets to be used. */
@@ -243,100 +266,54 @@ export type EndToEndContext = {
243
266
  cheatCodes: CheatCodes;
244
267
  /** The cheat codes for L1 */
245
268
  ethCheatCodes: EthCheatCodes;
246
- /** The anvil test watcher (undefined if connected to remote environment) */
247
- watcher: AnvilTestWatcher | undefined;
248
- /** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
249
- dateProvider: TestDateProvider | undefined;
269
+ /** Allows tweaking current system time, used by the epoch cache only. */
270
+ dateProvider: TestDateProvider;
250
271
  /** Telemetry client */
251
- telemetryClient: TelemetryClient | undefined;
272
+ telemetryClient: TelemetryClient;
252
273
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
253
274
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
254
- /** Prefilled public data used for setting up nodes. */
255
- prefilledPublicData: PublicDataTreeLeaf[] | undefined;
275
+ /** Delayer for sequencer L1 txs (only when enableDelayer is true). */
276
+ sequencerDelayer: Delayer | undefined;
277
+ /** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
278
+ proverDelayer: Delayer | undefined;
279
+ /** Genesis data used for setting up nodes. */
280
+ genesis: GenesisData | undefined;
281
+ /** Resolved value of the `deployExtraL1Contracts` setup hook, if one was provided. */
282
+ extraL1DeployResult: TDeployExtraL1ContractsReturnType;
256
283
  /** ACVM config (only set if running locally). */
257
284
  acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
258
285
  /** BB config (only set if running locally). */
259
286
  bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
260
287
  /** Directory to cleanup on teardown. */
261
- directoryToCleanup: string | undefined;
288
+ directoryToCleanup: string;
262
289
  /** Function to stop the started services. */
263
290
  teardown: () => Promise<void>;
264
291
  };
265
292
 
266
293
  /**
267
- * Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
294
+ * When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
295
+ * aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
296
+ * actually swapped in the correct version.
268
297
  */
269
- async function setupWithRemoteEnvironment(
270
- account: HDAccount | PrivateKeyAccount,
271
- config: AztecNodeConfig & SetupOptions,
272
- logger: Logger,
273
- numberOfAccounts: number,
274
- ): Promise<EndToEndContext> {
275
- const aztecNodeUrl = getAztecUrl();
276
- logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
277
- const aztecNode = createAztecNodeClient(aztecNodeUrl);
278
- await waitForNode(aztecNode, logger);
279
- logger.verbose('JSON RPC client connected to Aztec Node');
280
- logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
281
- const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
282
-
283
- const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
284
-
285
- const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
286
- l1ContractAddresses,
287
- l1Client,
288
- rollupVersion,
289
- };
290
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
291
- const wallet = await TestWallet.create(aztecNode);
292
-
293
- if (config.walletMinFeePadding !== undefined) {
294
- wallet.setMinFeePadding(config.walletMinFeePadding);
298
+ function assertContractArtifactsVersion() {
299
+ const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
300
+ if (!expected) {
301
+ return;
295
302
  }
296
-
297
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
298
- const teardown = () => Promise.resolve();
299
-
300
- logger.verbose('Populating wallet from already registered accounts...');
301
- const initialFundedAccounts = await getInitialTestAccountsData();
302
-
303
- if (initialFundedAccounts.length < numberOfAccounts) {
304
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
303
+ const { aztecVersion } = SponsoredFPCContract.artifact;
304
+ // TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
305
+ if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
306
+ createLogger('e2e:setup').info(
307
+ `Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`,
308
+ );
309
+ return;
310
+ }
311
+ if (aztecVersion !== expected) {
312
+ throw new Error(
313
+ `Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` +
314
+ `The legacy artifact resolver may not have swapped in the correct version.`,
315
+ );
305
316
  }
306
-
307
- const testAccounts = await Promise.all(
308
- initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
309
- const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
310
- return accountManager.address;
311
- }),
312
- );
313
-
314
- return {
315
- anvil: undefined,
316
- aztecNode,
317
- aztecNodeService: undefined,
318
- aztecNodeAdmin: undefined,
319
- sequencer: undefined,
320
- proverNode: undefined,
321
- deployL1ContractsValues,
322
- config,
323
- aztecNodeConfig: config,
324
- initialFundedAccounts,
325
- wallet,
326
- accounts: testAccounts,
327
- logger,
328
- cheatCodes,
329
- ethCheatCodes,
330
- prefilledPublicData: undefined,
331
- mockGossipSubNetwork: undefined,
332
- watcher: undefined,
333
- dateProvider: undefined,
334
- telemetryClient: undefined,
335
- acvmConfig: undefined,
336
- bbConfig: undefined,
337
- directoryToCleanup: undefined,
338
- teardown,
339
- };
340
317
  }
341
318
 
342
319
  /**
@@ -345,16 +322,43 @@ async function setupWithRemoteEnvironment(
345
322
  * @param opts - Options to pass to the node initialization and to the setup script.
346
323
  * @param pxeOpts - Options to pass to the PXE initialization.
347
324
  */
348
- export async function setup(
325
+ export function setup<TDeployExtraL1ContractsReturnType = unknown>(
349
326
  numberOfAccounts = 1,
350
- opts: SetupOptions = {},
327
+ opts: SetupOptions<TDeployExtraL1ContractsReturnType> = {},
351
328
  pxeOpts: Partial<PXEConfig> = {},
352
329
  chain: Chain = foundry,
353
- ): Promise<EndToEndContext> {
330
+ ): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
331
+ // Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
332
+ // swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
333
+ // (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
334
+ const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
335
+ return testSpan(`setup:env:${proverMode}`, async () => {
336
+ const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
337
+ if (process.env.EXIT_E2E_AFTER_SETUP) {
338
+ ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
339
+ throw new Error('EXIT_E2E_AFTER_SETUP');
340
+ }
341
+ return ctx;
342
+ });
343
+ }
344
+
345
+ async function setupInner<TDeployExtraL1ContractsReturnType = unknown>(
346
+ numberOfAccounts: number,
347
+ opts: SetupOptions<TDeployExtraL1ContractsReturnType>,
348
+ pxeOpts: Partial<PXEConfig>,
349
+ chain: Chain,
350
+ ): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
351
+ assertContractArtifactsVersion();
352
+ const logger = getLogger();
354
353
  let anvil: Anvil | undefined;
355
354
  try {
356
355
  opts.aztecTargetCommitteeSize ??= 0;
357
- opts.slasherFlavor ??= 'none';
356
+ opts.slasherEnabled ??= false;
357
+ // Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
358
+ // waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
359
+ // assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
360
+ opts.automineL1Setup ??= true;
361
+ logger.trace('Starting e2e test setup');
358
362
 
359
363
  const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
360
364
  // use initialValidators for the node config
@@ -364,11 +368,11 @@ export async function setup(
364
368
  config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
365
369
  // For tests we only want proving enabled if specifically requested
366
370
  config.realProofs = !!opts.realProofs;
367
- // Only enforce the time table if requested
368
- config.enforceTimeTable = !!opts.enforceTimeTable;
371
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
372
+ config.enableDelayer = true;
369
373
  config.listenAddress = '127.0.0.1';
370
374
 
371
- const logger = getLogger();
375
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
372
376
 
373
377
  // Create a temp directory for any services that need it and cleanup later
374
378
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
@@ -377,24 +381,25 @@ export async function setup(
377
381
  config.dataDirectory = directoryToCleanup;
378
382
  }
379
383
 
384
+ const dateProvider = new TestDateProvider();
385
+
380
386
  if (!config.l1RpcUrls?.length) {
381
387
  if (!isAnvilTestChain(chain.id)) {
382
388
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
383
389
  }
384
- if (AZTEC_NODE_URL) {
385
- throw new Error(
386
- `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`,
387
- );
388
- }
389
-
390
- const res = await startAnvil({
391
- l1BlockTime: opts.ethereumSlotDuration,
392
- accounts: opts.anvilAccounts,
393
- port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
394
- });
390
+ const res = await testSpan('setup:env:anvil', () =>
391
+ startAnvil({
392
+ l1BlockTime: opts.ethereumSlotDuration,
393
+ accounts: opts.anvilAccounts,
394
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
395
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
396
+ dateProvider,
397
+ }),
398
+ );
395
399
  anvil = res.anvil;
396
400
  config.l1RpcUrls = [res.rpcUrl];
397
401
  }
402
+ logger.trace('Started anvil and L1 RPC client');
398
403
 
399
404
  // Enable logging metrics to a local file named after the test suite
400
405
  if (isMetricsLoggingRequested()) {
@@ -402,8 +407,6 @@ export async function setup(
402
407
  logger.info(`Logging metrics to ${filename}`);
403
408
  setupMetricsLogger(filename);
404
409
  }
405
-
406
- const dateProvider = new TestDateProvider();
407
410
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
408
411
 
409
412
  if (opts.stateLoad) {
@@ -413,6 +416,7 @@ export async function setup(
413
416
  if (opts.l1StartTime) {
414
417
  await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
415
418
  }
419
+ logger.trace('Initialized L1 cheat codes and applied state/time overrides');
416
420
 
417
421
  let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
418
422
  let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
@@ -421,11 +425,11 @@ export async function setup(
421
425
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
422
426
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
423
427
  } else if (
424
- config.publisherPrivateKeys &&
425
- config.publisherPrivateKeys.length > 0 &&
426
- config.publisherPrivateKeys[0].getValue() != NULL_KEY
428
+ config.sequencerPublisherPrivateKeys &&
429
+ config.sequencerPublisherPrivateKeys.length > 0 &&
430
+ config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
427
431
  ) {
428
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
432
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
429
433
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
430
434
  } else if (!MNEMONIC) {
431
435
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -434,35 +438,36 @@ export async function setup(
434
438
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
435
439
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
436
440
  publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
437
- config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
441
+ config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
438
442
  }
439
443
 
440
444
  if (config.coinbase === undefined) {
441
445
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
442
446
  }
447
+ logger.trace('Resolved L1 publisher account');
443
448
 
444
- if (AZTEC_NODE_URL) {
445
- // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
446
- return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
447
- }
448
-
449
- // Determine which addresses to fund in genesis
450
- const initialFundedAccounts =
451
- opts.initialFundedAccounts ??
452
- (await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10)));
453
- const addressesToFund = initialFundedAccounts.map(a => a.address);
449
+ // The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
450
+ // funded at genesis so they are immediately usable.
451
+ const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
452
+ // Extra accounts the test wants funded at genesis but will create/deploy itself.
453
+ const additionallyFundedAccounts = opts.additionallyFundedAccounts ?? [];
454
+ const addressesToFund = [...defaultAccounts, ...additionallyFundedAccounts].map(a => a.address);
454
455
 
455
456
  // Optionally fund the sponsored FPC
456
457
  if (opts.fundSponsoredFPC) {
457
458
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
458
459
  addressesToFund.push(sponsoredFPCAddress);
459
460
  }
461
+ logger.trace('Generated test accounts to fund at genesis');
460
462
 
461
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
463
+ const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
464
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
462
465
  addressesToFund,
463
466
  opts.initialAccountFeeJuice,
464
467
  opts.genesisPublicData,
468
+ genesisTimestamp,
465
469
  );
470
+ logger.trace('Computed genesis values');
466
471
 
467
472
  const wasAutomining = await ethCheatCodes.isAutoMining();
468
473
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
@@ -472,18 +477,21 @@ export async function setup(
472
477
 
473
478
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
474
479
 
480
+ // Warm both KZG trusted setups (ours + anvil's) in parallel
481
+ if (anvil && isAnvilTestChain(chain.id)) {
482
+ await warmBlobKzg(l1Client, logger);
483
+ }
484
+
475
485
  // Deploy Multicall3 if running locally
476
486
  await deployMulticall3(l1Client, logger);
477
487
 
478
488
  // Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
479
489
  // This is necessary because deployMulticall3 sends multiple transactions and viem may cache a stale nonce
480
490
  await l1Client.getTransactionCount({ address: l1Client.account.address });
491
+ logger.trace('Deployed Multicall3');
481
492
 
482
- const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await deployAztecL1Contracts(
483
- config.l1RpcUrls[0],
484
- publisherPrivKeyHex!,
485
- chain.id,
486
- {
493
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await testSpan('setup:env:l1-deploy', () =>
494
+ deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex!, chain.id, {
487
495
  ...getL1ContractsConfigEnvVars(),
488
496
  ...opts,
489
497
  ...opts.l1ContractsArgs,
@@ -493,76 +501,96 @@ export async function setup(
493
501
  initialValidators: opts.initialValidators,
494
502
  feeJuicePortalInitialBalance: fundingNeeded,
495
503
  realVerifier: false,
496
- },
504
+ }),
497
505
  );
498
506
 
499
- config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
507
+ Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
500
508
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
501
509
 
502
- if (enableAutomine) {
503
- await ethCheatCodes.setAutomine(false);
504
- await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
505
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
510
+ // Propagate L1-contracts-config overrides back to the node config so the archiver's
511
+ // `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
512
+ // Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
513
+ // but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
514
+ // `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
515
+ // `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
516
+ // Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
517
+ // by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
518
+ // as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
519
+ // in this function and crash `setupSharedBlobStorage`.
520
+ if (opts.l1ContractsArgs) {
521
+ for (const [key, value] of Object.entries(opts.l1ContractsArgs)) {
522
+ if (value !== undefined) {
523
+ (config as unknown as Record<string, unknown>)[key] = value;
524
+ }
525
+ }
506
526
  }
507
527
 
508
- if (opts.l2StartTime) {
509
- await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
528
+ // Deploy any test-specific L1 contracts while automine is still on and before the node starts,
529
+ // so they mine instantly rather than paying the L1 block interval once the sequencer is live.
530
+ let extraL1DeployResult: TDeployExtraL1ContractsReturnType = undefined as TDeployExtraL1ContractsReturnType;
531
+ if (opts.deployExtraL1Contracts) {
532
+ logger.trace('Running deployExtraL1Contracts hook');
533
+ extraL1DeployResult = await opts.deployExtraL1Contracts({
534
+ l1Client,
535
+ deployL1ContractsValues,
536
+ logger,
537
+ });
538
+ // The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
539
+ // stale cached nonce for later transactions on the publisher account.
540
+ await l1Client.getTransactionCount({ address: l1Client.account.address });
510
541
  }
511
542
 
512
- const watcher = new AnvilTestWatcher(
513
- new EthCheatCodesWithState(config.l1RpcUrls, dateProvider),
514
- deployL1ContractsValues.l1ContractAddresses.rollupAddress,
515
- deployL1ContractsValues.l1Client,
516
- dateProvider,
517
- );
518
- if (!opts.disableAnvilTestWatcher) {
519
- await watcher.start();
543
+ if (enableAutomine) {
544
+ await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
520
545
  }
521
546
 
522
- // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
523
- const telemetryClient = opts.metricsPort
524
- ? await getEndToEndTestTelemetryClient(opts.metricsPort)
525
- : await getTelemetryClient(opts.telemetryConfig);
526
-
527
- await setupSharedBlobStorage(config);
547
+ // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
548
+ // ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
549
+ // the stdout listener.
550
+ if (!anvil) {
551
+ dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
552
+ }
528
553
 
529
- logger.verbose('Creating and synching an aztec node', config);
554
+ if (opts.l2StartTime) {
555
+ await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
556
+ }
557
+ logger.trace('Deployed L1 rollup contracts');
558
+
559
+ // These boot steps are independent and write disjoint config keys, so run them concurrently:
560
+ // telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
561
+ // and the ACVM/BB config resolvers write their own acvm*/bb* keys.
562
+ const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
563
+ // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
564
+ opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
565
+ setupSharedBlobStorage(config),
566
+ getACVMConfig(logger),
567
+ getBBConfig(logger),
568
+ ]);
569
+ logger.trace('Created telemetry client');
570
+ logger.trace('Set up shared blob storage');
530
571
 
531
- const acvmConfig = await getACVMConfig(logger);
532
572
  if (acvmConfig) {
533
573
  config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
534
574
  config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
535
575
  }
576
+ logger.trace('Resolved ACVM config');
536
577
 
537
- const bbConfig = await getBBConfig(logger);
538
578
  if (bbConfig) {
539
579
  config.bbBinaryPath = bbConfig.bbBinaryPath;
540
580
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
541
581
  }
582
+ logger.trace('Resolved Barretenberg config');
583
+
584
+ logger.verbose('Creating and synching an aztec node', config);
542
585
 
543
586
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
544
- let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
587
+ let p2pClientDeps: P2PClientDeps | undefined = undefined;
545
588
 
546
589
  if (opts.mockGossipSubNetwork) {
547
- mockGossipSubNetwork = new MockGossipSubNetwork();
590
+ mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
548
591
  p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
549
592
  }
550
593
 
551
- // Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
552
- // To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
553
- // For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
554
- // If no accounts need deployment, we await an empty block to confirm network progression.
555
- const originalMinTxsPerBlock = config.minTxsPerBlock;
556
- if (originalMinTxsPerBlock === undefined) {
557
- throw new Error('minTxsPerBlock is undefined in e2e test setup');
558
- }
559
-
560
- // Only set minTxsPerBlock=1 if we're going to deploy accounts and need reliable block inclusion
561
- const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
562
- // Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
563
- const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
564
- config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
565
-
566
594
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
567
595
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
568
596
 
@@ -572,52 +600,81 @@ export async function setup(
572
600
  }
573
601
  }
574
602
 
575
- const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
576
- AztecNodeService.createAndSync(
577
- config,
578
- { dateProvider, telemetry: telemetryClient, p2pClientDeps },
579
- { prefilledPublicData },
603
+ // When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
604
+ // We apply these overrides to a copy so they don't leak into the returned config.
605
+ // Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
606
+ const initialNodeConfig = opts.skipInitialSequencer
607
+ ? {
608
+ ...config,
609
+ disableValidator: true,
610
+ ...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
611
+ }
612
+ : config;
613
+ logger.trace('Prepared aztec node config');
614
+
615
+ const aztecNodeService = await testSpan('setup:env:sequencer-start', () =>
616
+ withLoggerBindings({ actor: 'node-0' }, () =>
617
+ createAztecNodeService(
618
+ initialNodeConfig,
619
+ { dateProvider, telemetry: telemetryClient, p2pClientDeps },
620
+ { genesis, dontStartSequencer: opts.skipInitialSequencer },
621
+ ),
580
622
  ),
581
623
  );
582
624
  const sequencerClient = aztecNodeService.getSequencer();
625
+ logger.trace('Created and synced aztec node');
583
626
 
584
- if (sequencerClient) {
585
- const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
586
- publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
587
- }
588
-
589
- let proverNode: ProverNode | undefined = undefined;
627
+ let proverNode: AztecNodeService | undefined = undefined;
590
628
  if (opts.startProverNode) {
591
629
  logger.verbose('Creating and syncing a simulated prover node...');
592
630
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
593
631
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
594
632
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
595
- const proverNodeConfig = {
596
- ...config.proverNodeConfig,
597
- dataDirectory: proverNodeDataDirectory,
598
- p2pEnabled: false,
633
+
634
+ const p2pClientDeps: Partial<P2PClientDeps> = {
635
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
636
+ rpcTxProviders: [aztecNodeService],
599
637
  };
600
- proverNode = await createAndSyncProverNode(
601
- proverNodePrivateKeyHex,
602
- config,
603
- proverNodeConfig,
604
- aztecNodeService,
605
- prefilledPublicData,
606
- );
638
+
639
+ ({ proverNode } = await testSpan('setup:env:prover-node', () =>
640
+ createAndSyncProverNode(
641
+ proverNodePrivateKeyHex,
642
+ config,
643
+ {
644
+ ...config.proverNodeConfig,
645
+ dataDirectory: proverNodeDataDirectory,
646
+ },
647
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
648
+ { genesis },
649
+ ),
650
+ ));
651
+ logger.trace('Created prover node');
607
652
  }
608
653
 
654
+ const sequencerDelayer = sequencerClient?.getDelayer();
655
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
656
+
609
657
  logger.verbose('Creating a pxe...');
610
658
  const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
611
659
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
612
660
  // For tests we only want proving enabled if specifically requested
613
661
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
614
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig, { loggerActorLabel: 'pxe-0' });
662
+ const wallet = await testSpan('setup:env:pxe', () =>
663
+ TestWallet.create(aztecNodeService, pxeConfig, {
664
+ loggerActorLabel: 'pxe-0',
665
+ // In-process node implements the debug API, so register public function signatures for named traces.
666
+ nodeDebug: aztecNodeService,
667
+ ...opts.pxeCreationOptions,
668
+ }),
669
+ );
615
670
 
616
671
  if (opts.walletMinFeePadding !== undefined) {
617
672
  wallet.setMinFeePadding(opts.walletMinFeePadding);
618
673
  }
674
+ logger.trace('Created PXE and test wallet');
619
675
 
620
676
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
677
+ logger.trace('Created cheat codes');
621
678
 
622
679
  if (
623
680
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
@@ -631,64 +688,48 @@ export async function setup(
631
688
  );
632
689
  await cheatCodes.rollup.setupEpoch();
633
690
  await cheatCodes.rollup.debugRollup();
691
+ logger.trace('Advanced chain to set up validator committee');
634
692
  }
635
693
 
636
694
  let accounts: AztecAddress[] = [];
637
695
 
638
- if (shouldDeployAccounts) {
639
- logger.info(
640
- `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
641
- );
642
- const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
643
- const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
644
- accounts = accountManagers.map(accountManager => accountManager.address);
645
- } else if (needsEmptyBlock) {
646
- logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
647
- while ((await aztecNodeService.getBlockNumber()) === 0) {
648
- await sleep(2000);
649
- }
650
- }
651
- // If skipAccountDeployment is true, we don't deploy or wait - tests will handle account deployment later
652
-
653
- // Now we restore the original minTxsPerBlock setting if we changed it.
654
- if (sequencerClient && config.minTxsPerBlock !== originalMinTxsPerBlock) {
655
- sequencerClient.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
696
+ // Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
697
+ // + a simulated store call) with no on-chain tx, independent of the sequencer.
698
+ if (numberOfAccounts > 0) {
699
+ logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
700
+ await testSpan('wallet:create', () => createFundedInitializerlessAccounts(wallet, defaultAccounts));
701
+ accounts = defaultAccounts.map(a => a.address);
656
702
  }
703
+ logger.trace('Created funded test accounts');
657
704
 
658
- if (initialFundedAccounts.length < numberOfAccounts) {
659
- throw new Error(
660
- `Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`,
661
- );
662
- }
663
-
664
- const teardown = async () => {
665
- try {
666
- await tryStop(wallet, logger);
667
- await tryStop(aztecNodeService, logger);
668
- await tryStop(proverNode, logger);
705
+ const teardown = () =>
706
+ testSpan('teardown:env', async () => {
707
+ try {
708
+ await tryStop(wallet, logger);
709
+ await tryStop(aztecNodeService, logger);
710
+ await tryStop(proverNode, logger);
669
711
 
670
- if (acvmConfig?.cleanup) {
671
- await acvmConfig.cleanup();
672
- }
712
+ if (acvmConfig?.cleanup) {
713
+ await acvmConfig.cleanup();
714
+ }
673
715
 
674
- if (bbConfig?.cleanup) {
675
- await bbConfig.cleanup();
676
- }
716
+ if (bbConfig?.cleanup) {
717
+ await bbConfig.cleanup();
718
+ }
677
719
 
678
- await tryStop(watcher, logger);
679
- await tryStop(anvil, logger);
720
+ await tryStop(anvil, logger);
680
721
 
681
- await tryRmDir(directoryToCleanup, logger);
682
- } catch (err) {
683
- logger.error(`Error during e2e test teardown`, err);
684
- } finally {
685
- try {
686
- await telemetryClient?.stop();
722
+ await tryRmDir(directoryToCleanup, logger);
687
723
  } catch (err) {
688
- logger.error(`Error during telemetry client stop`, err);
724
+ logger.error(`Error during e2e test teardown`, err);
725
+ } finally {
726
+ try {
727
+ await telemetryClient.stop();
728
+ } catch (err) {
729
+ logger.error(`Error during telemetry client stop`, err);
730
+ }
689
731
  }
690
- }
691
- };
732
+ });
692
733
 
693
734
  return {
694
735
  anvil,
@@ -701,17 +742,19 @@ export async function setup(
701
742
  aztecNodeConfig: config,
702
743
  dateProvider,
703
744
  deployL1ContractsValues,
704
- initialFundedAccounts,
745
+ additionallyFundedAccounts,
705
746
  logger,
706
747
  mockGossipSubNetwork,
707
- prefilledPublicData,
748
+ genesis,
749
+ extraL1DeployResult,
708
750
  proverNode,
751
+ sequencerDelayer,
752
+ proverDelayer,
709
753
  sequencer: sequencerClient,
710
754
  teardown,
711
755
  telemetryClient,
712
756
  wallet,
713
757
  accounts,
714
- watcher,
715
758
  acvmConfig,
716
759
  bbConfig,
717
760
  directoryToCleanup,
@@ -778,104 +821,71 @@ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
778
821
  await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
779
822
  }
780
823
 
781
- export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNumber, timeoutSec = 60, intervalSec = 1) {
824
+ export async function waitForProvenChain(
825
+ node: AztecNode,
826
+ targetBlock?: BlockNumber,
827
+ timeoutSec = 60,
828
+ intervalSec = 0.25,
829
+ ) {
782
830
  targetBlock ??= await node.getBlockNumber();
783
831
 
784
832
  await retryUntil(
785
- async () => (await node.getProvenBlockNumber()) >= targetBlock,
833
+ async () => (await node.getBlockNumber('proven')) >= targetBlock,
786
834
  'proven chain status',
787
835
  timeoutSec,
788
836
  intervalSec,
789
837
  );
790
838
  }
791
839
 
840
+ /**
841
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
842
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
843
+ */
792
844
  export function createAndSyncProverNode(
793
845
  proverNodePrivateKey: `0x${string}`,
794
- aztecNodeConfig: AztecNodeConfig,
795
- proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & { dontStart?: boolean },
796
- aztecNode: AztecNode | undefined,
797
- prefilledPublicData: PublicDataTreeLeaf[] = [],
798
- proverNodeDeps: ProverNodeDeps = {},
799
- ) {
846
+ baseConfig: AztecNodeConfig,
847
+ configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
848
+ deps: {
849
+ telemetry?: TelemetryClient;
850
+ dateProvider: DateProvider;
851
+ p2pClientDeps?: P2PClientDeps;
852
+ },
853
+ options: { genesis?: GenesisData; dontStart?: boolean },
854
+ ): Promise<{ proverNode: AztecNodeService }> {
800
855
  return withLoggerBindings({ actor: 'prover-0' }, async () => {
801
- const aztecNodeTxProvider = aztecNode && {
802
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
803
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
804
- stop: () => Promise.resolve(),
805
- };
806
-
807
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
808
-
809
- const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
810
- const archiver = await createArchiver(
811
- archiverConfig,
812
- { blobClient, dateProvider: proverNodeDeps.dateProvider },
813
- { blockUntilSync: true },
814
- );
815
-
816
- const proverConfig: ProverNodeConfig = {
817
- ...aztecNodeConfig,
818
- txCollectionNodeRpcUrls: [],
819
- realProofs: false,
820
- proverAgentCount: 2,
821
- publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
822
- proverNodeMaxPendingJobs: 10,
823
- proverNodeMaxParallelBlocksPerEpoch: 32,
824
- proverNodePollingIntervalMs: 200,
825
- txGatheringIntervalMs: 1000,
826
- txGatheringBatchSize: 10,
827
- txGatheringMaxParallelRequestsPerNode: 10,
828
- txGatheringTimeoutMs: 24_000,
829
- proverNodeFailedEpochStore: undefined,
830
- proverId: EthAddress.fromNumber(1),
831
- proverNodeEpochProvingDelayMs: undefined,
832
- ...proverNodeConfig,
833
- };
834
-
835
- const l1TxUtils = createDelayedL1TxUtils(
836
- aztecNodeConfig,
837
- proverNodePrivateKey,
838
- 'prover-node',
839
- proverNodeDeps.dateProvider,
856
+ const proverNode = await createAztecNodeService(
857
+ {
858
+ ...baseConfig,
859
+ ...configOverrides,
860
+ p2pPort: 0,
861
+ enableProverNode: true,
862
+ disableValidator: true,
863
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
864
+ },
865
+ deps,
866
+ { genesis: options.genesis, dontStartProverNode: options.dontStart },
840
867
  );
841
868
 
842
- const proverNode = await createProverNode(
843
- proverConfig,
844
- { ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
845
- { prefilledPublicData },
846
- );
847
- getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
848
- if (!proverNodeConfig.dontStart) {
849
- await proverNode.start();
869
+ if (!proverNode.getProverNode()) {
870
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
850
871
  }
851
- return proverNode;
852
- });
853
- }
854
-
855
- function createDelayedL1TxUtils(
856
- aztecNodeConfig: AztecNodeConfig,
857
- privateKey: `0x${string}`,
858
- logName: string,
859
- dateProvider?: DateProvider,
860
- ) {
861
- const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
862
872
 
863
- const log = createLogger(logName);
864
- const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
865
- l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
866
- return l1TxUtils;
873
+ getLogger().info(`Created and synced prover node`);
874
+ return { proverNode };
875
+ });
867
876
  }
868
877
 
869
878
  export type BalancesFn = ReturnType<typeof getBalancesFn>;
870
879
  export function getBalancesFn(
871
880
  symbol: string,
872
881
  method: ContractMethod,
873
- from: AztecAddress,
874
882
  logger: any,
875
883
  ): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
876
884
  const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
877
885
  const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
878
- const b = await Promise.all(addresses.map(address => method(address).simulate({ from })));
886
+ const b = await Promise.all(
887
+ addresses.map(async address => (await method(address).simulate({ from: address })).result),
888
+ );
879
889
  const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
880
890
  logger.verbose(debugString);
881
891
  return b;
@@ -911,96 +921,56 @@ export async function expectMappingDelta<K, V extends number | bigint>(
911
921
  }
912
922
 
913
923
  /**
914
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
915
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
924
+ * Registers the auth_registry contract class and publishes its standard instance if not already
925
+ * present, and registers the artifact with PXE. Publishing is required before exercising the public
926
+ * authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
927
+ * required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
928
+ * surface as generic "Assertion failed:" and tests that match on the real message fail).
916
929
  */
917
- export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
918
- const accountsAndAddresses = await Promise.all(
919
- accountsToDeploy.map(async address => {
920
- return {
921
- address,
922
- deployed: (await wallet.getContractMetadata(address)).isContractPublished,
923
- };
924
- }),
925
- );
926
- const instances = (
927
- await Promise.all(
928
- accountsAndAddresses
929
- .filter(({ deployed }) => !deployed)
930
- .map(({ address }) => wallet.getContractMetadata(address)),
931
- )
932
- ).map(contractMetadata => contractMetadata.instance);
933
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
934
- if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
935
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
936
- }
937
- const requests = instances.map(instance => publishInstance(wallet, instance!));
938
- const batch = new BatchCall(wallet, requests);
939
- await batch.send({ from: accountsToDeploy[0] });
930
+ export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
931
+ await testSpan('setup:auth-registry', async () => {
932
+ const { instance, contractClass } = await getStandardAuthRegistry();
933
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
934
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
935
+ }
936
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
937
+ await publishInstance(wallet, instance).send({ from });
938
+ }
939
+ await wallet.registerContract(instance, AuthRegistryArtifact);
940
+ });
940
941
  }
941
942
 
942
943
  /**
943
- * Helper function to deploy accounts.
944
- * Returns deployed account data that can be used by tests.
944
+ * Registers the public_checks contract class and publishes its standard instance if not already
945
+ * present, and registers the artifact with PXE. Required for any contract that calls
946
+ * `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
947
+ * deployed PublicChecks contract via an enqueued public call).
945
948
  */
946
- export const deployAccounts =
947
- (numberOfAccounts: number, logger: Logger) =>
948
- async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
949
- if (initialFundedAccounts.length < numberOfAccounts) {
950
- throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
951
- }
952
-
953
- logger.verbose('Deploying accounts funded with fee juice...');
954
- const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
955
- // Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
956
- for (let i = 0; i < deployedAccounts.length; i++) {
957
- const accountManager = await wallet.createSchnorrAccount(
958
- deployedAccounts[i].secret,
959
- deployedAccounts[i].salt,
960
- deployedAccounts[i].signingKey,
961
- );
962
- const deployMethod = await accountManager.getDeployMethod();
963
- await deployMethod.send({
964
- from: AztecAddress.ZERO,
965
- skipClassPublication: i !== 0, // Publish the contract class at most once.
966
- });
967
- }
968
-
969
- return { deployedAccounts };
970
- };
949
+ export async function ensurePublicChecksPublished(wallet: Wallet, from: AztecAddress) {
950
+ const { instance, contractClass } = await getStandardPublicChecks();
951
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
952
+ await (await publishContractClass(wallet, PublicChecksArtifact)).send({ from });
953
+ }
954
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
955
+ await publishInstance(wallet, instance).send({ from });
956
+ }
957
+ await wallet.registerContract(instance, PublicChecksArtifact);
958
+ }
971
959
 
972
960
  /**
973
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
974
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
961
+ * Registers the handshake_registry contract class and publishes its standard instance if not
962
+ * already present, and registers the artifact with PXE. Required for constrained-delivery flows
963
+ * that call into the HandshakeRegistry at its well-known address.
975
964
  */
976
- export async function publicDeployAccounts(
977
- wallet: Wallet,
978
- accountsToDeploy: AztecAddress[],
979
- waitUntilProven = false,
980
- node?: AztecNode,
981
- ) {
982
- const instances = (await Promise.all(accountsToDeploy.map(account => wallet.getContractMetadata(account)))).map(
983
- metadata => metadata.instance,
984
- );
985
-
986
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
987
- const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
988
-
989
- const calls: ContractFunctionInteraction[] = await Promise.all([
990
- ...(!alreadyRegistered ? [publishContractClass(wallet, SchnorrAccountContractArtifact)] : []),
991
- ...instances.map(instance => publishInstance(wallet, instance!)),
992
- ]);
993
-
994
- const batch = new BatchCall(wallet, calls);
995
-
996
- const txReceipt = await batch.send({ from: accountsToDeploy[0] });
997
- if (waitUntilProven) {
998
- if (!node) {
999
- throw new Error('Need to provide an AztecNode to wait for proven.');
1000
- } else {
1001
- await waitForProven(node, txReceipt);
1002
- }
965
+ export async function ensureHandshakeRegistryPublished(wallet: Wallet, from: AztecAddress) {
966
+ const { instance, contractClass } = await getStandardHandshakeRegistry();
967
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
968
+ await (await publishContractClass(wallet, HandshakeRegistryArtifact)).send({ from });
969
+ }
970
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
971
+ await publishInstance(wallet, instance).send({ from });
1003
972
  }
973
+ await wallet.registerContract(instance, HandshakeRegistryArtifact);
1004
974
  }
1005
975
 
1006
976
  /**