@aztec/end-to-end 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0

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 (404) 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/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/automine/token/blacklist_token_contract_test.js +166 -0
  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/automine/token/token_contract_test.js +119 -0
  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 +17 -2
  27. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  28. package/dest/bench/client_flows/benchmark.js +40 -1
  29. package/dest/bench/client_flows/client_flows_benchmark.d.ts +19 -20
  30. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  31. package/dest/bench/client_flows/client_flows_benchmark.js +155 -159
  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/client_flows/data_extractor.js +4 -1
  36. package/dest/bench/utils.d.ts +11 -10
  37. package/dest/bench/utils.d.ts.map +1 -1
  38. package/dest/bench/utils.js +126 -23
  39. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  40. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  41. package/dest/composed/ha/ha_full_setup.js +383 -0
  42. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  43. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  44. package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +1 -1
  45. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  46. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  47. package/dest/fixtures/authwit_proxy.js +34 -0
  48. package/dest/fixtures/e2e_prover_test.d.ts +25 -29
  49. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  50. package/dest/fixtures/e2e_prover_test.js +147 -151
  51. package/dest/fixtures/elu_monitor.d.ts +21 -0
  52. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  53. package/dest/fixtures/elu_monitor.js +102 -0
  54. package/dest/fixtures/fixtures.d.ts +84 -3
  55. package/dest/fixtures/fixtures.d.ts.map +1 -1
  56. package/dest/fixtures/fixtures.js +87 -2
  57. package/dest/fixtures/get_acvm_config.js +1 -1
  58. package/dest/fixtures/get_bb_config.d.ts +1 -1
  59. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  60. package/dest/fixtures/get_bb_config.js +5 -5
  61. package/dest/fixtures/ha_setup.d.ts +71 -0
  62. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  63. package/dest/fixtures/ha_setup.js +119 -0
  64. package/dest/fixtures/index.d.ts +3 -1
  65. package/dest/fixtures/index.d.ts.map +1 -1
  66. package/dest/fixtures/index.js +2 -0
  67. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  68. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  69. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  70. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  71. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  72. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  73. package/dest/fixtures/setup.d.ts +269 -0
  74. package/dest/fixtures/setup.d.ts.map +1 -0
  75. package/dest/fixtures/setup.js +688 -0
  76. package/dest/fixtures/setup_p2p_test.d.ts +22 -11
  77. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  78. package/dest/fixtures/setup_p2p_test.js +49 -38
  79. package/dest/fixtures/timing.d.ts +42 -0
  80. package/dest/fixtures/timing.d.ts.map +1 -0
  81. package/dest/fixtures/timing.js +72 -0
  82. package/dest/fixtures/token_utils.d.ts +22 -4
  83. package/dest/fixtures/token_utils.d.ts.map +1 -1
  84. package/dest/fixtures/token_utils.js +28 -7
  85. package/dest/fixtures/utils.d.ts +5 -638
  86. package/dest/fixtures/utils.d.ts.map +1 -1
  87. package/dest/fixtures/utils.js +4 -647
  88. package/dest/fixtures/wait_helpers.d.ts +135 -0
  89. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  90. package/dest/fixtures/wait_helpers.js +154 -0
  91. package/dest/fixtures/web3signer.js +1 -1
  92. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  93. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  94. package/dest/fixtures/with_telemetry_utils.js +2 -2
  95. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  96. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  97. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  98. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  99. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  100. package/dest/forward-compatibility/wallet_service.js +109 -0
  101. package/dest/install_legacy_contracts.d.cts +10 -0
  102. package/dest/install_legacy_contracts.d.cts.map +1 -0
  103. package/dest/legacy-jest-resolver.d.cts +3 -0
  104. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  105. package/dest/multi-node/block-production/setup.d.ts +97 -0
  106. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  107. package/dest/multi-node/block-production/setup.js +158 -0
  108. package/dest/multi-node/governance/setup.d.ts +67 -0
  109. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  110. package/dest/multi-node/governance/setup.js +126 -0
  111. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  112. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  113. package/dest/multi-node/multi_node_test_context.js +347 -0
  114. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  115. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  116. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  117. package/dest/multi-node/slashing/setup.d.ts +167 -0
  118. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  119. package/dest/multi-node/slashing/setup.js +275 -0
  120. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +33 -21
  121. package/dest/p2p/p2p_network.d.ts.map +1 -0
  122. package/dest/p2p/p2p_network.js +389 -0
  123. package/dest/p2p/reqresp/utils.d.ts +19 -0
  124. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  125. package/dest/p2p/reqresp/utils.js +193 -0
  126. package/dest/p2p/shared.d.ts +72 -0
  127. package/dest/p2p/shared.d.ts.map +1 -0
  128. package/dest/p2p/shared.js +212 -0
  129. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  130. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  131. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  132. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  133. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  134. package/dest/quality_of_service/prometheus_client.js +67 -0
  135. package/dest/shared/cross_chain_test_harness.d.ts +22 -9
  136. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  137. package/dest/shared/cross_chain_test_harness.js +45 -40
  138. package/dest/shared/gas_portal_test_harness.d.ts +19 -6
  139. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  140. package/dest/shared/gas_portal_test_harness.js +27 -15
  141. package/dest/shared/index.d.ts +3 -2
  142. package/dest/shared/index.d.ts.map +1 -1
  143. package/dest/shared/index.js +1 -0
  144. package/dest/shared/jest_setup.js +41 -1
  145. package/dest/shared/mock_state_view.d.ts +86 -0
  146. package/dest/shared/mock_state_view.d.ts.map +1 -0
  147. package/dest/shared/mock_state_view.js +186 -0
  148. package/dest/shared/submit-transactions.d.ts +4 -4
  149. package/dest/shared/submit-transactions.d.ts.map +1 -1
  150. package/dest/shared/submit-transactions.js +19 -14
  151. package/dest/shared/timing_env.d.js +5 -0
  152. package/dest/shared/timing_env.js +365 -0
  153. package/dest/shared/uniswap_l1_l2.d.ts +3 -27
  154. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  155. package/dest/shared/uniswap_l1_l2.js +86 -54
  156. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  157. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  158. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  159. package/dest/simulators/lending_simulator.d.ts +15 -4
  160. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  161. package/dest/simulators/lending_simulator.js +29 -17
  162. package/dest/simulators/token_simulator.d.ts +1 -1
  163. package/dest/simulators/token_simulator.d.ts.map +1 -1
  164. package/dest/simulators/token_simulator.js +3 -24
  165. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  166. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  167. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  168. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  169. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  170. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  171. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  172. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  173. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +21 -10
  174. package/dest/single-node/fees/fees_test.d.ts +93 -0
  175. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  176. package/dest/single-node/fees/fees_test.js +274 -0
  177. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  178. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  179. package/dest/single-node/l1-reorgs/setup.js +57 -0
  180. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  181. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  182. package/dest/single-node/partial-proofs/setup.js +5 -0
  183. package/dest/single-node/proving/setup.d.ts +5 -0
  184. package/dest/single-node/proving/setup.d.ts.map +1 -0
  185. package/dest/single-node/proving/setup.js +5 -0
  186. package/dest/single-node/recovery/setup.d.ts +5 -0
  187. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  188. package/dest/single-node/recovery/setup.js +5 -0
  189. package/dest/single-node/setup.d.ts +49 -0
  190. package/dest/single-node/setup.d.ts.map +1 -0
  191. package/dest/single-node/setup.js +56 -0
  192. package/dest/single-node/single_node_test_context.d.ts +360 -0
  193. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  194. package/dest/single-node/single_node_test_context.js +833 -0
  195. package/dest/spartan/setup_test_wallets.d.ts +15 -5
  196. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  197. package/dest/spartan/setup_test_wallets.js +155 -50
  198. package/dest/spartan/tx_metrics.d.ts +111 -0
  199. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  200. package/dest/spartan/tx_metrics.js +507 -0
  201. package/dest/spartan/utils/bot.d.ts +28 -0
  202. package/dest/spartan/utils/bot.d.ts.map +1 -0
  203. package/dest/spartan/utils/bot.js +142 -0
  204. package/dest/spartan/utils/chaos.d.ts +79 -0
  205. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  206. package/dest/spartan/utils/chaos.js +142 -0
  207. package/dest/spartan/utils/clients.d.ts +39 -0
  208. package/dest/spartan/utils/clients.d.ts.map +1 -0
  209. package/dest/spartan/utils/clients.js +90 -0
  210. package/dest/spartan/utils/config.d.ts +19 -0
  211. package/dest/spartan/utils/config.d.ts.map +1 -0
  212. package/dest/spartan/utils/config.js +23 -0
  213. package/dest/spartan/utils/health.d.ts +63 -0
  214. package/dest/spartan/utils/health.d.ts.map +1 -0
  215. package/dest/spartan/utils/health.js +202 -0
  216. package/dest/spartan/utils/helm.d.ts +15 -0
  217. package/dest/spartan/utils/helm.d.ts.map +1 -0
  218. package/dest/spartan/utils/helm.js +47 -0
  219. package/dest/spartan/utils/index.d.ts +11 -0
  220. package/dest/spartan/utils/index.d.ts.map +1 -0
  221. package/dest/spartan/utils/index.js +22 -0
  222. package/dest/spartan/utils/k8s.d.ts +128 -0
  223. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  224. package/dest/spartan/utils/k8s.js +381 -0
  225. package/dest/spartan/utils/nodes.d.ts +40 -0
  226. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  227. package/dest/spartan/utils/nodes.js +461 -0
  228. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  229. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  230. package/dest/spartan/utils/pod_logs.js +74 -0
  231. package/dest/spartan/utils/scripts.d.ts +30 -0
  232. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  233. package/dest/spartan/utils/scripts.js +81 -0
  234. package/dest/spartan/utils.d.ts +2 -221
  235. package/dest/spartan/utils.d.ts.map +1 -1
  236. package/dest/spartan/utils.js +1 -782
  237. package/dest/test-wallet/test_wallet.d.ts +105 -0
  238. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  239. package/dest/test-wallet/test_wallet.js +320 -0
  240. package/dest/test-wallet/utils.d.ts +76 -0
  241. package/dest/test-wallet/utils.d.ts.map +1 -0
  242. package/dest/test-wallet/utils.js +126 -0
  243. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  244. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  245. package/dest/test-wallet/wallet_worker_script.js +56 -0
  246. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  247. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  248. package/dest/test-wallet/worker_wallet.js +157 -0
  249. package/dest/test-wallet/worker_wallet_schema.d.ts +4 -0
  250. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  251. package/dest/test-wallet/worker_wallet_schema.js +23 -0
  252. package/package.json +54 -46
  253. package/src/automine/README.md +60 -0
  254. package/src/automine/automine_test_context.ts +153 -0
  255. package/src/automine/contracts/fixtures/storage_proof.json +915 -0
  256. package/src/automine/contracts/fixtures/storage_proof_fetcher.ts +190 -0
  257. package/src/automine/contracts/fixtures/storage_proof_fixture.ts +173 -0
  258. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  259. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  260. package/src/automine/token/blacklist_token_contract_test.ts +208 -0
  261. package/src/automine/token/token_contract_test.ts +146 -0
  262. package/src/automine/token/token_test_helpers.ts +138 -0
  263. package/src/bench/client_flows/benchmark.ts +45 -2
  264. package/src/bench/client_flows/client_flows_benchmark.ts +222 -251
  265. package/src/bench/client_flows/config.ts +9 -1
  266. package/src/bench/client_flows/data_extractor.ts +2 -1
  267. package/src/bench/utils.ts +144 -25
  268. package/src/composed/ha/ha_full_setup.ts +466 -0
  269. package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +1 -1
  270. package/src/fixtures/authwit_proxy.ts +54 -0
  271. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  272. package/src/fixtures/e2e_prover_test.ts +172 -205
  273. package/src/fixtures/elu_monitor.ts +126 -0
  274. package/src/fixtures/fixtures.ts +111 -3
  275. package/src/fixtures/get_acvm_config.ts +1 -1
  276. package/src/fixtures/get_bb_config.ts +7 -6
  277. package/src/fixtures/ha_setup.ts +192 -0
  278. package/src/fixtures/index.ts +2 -0
  279. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  280. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  281. package/src/fixtures/setup.ts +987 -0
  282. package/src/fixtures/setup_p2p_test.ts +57 -57
  283. package/src/fixtures/timing.ts +97 -0
  284. package/src/fixtures/token_utils.ts +46 -10
  285. package/src/fixtures/utils.ts +26 -966
  286. package/src/fixtures/wait_helpers.ts +333 -0
  287. package/src/fixtures/web3signer.ts +1 -1
  288. package/src/fixtures/with_telemetry_utils.ts +2 -2
  289. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  290. package/src/forward-compatibility/wallet_service.ts +106 -0
  291. package/src/guides/up_quick_start.sh +7 -4
  292. package/src/infra/README.md +12 -0
  293. package/src/install_legacy_contracts.cjs +75 -0
  294. package/src/legacy-jest-resolver.cjs +112 -0
  295. package/src/multi-node/README.md +95 -0
  296. package/src/multi-node/block-production/setup.ts +272 -0
  297. package/src/multi-node/governance/setup.ts +172 -0
  298. package/src/multi-node/multi_node_test_context.ts +447 -0
  299. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  300. package/src/multi-node/slashing/setup.ts +433 -0
  301. package/src/p2p/README.md +78 -0
  302. package/src/p2p/p2p_network.ts +542 -0
  303. package/src/p2p/reqresp/utils.ts +263 -0
  304. package/src/p2p/shared.ts +329 -0
  305. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
  306. package/src/quality_of_service/prometheus_client.ts +113 -0
  307. package/src/shared/cross_chain_test_harness.ts +51 -44
  308. package/src/shared/gas_portal_test_harness.ts +35 -17
  309. package/src/shared/index.ts +2 -1
  310. package/src/shared/jest_setup.ts +51 -1
  311. package/src/shared/mock_state_view.ts +188 -0
  312. package/src/shared/submit-transactions.ts +22 -19
  313. package/src/shared/timing_env.d.mts +39 -0
  314. package/src/shared/timing_env.mjs +363 -0
  315. package/src/shared/uniswap_l1_l2.ts +136 -115
  316. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  317. package/src/simulators/lending_simulator.ts +36 -18
  318. package/src/simulators/token_simulator.ts +6 -30
  319. package/src/single-node/README.md +60 -0
  320. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  321. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  322. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +23 -15
  323. package/src/single-node/fees/fees_test.ts +368 -0
  324. package/src/single-node/l1-reorgs/setup.ts +93 -0
  325. package/src/single-node/partial-proofs/setup.ts +8 -0
  326. package/src/single-node/proving/setup.ts +15 -0
  327. package/src/single-node/recovery/setup.ts +8 -0
  328. package/src/single-node/setup.ts +63 -0
  329. package/src/single-node/single_node_test_context.ts +1041 -0
  330. package/src/spartan/setup_test_wallets.ts +217 -36
  331. package/src/spartan/tx_metrics.ts +460 -0
  332. package/src/spartan/utils/bot.ts +188 -0
  333. package/src/spartan/utils/chaos.ts +253 -0
  334. package/src/spartan/utils/clients.ts +100 -0
  335. package/src/spartan/utils/config.ts +29 -0
  336. package/src/spartan/utils/health.ts +255 -0
  337. package/src/spartan/utils/helm.ts +84 -0
  338. package/src/spartan/utils/index.ts +71 -0
  339. package/src/spartan/utils/k8s.ts +535 -0
  340. package/src/spartan/utils/nodes.ts +543 -0
  341. package/src/spartan/utils/pod_logs.ts +99 -0
  342. package/src/spartan/utils/scripts.ts +99 -0
  343. package/src/spartan/utils.ts +1 -983
  344. package/src/test-wallet/test_wallet.ts +426 -0
  345. package/src/test-wallet/utils.ts +205 -0
  346. package/src/test-wallet/wallet_worker_script.ts +66 -0
  347. package/src/test-wallet/worker_wallet.ts +216 -0
  348. package/src/test-wallet/worker_wallet_schema.ts +14 -0
  349. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -54
  350. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  351. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +0 -185
  352. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -41
  353. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  354. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -108
  355. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
  356. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  357. package/dest/e2e_deploy_contract/deploy_test.js +0 -45
  358. package/dest/e2e_epochs/epochs_test.d.ts +0 -93
  359. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  360. package/dest/e2e_epochs/epochs_test.js +0 -337
  361. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  362. package/dest/e2e_fees/fees_test.d.ts +0 -85
  363. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  364. package/dest/e2e_fees/fees_test.js +0 -263
  365. package/dest/e2e_l1_publisher/write_json.d.ts +0 -10
  366. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  367. package/dest/e2e_l1_publisher/write_json.js +0 -58
  368. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  369. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  370. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -29
  371. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  372. package/dest/e2e_nested_contract/nested_contract_test.js +0 -64
  373. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  374. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  375. package/dest/e2e_p2p/inactivity_slash_test.js +0 -139
  376. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  377. package/dest/e2e_p2p/p2p_network.js +0 -320
  378. package/dest/e2e_p2p/shared.d.ts +0 -46
  379. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  380. package/dest/e2e_p2p/shared.js +0 -184
  381. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -35
  382. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  383. package/dest/e2e_token_contract/token_contract_test.js +0 -126
  384. package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
  385. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  386. package/dest/fixtures/setup_l1_contracts.js +0 -17
  387. package/dest/fixtures/snapshot_manager.d.ts +0 -95
  388. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  389. package/dest/fixtures/snapshot_manager.js +0 -505
  390. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  391. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  392. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +0 -256
  393. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -179
  394. package/src/e2e_deploy_contract/deploy_test.ts +0 -78
  395. package/src/e2e_epochs/epochs_test.ts +0 -438
  396. package/src/e2e_fees/fees_test.ts +0 -382
  397. package/src/e2e_l1_publisher/write_json.ts +0 -77
  398. package/src/e2e_nested_contract/nested_contract_test.ts +0 -96
  399. package/src/e2e_p2p/inactivity_slash_test.ts +0 -182
  400. package/src/e2e_p2p/p2p_network.ts +0 -476
  401. package/src/e2e_p2p/shared.ts +0 -285
  402. package/src/e2e_token_contract/token_contract_test.ts +0 -167
  403. package/src/fixtures/setup_l1_contracts.ts +0 -26
  404. package/src/fixtures/snapshot_manager.ts +0 -665
@@ -0,0 +1,186 @@
1
+ import { createLogger } from '@aztec/aztec.js/log';
2
+ import { getContract } from 'viem';
3
+ /**
4
+ * Mock StateView contract for testing the Uniswap price oracle.
5
+ *
6
+ * Wraps a compiled Solidity contract that mimics the Uniswap V4 StateView's getSlot0 function.
7
+ * The mock allows setting return values dynamically for testing different price scenarios.
8
+ *
9
+ * Solidity source:
10
+ * ```solidity
11
+ * // SPDX-License-Identifier: Apache-2.0
12
+ * pragma solidity >=0.8.27;
13
+ *
14
+ * contract MockStateView {
15
+ * uint160 public sqrtPriceX96;
16
+ * int24 public tick;
17
+ * uint24 public protocolFee;
18
+ * uint24 public lpFee;
19
+ *
20
+ * function setReturnValues(
21
+ * uint160 _sqrtPriceX96,
22
+ * int24 _tick,
23
+ * uint24 _protocolFee,
24
+ * uint24 _lpFee
25
+ * ) external {
26
+ * sqrtPriceX96 = _sqrtPriceX96;
27
+ * tick = _tick;
28
+ * protocolFee = _protocolFee;
29
+ * lpFee = _lpFee;
30
+ * }
31
+ *
32
+ * function getSlot0(bytes32 poolId) external view returns (uint160, int24, uint24, uint24) {
33
+ * return (sqrtPriceX96, tick, protocolFee, lpFee);
34
+ * }
35
+ * }
36
+ * ```
37
+ */ export class MockStateView {
38
+ address;
39
+ walletClient;
40
+ log;
41
+ static BYTECODE = '0x608060405234801561000f575f5ffd5b5060043610610060575f3560e01c80633eaf5d9f14610064578063704ce43e146100825780638db791d2146100a0578063b0e21e8a146100be578063b52e4bdd146100dc578063c815641c146100f8575b5f5ffd5b61006c61012b565b60405161007991906102ab565b60405180910390f35b61008a61013d565b60405161009791906102e1565b60405180910390f35b6100a8610151565b6040516100b59190610328565b60405180910390f35b6100c6610175565b6040516100d391906102e1565b60405180910390f35b6100f660048036038101906100f191906103c3565b610189565b005b610112600480360381019061010d919061045a565b61022b565b6040516101229493929190610485565b60405180910390f35b5f60149054906101000a900460020b81565b5f601a9054906101000a900462ffffff1681565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f60179054906101000a900462ffffff1681565b835f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550825f60146101000a81548162ffffff021916908360020b62ffffff160217905550815f60176101000a81548162ffffff021916908362ffffff160217905550805f601a6101000a81548162ffffff021916908362ffffff16021790555050505050565b5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff165f60149054906101000a900460020b5f60179054906101000a900462ffffff165f601a9054906101000a900462ffffff1693509350935093509193509193565b5f8160020b9050919050565b6102a581610290565b82525050565b5f6020820190506102be5f83018461029c565b92915050565b5f62ffffff82169050919050565b6102db816102c4565b82525050565b5f6020820190506102f45f8301846102d2565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b610322816102fa565b82525050565b5f60208201905061033b5f830184610319565b92915050565b5f5ffd5b61034e816102fa565b8114610358575f5ffd5b50565b5f8135905061036981610345565b92915050565b61037881610290565b8114610382575f5ffd5b50565b5f813590506103938161036f565b92915050565b6103a2816102c4565b81146103ac575f5ffd5b50565b5f813590506103bd81610399565b92915050565b5f5f5f5f608085870312156103db576103da610341565b5b5f6103e88782880161035b565b94505060206103f987828801610385565b935050604061040a878288016103af565b925050606061041b878288016103af565b91505092959194509250565b5f819050919050565b61043981610427565b8114610443575f5ffd5b50565b5f8135905061045481610430565b92915050565b5f6020828403121561046f5761046e610341565b5b5f61047c84828501610446565b91505092915050565b5f6080820190506104985f830187610319565b6104a5602083018661029c565b6104b260408301856102d2565b6104bf60608301846102d2565b9594505050505056fea2646970667358221220f8b1bfff284535bc078368ed34bd5e78981644845f3c9c1f5a4b8448c976805464736f6c634300081f0033';
42
+ static ABI = [
43
+ {
44
+ type: 'function',
45
+ name: 'setReturnValues',
46
+ inputs: [
47
+ {
48
+ name: '_sqrtPriceX96',
49
+ type: 'uint160'
50
+ },
51
+ {
52
+ name: '_tick',
53
+ type: 'int24'
54
+ },
55
+ {
56
+ name: '_protocolFee',
57
+ type: 'uint24'
58
+ },
59
+ {
60
+ name: '_lpFee',
61
+ type: 'uint24'
62
+ }
63
+ ],
64
+ outputs: [],
65
+ stateMutability: 'nonpayable'
66
+ },
67
+ {
68
+ inputs: [
69
+ {
70
+ internalType: 'bytes32',
71
+ name: 'poolId',
72
+ type: 'bytes32'
73
+ }
74
+ ],
75
+ name: 'getSlot0',
76
+ outputs: [
77
+ {
78
+ internalType: 'uint160',
79
+ name: '',
80
+ type: 'uint160'
81
+ },
82
+ {
83
+ internalType: 'int24',
84
+ name: '',
85
+ type: 'int24'
86
+ },
87
+ {
88
+ internalType: 'uint24',
89
+ name: '',
90
+ type: 'uint24'
91
+ },
92
+ {
93
+ internalType: 'uint24',
94
+ name: '',
95
+ type: 'uint24'
96
+ }
97
+ ],
98
+ stateMutability: 'view',
99
+ type: 'function'
100
+ }
101
+ ];
102
+ constructor(address, walletClient, log = createLogger('mock-state-view')){
103
+ this.address = address;
104
+ this.walletClient = walletClient;
105
+ this.log = log;
106
+ }
107
+ /**
108
+ * Deploys the mock StateView contract at the specified address using etch.
109
+ * @param ethCheatCodes - Cheat codes for etching bytecode
110
+ * @param walletClient - Wallet client for sending transactions
111
+ * @param address - Address to deploy the mock at (typically the real StateView address)
112
+ */ static async deploy(ethCheatCodes, walletClient, address) {
113
+ await ethCheatCodes.etch(address, MockStateView.BYTECODE);
114
+ return new MockStateView(address, walletClient);
115
+ }
116
+ /**
117
+ * Sets the price using the ethPerFeeAssetE12 format (same as rollup contract).
118
+ * Computes the corresponding sqrtPriceX96 internally.
119
+ *
120
+ * Math (from fee_asset_price_oracle.ts):
121
+ * ethPerFeeAssetE12 = 1e12 * 2^192 / sqrtPriceX96^2
122
+ *
123
+ * Inverted:
124
+ * sqrtPriceX96^2 = 1e12 * 2^192 / ethPerFeeAssetE12
125
+ * sqrtPriceX96 = sqrt(1e12 * 2^192 / ethPerFeeAssetE12)
126
+ *
127
+ * @param ethPerFeeAssetE12 - The price in ETH per fee asset, scaled by 1e12
128
+ */ async setEthPerFeeAsset(ethPerFeeAssetE12) {
129
+ const sqrtPriceX96 = this.ethPerFeeAssetE12ToSqrtPriceX96(ethPerFeeAssetE12);
130
+ return await this.setSqrtPriceX96(sqrtPriceX96);
131
+ }
132
+ /**
133
+ * Sets the sqrtPriceX96 value directly (Uniswap's price encoding).
134
+ * @param sqrtPriceX96 - The sqrtPriceX96 value
135
+ * @param tick - The tick value (default 10)
136
+ * @param protocolFee - The protocol fee (default 0)
137
+ * @param lpFee - The LP fee (default 500)
138
+ */ async setSqrtPriceX96(sqrtPriceX96, tick = 10, protocolFee = 0, lpFee = 500) {
139
+ const contract = getContract({
140
+ address: this.address.toString(),
141
+ abi: MockStateView.ABI,
142
+ client: this.walletClient
143
+ });
144
+ const hash = await contract.write.setReturnValues([
145
+ sqrtPriceX96,
146
+ tick,
147
+ protocolFee,
148
+ lpFee
149
+ ]);
150
+ this.log.info(`Set sqrtPriceX96 to ${sqrtPriceX96}`);
151
+ return await this.walletClient.waitForTransactionReceipt({
152
+ hash
153
+ });
154
+ }
155
+ /**
156
+ * Converts ethPerFeeAssetE12 to sqrtPriceX96 (inverse of sqrtPriceX96ToEthPerFeeAssetE12).
157
+ *
158
+ * Math:
159
+ * sqrtPriceX96 = sqrt(1e12 * 2^192 / ethPerFeeAssetE12)
160
+ */ ethPerFeeAssetE12ToSqrtPriceX96(ethPerFeeAssetE12) {
161
+ if (ethPerFeeAssetE12 === 0n) {
162
+ throw new Error('Cannot convert zero ethPerFeeAssetE12');
163
+ }
164
+ const Q192 = 2n ** 192n;
165
+ const sqrtPriceSquared = 10n ** 12n * Q192 / ethPerFeeAssetE12;
166
+ return this.bigintSqrt(sqrtPriceSquared);
167
+ }
168
+ /** Integer square root using Newton's method */ bigintSqrt(n) {
169
+ if (n < 0n) {
170
+ throw new Error('Cannot compute sqrt of negative number');
171
+ }
172
+ if (n === 0n) {
173
+ return 0n;
174
+ }
175
+ let x = n;
176
+ let y = (x + 1n) / 2n;
177
+ while(y < x){
178
+ x = y;
179
+ y = (x + n / x) / 2n;
180
+ }
181
+ return x;
182
+ }
183
+ }
184
+ export function diffInBps(a, b) {
185
+ return (a - b) * 10000n / b;
186
+ }
@@ -1,6 +1,6 @@
1
1
  import { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import type { SentTx } from '@aztec/aztec.js/contracts';
3
2
  import type { Logger } from '@aztec/aztec.js/log';
4
- import type { TestWallet } from '@aztec/test-wallet/server';
5
- export declare const submitTxsTo: (wallet: TestWallet, submitter: AztecAddress, numTxs: number, logger: Logger) => Promise<SentTx[]>;
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3VibWl0LXRyYW5zYWN0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NoYXJlZC9zdWJtaXQtdHJhbnNhY3Rpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV4RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUdsRCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUc1RCxlQUFPLE1BQU0sV0FBVyxvR0EyQnZCLENBQUMifQ==
3
+ import { TxHash } from '@aztec/aztec.js/tx';
4
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
5
+ export declare const submitTxsTo: (wallet: TestWallet, submitter: AztecAddress, numTxs: number, logger: Logger) => Promise<TxHash[]>;
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3VibWl0LXRyYW5zYWN0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NoYXJlZC9zdWJtaXQtdHJhbnNhY3Rpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUd6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNsRCxPQUFPLEVBQUUsTUFBTSxFQUE0QixNQUFNLG9CQUFvQixDQUFDO0FBSXRFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBR2hFLGVBQU8sTUFBTSxXQUFXLG9HQTRCdkIsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"submit-transactions.d.ts","sourceRoot":"","sources":["../../src/shared/submit-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,eAAO,MAAM,WAAW,oGA2BvB,CAAC"}
1
+ {"version":3,"file":"submit-transactions.d.ts","sourceRoot":"","sources":["../../src/shared/submit-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAA4B,MAAM,oBAAoB,CAAC;AAItE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,eAAO,MAAM,WAAW,oGA4BvB,CAAC"}
@@ -1,24 +1,29 @@
1
- import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields';
1
+ import { NO_WAIT, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
2
+ import { Fr } from '@aztec/aztec.js/fields';
2
3
  import { TxStatus } from '@aztec/aztec.js/tx';
3
4
  import { times } from '@aztec/foundation/collection';
5
+ import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
4
6
  // submits a set of transactions to the provided Wallet
5
7
  export const submitTxsTo = async (wallet, submitter, numTxs, logger)=>{
6
- const txs = [];
8
+ // Register (without deploying) a single TestContract instance to source cheap throwaway txs from.
9
+ // emit_nullifier is #[noinitcheck], so it runs on a register-only instance — this avoids a full
10
+ // account-contract deployment per tx, which is all these callers were paying for a mined/gossiped tx.
11
+ const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
12
+ salt: Fr.random()
13
+ });
14
+ await wallet.registerContract(testContractInstance, TestContractArtifact);
15
+ const contract = TestContract.at(testContractInstance.address, wallet);
16
+ const txHashes = [];
7
17
  await Promise.all(times(numTxs, async ()=>{
8
- const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
9
- const deployMethod = await accountManager.getDeployMethod();
10
- const tx = deployMethod.send({
11
- from: submitter
18
+ const { txHash } = await contract.methods.emit_nullifier(Fr.random()).send({
19
+ from: submitter,
20
+ wait: NO_WAIT
12
21
  });
13
- const txHash = await tx.getTxHash();
14
22
  logger.info(`Tx sent with hash ${txHash}`);
15
- const receipt = await tx.getReceipt();
16
- expect(receipt).toEqual(expect.objectContaining({
17
- status: TxStatus.PENDING,
18
- error: ''
19
- }));
23
+ const receipt = await wallet.getTxReceipt(txHash);
24
+ expect(receipt.status).toBe(TxStatus.PENDING);
20
25
  logger.info(`Receipt received for ${txHash}`);
21
- txs.push(tx);
26
+ txHashes.push(txHash);
22
27
  }));
23
- return txs;
28
+ return txHashes;
24
29
  };
@@ -0,0 +1,5 @@
1
+ /** A single recorded span occurrence on the shared `performance.now()` clock. */ /**
2
+ * Groups `spans` by owner then tag, attaches a `spans` aggregate map to the matching record (or
3
+ * `suiteRecord` for `null`-owner spans), derives back-compat `setupFnMs` / `teardownFnMs`, drops spans
4
+ * whose owner matches no record, and returns the raw per-occurrence list (empty unless `emitSpanLines`).
5
+ */ export { };
@@ -0,0 +1,365 @@
1
+ import { appendFileSync, writeFileSync } from 'node:fs';
2
+ import { basename } from 'node:path';
3
+ import CustomEnvironment from '../../../foundation/src/jest/env.mjs';
4
+ // Per-test e2e timing environment. Gated entirely on the TEST_TIMING_FILE env var: when unset, this
5
+ // behaves exactly like the base CustomEnvironment (it only delegates). When set, it records, per test
6
+ // worker process, the time spent in jest before/after hooks and the test body, and folds in the named
7
+ // spans recorded via the `testSpan()` wrapper (fixtures/timing.ts) through a collector shared on
8
+ // `this.global`.
9
+ //
10
+ // Output is one JSONL file per worker process (the env runs once per worker). Each line carries a
11
+ // `type` discriminator and is one of:
12
+ // - `type: 'test'` (`name` set): beforeEach hooks, the it() body, afterEach hooks for one test; or
13
+ // - `type: 'suite'` (`name: null`): the suite-scoped beforeAll/afterAll hooks for the whole file.
14
+ //
15
+ // Each line also gains a `spans` map: per `category:label` tag the test/suite touched, the collector
16
+ // records `{ count, totalMs, busyMs, maxMs }`. `busyMs` is the duration of the union of the spans'
17
+ // `[start, end)` intervals on the shared `performance.now()` clock, so concurrent spans (Promise.all
18
+ // fan-out) do not inflate it the way `totalMs` does. The legacy `setupFnMs`/`teardownFnMs` fields are
19
+ // kept for back-compat, derived from the `setup:env`/`teardown:env` spans.
20
+ //
21
+ // When `TEST_TIMING_SPANS=1`, the collector additionally retains every raw span occurrence and emits
22
+ // one `type:"span"` line per occurrence (owner, name, ms) for deep dives, at the cost of a larger file.
23
+ export default class TimingEnvironment extends CustomEnvironment {
24
+ constructor(config, context){
25
+ super(config, context);
26
+ this.timingFile = process.env.TEST_TIMING_FILE;
27
+ if (!this.timingFile) {
28
+ return;
29
+ }
30
+ this.suite = basename(context?.testPath ?? config?.testPath ?? 'unknown').replace(/\.test\.[cm]?[jt]s$/, '');
31
+ this.meta = {
32
+ commit: process.env.COMMIT_HASH ?? null,
33
+ branch: process.env.TARGET_BRANCH ?? process.env.REF_NAME ?? null,
34
+ runId: process.env.RUN_ID ?? null
35
+ };
36
+ // Opt-in per-occurrence emission for deep dives (off by default keeps the JSONL one line per test).
37
+ this.emitSpanLines = process.env.TEST_TIMING_SPANS === '1';
38
+ // Shared collector. The instrumented helpers (running in the sandbox realm) read
39
+ // `globalThis.__e2eTimings`; this env (host realm) reads `this.global.__e2eTimings` — they are the
40
+ // same object. `current` is the full name of the test currently running (null during
41
+ // beforeAll/afterAll), used to attribute each span to a test or to the suite-scoped line. `spans`
42
+ // accumulates every recorded span until flush. The `start`/`end` timestamps come from the sandbox
43
+ // realm's `performance.now()`; Node's perf clock is process-wide (one monotonic origin across all
44
+ // realms), so merging the intervals here for `busyMs` is valid.
45
+ this.collector = {
46
+ current: null,
47
+ spans: []
48
+ };
49
+ this.global.__e2eTimings = this.collector;
50
+ // Records to flush as JSONL on teardown. One per test plus one suite-scoped record.
51
+ this.records = [];
52
+ this.recordsByName = new Map();
53
+ // The suite-scoped record (beforeAll/afterAll); bodyMs/totalMs are computed at flush time.
54
+ this.suiteRecord = {
55
+ name: null,
56
+ status: 'passed',
57
+ beforeHooksMs: 0,
58
+ afterHooksMs: 0
59
+ };
60
+ // Start times keyed by hook type (beforeAll/beforeEach/afterAll/afterEach).
61
+ this.hookStarts = {};
62
+ this.testStarts = new Map();
63
+ // Guards against double-flushing (we flush on both the teardown event and the teardown method).
64
+ this.flushed = false;
65
+ // Raw per-occurrence spans retained only when TEST_TIMING_SPANS=1, emitted as `type:"span"` lines.
66
+ this.rawSpans = [];
67
+ }
68
+ // Flush on the teardown method too: the jest lifecycle always calls this, whereas the 'teardown'
69
+ // event is not reliably delivered when a test run is interrupted. Whichever fires first wins.
70
+ async teardown() {
71
+ this.finalizeAndFlush();
72
+ await super.teardown();
73
+ }
74
+ async handleTestEvent(event, state) {
75
+ // Run the base env first so its unhandledRejection patching for after-hooks stays intact.
76
+ await super.handleTestEvent(event, state);
77
+ if (!this.timingFile) {
78
+ return;
79
+ }
80
+ const now = Date.now();
81
+ switch(event.name){
82
+ case 'hook_start':
83
+ {
84
+ this.hookStarts[event.hook.type] = now;
85
+ break;
86
+ }
87
+ case 'hook_success':
88
+ case 'hook_failure':
89
+ {
90
+ const start = this.hookStarts[event.hook.type];
91
+ if (start === undefined) {
92
+ break;
93
+ }
94
+ delete this.hookStarts[event.hook.type];
95
+ const ms = now - start;
96
+ if (event.hook.type === 'beforeEach') {
97
+ this.addToCurrent('beforeHooksMs', ms);
98
+ } else if (event.hook.type === 'afterEach') {
99
+ this.addToCurrent('afterHooksMs', ms);
100
+ } else if (event.hook.type === 'beforeAll') {
101
+ this.suiteRecord.beforeHooksMs += ms;
102
+ } else if (event.hook.type === 'afterAll') {
103
+ this.suiteRecord.afterHooksMs += ms;
104
+ }
105
+ break;
106
+ }
107
+ case 'test_start':
108
+ {
109
+ const name = this.fullTestName(event.test);
110
+ const record = {
111
+ type: 'test',
112
+ name,
113
+ status: 'passed',
114
+ setupFnMs: 0,
115
+ beforeHooksMs: 0,
116
+ bodyMs: 0,
117
+ teardownFnMs: 0,
118
+ afterHooksMs: 0,
119
+ totalMs: 0,
120
+ startedAt: new Date(now).toISOString()
121
+ };
122
+ this.records.push(record);
123
+ this.recordsByName.set(name, record);
124
+ this.testStarts.set(name, now);
125
+ this.collector.current = name;
126
+ break;
127
+ }
128
+ case 'test_fn_start':
129
+ {
130
+ this.testStarts.set(`fn:${this.fullTestName(event.test)}`, now);
131
+ break;
132
+ }
133
+ case 'test_fn_success':
134
+ case 'test_fn_failure':
135
+ {
136
+ const name = this.fullTestName(event.test);
137
+ const start = this.testStarts.get(`fn:${name}`);
138
+ const record = this.recordsByName.get(name);
139
+ if (record && start !== undefined) {
140
+ record.bodyMs = now - start;
141
+ }
142
+ if (record && event.name === 'test_fn_failure') {
143
+ record.status = 'failed';
144
+ }
145
+ break;
146
+ }
147
+ case 'test_done':
148
+ {
149
+ const name = this.fullTestName(event.test);
150
+ const record = this.recordsByName.get(name);
151
+ const start = this.testStarts.get(name);
152
+ if (record && start !== undefined) {
153
+ record.totalMs = now - start;
154
+ }
155
+ if (record && event.test?.errors?.length) {
156
+ record.status = 'failed';
157
+ }
158
+ this.collector.current = null;
159
+ break;
160
+ }
161
+ case 'teardown':
162
+ {
163
+ this.finalizeAndFlush();
164
+ break;
165
+ }
166
+ default:
167
+ break;
168
+ }
169
+ }
170
+ /** The record for the test currently running, if any. */ currentRecord() {
171
+ return this.collector.current ? this.recordsByName.get(this.collector.current) : undefined;
172
+ }
173
+ /** Adds `ms` to a hook bucket on the current per-test record, or the suite record during beforeAll/afterAll. */ addToCurrent(field, ms) {
174
+ const record = this.currentRecord();
175
+ if (record) {
176
+ record[field] += ms;
177
+ }
178
+ }
179
+ /** Builds the full test name by walking up the describe blocks, matching jest's currentTestName. */ fullTestName(test) {
180
+ if (!test) {
181
+ return null;
182
+ }
183
+ const parts = [];
184
+ let node = test;
185
+ while(node && node.name && node.name !== 'ROOT_DESCRIBE_BLOCK'){
186
+ parts.unshift(node.name);
187
+ node = node.parent;
188
+ }
189
+ return parts.join(' ');
190
+ }
191
+ /** Folds the collected spans into the per-test / suite records via {@link foldSpansInto}, then drains the collector. */ foldSpans() {
192
+ const rawSpans = foldSpansInto(this.collector.spans, {
193
+ recordsByName: this.recordsByName,
194
+ suiteRecord: this.suiteRecord,
195
+ emitSpanLines: this.emitSpanLines
196
+ });
197
+ this.rawSpans.push(...rawSpans);
198
+ this.collector.spans = [];
199
+ }
200
+ /** Folds spans into records, finalizes the suite-scoped record, and writes all JSONL. */ finalizeAndFlush() {
201
+ if (this.flushed || !this.timingFile) {
202
+ return;
203
+ }
204
+ this.flushed = true;
205
+ this.foldSpans();
206
+ const lines = [];
207
+ for (const record of this.records){
208
+ lines.push(this.toLine({
209
+ ...record
210
+ }));
211
+ }
212
+ lines.push(this.toLine({
213
+ type: 'suite',
214
+ name: null,
215
+ status: 'passed',
216
+ setupFnMs: this.suiteRecord.setupFnMs ?? 0,
217
+ beforeHooksMs: this.suiteRecord.beforeHooksMs,
218
+ teardownFnMs: this.suiteRecord.teardownFnMs ?? 0,
219
+ afterHooksMs: this.suiteRecord.afterHooksMs,
220
+ totalMs: this.suiteRecord.beforeHooksMs + this.suiteRecord.afterHooksMs,
221
+ spans: this.suiteRecord.spans
222
+ }));
223
+ for (const raw of this.rawSpans){
224
+ lines.push(this.toLine({
225
+ type: 'span',
226
+ name: raw.owner,
227
+ span: raw.name,
228
+ ms: raw.ms
229
+ }));
230
+ }
231
+ const payload = lines.join('\n') + '\n';
232
+ try {
233
+ // One file per worker process, but a worker may run several suites: append so we keep them all.
234
+ appendFileSync(this.timingFile, payload);
235
+ } catch {
236
+ try {
237
+ writeFileSync(this.timingFile, payload);
238
+ } catch {
239
+ // Timing is best-effort; never fail a test because we couldn't write the file.
240
+ }
241
+ }
242
+ }
243
+ /** Flattens metadata onto a record and serializes to a single JSON line, rounding all Ms fields. */ toLine(record) {
244
+ const obj = {
245
+ suite: this.suite,
246
+ ...record,
247
+ ...this.meta
248
+ };
249
+ for (const key of Object.keys(obj)){
250
+ if (key.endsWith('Ms') && typeof obj[key] === 'number') {
251
+ obj[key] = Math.round(obj[key]);
252
+ }
253
+ }
254
+ // Round the nested span aggregates' Ms fields too (totalMs/busyMs/maxMs per tag).
255
+ if (obj.spans && typeof obj.spans === 'object') {
256
+ for (const agg of Object.values(obj.spans)){
257
+ for (const key of Object.keys(agg)){
258
+ if (key.endsWith('Ms') && typeof agg[key] === 'number') {
259
+ agg[key] = Math.round(agg[key]);
260
+ }
261
+ }
262
+ }
263
+ }
264
+ return JSON.stringify(obj);
265
+ }
266
+ }
267
+ /**
268
+ * Aggregates a list of `{ start, end }` spans of one tag into `{ count, totalMs, busyMs, maxMs }`.
269
+ * `totalMs` is the naive sum of per-occurrence durations (correct for serial repeats); `busyMs` is
270
+ * the duration of the union of the `[start, end)` intervals (concurrency-correct — N concurrent
271
+ * spans collapse to their wall-clock span instead of summing to ~N×); `maxMs` is the longest single
272
+ * occurrence. All durations are on the shared process-wide `performance.now()` clock. Does not mutate
273
+ * the input array.
274
+ */ export function aggregateSpans(spans) {
275
+ let totalMs = 0;
276
+ let maxMs = 0;
277
+ for (const span of spans){
278
+ const ms = span.end - span.start;
279
+ totalMs += ms;
280
+ if (ms > maxMs) {
281
+ maxMs = ms;
282
+ }
283
+ }
284
+ // busyMs: sort by start and merge overlapping intervals, summing the merged lengths.
285
+ const sorted = [
286
+ ...spans
287
+ ].sort((a, b)=>a.start - b.start);
288
+ let busyMs = 0;
289
+ let mergeStart = null;
290
+ let mergeEnd = null;
291
+ for (const span of sorted){
292
+ if (mergeStart === null) {
293
+ mergeStart = span.start;
294
+ mergeEnd = span.end;
295
+ } else if (span.start <= mergeEnd) {
296
+ if (span.end > mergeEnd) {
297
+ mergeEnd = span.end;
298
+ }
299
+ } else {
300
+ busyMs += mergeEnd - mergeStart;
301
+ mergeStart = span.start;
302
+ mergeEnd = span.end;
303
+ }
304
+ }
305
+ if (mergeStart !== null) {
306
+ busyMs += mergeEnd - mergeStart;
307
+ }
308
+ return {
309
+ count: spans.length,
310
+ totalMs,
311
+ busyMs,
312
+ maxMs
313
+ };
314
+ }
315
+ /**
316
+ * Groups `spans` by owner, then by tag, and attaches a `spans` map of aggregates to the matching
317
+ * per-test record (looked up in `recordsByName`) or, for `null`-owner spans, to `suiteRecord`. Also
318
+ * derives the back-compat `setupFnMs` / `teardownFnMs` fields from the `setup:env:<mode>` /
319
+ * `teardown:env` aggregates (additive over any pre-existing value). Spans whose owner matches no
320
+ * record (e.g. the pinned `other:mempool-feeder` owner) are dropped. Returns the raw per-occurrence
321
+ * list (`{ owner, name, ms }`), which is empty unless `emitSpanLines` is set.
322
+ */ export function foldSpansInto(spans, { recordsByName, suiteRecord, emitSpanLines = false }) {
323
+ const rawSpans = [];
324
+ // Group by owner (null owner → suite record), then by tag.
325
+ const byOwner = new Map();
326
+ for (const span of spans){
327
+ const owner = span.owner ?? null;
328
+ let byName = byOwner.get(owner);
329
+ if (!byName) {
330
+ byName = new Map();
331
+ byOwner.set(owner, byName);
332
+ }
333
+ let list = byName.get(span.name);
334
+ if (!list) {
335
+ list = [];
336
+ byName.set(span.name, list);
337
+ }
338
+ list.push(span);
339
+ if (emitSpanLines) {
340
+ rawSpans.push({
341
+ owner,
342
+ name: span.name,
343
+ ms: span.end - span.start
344
+ });
345
+ }
346
+ }
347
+ for (const [owner, byName] of byOwner){
348
+ const record = owner === null ? suiteRecord : recordsByName.get(owner);
349
+ if (!record) {
350
+ continue;
351
+ }
352
+ const aggregates = {};
353
+ for (const [name, list] of byName){
354
+ aggregates[name] = aggregateSpans(list);
355
+ }
356
+ record.spans = aggregates;
357
+ // Back-compat: the legacy fn-span buckets are derived from the top-level env setup/teardown tags.
358
+ // The top-level setup is tagged `setup:env:<proverMode>` (the mode is a closed set, distinct from
359
+ // the `:anvil`/`:l1-deploy`/... sub-phase tags), so sum those three exact tags.
360
+ const setupFnMs = (aggregates['setup:env:none']?.totalMs ?? 0) + (aggregates['setup:env:fake']?.totalMs ?? 0) + (aggregates['setup:env:real']?.totalMs ?? 0);
361
+ record.setupFnMs = setupFnMs + (record.setupFnMs ?? 0);
362
+ record.teardownFnMs = (aggregates['teardown:env']?.totalMs ?? 0) + (record.teardownFnMs ?? 0);
363
+ }
364
+ return rawSpans;
365
+ }
@@ -1,27 +1,3 @@
1
- import { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import type { Logger } from '@aztec/aztec.js/log';
3
- import type { AztecNode } from '@aztec/aztec.js/node';
4
- import { CheatCodes } from '@aztec/aztec/testing';
5
- import { type DeployL1ContractsReturnType, type ExtendedViemWalletClient } from '@aztec/ethereum';
6
- import type { TestWallet } from '@aztec/test-wallet/server';
7
- /** Objects to be returned by the uniswap setup function */
8
- export type UniswapSetupContext = {
9
- /** Aztec Node instance */
10
- aztecNode: AztecNode;
11
- /** Logger instance named as the current test. */
12
- logger: Logger;
13
- /** The L1 wallet client, extended with public actions. */
14
- l1Client: ExtendedViemWalletClient;
15
- /** The wallet. */
16
- wallet: TestWallet;
17
- /** The owner address. */
18
- ownerAddress: AztecAddress;
19
- /** The sponsor wallet. */
20
- sponsorAddress: AztecAddress;
21
- /** */
22
- deployL1ContractsValues: DeployL1ContractsReturnType;
23
- /** Cheat codes instance. */
24
- cheatCodes: CheatCodes;
25
- };
26
- export declare const uniswapL1L2TestSuite: (setup: () => Promise<UniswapSetupContext>, cleanup: () => Promise<void>, expectedForkBlockNumber?: number) => void;
27
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5pc3dhcF9sMV9sMi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NoYXJlZC91bmlzd2FwX2wxX2wyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQWMsTUFBTSwyQkFBMkIsQ0FBQztBQUlyRSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNsRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDbEQsT0FBTyxFQUNMLEtBQUssMkJBQTJCLEVBQ2hDLEtBQUssd0JBQXdCLEVBSTlCLE1BQU0saUJBQWlCLENBQUM7QUFNekIsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFpQjVELDJEQUEyRDtBQUMzRCxNQUFNLE1BQU0sbUJBQW1CLEdBQUc7SUFDaEMsMEJBQTBCO0lBQzFCLFNBQVMsRUFBRSxTQUFTLENBQUM7SUFDckIsaURBQWlEO0lBQ2pELE1BQU0sRUFBRSxNQUFNLENBQUM7SUFDZiwwREFBMEQ7SUFDMUQsUUFBUSxFQUFFLHdCQUF3QixDQUFDO0lBQ25DLGtCQUFrQjtJQUNsQixNQUFNLEVBQUUsVUFBVSxDQUFDO0lBQ25CLHlCQUF5QjtJQUN6QixZQUFZLEVBQUUsWUFBWSxDQUFDO0lBQzNCLDBCQUEwQjtJQUMxQixjQUFjLEVBQUUsWUFBWSxDQUFDO0lBQzdCLE9BQU87SUFDUCx1QkFBdUIsRUFBRSwyQkFBMkIsQ0FBQztJQUNyRCw0QkFBNEI7SUFDNUIsVUFBVSxFQUFFLFVBQVUsQ0FBQztDQUN4QixDQUFDO0FBRUYsZUFBTyxNQUFNLG9CQUFvQixxSEFtK0JoQyxDQUFDIn0=
1
+ import { type EndToEndContext } from '../fixtures/utils.js';
2
+ export declare const uniswapL1L2TestSuite: (setup: () => Promise<EndToEndContext>, cleanup: () => Promise<void>, expectedForkBlockNumber?: number) => void;
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5pc3dhcF9sMV9sMi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NoYXJlZC91bmlzd2FwX2wxX2wyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXVCQSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQStCLE1BQU0sc0JBQXNCLENBQUM7QUFhekYsZUFBTyxNQUFNLG9CQUFvQixpSEE0Z0NoQyxDQUFDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,2BAA2B,CAAC;AAIrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAI9B,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAiB5D,2DAA2D;AAC3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,0BAA0B;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,QAAQ,EAAE,wBAAwB,CAAC;IACnC,kBAAkB;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,yBAAyB;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,0BAA0B;IAC1B,cAAc,EAAE,YAAY,CAAC;IAC7B,OAAO;IACP,uBAAuB,EAAE,2BAA2B,CAAC;IACrD,4BAA4B;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,oBAAoB,qHAm+BhC,CAAC"}
1
+ {"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,sBAAsB,CAAC;AAazF,eAAO,MAAM,oBAAoB,iHA4gChC,CAAC"}