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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/benchmark.d.ts +76 -0
  3. package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
  4. package/dest/bench/client_flows/benchmark.js +298 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
  6. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
  7. package/dest/bench/client_flows/client_flows_benchmark.js +318 -0
  8. package/dest/bench/client_flows/config.d.ts +14 -0
  9. package/dest/bench/client_flows/config.d.ts.map +1 -0
  10. package/dest/bench/client_flows/config.js +124 -0
  11. package/dest/bench/client_flows/data_extractor.d.ts +2 -0
  12. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
  13. package/dest/bench/client_flows/data_extractor.js +79 -0
  14. package/dest/bench/utils.d.ts +16 -41
  15. package/dest/bench/utils.d.ts.map +1 -1
  16. package/dest/bench/utils.js +46 -72
  17. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +30 -20
  18. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  19. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +137 -106
  20. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +44 -33
  21. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  22. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +136 -103
  23. package/dest/e2e_deploy_contract/deploy_test.d.ts +20 -11
  24. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  25. package/dest/e2e_deploy_contract/deploy_test.js +28 -28
  26. package/dest/e2e_epochs/epochs_test.d.ts +98 -24
  27. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  28. package/dest/e2e_epochs/epochs_test.js +366 -61
  29. package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
  30. package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
  31. package/dest/e2e_fees/bridging_race.notest.js +61 -0
  32. package/dest/e2e_fees/fees_test.d.ts +42 -24
  33. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  34. package/dest/e2e_fees/fees_test.js +194 -182
  35. package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
  36. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
  37. package/dest/e2e_l1_publisher/write_json.js +56 -0
  38. package/dest/e2e_multi_validator/utils.d.ts +12 -0
  39. package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
  40. package/dest/e2e_multi_validator/utils.js +214 -0
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts +16 -16
  42. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  43. package/dest/e2e_nested_contract/nested_contract_test.js +38 -43
  44. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  45. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  46. package/dest/e2e_p2p/inactivity_slash_test.js +137 -0
  47. package/dest/e2e_p2p/p2p_network.d.ts +287 -31
  48. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  49. package/dest/e2e_p2p/p2p_network.js +281 -183
  50. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  51. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  52. package/dest/e2e_p2p/reqresp/utils.js +206 -0
  53. package/dest/e2e_p2p/shared.d.ts +73 -8
  54. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  55. package/dest/e2e_p2p/shared.js +205 -27
  56. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  57. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  58. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  59. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  60. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  61. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  62. package/dest/e2e_token_contract/token_contract_test.d.ts +30 -15
  63. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  64. package/dest/e2e_token_contract/token_contract_test.js +110 -76
  65. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  66. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  67. package/dest/fixtures/authwit_proxy.js +34 -0
  68. package/dest/fixtures/e2e_prover_test.d.ts +56 -0
  69. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  70. package/dest/fixtures/e2e_prover_test.js +267 -0
  71. package/dest/fixtures/elu_monitor.d.ts +21 -0
  72. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  73. package/dest/fixtures/elu_monitor.js +102 -0
  74. package/dest/fixtures/fixtures.d.ts +79 -8
  75. package/dest/fixtures/fixtures.d.ts.map +1 -1
  76. package/dest/fixtures/fixtures.js +76 -5
  77. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  78. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  79. package/dest/fixtures/get_acvm_config.js +3 -15
  80. package/dest/fixtures/get_bb_config.d.ts +2 -2
  81. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  82. package/dest/fixtures/get_bb_config.js +10 -17
  83. package/dest/fixtures/ha_setup.d.ts +71 -0
  84. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  85. package/dest/fixtures/ha_setup.js +116 -0
  86. package/dest/fixtures/index.d.ts +2 -1
  87. package/dest/fixtures/index.d.ts.map +1 -1
  88. package/dest/fixtures/index.js +1 -0
  89. package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
  90. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  91. package/dest/fixtures/l1_to_l2_messaging.js +45 -19
  92. package/dest/fixtures/logging.d.ts +1 -1
  93. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  94. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  95. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  96. package/dest/fixtures/setup.d.ts +272 -0
  97. package/dest/fixtures/setup.d.ts.map +1 -0
  98. package/dest/fixtures/setup.js +735 -0
  99. package/dest/fixtures/setup_p2p_test.d.ts +28 -16
  100. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  101. package/dest/fixtures/setup_p2p_test.js +103 -32
  102. package/dest/fixtures/token_utils.d.ts +10 -4
  103. package/dest/fixtures/token_utils.d.ts.map +1 -1
  104. package/dest/fixtures/token_utils.js +30 -13
  105. package/dest/fixtures/utils.d.ts +5 -153
  106. package/dest/fixtures/utils.d.ts.map +1 -1
  107. package/dest/fixtures/utils.js +4 -552
  108. package/dest/fixtures/web3signer.d.ts +5 -0
  109. package/dest/fixtures/web3signer.d.ts.map +1 -0
  110. package/dest/fixtures/web3signer.js +53 -0
  111. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  112. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  113. package/dest/fixtures/with_telemetry_utils.js +2 -2
  114. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  115. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  116. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  117. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  118. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  119. package/dest/forward-compatibility/wallet_service.js +109 -0
  120. package/dest/index.d.ts +1 -1
  121. package/dest/install_legacy_contracts.d.cts +10 -0
  122. package/dest/install_legacy_contracts.d.cts.map +1 -0
  123. package/dest/legacy-jest-resolver.d.cts +3 -0
  124. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  125. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  126. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  127. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  128. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  129. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  130. package/dest/quality_of_service/prometheus_client.js +67 -0
  131. package/dest/shared/cross_chain_test_harness.d.ts +46 -27
  132. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  133. package/dest/shared/cross_chain_test_harness.js +113 -55
  134. package/dest/shared/gas_portal_test_harness.d.ts +39 -28
  135. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  136. package/dest/shared/gas_portal_test_harness.js +64 -34
  137. package/dest/shared/index.d.ts +3 -2
  138. package/dest/shared/index.d.ts.map +1 -1
  139. package/dest/shared/index.js +1 -0
  140. package/dest/shared/jest_setup.d.ts +1 -1
  141. package/dest/shared/jest_setup.js +42 -2
  142. package/dest/shared/mock_state_view.d.ts +86 -0
  143. package/dest/shared/mock_state_view.d.ts.map +1 -0
  144. package/dest/shared/mock_state_view.js +186 -0
  145. package/dest/shared/submit-transactions.d.ts +6 -4
  146. package/dest/shared/submit-transactions.d.ts.map +1 -1
  147. package/dest/shared/submit-transactions.js +15 -16
  148. package/dest/shared/uniswap_l1_l2.d.ts +3 -25
  149. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  150. package/dest/shared/uniswap_l1_l2.js +202 -135
  151. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  152. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  153. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  154. package/dest/simulators/index.d.ts +1 -1
  155. package/dest/simulators/lending_simulator.d.ts +16 -9
  156. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  157. package/dest/simulators/lending_simulator.js +38 -27
  158. package/dest/simulators/token_simulator.d.ts +6 -3
  159. package/dest/simulators/token_simulator.d.ts.map +1 -1
  160. package/dest/simulators/token_simulator.js +12 -30
  161. package/dest/spartan/setup_test_wallets.d.ts +36 -11
  162. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  163. package/dest/spartan/setup_test_wallets.js +301 -63
  164. package/dest/spartan/tx_metrics.d.ts +102 -0
  165. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  166. package/dest/spartan/tx_metrics.js +475 -0
  167. package/dest/spartan/utils/bot.d.ts +28 -0
  168. package/dest/spartan/utils/bot.d.ts.map +1 -0
  169. package/dest/spartan/utils/bot.js +142 -0
  170. package/dest/spartan/utils/chaos.d.ts +79 -0
  171. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  172. package/dest/spartan/utils/chaos.js +142 -0
  173. package/dest/spartan/utils/clients.d.ts +39 -0
  174. package/dest/spartan/utils/clients.d.ts.map +1 -0
  175. package/dest/spartan/utils/clients.js +90 -0
  176. package/dest/spartan/utils/config.d.ts +19 -0
  177. package/dest/spartan/utils/config.d.ts.map +1 -0
  178. package/dest/spartan/utils/config.js +23 -0
  179. package/dest/spartan/utils/health.d.ts +63 -0
  180. package/dest/spartan/utils/health.d.ts.map +1 -0
  181. package/dest/spartan/utils/health.js +202 -0
  182. package/dest/spartan/utils/helm.d.ts +15 -0
  183. package/dest/spartan/utils/helm.d.ts.map +1 -0
  184. package/dest/spartan/utils/helm.js +47 -0
  185. package/dest/spartan/utils/index.d.ts +11 -0
  186. package/dest/spartan/utils/index.d.ts.map +1 -0
  187. package/dest/spartan/utils/index.js +22 -0
  188. package/dest/spartan/utils/k8s.d.ts +128 -0
  189. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  190. package/dest/spartan/utils/k8s.js +381 -0
  191. package/dest/spartan/utils/nodes.d.ts +40 -0
  192. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  193. package/dest/spartan/utils/nodes.js +461 -0
  194. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  195. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  196. package/dest/spartan/utils/pod_logs.js +74 -0
  197. package/dest/spartan/utils/scripts.d.ts +30 -0
  198. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  199. package/dest/spartan/utils/scripts.js +81 -0
  200. package/dest/spartan/utils.d.ts +2 -415
  201. package/dest/spartan/utils.d.ts.map +1 -1
  202. package/dest/spartan/utils.js +1 -445
  203. package/dest/test-wallet/test_wallet.d.ts +85 -0
  204. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  205. package/dest/test-wallet/test_wallet.js +273 -0
  206. package/dest/test-wallet/utils.d.ts +41 -0
  207. package/dest/test-wallet/utils.d.ts.map +1 -0
  208. package/dest/test-wallet/utils.js +66 -0
  209. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  210. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  211. package/dest/test-wallet/wallet_worker_script.js +53 -0
  212. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  213. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  214. package/dest/test-wallet/worker_wallet.js +155 -0
  215. package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
  216. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  217. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  218. package/package.json +79 -64
  219. package/src/bench/client_flows/benchmark.ts +382 -0
  220. package/src/bench/client_flows/client_flows_benchmark.ts +399 -0
  221. package/src/bench/client_flows/config.ts +69 -0
  222. package/src/bench/client_flows/data_extractor.ts +89 -0
  223. package/src/bench/utils.ts +49 -87
  224. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +164 -172
  225. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +194 -183
  226. package/src/e2e_deploy_contract/deploy_test.ts +42 -49
  227. package/src/e2e_epochs/epochs_test.ts +451 -93
  228. package/src/e2e_fees/bridging_race.notest.ts +74 -0
  229. package/src/e2e_fees/fees_test.ts +249 -262
  230. package/src/e2e_l1_publisher/write_json.ts +77 -0
  231. package/src/e2e_multi_validator/utils.ts +258 -0
  232. package/src/e2e_nested_contract/nested_contract_test.ts +51 -60
  233. package/src/e2e_p2p/inactivity_slash_test.ts +180 -0
  234. package/src/e2e_p2p/p2p_network.ts +391 -240
  235. package/src/e2e_p2p/reqresp/utils.ts +274 -0
  236. package/src/e2e_p2p/shared.ts +304 -39
  237. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  238. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  239. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  240. package/src/e2e_token_contract/token_contract_test.ts +140 -124
  241. package/src/fixtures/authwit_proxy.ts +54 -0
  242. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  243. package/src/fixtures/e2e_prover_test.ts +329 -0
  244. package/src/fixtures/elu_monitor.ts +126 -0
  245. package/src/fixtures/fixtures.ts +98 -7
  246. package/src/fixtures/get_acvm_config.ts +4 -12
  247. package/src/fixtures/get_bb_config.ts +19 -13
  248. package/src/fixtures/ha_setup.ts +188 -0
  249. package/src/fixtures/index.ts +1 -0
  250. package/src/fixtures/l1_to_l2_messaging.ts +56 -24
  251. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  252. package/src/fixtures/setup.ts +1056 -0
  253. package/src/fixtures/setup_p2p_test.ts +142 -54
  254. package/src/fixtures/token_utils.ts +34 -16
  255. package/src/fixtures/utils.ts +29 -820
  256. package/src/fixtures/web3signer.ts +63 -0
  257. package/src/fixtures/with_telemetry_utils.ts +2 -2
  258. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  259. package/src/forward-compatibility/wallet_service.ts +104 -0
  260. package/src/guides/up_quick_start.sh +9 -19
  261. package/src/install_legacy_contracts.cjs +75 -0
  262. package/src/legacy-jest-resolver.cjs +112 -0
  263. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
  264. package/src/quality_of_service/prometheus_client.ts +113 -0
  265. package/src/shared/cross_chain_test_harness.ts +116 -90
  266. package/src/shared/gas_portal_test_harness.ts +75 -56
  267. package/src/shared/index.ts +2 -1
  268. package/src/shared/jest_setup.ts +52 -2
  269. package/src/shared/mock_state_view.ts +188 -0
  270. package/src/shared/submit-transactions.ts +19 -20
  271. package/src/shared/uniswap_l1_l2.ts +259 -234
  272. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  273. package/src/simulators/lending_simulator.ts +43 -26
  274. package/src/simulators/token_simulator.ts +18 -34
  275. package/src/spartan/DEVELOP.md +128 -0
  276. package/src/spartan/setup_test_wallets.ts +420 -96
  277. package/src/spartan/tx_metrics.ts +434 -0
  278. package/src/spartan/utils/bot.ts +188 -0
  279. package/src/spartan/utils/chaos.ts +253 -0
  280. package/src/spartan/utils/clients.ts +100 -0
  281. package/src/spartan/utils/config.ts +29 -0
  282. package/src/spartan/utils/health.ts +255 -0
  283. package/src/spartan/utils/helm.ts +84 -0
  284. package/src/spartan/utils/index.ts +71 -0
  285. package/src/spartan/utils/k8s.ts +535 -0
  286. package/src/spartan/utils/nodes.ts +543 -0
  287. package/src/spartan/utils/pod_logs.ts +99 -0
  288. package/src/spartan/utils/scripts.ts +99 -0
  289. package/src/spartan/utils.ts +1 -582
  290. package/src/test-wallet/test_wallet.ts +376 -0
  291. package/src/test-wallet/utils.ts +108 -0
  292. package/src/test-wallet/wallet_worker_script.ts +63 -0
  293. package/src/test-wallet/worker_wallet.ts +218 -0
  294. package/src/test-wallet/worker_wallet_schema.ts +13 -0
  295. package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
  296. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  297. package/dest/e2e_prover/e2e_prover_test.js +0 -291
  298. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  299. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  300. package/dest/fixtures/setup_l1_contracts.js +0 -17
  301. package/dest/fixtures/snapshot_manager.d.ts +0 -87
  302. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  303. package/dest/fixtures/snapshot_manager.js +0 -479
  304. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  305. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  306. package/dest/sample-dapp/connect.js +0 -12
  307. package/dest/sample-dapp/contracts.js +0 -10
  308. package/dest/sample-dapp/deploy.js +0 -35
  309. package/dest/sample-dapp/index.js +0 -98
  310. package/src/e2e_prover/e2e_prover_test.ts +0 -418
  311. package/src/fixtures/setup_l1_contracts.ts +0 -27
  312. package/src/fixtures/snapshot_manager.ts +0 -617
  313. package/src/sample-dapp/connect.mjs +0 -16
  314. package/src/sample-dapp/contracts.mjs +0 -14
  315. package/src/sample-dapp/deploy.mjs +0 -40
  316. package/src/sample-dapp/index.mjs +0 -128
@@ -0,0 +1,329 @@
1
+ import type { InitialAccountData } from '@aztec/accounts/testing';
2
+ import { AztecNodeService } from '@aztec/aztec-node';
3
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
+ import type { AztecNode } from '@aztec/aztec.js/node';
6
+ import { CheatCodes } from '@aztec/aztec/testing';
7
+ import type { ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
8
+ import { BackendType, Barretenberg } from '@aztec/bb.js';
9
+ import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
10
+ import { Buffer32 } from '@aztec/foundation/buffer';
11
+ import { SecretValue } from '@aztec/foundation/config';
12
+ import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
13
+ import { TokenContract } from '@aztec/noir-contracts.js/Token';
14
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
15
+ import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
16
+ import { getGenesisValues } from '@aztec/world-state/testing';
17
+
18
+ import { type Hex, getContract } from 'viem';
19
+ import { privateKeyToAddress } from 'viem/accounts';
20
+
21
+ import { TokenSimulator } from '../simulators/token_simulator.js';
22
+ import { TestWallet } from '../test-wallet/test_wallet.js';
23
+ import { getACVMConfig } from './get_acvm_config.js';
24
+ import { getBBConfig } from './get_bb_config.js';
25
+ import {
26
+ type EndToEndContext,
27
+ type SetupOptions,
28
+ deployAccounts,
29
+ getPrivateKeyFromIndex,
30
+ getSponsoredFPCAddress,
31
+ publicDeployAccounts,
32
+ setup,
33
+ setupPXEAndGetWallet,
34
+ teardown,
35
+ } from './setup.js';
36
+
37
+ type ProvenSetup = {
38
+ wallet: TestWallet;
39
+ teardown: () => Promise<void>;
40
+ };
41
+
42
+ /**
43
+ * Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
44
+ * However, we then setup a second PXE with a full prover instance.
45
+ * We configure this instance with all of the accounts and contracts.
46
+ * We then prove and verify transactions created via this full prover PXE.
47
+ */
48
+
49
+ export class FullProverTest {
50
+ static TOKEN_NAME = 'USDC';
51
+ static TOKEN_SYMBOL = 'USD';
52
+ static TOKEN_DECIMALS = 18n;
53
+ logger: Logger;
54
+ wallet!: TestWallet;
55
+ provenWallet!: TestWallet;
56
+ accounts: AztecAddress[] = [];
57
+ deployedAccounts!: InitialAccountData[];
58
+ fakeProofsAsset!: TokenContract;
59
+ fakeProofsAssetInstance!: ContractInstanceWithAddress;
60
+ tokenSim!: TokenSimulator;
61
+ aztecNode!: AztecNode;
62
+ aztecNodeAdmin!: AztecNodeAdmin;
63
+ cheatCodes!: CheatCodes;
64
+ private provenComponents: ProvenSetup[] = [];
65
+ private bbConfigCleanup?: () => Promise<void>;
66
+ private acvmConfigCleanup?: () => Promise<void>;
67
+ /** Returns the proof verifier from the prover node (for test assertions). */
68
+ get circuitProofVerifier(): ClientProtocolCircuitVerifier | undefined {
69
+ return this.proverAztecNode?.getProofVerifier();
70
+ }
71
+ provenAsset!: TokenContract;
72
+ context!: EndToEndContext;
73
+ private proverAztecNode!: AztecNodeService;
74
+ private simulatedProverAztecNode!: AztecNodeService;
75
+ public l1Contracts!: DeployAztecL1ContractsReturnType;
76
+ public proverAddress!: EthAddress;
77
+ private minNumberOfTxsPerBlock: number;
78
+ private coinbase: EthAddress;
79
+ private realProofs: boolean;
80
+
81
+ constructor(testName: string, minNumberOfTxsPerBlock: number, coinbase: EthAddress, realProofs = true) {
82
+ this.logger = createLogger(`e2e:full_prover_test:${testName}`);
83
+ this.minNumberOfTxsPerBlock = minNumberOfTxsPerBlock;
84
+ this.coinbase = coinbase;
85
+ this.realProofs = realProofs;
86
+ }
87
+
88
+ /**
89
+ * Applies base setup: deploys 2 accounts and token contract.
90
+ */
91
+ private async applyBaseSetup() {
92
+ this.logger.info('Applying base setup: deploying accounts');
93
+ const { deployedAccounts } = await deployAccounts(
94
+ 2,
95
+ this.logger,
96
+ )({
97
+ wallet: this.context.wallet,
98
+ initialFundedAccounts: this.context.initialFundedAccounts,
99
+ });
100
+ this.deployedAccounts = deployedAccounts;
101
+ this.accounts = deployedAccounts.map(a => a.address);
102
+ this.wallet = this.context.wallet;
103
+
104
+ this.logger.info('Applying base setup: publicly deploying accounts');
105
+ await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
106
+
107
+ this.logger.info('Applying base setup: deploying token contract');
108
+ const { contract: asset, instance } = await TokenContract.deploy(
109
+ this.wallet,
110
+ this.accounts[0],
111
+ FullProverTest.TOKEN_NAME,
112
+ FullProverTest.TOKEN_SYMBOL,
113
+ FullProverTest.TOKEN_DECIMALS,
114
+ ).send({ from: this.accounts[0] });
115
+ this.logger.verbose(`Token deployed to ${asset.address}`);
116
+
117
+ this.fakeProofsAsset = asset;
118
+ this.fakeProofsAssetInstance = instance;
119
+ this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
120
+
121
+ this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallet, this.accounts[0], this.logger, this.accounts);
122
+
123
+ expect((await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).result).toBe(
124
+ this.accounts[0].toBigInt(),
125
+ );
126
+ }
127
+
128
+ async setup(opts: Partial<SetupOptions> = {}) {
129
+ this.logger.info('Setting up subsystems from fresh');
130
+ this.context = await setup(0, {
131
+ ...opts,
132
+ startProverNode: true,
133
+ coinbase: this.coinbase,
134
+ fundSponsoredFPC: true,
135
+ skipAccountDeployment: true,
136
+ l1ContractsArgs: { realVerifier: this.realProofs },
137
+ });
138
+
139
+ await this.applyBaseSetup();
140
+ await this.applyMint();
141
+
142
+ this.logger.info(`Enabling proving`, { realProofs: this.realProofs });
143
+
144
+ // We don't wish to mark as proven automatically, so we set the flag to false
145
+ this.context.watcher.setIsMarkingAsProven(false);
146
+
147
+ this.simulatedProverAztecNode = this.context.proverNode!;
148
+ ({
149
+ aztecNode: this.aztecNode,
150
+ deployL1ContractsValues: this.l1Contracts,
151
+ cheatCodes: this.cheatCodes,
152
+ } = this.context);
153
+ this.aztecNodeAdmin = this.context.aztecNodeService;
154
+
155
+ const config = this.context.aztecNodeConfig;
156
+
157
+ // Configure a full prover PXE
158
+ let acvmConfig: Awaited<ReturnType<typeof getACVMConfig>> | undefined;
159
+ let bbConfig: Awaited<ReturnType<typeof getBBConfig>> | undefined;
160
+ if (this.realProofs) {
161
+ [acvmConfig, bbConfig] = await Promise.all([getACVMConfig(this.logger), getBBConfig(this.logger)]);
162
+ if (!acvmConfig || !bbConfig) {
163
+ throw new Error('Missing ACVM or BB config');
164
+ }
165
+
166
+ this.acvmConfigCleanup = acvmConfig.cleanup;
167
+ this.bbConfigCleanup = bbConfig.cleanup;
168
+
169
+ await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
170
+
171
+ this.logger.debug(`Configuring the node for real proofs...`);
172
+ await this.aztecNodeAdmin.setConfig({
173
+ realProofs: true,
174
+ minTxsPerBlock: this.minNumberOfTxsPerBlock,
175
+ });
176
+ } else {
177
+ this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
178
+ await this.aztecNodeAdmin.setConfig({
179
+ minTxsPerBlock: this.minNumberOfTxsPerBlock,
180
+ });
181
+ }
182
+
183
+ this.logger.verbose(`Move to a clean epoch`);
184
+ await this.context.cheatCodes.rollup.advanceToNextEpoch();
185
+
186
+ this.logger.verbose(`Marking current block as proven`);
187
+ await this.context.cheatCodes.rollup.markAsProven();
188
+
189
+ this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
190
+ const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(
191
+ this.aztecNode,
192
+ { proverEnabled: this.realProofs },
193
+ undefined,
194
+ 'pxe-proven',
195
+ );
196
+ this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
197
+ await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
198
+
199
+ for (let i = 0; i < 2; i++) {
200
+ await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
201
+ await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
202
+ }
203
+
204
+ const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
205
+ this.provenComponents.push({
206
+ wallet: provenWallet,
207
+ teardown: provenTeardown,
208
+ });
209
+ this.provenAsset = asset;
210
+ this.provenWallet = provenWallet;
211
+ this.logger.info(`Full prover PXE started`);
212
+
213
+ // Shutdown the current, simulated prover node (by stopping its hosting aztec node)
214
+ this.logger.verbose('Shutting down simulated prover node');
215
+ await this.simulatedProverAztecNode.stop();
216
+
217
+ // The simulated prover node (now shutdown) used private key index 2
218
+ const proverNodePrivateKey = getPrivateKeyFromIndex(2);
219
+ const proverNodePrivateKeyHex = `0x${proverNodePrivateKey!.toString('hex')}` as const;
220
+ const proverNodeSenderAddress = privateKeyToAddress(new Buffer32(proverNodePrivateKey!).toString());
221
+ this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
222
+
223
+ this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
224
+ await this.mintFeeJuice(proverNodeSenderAddress);
225
+
226
+ this.logger.verbose('Starting prover node');
227
+ const sponsoredFPCAddress = await getSponsoredFPCAddress();
228
+ const { genesis } = await getGenesisValues(
229
+ this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
230
+ undefined,
231
+ undefined,
232
+ this.context.genesis!.genesisTimestamp,
233
+ );
234
+
235
+ const proverNodeConfig: Parameters<typeof AztecNodeService.createAndSync>[0] = {
236
+ ...config,
237
+ enableProverNode: true,
238
+ disableValidator: true,
239
+ dataDirectory: undefined,
240
+ txCollectionNodeRpcUrls: [],
241
+ proverId: this.proverAddress,
242
+ realProofs: this.realProofs,
243
+ proverAgentCount: 2,
244
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKeyHex)],
245
+ proverNodeMaxPendingJobs: 100,
246
+ proverNodeMaxParallelBlocksPerEpoch: 32,
247
+ proverNodePollingIntervalMs: 100,
248
+ txGatheringIntervalMs: 1000,
249
+ txGatheringBatchSize: 10,
250
+ txGatheringMaxParallelRequestsPerNode: 100,
251
+ txGatheringTimeoutMs: 24_000,
252
+ proverNodeFailedEpochStore: undefined,
253
+ proverNodeEpochProvingDelayMs: undefined,
254
+ validatorPrivateKeys: new SecretValue([]),
255
+ };
256
+
257
+ this.proverAztecNode = await AztecNodeService.createAndSync(
258
+ proverNodeConfig,
259
+ { dateProvider: this.context.dateProvider, p2pClientDeps: { rpcTxProviders: [this.aztecNode] } },
260
+ { genesis },
261
+ );
262
+ this.logger.warn(`Proofs are now enabled`, { realProofs: this.realProofs });
263
+ return this;
264
+ }
265
+
266
+ private async mintFeeJuice(recipient: Hex) {
267
+ const handlerAddress = this.context.deployL1ContractsValues.l1ContractAddresses.feeAssetHandlerAddress!;
268
+ this.logger.verbose(`Minting fee juice to ${recipient} using handler at ${handlerAddress}`);
269
+ const client = this.context.deployL1ContractsValues.l1Client;
270
+ const handler = getContract({ abi: FeeAssetHandlerAbi, address: handlerAddress.toString(), client });
271
+ const hash = await handler.write.mint([recipient]);
272
+ await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
273
+ }
274
+
275
+ async teardown() {
276
+ // Cleanup related to the full prover PXEs
277
+ for (let i = 0; i < this.provenComponents.length; i++) {
278
+ await this.provenComponents[i].teardown();
279
+ }
280
+
281
+ // clean up the full prover node (by stopping its hosting aztec node)
282
+ await this.proverAztecNode.stop();
283
+
284
+ await Barretenberg.destroySingleton();
285
+ await this.bbConfigCleanup?.();
286
+ await this.acvmConfigCleanup?.();
287
+
288
+ await teardown(this.context);
289
+ }
290
+
291
+ private async applyMint() {
292
+ this.logger.info('Applying mint setup');
293
+ const { fakeProofsAsset: asset, accounts } = this;
294
+ const privateAmount = 10000n;
295
+ const publicAmount = 10000n;
296
+
297
+ this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
298
+ await asset.methods.mint_to_public(accounts[0], privateAmount + publicAmount).send({ from: accounts[0] });
299
+
300
+ this.logger.verbose(`Transferring ${privateAmount} to private...`);
301
+ await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] });
302
+
303
+ this.logger.info(`Minting complete`);
304
+
305
+ const {
306
+ fakeProofsAsset,
307
+ accounts: [address],
308
+ tokenSim,
309
+ } = this;
310
+ tokenSim.mintPublic(address, publicAmount);
311
+
312
+ const { result: publicBalance } = await fakeProofsAsset.methods
313
+ .balance_of_public(address)
314
+ .simulate({ from: address });
315
+ this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
316
+ expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
317
+
318
+ tokenSim.mintPrivate(address, publicAmount);
319
+ const { result: privateBalance } = await fakeProofsAsset.methods
320
+ .balance_of_private(address)
321
+ .simulate({ from: address });
322
+ this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
323
+ expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
324
+
325
+ const { result: totalSupply } = await fakeProofsAsset.methods.total_supply().simulate({ from: address });
326
+ this.logger.verbose(`Total supply: ${totalSupply}`);
327
+ expect(totalSupply).toEqual(tokenSim.totalSupply);
328
+ }
329
+ }
@@ -0,0 +1,126 @@
1
+ import { appendFileSync } from 'node:fs';
2
+ import { type EventLoopUtilization, type IntervalHistogram, monitorEventLoopDelay, performance } from 'node:perf_hooks';
3
+
4
+ const NANOS_PER_MS = 1_000_000;
5
+
6
+ /** Samples event-loop utilization, delay histogram, and heap usage per test, writing columnar text to a file. */
7
+ export class EluMonitor {
8
+ private filePath: string;
9
+ private intervalMs: number;
10
+ private timer: ReturnType<typeof setInterval> | undefined;
11
+ private lastELU: EventLoopUtilization | undefined;
12
+ private histogram: IntervalHistogram;
13
+ private testName: string | undefined;
14
+ private testStart: number | undefined;
15
+ private eluSamples: number[] = [];
16
+
17
+ constructor(filePath: string, intervalMs?: number) {
18
+ this.filePath = filePath;
19
+ this.intervalMs = intervalMs ?? 2000;
20
+ this.histogram = monitorEventLoopDelay({ resolution: 20 });
21
+ }
22
+
23
+ /** Begin sampling for a test. Writes a header line and starts the periodic sampler. */
24
+ startTest(testName: string): void {
25
+ this.stopTest();
26
+
27
+ this.testName = testName;
28
+ this.testStart = performance.now();
29
+ this.eluSamples = [];
30
+
31
+ appendFileSync(this.filePath, `\n=== Test: ${testName} ===\n`);
32
+ appendFileSync(
33
+ this.filePath,
34
+ padColumns('TIME', 'ELU', 'EL_DLY_P50', 'EL_DLY_P99', 'EL_DLY_MAX', 'HEAP_MB') + '\n',
35
+ );
36
+
37
+ this.lastELU = performance.eventLoopUtilization();
38
+ this.histogram.enable();
39
+
40
+ this.timer = setInterval(() => this.sample(), this.intervalMs);
41
+ // Allow the process to exit even if the timer is still running.
42
+ this.timer.unref();
43
+ }
44
+
45
+ /** Stop sampling and write a summary line. */
46
+ stopTest(): void {
47
+ if (!this.timer) {
48
+ return;
49
+ }
50
+
51
+ // Take a final sample before stopping.
52
+ this.sample();
53
+
54
+ clearInterval(this.timer);
55
+ this.timer = undefined;
56
+ this.histogram.disable();
57
+ this.histogram.reset();
58
+
59
+ this.writeSummary();
60
+
61
+ this.lastELU = undefined;
62
+ this.testName = undefined;
63
+ this.testStart = undefined;
64
+ this.eluSamples = [];
65
+ }
66
+
67
+ /** Alias for stopTest — call on process exit to flush any remaining data. */
68
+ stop(): void {
69
+ this.stopTest();
70
+ }
71
+
72
+ private sample(): void {
73
+ const newELU = performance.eventLoopUtilization();
74
+ const delta = performance.eventLoopUtilization(newELU, this.lastELU);
75
+ this.lastELU = newELU;
76
+
77
+ const elu = delta.utilization;
78
+ this.eluSamples.push(elu);
79
+
80
+ const p50 = this.histogram.percentile(50) / NANOS_PER_MS;
81
+ const p99 = this.histogram.percentile(99) / NANOS_PER_MS;
82
+ const max = this.histogram.max / NANOS_PER_MS;
83
+ const heapMb = Math.round(process.memoryUsage().heapUsed / (1024 * 1024));
84
+
85
+ const now = new Date();
86
+ const time = [now.getHours(), now.getMinutes(), now.getSeconds()].map(n => String(n).padStart(2, '0')).join(':');
87
+
88
+ const line = padColumns(
89
+ time,
90
+ elu.toFixed(2),
91
+ `${p50.toFixed(1)}ms`,
92
+ `${p99.toFixed(1)}ms`,
93
+ `${max.toFixed(1)}ms`,
94
+ String(heapMb),
95
+ );
96
+ appendFileSync(this.filePath, line + '\n');
97
+
98
+ // Reset histogram so next sample only reflects the new interval.
99
+ this.histogram.reset();
100
+ }
101
+
102
+ private writeSummary(): void {
103
+ if (this.eluSamples.length === 0 || this.testStart === undefined) {
104
+ return;
105
+ }
106
+
107
+ const mean = this.eluSamples.reduce((a, b) => a + b, 0) / this.eluSamples.length;
108
+ const maxElu = Math.max(...this.eluSamples);
109
+ const sorted = [...this.eluSamples].sort((a, b) => a - b);
110
+ const p90Elu = sorted[Math.floor(sorted.length * 0.9)] ?? maxElu;
111
+ const durationS = ((performance.now() - this.testStart) / 1000).toFixed(1);
112
+
113
+ let summary = `--- Summary: mean_elu=${mean.toFixed(2)} max_elu=${maxElu.toFixed(2)} p90_elu=${p90Elu.toFixed(2)} duration=${durationS}s`;
114
+ if (maxElu > 0.85) {
115
+ summary += ' WARNING:ELU>0.85';
116
+ }
117
+ summary += ' ---\n';
118
+
119
+ appendFileSync(this.filePath, summary);
120
+ }
121
+ }
122
+
123
+ function padColumns(...cols: string[]): string {
124
+ const widths = [11, 7, 12, 12, 12, 8];
125
+ return cols.map((col, i) => col.padEnd(widths[i] ?? 10)).join('');
126
+ }
@@ -1,5 +1,88 @@
1
+ import type { AztecNode } from '@aztec/aztec.js/node';
2
+ import type { GasFees } from '@aztec/stdlib/gas';
3
+
1
4
  export const METRICS_PORT = 4318;
2
5
 
6
+ /** Default fee padding applied to predicted min fees in e2e tests. */
7
+ export const DEFAULT_MIN_FEE_PADDING = 5;
8
+
9
+ /**
10
+ * Large fee padding for txs that may be mined significantly later than when they were created,
11
+ * such as cloned txs in throughput/capacity benchmarks, where fees may spike between creation and mining.
12
+ */
13
+ export const LARGE_MIN_FEE_PADDING = 15;
14
+
15
+ /**
16
+ * Fee padding used by tests running under proposer pipelining. Under pipelining the fee-asset
17
+ * price modifier evolves faster across the build/publish gap, so client-set maxFeesPerGas (sized
18
+ * for the default 5x padding) was getting bumped past by the time the tx mined a few slots later.
19
+ * Observed worst case in CI: fee evolved ~20x between PXE snapshot and inclusion, exceeding even
20
+ * LARGE_MIN_FEE_PADDING (15x).
21
+ */
22
+ export const PIPELINED_FEE_PADDING = 30;
23
+
24
+ /**
25
+ * Setup option preset that opts a test into proposer pipelining. Use with `setup()`:
26
+ *
27
+ * await setup(N, { ...PIPELINING_SETUP_OPTS, ...otherOpts });
28
+ *
29
+ * The preset sets:
30
+ * - `inboxLag: 2` so the sequencer sources L1->L2 messages from checkpoint N-1 (already sealed),
31
+ * avoiding `L1ToL2MessagesNotReadyError` when building for slot N during slot N-1.
32
+ * - `minTxsPerBlock: 0` so empty checkpoints land even when a tx arrives late in the build window
33
+ * (otherwise the chain stalls on alternating slots).
34
+ * - `aztecSlotDuration: 12` / `ethereumSlotDuration: 4` so the pipelined cycle fits inside the
35
+ * default 300s Jest hook budget. Tests that depend on the env-default 72s/12s should override.
36
+ * - `walletMinFeePadding: PIPELINED_FEE_PADDING` (30x) to absorb the wider fee evolution window.
37
+ */
38
+ export const PIPELINING_SETUP_OPTS = {
39
+ inboxLag: 2,
40
+ minTxsPerBlock: 0,
41
+ aztecSlotDuration: 12,
42
+ ethereumSlotDuration: 4,
43
+ walletMinFeePadding: PIPELINED_FEE_PADDING,
44
+ } as const;
45
+
46
+ /**
47
+ * Setup option preset that opts a test into the deterministic AutomineSequencer path.
48
+ * Use only for single-sequencer tests that don't exercise block-building or consensus
49
+ * (e.g. e2e_token, e2e_amm, e2e_authwit). Not compatible with `e2e_p2p/*`,
50
+ * `e2e_epochs/*`, `e2e_slashing/*`, `e2e_block_building`, or any multi-validator suite.
51
+ *
52
+ * await setup(N, { ...AUTOMINE_E2E_OPTS, ...otherOpts });
53
+ *
54
+ * The preset:
55
+ * - Swaps the production Sequencer for an AutomineSequencer that builds one block per
56
+ * submitted tx, publishes synchronously to L1, and owns all time control through a
57
+ * serial queue (see `sequencer-client/src/sequencer/automine/automine_sequencer.ts`).
58
+ * - Disables the validator client and AnvilTestWatcher (the AutomineSequencer needs
59
+ * neither).
60
+ * - Uses `inboxLag: 1` (synchronous) since the AutomineSequencer publishes one block per tx.
61
+ * - Switches anvil into automine mode at setup time (no interval mining); each L1 tx
62
+ * mines an L1 block immediately.
63
+ *
64
+ * Requires `aztecTargetCommitteeSize: 0`, which is the e2e default at `setup.ts:317`.
65
+ */
66
+ export const AUTOMINE_E2E_OPTS = {
67
+ useAutomineSequencer: true,
68
+ disableAnvilTestWatcher: true,
69
+ inboxLag: 1,
70
+ minTxsPerBlock: 0,
71
+ aztecSlotDuration: 12,
72
+ ethereumSlotDuration: 4,
73
+ walletMinFeePadding: PIPELINED_FEE_PADDING,
74
+ } as const;
75
+
76
+ /** Returns worst-case predicted min fees with padding applied, mirroring the BaseWallet pattern. */
77
+ export async function getPaddedMaxFeesPerGas(node: AztecNode, padding = DEFAULT_MIN_FEE_PADDING): Promise<GasFees> {
78
+ const predicted = await node.getPredictedMinFees();
79
+ const worstCase =
80
+ predicted.length > 0
81
+ ? predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst))
82
+ : await node.getCurrentMinFees();
83
+ return worstCase.mul(1 + padding);
84
+ }
85
+
3
86
  export const shouldCollectMetrics = () => {
4
87
  if (process.env.COLLECT_METRICS) {
5
88
  return METRICS_PORT;
@@ -7,22 +90,30 @@ export const shouldCollectMetrics = () => {
7
90
  return undefined;
8
91
  };
9
92
 
93
+ /** Returns the boot node UDP port from environment variable or default value. */
94
+ export function getBootNodeUdpPort(): number {
95
+ return process.env.BOOT_NODE_UDP_PORT ? parseInt(process.env.BOOT_NODE_UDP_PORT, 10) : 4500;
96
+ }
97
+
98
+ /** Returns the anvil port from environment variable or default value. */
99
+ export function getAnvilPort(): number {
100
+ return process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT, 10) : 8545;
101
+ }
102
+
10
103
  export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
104
+ export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
11
105
 
12
106
  export const MNEMONIC = 'test test test test test test test test test test test junk';
13
107
  export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
14
108
  export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
15
109
 
16
110
  /// Common errors
17
- export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
18
- export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
111
+ export const U128_UNDERFLOW_ERROR = 'Assertion failed: attempt to subtract with overflow';
112
+ export const U128_OVERFLOW_ERROR = 'Assertion failed: attempt to add with overflow';
19
113
  export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
20
114
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
21
- export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted|Nullifier collision/;
115
+ export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
22
116
  export const NO_L1_TO_L2_MSG_ERROR =
23
117
  /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
24
- export const STATIC_CALL_STATE_MODIFICATION_ERROR =
25
- /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
118
+ export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state.*/;
26
119
  export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
27
-
28
- export const DEFAULT_BLOB_SINK_PORT = '5052';
@@ -1,6 +1,7 @@
1
- import type { Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  import { parseBooleanEnv } from '@aztec/foundation/config';
3
- import { randomBytes } from '@aztec/foundation/crypto';
3
+ import { randomBytes } from '@aztec/foundation/crypto/random';
4
+ import { tryRmDir } from '@aztec/foundation/fs';
4
5
 
5
6
  import { promises as fs } from 'fs';
6
7
 
@@ -36,16 +37,7 @@ export async function getACVMConfig(logger: Logger): Promise<
36
37
 
37
38
  const directoryToCleanup = ACVM_WORKING_DIRECTORY ? undefined : tempWorkingDirectory;
38
39
 
39
- const cleanup = async () => {
40
- if (directoryToCleanup) {
41
- try {
42
- logger.info(`Cleaning up ACVM temp directory ${directoryToCleanup}`);
43
- await fs.rm(directoryToCleanup, { recursive: true, force: true, maxRetries: 3 });
44
- } catch (err) {
45
- logger.warn(`Failed to delete ACVM temp directory at ${directoryToCleanup}: ${err}`);
46
- }
47
- }
48
- };
40
+ const cleanup = () => tryRmDir(directoryToCleanup, logger);
49
41
 
50
42
  return {
51
43
  acvmWorkingDirectory,
@@ -1,9 +1,11 @@
1
- import { type Logger, fileURLToPath } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  import type { BBConfig } from '@aztec/bb-prover';
3
+ import { tryRmDir } from '@aztec/foundation/fs';
3
4
 
4
5
  import fs from 'node:fs/promises';
5
6
  import { tmpdir } from 'node:os';
6
7
  import path from 'path';
8
+ import { fileURLToPath } from 'url';
7
9
 
8
10
  const {
9
11
  BB_RELEASE_DIR = 'barretenberg/cpp/build/bin',
@@ -11,6 +13,10 @@ const {
11
13
  BB_SKIP_CLEANUP = '',
12
14
  TEMP_DIR = tmpdir(),
13
15
  BB_WORKING_DIRECTORY = '',
16
+ BB_NUM_IVC_VERIFIERS = '8',
17
+ BB_IVC_CONCURRENCY = '1',
18
+ BB_CHONK_VERIFY_MAX_BATCH = '16',
19
+ BB_CHONK_VERIFY_BATCH_CONCURRENCY = '6',
14
20
  } = process.env;
15
21
 
16
22
  export const getBBConfig = async (
@@ -19,7 +25,7 @@ export const getBBConfig = async (
19
25
  try {
20
26
  const bbBinaryPath =
21
27
  BB_BINARY_PATH ??
22
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb');
28
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb-avm');
23
29
  await fs.access(bbBinaryPath, fs.constants.R_OK);
24
30
 
25
31
  let bbWorkingDirectory: string;
@@ -35,18 +41,18 @@ export const getBBConfig = async (
35
41
  await fs.mkdir(bbWorkingDirectory, { recursive: true });
36
42
 
37
43
  const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
38
-
39
- const cleanup = async () => {
40
- if (directoryToCleanup && !bbSkipCleanup) {
41
- try {
42
- await fs.rm(directoryToCleanup, { recursive: true, force: true, maxRetries: 3 });
43
- } catch (err) {
44
- logger.warn(`Failed to delete bb working directory at ${directoryToCleanup}: ${err}`);
45
- }
46
- }
44
+ const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
45
+
46
+ return {
47
+ bbSkipCleanup,
48
+ bbBinaryPath,
49
+ bbWorkingDirectory,
50
+ cleanup,
51
+ numConcurrentIVCVerifiers: Number(BB_NUM_IVC_VERIFIERS),
52
+ bbIVCConcurrency: Number(BB_IVC_CONCURRENCY),
53
+ bbChonkVerifyMaxBatch: Number(BB_CHONK_VERIFY_MAX_BATCH),
54
+ bbChonkVerifyConcurrency: Number(BB_CHONK_VERIFY_BATCH_CONCURRENCY),
47
55
  };
48
-
49
- return { bbSkipCleanup, bbBinaryPath, bbWorkingDirectory, cleanup };
50
56
  } catch (err) {
51
57
  logger.error(`Native BB not available, error: ${err}`);
52
58
  return undefined;