@aztec/end-to-end 0.0.1-commit.96dac018d → 0.0.1-commit.9a89641

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