@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa

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 (410) hide show
  1. package/README.md +217 -14
  2. package/dest/automine/automine_test_context.d.ts +85 -0
  3. package/dest/automine/automine_test_context.d.ts.map +1 -0
  4. package/dest/automine/automine_test_context.js +98 -0
  5. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
  6. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  7. package/dest/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
  8. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
  9. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
  10. package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -0
  11. package/dest/automine/delivery/onchain_delivery_harness.d.ts +17 -0
  12. package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
  13. package/dest/automine/delivery/onchain_delivery_harness.js +123 -0
  14. package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
  15. package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
  16. package/dest/automine/token/blacklist_token_contract_test.js +166 -0
  17. package/dest/automine/token/token_contract_test.d.ts +40 -0
  18. package/dest/automine/token/token_contract_test.d.ts.map +1 -0
  19. package/dest/automine/token/token_contract_test.js +119 -0
  20. package/dest/automine/token/token_test_helpers.d.ts +73 -0
  21. package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
  22. package/dest/automine/token/token_test_helpers.js +97 -0
  23. package/dest/bench/client_flows/benchmark.d.ts +17 -2
  24. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  25. package/dest/bench/client_flows/benchmark.js +40 -1
  26. package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -20
  27. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  28. package/dest/bench/client_flows/client_flows_benchmark.js +159 -140
  29. package/dest/bench/client_flows/config.d.ts +2 -2
  30. package/dest/bench/client_flows/config.d.ts.map +1 -1
  31. package/dest/bench/client_flows/config.js +18 -0
  32. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  33. package/dest/bench/client_flows/data_extractor.js +8 -27
  34. package/dest/bench/utils.d.ts +10 -9
  35. package/dest/bench/utils.d.ts.map +1 -1
  36. package/dest/bench/utils.js +126 -23
  37. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  38. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  39. package/dest/composed/ha/ha_full_setup.js +383 -0
  40. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  41. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  42. package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +1 -1
  43. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  44. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  45. package/dest/fixtures/authwit_proxy.js +34 -0
  46. package/dest/fixtures/e2e_prover_test.d.ts +27 -29
  47. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  48. package/dest/fixtures/e2e_prover_test.js +156 -156
  49. package/dest/fixtures/elu_monitor.d.ts +21 -0
  50. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  51. package/dest/fixtures/elu_monitor.js +102 -0
  52. package/dest/fixtures/fixtures.d.ts +83 -3
  53. package/dest/fixtures/fixtures.d.ts.map +1 -1
  54. package/dest/fixtures/fixtures.js +86 -3
  55. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  56. package/dest/fixtures/get_acvm_config.js +1 -1
  57. package/dest/fixtures/get_bb_config.d.ts +1 -1
  58. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  59. package/dest/fixtures/get_bb_config.js +5 -5
  60. package/dest/fixtures/ha_setup.d.ts +71 -0
  61. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  62. package/dest/fixtures/ha_setup.js +119 -0
  63. package/dest/fixtures/index.d.ts +3 -1
  64. package/dest/fixtures/index.d.ts.map +1 -1
  65. package/dest/fixtures/index.js +2 -0
  66. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  67. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  68. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  69. package/dest/fixtures/logging.d.ts +1 -1
  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 +60 -41
  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 +26 -5
  83. package/dest/fixtures/token_utils.d.ts.map +1 -1
  84. package/dest/fixtures/token_utils.js +33 -9
  85. package/dest/fixtures/utils.d.ts +5 -192
  86. package/dest/fixtures/utils.d.ts.map +1 -1
  87. package/dest/fixtures/utils.js +4 -648
  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.d.ts +1 -1
  92. package/dest/fixtures/web3signer.js +1 -1
  93. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  94. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  95. package/dest/fixtures/with_telemetry_utils.js +2 -2
  96. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  97. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  98. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  99. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  100. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  101. package/dest/forward-compatibility/wallet_service.js +109 -0
  102. package/dest/index.d.ts +1 -1
  103. package/dest/install_legacy_contracts.d.cts +10 -0
  104. package/dest/install_legacy_contracts.d.cts.map +1 -0
  105. package/dest/legacy-jest-resolver.d.cts +3 -0
  106. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  107. package/dest/multi-node/block-production/setup.d.ts +97 -0
  108. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  109. package/dest/multi-node/block-production/setup.js +158 -0
  110. package/dest/multi-node/governance/setup.d.ts +67 -0
  111. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  112. package/dest/multi-node/governance/setup.js +126 -0
  113. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  114. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  115. package/dest/multi-node/multi_node_test_context.js +347 -0
  116. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  117. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  118. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  119. package/dest/multi-node/slashing/setup.d.ts +167 -0
  120. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  121. package/dest/multi-node/slashing/setup.js +275 -0
  122. package/dest/p2p/p2p_network.d.ts +325 -0
  123. package/dest/p2p/p2p_network.d.ts.map +1 -0
  124. package/dest/p2p/p2p_network.js +389 -0
  125. package/dest/p2p/reqresp/utils.d.ts +19 -0
  126. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  127. package/dest/p2p/reqresp/utils.js +193 -0
  128. package/dest/p2p/shared.d.ts +72 -0
  129. package/dest/p2p/shared.d.ts.map +1 -0
  130. package/dest/p2p/shared.js +212 -0
  131. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  132. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  133. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  134. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  135. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  136. package/dest/quality_of_service/prometheus_client.js +67 -0
  137. package/dest/shared/cross_chain_test_harness.d.ts +11 -8
  138. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  139. package/dest/shared/cross_chain_test_harness.js +45 -40
  140. package/dest/shared/gas_portal_test_harness.d.ts +9 -6
  141. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  142. package/dest/shared/gas_portal_test_harness.js +28 -16
  143. package/dest/shared/index.d.ts +3 -2
  144. package/dest/shared/index.d.ts.map +1 -1
  145. package/dest/shared/index.js +1 -0
  146. package/dest/shared/jest_setup.d.ts +1 -1
  147. package/dest/shared/jest_setup.js +41 -1
  148. package/dest/shared/mock_state_view.d.ts +86 -0
  149. package/dest/shared/mock_state_view.d.ts.map +1 -0
  150. package/dest/shared/mock_state_view.js +186 -0
  151. package/dest/shared/submit-transactions.d.ts +4 -4
  152. package/dest/shared/submit-transactions.d.ts.map +1 -1
  153. package/dest/shared/submit-transactions.js +19 -14
  154. package/dest/shared/timing_env.d.js +5 -0
  155. package/dest/shared/timing_env.js +365 -0
  156. package/dest/shared/uniswap_l1_l2.d.ts +3 -27
  157. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  158. package/dest/shared/uniswap_l1_l2.js +86 -54
  159. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  160. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  161. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  162. package/dest/simulators/index.d.ts +1 -1
  163. package/dest/simulators/lending_simulator.d.ts +11 -4
  164. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  165. package/dest/simulators/lending_simulator.js +33 -19
  166. package/dest/simulators/token_simulator.d.ts +1 -1
  167. package/dest/simulators/token_simulator.d.ts.map +1 -1
  168. package/dest/simulators/token_simulator.js +3 -24
  169. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  170. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  171. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  172. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  173. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  174. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  175. package/dest/single-node/fees/bridging_race.notest.d.ts +2 -0
  176. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  177. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +21 -10
  178. package/dest/single-node/fees/fees_test.d.ts +93 -0
  179. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  180. package/dest/single-node/fees/fees_test.js +274 -0
  181. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  182. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  183. package/dest/single-node/l1-reorgs/setup.js +57 -0
  184. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  185. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  186. package/dest/single-node/partial-proofs/setup.js +5 -0
  187. package/dest/single-node/proving/setup.d.ts +5 -0
  188. package/dest/single-node/proving/setup.d.ts.map +1 -0
  189. package/dest/single-node/proving/setup.js +5 -0
  190. package/dest/single-node/recovery/setup.d.ts +5 -0
  191. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  192. package/dest/single-node/recovery/setup.js +5 -0
  193. package/dest/single-node/setup.d.ts +49 -0
  194. package/dest/single-node/setup.d.ts.map +1 -0
  195. package/dest/single-node/setup.js +56 -0
  196. package/dest/single-node/single_node_test_context.d.ts +360 -0
  197. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  198. package/dest/single-node/single_node_test_context.js +833 -0
  199. package/dest/spartan/setup_test_wallets.d.ts +18 -6
  200. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  201. package/dest/spartan/setup_test_wallets.js +169 -30
  202. package/dest/spartan/tx_metrics.d.ts +111 -0
  203. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  204. package/dest/spartan/tx_metrics.js +507 -0
  205. package/dest/spartan/utils/bot.d.ts +28 -0
  206. package/dest/spartan/utils/bot.d.ts.map +1 -0
  207. package/dest/spartan/utils/bot.js +142 -0
  208. package/dest/spartan/utils/chaos.d.ts +79 -0
  209. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  210. package/dest/spartan/utils/chaos.js +142 -0
  211. package/dest/spartan/utils/clients.d.ts +39 -0
  212. package/dest/spartan/utils/clients.d.ts.map +1 -0
  213. package/dest/spartan/utils/clients.js +90 -0
  214. package/dest/spartan/utils/config.d.ts +19 -0
  215. package/dest/spartan/utils/config.d.ts.map +1 -0
  216. package/dest/spartan/utils/config.js +23 -0
  217. package/dest/spartan/utils/health.d.ts +63 -0
  218. package/dest/spartan/utils/health.d.ts.map +1 -0
  219. package/dest/spartan/utils/health.js +202 -0
  220. package/dest/spartan/utils/helm.d.ts +15 -0
  221. package/dest/spartan/utils/helm.d.ts.map +1 -0
  222. package/dest/spartan/utils/helm.js +47 -0
  223. package/dest/spartan/utils/index.d.ts +11 -0
  224. package/dest/spartan/utils/index.d.ts.map +1 -0
  225. package/dest/spartan/utils/index.js +22 -0
  226. package/dest/spartan/utils/k8s.d.ts +128 -0
  227. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  228. package/dest/spartan/utils/k8s.js +381 -0
  229. package/dest/spartan/utils/nodes.d.ts +40 -0
  230. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  231. package/dest/spartan/utils/nodes.js +461 -0
  232. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  233. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  234. package/dest/spartan/utils/pod_logs.js +74 -0
  235. package/dest/spartan/utils/scripts.d.ts +30 -0
  236. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  237. package/dest/spartan/utils/scripts.js +81 -0
  238. package/dest/spartan/utils.d.ts +2 -218
  239. package/dest/spartan/utils.d.ts.map +1 -1
  240. package/dest/spartan/utils.js +1 -749
  241. package/dest/test-wallet/test_wallet.d.ts +105 -0
  242. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  243. package/dest/test-wallet/test_wallet.js +323 -0
  244. package/dest/test-wallet/utils.d.ts +76 -0
  245. package/dest/test-wallet/utils.d.ts.map +1 -0
  246. package/dest/test-wallet/utils.js +126 -0
  247. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  248. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  249. package/dest/test-wallet/wallet_worker_script.js +56 -0
  250. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  251. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  252. package/dest/test-wallet/worker_wallet.js +155 -0
  253. package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
  254. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  255. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  256. package/package.json +57 -47
  257. package/src/automine/README.md +60 -0
  258. package/src/automine/automine_test_context.ts +153 -0
  259. package/src/automine/contracts/fixtures/storage_proof.json +915 -0
  260. package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
  261. package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
  262. package/src/automine/delivery/onchain_delivery_harness.ts +177 -0
  263. package/src/automine/token/blacklist_token_contract_test.ts +208 -0
  264. package/src/automine/token/token_contract_test.ts +146 -0
  265. package/src/automine/token/token_test_helpers.ts +138 -0
  266. package/src/bench/client_flows/benchmark.ts +45 -2
  267. package/src/bench/client_flows/client_flows_benchmark.ts +227 -211
  268. package/src/bench/client_flows/config.ts +9 -1
  269. package/src/bench/client_flows/data_extractor.ts +7 -28
  270. package/src/bench/utils.ts +144 -25
  271. package/src/composed/ha/ha_full_setup.ts +466 -0
  272. package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +1 -1
  273. package/src/fixtures/authwit_proxy.ts +54 -0
  274. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  275. package/src/fixtures/e2e_prover_test.ts +175 -214
  276. package/src/fixtures/elu_monitor.ts +126 -0
  277. package/src/fixtures/fixtures.ts +110 -5
  278. package/src/fixtures/get_acvm_config.ts +1 -1
  279. package/src/fixtures/get_bb_config.ts +7 -6
  280. package/src/fixtures/ha_setup.ts +192 -0
  281. package/src/fixtures/index.ts +2 -0
  282. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  283. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  284. package/src/fixtures/setup.ts +987 -0
  285. package/src/fixtures/setup_p2p_test.ts +72 -58
  286. package/src/fixtures/timing.ts +97 -0
  287. package/src/fixtures/token_utils.ts +47 -11
  288. package/src/fixtures/utils.ts +26 -947
  289. package/src/fixtures/wait_helpers.ts +333 -0
  290. package/src/fixtures/web3signer.ts +1 -1
  291. package/src/fixtures/with_telemetry_utils.ts +2 -2
  292. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  293. package/src/forward-compatibility/wallet_service.ts +106 -0
  294. package/src/guides/up_quick_start.sh +8 -5
  295. package/src/infra/README.md +12 -0
  296. package/src/install_legacy_contracts.cjs +75 -0
  297. package/src/legacy-jest-resolver.cjs +112 -0
  298. package/src/multi-node/README.md +95 -0
  299. package/src/multi-node/block-production/setup.ts +272 -0
  300. package/src/multi-node/governance/setup.ts +172 -0
  301. package/src/multi-node/multi_node_test_context.ts +447 -0
  302. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  303. package/src/multi-node/slashing/setup.ts +433 -0
  304. package/src/p2p/README.md +78 -0
  305. package/src/p2p/p2p_network.ts +542 -0
  306. package/src/p2p/reqresp/utils.ts +263 -0
  307. package/src/p2p/shared.ts +329 -0
  308. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
  309. package/src/quality_of_service/prometheus_client.ts +113 -0
  310. package/src/shared/cross_chain_test_harness.ts +51 -43
  311. package/src/shared/gas_portal_test_harness.ts +36 -18
  312. package/src/shared/index.ts +2 -1
  313. package/src/shared/jest_setup.ts +51 -1
  314. package/src/shared/mock_state_view.ts +188 -0
  315. package/src/shared/submit-transactions.ts +22 -19
  316. package/src/shared/timing_env.d.mts +39 -0
  317. package/src/shared/timing_env.mjs +363 -0
  318. package/src/shared/uniswap_l1_l2.ts +136 -115
  319. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  320. package/src/simulators/lending_simulator.ts +40 -20
  321. package/src/simulators/token_simulator.ts +6 -30
  322. package/src/single-node/README.md +60 -0
  323. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  324. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  325. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +23 -15
  326. package/src/single-node/fees/fees_test.ts +368 -0
  327. package/src/single-node/l1-reorgs/setup.ts +93 -0
  328. package/src/single-node/partial-proofs/setup.ts +8 -0
  329. package/src/single-node/proving/setup.ts +15 -0
  330. package/src/single-node/recovery/setup.ts +8 -0
  331. package/src/single-node/setup.ts +63 -0
  332. package/src/single-node/single_node_test_context.ts +1041 -0
  333. package/src/spartan/DEVELOP.md +7 -0
  334. package/src/spartan/setup_test_wallets.ts +243 -32
  335. package/src/spartan/tx_metrics.ts +460 -0
  336. package/src/spartan/utils/bot.ts +188 -0
  337. package/src/spartan/utils/chaos.ts +253 -0
  338. package/src/spartan/utils/clients.ts +100 -0
  339. package/src/spartan/utils/config.ts +29 -0
  340. package/src/spartan/utils/health.ts +255 -0
  341. package/src/spartan/utils/helm.ts +84 -0
  342. package/src/spartan/utils/index.ts +71 -0
  343. package/src/spartan/utils/k8s.ts +535 -0
  344. package/src/spartan/utils/nodes.ts +543 -0
  345. package/src/spartan/utils/pod_logs.ts +99 -0
  346. package/src/spartan/utils/scripts.ts +99 -0
  347. package/src/spartan/utils.ts +1 -942
  348. package/src/test-wallet/test_wallet.ts +429 -0
  349. package/src/test-wallet/utils.ts +205 -0
  350. package/src/test-wallet/wallet_worker_script.ts +66 -0
  351. package/src/test-wallet/worker_wallet.ts +214 -0
  352. package/src/test-wallet/worker_wallet_schema.ts +14 -0
  353. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -54
  354. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  355. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +0 -185
  356. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -41
  357. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  358. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -107
  359. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
  360. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  361. package/dest/e2e_deploy_contract/deploy_test.js +0 -45
  362. package/dest/e2e_epochs/epochs_test.d.ts +0 -92
  363. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  364. package/dest/e2e_epochs/epochs_test.js +0 -336
  365. package/dest/e2e_fees/bridging_race.notest.d.ts +0 -2
  366. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  367. package/dest/e2e_fees/fees_test.d.ts +0 -84
  368. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  369. package/dest/e2e_fees/fees_test.js +0 -260
  370. package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
  371. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  372. package/dest/e2e_l1_publisher/write_json.js +0 -57
  373. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  374. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  375. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -29
  376. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  377. package/dest/e2e_nested_contract/nested_contract_test.js +0 -63
  378. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  379. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  380. package/dest/e2e_p2p/inactivity_slash_test.js +0 -135
  381. package/dest/e2e_p2p/p2p_network.d.ts +0 -108
  382. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  383. package/dest/e2e_p2p/p2p_network.js +0 -318
  384. package/dest/e2e_p2p/shared.d.ts +0 -46
  385. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  386. package/dest/e2e_p2p/shared.js +0 -183
  387. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -35
  388. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  389. package/dest/e2e_token_contract/token_contract_test.js +0 -126
  390. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  391. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  392. package/dest/fixtures/setup_l1_contracts.js +0 -17
  393. package/dest/fixtures/snapshot_manager.d.ts +0 -95
  394. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  395. package/dest/fixtures/snapshot_manager.js +0 -505
  396. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  397. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  398. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +0 -256
  399. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -178
  400. package/src/e2e_deploy_contract/deploy_test.ts +0 -78
  401. package/src/e2e_epochs/epochs_test.ts +0 -437
  402. package/src/e2e_fees/fees_test.ts +0 -378
  403. package/src/e2e_l1_publisher/write_json.ts +0 -76
  404. package/src/e2e_nested_contract/nested_contract_test.ts +0 -95
  405. package/src/e2e_p2p/inactivity_slash_test.ts +0 -178
  406. package/src/e2e_p2p/p2p_network.ts +0 -472
  407. package/src/e2e_p2p/shared.ts +0 -282
  408. package/src/e2e_token_contract/token_contract_test.ts +0 -167
  409. package/src/fixtures/setup_l1_contracts.ts +0 -26
  410. package/src/fixtures/snapshot_manager.ts +0 -665
@@ -0,0 +1,542 @@
1
+ import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
2
+ import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
3
+ import { getAccountContractAddress } from '@aztec/aztec.js/account';
4
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
5
+ import { Fr } from '@aztec/aztec.js/fields';
6
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
7
+ import { GSEContract, RollupContract, type SlashingProposerContract } from '@aztec/ethereum/contracts';
8
+ import type { Operator } from '@aztec/ethereum/deploy-aztec-l1-contracts';
9
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
10
+ import { MultiAdderArtifact } from '@aztec/ethereum/l1-artifacts';
11
+ import { createL1TxUtils } from '@aztec/ethereum/l1-tx-utils';
12
+ import { ChainMonitor } from '@aztec/ethereum/test';
13
+ import type { ExtendedViemWalletClient, ViemClient } from '@aztec/ethereum/types';
14
+ import { EpochNumber } from '@aztec/foundation/branded-types';
15
+ import { SecretValue } from '@aztec/foundation/config';
16
+ import { type Logger, createLogger } from '@aztec/foundation/log';
17
+ import { retryUntil } from '@aztec/foundation/retry';
18
+ import { RollupAbi, SlasherAbi, TestERC20Abi } from '@aztec/l1-artifacts';
19
+ import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
20
+ import type { BootstrapNode } from '@aztec/p2p/bootstrap';
21
+ import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
22
+ import { tryStop } from '@aztec/stdlib/interfaces/server';
23
+ import { TopicType } from '@aztec/stdlib/p2p';
24
+ import type { GenesisData } from '@aztec/stdlib/world-state';
25
+ import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
26
+ import { getGenesisValues } from '@aztec/world-state/testing';
27
+
28
+ import fs from 'fs';
29
+ import getPort from 'get-port';
30
+ import os from 'os';
31
+ import path from 'path';
32
+ import { type GetContractReturnType, getAddress, getContract } from 'viem';
33
+ import { privateKeyToAccount } from 'viem/accounts';
34
+
35
+ import {
36
+ SCHNORR_HARDCODED_PRIVATE_KEY,
37
+ SchnorrHardcodedKeyAccountContract,
38
+ } from '../fixtures/schnorr_hardcoded_account_contract.js';
39
+ import {
40
+ type EndToEndContext,
41
+ type SetupOptions,
42
+ getPrivateKeyFromIndex,
43
+ getSponsoredFPCAddress,
44
+ setup,
45
+ teardown,
46
+ } from '../fixtures/setup.js';
47
+ import {
48
+ ATTESTER_PRIVATE_KEYS_START_INDEX,
49
+ createValidatorConfig,
50
+ generatePrivateKeys,
51
+ } from '../fixtures/setup_p2p_test.js';
52
+ import { getEndToEndTestTelemetryClient } from '../fixtures/with_telemetry_utils.js';
53
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
54
+
55
+ // Use a fixed bootstrap node private key so that we can re-use the same snapshot and the nodes can find each other
56
+ const BOOTSTRAP_NODE_PRIVATE_KEY = '080212208f988fc0899e4a73a5aee4d271a5f20670603a756ad8d84f2c94263a6427c591';
57
+ const l1ContractsConfig = getL1ContractsConfigEnvVars();
58
+ export const WAIT_FOR_TX_TIMEOUT = l1ContractsConfig.aztecSlotDuration * 3;
59
+
60
+ export const SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES = {
61
+ aztecSlotDuration: 12,
62
+ ethereumSlotDuration: 4,
63
+ aztecProofSubmissionEpochs: 640,
64
+ };
65
+
66
+ export class P2PNetworkTest {
67
+ public context!: EndToEndContext;
68
+ public baseAccountPrivateKey: `0x${string}`;
69
+ public baseAccount;
70
+
71
+ public logger: Logger;
72
+ public monitor!: ChainMonitor;
73
+
74
+ public ctx!: EndToEndContext;
75
+ public attesterPrivateKeys: `0x${string}`[] = [];
76
+ public attesterPublicKeys: string[] = [];
77
+ public peerIdPrivateKeys: string[] = [];
78
+ public validators: Operator[] = [];
79
+
80
+ public hardcodedAccountData!: InitialAccountData;
81
+ public genesis: GenesisData | undefined;
82
+
83
+ // The re-execution test needs a wallet and a spam contract
84
+ public wallet?: TestWallet;
85
+ public defaultAccountAddress?: AztecAddress;
86
+ public spamContract?: SpamContract;
87
+
88
+ public bootstrapNode?: BootstrapNode;
89
+
90
+ // Root temp directory holding every node's data dir. Created in setup(), removed in teardown().
91
+ public dataDir!: string;
92
+
93
+ // Store setup options for use in setup()
94
+ private setupOptions: SetupOptions;
95
+ private deployL1ContractsArgs: any;
96
+
97
+ constructor(
98
+ public readonly testName: string,
99
+ public bootstrapNodeEnr: string,
100
+ public bootNodePort: number,
101
+ public numberOfValidators: number,
102
+ initialValidatorConfig: SetupOptions,
103
+ public numberOfNodes = 0,
104
+ // If set enable metrics collection
105
+ private metricsPort?: number,
106
+ startProverNode?: boolean,
107
+ ) {
108
+ this.logger = createLogger(`e2e:e2e_p2p:${testName}`);
109
+
110
+ // Set up the base account and node private keys for the initial network deployment
111
+ this.baseAccountPrivateKey = `0x${getPrivateKeyFromIndex(1)!.toString('hex')}`;
112
+ this.baseAccount = privateKeyToAccount(this.baseAccountPrivateKey);
113
+ this.attesterPrivateKeys = generatePrivateKeys(
114
+ ATTESTER_PRIVATE_KEYS_START_INDEX + numberOfNodes,
115
+ numberOfValidators,
116
+ );
117
+ this.attesterPublicKeys = this.attesterPrivateKeys.map(privateKey => privateKeyToAccount(privateKey).address);
118
+
119
+ const zkPassportParams = ZkPassportProofParams.random();
120
+
121
+ // Store setup options for later use
122
+ this.setupOptions = {
123
+ ...initialValidatorConfig,
124
+ ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
125
+ aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
126
+ aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
127
+ aztecProofSubmissionEpochs:
128
+ initialValidatorConfig.aztecProofSubmissionEpochs ?? l1ContractsConfig.aztecProofSubmissionEpochs,
129
+ slashingRoundSizeInEpochs:
130
+ initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
131
+ slasherEnabled: initialValidatorConfig.slasherEnabled ?? true,
132
+ aztecTargetCommitteeSize: numberOfValidators,
133
+ metricsPort: metricsPort,
134
+ startProverNode,
135
+ };
136
+
137
+ this.deployL1ContractsArgs = {
138
+ ...initialValidatorConfig,
139
+ aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
140
+ slashingRoundSizeInEpochs:
141
+ initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
142
+ slasherEnabled: initialValidatorConfig.slasherEnabled ?? true,
143
+
144
+ ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
145
+ aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
146
+ aztecProofSubmissionEpochs:
147
+ initialValidatorConfig.aztecProofSubmissionEpochs ?? l1ContractsConfig.aztecProofSubmissionEpochs,
148
+ aztecTargetCommitteeSize: numberOfValidators,
149
+ initialValidators: [],
150
+ zkPassportArgs: {
151
+ zkPassportDomain: zkPassportParams.domain,
152
+ zkPassportScope: zkPassportParams.scope,
153
+ },
154
+ };
155
+ }
156
+
157
+ static async create({
158
+ testName,
159
+ numberOfNodes,
160
+ numberOfValidators,
161
+ basePort,
162
+ metricsPort,
163
+ initialConfig,
164
+ startProverNode,
165
+ }: {
166
+ testName: string;
167
+ numberOfNodes: number;
168
+ numberOfValidators: number;
169
+ basePort?: number;
170
+ metricsPort?: number;
171
+ initialConfig?: SetupOptions;
172
+ startProverNode?: boolean;
173
+ }) {
174
+ const port = basePort || (await getPort());
175
+
176
+ const bootstrapNodeENR = await getBootstrapNodeEnr(BOOTSTRAP_NODE_PRIVATE_KEY, port);
177
+ const bootstrapNodeEnr = bootstrapNodeENR.encodeTxt();
178
+
179
+ const initialValidatorConfig = await createValidatorConfig(
180
+ (initialConfig ?? {}) as AztecNodeConfig,
181
+ bootstrapNodeEnr,
182
+ );
183
+
184
+ return new P2PNetworkTest(
185
+ testName,
186
+ bootstrapNodeEnr,
187
+ port,
188
+ numberOfValidators,
189
+ initialValidatorConfig,
190
+ numberOfNodes,
191
+ metricsPort,
192
+ startProverNode,
193
+ );
194
+ }
195
+
196
+ get fundedAccount() {
197
+ if (!this.hardcodedAccountData) {
198
+ throw new Error('Call setup to initialize the hardcoded account.');
199
+ }
200
+ return this.hardcodedAccountData;
201
+ }
202
+
203
+ /**
204
+ * Returns a per-role data directory nested under this test's root data dir. The multi-node factories
205
+ * (`createNodes`) append `-<index>` to this base for each node they spawn; single-node factories
206
+ * (`createProverNode`, `createNonValidatorNode`, `createNode`) use it verbatim. Everything lives under
207
+ * `this.dataDir`, so a single recursive remove in teardown() cleans up all of it.
208
+ */
209
+ dataDirFor(label: string): string {
210
+ if (!this.dataDir) {
211
+ throw new Error('Call setup to initialize the data directory.');
212
+ }
213
+ return path.join(this.dataDir, label);
214
+ }
215
+
216
+ async addBootstrapNode() {
217
+ this.logger.info('Adding bootstrap node');
218
+ const telemetry = await getEndToEndTestTelemetryClient(this.metricsPort);
219
+ this.bootstrapNode = await createBootstrapNodeFromPrivateKey(
220
+ BOOTSTRAP_NODE_PRIVATE_KEY,
221
+ this.bootNodePort,
222
+ telemetry,
223
+ this.context.config,
224
+ );
225
+ // Overwrite enr with updated info
226
+ this.bootstrapNodeEnr = this.bootstrapNode.getENR().encodeTxt();
227
+ }
228
+
229
+ getValidators() {
230
+ const validators: Operator[] = [];
231
+
232
+ for (let i = 0; i < this.numberOfValidators; i++) {
233
+ const keyIndex = i;
234
+ const attester = privateKeyToAccount(this.attesterPrivateKeys[keyIndex]!);
235
+
236
+ validators.push({
237
+ attester: EthAddress.fromString(attester.address),
238
+ withdrawer: EthAddress.fromString(attester.address),
239
+ bn254SecretKey: new SecretValue(Fr.random().toBigInt()),
240
+ });
241
+
242
+ this.logger.info(`Adding attester ${attester.address} as validator`);
243
+ }
244
+ return { validators };
245
+ }
246
+
247
+ async applyBaseSetup() {
248
+ await this.addBootstrapNode();
249
+
250
+ this.logger.info('Adding validators');
251
+ const rollup = getContract({
252
+ address: this.context.deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
253
+ abi: RollupAbi,
254
+ client: this.context.deployL1ContractsValues.l1Client,
255
+ });
256
+
257
+ this.logger.info(`Adding ${this.numberOfValidators} validators`);
258
+
259
+ const stakingAsset = getContract({
260
+ address: this.context.deployL1ContractsValues.l1ContractAddresses.stakingAssetAddress.toString(),
261
+ abi: TestERC20Abi,
262
+ client: this.context.deployL1ContractsValues.l1Client,
263
+ });
264
+
265
+ const { address: multiAdderAddress } = await deployL1Contract(
266
+ this.context.deployL1ContractsValues.l1Client,
267
+ MultiAdderArtifact.contractAbi,
268
+ MultiAdderArtifact.contractBytecode,
269
+ [rollup.address, this.context.deployL1ContractsValues.l1Client.account.address],
270
+ );
271
+
272
+ const multiAdder = getContract({
273
+ address: multiAdderAddress.toString(),
274
+ abi: MultiAdderArtifact.contractAbi,
275
+ client: this.context.deployL1ContractsValues.l1Client,
276
+ });
277
+
278
+ const stakeNeeded = (await rollup.read.getActivationThreshold()) * BigInt(this.numberOfValidators);
279
+ await Promise.all(
280
+ [await stakingAsset.write.mint([multiAdder.address, stakeNeeded], {} as any)].map(txHash =>
281
+ this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: txHash }),
282
+ ),
283
+ );
284
+
285
+ const { validators } = this.getValidators();
286
+ this.validators = validators;
287
+
288
+ const gseAddress = this.context.deployL1ContractsValues.l1ContractAddresses.gseAddress!;
289
+ if (!gseAddress) {
290
+ throw new Error('GSE contract not deployed');
291
+ }
292
+
293
+ const gseContract = new GSEContract(this.context.deployL1ContractsValues.l1Client, gseAddress.toString());
294
+
295
+ const makeValidatorTuples = async (validator: Operator) => {
296
+ const registrationTuple = await gseContract.makeRegistrationTuple(validator.bn254SecretKey.getValue());
297
+ return {
298
+ attester: validator.attester.toString() as `0x${string}`,
299
+ withdrawer: validator.withdrawer.toString() as `0x${string}`,
300
+ ...registrationTuple,
301
+ };
302
+ };
303
+ const validatorTuples = await Promise.all(validators.map(makeValidatorTuples));
304
+
305
+ await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({
306
+ hash: await multiAdder.write.addValidators([validatorTuples]),
307
+ });
308
+
309
+ await this.context.cheatCodes.rollup.advanceToEpoch(
310
+ EpochNumber.fromBigInt(
311
+ BigInt(await this.context.cheatCodes.rollup.getEpoch()) +
312
+ (await rollup.read.getLagInEpochsForValidatorSet()) +
313
+ 1n,
314
+ ),
315
+ );
316
+
317
+ // Send and await a tx to make sure we mine a block for the warp to correctly progress.
318
+ await this._sendDummyTx(this.context.deployL1ContractsValues.l1Client);
319
+ }
320
+
321
+ /** Points the wallet to a P2P-enabled node so transactions can propagate through the network. */
322
+ setupWalletOnNode(node: AztecNodeService) {
323
+ this.logger.info('Pointing wallet to a P2P-enabled node');
324
+ this.context.wallet.updateNode(node);
325
+ }
326
+
327
+ /** Registers the hardcoded account in PXE without on-chain deployment. No sequencer needed. */
328
+ async setupAccount() {
329
+ this.logger.info('Registering hardcoded account (no deployment)');
330
+ const contract = new SchnorrHardcodedKeyAccountContract();
331
+ const accountManager = await (this.context.wallet as TestWallet).createAccount({
332
+ secret: this.hardcodedAccountData.secret,
333
+ salt: this.hardcodedAccountData.salt,
334
+ contract,
335
+ });
336
+ this.defaultAccountAddress = accountManager.address;
337
+ this.wallet = this.context.wallet;
338
+ }
339
+
340
+ async deploySpamContract() {
341
+ this.logger.info('Deploying spam contract');
342
+ if (!this.wallet) {
343
+ throw new Error('Call setupAccount before deploying spam contract');
344
+ }
345
+
346
+ ({ contract: this.spamContract } = await SpamContract.deploy(this.wallet).send({
347
+ from: this.defaultAccountAddress!,
348
+ }));
349
+ }
350
+
351
+ async removeInitialNode() {
352
+ this.logger.info('Removing initial node');
353
+ // Send and await a tx to make sure we mine a block for the warp to correctly progress.
354
+ const { receipt } = await this._sendDummyTx(this.context.deployL1ContractsValues.l1Client);
355
+ const block = await this.context.deployL1ContractsValues.l1Client.getBlock({
356
+ blockNumber: receipt.blockNumber,
357
+ });
358
+ this.context.dateProvider.setTime(Number(block.timestamp) * 1000);
359
+
360
+ await this.context.aztecNodeService.stop();
361
+ }
362
+
363
+ async sendDummyTx() {
364
+ return await this._sendDummyTx(this.ctx.deployL1ContractsValues.l1Client);
365
+ }
366
+
367
+ private async _sendDummyTx(l1Client: ExtendedViemWalletClient) {
368
+ const l1TxUtils = createL1TxUtils(l1Client);
369
+ return await l1TxUtils.sendAndMonitorTransaction({
370
+ to: l1Client.account!.address,
371
+ value: 1n,
372
+ });
373
+ }
374
+
375
+ async setup() {
376
+ this.logger.info('Setting up subsystems from fresh');
377
+
378
+ this.dataDir = fs.mkdtempSync(path.join(os.tmpdir(), `${this.testName}-`));
379
+
380
+ // Pre-compute hardcoded account data so it gets funded in genesis.
381
+ const contract = new SchnorrHardcodedKeyAccountContract();
382
+ const secret = Fr.random();
383
+ const salt = Fr.random();
384
+ this.hardcodedAccountData = {
385
+ secret,
386
+ salt,
387
+ signingKey: SCHNORR_HARDCODED_PRIVATE_KEY,
388
+ address: await getAccountContractAddress(contract, secret, salt),
389
+ };
390
+
391
+ // Generate funded (initializerless) Schnorr accounts for tests that create accounts from them (e.g. add_rollup).
392
+ const fundedAccounts = await generateSchnorrAccounts(2);
393
+
394
+ this.context = await setup(
395
+ 0,
396
+ {
397
+ ...this.setupOptions,
398
+ fundSponsoredFPC: true,
399
+ skipInitialSequencer: true,
400
+ additionallyFundedAccounts: [...fundedAccounts, this.hardcodedAccountData],
401
+ slasherEnabled: this.setupOptions.slasherEnabled ?? this.deployL1ContractsArgs.slasherEnabled ?? false,
402
+ aztecTargetCommitteeSize: 0,
403
+ l1ContractsArgs: this.deployL1ContractsArgs,
404
+ },
405
+ // Use checkpointed chain tip for PXE to avoid issues with blocks being dropped due to pruned anchor blocks.
406
+ { syncChainTip: 'checkpointed' },
407
+ );
408
+ this.ctx = this.context;
409
+
410
+ const sponsoredFPCAddress = await getSponsoredFPCAddress();
411
+ const initialFundedAccounts = [...this.context.additionallyFundedAccounts.map(a => a.address), sponsoredFPCAddress];
412
+
413
+ const { genesis } = await getGenesisValues(
414
+ initialFundedAccounts,
415
+ undefined,
416
+ undefined,
417
+ this.context.genesis!.genesisTimestamp,
418
+ );
419
+ this.genesis = genesis;
420
+
421
+ const rollupContract = RollupContract.getFromL1ContractsValues(this.context.deployL1ContractsValues);
422
+ this.monitor = new ChainMonitor(rollupContract, this.context.dateProvider).start();
423
+ this.monitor.on('l1-block', ({ timestamp }) => this.context.dateProvider.setTime(Number(timestamp) * 1000));
424
+ }
425
+
426
+ async stopNodes(nodes: AztecNodeService[]) {
427
+ this.logger.info('Stopping nodes');
428
+
429
+ if (!nodes || !nodes.length) {
430
+ this.logger.info('No nodes to stop');
431
+ return;
432
+ }
433
+
434
+ await Promise.all(nodes.map(node => node.stop()));
435
+
436
+ this.logger.info('Nodes stopped');
437
+ }
438
+
439
+ /**
440
+ * Wait for P2P mesh to be fully formed across all nodes.
441
+ * This ensures that all nodes are connected to each other before proceeding,
442
+ * preventing race conditions where validators propose blocks before the network is ready.
443
+ *
444
+ * @param nodes - Array of nodes to check for P2P connectivity
445
+ * @param expectedNodeCount - Expected number of nodes in the network (defaults to nodes.length)
446
+ * @param timeoutSeconds - Maximum time to wait for connections (default: 30 seconds)
447
+ * @param checkIntervalSeconds - How often to check connectivity (default: 0.1 seconds)
448
+ */
449
+ async waitForP2PMeshConnectivity(
450
+ nodes: AztecNodeService[],
451
+ expectedNodeCount?: number,
452
+ timeoutSeconds = 30,
453
+ checkIntervalSeconds = 0.1,
454
+ topics: TopicType[] = [TopicType.tx],
455
+ minMeshPeerCount = 1,
456
+ ) {
457
+ const nodeCount = expectedNodeCount ?? nodes.length;
458
+ const minPeerCount = nodeCount - 1;
459
+
460
+ this.logger.warn(
461
+ `Waiting for all ${nodeCount} nodes to connect to P2P mesh (at least ${minPeerCount} peers each)...`,
462
+ );
463
+
464
+ await Promise.all(
465
+ nodes.map(async (node, index) => {
466
+ const p2p = node.getP2P();
467
+ await retryUntil(
468
+ async () => {
469
+ const peers = await p2p.getPeers();
470
+ // Each node should be connected to at least N-1 other nodes
471
+ return peers.length >= minPeerCount ? true : undefined;
472
+ },
473
+ `Node ${index} to connect to at least ${minPeerCount} peers`,
474
+ timeoutSeconds,
475
+ checkIntervalSeconds,
476
+ );
477
+ }),
478
+ );
479
+
480
+ this.logger.warn('All nodes connected to P2P mesh');
481
+
482
+ // Wait for the GossipSub mesh to form for all specified topics. By default we only require at
483
+ // least 1 mesh peer per node, since GossipSub stops grafting once it reaches Dlo peers and won't
484
+ // fill the mesh to every available peer. Callers that need a proposal to reach the whole
485
+ // committee within a slot (e.g. quorum-from-genesis tests) raise `minMeshPeerCount` so the mesh
486
+ // is fully formed — a single mesh peer can leave some committee members unreached at first.
487
+ for (const topic of topics) {
488
+ this.logger.warn(`Waiting for GossipSub mesh (>= ${minMeshPeerCount} peers per node) for ${topic} topic...`);
489
+ await Promise.all(
490
+ nodes.map(async (node, index) => {
491
+ const p2p = node.getP2P();
492
+ await retryUntil(
493
+ async () => {
494
+ const meshPeers = await p2p.getGossipMeshPeerCount(topic);
495
+ this.logger.debug(`Node ${index} has ${meshPeers} gossip mesh peers for ${topic} topic`);
496
+ return meshPeers >= minMeshPeerCount ? true : undefined;
497
+ },
498
+ `Node ${index} to have >= ${minMeshPeerCount} gossip mesh peers for ${topic} topic`,
499
+ timeoutSeconds,
500
+ checkIntervalSeconds,
501
+ );
502
+ }),
503
+ );
504
+ this.logger.warn(`All nodes have >= ${minMeshPeerCount} gossip mesh peers for ${topic} topic`);
505
+ }
506
+ }
507
+
508
+ async teardown() {
509
+ await this.monitor.stop();
510
+ await tryStop(this.bootstrapNode, this.logger);
511
+ await teardown(this.context);
512
+ if (this.dataDir) {
513
+ fs.rmSync(this.dataDir, { recursive: true, force: true, maxRetries: 3 });
514
+ }
515
+ }
516
+
517
+ async getContracts(): Promise<{
518
+ rollup: RollupContract;
519
+ slasherContract: GetContractReturnType<typeof SlasherAbi, ViemClient>;
520
+ slashingProposer: SlashingProposerContract | undefined;
521
+ }> {
522
+ if (!this.ctx.deployL1ContractsValues) {
523
+ throw new Error('DeployAztecL1ContractsValues not set');
524
+ }
525
+
526
+ const rollup = new RollupContract(
527
+ this.ctx.deployL1ContractsValues!.l1Client,
528
+ this.ctx.deployL1ContractsValues!.l1ContractAddresses.rollupAddress,
529
+ );
530
+
531
+ const slasherContract = getContract({
532
+ address: getAddress((await rollup.getSlasherAddress()).toString()),
533
+ abi: SlasherAbi,
534
+ client: this.ctx.deployL1ContractsValues.l1Client,
535
+ });
536
+
537
+ // Get the actual slashing proposer from rollup
538
+ const slashingProposer = await rollup.getSlashingProposer();
539
+
540
+ return { rollup, slasherContract, slashingProposer };
541
+ }
542
+ }