@aztec/end-to-end 0.0.1-commit.2ed92850 → 0.0.1-commit.3100065

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