@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,12 +1,10 @@
1
- import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
1
  import { generateSchnorrAccounts } from '@aztec/accounts/testing';
3
- import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
4
- import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
5
- import { BatchCall, getContractClassFromArtifact, waitForProven } from '@aztec/aztec.js/contracts';
2
+ import { createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
3
+ import { EthAddress } from '@aztec/aztec.js/addresses';
6
4
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
7
5
  import { Fr } from '@aztec/aztec.js/fields';
8
6
  import { createLogger } from '@aztec/aztec.js/log';
9
- import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
7
+ import { CheatCodes } from '@aztec/aztec/testing';
10
8
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
11
9
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
12
10
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -14,25 +12,28 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
14
12
  import { NULL_KEY } from '@aztec/ethereum/constants';
15
13
  import { deployMulticall3 } from '@aztec/ethereum/contracts';
16
14
  import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
17
- import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
15
+ import { EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
18
16
  import { EpochNumber } from '@aztec/foundation/branded-types';
19
17
  import { SecretValue } from '@aztec/foundation/config';
20
18
  import { randomBytes } from '@aztec/foundation/crypto/random';
21
19
  import { tryRmDir } from '@aztec/foundation/fs';
22
20
  import { withLoggerBindings } from '@aztec/foundation/log/server';
23
21
  import { retryUntil } from '@aztec/foundation/retry';
24
- import { sleep } from '@aztec/foundation/sleep';
25
22
  import { TestDateProvider } from '@aztec/foundation/timer';
26
23
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
27
24
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
28
25
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
29
26
  import { protocolContractsHash } from '@aztec/protocol-contracts';
30
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';
31
32
  import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
32
33
  import { tryStop } from '@aztec/stdlib/interfaces/server';
33
34
  import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
34
35
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
35
- import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
36
+ import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
36
37
  import { getGenesisValues } from '@aztec/world-state/testing';
37
38
  import fs from 'fs/promises';
38
39
  import { tmpdir } from 'os';
@@ -44,6 +45,8 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
44
45
  import { getACVMConfig } from './get_acvm_config.js';
45
46
  import { getBBConfig } from './get_bb_config.js';
46
47
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
48
+ import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
49
+ import { testSpan } from './timing.js';
47
50
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
48
51
  export { startAnvil };
49
52
  let telemetry = undefined;
@@ -79,11 +82,13 @@ export const getPrivateKeyFromIndex = (index)=>{
79
82
  /**
80
83
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
81
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.
82
87
  * @param opts - Partial configuration for the PXE.
83
88
  * @param logger - The logger to be used.
84
89
  * @param actor - Actor label to include in log output (e.g., 'pxe-test').
85
90
  * @returns A test wallet, logger and teardown function.
86
- */ export async function setupPXEAndGetWallet(aztecNode, opts = {}, logger = getLogger(), actor) {
91
+ */ export async function setupPXEAndGetWallet(aztecNode, nodeDebug, opts = {}, logger = getLogger(), actor) {
87
92
  const PXEConfig = {
88
93
  ...getPXEConfig(),
89
94
  ...opts
@@ -97,7 +102,8 @@ export const getPrivateKeyFromIndex = (index)=>{
97
102
  }
98
103
  const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(PXEConfig.dataDirectory);
99
104
  const wallet = await TestWallet.create(aztecNode, PXEConfig, {
100
- loggerActorLabel: actor
105
+ loggerActorLabel: actor,
106
+ nodeDebug
101
107
  });
102
108
  return {
103
109
  wallet,
@@ -105,16 +111,56 @@ export const getPrivateKeyFromIndex = (index)=>{
105
111
  teardown
106
112
  };
107
113
  }
114
+ /**
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;
122
+ }
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.`);
131
+ }
132
+ }
108
133
  /**
109
134
  * Sets up the environment for the end-to-end tests.
110
135
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
111
136
  * @param opts - Options to pass to the node initialization and to the setup script.
112
137
  * @param pxeOpts - Options to pass to the PXE initialization.
113
- */ 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();
114
155
  let anvil;
115
156
  try {
116
157
  opts.aztecTargetCommitteeSize ??= 0;
117
- 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');
118
164
  const config = {
119
165
  ...getConfigEnvVars(),
120
166
  ...opts
@@ -125,13 +171,10 @@ export const getPrivateKeyFromIndex = (index)=>{
125
171
  config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
126
172
  // For tests we only want proving enabled if specifically requested
127
173
  config.realProofs = !!opts.realProofs;
128
- // Only enforce the time table if requested
129
- config.enforceTimeTable = !!opts.enforceTimeTable;
130
174
  // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
131
175
  config.enableDelayer = true;
132
176
  config.listenAddress = '127.0.0.1';
133
177
  config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
134
- const logger = getLogger();
135
178
  // Create a temp directory for any services that need it and cleanup later
136
179
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
137
180
  await fs.mkdir(directoryToCleanup, {
@@ -140,27 +183,30 @@ export const getPrivateKeyFromIndex = (index)=>{
140
183
  if (!config.dataDirectory) {
141
184
  config.dataDirectory = directoryToCleanup;
142
185
  }
186
+ const dateProvider = new TestDateProvider();
143
187
  if (!config.l1RpcUrls?.length) {
144
188
  if (!isAnvilTestChain(chain.id)) {
145
189
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
146
190
  }
147
- const res = await startAnvil({
148
- l1BlockTime: opts.ethereumSlotDuration,
149
- accounts: opts.anvilAccounts,
150
- port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined)
151
- });
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
+ }));
152
198
  anvil = res.anvil;
153
199
  config.l1RpcUrls = [
154
200
  res.rpcUrl
155
201
  ];
156
202
  }
203
+ logger.trace('Started anvil and L1 RPC client');
157
204
  // Enable logging metrics to a local file named after the test suite
158
205
  if (isMetricsLoggingRequested()) {
159
206
  const filename = path.join('log', getJobName() + '.jsonl');
160
207
  logger.info(`Logging metrics to ${filename}`);
161
208
  setupMetricsLogger(filename);
162
209
  }
163
- const dateProvider = new TestDateProvider();
164
210
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
165
211
  if (opts.stateLoad) {
166
212
  await ethCheatCodes.loadChainState(opts.stateLoad);
@@ -170,6 +216,7 @@ export const getPrivateKeyFromIndex = (index)=>{
170
216
  resetBlockInterval: true
171
217
  });
172
218
  }
219
+ logger.trace('Initialized L1 cheat codes and applied state/time overrides');
173
220
  let publisherPrivKeyHex = undefined;
174
221
  let publisherHdAccount = undefined;
175
222
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
@@ -194,21 +241,46 @@ export const getPrivateKeyFromIndex = (index)=>{
194
241
  if (config.coinbase === undefined) {
195
242
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
196
243
  }
197
- // Determine which addresses to fund in genesis
198
- const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10));
199
- 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);
200
254
  // Optionally fund the sponsored FPC
201
255
  if (opts.fundSponsoredFPC) {
202
256
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
203
257
  addressesToFund.push(sponsoredFPCAddress);
204
258
  }
205
- 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');
206
274
  const wasAutomining = await ethCheatCodes.isAutoMining();
207
275
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
208
276
  if (enableAutomine) {
209
277
  await ethCheatCodes.setAutomine(true);
210
278
  }
211
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
+ }
212
284
  // Deploy Multicall3 if running locally
213
285
  await deployMulticall3(l1Client, logger);
214
286
  // Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
@@ -216,72 +288,99 @@ export const getPrivateKeyFromIndex = (index)=>{
216
288
  await l1Client.getTransactionCount({
217
289
  address: l1Client.account.address
218
290
  });
219
- const deployL1ContractsValues = await deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
220
- ...getL1ContractsConfigEnvVars(),
221
- ...opts,
222
- ...opts.l1ContractsArgs,
223
- vkTreeRoot: getVKTreeRoot(),
224
- protocolContractsHash,
225
- genesisArchiveRoot,
226
- initialValidators: opts.initialValidators,
227
- feeJuicePortalInitialBalance: fundingNeeded,
228
- realVerifier: false
229
- });
230
- 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);
231
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
+ }
232
338
  if (enableAutomine) {
233
- await ethCheatCodes.setAutomine(false);
234
- await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
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);
235
346
  }
236
- // Always sync dateProvider to L1 time after deploying L1 contracts, regardless of mining mode.
237
- // In compose mode, L1 time may have drifted ahead of system time due to the local-network watcher
238
- // warping time forward on each filled slot. Without this sync, the sequencer computes the wrong
239
- // slot from its dateProvider and cannot propose blocks.
240
- dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
241
347
  if (opts.l2StartTime) {
242
348
  await ethCheatCodes.warp(opts.l2StartTime, {
243
349
  resetBlockInterval: true
244
350
  });
245
351
  }
246
- const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
247
- if (!opts.disableAnvilTestWatcher) {
248
- await watcher.start();
249
- }
250
- // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
251
- const telemetryClient = opts.metricsPort ? await getEndToEndTestTelemetryClient(opts.metricsPort) : await getTelemetryClient(opts.telemetryConfig);
252
- await setupSharedBlobStorage(config);
253
- logger.verbose('Creating and synching an aztec node', config);
254
- 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');
255
365
  if (acvmConfig) {
256
366
  config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
257
367
  config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
258
368
  }
259
- const bbConfig = await getBBConfig(logger);
369
+ logger.trace('Resolved ACVM config');
260
370
  if (bbConfig) {
261
371
  config.bbBinaryPath = bbConfig.bbBinaryPath;
262
372
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
263
373
  }
374
+ logger.trace('Resolved Barretenberg config');
375
+ logger.verbose('Creating and synching an aztec node', config);
264
376
  let mockGossipSubNetwork;
265
377
  let p2pClientDeps = undefined;
266
378
  if (opts.mockGossipSubNetwork) {
267
- mockGossipSubNetwork = new MockGossipSubNetwork();
379
+ mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
268
380
  p2pClientDeps = {
269
381
  p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
270
382
  };
271
383
  }
272
- // Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
273
- // To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
274
- // For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
275
- // If no accounts need deployment, we await an empty block to confirm network progression.
276
- const originalMinTxsPerBlock = config.minTxsPerBlock;
277
- if (originalMinTxsPerBlock === undefined) {
278
- throw new Error('minTxsPerBlock is undefined in e2e test setup');
279
- }
280
- // Only set minTxsPerBlock=1 if we're going to deploy accounts and need reliable block inclusion
281
- const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
282
- // Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
283
- const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
284
- config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
285
384
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
286
385
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
287
386
  if (!config.disableValidator) {
@@ -291,16 +390,30 @@ export const getPrivateKeyFromIndex = (index)=>{
291
390
  ]);
292
391
  }
293
392
  }
294
- const aztecNodeService = await withLoggerBindings({
295
- actor: 'node-0'
296
- }, ()=>AztecNodeService.createAndSync(config, {
297
- dateProvider,
298
- telemetry: telemetryClient,
299
- p2pClientDeps
300
- }, {
301
- prefilledPublicData
302
- }));
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
+ })));
303
415
  const sequencerClient = aztecNodeService.getSequencer();
416
+ logger.trace('Created and synced aztec node');
304
417
  let proverNode = undefined;
305
418
  if (opts.startProverNode) {
306
419
  logger.verbose('Creating and syncing a simulated prover node...');
@@ -313,16 +426,17 @@ export const getPrivateKeyFromIndex = (index)=>{
313
426
  aztecNodeService
314
427
  ]
315
428
  };
316
- ({ proverNode } = await createAndSyncProverNode(proverNodePrivateKeyHex, config, {
317
- ...config.proverNodeConfig,
318
- dataDirectory: proverNodeDataDirectory
319
- }, {
320
- dateProvider,
321
- p2pClientDeps,
322
- telemetry: telemetryClient
323
- }, {
324
- prefilledPublicData
325
- }));
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');
326
440
  }
327
441
  const sequencerDelayer = sequencerClient?.getDelayer();
328
442
  const proverDelayer = proverNode?.getProverNode()?.getDelayer();
@@ -334,65 +448,57 @@ export const getPrivateKeyFromIndex = (index)=>{
334
448
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
335
449
  // For tests we only want proving enabled if specifically requested
336
450
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
337
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
338
- loggerActorLabel: 'pxe-0'
339
- });
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
+ }));
340
457
  if (opts.walletMinFeePadding !== undefined) {
341
458
  wallet.setMinFeePadding(opts.walletMinFeePadding);
342
459
  }
460
+ logger.trace('Created PXE and test wallet');
343
461
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
462
+ logger.trace('Created cheat codes');
344
463
  if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
345
464
  // We need to advance such that the committee is set up.
346
465
  await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1)));
347
466
  await cheatCodes.rollup.setupEpoch();
348
467
  await cheatCodes.rollup.debugRollup();
468
+ logger.trace('Advanced chain to set up validator committee');
349
469
  }
350
470
  let accounts = [];
351
- if (shouldDeployAccounts) {
352
- logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`);
353
- const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
354
- const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
355
- accounts = accountManagers.map((accountManager)=>accountManager.address);
356
- } else if (needsEmptyBlock) {
357
- logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
358
- while(await aztecNodeService.getBlockNumber() === 0){
359
- await sleep(2000);
360
- }
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);
361
477
  }
362
- // If skipAccountDeployment is true, we don't deploy or wait - tests will handle account deployment later
363
- // Now we restore the original minTxsPerBlock setting if we changed it.
364
- if (sequencerClient && config.minTxsPerBlock !== originalMinTxsPerBlock) {
365
- sequencerClient.getSequencer().updateConfig({
366
- minTxsPerBlock: originalMinTxsPerBlock
367
- });
368
- }
369
- if (initialFundedAccounts.length < numberOfAccounts) {
370
- throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
371
- }
372
- const teardown = async ()=>{
373
- try {
374
- await tryStop(wallet, logger);
375
- await tryStop(aztecNodeService, logger);
376
- await tryStop(proverNode, logger);
377
- if (acvmConfig?.cleanup) {
378
- await acvmConfig.cleanup();
379
- }
380
- if (bbConfig?.cleanup) {
381
- await bbConfig.cleanup();
382
- }
383
- await tryStop(watcher, logger);
384
- await tryStop(anvil, logger);
385
- await tryRmDir(directoryToCleanup, logger);
386
- } catch (err) {
387
- logger.error(`Error during e2e test teardown`, err);
388
- } finally{
478
+ logger.trace('Created funded test accounts');
479
+ const teardown = ()=>testSpan('teardown:env', async ()=>{
389
480
  try {
390
- 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);
391
492
  } catch (err) {
392
- 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
+ }
393
500
  }
394
- }
395
- };
501
+ });
396
502
  return {
397
503
  anvil,
398
504
  aztecNode: aztecNodeService,
@@ -404,10 +510,11 @@ export const getPrivateKeyFromIndex = (index)=>{
404
510
  aztecNodeConfig: config,
405
511
  dateProvider,
406
512
  deployL1ContractsValues,
407
- initialFundedAccounts,
513
+ additionallyFundedAccounts,
408
514
  logger,
409
515
  mockGossipSubNetwork,
410
- prefilledPublicData,
516
+ genesis,
517
+ extraL1DeployResult,
411
518
  proverNode,
412
519
  sequencerDelayer,
413
520
  proverDelayer,
@@ -416,7 +523,6 @@ export const getPrivateKeyFromIndex = (index)=>{
416
523
  telemetryClient,
417
524
  wallet,
418
525
  accounts,
419
- watcher,
420
526
  acvmConfig,
421
527
  bbConfig,
422
528
  directoryToCleanup
@@ -467,9 +573,9 @@ export const getPrivateKeyFromIndex = (index)=>{
467
573
  */ export async function registerSponsoredFPC(wallet) {
468
574
  await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
469
575
  }
470
- export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 1) {
576
+ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 0.25) {
471
577
  targetBlock ??= await node.getBlockNumber();
472
- 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);
473
579
  }
474
580
  /**
475
581
  * Creates an AztecNodeService with the prover node enabled as a subsystem.
@@ -478,7 +584,7 @@ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, int
478
584
  return withLoggerBindings({
479
585
  actor: 'prover-0'
480
586
  }, async ()=>{
481
- const proverNode = await AztecNodeService.createAndSync({
587
+ const proverNode = await createAztecNodeService({
482
588
  ...baseConfig,
483
589
  ...configOverrides,
484
590
  p2pPort: 0,
@@ -488,7 +594,7 @@ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, int
488
594
  new SecretValue(proverNodePrivateKey)
489
595
  ]
490
596
  }, deps, {
491
- ...options,
597
+ genesis: options.genesis,
492
598
  dontStartProverNode: options.dontStart
493
599
  });
494
600
  if (!proverNode.getProverNode()) {
@@ -503,9 +609,9 @@ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, int
503
609
  export function getBalancesFn(symbol, method, logger) {
504
610
  const balances = async (...addressLikes)=>{
505
611
  const addresses = addressLikes.map((addressLike)=>'address' in addressLike ? addressLike.address : addressLike);
506
- const b = await Promise.all(addresses.map((address)=>method(address).simulate({
612
+ const b = await Promise.all(addresses.map(async (address)=>(await method(address).simulate({
507
613
  from: address
508
- })));
614
+ })).result));
509
615
  const debugString = `${symbol} balances: ${addresses.map((address, i)=>`${address}: ${b[i]}`).join(', ')}`;
510
616
  logger.verbose(debugString);
511
617
  return b;
@@ -524,74 +630,63 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
524
630
  expect(diffs).toEqual(expectedDiffs);
525
631
  }
526
632
  /**
527
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
528
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
529
- */ export async function ensureAccountContractsPublished(wallet, accountsToDeploy) {
530
- const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (address)=>{
531
- return {
532
- address,
533
- deployed: (await wallet.getContractMetadata(address)).isContractPublished
534
- };
535
- }));
536
- const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>wallet.getContractMetadata(address)))).map((contractMetadata)=>contractMetadata.instance);
537
- 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();
538
661
  if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
539
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({
540
- from: accountsToDeploy[0]
662
+ await (await publishContractClass(wallet, PublicChecksArtifact)).send({
663
+ from
541
664
  });
542
665
  }
543
- const requests = instances.map((instance)=>publishInstance(wallet, instance));
544
- const batch = new BatchCall(wallet, requests);
545
- await batch.send({
546
- from: accountsToDeploy[0]
547
- });
666
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
667
+ await publishInstance(wallet, instance).send({
668
+ from
669
+ });
670
+ }
671
+ await wallet.registerContract(instance, PublicChecksArtifact);
548
672
  }
549
673
  /**
550
- * Helper function to deploy accounts.
551
- * Returns deployed account data that can be used by tests.
552
- */ export const deployAccounts = (numberOfAccounts, logger)=>async ({ wallet, initialFundedAccounts })=>{
553
- if (initialFundedAccounts.length < numberOfAccounts) {
554
- throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
555
- }
556
- logger.verbose('Deploying accounts funded with fee juice...');
557
- const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
558
- // Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
559
- for(let i = 0; i < deployedAccounts.length; i++){
560
- const accountManager = await wallet.createSchnorrAccount(deployedAccounts[i].secret, deployedAccounts[i].salt, deployedAccounts[i].signingKey);
561
- const deployMethod = await accountManager.getDeployMethod();
562
- await deployMethod.send({
563
- from: AztecAddress.ZERO,
564
- skipClassPublication: i !== 0
565
- });
566
- }
567
- return {
568
- deployedAccounts
569
- };
570
- };
571
- /**
572
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
573
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
574
- */ export async function publicDeployAccounts(wallet, accountsToDeploy, waitUntilProven = false, node) {
575
- const instances = (await Promise.all(accountsToDeploy.map((account)=>wallet.getContractMetadata(account)))).map((metadata)=>metadata.instance);
576
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
577
- const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
578
- const calls = await Promise.all([
579
- ...!alreadyRegistered ? [
580
- publishContractClass(wallet, SchnorrAccountContractArtifact)
581
- ] : [],
582
- ...instances.map((instance)=>publishInstance(wallet, instance))
583
- ]);
584
- const batch = new BatchCall(wallet, calls);
585
- const txReceipt = await batch.send({
586
- from: accountsToDeploy[0]
587
- });
588
- if (waitUntilProven) {
589
- if (!node) {
590
- throw new Error('Need to provide an AztecNode to wait for proven.');
591
- } else {
592
- await waitForProven(node, txReceipt);
593
- }
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
+ });
594
688
  }
689
+ await wallet.registerContract(instance, HandshakeRegistryArtifact);
595
690
  }
596
691
  /**
597
692
  * Destroys the current context.