@aztec/end-to-end 0.0.1-commit.3469e52 → 0.0.1-commit.350e0a4d

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 (362) 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/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +50 -54
  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/{e2e_token_contract → automine/token}/token_contract_test.js +44 -49
  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 +15 -1
  24. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  25. package/dest/bench/client_flows/benchmark.js +19 -0
  26. package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
  27. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  28. package/dest/bench/client_flows/client_flows_benchmark.js +66 -42
  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.js +1 -0
  33. package/dest/bench/utils.d.ts +7 -6
  34. package/dest/bench/utils.d.ts.map +1 -1
  35. package/dest/bench/utils.js +108 -12
  36. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  37. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  38. package/dest/composed/ha/ha_full_setup.js +383 -0
  39. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  40. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  41. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  42. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  43. package/dest/fixtures/authwit_proxy.js +34 -0
  44. package/dest/fixtures/e2e_prover_test.d.ts +18 -14
  45. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  46. package/dest/fixtures/e2e_prover_test.js +85 -74
  47. package/dest/fixtures/elu_monitor.d.ts +21 -0
  48. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  49. package/dest/fixtures/elu_monitor.js +102 -0
  50. package/dest/fixtures/fixtures.d.ts +82 -1
  51. package/dest/fixtures/fixtures.d.ts.map +1 -1
  52. package/dest/fixtures/fixtures.js +84 -0
  53. package/dest/fixtures/get_bb_config.d.ts +1 -1
  54. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  55. package/dest/fixtures/get_bb_config.js +5 -5
  56. package/dest/fixtures/ha_setup.d.ts +71 -0
  57. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  58. package/dest/fixtures/ha_setup.js +119 -0
  59. package/dest/fixtures/index.d.ts +3 -1
  60. package/dest/fixtures/index.d.ts.map +1 -1
  61. package/dest/fixtures/index.js +2 -0
  62. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  63. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  64. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  65. package/dest/fixtures/setup.d.ts +113 -60
  66. package/dest/fixtures/setup.d.ts.map +1 -1
  67. package/dest/fixtures/setup.js +330 -326
  68. package/dest/fixtures/setup_p2p_test.d.ts +22 -11
  69. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  70. package/dest/fixtures/setup_p2p_test.js +46 -35
  71. package/dest/fixtures/timing.d.ts +42 -0
  72. package/dest/fixtures/timing.d.ts.map +1 -0
  73. package/dest/fixtures/timing.js +72 -0
  74. package/dest/fixtures/token_utils.d.ts +22 -4
  75. package/dest/fixtures/token_utils.d.ts.map +1 -1
  76. package/dest/fixtures/token_utils.js +28 -7
  77. package/dest/fixtures/utils.d.ts +2 -2
  78. package/dest/fixtures/utils.d.ts.map +1 -1
  79. package/dest/fixtures/utils.js +1 -1
  80. package/dest/fixtures/wait_helpers.d.ts +135 -0
  81. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  82. package/dest/fixtures/wait_helpers.js +154 -0
  83. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  84. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  85. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  86. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  87. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  88. package/dest/forward-compatibility/wallet_service.js +109 -0
  89. package/dest/install_legacy_contracts.d.cts +10 -0
  90. package/dest/install_legacy_contracts.d.cts.map +1 -0
  91. package/dest/legacy-jest-resolver.d.cts +3 -0
  92. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  93. package/dest/multi-node/block-production/setup.d.ts +97 -0
  94. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  95. package/dest/multi-node/block-production/setup.js +158 -0
  96. package/dest/multi-node/governance/setup.d.ts +67 -0
  97. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  98. package/dest/multi-node/governance/setup.js +126 -0
  99. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  100. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  101. package/dest/multi-node/multi_node_test_context.js +347 -0
  102. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  103. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  104. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  105. package/dest/multi-node/slashing/setup.d.ts +167 -0
  106. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  107. package/dest/multi-node/slashing/setup.js +275 -0
  108. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +22 -12
  109. package/dest/p2p/p2p_network.d.ts.map +1 -0
  110. package/dest/{e2e_p2p → p2p}/p2p_network.js +99 -35
  111. package/dest/p2p/reqresp/utils.d.ts +19 -0
  112. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  113. package/dest/p2p/reqresp/utils.js +193 -0
  114. package/dest/p2p/shared.d.ts +72 -0
  115. package/dest/p2p/shared.d.ts.map +1 -0
  116. package/dest/p2p/shared.js +212 -0
  117. package/dest/shared/cross_chain_test_harness.d.ts +8 -7
  118. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  119. package/dest/shared/cross_chain_test_harness.js +44 -39
  120. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  121. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  122. package/dest/shared/gas_portal_test_harness.js +27 -15
  123. package/dest/shared/index.d.ts +2 -1
  124. package/dest/shared/index.d.ts.map +1 -1
  125. package/dest/shared/index.js +1 -0
  126. package/dest/shared/jest_setup.js +41 -1
  127. package/dest/shared/mock_state_view.d.ts +86 -0
  128. package/dest/shared/mock_state_view.d.ts.map +1 -0
  129. package/dest/shared/mock_state_view.js +186 -0
  130. package/dest/shared/submit-transactions.d.ts +4 -4
  131. package/dest/shared/submit-transactions.d.ts.map +1 -1
  132. package/dest/shared/submit-transactions.js +19 -14
  133. package/dest/shared/timing_env.d.js +5 -0
  134. package/dest/shared/timing_env.js +365 -0
  135. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  136. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  137. package/dest/shared/uniswap_l1_l2.js +67 -55
  138. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  139. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  140. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  141. package/dest/simulators/lending_simulator.d.ts +10 -3
  142. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  143. package/dest/simulators/lending_simulator.js +29 -17
  144. package/dest/simulators/token_simulator.d.ts +1 -1
  145. package/dest/simulators/token_simulator.d.ts.map +1 -1
  146. package/dest/simulators/token_simulator.js +3 -24
  147. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  148. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  149. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  150. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  151. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  152. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  153. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  154. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  155. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +18 -5
  156. package/dest/single-node/fees/fees_test.d.ts +93 -0
  157. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  158. package/dest/{e2e_fees → single-node/fees}/fees_test.js +96 -70
  159. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  160. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  161. package/dest/single-node/l1-reorgs/setup.js +57 -0
  162. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  163. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  164. package/dest/single-node/partial-proofs/setup.js +5 -0
  165. package/dest/single-node/proving/setup.d.ts +5 -0
  166. package/dest/single-node/proving/setup.d.ts.map +1 -0
  167. package/dest/single-node/proving/setup.js +5 -0
  168. package/dest/single-node/recovery/setup.d.ts +5 -0
  169. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  170. package/dest/single-node/recovery/setup.js +5 -0
  171. package/dest/single-node/setup.d.ts +49 -0
  172. package/dest/single-node/setup.d.ts.map +1 -0
  173. package/dest/single-node/setup.js +56 -0
  174. package/dest/single-node/single_node_test_context.d.ts +360 -0
  175. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  176. package/dest/single-node/single_node_test_context.js +833 -0
  177. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  178. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  179. package/dest/spartan/setup_test_wallets.js +147 -43
  180. package/dest/spartan/tx_metrics.d.ts +64 -5
  181. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  182. package/dest/spartan/tx_metrics.js +280 -21
  183. package/dest/spartan/utils/bot.d.ts +28 -0
  184. package/dest/spartan/utils/bot.d.ts.map +1 -0
  185. package/dest/spartan/utils/bot.js +142 -0
  186. package/dest/spartan/utils/chaos.d.ts +79 -0
  187. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  188. package/dest/spartan/utils/chaos.js +142 -0
  189. package/dest/spartan/utils/clients.d.ts +39 -0
  190. package/dest/spartan/utils/clients.d.ts.map +1 -0
  191. package/dest/spartan/utils/clients.js +90 -0
  192. package/dest/spartan/utils/config.d.ts +19 -0
  193. package/dest/spartan/utils/config.d.ts.map +1 -0
  194. package/dest/spartan/utils/config.js +23 -0
  195. package/dest/spartan/utils/health.d.ts +63 -0
  196. package/dest/spartan/utils/health.d.ts.map +1 -0
  197. package/dest/spartan/utils/health.js +202 -0
  198. package/dest/spartan/utils/helm.d.ts +15 -0
  199. package/dest/spartan/utils/helm.d.ts.map +1 -0
  200. package/dest/spartan/utils/helm.js +47 -0
  201. package/dest/spartan/utils/index.d.ts +11 -0
  202. package/dest/spartan/utils/index.d.ts.map +1 -0
  203. package/dest/spartan/utils/index.js +22 -0
  204. package/dest/spartan/utils/k8s.d.ts +128 -0
  205. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  206. package/dest/spartan/utils/k8s.js +381 -0
  207. package/dest/spartan/utils/nodes.d.ts +40 -0
  208. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  209. package/dest/spartan/utils/nodes.js +461 -0
  210. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  211. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  212. package/dest/spartan/utils/pod_logs.js +74 -0
  213. package/dest/spartan/utils/scripts.d.ts +30 -0
  214. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  215. package/dest/spartan/utils/scripts.js +81 -0
  216. package/dest/spartan/utils.d.ts +2 -260
  217. package/dest/spartan/utils.d.ts.map +1 -1
  218. package/dest/spartan/utils.js +1 -942
  219. package/dest/test-wallet/test_wallet.d.ts +105 -0
  220. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  221. package/dest/test-wallet/test_wallet.js +323 -0
  222. package/dest/test-wallet/utils.d.ts +76 -0
  223. package/dest/test-wallet/utils.d.ts.map +1 -0
  224. package/dest/test-wallet/utils.js +126 -0
  225. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  226. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  227. package/dest/test-wallet/wallet_worker_script.js +56 -0
  228. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  229. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  230. package/dest/test-wallet/worker_wallet.js +155 -0
  231. package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
  232. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  233. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  234. package/package.json +53 -46
  235. package/src/automine/README.md +60 -0
  236. package/src/automine/automine_test_context.ts +153 -0
  237. package/src/automine/contracts/fixtures/storage_proof.json +915 -0
  238. package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
  239. package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
  240. package/src/automine/delivery/onchain_delivery_harness.ts +177 -0
  241. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +56 -69
  242. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +51 -59
  243. package/src/automine/token/token_test_helpers.ts +138 -0
  244. package/src/bench/client_flows/benchmark.ts +21 -0
  245. package/src/bench/client_flows/client_flows_benchmark.ts +109 -88
  246. package/src/bench/client_flows/config.ts +9 -1
  247. package/src/bench/client_flows/data_extractor.ts +1 -0
  248. package/src/bench/utils.ts +123 -12
  249. package/src/composed/ha/ha_full_setup.ts +466 -0
  250. package/src/fixtures/authwit_proxy.ts +54 -0
  251. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  252. package/src/fixtures/e2e_prover_test.ts +97 -103
  253. package/src/fixtures/elu_monitor.ts +126 -0
  254. package/src/fixtures/fixtures.ts +108 -0
  255. package/src/fixtures/get_bb_config.ts +7 -6
  256. package/src/fixtures/ha_setup.ts +192 -0
  257. package/src/fixtures/index.ts +2 -0
  258. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  259. package/src/fixtures/setup.ts +421 -444
  260. package/src/fixtures/setup_p2p_test.ts +54 -54
  261. package/src/fixtures/timing.ts +97 -0
  262. package/src/fixtures/token_utils.ts +46 -10
  263. package/src/fixtures/utils.ts +2 -3
  264. package/src/fixtures/wait_helpers.ts +333 -0
  265. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  266. package/src/forward-compatibility/wallet_service.ts +106 -0
  267. package/src/guides/up_quick_start.sh +7 -4
  268. package/src/infra/README.md +12 -0
  269. package/src/install_legacy_contracts.cjs +75 -0
  270. package/src/legacy-jest-resolver.cjs +112 -0
  271. package/src/multi-node/README.md +95 -0
  272. package/src/multi-node/block-production/setup.ts +272 -0
  273. package/src/multi-node/governance/setup.ts +172 -0
  274. package/src/multi-node/multi_node_test_context.ts +447 -0
  275. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  276. package/src/multi-node/slashing/setup.ts +433 -0
  277. package/src/p2p/README.md +78 -0
  278. package/src/{e2e_p2p → p2p}/p2p_network.ts +132 -57
  279. package/src/p2p/reqresp/utils.ts +263 -0
  280. package/src/p2p/shared.ts +329 -0
  281. package/src/shared/cross_chain_test_harness.ts +52 -41
  282. package/src/shared/gas_portal_test_harness.ts +34 -16
  283. package/src/shared/index.ts +1 -0
  284. package/src/shared/jest_setup.ts +51 -1
  285. package/src/shared/mock_state_view.ts +188 -0
  286. package/src/shared/submit-transactions.ts +22 -19
  287. package/src/shared/timing_env.d.mts +39 -0
  288. package/src/shared/timing_env.mjs +363 -0
  289. package/src/shared/uniswap_l1_l2.ts +109 -74
  290. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  291. package/src/simulators/lending_simulator.ts +35 -17
  292. package/src/simulators/token_simulator.ts +6 -30
  293. package/src/single-node/README.md +60 -0
  294. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  295. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  296. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +20 -9
  297. package/src/{e2e_fees → single-node/fees}/fees_test.ts +120 -95
  298. package/src/single-node/l1-reorgs/setup.ts +93 -0
  299. package/src/single-node/partial-proofs/setup.ts +8 -0
  300. package/src/single-node/proving/setup.ts +15 -0
  301. package/src/single-node/recovery/setup.ts +8 -0
  302. package/src/single-node/setup.ts +63 -0
  303. package/src/single-node/single_node_test_context.ts +1041 -0
  304. package/src/spartan/setup_test_wallets.ts +196 -28
  305. package/src/spartan/tx_metrics.ts +255 -26
  306. package/src/spartan/utils/bot.ts +188 -0
  307. package/src/spartan/utils/chaos.ts +253 -0
  308. package/src/spartan/utils/clients.ts +100 -0
  309. package/src/spartan/utils/config.ts +29 -0
  310. package/src/spartan/utils/health.ts +255 -0
  311. package/src/spartan/utils/helm.ts +84 -0
  312. package/src/spartan/utils/index.ts +71 -0
  313. package/src/spartan/utils/k8s.ts +535 -0
  314. package/src/spartan/utils/nodes.ts +543 -0
  315. package/src/spartan/utils/pod_logs.ts +99 -0
  316. package/src/spartan/utils/scripts.ts +99 -0
  317. package/src/spartan/utils.ts +1 -1246
  318. package/src/test-wallet/test_wallet.ts +429 -0
  319. package/src/test-wallet/utils.ts +205 -0
  320. package/src/test-wallet/wallet_worker_script.ts +66 -0
  321. package/src/test-wallet/worker_wallet.ts +214 -0
  322. package/src/test-wallet/worker_wallet_schema.ts +14 -0
  323. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -53
  324. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  325. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
  326. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  327. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -128
  328. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  329. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  330. package/dest/e2e_deploy_contract/deploy_test.js +0 -50
  331. package/dest/e2e_epochs/epochs_test.d.ts +0 -94
  332. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  333. package/dest/e2e_epochs/epochs_test.js +0 -339
  334. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  335. package/dest/e2e_fees/fees_test.d.ts +0 -88
  336. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  337. package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
  338. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  339. package/dest/e2e_l1_publisher/write_json.js +0 -62
  340. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  341. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  342. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  343. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  344. package/dest/e2e_nested_contract/nested_contract_test.js +0 -56
  345. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  346. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  347. package/dest/e2e_p2p/inactivity_slash_test.js +0 -136
  348. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  349. package/dest/e2e_p2p/shared.d.ts +0 -46
  350. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  351. package/dest/e2e_p2p/shared.js +0 -184
  352. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -42
  353. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  354. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -194
  355. package/src/e2e_deploy_contract/deploy_test.ts +0 -85
  356. package/src/e2e_epochs/epochs_test.ts +0 -451
  357. package/src/e2e_l1_publisher/write_json.ts +0 -82
  358. package/src/e2e_nested_contract/nested_contract_test.ts +0 -75
  359. package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
  360. package/src/e2e_p2p/shared.ts +0 -290
  361. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  362. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -1,22 +1,31 @@
1
1
  import { generateSchnorrAccounts } from '@aztec/accounts/testing';
2
+ import { NO_FROM } from '@aztec/aztec.js/account';
2
3
  import { AztecAddress } from '@aztec/aztec.js/addresses';
4
+ import { DefaultWaitOpts, NO_WAIT } from '@aztec/aztec.js/contracts';
3
5
  import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
4
6
  import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
5
7
  import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
6
8
  import { Fr } from '@aztec/aztec.js/fields';
7
- import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
9
+ import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
10
+ import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
8
11
  import type { Wallet } from '@aztec/aztec.js/wallet';
9
12
  import { createEthereumChain } from '@aztec/ethereum/chain';
10
13
  import { createExtendedL1Client } from '@aztec/ethereum/client';
11
14
  import type { Logger } from '@aztec/foundation/log';
12
- import { retryUntil } from '@aztec/foundation/retry';
15
+ import { makeBackoff, retry, retryUntil } from '@aztec/foundation/retry';
13
16
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
17
+ import { Gas } from '@aztec/stdlib/gas';
14
18
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
15
- import { TestWallet, proveInteraction, registerInitialLocalNetworkAccountsInWallet } from '@aztec/test-wallet/server';
19
+ import { TxStatus } from '@aztec/stdlib/tx';
20
+ import { getGasLimits } from '@aztec/wallet-sdk/base-wallet';
21
+ import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
16
22
 
17
23
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
18
24
  import { getBBConfig } from '../fixtures/get_bb_config.js';
19
25
  import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
26
+ import { TestWallet } from '../test-wallet/test_wallet.js';
27
+ import { proveInteraction } from '../test-wallet/utils.js';
28
+ import { WorkerWallet } from '../test-wallet/worker_wallet.js';
20
29
 
21
30
  export interface TestAccounts {
22
31
  aztecNode: AztecNode;
@@ -47,6 +56,8 @@ export async function setupTestAccountsWithTokens(
47
56
 
48
57
  const aztecNode = createAztecNodeClient(nodeUrl);
49
58
  const wallet = await TestWallet.create(aztecNode);
59
+ // Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
60
+ wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
50
61
 
51
62
  const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
52
63
  0,
@@ -84,11 +95,19 @@ export async function deploySponsoredTestAccountsWithTokens(
84
95
 
85
96
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
86
97
  const recipientDeployMethod = await recipientAccount.getDeployMethod();
87
- await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
98
+ await recipientDeployMethod.send({
99
+ from: NO_FROM,
100
+ fee: { paymentMethod },
101
+ wait: { timeout: 2400 },
102
+ });
88
103
  await Promise.all(
89
104
  fundedAccounts.map(async a => {
90
105
  const deployMethod = await a.getDeployMethod();
91
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
106
+ await deployMethod.send({
107
+ from: NO_FROM,
108
+ fee: { paymentMethod },
109
+ wait: { timeout: 2400 },
110
+ }); // increase timeout on purpose in order to account for two empty epochs
92
111
  logger.info(`Account deployed at ${a.address}`);
93
112
  }),
94
113
  );
@@ -116,11 +135,104 @@ export async function deploySponsoredTestAccountsWithTokens(
116
135
  };
117
136
  }
118
137
 
138
+ async function deployAccountWithDiagnostics(
139
+ account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
140
+ paymentMethod: SponsoredFeePaymentMethod,
141
+ aztecNode: AztecNode,
142
+ logger: Logger,
143
+ accountLabel: string,
144
+ estimateGas?: boolean,
145
+ ): Promise<void> {
146
+ const deployMethod = await account.getDeployMethod();
147
+ let gasSettings: any;
148
+ if (estimateGas) {
149
+ const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod }, includeMetadata: true });
150
+ const { txsLimits } = await aztecNode.getNodeInfo();
151
+ gasSettings = getGasLimits(sim.gasUsed!, Gas.from(txsLimits.gas));
152
+ logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
153
+ }
154
+
155
+ // Track the tx hash across retries so we don't re-send when the previous tx is still pending.
156
+ let sentTxHash: { txHash: any } | undefined;
157
+
158
+ await retry(
159
+ async () => {
160
+ // Check if already deployed (handles case where previous attempt succeeded but waitForTx timed out)
161
+ const existing = await aztecNode.getContract(account.address);
162
+ if (existing) {
163
+ logger.info(`${accountLabel} already deployed at ${account.address}, skipping`);
164
+ return;
165
+ }
166
+
167
+ // If we already sent a tx, check if it was dropped before deciding to re-send.
168
+ if (sentTxHash) {
169
+ const prevReceipt = await aztecNode.getTxReceipt(sentTxHash.txHash);
170
+ if (prevReceipt.isDropped()) {
171
+ logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} was dropped, re-sending`);
172
+ sentTxHash = undefined;
173
+ } else {
174
+ logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} still pending, waiting again...`);
175
+ }
176
+ }
177
+
178
+ if (!sentTxHash) {
179
+ const deployResult = await deployMethod.send({
180
+ from: NO_FROM,
181
+ fee: { paymentMethod, gasSettings },
182
+ wait: NO_WAIT,
183
+ });
184
+ sentTxHash = { txHash: deployResult.txHash };
185
+ logger.info(`${accountLabel} tx sent`, { txHash: sentTxHash.txHash.toString() });
186
+ }
187
+
188
+ const receipt = await waitForTx(aztecNode, sentTxHash.txHash, { timeout: 600 });
189
+ if (receipt.isDropped()) {
190
+ sentTxHash = undefined;
191
+ throw new Error(`${accountLabel} tx was dropped, retrying...`);
192
+ }
193
+ logger.info(`${accountLabel} deployed at ${account.address}`);
194
+ },
195
+ `deploy ${accountLabel}`,
196
+ makeBackoff([1, 2, 4, 8, 16]),
197
+ logger,
198
+ );
199
+ }
200
+
201
+ async function deployAccountsInBatches(
202
+ accounts: {
203
+ getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
204
+ address: any;
205
+ }[],
206
+ paymentMethod: SponsoredFeePaymentMethod,
207
+ aztecNode: AztecNode,
208
+ logger: Logger,
209
+ labelPrefix: string,
210
+ batchSize = 2,
211
+ estimateGas?: boolean,
212
+ ): Promise<void> {
213
+ for (let i = 0; i < accounts.length; i += batchSize) {
214
+ const batch = accounts.slice(i, i + batchSize);
215
+ await Promise.all(
216
+ batch.map((account, idx) =>
217
+ deployAccountWithDiagnostics(
218
+ account,
219
+ paymentMethod,
220
+ aztecNode,
221
+ logger,
222
+ `${labelPrefix}${i + idx + 1}`,
223
+ estimateGas,
224
+ ),
225
+ ),
226
+ );
227
+ }
228
+ }
229
+
119
230
  export async function deploySponsoredTestAccounts(
120
231
  wallet: TestWallet,
121
232
  aztecNode: AztecNode,
122
233
  logger: Logger,
123
234
  numberOfFundedWallets = 1,
235
+ opts?: { estimateGas?: boolean },
124
236
  ): Promise<TestAccountsWithoutTokens> {
125
237
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
126
238
  const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
@@ -129,14 +241,23 @@ export async function deploySponsoredTestAccounts(
129
241
  await registerSponsoredFPC(wallet);
130
242
 
131
243
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
132
- const recipientDeployMethod = await recipientAccount.getDeployMethod();
133
- await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
134
- await Promise.all(
135
- fundedAccounts.map(async a => {
136
- const deployMethod = await a.getDeployMethod();
137
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
138
- logger.info(`Account deployed at ${a.address}`);
139
- }),
244
+
245
+ await deployAccountWithDiagnostics(
246
+ recipientAccount,
247
+ paymentMethod,
248
+ aztecNode,
249
+ logger,
250
+ 'Recipient account',
251
+ opts?.estimateGas,
252
+ );
253
+ await deployAccountsInBatches(
254
+ fundedAccounts,
255
+ paymentMethod,
256
+ aztecNode,
257
+ logger,
258
+ 'Funded account ',
259
+ 2,
260
+ opts?.estimateGas,
140
261
  );
141
262
 
142
263
  return {
@@ -157,6 +278,8 @@ export async function deployTestAccountsWithTokens(
157
278
  ): Promise<TestAccounts> {
158
279
  const aztecNode = createAztecNodeClient(nodeUrl);
159
280
  const wallet = await TestWallet.create(aztecNode);
281
+ // Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
282
+ wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
160
283
 
161
284
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
162
285
  const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
@@ -175,7 +298,7 @@ export async function deployTestAccountsWithTokens(
175
298
  fundedAccounts.map(async (a, i) => {
176
299
  const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
177
300
  const deployMethod = await a.getDeployMethod();
178
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait();
301
+ await deployMethod.send({ from: NO_FROM, fee: { paymentMethod } });
179
302
  logger.info(`Account deployed at ${a.address}`);
180
303
  }),
181
304
  );
@@ -218,9 +341,7 @@ async function bridgeL1FeeJuice(
218
341
  const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
219
342
  const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
220
343
 
221
- const isSynced = async () =>
222
- (await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
223
- await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
344
+ await waitForL1ToL2MessageReady(aztecNode, Fr.fromHexString(claim.messageHash), { timeoutSeconds: 24 });
224
345
 
225
346
  log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
226
347
  return claim;
@@ -251,14 +372,19 @@ async function deployTokenAndMint(
251
372
  logger: Logger,
252
373
  ) {
253
374
  logger.verbose(`Deploying TokenContract...`);
254
- const tokenContract = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
255
- .send({
256
- from: admin,
257
- fee: {
258
- paymentMethod,
259
- },
260
- })
261
- .deployed({ timeout: 600 });
375
+ const { contract: tokenContract } = await TokenContract.deploy(
376
+ wallet,
377
+ admin,
378
+ TOKEN_NAME,
379
+ TOKEN_SYMBOL,
380
+ TOKEN_DECIMALS,
381
+ ).send({
382
+ from: admin,
383
+ fee: {
384
+ paymentMethod,
385
+ },
386
+ wait: { timeout: 600 },
387
+ });
262
388
 
263
389
  const tokenAddress = tokenContract.address;
264
390
 
@@ -268,8 +394,7 @@ async function deployTokenAndMint(
268
394
  accounts.map(acc =>
269
395
  TokenContract.at(tokenAddress, wallet)
270
396
  .methods.mint_to_public(acc, mintAmount)
271
- .send({ from: admin, fee: { paymentMethod } })
272
- .wait({ timeout: 600 }),
397
+ .send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
273
398
  ),
274
399
  );
275
400
 
@@ -309,7 +434,9 @@ export async function performTransfers({
309
434
 
310
435
  const provenTxs = await Promise.all(txs);
311
436
 
312
- await Promise.all(provenTxs.map(t => t.send().wait({ timeout: 600 })));
437
+ // Wait only for the txs to be proposed, not checkpointed. This is enough to keep the chain
438
+ // loaded for the reorg scenario, and avoids each round blocking on the (slower) checkpoint lag.
439
+ await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600, waitForStatus: TxStatus.PROPOSED } })));
313
440
 
314
441
  logger.info(`Completed round ${i + 1} / ${rounds}`);
315
442
  }
@@ -336,6 +463,8 @@ export async function createWalletAndAztecNodeClient(
336
463
  proverEnabled,
337
464
  };
338
465
  const wallet = await TestWallet.create(aztecNode, pxeConfig);
466
+ // Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
467
+ wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
339
468
 
340
469
  return {
341
470
  wallet,
@@ -347,3 +476,42 @@ export async function createWalletAndAztecNodeClient(
347
476
  },
348
477
  };
349
478
  }
479
+
480
+ export type WorkerWalletWrapper = {
481
+ wallet: WorkerWallet;
482
+ aztecNode: AztecNode;
483
+ cleanup: () => Promise<void>;
484
+ };
485
+
486
+ export async function createWorkerWalletClient(
487
+ nodeUrl: string,
488
+ proverEnabled: boolean,
489
+ logger: Logger,
490
+ ): Promise<WorkerWalletWrapper> {
491
+ const aztecNode = createAztecNodeClient(nodeUrl);
492
+ const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
493
+
494
+ // Strip cleanup functions — they can't be structured-cloned for worker transfer
495
+ const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
496
+ const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
497
+
498
+ const pxeConfig = {
499
+ dataDirectory: undefined,
500
+ dataStoreMapSizeKb: 1024 * 1024,
501
+ ...bbPaths,
502
+ ...acvmPaths,
503
+ proverEnabled,
504
+ };
505
+
506
+ const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
507
+
508
+ return {
509
+ wallet,
510
+ aztecNode,
511
+ async cleanup() {
512
+ await wallet.stop();
513
+ await bbCleanup?.();
514
+ await acvmCleanup?.();
515
+ },
516
+ };
517
+ }
@@ -1,15 +1,145 @@
1
1
  import type { AztecNode } from '@aztec/aztec.js/node';
2
- import type { L2BlockNew } from '@aztec/stdlib/block';
2
+ import type { Logger } from '@aztec/foundation/log';
3
+ import type { BlockResponse } from '@aztec/stdlib/interfaces/client';
3
4
  import type { TopicType } from '@aztec/stdlib/p2p';
4
- import { Tx, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
5
+ import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
5
6
 
6
7
  import { createHistogram } from 'perf_hooks';
7
8
 
9
+ /** Metrics class for proving-related benchmarks. */
10
+ export class ProvingMetrics {
11
+ private successfulTxs: number | undefined;
12
+ private proofDuration: number | undefined;
13
+ private activeAgents: number | undefined;
14
+ private avgQueueTime: number | undefined;
15
+ private jobRetries: number | undefined;
16
+ private jobDuration: number | undefined;
17
+ private timedOutJobs: number | undefined;
18
+ private resolvedJobs: number | undefined;
19
+ private rejectedJobs: number | undefined;
20
+ private epochProvingDuration: number | undefined;
21
+ private provenTransactions: number | undefined;
22
+ private provenBlocks: number | undefined;
23
+
24
+ constructor(private prefix: string) {}
25
+
26
+ recordSuccessfulTxs(count: number): void {
27
+ this.successfulTxs = count;
28
+ }
29
+
30
+ recordProofDuration(seconds: number): void {
31
+ this.proofDuration = seconds;
32
+ }
33
+
34
+ recordActiveAgents(count: number): void {
35
+ this.activeAgents = count;
36
+ }
37
+
38
+ recordAvgQueueTime(ms: number): void {
39
+ this.avgQueueTime = ms;
40
+ }
41
+
42
+ recordJobRetries(count: number): void {
43
+ this.jobRetries = count;
44
+ }
45
+
46
+ recordJobDuration(ms: number): void {
47
+ this.jobDuration = ms;
48
+ }
49
+
50
+ recordTimedOutJobs(count: number): void {
51
+ this.timedOutJobs = count;
52
+ }
53
+
54
+ recordResolvedJobs(count: number): void {
55
+ this.resolvedJobs = count;
56
+ }
57
+
58
+ recordRejectedJobs(count: number): void {
59
+ this.rejectedJobs = count;
60
+ }
61
+
62
+ recordEpochProvingDuration(seconds: number): void {
63
+ this.epochProvingDuration = seconds;
64
+ }
65
+
66
+ recordProvenTransactions(count: number): void {
67
+ this.provenTransactions = count;
68
+ }
69
+
70
+ recordProvenBlocks(count: number): void {
71
+ this.provenBlocks = count;
72
+ }
73
+
74
+ toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number }> {
75
+ const data: Array<{ name: string; unit: string; value: number }> = [];
76
+
77
+ if (this.successfulTxs !== undefined) {
78
+ data.push({ name: `${this.prefix}/successful_txs`, unit: 'count', value: this.successfulTxs });
79
+ }
80
+
81
+ if (this.proofDuration !== undefined) {
82
+ data.push({ name: `${this.prefix}/proof_duration`, unit: 's', value: this.proofDuration });
83
+ }
84
+
85
+ if (this.activeAgents !== undefined) {
86
+ data.push({ name: `${this.prefix}/active_agents`, unit: 'count', value: this.activeAgents });
87
+ }
88
+
89
+ if (this.avgQueueTime !== undefined) {
90
+ data.push({ name: `${this.prefix}/avg_queue_time`, unit: 'ms', value: this.avgQueueTime });
91
+ }
92
+
93
+ if (this.jobRetries !== undefined) {
94
+ data.push({ name: `${this.prefix}/job_retries`, unit: 'count', value: this.jobRetries });
95
+ }
96
+
97
+ if (this.jobDuration !== undefined) {
98
+ data.push({ name: `${this.prefix}/job_duration`, unit: 'ms', value: this.jobDuration });
99
+ }
100
+
101
+ if (this.timedOutJobs !== undefined) {
102
+ data.push({ name: `${this.prefix}/timed_out_jobs`, unit: 'count', value: this.timedOutJobs });
103
+ }
104
+
105
+ if (this.resolvedJobs !== undefined) {
106
+ data.push({ name: `${this.prefix}/resolved_jobs`, unit: 'count', value: this.resolvedJobs });
107
+ }
108
+
109
+ if (this.rejectedJobs !== undefined) {
110
+ data.push({ name: `${this.prefix}/rejected_jobs`, unit: 'count', value: this.rejectedJobs });
111
+ }
112
+
113
+ if (this.epochProvingDuration !== undefined) {
114
+ data.push({ name: `${this.prefix}/epoch_proving_duration`, unit: 's', value: this.epochProvingDuration });
115
+ }
116
+
117
+ if (this.provenTransactions !== undefined) {
118
+ data.push({ name: `${this.prefix}/proven_transactions`, unit: 'count', value: this.provenTransactions });
119
+ }
120
+
121
+ if (this.provenBlocks !== undefined) {
122
+ data.push({ name: `${this.prefix}/proven_blocks`, unit: 'count', value: this.provenBlocks });
123
+ }
124
+
125
+ const scenario = process.env.BENCH_SCENARIO?.trim();
126
+ if (!scenario) {
127
+ return data;
128
+ }
129
+
130
+ const scenarioPrefix = `scenario/${scenario}/`;
131
+ return data.map(entry => ({ ...entry, name: `${scenarioPrefix}${entry.name}` }));
132
+ }
133
+ }
134
+
8
135
  export type TxInclusionData = {
9
136
  txHash: string;
10
- sentAt: number;
11
- minedAt: number;
12
- attestedAt: number;
137
+ /** Wall-clock at client when the tx was submitted, in ms (Date.now()). */
138
+ sentAtMs: number;
139
+ /** Wall-clock at client when the block containing the tx first became visible, in ms (Date.now()). -1 if never observed. */
140
+ minedAtMs: number;
141
+ /** Reserved for future attestation-observed-at signal; -1 today. */
142
+ attestedAtMs: number;
13
143
  blocknumber: number;
14
144
  priorityFee: number;
15
145
  totalFee: number;
@@ -20,7 +150,7 @@ export type TxInclusionData = {
20
150
  export class TxInclusionMetrics {
21
151
  private data = new Map<string, TxInclusionData>();
22
152
  private groups = new Set<string>();
23
- private blocks = new Map<number, Promise<L2BlockNew | undefined>>();
153
+ private blocks = new Map<number, Promise<BlockResponse<{ includeTransactions: true }> | undefined>>();
24
154
 
25
155
  private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
26
156
 
@@ -31,18 +161,26 @@ export class TxInclusionMetrics {
31
161
  private mempoolMinedDelay:
32
162
  | { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
33
163
  | undefined;
164
+ private inclusionOutcome: { mined: number; failed: number } | undefined;
34
165
 
35
- constructor(private aztecNode: AztecNode) {}
166
+ constructor(
167
+ private aztecNode: AztecNode,
168
+ private logger?: Logger,
169
+ ) {}
36
170
 
37
171
  recordSentTx(tx: Tx, group: string): void {
38
172
  const txHash = tx.getTxHash().toString();
39
173
  const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
40
174
 
175
+ if (this.data.has(txHash)) {
176
+ this.logger?.debug(`Overwriting tx inclusion data for ${txHash}`, { txHash, group });
177
+ }
178
+
41
179
  this.data.set(txHash, {
42
180
  txHash,
43
- sentAt: Math.trunc(Date.now() / 1000),
44
- minedAt: -1,
45
- attestedAt: -1,
181
+ sentAtMs: Date.now(),
182
+ minedAtMs: -1,
183
+ attestedAtMs: -1,
46
184
  blocknumber: -1,
47
185
  priorityFee: Number(priorityFees.feePerDaGas + priorityFees.feePerL2Gas),
48
186
  totalFee: -1,
@@ -52,26 +190,86 @@ export class TxInclusionMetrics {
52
190
  this.groups.add(group);
53
191
  }
54
192
 
193
+ /**
194
+ * Stamp mined-at metadata for any tracked tx contained in this block, using
195
+ * `observedAtMs` (caller-supplied wall-clock at the moment they first saw the
196
+ * block). Idempotent: existing minedAtMs is preserved so the first observer
197
+ * wins (typically the block-watcher; recordMinedTx is a fallback).
198
+ */
199
+ observeBlockForMinedTxs(
200
+ blockNumber: number,
201
+ txHashes: ReadonlyArray<{ toString(): string }>,
202
+ observedAtMs: number,
203
+ ): void {
204
+ txHashes.forEach((txHash, position) => {
205
+ const data = this.data.get(txHash.toString());
206
+ if (!data || data.minedAtMs !== -1) {
207
+ return;
208
+ }
209
+ data.blocknumber = blockNumber;
210
+ data.minedAtMs = observedAtMs;
211
+ data.positionInBlock = position;
212
+ });
213
+ }
214
+
55
215
  async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
56
- const { status, txHash, blockNumber } = txReceipt;
57
- if (status !== TxStatus.SUCCESS || !blockNumber) {
216
+ const { txHash, blockNumber } = txReceipt;
217
+ if (!txReceipt.isMined() || !txReceipt.hasExecutionSucceeded() || !blockNumber) {
218
+ this.logger?.debug('Skipping mined tx record due to receipt status', {
219
+ txHash: txHash.toString(),
220
+ status: txReceipt.status,
221
+ blockNumber,
222
+ });
58
223
  return;
59
224
  }
60
225
 
61
- if (!this.blocks.has(blockNumber)) {
62
- this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber));
226
+ const data = this.data.get(txHash.toString());
227
+ if (!data) {
228
+ const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
229
+ this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
230
+ throw new Error(message);
63
231
  }
232
+ data.totalFee = Number(txReceipt.transactionFee ?? 0n);
64
233
 
65
- const block = await this.blocks.get(blockNumber)!;
66
- if (!block) {
67
- return;
234
+ // Fallback path for txs the block-watcher missed (e.g. observed only after
235
+ // the watcher stopped). Stamp with the block's L2 slot timestamp; this is
236
+ // earlier than the true client-observed time by attestation+propagation
237
+ // lag, but it's the only deterministic timestamp available post-hoc.
238
+ if (data.minedAtMs === -1) {
239
+ if (!this.blocks.has(blockNumber)) {
240
+ this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber, { includeTransactions: true }));
241
+ }
242
+ const block = await this.blocks.get(blockNumber)!;
243
+ if (!block) {
244
+ this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
245
+ return;
246
+ }
247
+ data.blocknumber = blockNumber;
248
+ data.minedAtMs = Number(block.header.globalVariables.timestamp) * 1000;
249
+ data.positionInBlock = block.body.txEffects.findIndex(txEffect => txEffect.txHash.equals(txHash));
68
250
  }
69
- const data = this.data.get(txHash.toString())!;
70
- data.blocknumber = blockNumber;
71
- data.minedAt = Number(block.header.globalVariables.timestamp);
72
- data.attestedAt = -1;
73
- data.totalFee = Number(txReceipt.transactionFee ?? 0n);
74
- data.positionInBlock = block.body.txEffects.findIndex(txEffect => txEffect.txHash.equals(txHash));
251
+ }
252
+
253
+ /**
254
+ * Whether this tx was ever observed in a block (by the block-watcher or a mined receipt).
255
+ * Idempotent first-sighting semantics: a later reorg / pool eviction never clears it, so callers
256
+ * can treat "ever mined" as included regardless of what happens to the tx afterwards.
257
+ */
258
+ public wasMined(txHash: string): boolean {
259
+ const d = this.data.get(txHash);
260
+ return !!d && d.minedAtMs !== -1;
261
+ }
262
+
263
+ /** Per-tx inclusion records for a group. Used to serialise out for downstream tooling. */
264
+ getInclusionRecords(group?: string): TxInclusionData[] {
265
+ const out: TxInclusionData[] = [];
266
+ for (const tx of this.data.values()) {
267
+ if (group !== undefined && tx.group !== group) {
268
+ continue;
269
+ }
270
+ out.push({ ...tx });
271
+ }
272
+ return out;
75
273
  }
76
274
 
77
275
  public inclusionTimeInSeconds(group: string): {
@@ -84,12 +282,28 @@ export class TxInclusionMetrics {
84
282
  p99: number;
85
283
  } {
86
284
  const histogram = createHistogram({});
285
+ let nonPositive = 0;
87
286
  for (const tx of this.data.values()) {
88
- if (!tx.blocknumber || tx.group !== group || tx.minedAt === -1) {
287
+ if (!tx.blocknumber || tx.group !== group || tx.minedAtMs === -1) {
89
288
  continue;
90
289
  }
91
290
 
92
- histogram.record(tx.minedAt - tx.sentAt);
291
+ // Both timestamps are client wall-clock (ms). A negative delta should be
292
+ // impossible since the watcher stamps minedAtMs strictly after sentAtMs,
293
+ // but the fallback path (recordMinedTx via L2 slot timestamp) can stamp
294
+ // earlier than sentAtMs. perf_hooks.createHistogram rejects <=0; skip
295
+ // those instead of crashing.
296
+ const deltaMs = tx.minedAtMs - tx.sentAtMs;
297
+ if (deltaMs <= 0) {
298
+ nonPositive++;
299
+ continue;
300
+ }
301
+ // Histogram is recorded in seconds (rounded) to match the existing
302
+ // toGithubActionBenchmarkJSON output unit; per-tx records carry the raw ms.
303
+ histogram.record(Math.max(1, Math.round(deltaMs / 1000)));
304
+ }
305
+ if (nonPositive > 0) {
306
+ this.logger?.debug(`Dropped ${nonPositive} tx inclusion samples with non-positive delta`, { group });
93
307
  }
94
308
 
95
309
  if (histogram.count === 0) {
@@ -139,6 +353,11 @@ export class TxInclusionMetrics {
139
353
  this.mempoolMinedDelay = { txP50, txP95, attestationP50, attestationP95 };
140
354
  }
141
355
 
356
+ /** Mined vs failed counts for the high-value lane — recorded instead of asserting strict 1:1 inclusion. */
357
+ public recordInclusionOutcome(mined: number, failed: number): void {
358
+ this.inclusionOutcome = { mined, failed };
359
+ }
360
+
142
361
  toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
143
362
  const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
144
363
  for (const group of this.groups) {
@@ -151,7 +370,7 @@ export class TxInclusionMetrics {
151
370
  value: stats.mean,
152
371
  },
153
372
  {
154
- name: `${group}/median_inclusion`,
373
+ name: `${group}/p50_inclusion`,
155
374
  unit: 's',
156
375
  value: stats.median,
157
376
  },
@@ -220,6 +439,16 @@ export class TxInclusionMetrics {
220
439
  );
221
440
  }
222
441
 
442
+ if (this.inclusionOutcome) {
443
+ const { mined, failed } = this.inclusionOutcome;
444
+ const total = mined + failed;
445
+ data.push(
446
+ { name: 'inclusion/mined_count', unit: 'count', value: mined },
447
+ { name: 'inclusion/failed_count', unit: 'count', value: failed },
448
+ { name: 'inclusion/success_ratio', unit: 'ratio', value: total > 0 ? mined / total : 0 },
449
+ );
450
+ }
451
+
223
452
  const scenario = process.env.BENCH_SCENARIO?.trim();
224
453
  if (!scenario) {
225
454
  return data;