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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) 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/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
  8. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
  9. package/dest/automine/delivery/onchain_delivery_harness.d.ts +17 -0
  10. package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
  11. package/dest/automine/delivery/onchain_delivery_harness.js +123 -0
  12. package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
  13. package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
  14. package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +23 -36
  15. package/dest/automine/token/token_contract_test.d.ts +40 -0
  16. package/dest/automine/token/token_contract_test.d.ts.map +1 -0
  17. package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +24 -39
  18. package/dest/automine/token/token_test_helpers.d.ts +73 -0
  19. package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
  20. package/dest/automine/token/token_test_helpers.js +97 -0
  21. package/dest/bench/client_flows/benchmark.d.ts +15 -1
  22. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  23. package/dest/bench/client_flows/benchmark.js +19 -0
  24. package/dest/bench/client_flows/client_flows_benchmark.d.ts +5 -5
  25. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  26. package/dest/bench/client_flows/client_flows_benchmark.js +53 -52
  27. package/dest/bench/client_flows/data_extractor.js +1 -0
  28. package/dest/bench/utils.d.ts +3 -3
  29. package/dest/bench/utils.d.ts.map +1 -1
  30. package/dest/bench/utils.js +97 -6
  31. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  32. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  33. package/dest/composed/ha/ha_full_setup.js +383 -0
  34. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  35. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  36. package/dest/fixtures/authwit_proxy.d.ts +1 -1
  37. package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
  38. package/dest/fixtures/authwit_proxy.js +4 -0
  39. package/dest/fixtures/e2e_prover_test.d.ts +15 -11
  40. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  41. package/dest/fixtures/e2e_prover_test.js +55 -40
  42. package/dest/fixtures/fixtures.d.ts +78 -1
  43. package/dest/fixtures/fixtures.d.ts.map +1 -1
  44. package/dest/fixtures/fixtures.js +78 -0
  45. package/dest/fixtures/get_bb_config.d.ts +1 -1
  46. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  47. package/dest/fixtures/get_bb_config.js +5 -5
  48. package/dest/fixtures/ha_setup.d.ts +4 -4
  49. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  50. package/dest/fixtures/ha_setup.js +5 -2
  51. package/dest/fixtures/index.d.ts +2 -1
  52. package/dest/fixtures/index.d.ts.map +1 -1
  53. package/dest/fixtures/index.js +1 -0
  54. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  55. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  56. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  57. package/dest/fixtures/setup.d.ts +71 -41
  58. package/dest/fixtures/setup.d.ts.map +1 -1
  59. package/dest/fixtures/setup.js +283 -201
  60. package/dest/fixtures/setup_p2p_test.d.ts +10 -6
  61. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  62. package/dest/fixtures/setup_p2p_test.js +11 -11
  63. package/dest/fixtures/timing.d.ts +42 -0
  64. package/dest/fixtures/timing.d.ts.map +1 -0
  65. package/dest/fixtures/timing.js +72 -0
  66. package/dest/fixtures/token_utils.d.ts +22 -4
  67. package/dest/fixtures/token_utils.d.ts.map +1 -1
  68. package/dest/fixtures/token_utils.js +23 -6
  69. package/dest/fixtures/utils.d.ts +2 -2
  70. package/dest/fixtures/utils.d.ts.map +1 -1
  71. package/dest/fixtures/utils.js +1 -1
  72. package/dest/fixtures/wait_helpers.d.ts +135 -0
  73. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  74. package/dest/fixtures/wait_helpers.js +154 -0
  75. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  76. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  77. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  78. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  79. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  80. package/dest/forward-compatibility/wallet_service.js +109 -0
  81. package/dest/install_legacy_contracts.d.cts +10 -0
  82. package/dest/install_legacy_contracts.d.cts.map +1 -0
  83. package/dest/legacy-jest-resolver.d.cts +3 -0
  84. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  85. package/dest/multi-node/block-production/setup.d.ts +97 -0
  86. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  87. package/dest/multi-node/block-production/setup.js +158 -0
  88. package/dest/multi-node/governance/setup.d.ts +67 -0
  89. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  90. package/dest/multi-node/governance/setup.js +126 -0
  91. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  92. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  93. package/dest/multi-node/multi_node_test_context.js +347 -0
  94. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  95. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  96. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  97. package/dest/multi-node/slashing/setup.d.ts +167 -0
  98. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  99. package/dest/multi-node/slashing/setup.js +275 -0
  100. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +19 -10
  101. package/dest/p2p/p2p_network.d.ts.map +1 -0
  102. package/dest/{e2e_p2p → p2p}/p2p_network.js +81 -38
  103. package/dest/p2p/reqresp/utils.d.ts +19 -0
  104. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  105. package/dest/{e2e_p2p → p2p}/reqresp/utils.js +32 -29
  106. package/dest/p2p/shared.d.ts +72 -0
  107. package/dest/p2p/shared.d.ts.map +1 -0
  108. package/dest/p2p/shared.js +212 -0
  109. package/dest/shared/cross_chain_test_harness.d.ts +6 -4
  110. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  111. package/dest/shared/cross_chain_test_harness.js +25 -20
  112. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  113. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  114. package/dest/shared/gas_portal_test_harness.js +24 -12
  115. package/dest/shared/submit-transactions.d.ts +1 -1
  116. package/dest/shared/submit-transactions.d.ts.map +1 -1
  117. package/dest/shared/submit-transactions.js +12 -5
  118. package/dest/shared/timing_env.d.js +5 -0
  119. package/dest/shared/timing_env.js +365 -0
  120. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  121. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  122. package/dest/shared/uniswap_l1_l2.js +50 -37
  123. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  124. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  125. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  126. package/dest/simulators/lending_simulator.d.ts +10 -3
  127. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  128. package/dest/simulators/lending_simulator.js +25 -13
  129. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  130. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  131. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  132. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  133. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  134. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  135. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  136. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  137. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
  138. package/dest/single-node/fees/fees_test.d.ts +93 -0
  139. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  140. package/dest/{e2e_fees → single-node/fees}/fees_test.js +78 -59
  141. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  142. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  143. package/dest/single-node/l1-reorgs/setup.js +57 -0
  144. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  145. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  146. package/dest/single-node/partial-proofs/setup.js +5 -0
  147. package/dest/single-node/proving/setup.d.ts +5 -0
  148. package/dest/single-node/proving/setup.d.ts.map +1 -0
  149. package/dest/single-node/proving/setup.js +5 -0
  150. package/dest/single-node/recovery/setup.d.ts +5 -0
  151. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  152. package/dest/single-node/recovery/setup.js +5 -0
  153. package/dest/single-node/setup.d.ts +49 -0
  154. package/dest/single-node/setup.d.ts.map +1 -0
  155. package/dest/single-node/setup.js +56 -0
  156. package/dest/single-node/single_node_test_context.d.ts +360 -0
  157. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  158. package/dest/single-node/single_node_test_context.js +833 -0
  159. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  160. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  161. package/dest/spartan/setup_test_wallets.js +83 -49
  162. package/dest/spartan/tx_metrics.d.ts +27 -4
  163. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  164. package/dest/spartan/tx_metrics.js +105 -20
  165. package/dest/spartan/utils/config.d.ts +9 -35
  166. package/dest/spartan/utils/config.d.ts.map +1 -1
  167. package/dest/spartan/utils/nodes.js +2 -2
  168. package/dest/test-wallet/test_wallet.d.ts +38 -9
  169. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  170. package/dest/test-wallet/test_wallet.js +186 -77
  171. package/dest/test-wallet/utils.d.ts +38 -3
  172. package/dest/test-wallet/utils.d.ts.map +1 -1
  173. package/dest/test-wallet/utils.js +65 -10
  174. package/dest/test-wallet/wallet_worker_script.js +10 -2
  175. package/dest/test-wallet/worker_wallet.d.ts +7 -6
  176. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  177. package/dest/test-wallet/worker_wallet.js +6 -2
  178. package/dest/test-wallet/worker_wallet_schema.d.ts +3 -273
  179. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
  180. package/dest/test-wallet/worker_wallet_schema.js +14 -2
  181. package/package.json +47 -42
  182. package/src/automine/README.md +60 -0
  183. package/src/automine/automine_test_context.ts +153 -0
  184. package/src/automine/delivery/onchain_delivery_harness.ts +177 -0
  185. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +24 -47
  186. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +25 -48
  187. package/src/automine/token/token_test_helpers.ts +138 -0
  188. package/src/bench/client_flows/benchmark.ts +21 -0
  189. package/src/bench/client_flows/client_flows_benchmark.ts +103 -73
  190. package/src/bench/client_flows/data_extractor.ts +1 -0
  191. package/src/bench/utils.ts +110 -6
  192. package/src/composed/ha/ha_full_setup.ts +466 -0
  193. package/src/fixtures/authwit_proxy.ts +4 -0
  194. package/src/fixtures/e2e_prover_test.ts +66 -63
  195. package/src/fixtures/fixtures.ts +98 -0
  196. package/src/fixtures/get_bb_config.ts +7 -6
  197. package/src/fixtures/ha_setup.ts +11 -5
  198. package/src/fixtures/index.ts +1 -0
  199. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  200. package/src/fixtures/setup.ts +342 -258
  201. package/src/fixtures/setup_p2p_test.ts +15 -11
  202. package/src/fixtures/timing.ts +97 -0
  203. package/src/fixtures/token_utils.ts +40 -8
  204. package/src/fixtures/utils.ts +2 -3
  205. package/src/fixtures/wait_helpers.ts +333 -0
  206. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  207. package/src/forward-compatibility/wallet_service.ts +106 -0
  208. package/src/guides/up_quick_start.sh +5 -2
  209. package/src/infra/README.md +12 -0
  210. package/src/install_legacy_contracts.cjs +75 -0
  211. package/src/legacy-jest-resolver.cjs +112 -0
  212. package/src/multi-node/README.md +95 -0
  213. package/src/multi-node/block-production/setup.ts +272 -0
  214. package/src/multi-node/governance/setup.ts +172 -0
  215. package/src/multi-node/multi_node_test_context.ts +447 -0
  216. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  217. package/src/multi-node/slashing/setup.ts +433 -0
  218. package/src/p2p/README.md +78 -0
  219. package/src/{e2e_p2p → p2p}/p2p_network.ts +92 -49
  220. package/src/{e2e_p2p → p2p}/reqresp/utils.ts +35 -28
  221. package/src/p2p/shared.ts +329 -0
  222. package/src/shared/cross_chain_test_harness.ts +35 -14
  223. package/src/shared/gas_portal_test_harness.ts +32 -14
  224. package/src/shared/submit-transactions.ts +13 -5
  225. package/src/shared/timing_env.d.mts +39 -0
  226. package/src/shared/timing_env.mjs +363 -0
  227. package/src/shared/uniswap_l1_l2.ts +80 -43
  228. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  229. package/src/simulators/lending_simulator.ts +29 -13
  230. package/src/single-node/README.md +60 -0
  231. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  232. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  233. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
  234. package/src/{e2e_fees → single-node/fees}/fees_test.ts +103 -66
  235. package/src/single-node/l1-reorgs/setup.ts +93 -0
  236. package/src/single-node/partial-proofs/setup.ts +8 -0
  237. package/src/single-node/proving/setup.ts +15 -0
  238. package/src/single-node/recovery/setup.ts +8 -0
  239. package/src/single-node/setup.ts +63 -0
  240. package/src/single-node/single_node_test_context.ts +1041 -0
  241. package/src/spartan/setup_test_wallets.ts +79 -44
  242. package/src/spartan/tx_metrics.ts +107 -23
  243. package/src/spartan/utils/nodes.ts +2 -2
  244. package/src/test-wallet/test_wallet.ts +213 -78
  245. package/src/test-wallet/utils.ts +104 -11
  246. package/src/test-wallet/wallet_worker_script.ts +8 -2
  247. package/src/test-wallet/worker_wallet.ts +12 -11
  248. package/src/test-wallet/worker_wallet_schema.ts +4 -3
  249. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -55
  250. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  251. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -47
  252. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  253. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -129
  254. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  255. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  256. package/dest/e2e_deploy_contract/deploy_test.js +0 -50
  257. package/dest/e2e_epochs/epochs_test.d.ts +0 -104
  258. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  259. package/dest/e2e_epochs/epochs_test.js +0 -389
  260. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  261. package/dest/e2e_fees/fees_test.d.ts +0 -88
  262. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  263. package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
  264. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  265. package/dest/e2e_l1_publisher/write_json.js +0 -56
  266. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  267. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  268. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  269. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  270. package/dest/e2e_nested_contract/nested_contract_test.js +0 -54
  271. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  272. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  273. package/dest/e2e_p2p/inactivity_slash_test.js +0 -136
  274. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  275. package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
  276. package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
  277. package/dest/e2e_p2p/shared.d.ts +0 -66
  278. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  279. package/dest/e2e_p2p/shared.js +0 -212
  280. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
  281. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
  282. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
  283. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
  284. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  285. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -193
  286. package/src/e2e_deploy_contract/deploy_test.ts +0 -85
  287. package/src/e2e_epochs/epochs_test.ts +0 -499
  288. package/src/e2e_l1_publisher/write_json.ts +0 -77
  289. package/src/e2e_nested_contract/nested_contract_test.ts +0 -75
  290. package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
  291. package/src/e2e_p2p/shared.ts +0 -343
  292. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
  293. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
  294. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  295. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
  296. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
  297. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
  298. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -1,18 +1,23 @@
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';
19
+ import { TxStatus } from '@aztec/stdlib/tx';
20
+ import { getGasLimits } from '@aztec/wallet-sdk/base-wallet';
16
21
  import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
17
22
 
18
23
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
@@ -51,6 +56,8 @@ export async function setupTestAccountsWithTokens(
51
56
 
52
57
  const aztecNode = createAztecNodeClient(nodeUrl);
53
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);
54
61
 
55
62
  const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
56
63
  0,
@@ -89,7 +96,7 @@ export async function deploySponsoredTestAccountsWithTokens(
89
96
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
90
97
  const recipientDeployMethod = await recipientAccount.getDeployMethod();
91
98
  await recipientDeployMethod.send({
92
- from: AztecAddress.ZERO,
99
+ from: NO_FROM,
93
100
  fee: { paymentMethod },
94
101
  wait: { timeout: 2400 },
95
102
  });
@@ -97,7 +104,7 @@ export async function deploySponsoredTestAccountsWithTokens(
97
104
  fundedAccounts.map(async a => {
98
105
  const deployMethod = await a.getDeployMethod();
99
106
  await deployMethod.send({
100
- from: AztecAddress.ZERO,
107
+ from: NO_FROM,
101
108
  fee: { paymentMethod },
102
109
  wait: { timeout: 2400 },
103
110
  }); // increase timeout on purpose in order to account for two empty epochs
@@ -137,38 +144,58 @@ async function deployAccountWithDiagnostics(
137
144
  estimateGas?: boolean,
138
145
  ): Promise<void> {
139
146
  const deployMethod = await account.getDeployMethod();
140
- let txHash;
141
- try {
142
- let gasSettings;
143
- if (estimateGas) {
144
- const sim = await deployMethod.simulate({ from: AztecAddress.ZERO, fee: { paymentMethod } });
145
- gasSettings = sim.estimatedGas;
146
- logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
147
- }
148
- const deployResult = await deployMethod.send({
149
- from: AztecAddress.ZERO,
150
- fee: { paymentMethod, gasSettings },
151
- wait: NO_WAIT,
152
- });
153
- txHash = deployResult.txHash;
154
- await waitForTx(aztecNode, txHash, { timeout: 2400 });
155
- logger.info(`${accountLabel} deployed at ${account.address}`);
156
- } catch (error) {
157
- const blockNumber = await aztecNode.getBlockNumber();
158
- let receipt;
159
- try {
160
- receipt = await aztecNode.getTxReceipt(txHash);
161
- } catch {
162
- receipt = 'unavailable';
163
- }
164
- logger.error(`${accountLabel} deployment failed`, {
165
- txHash: txHash.toString(),
166
- receipt: JSON.stringify(receipt),
167
- currentBlockNumber: blockNumber,
168
- error: String(error),
169
- });
170
- throw error;
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}`);
171
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
+ );
172
199
  }
173
200
 
174
201
  async function deployAccountsInBatches(
@@ -251,6 +278,8 @@ export async function deployTestAccountsWithTokens(
251
278
  ): Promise<TestAccounts> {
252
279
  const aztecNode = createAztecNodeClient(nodeUrl);
253
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);
254
283
 
255
284
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
256
285
  const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
@@ -269,7 +298,7 @@ export async function deployTestAccountsWithTokens(
269
298
  fundedAccounts.map(async (a, i) => {
270
299
  const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
271
300
  const deployMethod = await a.getDeployMethod();
272
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } });
301
+ await deployMethod.send({ from: NO_FROM, fee: { paymentMethod } });
273
302
  logger.info(`Account deployed at ${a.address}`);
274
303
  }),
275
304
  );
@@ -312,9 +341,7 @@ async function bridgeL1FeeJuice(
312
341
  const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
313
342
  const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
314
343
 
315
- const isSynced = async () =>
316
- (await aztecNode.getL1ToL2MessageCheckpoint(Fr.fromHexString(claim.messageHash))) !== undefined;
317
- await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
344
+ await waitForL1ToL2MessageReady(aztecNode, Fr.fromHexString(claim.messageHash), { timeoutSeconds: 24 });
318
345
 
319
346
  log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
320
347
  return claim;
@@ -345,14 +372,18 @@ async function deployTokenAndMint(
345
372
  logger: Logger,
346
373
  ) {
347
374
  logger.verbose(`Deploying TokenContract...`);
348
- const {
349
- receipt: { contract: tokenContract },
350
- } = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS).send({
375
+ const { contract: tokenContract } = await TokenContract.deploy(
376
+ wallet,
377
+ admin,
378
+ TOKEN_NAME,
379
+ TOKEN_SYMBOL,
380
+ TOKEN_DECIMALS,
381
+ ).send({
351
382
  from: admin,
352
383
  fee: {
353
384
  paymentMethod,
354
385
  },
355
- wait: { timeout: 600, returnReceipt: true },
386
+ wait: { timeout: 600 },
356
387
  });
357
388
 
358
389
  const tokenAddress = tokenContract.address;
@@ -403,7 +434,9 @@ export async function performTransfers({
403
434
 
404
435
  const provenTxs = await Promise.all(txs);
405
436
 
406
- 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 } })));
407
440
 
408
441
  logger.info(`Completed round ${i + 1} / ${rounds}`);
409
442
  }
@@ -430,6 +463,8 @@ export async function createWalletAndAztecNodeClient(
430
463
  proverEnabled,
431
464
  };
432
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);
433
468
 
434
469
  return {
435
470
  wallet,
@@ -1,6 +1,6 @@
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
 
@@ -134,9 +134,12 @@ export class ProvingMetrics {
134
134
 
135
135
  export type TxInclusionData = {
136
136
  txHash: string;
137
- sentAt: number;
138
- minedAt: number;
139
- 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;
140
143
  blocknumber: number;
141
144
  priorityFee: number;
142
145
  totalFee: number;
@@ -147,7 +150,7 @@ export type TxInclusionData = {
147
150
  export class TxInclusionMetrics {
148
151
  private data = new Map<string, TxInclusionData>();
149
152
  private groups = new Set<string>();
150
- private blocks = new Map<number, Promise<L2Block | undefined>>();
153
+ private blocks = new Map<number, Promise<BlockResponse<{ includeTransactions: true }> | undefined>>();
151
154
 
152
155
  private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
153
156
 
@@ -158,6 +161,7 @@ export class TxInclusionMetrics {
158
161
  private mempoolMinedDelay:
159
162
  | { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
160
163
  | undefined;
164
+ private inclusionOutcome: { mined: number; failed: number } | undefined;
161
165
 
162
166
  constructor(
163
167
  private aztecNode: AztecNode,
@@ -174,9 +178,9 @@ export class TxInclusionMetrics {
174
178
 
175
179
  this.data.set(txHash, {
176
180
  txHash,
177
- sentAt: Math.trunc(Date.now() / 1000),
178
- minedAt: -1,
179
- attestedAt: -1,
181
+ sentAtMs: Date.now(),
182
+ minedAtMs: -1,
183
+ attestedAtMs: -1,
180
184
  blocknumber: -1,
181
185
  priorityFee: Number(priorityFees.feePerDaGas + priorityFees.feePerL2Gas),
182
186
  totalFee: -1,
@@ -186,6 +190,28 @@ export class TxInclusionMetrics {
186
190
  this.groups.add(group);
187
191
  }
188
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
+
189
215
  async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
190
216
  const { txHash, blockNumber } = txReceipt;
191
217
  if (!txReceipt.isMined() || !txReceipt.hasExecutionSucceeded() || !blockNumber) {
@@ -197,26 +223,53 @@ export class TxInclusionMetrics {
197
223
  return;
198
224
  }
199
225
 
200
- if (!this.blocks.has(blockNumber)) {
201
- this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber));
202
- }
203
-
204
- const block = await this.blocks.get(blockNumber)!;
205
- if (!block) {
206
- this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
207
- return;
208
- }
209
226
  const data = this.data.get(txHash.toString());
210
227
  if (!data) {
211
228
  const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
212
229
  this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
213
230
  throw new Error(message);
214
231
  }
215
- data.blocknumber = blockNumber;
216
- data.minedAt = Number(block.header.globalVariables.timestamp);
217
- data.attestedAt = -1;
218
232
  data.totalFee = Number(txReceipt.transactionFee ?? 0n);
219
- 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;
220
273
  }
221
274
 
222
275
  public inclusionTimeInSeconds(group: string): {
@@ -229,12 +282,28 @@ export class TxInclusionMetrics {
229
282
  p99: number;
230
283
  } {
231
284
  const histogram = createHistogram({});
285
+ let nonPositive = 0;
232
286
  for (const tx of this.data.values()) {
233
- if (!tx.blocknumber || tx.group !== group || tx.minedAt === -1) {
287
+ if (!tx.blocknumber || tx.group !== group || tx.minedAtMs === -1) {
234
288
  continue;
235
289
  }
236
290
 
237
- 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 });
238
307
  }
239
308
 
240
309
  if (histogram.count === 0) {
@@ -284,6 +353,11 @@ export class TxInclusionMetrics {
284
353
  this.mempoolMinedDelay = { txP50, txP95, attestationP50, attestationP95 };
285
354
  }
286
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
+
287
361
  toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
288
362
  const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
289
363
  for (const group of this.groups) {
@@ -365,6 +439,16 @@ export class TxInclusionMetrics {
365
439
  );
366
440
  }
367
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
+
368
452
  const scenario = process.env.BENCH_SCENARIO?.trim();
369
453
  if (!scenario) {
370
454
  return data;
@@ -71,7 +71,7 @@ export async function waitForProvenToAdvance(
71
71
  // Get current proven block number
72
72
  let initialProvenBlock: number;
73
73
  try {
74
- const tips = await node.getL2Tips();
74
+ const tips = await node.getChainTips();
75
75
  initialProvenBlock = Number(tips.proven.block.number);
76
76
  log.info(`Current proven block: ${initialProvenBlock}. Waiting for it to increase...`);
77
77
  } catch (err) {
@@ -82,7 +82,7 @@ export async function waitForProvenToAdvance(
82
82
  await retryUntil(
83
83
  async () => {
84
84
  try {
85
- const tips = await node.getL2Tips();
85
+ const tips = await node.getChainTips();
86
86
  const currentProvenBlock = Number(tips.proven.block.number);
87
87
  const proposedBlock = Number(tips.proposed.number);
88
88