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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (404) hide show
  1. package/README.md +217 -14
  2. package/dest/automine/automine_test_context.d.ts +85 -0
  3. package/dest/automine/automine_test_context.d.ts.map +1 -0
  4. package/dest/automine/automine_test_context.js +98 -0
  5. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
  6. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  7. package/dest/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
  8. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
  9. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
  10. package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -0
  11. package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
  12. package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
  13. package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
  14. package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
  15. package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
  16. package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
  17. package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
  18. package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
  19. package/dest/automine/token/blacklist_token_contract_test.js +166 -0
  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/automine/token/token_contract_test.js +119 -0
  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 +17 -2
  27. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  28. package/dest/bench/client_flows/benchmark.js +40 -1
  29. package/dest/bench/client_flows/client_flows_benchmark.d.ts +19 -20
  30. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  31. package/dest/bench/client_flows/client_flows_benchmark.js +155 -159
  32. package/dest/bench/client_flows/config.d.ts +2 -2
  33. package/dest/bench/client_flows/config.d.ts.map +1 -1
  34. package/dest/bench/client_flows/config.js +18 -0
  35. package/dest/bench/client_flows/data_extractor.js +4 -1
  36. package/dest/bench/utils.d.ts +11 -10
  37. package/dest/bench/utils.d.ts.map +1 -1
  38. package/dest/bench/utils.js +126 -23
  39. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  40. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  41. package/dest/composed/ha/ha_full_setup.js +383 -0
  42. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  43. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  44. package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +1 -1
  45. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  46. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  47. package/dest/fixtures/authwit_proxy.js +34 -0
  48. package/dest/fixtures/e2e_prover_test.d.ts +25 -29
  49. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  50. package/dest/fixtures/e2e_prover_test.js +147 -151
  51. package/dest/fixtures/elu_monitor.d.ts +21 -0
  52. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  53. package/dest/fixtures/elu_monitor.js +102 -0
  54. package/dest/fixtures/fixtures.d.ts +84 -3
  55. package/dest/fixtures/fixtures.d.ts.map +1 -1
  56. package/dest/fixtures/fixtures.js +87 -2
  57. package/dest/fixtures/get_acvm_config.js +1 -1
  58. package/dest/fixtures/get_bb_config.d.ts +1 -1
  59. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  60. package/dest/fixtures/get_bb_config.js +5 -5
  61. package/dest/fixtures/ha_setup.d.ts +71 -0
  62. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  63. package/dest/fixtures/ha_setup.js +119 -0
  64. package/dest/fixtures/index.d.ts +3 -1
  65. package/dest/fixtures/index.d.ts.map +1 -1
  66. package/dest/fixtures/index.js +2 -0
  67. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  68. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  69. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  70. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  71. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  72. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  73. package/dest/fixtures/setup.d.ts +269 -0
  74. package/dest/fixtures/setup.d.ts.map +1 -0
  75. package/dest/fixtures/setup.js +688 -0
  76. package/dest/fixtures/setup_p2p_test.d.ts +22 -11
  77. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  78. package/dest/fixtures/setup_p2p_test.js +49 -38
  79. package/dest/fixtures/timing.d.ts +42 -0
  80. package/dest/fixtures/timing.d.ts.map +1 -0
  81. package/dest/fixtures/timing.js +72 -0
  82. package/dest/fixtures/token_utils.d.ts +22 -4
  83. package/dest/fixtures/token_utils.d.ts.map +1 -1
  84. package/dest/fixtures/token_utils.js +28 -7
  85. package/dest/fixtures/utils.d.ts +5 -638
  86. package/dest/fixtures/utils.d.ts.map +1 -1
  87. package/dest/fixtures/utils.js +4 -647
  88. package/dest/fixtures/wait_helpers.d.ts +135 -0
  89. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  90. package/dest/fixtures/wait_helpers.js +154 -0
  91. package/dest/fixtures/web3signer.js +1 -1
  92. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  93. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  94. package/dest/fixtures/with_telemetry_utils.js +2 -2
  95. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  96. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  97. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  98. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  99. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  100. package/dest/forward-compatibility/wallet_service.js +109 -0
  101. package/dest/install_legacy_contracts.d.cts +10 -0
  102. package/dest/install_legacy_contracts.d.cts.map +1 -0
  103. package/dest/legacy-jest-resolver.d.cts +3 -0
  104. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  105. package/dest/multi-node/block-production/setup.d.ts +97 -0
  106. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  107. package/dest/multi-node/block-production/setup.js +158 -0
  108. package/dest/multi-node/governance/setup.d.ts +67 -0
  109. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  110. package/dest/multi-node/governance/setup.js +126 -0
  111. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  112. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  113. package/dest/multi-node/multi_node_test_context.js +347 -0
  114. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  115. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  116. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  117. package/dest/multi-node/slashing/setup.d.ts +167 -0
  118. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  119. package/dest/multi-node/slashing/setup.js +275 -0
  120. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +33 -21
  121. package/dest/p2p/p2p_network.d.ts.map +1 -0
  122. package/dest/p2p/p2p_network.js +389 -0
  123. package/dest/p2p/reqresp/utils.d.ts +19 -0
  124. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  125. package/dest/p2p/reqresp/utils.js +193 -0
  126. package/dest/p2p/shared.d.ts +72 -0
  127. package/dest/p2p/shared.d.ts.map +1 -0
  128. package/dest/p2p/shared.js +212 -0
  129. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  130. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  131. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  132. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  133. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  134. package/dest/quality_of_service/prometheus_client.js +67 -0
  135. package/dest/shared/cross_chain_test_harness.d.ts +22 -9
  136. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  137. package/dest/shared/cross_chain_test_harness.js +45 -40
  138. package/dest/shared/gas_portal_test_harness.d.ts +19 -6
  139. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  140. package/dest/shared/gas_portal_test_harness.js +27 -15
  141. package/dest/shared/index.d.ts +3 -2
  142. package/dest/shared/index.d.ts.map +1 -1
  143. package/dest/shared/index.js +1 -0
  144. package/dest/shared/jest_setup.js +41 -1
  145. package/dest/shared/mock_state_view.d.ts +86 -0
  146. package/dest/shared/mock_state_view.d.ts.map +1 -0
  147. package/dest/shared/mock_state_view.js +186 -0
  148. package/dest/shared/submit-transactions.d.ts +4 -4
  149. package/dest/shared/submit-transactions.d.ts.map +1 -1
  150. package/dest/shared/submit-transactions.js +19 -14
  151. package/dest/shared/timing_env.d.js +5 -0
  152. package/dest/shared/timing_env.js +365 -0
  153. package/dest/shared/uniswap_l1_l2.d.ts +3 -27
  154. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  155. package/dest/shared/uniswap_l1_l2.js +86 -54
  156. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  157. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  158. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  159. package/dest/simulators/lending_simulator.d.ts +15 -4
  160. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  161. package/dest/simulators/lending_simulator.js +29 -17
  162. package/dest/simulators/token_simulator.d.ts +1 -1
  163. package/dest/simulators/token_simulator.d.ts.map +1 -1
  164. package/dest/simulators/token_simulator.js +3 -24
  165. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  166. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  167. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  168. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  169. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  170. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  171. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  172. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  173. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +21 -10
  174. package/dest/single-node/fees/fees_test.d.ts +93 -0
  175. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  176. package/dest/single-node/fees/fees_test.js +274 -0
  177. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  178. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  179. package/dest/single-node/l1-reorgs/setup.js +57 -0
  180. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  181. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  182. package/dest/single-node/partial-proofs/setup.js +5 -0
  183. package/dest/single-node/proving/setup.d.ts +5 -0
  184. package/dest/single-node/proving/setup.d.ts.map +1 -0
  185. package/dest/single-node/proving/setup.js +5 -0
  186. package/dest/single-node/recovery/setup.d.ts +5 -0
  187. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  188. package/dest/single-node/recovery/setup.js +5 -0
  189. package/dest/single-node/setup.d.ts +49 -0
  190. package/dest/single-node/setup.d.ts.map +1 -0
  191. package/dest/single-node/setup.js +56 -0
  192. package/dest/single-node/single_node_test_context.d.ts +360 -0
  193. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  194. package/dest/single-node/single_node_test_context.js +833 -0
  195. package/dest/spartan/setup_test_wallets.d.ts +15 -5
  196. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  197. package/dest/spartan/setup_test_wallets.js +155 -50
  198. package/dest/spartan/tx_metrics.d.ts +111 -0
  199. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  200. package/dest/spartan/tx_metrics.js +507 -0
  201. package/dest/spartan/utils/bot.d.ts +28 -0
  202. package/dest/spartan/utils/bot.d.ts.map +1 -0
  203. package/dest/spartan/utils/bot.js +142 -0
  204. package/dest/spartan/utils/chaos.d.ts +79 -0
  205. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  206. package/dest/spartan/utils/chaos.js +142 -0
  207. package/dest/spartan/utils/clients.d.ts +39 -0
  208. package/dest/spartan/utils/clients.d.ts.map +1 -0
  209. package/dest/spartan/utils/clients.js +90 -0
  210. package/dest/spartan/utils/config.d.ts +19 -0
  211. package/dest/spartan/utils/config.d.ts.map +1 -0
  212. package/dest/spartan/utils/config.js +23 -0
  213. package/dest/spartan/utils/health.d.ts +63 -0
  214. package/dest/spartan/utils/health.d.ts.map +1 -0
  215. package/dest/spartan/utils/health.js +202 -0
  216. package/dest/spartan/utils/helm.d.ts +15 -0
  217. package/dest/spartan/utils/helm.d.ts.map +1 -0
  218. package/dest/spartan/utils/helm.js +47 -0
  219. package/dest/spartan/utils/index.d.ts +11 -0
  220. package/dest/spartan/utils/index.d.ts.map +1 -0
  221. package/dest/spartan/utils/index.js +22 -0
  222. package/dest/spartan/utils/k8s.d.ts +128 -0
  223. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  224. package/dest/spartan/utils/k8s.js +381 -0
  225. package/dest/spartan/utils/nodes.d.ts +40 -0
  226. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  227. package/dest/spartan/utils/nodes.js +461 -0
  228. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  229. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  230. package/dest/spartan/utils/pod_logs.js +74 -0
  231. package/dest/spartan/utils/scripts.d.ts +30 -0
  232. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  233. package/dest/spartan/utils/scripts.js +81 -0
  234. package/dest/spartan/utils.d.ts +2 -221
  235. package/dest/spartan/utils.d.ts.map +1 -1
  236. package/dest/spartan/utils.js +1 -782
  237. package/dest/test-wallet/test_wallet.d.ts +105 -0
  238. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  239. package/dest/test-wallet/test_wallet.js +320 -0
  240. package/dest/test-wallet/utils.d.ts +76 -0
  241. package/dest/test-wallet/utils.d.ts.map +1 -0
  242. package/dest/test-wallet/utils.js +126 -0
  243. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  244. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  245. package/dest/test-wallet/wallet_worker_script.js +56 -0
  246. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  247. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  248. package/dest/test-wallet/worker_wallet.js +157 -0
  249. package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
  250. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  251. package/dest/test-wallet/worker_wallet_schema.js +23 -0
  252. package/package.json +54 -46
  253. package/src/automine/README.md +60 -0
  254. package/src/automine/automine_test_context.ts +153 -0
  255. package/src/automine/contracts/fixtures/storage_proof.json +915 -0
  256. package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
  257. package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
  258. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  259. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  260. package/src/automine/token/blacklist_token_contract_test.ts +208 -0
  261. package/src/automine/token/token_contract_test.ts +146 -0
  262. package/src/automine/token/token_test_helpers.ts +138 -0
  263. package/src/bench/client_flows/benchmark.ts +45 -2
  264. package/src/bench/client_flows/client_flows_benchmark.ts +222 -251
  265. package/src/bench/client_flows/config.ts +9 -1
  266. package/src/bench/client_flows/data_extractor.ts +2 -1
  267. package/src/bench/utils.ts +144 -25
  268. package/src/composed/ha/ha_full_setup.ts +466 -0
  269. package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +1 -1
  270. package/src/fixtures/authwit_proxy.ts +54 -0
  271. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  272. package/src/fixtures/e2e_prover_test.ts +172 -205
  273. package/src/fixtures/elu_monitor.ts +126 -0
  274. package/src/fixtures/fixtures.ts +111 -3
  275. package/src/fixtures/get_acvm_config.ts +1 -1
  276. package/src/fixtures/get_bb_config.ts +7 -6
  277. package/src/fixtures/ha_setup.ts +192 -0
  278. package/src/fixtures/index.ts +2 -0
  279. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  280. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  281. package/src/fixtures/setup.ts +987 -0
  282. package/src/fixtures/setup_p2p_test.ts +57 -57
  283. package/src/fixtures/timing.ts +97 -0
  284. package/src/fixtures/token_utils.ts +46 -10
  285. package/src/fixtures/utils.ts +26 -966
  286. package/src/fixtures/wait_helpers.ts +333 -0
  287. package/src/fixtures/web3signer.ts +1 -1
  288. package/src/fixtures/with_telemetry_utils.ts +2 -2
  289. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  290. package/src/forward-compatibility/wallet_service.ts +106 -0
  291. package/src/guides/up_quick_start.sh +7 -4
  292. package/src/infra/README.md +12 -0
  293. package/src/install_legacy_contracts.cjs +75 -0
  294. package/src/legacy-jest-resolver.cjs +112 -0
  295. package/src/multi-node/README.md +95 -0
  296. package/src/multi-node/block-production/setup.ts +272 -0
  297. package/src/multi-node/governance/setup.ts +172 -0
  298. package/src/multi-node/multi_node_test_context.ts +447 -0
  299. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  300. package/src/multi-node/slashing/setup.ts +433 -0
  301. package/src/p2p/README.md +78 -0
  302. package/src/p2p/p2p_network.ts +542 -0
  303. package/src/p2p/reqresp/utils.ts +263 -0
  304. package/src/p2p/shared.ts +329 -0
  305. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
  306. package/src/quality_of_service/prometheus_client.ts +113 -0
  307. package/src/shared/cross_chain_test_harness.ts +51 -44
  308. package/src/shared/gas_portal_test_harness.ts +35 -17
  309. package/src/shared/index.ts +2 -1
  310. package/src/shared/jest_setup.ts +51 -1
  311. package/src/shared/mock_state_view.ts +188 -0
  312. package/src/shared/submit-transactions.ts +22 -19
  313. package/src/shared/timing_env.d.mts +39 -0
  314. package/src/shared/timing_env.mjs +363 -0
  315. package/src/shared/uniswap_l1_l2.ts +136 -115
  316. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  317. package/src/simulators/lending_simulator.ts +36 -18
  318. package/src/simulators/token_simulator.ts +6 -30
  319. package/src/single-node/README.md +60 -0
  320. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  321. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  322. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +23 -15
  323. package/src/single-node/fees/fees_test.ts +368 -0
  324. package/src/single-node/l1-reorgs/setup.ts +93 -0
  325. package/src/single-node/partial-proofs/setup.ts +8 -0
  326. package/src/single-node/proving/setup.ts +15 -0
  327. package/src/single-node/recovery/setup.ts +8 -0
  328. package/src/single-node/setup.ts +63 -0
  329. package/src/single-node/single_node_test_context.ts +1041 -0
  330. package/src/spartan/setup_test_wallets.ts +217 -36
  331. package/src/spartan/tx_metrics.ts +460 -0
  332. package/src/spartan/utils/bot.ts +188 -0
  333. package/src/spartan/utils/chaos.ts +253 -0
  334. package/src/spartan/utils/clients.ts +100 -0
  335. package/src/spartan/utils/config.ts +29 -0
  336. package/src/spartan/utils/health.ts +255 -0
  337. package/src/spartan/utils/helm.ts +84 -0
  338. package/src/spartan/utils/index.ts +71 -0
  339. package/src/spartan/utils/k8s.ts +535 -0
  340. package/src/spartan/utils/nodes.ts +543 -0
  341. package/src/spartan/utils/pod_logs.ts +99 -0
  342. package/src/spartan/utils/scripts.ts +99 -0
  343. package/src/spartan/utils.ts +1 -983
  344. package/src/test-wallet/test_wallet.ts +426 -0
  345. package/src/test-wallet/utils.ts +205 -0
  346. package/src/test-wallet/wallet_worker_script.ts +66 -0
  347. package/src/test-wallet/worker_wallet.ts +216 -0
  348. package/src/test-wallet/worker_wallet_schema.ts +14 -0
  349. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -54
  350. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  351. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +0 -185
  352. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -41
  353. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  354. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -108
  355. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
  356. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  357. package/dest/e2e_deploy_contract/deploy_test.js +0 -45
  358. package/dest/e2e_epochs/epochs_test.d.ts +0 -93
  359. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  360. package/dest/e2e_epochs/epochs_test.js +0 -337
  361. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  362. package/dest/e2e_fees/fees_test.d.ts +0 -85
  363. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  364. package/dest/e2e_fees/fees_test.js +0 -263
  365. package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
  366. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  367. package/dest/e2e_l1_publisher/write_json.js +0 -58
  368. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  369. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  370. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -29
  371. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  372. package/dest/e2e_nested_contract/nested_contract_test.js +0 -64
  373. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  374. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  375. package/dest/e2e_p2p/inactivity_slash_test.js +0 -139
  376. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  377. package/dest/e2e_p2p/p2p_network.js +0 -320
  378. package/dest/e2e_p2p/shared.d.ts +0 -46
  379. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  380. package/dest/e2e_p2p/shared.js +0 -184
  381. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -35
  382. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  383. package/dest/e2e_token_contract/token_contract_test.js +0 -126
  384. package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
  385. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  386. package/dest/fixtures/setup_l1_contracts.js +0 -17
  387. package/dest/fixtures/snapshot_manager.d.ts +0 -95
  388. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  389. package/dest/fixtures/snapshot_manager.js +0 -505
  390. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  391. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  392. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +0 -256
  393. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -179
  394. package/src/e2e_deploy_contract/deploy_test.ts +0 -78
  395. package/src/e2e_epochs/epochs_test.ts +0 -438
  396. package/src/e2e_fees/fees_test.ts +0 -382
  397. package/src/e2e_l1_publisher/write_json.ts +0 -77
  398. package/src/e2e_nested_contract/nested_contract_test.ts +0 -96
  399. package/src/e2e_p2p/inactivity_slash_test.ts +0 -182
  400. package/src/e2e_p2p/p2p_network.ts +0 -476
  401. package/src/e2e_p2p/shared.ts +0 -285
  402. package/src/e2e_token_contract/token_contract_test.ts +0 -167
  403. package/src/fixtures/setup_l1_contracts.ts +0 -26
  404. package/src/fixtures/snapshot_manager.ts +0 -665
@@ -0,0 +1,112 @@
1
+ // Custom Jest resolver. When CONTRACT_ARTIFACTS_VERSION is set, redirects *only* JSON artifact files under
2
+ // @aztec/noir-contracts.js/artifacts/, @aztec/noir-test-contracts.js/artifacts/, and @aztec/accounts/artifacts/ to a local cache of the pinned
3
+ // legacy versions. TypeScript wrapper classes (e.g. Token.ts) continue to load from the current workspace and use the
4
+ // current @aztec/aztec.js — only the artifact JSON (the deployed-contract ABI / bytecode / notes surface) is swapped.
5
+ //
6
+ // Why JSON-only: the JSON artifact is the actual interchange surface a "deployed contract" exposes. The TS wrapper is
7
+ // generated client-side ergonomics that's tightly coupled to the current @aztec/aztec.js API. Redirecting the wrapper
8
+ // would couple this test to a moving aztec.js surface and break at import time on unrelated breaking changes; we want
9
+ // to fail only on actual artifact-compat regressions.
10
+ //
11
+ // Cache population lives in install_legacy_contracts.cjs — invoked lazily here for local dev, and eagerly
12
+ // by bootstrap.sh ci-compat-e2e before hermetic test containers (which run with --net=none) launch.
13
+ //
14
+ // Missing artifacts: legacy version directories are immutable, so an artifact missing from the cache means the
15
+ // contract was added after the pinned release — there's nothing to compat-test. Rather than failing or silently
16
+ // falling back to the workspace artifact (which would turn the compat run into a regular e2e run that always
17
+ // passes), we log the miss and exit the process cleanly with code 0. The test never runs, but the per-test CI
18
+ // log captures the explanatory line so the reason is auditable. This keeps the change scoped to this resolver,
19
+ // avoiding a new exit-code contract in the shared ci3 test runner.
20
+ //
21
+ // Activated by env var; passthrough otherwise.
22
+ /* eslint-disable @typescript-eslint/no-require-imports */
23
+
24
+ const path = require('path');
25
+ const fs = require('fs');
26
+ const { installLegacyContracts, REDIRECTED, cacheRoot } = require('./install_legacy_contracts.cjs');
27
+
28
+ const version = process.env.CONTRACT_ARTIFACTS_VERSION;
29
+ const cacheDir = version ? cacheRoot(version) : null;
30
+
31
+ function pkgJsonPath(name) {
32
+ return path.join(cacheDir, 'node_modules', name, 'package.json');
33
+ }
34
+
35
+ // Kept in a separate module (not inlined) because bootstrap.sh ci-compat-e2e also calls it directly
36
+ // via `node .../install_legacy_contracts.cjs <version>` to pre-populate the cache on the host before
37
+ // hermetic --net=none test containers launch. Inlining here would force us to duplicate the logic
38
+ // in bash or re-run jest just to trigger the install.
39
+ if (version) {
40
+ installLegacyContracts(version);
41
+ }
42
+
43
+ let bannerPrinted = false;
44
+ const seen = new Set();
45
+
46
+ function printBannerOnce() {
47
+ if (bannerPrinted || !version) {
48
+ return;
49
+ }
50
+ bannerPrinted = true;
51
+ const lines = ['='.repeat(60), `[legacy-contracts][jest] CONTRACT_ARTIFACTS_VERSION=${version}`];
52
+ for (const p of REDIRECTED) {
53
+ const v = JSON.parse(fs.readFileSync(pkgJsonPath(p), 'utf8')).version;
54
+ if (v !== version) {
55
+ throw new Error(`[legacy-contracts] ${p} on disk is ${v}, expected ${version}`);
56
+ }
57
+ lines.push(`[legacy-contracts][jest] redirecting ${p}/artifacts/*.json -> .legacy-contracts/${version}/...`);
58
+ }
59
+ lines.push('='.repeat(60));
60
+ process.stderr.write(lines.join('\n') + '\n');
61
+ }
62
+
63
+ // Match a resolved absolute path against the workspace artifacts dirs and return the legacy cache equivalent, or null
64
+ // if it's not an artifact path we should redirect.
65
+ function legacyArtifactPath(resolved) {
66
+ if (!resolved.endsWith('.json')) {
67
+ return null;
68
+ }
69
+ for (const pkg of REDIRECTED) {
70
+ // pkg = '@aztec/noir-contracts.js' -> match '/noir-contracts.js/artifacts/'
71
+ const dirName = pkg.split('/')[1];
72
+ const marker = `/${dirName}/artifacts/`;
73
+ const idx = resolved.indexOf(marker);
74
+ if (idx === -1) {
75
+ continue;
76
+ }
77
+ const basename = resolved.slice(idx + marker.length);
78
+ return path.join(cacheDir, 'node_modules', pkg, 'artifacts', basename);
79
+ }
80
+ return null;
81
+ }
82
+
83
+ module.exports = function legacyResolver(request, options) {
84
+ // Always run the default resolver first. We only inspect (and possibly rewrite) the *result*; this catches both
85
+ // bare-specifier imports of `@aztec/noir-contracts.js/artifacts/foo.json` and the relative `../artifacts/foo.json`
86
+ // imports inside the workspace TS wrapper classes — both resolve to the same workspace artifact path that we then
87
+ // redirect.
88
+ const resolved = options.defaultResolver(request, options);
89
+ if (!version) {
90
+ return resolved;
91
+ }
92
+ printBannerOnce();
93
+ const legacy = legacyArtifactPath(resolved);
94
+ if (!legacy) {
95
+ return resolved;
96
+ }
97
+ if (!fs.existsSync(legacy)) {
98
+ // Contract was added after this historical release, there is nothing to compat-test for it. Exit the process
99
+ // cleanly with code 0 so the test runner reports the run as passed.
100
+ fs.writeSync(
101
+ 2,
102
+ `[legacy-contracts][jest] artifact ${path.basename(legacy)} not in legacy cache @${version}; ` +
103
+ `assumed added after this release. No compat coverage applicable for this version, treating as passed.\n`,
104
+ );
105
+ process.exit(0);
106
+ }
107
+ if (!seen.has(resolved)) {
108
+ seen.add(resolved);
109
+ process.stderr.write(`[legacy-contracts][jest] redirected ${path.basename(legacy)} -> ${legacy}\n`);
110
+ }
111
+ return legacy;
112
+ };
@@ -0,0 +1,95 @@
1
+ # `multi-node` e2e test category
2
+
3
+ Multi-node tests run N validator nodes sharing an in-memory `MockGossipSubNetwork` bus (no real
4
+ libp2p). This is the category for any multi-node test whose subject — proposals, attestations,
5
+ checkpointing, pruning/recovery, offense detection — is faithfully reproduced by the mock-gossip bus.
6
+ Tests that need *real networking* (peer discovery / discv5, the req/resp protocol, gossip mesh
7
+ formation, peer auth/scoring, transport behavior) belong in the `p2p` category instead.
8
+
9
+ ## Base class
10
+
11
+ `MultiNodeTestContext` (`multi_node_test_context.ts`) extends `SingleNodeTestContext` (in
12
+ `../single-node/`) with the N-validator topology:
13
+
14
+ - `createValidatorNode` / `createValidatorNodeAt(index)` spawn nodes on the mock-gossip bus; passing
15
+ the same index to two calls (with different coinbases) models an equivocating proposer that shares
16
+ a key across two nodes. Validators with no spawned node stay registered-but-offline.
17
+ - The per-validator registration accessors (`validatorAt` / `addressAt` / `privateKeyAt`) for the
18
+ validators registered at genesis via `initialValidators`.
19
+ - `getSlashingContracts()` for the rollup / slasher / slashing-proposer L1 contracts.
20
+ - The committee convergence helpers `waitForAllNodes*` and `findSlotsWithProposers`.
21
+
22
+ The environment (in-process anvil + L1 deploy), the prover lifecycle, and the proving / reorg waiters
23
+ all live on the parent and are inherited.
24
+
25
+ ## Shared presets and helpers
26
+
27
+ These are exported from `multi_node_test_context.ts` and spread into a `setup(...)` call rather than
28
+ copy-pasted:
29
+
30
+ - `buildMockGossipValidators(n)` — the deterministic validator set (keys from
31
+ `getPrivateKeyFromIndex(i + 3)`), passed as `initialValidators`.
32
+ - `MOCK_GOSSIP_MULTI_VALIDATOR_OPTS` — a tight committee on the mock bus with no prover
33
+ (`{ mockGossipSubNetwork, skipInitialSequencer, startProverNode: false, aztecProofSubmissionEpochs:
34
+ 1024, numberOfAccounts: 0 }`). Tests that want a prover leave `startProverNode` explicit.
35
+ - `SLASHER_ENABLED_MULTI_VALIDATOR_OPTS` — the same committee with the slasher turned on, used by the
36
+ offense-detection tests.
37
+ - `defaultSlashingPenalties(unit?)` / `withOnlyOffense(offense, unit?)` — build the per-offense
38
+ `slash*Penalty` knobs; `withOnlyOffense` zeroes all but the named offense to isolate one offense.
39
+ - `setupHaPairs(test, validators, { baseOpts, coinbases })` — stands up two HA pairs (nodes 0/1 share
40
+ keys pk1+pk2, nodes 2/3 share pk3+pk4), each pair on a shared slashing-protection DB with distinct
41
+ per-node coinbases. Used by the `high-availability/` tests.
42
+
43
+ ## Organizing principle
44
+
45
+ The top level groups tests by node topology and setup model; the second level names the primary
46
+ behavior under test, not the shared setup or a flag. Multiple-blocks-per-slot and proposer pipelining
47
+ are default traits of block production here, not separate categories. Each file has a single top-level
48
+ `describe` named to match its path, and a co-located `setup.ts` holds shared setup. A `.parallel`
49
+ suffix marks files with more than one top-level `it`; CI splits each `it` into its own job.
50
+
51
+ ## Subfolders
52
+
53
+ | Folder | Base / preset | Contents |
54
+ |---|---|---|
55
+ | `block-production/` | `MultiNodeTestContext` + wide-slot / block-production timing (`setup.ts`) | Happy-path committee block production with multiple blocks per slot and pipelining as the default cadence: `simple`, `high_tps`, `first_slot` (blocks on the first two slots of an epoch), `deploy_and_call_ordering` (a contract deployed and called in separate blocks of one slot), `cross_chain_messages.parallel` (multi-block slots carrying L2→L1 and L1→L2 messages), `proposed_chain.parallel` (txs anchored to proposed blocks; non-validators re-execute and sync multi-block slots), `proof_boundary.parallel` (the proof-submission deadline vs. the pipelining boundary slot, across five proof-landing scenarios), `redistribution.parallel` (checkpoint budget redistributed so a late tx burst fits across the last blocks), `blob_promotion` (a promotion-disabled node fetches blobs while peers skip them, and a high-block-count checkpoint still proves), `multi_validator_node.parallel` (one physical node hosting 5 validator keys builds blocks and collects quorum attestations; after withdrawing 2 validators, signing is filtered to the active committee only). |
56
+ | `recovery/` | `MultiNodeTestContext` + wide-slot / block-production timing | The chain detects a bad/withheld/conflicting proposal and recovers: `proposal_failure_recovery.parallel` (all nodes prune and recover when a proposer fails to publish to L1), `pipeline_prune` (an uncheckpointed-blocks prune under pipelined MBPS, then recovery to a multi-block checkpoint), `equivocation_recovery` (an L1-confirmed checkpoint overrides a gossip-only equivocating proposal, the chain heals, and observers record the offense). |
57
+ | `invalid-attestations/` | `MultiNodeTestContext` (slasher on) | Invalid checkpoints are detected, invalidated on L1, and the chain progresses: `invalidate_block.parallel`, a six-validator suite injecting insufficient/fake/high-s/unrecoverable/shuffled attestations and withheld blobs. |
58
+ | `high-availability/` | `MultiNodeTestContext` + `setupHaPairs` | HA-pair sync and handoff between nodes that share validator keys: `ha_sync` (a peer that did not build a block syncs to the proposed chain tip over P2P), `ha_checkpoint_handoff` (a peer records and takes over a pipelined checkpoint when its partner proposes the previous slot). |
59
+ | `slashing/` | `MultiNodeTestContext` + `SLASHER_ENABLED_MULTI_VALIDATOR_OPTS` (`setup.ts`) | Offense detection and the sentinel that drives it. Equivocation — both duplicate-proposal and duplicate-attestation — (`equivocation_offenses`), broadcast of an invalid block or checkpoint proposal (`broadcasted_invalid_block_proposal_slash`, `broadcasted_invalid_checkpoint_proposal_slash.parallel`), attesting to an invalid checkpoint (`attested_invalid_proposal.parallel`), data withholding (`data_withholding_slash`), inactivity (`inactivity_slash`, `inactivity_slash_with_consecutive_epochs`, sharing the `InactivityTest` fixture in `inactivity_setup.ts`), the slasher veto path (`slash_veto_demo`), and sentinel observability (`validators_sentinel.parallel`, `multiple_validators_sentinel.parallel`, `sentinel_status_slash.parallel`). `setup.ts` holds the two timing profiles (`baseSlashingOpts`, `SENTINEL_TIMING`), the shared offense lookup (`findSlashOffense`), and the slashing waiters (`awaitCommitteeExists`, `awaitOffenseDetected`, `advanceToEpochBeforeProposer`, `findUpcomingProposerSlot`, `awaitCommitteeKicked`, `awaitProposalExecution`). |
60
+ | `governance/` | `MultiNodeTestContext` + `MOCK_GOSSIP_MULTI_VALIDATOR_OPTS` + `GOVERNANCE_TIMING` (`setup.ts`) | A validator committee drives an L1 governance upgrade. `upgrade_governance_proposer` (the committee signals a new governance-proposer payload, reaches quorum, and the proposal executes) and `add_rollup` (a new rollup version is registered and the nodes migrate to it, exercising L1↔L2 bridging on both rollups). |
61
+
62
+ ## Helper surface
63
+
64
+ Prefer these named waiters over hand-rolled `retryUntil` / raw `.on` / `sleep` polling in test bodies.
65
+
66
+ On `SingleNodeTestContext` (inherited):
67
+
68
+ - `waitUntilEpochStarts(epoch)` / `waitUntilNextEpochStarts()` — epoch-boundary waiters.
69
+ - `waitUntilCheckpointNumber(n)` / `waitUntilProvenCheckpointNumber(n)` — checkpoint waiters.
70
+ - `waitUntilLastSlotOfProofSubmissionWindow(epoch)` — proof-window timing.
71
+ - `waitForNodeToSync(blockNumber, type)` — single-node sync wait.
72
+ - `watchSequencerEvents(sequencers, …)` accumulates state-changes and fail-events across sequencers;
73
+ `assertNoFailuresFromSequencers(failEvents)` asserts none fired.
74
+ - `waitForSequencerEvent(sequencer, event, match?, opts)` — one-shot wait for a matching event, with
75
+ timeout and listener cleanup.
76
+ - `assertMultipleBlocksPerSlot(n)` — asserts some checkpoint has at least `n` blocks (MBPS).
77
+
78
+ Added by `MultiNodeTestContext`:
79
+
80
+ - `waitForAllNodes(predicate, opts)` and the conveniences
81
+ `waitForAllNodesToReachProvenCheckpoint(target, opts)` and
82
+ `waitForAllNodesToReachBlockAtSlot(slot, tag, match?, opts)` — multi-node convergence.
83
+ - `findSlotsWithProposers(count, predicate, opts)` — finds N consecutive slots whose proposers
84
+ satisfy `predicate`, warping the L1 clock forward and retrying on `EpochNotStable`.
85
+
86
+ On `ChainMonitor` (`@aztec/ethereum/test`):
87
+
88
+ - `waitUntilCheckpoint(n)` / `waitUntilCheckpointProven(n)`, `waitUntilL2Slot(slot)`,
89
+ `waitUntilL1Block` / `waitUntilL1Timestamp`.
90
+
91
+ Node-only / wallet-only waits (no context dependency) live in `../fixtures/wait_helpers.ts`:
92
+
93
+ - `waitForBlockNumber(node, target, { tag })` / `waitForProvenBlock(node, target)`.
94
+ - `waitForNodeCheckpoint(node, target, opts)` / `waitForNodeProvenCheckpoint(node, target)`.
95
+ - `waitForTxs(node, txHashes, opts)` — the plural form of `waitForTx`.
@@ -0,0 +1,272 @@
1
+ import type { Archiver } from '@aztec/archiver';
2
+ import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
3
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
+ import { NO_WAIT } from '@aztec/aztec.js/contracts';
5
+ import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
6
+ import { Fr } from '@aztec/aztec.js/fields';
7
+ import type { Logger } from '@aztec/aztec.js/log';
8
+ import { isL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
9
+ import { waitForTx } from '@aztec/aztec.js/node';
10
+ import { RollupContract } from '@aztec/ethereum/contracts';
11
+ import { waitUntilL1Timestamp } from '@aztec/ethereum/l1-tx-utils';
12
+ import { asyncMap } from '@aztec/foundation/async-map';
13
+ import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
14
+ import { timesAsync } from '@aztec/foundation/collection';
15
+ import { retryUntil } from '@aztec/foundation/retry';
16
+ import { sleep } from '@aztec/foundation/sleep';
17
+ import { executeTimeout } from '@aztec/foundation/timer';
18
+ import { TestContract } from '@aztec/noir-test-contracts.js/Test';
19
+ import type { SequencerEvents } from '@aztec/sequencer-client';
20
+ import { getSlotAtTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
21
+ import { GasFees } from '@aztec/stdlib/gas';
22
+ import { TxStatus } from '@aztec/stdlib/tx';
23
+
24
+ import { jest } from '@jest/globals';
25
+
26
+ import { sendL1ToL2Message } from '../../fixtures/l1_to_l2_messaging.js';
27
+ import { testSpan } from '../../fixtures/timing.js';
28
+ import type { EndToEndContext } from '../../fixtures/utils.js';
29
+ import { waitForBlockNumber, waitForTxs } from '../../fixtures/wait_helpers.js';
30
+ import type { TestWallet } from '../../test-wallet/test_wallet.js';
31
+ import { proveInteraction } from '../../test-wallet/utils.js';
32
+ import {
33
+ type BlockProposedEvent,
34
+ MOCK_GOSSIP_MULTI_VALIDATOR_OPTS,
35
+ MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING,
36
+ MultiNodeTestContext,
37
+ type MultiNodeTestOpts,
38
+ type RegisteredValidator,
39
+ type TrackedSequencerEvent,
40
+ WIDE_SLOT_TIMING,
41
+ buildMockGossipValidators,
42
+ } from '../multi_node_test_context.js';
43
+
44
+ jest.setTimeout(1000 * 60 * 20);
45
+
46
+ export const NODE_COUNT = 4;
47
+
48
+ // Send enough transactions to trigger multiple blocks within a checkpoint assuming 2 txs per block.
49
+ // If we start including txs at the 2nd block of a checkpoint, we can ensure a 3-block checkpoint
50
+ // if we produce 10 txs:
51
+ // - Checkpoint 1: Block 1 (0 txs), Block 2 (2 txs), Block 3 (2 txs)
52
+ // - Checkpoint 2: Block 1 (2 txs), Block 2 (2 txs), Block 3 (2 txs)
53
+ export const TX_COUNT = 10;
54
+
55
+ /** The validator cluster + context produced by {@link setupSimpleBlockProduction}. */
56
+ export type SimpleBlockProductionFixture = {
57
+ test: MultiNodeTestContext;
58
+ context: EndToEndContext;
59
+ logger: Logger;
60
+ validators: RegisteredValidator[];
61
+ nodes: AztecNodeService[];
62
+ from: AztecAddress;
63
+ };
64
+
65
+ /** State shared by the wide-slot `it`s (handles 4 validators + prover + a wallet pointed at node 0). */
66
+ export type BlockProductionWithProverFixture = {
67
+ test: MultiNodeTestContext;
68
+ context: EndToEndContext;
69
+ logger: Logger;
70
+ rollup: RollupContract;
71
+ archiver: Archiver;
72
+ validators: RegisteredValidator[];
73
+ nodes: AztecNodeService[];
74
+ contract: TestContract;
75
+ wallet: TestWallet;
76
+ from: AztecAddress;
77
+ failEvents: TrackedSequencerEvent[];
78
+ };
79
+
80
+ /** Per-validator node config, or a function deriving it from the validator's 0-based index. */
81
+ type ValidatorNodeOpts = Partial<AztecNodeConfig> & { dontStartSequencer?: boolean };
82
+
83
+ /** Shared spine: builds N mock-gossip validators, sets up the context, spawns one node per validator. */
84
+ async function buildValidatorCluster(opts: {
85
+ nodeCount: number;
86
+ setupOpts: Partial<MultiNodeTestOpts>;
87
+ nodeOpts?: ValidatorNodeOpts | ((index: number) => ValidatorNodeOpts);
88
+ }): Promise<SimpleBlockProductionFixture> {
89
+ const validators = buildMockGossipValidators(opts.nodeCount);
90
+
91
+ const test = await MultiNodeTestContext.setup({
92
+ ...opts.setupOpts,
93
+ initialValidators: validators,
94
+ });
95
+
96
+ const { context, logger } = test;
97
+ const from = context.accounts[0];
98
+
99
+ logger.warn(`Initial setup complete. Starting ${opts.nodeCount} validator nodes.`);
100
+ const nodes = await asyncMap(validators, ({ privateKey }, i) =>
101
+ test.createValidatorNode(
102
+ [privateKey],
103
+ typeof opts.nodeOpts === 'function' ? opts.nodeOpts(i) : { ...opts.nodeOpts },
104
+ ),
105
+ );
106
+ logger.warn(`Started ${opts.nodeCount} validator nodes.`, { validators: validators.map(v => v.attester.toString()) });
107
+
108
+ return { test, context, logger, validators, nodes, from };
109
+ }
110
+
111
+ /**
112
+ * Stands up the `block-production` validator cluster shared by the `MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING` tests
113
+ * (`simple`, `high_tps`): builds `nodeCount` mock-gossip validators, sets up the context with the
114
+ * block-production timing profile, spawns one validator node per validator, and returns the cluster. The
115
+ * per-test divergence (`fakeProcessingDelayPerTxMs`, `txDelayerMaxInclusionTimeIntoSlot`,
116
+ * min/maxTxsPerBlock, whether sequencers start eagerly, contract type) passes through `opts`. Mirrors
117
+ * how {@link setupBlockProductionWithProver} factors out the prover-backed setup; the test still registers its own contract.
118
+ */
119
+ export function setupSimpleBlockProduction(opts: {
120
+ nodeCount: number;
121
+ setupOpts?: Partial<MultiNodeTestOpts>;
122
+ nodeOpts?: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean };
123
+ }): Promise<SimpleBlockProductionFixture> {
124
+ return buildValidatorCluster({
125
+ nodeCount: opts.nodeCount,
126
+ setupOpts: { ...MOCK_GOSSIP_MULTI_VALIDATOR_OPTS, ...MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING, ...opts.setupOpts },
127
+ nodeOpts: opts.nodeOpts,
128
+ });
129
+ }
130
+
131
+ /**
132
+ * Creates validators and sets up a wide-slot test context with the pipelining timing profile and a prover
133
+ * node, then starts (paused) validator nodes and points the wallet at node 0. Mirrors the per-test
134
+ * setup from the dissolved `mbps.parallel` file. The blob-promotion and pipeline-prune suites layer their
135
+ * adverse-network shape on via `mockGossipSubNetworkLatency`, `maxTxsPerCheckpoint`, `clearInheritedCoinbase`,
136
+ * and `disableCheckpointPromotionOnFirstNode`.
137
+ */
138
+ export async function setupBlockProductionWithProver(opts: {
139
+ syncChainTip: 'proposed' | 'checkpointed';
140
+ minTxsPerBlock?: number;
141
+ maxTxsPerBlock?: number;
142
+ maxTxsPerCheckpoint?: number;
143
+ buildCheckpointIfEmpty?: boolean;
144
+ skipPushProposedBlocksToArchiver?: boolean;
145
+ /** Injects artificial mock-gossip propagation latency (ms) to model adverse network conditions. */
146
+ mockGossipSubNetworkLatency?: number;
147
+ /** Clears each validator node's inherited coinbase so it derives one from its own attester key. */
148
+ clearInheritedCoinbase?: boolean;
149
+ /**
150
+ * Disables checkpoint promotion on node 0 (`skipPromoteProposedCheckpointDuringL1Sync`), so node 0 fetches
151
+ * blobs during L1 sync while its peers promote their own proposed checkpoints and skip the blob fetch.
152
+ */
153
+ disableCheckpointPromotionOnFirstNode?: boolean;
154
+ }): Promise<BlockProductionWithProverFixture> {
155
+ const {
156
+ syncChainTip = 'checkpointed',
157
+ clearInheritedCoinbase = false,
158
+ disableCheckpointPromotionOnFirstNode = false,
159
+ ...setupOpts
160
+ } = opts;
161
+
162
+ // WIDE_SLOT_TIMING is the wide 72s/12s pipelining cadence (see A-914 on why the tighter 36s/4s breaks
163
+ // non-proposer nodes); the JSDoc on the profile carries the full rationale.
164
+ const { test, context, logger, validators, nodes, from } = await buildValidatorCluster({
165
+ nodeCount: NODE_COUNT,
166
+ setupOpts: {
167
+ ...WIDE_SLOT_TIMING,
168
+ numberOfAccounts: 0,
169
+ mockGossipSubNetwork: true,
170
+ startProverNode: true,
171
+ ...setupOpts,
172
+ pxeOpts: { syncChainTip },
173
+ skipInitialSequencer: true,
174
+ inboxLag: 2,
175
+ },
176
+ nodeOpts: (index: number) => ({
177
+ dontStartSequencer: true,
178
+ ...(clearInheritedCoinbase ? { coinbase: undefined } : {}),
179
+ ...(disableCheckpointPromotionOnFirstNode && index === 0
180
+ ? { skipPromoteProposedCheckpointDuringL1Sync: true }
181
+ : {}),
182
+ }),
183
+ });
184
+
185
+ const { rollup } = test;
186
+ const wallet = context.wallet as TestWallet;
187
+ const { failEvents } = test.watchNodeSequencerEvents(nodes);
188
+
189
+ // Point the wallet at a validator node. The initial node-0 has all validator keys in its config,
190
+ // so it rejects block proposals from validators thinking they come from itself. By redirecting
191
+ // the wallet to a validator node, the PXE correctly tracks proposed blocks.
192
+ wallet.updateNode(nodes[0]);
193
+ const archiver = nodes[0].getBlockSource() as Archiver;
194
+
195
+ // Register contract for sending txs.
196
+ const contract = await test.registerTestContract(wallet);
197
+ logger.warn(`Test setup completed.`, { validators: validators.map(v => v.attester.toString()) });
198
+
199
+ return { test, context, logger, rollup, archiver, validators, nodes, contract, wallet, from, failEvents };
200
+ }
201
+
202
+ /** Waits until a specific multi-block checkpoint is proven, verifying that proving succeeds with multiple-blocks-per-slot. */
203
+ export async function waitForProvenCheckpoint(
204
+ fixture: BlockProductionWithProverFixture,
205
+ targetCheckpoint: CheckpointNumber,
206
+ ) {
207
+ const { test, nodes, logger, failEvents } = fixture;
208
+ test.assertNoFailuresFromSequencers(failEvents);
209
+
210
+ logger.warn(`Stopping validator sequencers before waiting for checkpoint ${targetCheckpoint} to be proven`);
211
+ await Promise.all(nodes.map(n => n.getSequencer()?.stop()));
212
+
213
+ // With the sequencers stopped, no further blocks are produced, so waiting out the rest of the epoch in
214
+ // wall-clock is dead time. Warp the L1 clock forward past the epoch boundary so the epoch containing
215
+ // targetCheckpoint closes and the fake prover can prove+submit it; the subsequent wait then only covers
216
+ // the (real-time) proving+submission. A single next-epoch jump stays inside the proof-submission window
217
+ // (proofSubmissionEpochs >= 1), so it never crosses the submission deadline. Skipped if already proven,
218
+ // and forward-only since advanceToNextEpoch never rewinds.
219
+ const { proven } = await test.context.cheatCodes.rollup.getTips();
220
+ if (proven < targetCheckpoint) {
221
+ await testSpan('warp:proven-checkpoint-epoch', () => test.context.cheatCodes.rollup.advanceToNextEpoch());
222
+ }
223
+
224
+ const provenTimeout = test.L2_SLOT_DURATION_IN_S * test.epochDuration * 4;
225
+ logger.warn(`Waiting for checkpoint ${targetCheckpoint} to be proven (timeout=${provenTimeout}s)`);
226
+ await test.waitUntilProvenCheckpointNumber(targetCheckpoint, provenTimeout);
227
+ logger.warn(`Proven checkpoint advanced to ${test.monitor.provenCheckpointNumber}`);
228
+ }
229
+
230
+ export {
231
+ type Archiver,
232
+ type AztecNodeConfig,
233
+ type AztecNodeService,
234
+ AztecAddress,
235
+ EthAddress,
236
+ NO_WAIT,
237
+ generateClaimSecret,
238
+ Fr,
239
+ type Logger,
240
+ isL1ToL2MessageReady,
241
+ waitForTx,
242
+ RollupContract,
243
+ waitUntilL1Timestamp,
244
+ asyncMap,
245
+ BlockNumber,
246
+ CheckpointNumber,
247
+ SlotNumber,
248
+ timesAsync,
249
+ retryUntil,
250
+ sleep,
251
+ executeTimeout,
252
+ TestContract,
253
+ type SequencerEvents,
254
+ getSlotAtTimestamp,
255
+ getTimestampForSlot,
256
+ GasFees,
257
+ TxStatus,
258
+ jest,
259
+ sendL1ToL2Message,
260
+ type EndToEndContext,
261
+ waitForBlockNumber,
262
+ waitForTxs,
263
+ type TestWallet,
264
+ proveInteraction,
265
+ type BlockProposedEvent,
266
+ WIDE_SLOT_TIMING,
267
+ MULTI_VALIDATOR_BLOCK_PRODUCTION_TIMING,
268
+ MultiNodeTestContext,
269
+ type RegisteredValidator,
270
+ type TrackedSequencerEvent,
271
+ buildMockGossipValidators,
272
+ };
@@ -0,0 +1,172 @@
1
+ import { RollupContract } from '@aztec/ethereum/contracts';
2
+ import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
3
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
4
+ import { SlotNumber } from '@aztec/foundation/branded-types';
5
+ import { retryUntil } from '@aztec/foundation/retry';
6
+ import { GovernanceAbi, GovernanceProposerAbi } from '@aztec/l1-artifacts';
7
+
8
+ import { jest } from '@jest/globals';
9
+ import { type GetContractReturnType, encodeFunctionData, getAddress, getContract } from 'viem';
10
+
11
+ import type { MultiNodeTestContext } from '../multi_node_test_context.js';
12
+
13
+ jest.setTimeout(1000 * 60 * 10);
14
+
15
+ /**
16
+ * The shortened block-time timing the governance tests run on: a 12s L2 slot, 4s L1 slot, and a long
17
+ * proof-submission window so unproven blocks are never pruned (the committee runs no prover). Spread into
18
+ * a {@link MultiNodeTestContext.setup} call alongside {@link MOCK_GOSSIP_MULTI_VALIDATOR_OPTS} and
19
+ * `initialValidators`.
20
+ */
21
+ export const GOVERNANCE_TIMING = {
22
+ aztecSlotDuration: 12,
23
+ ethereumSlotDuration: 4,
24
+ aztecProofSubmissionEpochs: 640,
25
+ } as const;
26
+
27
+ /** The current round leader's payload and its signal count, as observed by {@link GovernanceTestDriver.govInfo}. */
28
+ type GovRoundState = { round: bigint; leaderVotes: bigint };
29
+
30
+ /**
31
+ * Wraps the L1 governance-proposer / governance / rollup contracts and the round-driving mechanics shared by
32
+ * the governance suites (`add_rollup`, `upgrade_governance_proposer`): warping to round boundaries, polling
33
+ * round state, waiting for signal quorum, submitting the round winner, and voting a proposal through to
34
+ * executable. Scenario-specific payload construction, node signaling, and post-execution assertions stay in
35
+ * each test.
36
+ */
37
+ export interface GovernanceTestDriver {
38
+ governanceProposer: GetContractReturnType<typeof GovernanceProposerAbi, ExtendedViemWalletClient>;
39
+ governance: GetContractReturnType<typeof GovernanceAbi, ExtendedViemWalletClient>;
40
+ rollup: RollupContract;
41
+ roundSize: bigint;
42
+ emperor: ExtendedViemWalletClient['account'];
43
+ /** Sends a 1-wei self-transfer to mine a fresh L1 block, so warped time takes effect. */
44
+ waitL1Block: () => Promise<void>;
45
+ /** Reads the current round's leading payload and its signal count. */
46
+ govInfo: () => Promise<GovRoundState>;
47
+ /** Warps L1 to the start of the next governance-proposer round. */
48
+ warpToNextRound: () => Promise<void>;
49
+ /** Polls once per L2 slot until the round leader reaches quorum, returning the round state at that point. */
50
+ waitForQuorum: (quorumSize: bigint, timeoutSeconds: number) => Promise<GovRoundState>;
51
+ /** Submits the winning payload of `round` to the governance proposer, creating the on-chain proposal. */
52
+ submitRoundWinner: (round: bigint) => Promise<void>;
53
+ /**
54
+ * Warps past the proposal's voting delay, casts a yes vote (asserting it lands), then warps past the
55
+ * voting duration and execution delay so the proposal becomes executable.
56
+ */
57
+ voteToExecutable: () => Promise<void>;
58
+ }
59
+
60
+ /** Builds a {@link GovernanceTestDriver} over the context's L1 governance contracts. */
61
+ export async function createGovernanceTestDriver(
62
+ test: MultiNodeTestContext,
63
+ l1TxUtils: L1TxUtils,
64
+ ): Promise<GovernanceTestDriver> {
65
+ const { l1Client, l1ContractAddresses } = test.context.deployL1ContractsValues;
66
+ const rollupAddress = l1ContractAddresses.rollupAddress.toString();
67
+
68
+ const governanceProposer = getContract({
69
+ address: getAddress(l1ContractAddresses.governanceProposerAddress.toString()),
70
+ abi: GovernanceProposerAbi,
71
+ client: l1Client,
72
+ });
73
+ const governance = getContract({
74
+ address: getAddress(l1ContractAddresses.governanceAddress.toString()),
75
+ abi: GovernanceAbi,
76
+ client: l1Client,
77
+ });
78
+ const rollup = new RollupContract(l1Client, l1ContractAddresses.rollupAddress);
79
+ const roundSize = await governanceProposer.read.ROUND_SIZE();
80
+ const emperor = l1Client.account;
81
+
82
+ const waitL1Block = async () => {
83
+ await l1TxUtils.sendAndMonitorTransaction({ to: emperor.address, value: 1n });
84
+ };
85
+
86
+ const govInfo = async (): Promise<GovRoundState> => {
87
+ const bn = await test.context.cheatCodes.eth.blockNumber();
88
+ const slot = await rollup.getSlotNumber();
89
+ const round = await governanceProposer.read.computeRound([BigInt(slot)]);
90
+ const info = await governanceProposer.read.getRoundData([rollupAddress, round]);
91
+ const leaderVotes = await governanceProposer.read.signalCount([rollupAddress, round, info.payloadWithMostSignals]);
92
+ test.logger.info(
93
+ `Governance stats for round ${round} (Slot: ${slot}, BN: ${bn}). Leader: ${info.payloadWithMostSignals} have ${leaderVotes} signals`,
94
+ );
95
+ return { round, leaderVotes };
96
+ };
97
+
98
+ const warpToNextRound = async () => {
99
+ const currentSlot = await rollup.getSlotNumber();
100
+ const nextRoundSlot = SlotNumber.fromBigInt((BigInt(currentSlot) / roundSize) * roundSize + roundSize);
101
+ const nextRoundTimestamp = await rollup.getTimestampForSlot(nextRoundSlot);
102
+ await test.context.cheatCodes.eth.warp(Number(nextRoundTimestamp));
103
+ };
104
+
105
+ const waitForQuorum = (quorumSize: bigint, timeoutSeconds: number) =>
106
+ retryUntil(
107
+ async () => {
108
+ const data = await govInfo();
109
+ return data.leaderVotes >= quorumSize ? data : undefined;
110
+ },
111
+ 'governance leader reaches quorum',
112
+ timeoutSeconds,
113
+ GOVERNANCE_TIMING.aztecSlotDuration,
114
+ );
115
+
116
+ const submitRoundWinner = async (round: bigint) => {
117
+ await l1TxUtils.sendAndMonitorTransaction({
118
+ to: governanceProposer.address,
119
+ data: encodeFunctionData({ abi: GovernanceProposerAbi, functionName: 'submitRoundWinner', args: [round] }),
120
+ });
121
+ };
122
+
123
+ const voteToExecutable = async () => {
124
+ const proposal = await governance.read.getProposal([0n]);
125
+
126
+ const timeToActive = proposal.creation + proposal.config.votingDelay;
127
+ await test.context.cheatCodes.eth.warp(Number(timeToActive + 1n));
128
+ await waitL1Block();
129
+
130
+ const voteTx = await rollup.vote(l1TxUtils, 0n);
131
+ expect(voteTx.receipt?.status).toBe('success');
132
+
133
+ const timeToExecutable = timeToActive + proposal.config.votingDuration + proposal.config.executionDelay + 1n;
134
+ await test.context.cheatCodes.eth.warp(Number(timeToExecutable));
135
+ await waitL1Block();
136
+ };
137
+
138
+ return {
139
+ governanceProposer,
140
+ governance,
141
+ rollup,
142
+ roundSize,
143
+ emperor,
144
+ waitL1Block,
145
+ govInfo,
146
+ warpToNextRound,
147
+ waitForQuorum,
148
+ submitRoundWinner,
149
+ voteToExecutable,
150
+ };
151
+ }
152
+
153
+ /**
154
+ * Drives one governance round to an executable proposal: waits for the signaled payload to reach quorum,
155
+ * warps to the next round, submits the round winner, then votes the resulting proposal through its voting
156
+ * and execution delays. Returns the round state observed at quorum; the caller performs the scenario-specific
157
+ * execution and assertions.
158
+ */
159
+ export async function driveGovernanceRound(
160
+ driver: GovernanceTestDriver,
161
+ opts: { quorumTimeoutSeconds: number },
162
+ ): Promise<{ govData: GovRoundState }> {
163
+ const quorumSize = await driver.governanceProposer.read.QUORUM_SIZE();
164
+ const govData = await driver.waitForQuorum(quorumSize, opts.quorumTimeoutSeconds);
165
+ await driver.warpToNextRound();
166
+ await driver.waitL1Block();
167
+ await driver.submitRoundWinner(govData.round);
168
+ await driver.voteToExecutable();
169
+ return { govData };
170
+ }
171
+
172
+ export { jest };