@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.017a351

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 (316) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/benchmark.d.ts +76 -0
  3. package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
  4. package/dest/bench/client_flows/benchmark.js +298 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
  6. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
  7. package/dest/bench/client_flows/client_flows_benchmark.js +318 -0
  8. package/dest/bench/client_flows/config.d.ts +14 -0
  9. package/dest/bench/client_flows/config.d.ts.map +1 -0
  10. package/dest/bench/client_flows/config.js +124 -0
  11. package/dest/bench/client_flows/data_extractor.d.ts +2 -0
  12. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
  13. package/dest/bench/client_flows/data_extractor.js +79 -0
  14. package/dest/bench/utils.d.ts +16 -41
  15. package/dest/bench/utils.d.ts.map +1 -1
  16. package/dest/bench/utils.js +46 -72
  17. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +30 -20
  18. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  19. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +137 -106
  20. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +44 -33
  21. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  22. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +136 -103
  23. package/dest/e2e_deploy_contract/deploy_test.d.ts +20 -11
  24. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  25. package/dest/e2e_deploy_contract/deploy_test.js +28 -28
  26. package/dest/e2e_epochs/epochs_test.d.ts +98 -24
  27. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  28. package/dest/e2e_epochs/epochs_test.js +366 -61
  29. package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
  30. package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
  31. package/dest/e2e_fees/bridging_race.notest.js +61 -0
  32. package/dest/e2e_fees/fees_test.d.ts +42 -24
  33. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  34. package/dest/e2e_fees/fees_test.js +194 -182
  35. package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
  36. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
  37. package/dest/e2e_l1_publisher/write_json.js +56 -0
  38. package/dest/e2e_multi_validator/utils.d.ts +12 -0
  39. package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
  40. package/dest/e2e_multi_validator/utils.js +214 -0
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts +16 -16
  42. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  43. package/dest/e2e_nested_contract/nested_contract_test.js +38 -43
  44. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  45. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  46. package/dest/e2e_p2p/inactivity_slash_test.js +137 -0
  47. package/dest/e2e_p2p/p2p_network.d.ts +287 -31
  48. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  49. package/dest/e2e_p2p/p2p_network.js +281 -183
  50. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  51. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  52. package/dest/e2e_p2p/reqresp/utils.js +206 -0
  53. package/dest/e2e_p2p/shared.d.ts +73 -8
  54. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  55. package/dest/e2e_p2p/shared.js +205 -27
  56. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  57. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  58. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  59. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  60. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  61. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  62. package/dest/e2e_token_contract/token_contract_test.d.ts +30 -15
  63. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  64. package/dest/e2e_token_contract/token_contract_test.js +110 -76
  65. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  66. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  67. package/dest/fixtures/authwit_proxy.js +34 -0
  68. package/dest/fixtures/e2e_prover_test.d.ts +56 -0
  69. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  70. package/dest/fixtures/e2e_prover_test.js +267 -0
  71. package/dest/fixtures/elu_monitor.d.ts +21 -0
  72. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  73. package/dest/fixtures/elu_monitor.js +102 -0
  74. package/dest/fixtures/fixtures.d.ts +79 -8
  75. package/dest/fixtures/fixtures.d.ts.map +1 -1
  76. package/dest/fixtures/fixtures.js +76 -5
  77. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  78. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  79. package/dest/fixtures/get_acvm_config.js +3 -15
  80. package/dest/fixtures/get_bb_config.d.ts +2 -2
  81. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  82. package/dest/fixtures/get_bb_config.js +10 -17
  83. package/dest/fixtures/ha_setup.d.ts +71 -0
  84. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  85. package/dest/fixtures/ha_setup.js +116 -0
  86. package/dest/fixtures/index.d.ts +2 -1
  87. package/dest/fixtures/index.d.ts.map +1 -1
  88. package/dest/fixtures/index.js +1 -0
  89. package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
  90. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  91. package/dest/fixtures/l1_to_l2_messaging.js +45 -19
  92. package/dest/fixtures/logging.d.ts +1 -1
  93. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  94. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  95. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  96. package/dest/fixtures/setup.d.ts +272 -0
  97. package/dest/fixtures/setup.d.ts.map +1 -0
  98. package/dest/fixtures/setup.js +735 -0
  99. package/dest/fixtures/setup_p2p_test.d.ts +28 -16
  100. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  101. package/dest/fixtures/setup_p2p_test.js +103 -32
  102. package/dest/fixtures/token_utils.d.ts +10 -4
  103. package/dest/fixtures/token_utils.d.ts.map +1 -1
  104. package/dest/fixtures/token_utils.js +30 -13
  105. package/dest/fixtures/utils.d.ts +5 -153
  106. package/dest/fixtures/utils.d.ts.map +1 -1
  107. package/dest/fixtures/utils.js +4 -552
  108. package/dest/fixtures/web3signer.d.ts +5 -0
  109. package/dest/fixtures/web3signer.d.ts.map +1 -0
  110. package/dest/fixtures/web3signer.js +53 -0
  111. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  112. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  113. package/dest/fixtures/with_telemetry_utils.js +2 -2
  114. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  115. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  116. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  117. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  118. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  119. package/dest/forward-compatibility/wallet_service.js +109 -0
  120. package/dest/index.d.ts +1 -1
  121. package/dest/install_legacy_contracts.d.cts +10 -0
  122. package/dest/install_legacy_contracts.d.cts.map +1 -0
  123. package/dest/legacy-jest-resolver.d.cts +3 -0
  124. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  125. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  126. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  127. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  128. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  129. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  130. package/dest/quality_of_service/prometheus_client.js +67 -0
  131. package/dest/shared/cross_chain_test_harness.d.ts +46 -27
  132. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  133. package/dest/shared/cross_chain_test_harness.js +113 -55
  134. package/dest/shared/gas_portal_test_harness.d.ts +39 -28
  135. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  136. package/dest/shared/gas_portal_test_harness.js +64 -34
  137. package/dest/shared/index.d.ts +3 -2
  138. package/dest/shared/index.d.ts.map +1 -1
  139. package/dest/shared/index.js +1 -0
  140. package/dest/shared/jest_setup.d.ts +1 -1
  141. package/dest/shared/jest_setup.js +42 -2
  142. package/dest/shared/mock_state_view.d.ts +86 -0
  143. package/dest/shared/mock_state_view.d.ts.map +1 -0
  144. package/dest/shared/mock_state_view.js +186 -0
  145. package/dest/shared/submit-transactions.d.ts +6 -4
  146. package/dest/shared/submit-transactions.d.ts.map +1 -1
  147. package/dest/shared/submit-transactions.js +15 -16
  148. package/dest/shared/uniswap_l1_l2.d.ts +3 -25
  149. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  150. package/dest/shared/uniswap_l1_l2.js +202 -135
  151. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  152. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  153. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  154. package/dest/simulators/index.d.ts +1 -1
  155. package/dest/simulators/lending_simulator.d.ts +16 -9
  156. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  157. package/dest/simulators/lending_simulator.js +38 -27
  158. package/dest/simulators/token_simulator.d.ts +6 -3
  159. package/dest/simulators/token_simulator.d.ts.map +1 -1
  160. package/dest/simulators/token_simulator.js +12 -30
  161. package/dest/spartan/setup_test_wallets.d.ts +36 -11
  162. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  163. package/dest/spartan/setup_test_wallets.js +301 -63
  164. package/dest/spartan/tx_metrics.d.ts +102 -0
  165. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  166. package/dest/spartan/tx_metrics.js +475 -0
  167. package/dest/spartan/utils/bot.d.ts +28 -0
  168. package/dest/spartan/utils/bot.d.ts.map +1 -0
  169. package/dest/spartan/utils/bot.js +142 -0
  170. package/dest/spartan/utils/chaos.d.ts +79 -0
  171. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  172. package/dest/spartan/utils/chaos.js +142 -0
  173. package/dest/spartan/utils/clients.d.ts +39 -0
  174. package/dest/spartan/utils/clients.d.ts.map +1 -0
  175. package/dest/spartan/utils/clients.js +90 -0
  176. package/dest/spartan/utils/config.d.ts +19 -0
  177. package/dest/spartan/utils/config.d.ts.map +1 -0
  178. package/dest/spartan/utils/config.js +23 -0
  179. package/dest/spartan/utils/health.d.ts +63 -0
  180. package/dest/spartan/utils/health.d.ts.map +1 -0
  181. package/dest/spartan/utils/health.js +202 -0
  182. package/dest/spartan/utils/helm.d.ts +15 -0
  183. package/dest/spartan/utils/helm.d.ts.map +1 -0
  184. package/dest/spartan/utils/helm.js +47 -0
  185. package/dest/spartan/utils/index.d.ts +11 -0
  186. package/dest/spartan/utils/index.d.ts.map +1 -0
  187. package/dest/spartan/utils/index.js +22 -0
  188. package/dest/spartan/utils/k8s.d.ts +128 -0
  189. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  190. package/dest/spartan/utils/k8s.js +381 -0
  191. package/dest/spartan/utils/nodes.d.ts +40 -0
  192. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  193. package/dest/spartan/utils/nodes.js +461 -0
  194. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  195. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  196. package/dest/spartan/utils/pod_logs.js +74 -0
  197. package/dest/spartan/utils/scripts.d.ts +30 -0
  198. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  199. package/dest/spartan/utils/scripts.js +81 -0
  200. package/dest/spartan/utils.d.ts +2 -415
  201. package/dest/spartan/utils.d.ts.map +1 -1
  202. package/dest/spartan/utils.js +1 -445
  203. package/dest/test-wallet/test_wallet.d.ts +85 -0
  204. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  205. package/dest/test-wallet/test_wallet.js +273 -0
  206. package/dest/test-wallet/utils.d.ts +41 -0
  207. package/dest/test-wallet/utils.d.ts.map +1 -0
  208. package/dest/test-wallet/utils.js +66 -0
  209. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  210. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  211. package/dest/test-wallet/wallet_worker_script.js +53 -0
  212. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  213. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  214. package/dest/test-wallet/worker_wallet.js +155 -0
  215. package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
  216. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  217. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  218. package/package.json +79 -64
  219. package/src/bench/client_flows/benchmark.ts +382 -0
  220. package/src/bench/client_flows/client_flows_benchmark.ts +399 -0
  221. package/src/bench/client_flows/config.ts +69 -0
  222. package/src/bench/client_flows/data_extractor.ts +89 -0
  223. package/src/bench/utils.ts +49 -87
  224. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +164 -172
  225. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +194 -183
  226. package/src/e2e_deploy_contract/deploy_test.ts +42 -49
  227. package/src/e2e_epochs/epochs_test.ts +451 -93
  228. package/src/e2e_fees/bridging_race.notest.ts +74 -0
  229. package/src/e2e_fees/fees_test.ts +249 -262
  230. package/src/e2e_l1_publisher/write_json.ts +77 -0
  231. package/src/e2e_multi_validator/utils.ts +258 -0
  232. package/src/e2e_nested_contract/nested_contract_test.ts +51 -60
  233. package/src/e2e_p2p/inactivity_slash_test.ts +180 -0
  234. package/src/e2e_p2p/p2p_network.ts +391 -240
  235. package/src/e2e_p2p/reqresp/utils.ts +274 -0
  236. package/src/e2e_p2p/shared.ts +304 -39
  237. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  238. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  239. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  240. package/src/e2e_token_contract/token_contract_test.ts +140 -124
  241. package/src/fixtures/authwit_proxy.ts +54 -0
  242. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  243. package/src/fixtures/e2e_prover_test.ts +329 -0
  244. package/src/fixtures/elu_monitor.ts +126 -0
  245. package/src/fixtures/fixtures.ts +98 -7
  246. package/src/fixtures/get_acvm_config.ts +4 -12
  247. package/src/fixtures/get_bb_config.ts +19 -13
  248. package/src/fixtures/ha_setup.ts +188 -0
  249. package/src/fixtures/index.ts +1 -0
  250. package/src/fixtures/l1_to_l2_messaging.ts +56 -24
  251. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  252. package/src/fixtures/setup.ts +1056 -0
  253. package/src/fixtures/setup_p2p_test.ts +142 -54
  254. package/src/fixtures/token_utils.ts +34 -16
  255. package/src/fixtures/utils.ts +29 -820
  256. package/src/fixtures/web3signer.ts +63 -0
  257. package/src/fixtures/with_telemetry_utils.ts +2 -2
  258. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  259. package/src/forward-compatibility/wallet_service.ts +104 -0
  260. package/src/guides/up_quick_start.sh +9 -19
  261. package/src/install_legacy_contracts.cjs +75 -0
  262. package/src/legacy-jest-resolver.cjs +112 -0
  263. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
  264. package/src/quality_of_service/prometheus_client.ts +113 -0
  265. package/src/shared/cross_chain_test_harness.ts +116 -90
  266. package/src/shared/gas_portal_test_harness.ts +75 -56
  267. package/src/shared/index.ts +2 -1
  268. package/src/shared/jest_setup.ts +52 -2
  269. package/src/shared/mock_state_view.ts +188 -0
  270. package/src/shared/submit-transactions.ts +19 -20
  271. package/src/shared/uniswap_l1_l2.ts +259 -234
  272. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  273. package/src/simulators/lending_simulator.ts +43 -26
  274. package/src/simulators/token_simulator.ts +18 -34
  275. package/src/spartan/DEVELOP.md +128 -0
  276. package/src/spartan/setup_test_wallets.ts +420 -96
  277. package/src/spartan/tx_metrics.ts +434 -0
  278. package/src/spartan/utils/bot.ts +188 -0
  279. package/src/spartan/utils/chaos.ts +253 -0
  280. package/src/spartan/utils/clients.ts +100 -0
  281. package/src/spartan/utils/config.ts +29 -0
  282. package/src/spartan/utils/health.ts +255 -0
  283. package/src/spartan/utils/helm.ts +84 -0
  284. package/src/spartan/utils/index.ts +71 -0
  285. package/src/spartan/utils/k8s.ts +535 -0
  286. package/src/spartan/utils/nodes.ts +543 -0
  287. package/src/spartan/utils/pod_logs.ts +99 -0
  288. package/src/spartan/utils/scripts.ts +99 -0
  289. package/src/spartan/utils.ts +1 -582
  290. package/src/test-wallet/test_wallet.ts +376 -0
  291. package/src/test-wallet/utils.ts +108 -0
  292. package/src/test-wallet/wallet_worker_script.ts +63 -0
  293. package/src/test-wallet/worker_wallet.ts +218 -0
  294. package/src/test-wallet/worker_wallet_schema.ts +13 -0
  295. package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
  296. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  297. package/dest/e2e_prover/e2e_prover_test.js +0 -291
  298. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  299. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  300. package/dest/fixtures/setup_l1_contracts.js +0 -17
  301. package/dest/fixtures/snapshot_manager.d.ts +0 -87
  302. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  303. package/dest/fixtures/snapshot_manager.js +0 -479
  304. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  305. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  306. package/dest/sample-dapp/connect.js +0 -12
  307. package/dest/sample-dapp/contracts.js +0 -10
  308. package/dest/sample-dapp/deploy.js +0 -35
  309. package/dest/sample-dapp/index.js +0 -98
  310. package/src/e2e_prover/e2e_prover_test.ts +0 -418
  311. package/src/fixtures/setup_l1_contracts.ts +0 -27
  312. package/src/fixtures/snapshot_manager.ts +0 -617
  313. package/src/sample-dapp/connect.mjs +0 -16
  314. package/src/sample-dapp/contracts.mjs +0 -14
  315. package/src/sample-dapp/deploy.mjs +0 -40
  316. package/src/sample-dapp/index.mjs +0 -128
@@ -1,21 +1,92 @@
1
1
  export const METRICS_PORT = 4318;
2
+ /** Default fee padding applied to predicted min fees in e2e tests. */ export const DEFAULT_MIN_FEE_PADDING = 5;
3
+ /**
4
+ * Large fee padding for txs that may be mined significantly later than when they were created,
5
+ * such as cloned txs in throughput/capacity benchmarks, where fees may spike between creation and mining.
6
+ */ export const LARGE_MIN_FEE_PADDING = 15;
7
+ /**
8
+ * Fee padding used by tests running under proposer pipelining. Under pipelining the fee-asset
9
+ * price modifier evolves faster across the build/publish gap, so client-set maxFeesPerGas (sized
10
+ * for the default 5x padding) was getting bumped past by the time the tx mined a few slots later.
11
+ * Observed worst case in CI: fee evolved ~20x between PXE snapshot and inclusion, exceeding even
12
+ * LARGE_MIN_FEE_PADDING (15x).
13
+ */ export const PIPELINED_FEE_PADDING = 30;
14
+ /**
15
+ * Setup option preset that opts a test into proposer pipelining. Use with `setup()`:
16
+ *
17
+ * await setup(N, { ...PIPELINING_SETUP_OPTS, ...otherOpts });
18
+ *
19
+ * The preset sets:
20
+ * - `inboxLag: 2` so the sequencer sources L1->L2 messages from checkpoint N-1 (already sealed),
21
+ * avoiding `L1ToL2MessagesNotReadyError` when building for slot N during slot N-1.
22
+ * - `minTxsPerBlock: 0` so empty checkpoints land even when a tx arrives late in the build window
23
+ * (otherwise the chain stalls on alternating slots).
24
+ * - `aztecSlotDuration: 12` / `ethereumSlotDuration: 4` so the pipelined cycle fits inside the
25
+ * default 300s Jest hook budget. Tests that depend on the env-default 72s/12s should override.
26
+ * - `walletMinFeePadding: PIPELINED_FEE_PADDING` (30x) to absorb the wider fee evolution window.
27
+ */ export const PIPELINING_SETUP_OPTS = {
28
+ inboxLag: 2,
29
+ minTxsPerBlock: 0,
30
+ aztecSlotDuration: 12,
31
+ ethereumSlotDuration: 4,
32
+ walletMinFeePadding: PIPELINED_FEE_PADDING
33
+ };
34
+ /**
35
+ * Setup option preset that opts a test into the deterministic AutomineSequencer path.
36
+ * Use only for single-sequencer tests that don't exercise block-building or consensus
37
+ * (e.g. e2e_token, e2e_amm, e2e_authwit). Not compatible with `e2e_p2p/*`,
38
+ * `e2e_epochs/*`, `e2e_slashing/*`, `e2e_block_building`, or any multi-validator suite.
39
+ *
40
+ * await setup(N, { ...AUTOMINE_E2E_OPTS, ...otherOpts });
41
+ *
42
+ * The preset:
43
+ * - Swaps the production Sequencer for an AutomineSequencer that builds one block per
44
+ * submitted tx, publishes synchronously to L1, and owns all time control through a
45
+ * serial queue (see `sequencer-client/src/sequencer/automine/automine_sequencer.ts`).
46
+ * - Disables the validator client and AnvilTestWatcher (the AutomineSequencer needs
47
+ * neither).
48
+ * - Uses `inboxLag: 1` (synchronous) since the AutomineSequencer publishes one block per tx.
49
+ * - Switches anvil into automine mode at setup time (no interval mining); each L1 tx
50
+ * mines an L1 block immediately.
51
+ *
52
+ * Requires `aztecTargetCommitteeSize: 0`, which is the e2e default at `setup.ts:317`.
53
+ */ export const AUTOMINE_E2E_OPTS = {
54
+ useAutomineSequencer: true,
55
+ disableAnvilTestWatcher: true,
56
+ inboxLag: 1,
57
+ minTxsPerBlock: 0,
58
+ aztecSlotDuration: 12,
59
+ ethereumSlotDuration: 4,
60
+ walletMinFeePadding: PIPELINED_FEE_PADDING
61
+ };
62
+ /** Returns worst-case predicted min fees with padding applied, mirroring the BaseWallet pattern. */ export async function getPaddedMaxFeesPerGas(node, padding = DEFAULT_MIN_FEE_PADDING) {
63
+ const predicted = await node.getPredictedMinFees();
64
+ const worstCase = predicted.length > 0 ? predicted.reduce((worst, fees)=>fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst) : await node.getCurrentMinFees();
65
+ return worstCase.mul(1 + padding);
66
+ }
2
67
  export const shouldCollectMetrics = ()=>{
3
68
  if (process.env.COLLECT_METRICS) {
4
69
  return METRICS_PORT;
5
70
  }
6
71
  return undefined;
7
72
  };
73
+ /** Returns the boot node UDP port from environment variable or default value. */ export function getBootNodeUdpPort() {
74
+ return process.env.BOOT_NODE_UDP_PORT ? parseInt(process.env.BOOT_NODE_UDP_PORT, 10) : 4500;
75
+ }
76
+ /** Returns the anvil port from environment variable or default value. */ export function getAnvilPort() {
77
+ return process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT, 10) : 8545;
78
+ }
8
79
  export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
80
+ export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
9
81
  export const MNEMONIC = 'test test test test test test test test test test test junk';
10
82
  export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
11
83
  export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
12
84
  /// Common errors
13
- export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
14
- export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
85
+ export const U128_UNDERFLOW_ERROR = 'Assertion failed: attempt to subtract with overflow';
86
+ export const U128_OVERFLOW_ERROR = 'Assertion failed: attempt to add with overflow';
15
87
  export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
16
88
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
17
- export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted|Nullifier collision/;
89
+ export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
18
90
  export const NO_L1_TO_L2_MSG_ERROR = /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
19
- export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
91
+ export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state.*/;
20
92
  export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
21
- export const DEFAULT_BLOB_SINK_PORT = '5052';
@@ -1,8 +1,8 @@
1
- import type { Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
3
3
  export declare function getACVMConfig(logger: Logger): Promise<{
4
4
  acvmWorkingDirectory: string;
5
5
  acvmBinaryPath: string;
6
6
  cleanup: () => Promise<void>;
7
7
  } | undefined>;
8
- //# sourceMappingURL=get_acvm_config.d.ts.map
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2Fjdm1fY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZml4dHVyZXMvZ2V0X2Fjdm1fY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBT2xELE9BQU8sRUFBRSwwQ0FBMEMsRUFBRSxNQUFNLHVDQUF1QyxDQUFDO0FBV25HLHdCQUFzQixhQUFhLENBQUMsTUFBTSxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQ3hEO0lBQ0Usb0JBQW9CLEVBQUUsTUFBTSxDQUFDO0lBQzdCLGNBQWMsRUFBRSxNQUFNLENBQUM7SUFDdkIsT0FBTyxFQUFFLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQzlCLEdBQ0QsU0FBUyxDQUNaLENBeUJBIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAM9C,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAWnG,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CACxD;IACE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACD,SAAS,CACZ,CAkCA"}
1
+ {"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOlD,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAWnG,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CACxD;IACE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACD,SAAS,CACZ,CAyBA"}
@@ -1,5 +1,6 @@
1
1
  import { parseBooleanEnv } from '@aztec/foundation/config';
2
- import { randomBytes } from '@aztec/foundation/crypto';
2
+ import { randomBytes } from '@aztec/foundation/crypto/random';
3
+ import { tryRmDir } from '@aztec/foundation/fs';
3
4
  import { promises as fs } from 'fs';
4
5
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
5
6
  const { NOIR_RELEASE_DIR = 'noir-repo/target/release', TEMP_DIR = '/tmp', ACVM_BINARY_PATH = '', ACVM_WORKING_DIRECTORY = '', ACVM_FORCE_WASM = '' } = process.env;
@@ -18,20 +19,7 @@ export async function getACVMConfig(logger) {
18
19
  });
19
20
  logger.verbose(`Using native ACVM binary at ${acvmBinaryPath} with working directory ${acvmWorkingDirectory}`);
20
21
  const directoryToCleanup = ACVM_WORKING_DIRECTORY ? undefined : tempWorkingDirectory;
21
- const cleanup = async ()=>{
22
- if (directoryToCleanup) {
23
- try {
24
- logger.info(`Cleaning up ACVM temp directory ${directoryToCleanup}`);
25
- await fs.rm(directoryToCleanup, {
26
- recursive: true,
27
- force: true,
28
- maxRetries: 3
29
- });
30
- } catch (err) {
31
- logger.warn(`Failed to delete ACVM temp directory at ${directoryToCleanup}: ${err}`);
32
- }
33
- }
34
- };
22
+ const cleanup = ()=>tryRmDir(directoryToCleanup, logger);
35
23
  return {
36
24
  acvmWorkingDirectory,
37
25
  acvmBinaryPath,
@@ -1,6 +1,6 @@
1
- import { type Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  import type { BBConfig } from '@aztec/bb-prover';
3
3
  export declare const getBBConfig: (logger: Logger) => Promise<(BBConfig & {
4
4
  cleanup: () => Promise<void>;
5
5
  }) | undefined>;
6
- //# sourceMappingURL=get_bb_config.d.ts.map
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2JiX2NvbmZpZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpeHR1cmVzL2dldF9iYl9jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDbEQsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFvQmpELGVBQU8sTUFBTSxXQUFXOztlQXNDdkIsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAcjD,eAAO,MAAM,WAAW,WACd,MAAM,KACb,QAAQ,CAAC,QAAQ,GAAG;IAAE,OAAO,EAAE,MAAM,QAAQ,IAAI,CAAC,CAAA;CAAE,CAAC,GAAG,SAAS,CAoCnE,CAAC"}
1
+ {"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAoBjD,eAAO,MAAM,WAAW;;eAsCvB,CAAC"}
@@ -1,11 +1,12 @@
1
- import { fileURLToPath } from '@aztec/aztec.js';
1
+ import { tryRmDir } from '@aztec/foundation/fs';
2
2
  import fs from 'node:fs/promises';
3
3
  import { tmpdir } from 'node:os';
4
4
  import path from 'path';
5
- const { BB_RELEASE_DIR = 'barretenberg/cpp/build/bin', BB_BINARY_PATH, BB_SKIP_CLEANUP = '', TEMP_DIR = tmpdir(), BB_WORKING_DIRECTORY = '' } = process.env;
5
+ import { fileURLToPath } from 'url';
6
+ const { BB_RELEASE_DIR = 'barretenberg/cpp/build/bin', BB_BINARY_PATH, BB_SKIP_CLEANUP = '', TEMP_DIR = tmpdir(), BB_WORKING_DIRECTORY = '', BB_NUM_IVC_VERIFIERS = '8', BB_IVC_CONCURRENCY = '1', BB_CHONK_VERIFY_MAX_BATCH = '16', BB_CHONK_VERIFY_BATCH_CONCURRENCY = '6' } = process.env;
6
7
  export const getBBConfig = async (logger)=>{
7
8
  try {
8
- const bbBinaryPath = BB_BINARY_PATH ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb');
9
+ const bbBinaryPath = BB_BINARY_PATH ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb-avm');
9
10
  await fs.access(bbBinaryPath, fs.constants.R_OK);
10
11
  let bbWorkingDirectory;
11
12
  let directoryToCleanup;
@@ -22,24 +23,16 @@ export const getBBConfig = async (logger)=>{
22
23
  '1',
23
24
  'true'
24
25
  ].includes(BB_SKIP_CLEANUP);
25
- const cleanup = async ()=>{
26
- if (directoryToCleanup && !bbSkipCleanup) {
27
- try {
28
- await fs.rm(directoryToCleanup, {
29
- recursive: true,
30
- force: true,
31
- maxRetries: 3
32
- });
33
- } catch (err) {
34
- logger.warn(`Failed to delete bb working directory at ${directoryToCleanup}: ${err}`);
35
- }
36
- }
37
- };
26
+ const cleanup = bbSkipCleanup ? ()=>Promise.resolve() : ()=>tryRmDir(directoryToCleanup);
38
27
  return {
39
28
  bbSkipCleanup,
40
29
  bbBinaryPath,
41
30
  bbWorkingDirectory,
42
- cleanup
31
+ cleanup,
32
+ numConcurrentIVCVerifiers: Number(BB_NUM_IVC_VERIFIERS),
33
+ bbIVCConcurrency: Number(BB_IVC_CONCURRENCY),
34
+ bbChonkVerifyMaxBatch: Number(BB_CHONK_VERIFY_MAX_BATCH),
35
+ bbChonkVerifyConcurrency: Number(BB_CHONK_VERIFY_BATCH_CONCURRENCY)
43
36
  };
44
37
  } catch (err) {
45
38
  logger.error(`Native BB not available, error: ${err}`);
@@ -0,0 +1,71 @@
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
+ import type { Logger } from '@aztec/aztec.js/log';
3
+ import { SecretValue } from '@aztec/foundation/config';
4
+ import { Pool } from 'pg';
5
+ /**
6
+ * Configuration for HA database connection
7
+ */
8
+ export interface HADatabaseConfig {
9
+ /** PostgreSQL connection URL */
10
+ databaseUrl: SecretValue<string>;
11
+ /** Node ID for HA coordination */
12
+ nodeId: string;
13
+ /** Enable HA signing */
14
+ haSigningEnabled: boolean;
15
+ /** Polling interval in ms */
16
+ pollingIntervalMs: number;
17
+ /** Signing timeout in ms */
18
+ signingTimeoutMs: number;
19
+ /** Max stuck duties age in ms */
20
+ maxStuckDutiesAgeMs: number;
21
+ }
22
+ /**
23
+ * Get database configuration from environment variables
24
+ */
25
+ export declare function createHADatabaseConfig(nodeId: string): HADatabaseConfig;
26
+ /**
27
+ * Setup PostgreSQL database connection pool for HA tests
28
+ *
29
+ * Note: Database migrations should be run separately before starting tests,
30
+ * either via docker-compose entrypoint or manually with: aztec migrate-ha-db up
31
+ */
32
+ export declare function setupHADatabase(databaseUrl: string, logger?: Logger): Pool;
33
+ /**
34
+ * Clean up HA database - drop all tables
35
+ * Use this between tests to ensure clean state
36
+ */
37
+ export declare function cleanupHADatabase(pool: Pool, logger?: Logger): Promise<void>;
38
+ /**
39
+ * Query validator duties from the database
40
+ */
41
+ export declare function getValidatorDuties(pool: Pool, slot: bigint, dutyType?: 'ATTESTATION' | 'BLOCK_PROPOSAL' | 'GOVERNANCE_VOTE' | 'SLASHING_VOTE'): Promise<Array<{
42
+ slot: string;
43
+ dutyType: string;
44
+ validatorAddress: string;
45
+ nodeId: string;
46
+ startedAt: Date;
47
+ completedAt: Date | undefined;
48
+ }>>;
49
+ /**
50
+ * Convert private keys to Ethereum addresses
51
+ */
52
+ export declare function getAddressesFromPrivateKeys(privateKeys: `0x${string}`[]): string[];
53
+ /**
54
+ * Create initial validators from private keys for L1 contract deployment
55
+ */
56
+ export declare function createInitialValidatorsFromPrivateKeys(attesterPrivateKeys: `0x${string}`[]): Array<{
57
+ attester: EthAddress;
58
+ withdrawer: EthAddress;
59
+ privateKey: `0x${string}`;
60
+ bn254SecretKey: SecretValue<bigint>;
61
+ }>;
62
+ /**
63
+ * Verify no duplicate attestations per validator (HA coordination check)
64
+ * Groups duties by validator address and verifies each validator attested exactly once
65
+ */
66
+ export declare function verifyNoDuplicateAttestations(attestationDuties: Array<{
67
+ validatorAddress: string;
68
+ nodeId: string;
69
+ completedAt: Date | undefined;
70
+ }>, logger?: Logger): Map<string, typeof attestationDuties>;
71
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFfc2V0dXAuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maXh0dXJlcy9oYV9zZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFdkQsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDbEQsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRXZELE9BQU8sRUFBRSxJQUFJLEVBQUUsTUFBTSxJQUFJLENBQUM7QUFHMUI7O0dBRUc7QUFDSCxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLGdDQUFnQztJQUNoQyxXQUFXLEVBQUUsV0FBVyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ2pDLGtDQUFrQztJQUNsQyxNQUFNLEVBQUUsTUFBTSxDQUFDO0lBQ2Ysd0JBQXdCO0lBQ3hCLGdCQUFnQixFQUFFLE9BQU8sQ0FBQztJQUMxQiw2QkFBNkI7SUFDN0IsaUJBQWlCLEVBQUUsTUFBTSxDQUFDO0lBQzFCLDRCQUE0QjtJQUM1QixnQkFBZ0IsRUFBRSxNQUFNLENBQUM7SUFDekIsaUNBQWlDO0lBQ2pDLG1CQUFtQixFQUFFLE1BQU0sQ0FBQztDQUM3QjtBQUVEOztHQ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AW,EAAE,IAAI,GAAG,SAAS,CAAC;CAC/B,CAAC,EACF,MAAM,CAAC,EAAE,MAAM,GACd,GAAG,CAAC,MAAM,EAAE,OAAO,iBAAiB,CAAC,CAmBvC"}
@@ -0,0 +1,116 @@
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
+ import { SecretValue } from '@aztec/foundation/config';
4
+ import { Pool } from 'pg';
5
+ import { privateKeyToAccount } from 'viem/accounts';
6
+ /**
7
+ * Get database configuration from environment variables
8
+ */ export function createHADatabaseConfig(nodeId) {
9
+ const databaseUrl = new SecretValue(process.env.DATABASE_URL || 'postgresql://aztec:aztec@localhost:5432/aztec_ha_test');
10
+ return {
11
+ databaseUrl,
12
+ nodeId,
13
+ haSigningEnabled: true,
14
+ pollingIntervalMs: 100,
15
+ signingTimeoutMs: 3000,
16
+ maxStuckDutiesAgeMs: 72000
17
+ };
18
+ }
19
+ /**
20
+ * Setup PostgreSQL database connection pool for HA tests
21
+ *
22
+ * Note: Database migrations should be run separately before starting tests,
23
+ * either via docker-compose entrypoint or manually with: aztec migrate-ha-db up
24
+ */ export function setupHADatabase(databaseUrl, logger) {
25
+ try {
26
+ // Create connection pool for test usage
27
+ // Migrations are already run by docker-compose entrypoint before tests start
28
+ const pool = new Pool({
29
+ connectionString: databaseUrl
30
+ });
31
+ logger?.info('Connected to HA database (migrations should already be applied)');
32
+ return pool;
33
+ } catch (error) {
34
+ logger?.error(`Failed to connect to HA database: ${error}`);
35
+ throw error;
36
+ }
37
+ }
38
+ /**
39
+ * Clean up HA database - drop all tables
40
+ * Use this between tests to ensure clean state
41
+ */ export async function cleanupHADatabase(pool, logger) {
42
+ try {
43
+ // Drop all HA tables
44
+ await pool.query('DROP TABLE IF EXISTS validator_duties CASCADE');
45
+ await pool.query('DROP TABLE IF EXISTS schema_version CASCADE');
46
+ // Drop migration tracking table (node-pg-migrate uses 'pgmigrations' by default)
47
+ // This ensures migrations will run fresh on next startup
48
+ await pool.query('DROP TABLE IF EXISTS pgmigrations CASCADE');
49
+ logger?.info('HA database cleaned up successfully');
50
+ } catch (error) {
51
+ logger?.error(`Failed to cleanup HA database: ${error}`);
52
+ throw error;
53
+ }
54
+ }
55
+ /**
56
+ * Query validator duties from the database
57
+ */ export async function getValidatorDuties(pool, slot, dutyType) {
58
+ const query = dutyType ? 'SELECT slot, duty_type, validator_address, node_id, started_at, completed_at FROM validator_duties WHERE slot = $1 AND duty_type = $2 ORDER BY started_at' : 'SELECT slot, duty_type, validator_address, node_id, started_at, completed_at FROM validator_duties WHERE slot = $1 ORDER BY started_at';
59
+ const params = dutyType ? [
60
+ slot.toString(),
61
+ dutyType
62
+ ] : [
63
+ slot.toString()
64
+ ];
65
+ const result = await pool.query(query, params);
66
+ return result.rows.map((row)=>({
67
+ slot: row.slot,
68
+ dutyType: row.duty_type,
69
+ validatorAddress: row.validator_address,
70
+ nodeId: row.node_id,
71
+ startedAt: row.started_at,
72
+ completedAt: row.completed_at
73
+ }));
74
+ }
75
+ /**
76
+ * Convert private keys to Ethereum addresses
77
+ */ export function getAddressesFromPrivateKeys(privateKeys) {
78
+ return privateKeys.map((pk)=>{
79
+ const account = privateKeyToAccount(pk);
80
+ return account.address;
81
+ });
82
+ }
83
+ /**
84
+ * Create initial validators from private keys for L1 contract deployment
85
+ */ export function createInitialValidatorsFromPrivateKeys(attesterPrivateKeys) {
86
+ return attesterPrivateKeys.map((pk)=>{
87
+ const account = privateKeyToAccount(pk);
88
+ return {
89
+ attester: EthAddress.fromString(account.address),
90
+ withdrawer: EthAddress.fromString(account.address),
91
+ privateKey: pk,
92
+ bn254SecretKey: new SecretValue(Fr.random().toBigInt())
93
+ };
94
+ });
95
+ }
96
+ /**
97
+ * Verify no duplicate attestations per validator (HA coordination check)
98
+ * Groups duties by validator address and verifies each validator attested exactly once
99
+ */ export function verifyNoDuplicateAttestations(attestationDuties, logger) {
100
+ const dutiesByValidator = new Map();
101
+ for (const duty of attestationDuties){
102
+ const existing = dutiesByValidator.get(duty.validatorAddress) || [];
103
+ existing.push(duty);
104
+ dutiesByValidator.set(duty.validatorAddress, existing);
105
+ }
106
+ for (const [validatorAddress, validatorDuties] of dutiesByValidator.entries()){
107
+ if (validatorDuties.length !== 1) {
108
+ throw new Error(`Validator ${validatorAddress} attested ${validatorDuties.length} times (expected exactly once)`);
109
+ }
110
+ if (!validatorDuties[0].completedAt) {
111
+ throw new Error(`Validator ${validatorAddress} attestation duty not completed`);
112
+ }
113
+ logger?.info(`Validator ${validatorAddress} attested once via node ${validatorDuties[0].nodeId}`);
114
+ }
115
+ return dutiesByValidator;
116
+ }
@@ -1,6 +1,7 @@
1
1
  export * from './fixtures.js';
2
+ export * from './ha_setup.js';
2
3
  export * from './logging.js';
3
4
  export * from './utils.js';
4
5
  export * from './token_utils.js';
5
6
  export * from './with_telemetry_utils.js';
6
- //# sourceMappingURL=index.d.ts.map
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maXh0dXJlcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGVBQWUsQ0FBQztBQUM5QixjQUFjLGVBQWUsQ0FBQztBQUM5QixjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsMkJBQTJCLENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './fixtures.js';
2
+ export * from './ha_setup.js';
2
3
  export * from './logging.js';
3
4
  export * from './utils.js';
4
5
  export * from './token_utils.js';
@@ -1,13 +1,17 @@
1
- import type { L1ContractAddresses, ViemPublicClient, ViemWalletClient } from '@aztec/ethereum';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
2
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
5
  export declare function sendL1ToL2Message(message: {
5
6
  recipient: AztecAddress;
6
7
  content: Fr;
7
8
  secretHash: Fr;
8
9
  }, ctx: {
9
- walletClient: ViemWalletClient;
10
- publicClient: ViemPublicClient;
11
- l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress'>;
12
- }): Promise<Fr[]>;
13
- //# sourceMappingURL=l1_to_l2_messaging.d.ts.map
10
+ l1Client: ExtendedViemWalletClient;
11
+ l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
12
+ }): Promise<{
13
+ msgHash: Fr;
14
+ globalLeafIndex: Fr;
15
+ txReceipt: import("viem").TransactionReceipt;
16
+ }>;
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdG9fbDJfbWVzc2FnaW5nLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZml4dHVyZXMvbDFfdG9fbDJfbWVzc2FnaW5nLnRzIl0sIm5hbWVzIjpbXSwibW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mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;CAChE,iBAmCF"}
1
+ {"version":3,"file":"l1_to_l2_messaging.d.ts","sourceRoot":"","sources":["../../src/fixtures/l1_to_l2_messaging.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,wBAAsB,iBAAiB,CACrC,OAAO,EAAE;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;IAAC,UAAU,EAAE,EAAE,CAAA;CAAE,EACjE,GAAG,EAAE;IACH,QAAQ,EAAE,wBAAwB,CAAC;IACnC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC;CAClF;;;;GAgEF"}
@@ -1,15 +1,18 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { RollupContract } from '@aztec/ethereum/contracts';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { tryJsonStringify } from '@aztec/foundation/json-rpc';
2
4
  import { InboxAbi } from '@aztec/l1-artifacts';
3
- import { expect } from '@jest/globals';
4
5
  import { decodeEventLog, getContract } from 'viem';
6
+ import { getLogger } from './utils.js';
5
7
  export async function sendL1ToL2Message(message, ctx) {
8
+ const logger = getLogger();
6
9
  const inbox = getContract({
7
10
  address: ctx.l1ContractAddresses.inboxAddress.toString(),
8
11
  abi: InboxAbi,
9
- client: ctx.walletClient
12
+ client: ctx.l1Client
10
13
  });
11
14
  const { recipient, content, secretHash } = message;
12
- const version = 1;
15
+ const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
13
16
  // We inject the message to Inbox
14
17
  const txHash = await inbox.write.sendL2Message([
15
18
  {
@@ -18,24 +21,47 @@ export async function sendL1ToL2Message(message, ctx) {
18
21
  },
19
22
  content.toString(),
20
23
  secretHash.toString()
21
- ]);
24
+ ], {
25
+ gas: 1_000_000n
26
+ });
27
+ logger.info(`L1 to L2 message sent in tx ${txHash}`);
22
28
  // We check that the message was correctly injected by checking the emitted event
23
- const txReceipt = await ctx.publicClient.waitForTransactionReceipt({
29
+ const txReceipt = await ctx.l1Client.waitForTransactionReceipt({
24
30
  hash: txHash
25
31
  });
26
- // Exactly 1 event should be emitted in the transaction
27
- expect(txReceipt.logs.length).toBe(1);
28
- // We decode the event and get leaf out of it
29
- const messageSentLog = txReceipt.logs[0];
30
- const topics = decodeEventLog({
31
- abi: InboxAbi,
32
- data: messageSentLog.data,
33
- topics: messageSentLog.topics
34
- });
32
+ if (txReceipt.status !== 'success') {
33
+ throw new Error(`L1 to L2 message failed to be sent in tx ${txHash}. Status: ${txReceipt.status}`);
34
+ }
35
+ logger.info(`L1 to L2 message receipt retrieved for tx ${txReceipt.transactionHash}`, txReceipt);
36
+ if (txReceipt.transactionHash !== txHash) {
37
+ throw new Error(`Receipt transaction hash mismatch: ${txReceipt.transactionHash} !== ${txHash}`);
38
+ }
39
+ // Filter for MessageSent events from the Inbox contract by trying to decode each log
40
+ const messageSentLogs = txReceipt.logs.filter((log)=>log.address.toLowerCase() === ctx.l1ContractAddresses.inboxAddress.toString().toLowerCase()).map((log)=>{
41
+ try {
42
+ const decoded = decodeEventLog({
43
+ abi: InboxAbi,
44
+ data: log.data,
45
+ topics: log.topics
46
+ });
47
+ return {
48
+ log,
49
+ decoded
50
+ };
51
+ } catch {
52
+ return null; // Not a decodable event from this ABI
53
+ }
54
+ }).filter((item)=>item !== null && item.decoded.eventName === 'MessageSent');
55
+ if (messageSentLogs.length !== 1) {
56
+ throw new Error(`Wrong number of MessageSent logs found in ${txHash} transaction (got ${messageSentLogs.length} expected 1)\n${tryJsonStringify(messageSentLogs.map((item)=>item.log))}`);
57
+ }
58
+ // We already have the decoded event
59
+ const topics = messageSentLogs[0].decoded;
35
60
  const receivedMsgHash = topics.args.hash;
36
61
  const receivedGlobalLeafIndex = topics.args.index;
37
- return [
38
- Fr.fromHexString(receivedMsgHash),
39
- new Fr(receivedGlobalLeafIndex)
40
- ];
62
+ return {
63
+ msgHash: Fr.fromHexString(receivedMsgHash),
64
+ globalLeafIndex: new Fr(receivedGlobalLeafIndex),
65
+ txReceipt
66
+ };
41
67
  }
@@ -5,4 +5,4 @@ export declare function isMetricsLoggingRequested(): boolean;
5
5
  * Idempotent and automatically called by `setup` if CI or BENCHMARK env vars are set.
6
6
  */
7
7
  export declare function setupMetricsLogger(filename: string): void;
8
- //# sourceMappingURL=logging.d.ts.map
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2luZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpeHR1cmVzL2xvZ2dpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0Esd0dBQXdHO0FBQ3hHLHdCQUFnQix5QkFBeUIsWUFFeEM7QUFFRDs7O0dBR0c7QUFDSCx3QkFBZ0Isa0JBQWtCLENBQUMsUUFBUSxFQUFFLE1BQU0sUUFPbEQifQ==
@@ -0,0 +1,25 @@
1
+ import { DefaultAccountContract } from '@aztec/accounts/defaults';
2
+ import type { ContractArtifact } from '@aztec/aztec.js/abi';
3
+ import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
4
+ import type { CompleteAddress } from '@aztec/aztec.js/addresses';
5
+ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
6
+ /**
7
+ * The private key that matches the hardcoded public key in the SchnorrHardcodedAccountContract.
8
+ * The corresponding public key is baked into the Noir contract as a global constant.
9
+ */
10
+ export declare const SCHNORR_HARDCODED_PRIVATE_KEY: import("@aztec/aztec.js/fields").Fq;
11
+ /**
12
+ * Account contract backed by the SchnorrHardcodedAccount Noir contract.
13
+ * This contract verifies Schnorr signatures against a public key that is hardcoded
14
+ * in the contract artifact (not stored in a note), so it does not require on-chain
15
+ * deployment or initialization. Useful for tests that need a working account without
16
+ * mining any blocks.
17
+ */
18
+ export declare class SchnorrHardcodedKeyAccountContract extends DefaultAccountContract {
19
+ private privateKey;
20
+ constructor(privateKey?: GrumpkinScalar);
21
+ getContractArtifact(): Promise<ContractArtifact>;
22
+ getInitializationFunctionAndArgs(): Promise<undefined>;
23
+ getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider;
24
+ }
25
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nobm9ycl9oYXJkY29kZWRfYWNjb3VudF9jb250cmFjdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpeHR1cmVzL3NjaG5vcnJfaGFyZGNvZGVkX2FjY291bnRfY29udHJhY3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBSWpFLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUduRTs7O0dBR0c7QUFDSCxlQUFPLE1BQU0sNkJBQTZCLHFDQUV6QyxDQUFDO0FBRUY7Ozs7OztHQU1HO0FBQ0gscUJBQWEsa0NBQW1DLFNBQVEsc0JBQXNCO0lBQ2hFLE9BQU8sQ0FBQyxVQUFVO0lBQTlCLFlBQW9CLFVBQVUsR0FBRSxjQUE4QyxFQUU3RTtJQUVRLG1CQUFtQixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUV4RDtJQUVELGdDQUFnQyx1QkFFL0I7SUFFRCxzQkFBc0IsQ0FBQyxRQUFRLEVBQUUsZUFBZSxHQUFHLG1CQUFtQixDQVNyRTtDQUNGIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schnorr_hardcoded_account_contract.d.ts","sourceRoot":"","sources":["../../src/fixtures/schnorr_hardcoded_account_contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE;;;GAGG;AACH,eAAO,MAAM,6BAA6B,qCAEzC,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,kCAAmC,SAAQ,sBAAsB;IAChE,OAAO,CAAC,UAAU;IAA9B,YAAoB,UAAU,GAAE,cAA8C,EAE7E;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;IAED,gCAAgC,uBAE/B;IAED,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB,CASrE;CACF"}
@@ -0,0 +1,37 @@
1
+ import { DefaultAccountContract } from '@aztec/accounts/defaults';
2
+ import { AuthWitness } from '@aztec/aztec.js/authorization';
3
+ import { Schnorr } from '@aztec/foundation/crypto/schnorr';
4
+ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
5
+ import { SchnorrHardcodedAccountContractArtifact } from '@aztec/noir-contracts.js/SchnorrHardcodedAccount';
6
+ /**
7
+ * The private key that matches the hardcoded public key in the SchnorrHardcodedAccountContract.
8
+ * The corresponding public key is baked into the Noir contract as a global constant.
9
+ */ export const SCHNORR_HARDCODED_PRIVATE_KEY = GrumpkinScalar.fromHexString('0xd35d743ac0dfe3d6dbe6be8c877cb524a00ab1e3d52d7bada095dfc8894ccfa');
10
+ /**
11
+ * Account contract backed by the SchnorrHardcodedAccount Noir contract.
12
+ * This contract verifies Schnorr signatures against a public key that is hardcoded
13
+ * in the contract artifact (not stored in a note), so it does not require on-chain
14
+ * deployment or initialization. Useful for tests that need a working account without
15
+ * mining any blocks.
16
+ */ export class SchnorrHardcodedKeyAccountContract extends DefaultAccountContract {
17
+ privateKey;
18
+ constructor(privateKey = SCHNORR_HARDCODED_PRIVATE_KEY){
19
+ super(), this.privateKey = privateKey;
20
+ }
21
+ getContractArtifact() {
22
+ return Promise.resolve(SchnorrHardcodedAccountContractArtifact);
23
+ }
24
+ getInitializationFunctionAndArgs() {
25
+ return Promise.resolve(undefined);
26
+ }
27
+ getAuthWitnessProvider(_address) {
28
+ const privateKey = this.privateKey;
29
+ return {
30
+ async createAuthWit (messageHash) {
31
+ const signer = new Schnorr();
32
+ const signature = await signer.constructSignature(messageHash, privateKey);
33
+ return new AuthWitness(messageHash, signature.toLimbFields());
34
+ }
35
+ };
36
+ }
37
+ }