@aztec/end-to-end 0.0.1-commit.2ed92850 → 0.0.1-commit.3100065

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 (350) hide show
  1. package/README.md +229 -14
  2. package/dest/automine/automine_test_context.d.ts +85 -0
  3. package/dest/automine/automine_test_context.d.ts.map +1 -0
  4. package/dest/automine/automine_test_context.js +98 -0
  5. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
  6. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  7. package/dest/automine/contracts/fixtures/storage_proof_fetcher.js +184 -0
  8. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts +18 -0
  9. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
  10. package/dest/automine/contracts/fixtures/storage_proof_fixture.js +120 -0
  11. package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
  12. package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
  13. package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
  14. package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
  15. package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
  16. package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
  17. package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
  18. package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
  19. package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +45 -48
  20. package/dest/automine/token/token_contract_test.d.ts +40 -0
  21. package/dest/automine/token/token_contract_test.d.ts.map +1 -0
  22. package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +43 -48
  23. package/dest/automine/token/token_test_helpers.d.ts +73 -0
  24. package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
  25. package/dest/automine/token/token_test_helpers.js +97 -0
  26. package/dest/bench/client_flows/benchmark.d.ts +15 -1
  27. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  28. package/dest/bench/client_flows/benchmark.js +19 -0
  29. package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
  30. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  31. package/dest/bench/client_flows/client_flows_benchmark.js +65 -56
  32. package/dest/bench/client_flows/config.d.ts +2 -2
  33. package/dest/bench/client_flows/config.d.ts.map +1 -1
  34. package/dest/bench/client_flows/config.js +18 -0
  35. package/dest/bench/utils.d.ts +3 -3
  36. package/dest/bench/utils.d.ts.map +1 -1
  37. package/dest/bench/utils.js +102 -8
  38. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  39. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  40. package/dest/composed/ha/ha_full_setup.js +383 -0
  41. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  42. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  43. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  44. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  45. package/dest/fixtures/authwit_proxy.js +34 -0
  46. package/dest/fixtures/e2e_prover_test.d.ts +18 -14
  47. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  48. package/dest/fixtures/e2e_prover_test.js +84 -75
  49. package/dest/fixtures/elu_monitor.d.ts +21 -0
  50. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  51. package/dest/fixtures/elu_monitor.js +102 -0
  52. package/dest/fixtures/fixtures.d.ts +82 -1
  53. package/dest/fixtures/fixtures.d.ts.map +1 -1
  54. package/dest/fixtures/fixtures.js +84 -0
  55. package/dest/fixtures/get_bb_config.d.ts +1 -1
  56. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  57. package/dest/fixtures/get_bb_config.js +5 -5
  58. package/dest/fixtures/ha_setup.d.ts +71 -0
  59. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  60. package/dest/fixtures/ha_setup.js +119 -0
  61. package/dest/fixtures/index.d.ts +3 -1
  62. package/dest/fixtures/index.d.ts.map +1 -1
  63. package/dest/fixtures/index.js +2 -0
  64. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  65. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  66. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  67. package/dest/fixtures/setup.d.ts +120 -61
  68. package/dest/fixtures/setup.d.ts.map +1 -1
  69. package/dest/fixtures/setup.js +337 -327
  70. package/dest/fixtures/setup_p2p_test.d.ts +22 -11
  71. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  72. package/dest/fixtures/setup_p2p_test.js +46 -35
  73. package/dest/fixtures/standard_contracts_genesis.d.ts +16 -0
  74. package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
  75. package/dest/fixtures/standard_contracts_genesis.js +25 -0
  76. package/dest/fixtures/timing.d.ts +42 -0
  77. package/dest/fixtures/timing.d.ts.map +1 -0
  78. package/dest/fixtures/timing.js +72 -0
  79. package/dest/fixtures/token_utils.d.ts +22 -4
  80. package/dest/fixtures/token_utils.d.ts.map +1 -1
  81. package/dest/fixtures/token_utils.js +26 -8
  82. package/dest/fixtures/utils.d.ts +2 -2
  83. package/dest/fixtures/utils.d.ts.map +1 -1
  84. package/dest/fixtures/utils.js +1 -1
  85. package/dest/fixtures/wait_helpers.d.ts +135 -0
  86. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  87. package/dest/fixtures/wait_helpers.js +154 -0
  88. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  89. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  90. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  91. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  92. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  93. package/dest/forward-compatibility/wallet_service.js +109 -0
  94. package/dest/install_legacy_contracts.d.cts +10 -0
  95. package/dest/install_legacy_contracts.d.cts.map +1 -0
  96. package/dest/legacy-jest-resolver.d.cts +3 -0
  97. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  98. package/dest/multi-node/block-production/setup.d.ts +97 -0
  99. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  100. package/dest/multi-node/block-production/setup.js +158 -0
  101. package/dest/multi-node/governance/setup.d.ts +67 -0
  102. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  103. package/dest/multi-node/governance/setup.js +126 -0
  104. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  105. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  106. package/dest/multi-node/multi_node_test_context.js +347 -0
  107. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  108. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  109. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  110. package/dest/multi-node/slashing/setup.d.ts +167 -0
  111. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  112. package/dest/multi-node/slashing/setup.js +275 -0
  113. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +22 -12
  114. package/dest/p2p/p2p_network.d.ts.map +1 -0
  115. package/dest/{e2e_p2p → p2p}/p2p_network.js +98 -37
  116. package/dest/p2p/reqresp/utils.d.ts +19 -0
  117. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  118. package/dest/p2p/reqresp/utils.js +193 -0
  119. package/dest/p2p/shared.d.ts +72 -0
  120. package/dest/p2p/shared.d.ts.map +1 -0
  121. package/dest/p2p/shared.js +212 -0
  122. package/dest/shared/cross_chain_test_harness.d.ts +6 -4
  123. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  124. package/dest/shared/cross_chain_test_harness.js +44 -32
  125. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  126. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  127. package/dest/shared/gas_portal_test_harness.js +26 -14
  128. package/dest/shared/index.d.ts +2 -1
  129. package/dest/shared/index.d.ts.map +1 -1
  130. package/dest/shared/index.js +1 -0
  131. package/dest/shared/jest_setup.js +41 -1
  132. package/dest/shared/mock_state_view.d.ts +86 -0
  133. package/dest/shared/mock_state_view.d.ts.map +1 -0
  134. package/dest/shared/mock_state_view.js +186 -0
  135. package/dest/shared/submit-transactions.d.ts +2 -2
  136. package/dest/shared/submit-transactions.d.ts.map +1 -1
  137. package/dest/shared/submit-transactions.js +12 -5
  138. package/dest/shared/timing_env.d.js +5 -0
  139. package/dest/shared/timing_env.js +365 -0
  140. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  141. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  142. package/dest/shared/uniswap_l1_l2.js +56 -44
  143. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  144. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  145. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  146. package/dest/simulators/lending_simulator.d.ts +10 -3
  147. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  148. package/dest/simulators/lending_simulator.js +27 -15
  149. package/dest/simulators/token_simulator.d.ts +1 -1
  150. package/dest/simulators/token_simulator.d.ts.map +1 -1
  151. package/dest/simulators/token_simulator.js +3 -24
  152. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  153. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  154. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  155. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  156. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  157. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  158. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  159. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  160. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
  161. package/dest/single-node/fees/fees_test.d.ts +95 -0
  162. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  163. package/dest/single-node/fees/fees_test.js +347 -0
  164. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  165. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  166. package/dest/single-node/l1-reorgs/setup.js +57 -0
  167. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  168. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  169. package/dest/single-node/partial-proofs/setup.js +5 -0
  170. package/dest/single-node/proving/setup.d.ts +5 -0
  171. package/dest/single-node/proving/setup.d.ts.map +1 -0
  172. package/dest/single-node/proving/setup.js +5 -0
  173. package/dest/single-node/recovery/setup.d.ts +5 -0
  174. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  175. package/dest/single-node/recovery/setup.js +5 -0
  176. package/dest/single-node/setup.d.ts +49 -0
  177. package/dest/single-node/setup.d.ts.map +1 -0
  178. package/dest/single-node/setup.js +56 -0
  179. package/dest/single-node/single_node_test_context.d.ts +373 -0
  180. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  181. package/dest/single-node/single_node_test_context.js +845 -0
  182. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  183. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  184. package/dest/spartan/setup_test_wallets.js +124 -47
  185. package/dest/spartan/tx_metrics.d.ts +61 -4
  186. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  187. package/dest/spartan/tx_metrics.js +256 -21
  188. package/dest/spartan/utils/bot.d.ts +3 -2
  189. package/dest/spartan/utils/bot.d.ts.map +1 -1
  190. package/dest/spartan/utils/bot.js +2 -1
  191. package/dest/spartan/utils/config.d.ts +11 -28
  192. package/dest/spartan/utils/config.d.ts.map +1 -1
  193. package/dest/spartan/utils/config.js +4 -1
  194. package/dest/spartan/utils/index.d.ts +6 -4
  195. package/dest/spartan/utils/index.d.ts.map +1 -1
  196. package/dest/spartan/utils/index.js +6 -2
  197. package/dest/spartan/utils/k8s.d.ts +31 -1
  198. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  199. package/dest/spartan/utils/k8s.js +124 -0
  200. package/dest/spartan/utils/nodes.d.ts +14 -5
  201. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  202. package/dest/spartan/utils/nodes.js +204 -33
  203. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  204. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  205. package/dest/spartan/utils/pod_logs.js +74 -0
  206. package/dest/spartan/utils/scripts.d.ts +18 -4
  207. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  208. package/dest/spartan/utils/scripts.js +19 -4
  209. package/dest/test-wallet/test_wallet.d.ts +105 -0
  210. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  211. package/dest/test-wallet/test_wallet.js +320 -0
  212. package/dest/test-wallet/utils.d.ts +76 -0
  213. package/dest/test-wallet/utils.d.ts.map +1 -0
  214. package/dest/test-wallet/utils.js +126 -0
  215. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  216. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  217. package/dest/test-wallet/wallet_worker_script.js +56 -0
  218. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  219. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  220. package/dest/test-wallet/worker_wallet.js +155 -0
  221. package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
  222. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  223. package/dest/test-wallet/worker_wallet_schema.js +23 -0
  224. package/package.json +53 -46
  225. package/src/automine/README.md +60 -0
  226. package/src/automine/automine_test_context.ts +153 -0
  227. package/src/automine/contracts/fixtures/storage_proof.json +915 -0
  228. package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
  229. package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
  230. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  231. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  232. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +51 -61
  233. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +50 -56
  234. package/src/automine/token/token_test_helpers.ts +138 -0
  235. package/src/bench/client_flows/benchmark.ts +21 -0
  236. package/src/bench/client_flows/client_flows_benchmark.ts +106 -72
  237. package/src/bench/client_flows/config.ts +9 -1
  238. package/src/bench/utils.ts +117 -8
  239. package/src/composed/ha/ha_full_setup.ts +466 -0
  240. package/src/fixtures/authwit_proxy.ts +54 -0
  241. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  242. package/src/fixtures/e2e_prover_test.ts +102 -96
  243. package/src/fixtures/elu_monitor.ts +126 -0
  244. package/src/fixtures/fixtures.ts +108 -0
  245. package/src/fixtures/get_bb_config.ts +7 -6
  246. package/src/fixtures/ha_setup.ts +192 -0
  247. package/src/fixtures/index.ts +2 -0
  248. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  249. package/src/fixtures/setup.ts +438 -445
  250. package/src/fixtures/setup_p2p_test.ts +54 -54
  251. package/src/fixtures/standard_contracts_genesis.ts +28 -0
  252. package/src/fixtures/timing.ts +97 -0
  253. package/src/fixtures/token_utils.ts +42 -7
  254. package/src/fixtures/utils.ts +2 -3
  255. package/src/fixtures/wait_helpers.ts +333 -0
  256. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  257. package/src/forward-compatibility/wallet_service.ts +106 -0
  258. package/src/guides/up_quick_start.sh +7 -4
  259. package/src/infra/README.md +12 -0
  260. package/src/install_legacy_contracts.cjs +75 -0
  261. package/src/legacy-jest-resolver.cjs +112 -0
  262. package/src/multi-node/README.md +96 -0
  263. package/src/multi-node/block-production/setup.ts +272 -0
  264. package/src/multi-node/governance/setup.ts +172 -0
  265. package/src/multi-node/multi_node_test_context.ts +447 -0
  266. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  267. package/src/multi-node/slashing/setup.ts +433 -0
  268. package/src/p2p/README.md +78 -0
  269. package/src/{e2e_p2p → p2p}/p2p_network.ts +124 -53
  270. package/src/p2p/reqresp/utils.ts +263 -0
  271. package/src/p2p/shared.ts +329 -0
  272. package/src/shared/cross_chain_test_harness.ts +44 -21
  273. package/src/shared/gas_portal_test_harness.ts +33 -15
  274. package/src/shared/index.ts +1 -0
  275. package/src/shared/jest_setup.ts +51 -1
  276. package/src/shared/mock_state_view.ts +188 -0
  277. package/src/shared/submit-transactions.ts +15 -6
  278. package/src/shared/timing_env.d.mts +39 -0
  279. package/src/shared/timing_env.mjs +363 -0
  280. package/src/shared/uniswap_l1_l2.ts +98 -56
  281. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  282. package/src/simulators/lending_simulator.ts +33 -15
  283. package/src/simulators/token_simulator.ts +6 -30
  284. package/src/single-node/README.md +66 -0
  285. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  286. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  287. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
  288. package/src/single-node/fees/fees_test.ts +437 -0
  289. package/src/single-node/l1-reorgs/setup.ts +93 -0
  290. package/src/single-node/partial-proofs/setup.ts +8 -0
  291. package/src/single-node/proving/setup.ts +15 -0
  292. package/src/single-node/recovery/setup.ts +8 -0
  293. package/src/single-node/setup.ts +63 -0
  294. package/src/single-node/single_node_test_context.ts +1054 -0
  295. package/src/spartan/setup_test_wallets.ts +168 -42
  296. package/src/spartan/tx_metrics.ts +234 -24
  297. package/src/spartan/utils/bot.ts +4 -1
  298. package/src/spartan/utils/config.ts +3 -0
  299. package/src/spartan/utils/index.ts +10 -1
  300. package/src/spartan/utils/k8s.ts +160 -0
  301. package/src/spartan/utils/nodes.ts +251 -31
  302. package/src/spartan/utils/pod_logs.ts +99 -0
  303. package/src/spartan/utils/scripts.ts +43 -7
  304. package/src/test-wallet/test_wallet.ts +426 -0
  305. package/src/test-wallet/utils.ts +205 -0
  306. package/src/test-wallet/wallet_worker_script.ts +66 -0
  307. package/src/test-wallet/worker_wallet.ts +214 -0
  308. package/src/test-wallet/worker_wallet_schema.ts +14 -0
  309. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -53
  310. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  311. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
  312. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  313. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -128
  314. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  315. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  316. package/dest/e2e_deploy_contract/deploy_test.js +0 -50
  317. package/dest/e2e_epochs/epochs_test.d.ts +0 -94
  318. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  319. package/dest/e2e_epochs/epochs_test.js +0 -342
  320. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  321. package/dest/e2e_fees/fees_test.d.ts +0 -88
  322. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  323. package/dest/e2e_fees/fees_test.js +0 -248
  324. package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
  325. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  326. package/dest/e2e_l1_publisher/write_json.js +0 -62
  327. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  328. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  329. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  330. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  331. package/dest/e2e_nested_contract/nested_contract_test.js +0 -56
  332. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  333. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  334. package/dest/e2e_p2p/inactivity_slash_test.js +0 -136
  335. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  336. package/dest/e2e_p2p/shared.d.ts +0 -46
  337. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  338. package/dest/e2e_p2p/shared.js +0 -177
  339. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -42
  340. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  341. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -194
  342. package/src/e2e_deploy_contract/deploy_test.ts +0 -85
  343. package/src/e2e_epochs/epochs_test.ts +0 -456
  344. package/src/e2e_fees/fees_test.ts +0 -339
  345. package/src/e2e_l1_publisher/write_json.ts +0 -82
  346. package/src/e2e_nested_contract/nested_contract_test.ts +0 -73
  347. package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
  348. package/src/e2e_p2p/shared.ts +0 -280
  349. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  350. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -1,23 +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';
3
- import { NO_WAIT } from '@aztec/aztec.js/contracts';
4
+ import { DefaultWaitOpts, NO_WAIT } from '@aztec/aztec.js/contracts';
4
5
  import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
5
6
  import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
6
7
  import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
7
8
  import { Fr } from '@aztec/aztec.js/fields';
9
+ import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
8
10
  import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
9
11
  import type { Wallet } from '@aztec/aztec.js/wallet';
10
12
  import { createEthereumChain } from '@aztec/ethereum/chain';
11
13
  import { createExtendedL1Client } from '@aztec/ethereum/client';
12
14
  import type { Logger } from '@aztec/foundation/log';
13
- import { retryUntil } from '@aztec/foundation/retry';
15
+ import { makeBackoff, retry, retryUntil } from '@aztec/foundation/retry';
14
16
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
17
+ import { Gas } from '@aztec/stdlib/gas';
15
18
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
16
- 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';
17
22
 
18
23
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
19
24
  import { getBBConfig } from '../fixtures/get_bb_config.js';
20
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';
21
29
 
22
30
  export interface TestAccounts {
23
31
  aztecNode: AztecNode;
@@ -48,6 +56,8 @@ export async function setupTestAccountsWithTokens(
48
56
 
49
57
  const aztecNode = createAztecNodeClient(nodeUrl);
50
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);
51
61
 
52
62
  const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
53
63
  0,
@@ -78,18 +88,28 @@ export async function deploySponsoredTestAccountsWithTokens(
78
88
  numberOfFundedWallets = 1,
79
89
  ): Promise<TestAccounts> {
80
90
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
81
- const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
82
- const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
91
+ const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
92
+ const fundedAccounts = await Promise.all(
93
+ funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
94
+ );
83
95
 
84
96
  await registerSponsoredFPC(wallet);
85
97
 
86
98
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
87
99
  const recipientDeployMethod = await recipientAccount.getDeployMethod();
88
- await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: { timeout: 2400 } });
100
+ await recipientDeployMethod.send({
101
+ from: NO_FROM,
102
+ fee: { paymentMethod },
103
+ wait: { timeout: 2400 },
104
+ });
89
105
  await Promise.all(
90
106
  fundedAccounts.map(async a => {
91
107
  const deployMethod = await a.getDeployMethod();
92
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: { timeout: 2400 } }); // increase timeout on purpose in order to account for two empty epochs
108
+ await deployMethod.send({
109
+ from: NO_FROM,
110
+ fee: { paymentMethod },
111
+ wait: { timeout: 2400 },
112
+ }); // increase timeout on purpose in order to account for two empty epochs
93
113
  logger.info(`Account deployed at ${a.address}`);
94
114
  }),
95
115
  );
@@ -118,49 +138,92 @@ export async function deploySponsoredTestAccountsWithTokens(
118
138
  }
119
139
 
120
140
  async function deployAccountWithDiagnostics(
121
- account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
141
+ account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
122
142
  paymentMethod: SponsoredFeePaymentMethod,
123
143
  aztecNode: AztecNode,
124
144
  logger: Logger,
125
145
  accountLabel: string,
146
+ estimateGas?: boolean,
126
147
  ): Promise<void> {
127
148
  const deployMethod = await account.getDeployMethod();
128
- let txHash;
129
- try {
130
- txHash = await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: NO_WAIT });
131
- await waitForTx(aztecNode, txHash, { timeout: 2400 });
132
- logger.info(`${accountLabel} deployed at ${account.address}`);
133
- } catch (error) {
134
- const blockNumber = await aztecNode.getBlockNumber();
135
- let receipt;
136
- try {
137
- receipt = await aztecNode.getTxReceipt(txHash);
138
- } catch {
139
- receipt = 'unavailable';
140
- }
141
- logger.error(`${accountLabel} deployment failed`, {
142
- txHash: txHash.toString(),
143
- receipt: JSON.stringify(receipt),
144
- currentBlockNumber: blockNumber,
145
- error: String(error),
146
- });
147
- throw error;
149
+ let gasSettings: any;
150
+ if (estimateGas) {
151
+ const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod }, includeMetadata: true });
152
+ const { txsLimits } = await aztecNode.getNodeInfo();
153
+ gasSettings = getGasLimits(sim.gasUsed!, Gas.from(txsLimits.gas));
154
+ logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
148
155
  }
156
+
157
+ // Track the tx hash across retries so we don't re-send when the previous tx is still pending.
158
+ let sentTxHash: { txHash: any } | undefined;
159
+
160
+ await retry(
161
+ async () => {
162
+ // Check if already deployed (handles case where previous attempt succeeded but waitForTx timed out)
163
+ const existing = await aztecNode.getContract(account.address);
164
+ if (existing) {
165
+ logger.info(`${accountLabel} already deployed at ${account.address}, skipping`);
166
+ return;
167
+ }
168
+
169
+ // If we already sent a tx, check if it was dropped before deciding to re-send.
170
+ if (sentTxHash) {
171
+ const prevReceipt = await aztecNode.getTxReceipt(sentTxHash.txHash);
172
+ if (prevReceipt.isDropped()) {
173
+ logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} was dropped, re-sending`);
174
+ sentTxHash = undefined;
175
+ } else {
176
+ logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} still pending, waiting again...`);
177
+ }
178
+ }
179
+
180
+ if (!sentTxHash) {
181
+ const deployResult = await deployMethod.send({
182
+ from: NO_FROM,
183
+ fee: { paymentMethod, gasSettings },
184
+ wait: NO_WAIT,
185
+ });
186
+ sentTxHash = { txHash: deployResult.txHash };
187
+ logger.info(`${accountLabel} tx sent`, { txHash: sentTxHash.txHash.toString() });
188
+ }
189
+
190
+ const receipt = await waitForTx(aztecNode, sentTxHash.txHash, { timeout: 600 });
191
+ if (receipt.isDropped()) {
192
+ sentTxHash = undefined;
193
+ throw new Error(`${accountLabel} tx was dropped, retrying...`);
194
+ }
195
+ logger.info(`${accountLabel} deployed at ${account.address}`);
196
+ },
197
+ `deploy ${accountLabel}`,
198
+ makeBackoff([1, 2, 4, 8, 16]),
199
+ logger,
200
+ );
149
201
  }
150
202
 
151
203
  async function deployAccountsInBatches(
152
- accounts: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any }[],
204
+ accounts: {
205
+ getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
206
+ address: any;
207
+ }[],
153
208
  paymentMethod: SponsoredFeePaymentMethod,
154
209
  aztecNode: AztecNode,
155
210
  logger: Logger,
156
211
  labelPrefix: string,
157
212
  batchSize = 2,
213
+ estimateGas?: boolean,
158
214
  ): Promise<void> {
159
215
  for (let i = 0; i < accounts.length; i += batchSize) {
160
216
  const batch = accounts.slice(i, i + batchSize);
161
217
  await Promise.all(
162
218
  batch.map((account, idx) =>
163
- deployAccountWithDiagnostics(account, paymentMethod, aztecNode, logger, `${labelPrefix}${i + idx + 1}`),
219
+ deployAccountWithDiagnostics(
220
+ account,
221
+ paymentMethod,
222
+ aztecNode,
223
+ logger,
224
+ `${labelPrefix}${i + idx + 1}`,
225
+ estimateGas,
226
+ ),
164
227
  ),
165
228
  );
166
229
  }
@@ -171,17 +234,35 @@ export async function deploySponsoredTestAccounts(
171
234
  aztecNode: AztecNode,
172
235
  logger: Logger,
173
236
  numberOfFundedWallets = 1,
237
+ opts?: { estimateGas?: boolean },
174
238
  ): Promise<TestAccountsWithoutTokens> {
175
239
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
176
- const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
177
- const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
240
+ const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
241
+ const fundedAccounts = await Promise.all(
242
+ funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
243
+ );
178
244
 
179
245
  await registerSponsoredFPC(wallet);
180
246
 
181
247
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
182
248
 
183
- await deployAccountWithDiagnostics(recipientAccount, paymentMethod, aztecNode, logger, 'Recipient account');
184
- await deployAccountsInBatches(fundedAccounts, paymentMethod, aztecNode, logger, 'Funded account ', 2);
249
+ await deployAccountWithDiagnostics(
250
+ recipientAccount,
251
+ paymentMethod,
252
+ aztecNode,
253
+ logger,
254
+ 'Recipient account',
255
+ opts?.estimateGas,
256
+ );
257
+ await deployAccountsInBatches(
258
+ fundedAccounts,
259
+ paymentMethod,
260
+ aztecNode,
261
+ logger,
262
+ 'Funded account ',
263
+ 2,
264
+ opts?.estimateGas,
265
+ );
185
266
 
186
267
  return {
187
268
  aztecNode,
@@ -201,10 +282,14 @@ export async function deployTestAccountsWithTokens(
201
282
  ): Promise<TestAccounts> {
202
283
  const aztecNode = createAztecNodeClient(nodeUrl);
203
284
  const wallet = await TestWallet.create(aztecNode);
285
+ // Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
286
+ wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
204
287
 
205
288
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
206
- const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
207
- const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
289
+ const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
290
+ const fundedAccounts = await Promise.all(
291
+ funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
292
+ );
208
293
 
209
294
  const claims = await Promise.all(
210
295
  fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, aztecNode, a.address, undefined, logger)),
@@ -219,7 +304,7 @@ export async function deployTestAccountsWithTokens(
219
304
  fundedAccounts.map(async (a, i) => {
220
305
  const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
221
306
  const deployMethod = await a.getDeployMethod();
222
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } });
307
+ await deployMethod.send({ from: NO_FROM, fee: { paymentMethod } });
223
308
  logger.info(`Account deployed at ${a.address}`);
224
309
  }),
225
310
  );
@@ -262,9 +347,7 @@ async function bridgeL1FeeJuice(
262
347
  const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
263
348
  const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
264
349
 
265
- const isSynced = async () =>
266
- (await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
267
- await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
350
+ await waitForL1ToL2MessageReady(aztecNode, Fr.fromHexString(claim.messageHash), { timeoutSeconds: 24 });
268
351
 
269
352
  log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
270
353
  return claim;
@@ -306,7 +389,7 @@ async function deployTokenAndMint(
306
389
  fee: {
307
390
  paymentMethod,
308
391
  },
309
- wait: { timeout: 600, returnReceipt: true },
392
+ wait: { timeout: 600 },
310
393
  });
311
394
 
312
395
  const tokenAddress = tokenContract.address;
@@ -357,7 +440,9 @@ export async function performTransfers({
357
440
 
358
441
  const provenTxs = await Promise.all(txs);
359
442
 
360
- await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600 } })));
443
+ // Wait only for the txs to be proposed, not checkpointed. This is enough to keep the chain
444
+ // loaded for the reorg scenario, and avoids each round blocking on the (slower) checkpoint lag.
445
+ await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600, waitForStatus: TxStatus.PROPOSED } })));
361
446
 
362
447
  logger.info(`Completed round ${i + 1} / ${rounds}`);
363
448
  }
@@ -384,6 +469,8 @@ export async function createWalletAndAztecNodeClient(
384
469
  proverEnabled,
385
470
  };
386
471
  const wallet = await TestWallet.create(aztecNode, pxeConfig);
472
+ // Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
473
+ wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
387
474
 
388
475
  return {
389
476
  wallet,
@@ -395,3 +482,42 @@ export async function createWalletAndAztecNodeClient(
395
482
  },
396
483
  };
397
484
  }
485
+
486
+ export type WorkerWalletWrapper = {
487
+ wallet: WorkerWallet;
488
+ aztecNode: AztecNode;
489
+ cleanup: () => Promise<void>;
490
+ };
491
+
492
+ export async function createWorkerWalletClient(
493
+ nodeUrl: string,
494
+ proverEnabled: boolean,
495
+ logger: Logger,
496
+ ): Promise<WorkerWalletWrapper> {
497
+ const aztecNode = createAztecNodeClient(nodeUrl);
498
+ const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
499
+
500
+ // Strip cleanup functions — they can't be structured-cloned for worker transfer
501
+ const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
502
+ const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
503
+
504
+ const pxeConfig = {
505
+ dataDirectory: undefined,
506
+ dataStoreMapSizeKb: 1024 * 1024,
507
+ ...bbPaths,
508
+ ...acvmPaths,
509
+ proverEnabled,
510
+ };
511
+
512
+ const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
513
+
514
+ return {
515
+ wallet,
516
+ aztecNode,
517
+ async cleanup() {
518
+ await wallet.stop();
519
+ await bbCleanup?.();
520
+ await acvmCleanup?.();
521
+ },
522
+ };
523
+ }
@@ -1,16 +1,145 @@
1
1
  import type { AztecNode } from '@aztec/aztec.js/node';
2
2
  import type { Logger } from '@aztec/foundation/log';
3
- import type { L2Block } from '@aztec/stdlib/block';
3
+ import type { BlockResponse } from '@aztec/stdlib/interfaces/client';
4
4
  import type { TopicType } from '@aztec/stdlib/p2p';
5
5
  import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
6
6
 
7
7
  import { createHistogram } from 'perf_hooks';
8
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
+
9
135
  export type TxInclusionData = {
10
136
  txHash: string;
11
- sentAt: number;
12
- minedAt: number;
13
- 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;
14
143
  blocknumber: number;
15
144
  priorityFee: number;
16
145
  totalFee: number;
@@ -21,7 +150,7 @@ export type TxInclusionData = {
21
150
  export class TxInclusionMetrics {
22
151
  private data = new Map<string, TxInclusionData>();
23
152
  private groups = new Set<string>();
24
- private blocks = new Map<number, Promise<L2Block | undefined>>();
153
+ private blocks = new Map<number, Promise<BlockResponse<{ includeTransactions: true }> | undefined>>();
25
154
 
26
155
  private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
27
156
 
@@ -32,6 +161,7 @@ export class TxInclusionMetrics {
32
161
  private mempoolMinedDelay:
33
162
  | { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
34
163
  | undefined;
164
+ private inclusionOutcome: { mined: number; failed: number } | undefined;
35
165
 
36
166
  constructor(
37
167
  private aztecNode: AztecNode,
@@ -48,9 +178,9 @@ export class TxInclusionMetrics {
48
178
 
49
179
  this.data.set(txHash, {
50
180
  txHash,
51
- sentAt: Math.trunc(Date.now() / 1000),
52
- minedAt: -1,
53
- attestedAt: -1,
181
+ sentAtMs: Date.now(),
182
+ minedAtMs: -1,
183
+ attestedAtMs: -1,
54
184
  blocknumber: -1,
55
185
  priorityFee: Number(priorityFees.feePerDaGas + priorityFees.feePerL2Gas),
56
186
  totalFee: -1,
@@ -60,6 +190,28 @@ export class TxInclusionMetrics {
60
190
  this.groups.add(group);
61
191
  }
62
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
+
63
215
  async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
64
216
  const { txHash, blockNumber } = txReceipt;
65
217
  if (!txReceipt.isMined() || !txReceipt.hasExecutionSucceeded() || !blockNumber) {
@@ -71,26 +223,53 @@ export class TxInclusionMetrics {
71
223
  return;
72
224
  }
73
225
 
74
- if (!this.blocks.has(blockNumber)) {
75
- this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber));
76
- }
77
-
78
- const block = await this.blocks.get(blockNumber)!;
79
- if (!block) {
80
- this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
81
- return;
82
- }
83
226
  const data = this.data.get(txHash.toString());
84
227
  if (!data) {
85
228
  const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
86
229
  this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
87
230
  throw new Error(message);
88
231
  }
89
- data.blocknumber = blockNumber;
90
- data.minedAt = Number(block.header.globalVariables.timestamp);
91
- data.attestedAt = -1;
92
232
  data.totalFee = Number(txReceipt.transactionFee ?? 0n);
93
- data.positionInBlock = block.body.txEffects.findIndex(txEffect => txEffect.txHash.equals(txHash));
233
+
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));
250
+ }
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;
94
273
  }
95
274
 
96
275
  public inclusionTimeInSeconds(group: string): {
@@ -103,12 +282,28 @@ export class TxInclusionMetrics {
103
282
  p99: number;
104
283
  } {
105
284
  const histogram = createHistogram({});
285
+ let nonPositive = 0;
106
286
  for (const tx of this.data.values()) {
107
- if (!tx.blocknumber || tx.group !== group || tx.minedAt === -1) {
287
+ if (!tx.blocknumber || tx.group !== group || tx.minedAtMs === -1) {
108
288
  continue;
109
289
  }
110
290
 
111
- 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 });
112
307
  }
113
308
 
114
309
  if (histogram.count === 0) {
@@ -158,6 +353,11 @@ export class TxInclusionMetrics {
158
353
  this.mempoolMinedDelay = { txP50, txP95, attestationP50, attestationP95 };
159
354
  }
160
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
+
161
361
  toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
162
362
  const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
163
363
  for (const group of this.groups) {
@@ -170,7 +370,7 @@ export class TxInclusionMetrics {
170
370
  value: stats.mean,
171
371
  },
172
372
  {
173
- name: `${group}/median_inclusion`,
373
+ name: `${group}/p50_inclusion`,
174
374
  unit: 's',
175
375
  value: stats.median,
176
376
  },
@@ -239,6 +439,16 @@ export class TxInclusionMetrics {
239
439
  );
240
440
  }
241
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
+
242
452
  const scenario = process.env.BENCH_SCENARIO?.trim();
243
453
  if (!scenario) {
244
454
  return data;