@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
@@ -1,87 +0,0 @@
1
- import { type InitialAccountData } from '@aztec/accounts/testing';
2
- import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
3
- import { AnvilTestWatcher, type AztecAddress, CheatCodes, type CompleteAddress, type DeployL1ContractsReturnType, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
4
- import { type BlobSinkServer } from '@aztec/blob-sink/server';
5
- import { type DeployL1ContractsArgs } from '@aztec/ethereum';
6
- import { TestDateProvider } from '@aztec/foundation/timer';
7
- import type { ProverNode } from '@aztec/prover-node';
8
- import { type PXEService } from '@aztec/pxe/server';
9
- import type { Anvil } from '@viem/anvil';
10
- import { type SetupOptions } from './utils.js';
11
- export type SubsystemsContext = {
12
- anvil: Anvil;
13
- acvmConfig: any;
14
- bbConfig: any;
15
- aztecNode: AztecNodeService;
16
- aztecNodeConfig: AztecNodeConfig;
17
- pxe: PXEService;
18
- deployL1ContractsValues: DeployL1ContractsReturnType;
19
- proverNode?: ProverNode;
20
- watcher: AnvilTestWatcher;
21
- cheatCodes: CheatCodes;
22
- dateProvider: TestDateProvider;
23
- blobSink: BlobSinkServer;
24
- initialFundedAccounts: InitialAccountData[];
25
- directoryToCleanup?: string;
26
- };
27
- export declare function createSnapshotManager(testName: string, dataPath?: string, config?: Partial<SetupOptions>, deployL1ContractsArgs?: Partial<DeployL1ContractsArgs>): SnapshotManager | MockSnapshotManager;
28
- export interface ISnapshotManager {
29
- snapshot<T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>): Promise<void>;
30
- setup(): Promise<SubsystemsContext>;
31
- teardown(): Promise<void>;
32
- }
33
- /** Snapshot manager that does not perform snapshotting, it just applies transition and restoration functions as it receives them. */
34
- declare class MockSnapshotManager implements ISnapshotManager {
35
- private config;
36
- private deployL1ContractsArgs;
37
- private context?;
38
- private logger;
39
- constructor(testName: string, config?: Partial<AztecNodeConfig>, deployL1ContractsArgs?: Partial<DeployL1ContractsArgs>);
40
- snapshot<T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>): Promise<void>;
41
- setup(): Promise<SubsystemsContext>;
42
- teardown(): Promise<void>;
43
- }
44
- /**
45
- * Snapshot engine for local e2e tests. Read more:
46
- * https://github.com/AztecProtocol/aztec-packages/pull/5526
47
- */
48
- declare class SnapshotManager implements ISnapshotManager {
49
- private dataPath;
50
- private config;
51
- private deployL1ContractsArgs;
52
- private snapshotStack;
53
- private context?;
54
- private livePath;
55
- private logger;
56
- constructor(testName: string, dataPath: string, config?: Partial<SetupOptions>, deployL1ContractsArgs?: Partial<DeployL1ContractsArgs>);
57
- snapshot<T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>): Promise<void>;
58
- /**
59
- * Creates and returns the subsystem context based on the current snapshot stack.
60
- * If the subsystem context already exists, just return it.
61
- * If you want to be sure to get a clean snapshot, be sure to call teardown() before calling setup().
62
- */
63
- setup(): Promise<SubsystemsContext>;
64
- /**
65
- * Destroys the current subsystem context.
66
- */
67
- teardown(): Promise<void>;
68
- }
69
- /**
70
- * Snapshot 'apply' helper function to add accounts.
71
- * The 'restore' function is not provided, as it must be a closure within the test context to capture the results.
72
- */
73
- export declare const deployAccounts: (numberOfAccounts: number, logger: Logger, waitUntilProven?: boolean) => ({ pxe, initialFundedAccounts }: {
74
- pxe: PXE;
75
- initialFundedAccounts: InitialAccountData[];
76
- }) => Promise<{
77
- deployedAccounts: InitialAccountData[];
78
- }>;
79
- /**
80
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
81
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
82
- * @param sender - Wallet to send the deployment tx.
83
- * @param accountsToDeploy - Which accounts to publicly deploy.
84
- */
85
- export declare function publicDeployAccounts(sender: Wallet, accountsToDeploy: (CompleteAddress | AztecAddress)[], waitUntilProven?: boolean): Promise<void>;
86
- export {};
87
- //# sourceMappingURL=snapshot_manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshot_manager.d.ts","sourceRoot":"","sources":["../../src/fixtures/snapshot_manager.ts"],"names":[],"mappings":"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"}
@@ -1,479 +0,0 @@
1
- import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import { deployFundedSchnorrAccounts, generateSchnorrAccounts } from '@aztec/accounts/testing';
3
- import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
4
- import { AnvilTestWatcher, BatchCall, CheatCodes, getContractClassFromArtifact } from '@aztec/aztec.js';
5
- import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
6
- import { createBlobSinkServer } from '@aztec/blob-sink/server';
7
- import { createL1Clients, getL1ContractsConfigEnvVars, l1Artifacts } from '@aztec/ethereum';
8
- import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
9
- import { asyncMap } from '@aztec/foundation/async-map';
10
- import { randomBytes } from '@aztec/foundation/crypto';
11
- import { createLogger } from '@aztec/foundation/log';
12
- import { resolver, reviver } from '@aztec/foundation/serialize';
13
- import { TestDateProvider } from '@aztec/foundation/timer';
14
- import { createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
15
- import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
16
- import { getGenesisValues } from '@aztec/world-state/testing';
17
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
18
- import { copySync, removeSync } from 'fs-extra/esm';
19
- import fs from 'fs/promises';
20
- import getPort from 'get-port';
21
- import { tmpdir } from 'os';
22
- import path, { join } from 'path';
23
- import { getContract } from 'viem';
24
- import { mnemonicToAccount } from 'viem/accounts';
25
- import { MNEMONIC, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
26
- import { getACVMConfig } from './get_acvm_config.js';
27
- import { getBBConfig } from './get_bb_config.js';
28
- import { setupL1Contracts } from './setup_l1_contracts.js';
29
- import { createAndSyncProverNode, getLogger, getPrivateKeyFromIndex } from './utils.js';
30
- import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
31
- export function createSnapshotManager(testName, dataPath, config = {}, deployL1ContractsArgs = {
32
- initialValidators: []
33
- }) {
34
- return dataPath ? new SnapshotManager(testName, dataPath, config, deployL1ContractsArgs) : new MockSnapshotManager(testName, config, deployL1ContractsArgs);
35
- }
36
- /** Snapshot manager that does not perform snapshotting, it just applies transition and restoration functions as it receives them. */ class MockSnapshotManager {
37
- config;
38
- deployL1ContractsArgs;
39
- context;
40
- logger;
41
- constructor(testName, config = {}, deployL1ContractsArgs = {}){
42
- this.config = config;
43
- this.deployL1ContractsArgs = deployL1ContractsArgs;
44
- this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
45
- this.logger.warn(`No data path given, will not persist any snapshots.`);
46
- }
47
- async snapshot(name, apply, restore = ()=>Promise.resolve()) {
48
- // We are running in disabled mode. Just apply the state.
49
- const context = await this.setup();
50
- this.logger.verbose(`Applying state transition for ${name}...`);
51
- const snapshotData = await apply(context);
52
- this.logger.verbose(`State transition for ${name} complete.`);
53
- // Execute the restoration function.
54
- await restore(snapshotData, context);
55
- return;
56
- }
57
- async setup() {
58
- if (!this.context) {
59
- this.context = await setupFromFresh(undefined, this.logger, this.config, this.deployL1ContractsArgs);
60
- }
61
- return this.context;
62
- }
63
- async teardown() {
64
- await teardown(this.context);
65
- this.context = undefined;
66
- }
67
- }
68
- /**
69
- * Snapshot engine for local e2e tests. Read more:
70
- * https://github.com/AztecProtocol/aztec-packages/pull/5526
71
- */ class SnapshotManager {
72
- dataPath;
73
- config;
74
- deployL1ContractsArgs;
75
- snapshotStack;
76
- context;
77
- livePath;
78
- logger;
79
- constructor(testName, dataPath, config = {}, deployL1ContractsArgs = {}){
80
- this.dataPath = dataPath;
81
- this.config = config;
82
- this.deployL1ContractsArgs = deployL1ContractsArgs;
83
- this.snapshotStack = [];
84
- this.livePath = join(this.dataPath, 'live', testName);
85
- this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
86
- }
87
- async snapshot(name, apply, restore = ()=>Promise.resolve()) {
88
- const snapshotPath = join(this.dataPath, 'snapshots', ...this.snapshotStack.map((e)=>e.name), name, 'snapshot');
89
- if (existsSync(snapshotPath)) {
90
- // Snapshot exists. Record entry on stack but do nothing else as we're probably still descending the tree.
91
- // It's the tests responsibility to call setup() before a test to ensure subsystems get created.
92
- this.logger.verbose(`Snapshot exists at ${snapshotPath}. Continuing...`);
93
- this.snapshotStack.push({
94
- name,
95
- apply,
96
- restore,
97
- snapshotPath
98
- });
99
- return;
100
- }
101
- // Snapshot didn't exist at snapshotPath, and by definition none of the child snapshots can exist.
102
- // If we have no subsystem context yet, create it from the top of the snapshot stack (if it exists).
103
- const context = await this.setup();
104
- this.snapshotStack.push({
105
- name,
106
- apply,
107
- restore,
108
- snapshotPath
109
- });
110
- // Apply current state transition.
111
- this.logger.verbose(`Applying state transition for ${name}...`);
112
- const snapshotData = await apply(context);
113
- this.logger.verbose(`State transition for ${name} complete.`);
114
- // Execute the restoration function.
115
- await restore(snapshotData, context);
116
- // Save the snapshot data.
117
- const ethCheatCodes = new EthCheatCodesWithState(context.aztecNodeConfig.l1RpcUrls);
118
- const anvilStateFile = `${this.livePath}/anvil.dat`;
119
- await ethCheatCodes.dumpChainState(anvilStateFile);
120
- writeFileSync(`${this.livePath}/${name}.json`, JSON.stringify(snapshotData || {}, resolver));
121
- // Copy everything to snapshot path.
122
- // We want it to be atomic, in case multiple processes are racing to create the snapshot.
123
- this.logger.verbose(`Saving snapshot to ${snapshotPath}...`);
124
- if (mkdirSync(snapshotPath, {
125
- recursive: true
126
- })) {
127
- copySync(this.livePath, snapshotPath);
128
- this.logger.verbose(`Snapshot copied to ${snapshotPath}.`);
129
- } else {
130
- this.logger.verbose(`Snapshot already exists at ${snapshotPath}. Discarding our version.`);
131
- await this.teardown();
132
- }
133
- }
134
- /**
135
- * Creates and returns the subsystem context based on the current snapshot stack.
136
- * If the subsystem context already exists, just return it.
137
- * If you want to be sure to get a clean snapshot, be sure to call teardown() before calling setup().
138
- */ async setup() {
139
- // We have no subsystem context yet.
140
- // If one exists on the snapshot stack, create one from that snapshot.
141
- // Otherwise create a fresh one.
142
- if (!this.context) {
143
- removeSync(this.livePath);
144
- mkdirSync(this.livePath, {
145
- recursive: true
146
- });
147
- const previousSnapshotPath = this.snapshotStack[this.snapshotStack.length - 1]?.snapshotPath;
148
- if (previousSnapshotPath) {
149
- this.logger.verbose(`Copying snapshot from ${previousSnapshotPath} to ${this.livePath}...`);
150
- copySync(previousSnapshotPath, this.livePath);
151
- this.context = await setupFromState(this.livePath, this.logger);
152
- // Execute each of the previous snapshots restoration functions in turn.
153
- await asyncMap(this.snapshotStack, async (e)=>{
154
- const snapshotData = JSON.parse(readFileSync(`${e.snapshotPath}/${e.name}.json`, 'utf-8'), reviver);
155
- this.logger.verbose(`Executing restoration function for ${e.name}...`);
156
- await e.restore(snapshotData, this.context);
157
- this.logger.verbose(`Restoration of ${e.name} complete.`);
158
- });
159
- } else {
160
- this.context = await setupFromFresh(this.livePath, this.logger, this.config, this.deployL1ContractsArgs);
161
- }
162
- }
163
- return this.context;
164
- }
165
- /**
166
- * Destroys the current subsystem context.
167
- */ async teardown() {
168
- await teardown(this.context);
169
- this.context = undefined;
170
- removeSync(this.livePath);
171
- }
172
- }
173
- /**
174
- * Destroys the current subsystem context.
175
- */ async function teardown(context) {
176
- if (!context) {
177
- return;
178
- }
179
- try {
180
- getLogger().info('Tearing down subsystems');
181
- await context.proverNode?.stop();
182
- await context.aztecNode.stop();
183
- await context.acvmConfig?.cleanup();
184
- await context.bbConfig?.cleanup();
185
- await context.anvil.stop();
186
- await context.watcher.stop();
187
- await context.blobSink.stop();
188
- if (context.directoryToCleanup) {
189
- try {
190
- await fs.rm(context.directoryToCleanup, {
191
- recursive: true,
192
- force: true,
193
- maxRetries: 3
194
- });
195
- } catch (err) {
196
- getLogger().warn(`Failed to delete tmp directory ${context.directoryToCleanup}: ${err}`);
197
- }
198
- }
199
- } catch (err) {
200
- getLogger().error('Error during teardown', err);
201
- }
202
- }
203
- /**
204
- * Initializes a fresh set of subsystems.
205
- * If given a statePath, the state will be written to the path.
206
- * If there is no statePath, in-memory and temporary state locations will be used.
207
- */ async function setupFromFresh(statePath, logger, { numberOfInitialFundedAccounts = 10, ...opts } = {}, deployL1ContractsArgs = {
208
- initialValidators: []
209
- }) {
210
- logger.verbose(`Initializing state...`);
211
- const blobSinkPort = await getPort();
212
- // Fetch the AztecNode config.
213
- // TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
214
- const aztecNodeConfig = {
215
- ...getConfigEnvVars(),
216
- ...opts
217
- };
218
- aztecNodeConfig.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
219
- // Create a temp directory for all ephemeral state and cleanup afterwards
220
- const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
221
- await fs.mkdir(directoryToCleanup, {
222
- recursive: true
223
- });
224
- if (statePath === undefined) {
225
- aztecNodeConfig.dataDirectory = directoryToCleanup;
226
- } else {
227
- aztecNodeConfig.dataDirectory = statePath;
228
- }
229
- aztecNodeConfig.blobSinkUrl = `http://localhost:${blobSinkPort}`;
230
- // Setup blob sink service
231
- const blobSink = await createBlobSinkServer({
232
- port: blobSinkPort,
233
- dataStoreConfig: {
234
- dataDirectory: aztecNodeConfig.dataDirectory,
235
- dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB
236
- }
237
- });
238
- await blobSink.start();
239
- // Start anvil. We go via a wrapper script to ensure if the parent dies, anvil dies.
240
- logger.verbose('Starting anvil...');
241
- const res = await startAnvil({
242
- l1BlockTime: opts.ethereumSlotDuration
243
- });
244
- const anvil = res.anvil;
245
- aztecNodeConfig.l1RpcUrls = [
246
- res.rpcUrl
247
- ];
248
- // Deploy our L1 contracts.
249
- logger.verbose('Deploying L1 contracts...');
250
- const hdAccount = mnemonicToAccount(MNEMONIC, {
251
- accountIndex: 0
252
- });
253
- const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
254
- const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
255
- const validatorPrivKey = getPrivateKeyFromIndex(0);
256
- const proverNodePrivateKey = getPrivateKeyFromIndex(0);
257
- aztecNodeConfig.publisherPrivateKey = `0x${publisherPrivKey.toString('hex')}`;
258
- aztecNodeConfig.validatorPrivateKey = `0x${validatorPrivKey.toString('hex')}`;
259
- const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
260
- if (opts.l1StartTime) {
261
- await ethCheatCodes.warp(opts.l1StartTime);
262
- }
263
- const initialFundedAccounts = await generateSchnorrAccounts(numberOfInitialFundedAccounts);
264
- const { genesisArchiveRoot, genesisBlockHash, prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address), opts.initialAccountFeeJuice);
265
- const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrls[0], hdAccount, logger, {
266
- ...getL1ContractsConfigEnvVars(),
267
- genesisArchiveRoot,
268
- genesisBlockHash,
269
- salt: opts.salt,
270
- ...deployL1ContractsArgs,
271
- initialValidators: opts.initialValidators
272
- });
273
- aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
274
- aztecNodeConfig.l1PublishRetryIntervalMS = 100;
275
- if (opts.fundRewardDistributor) {
276
- // Mints block rewards for 10000 blocks to the rewardDistributor contract
277
- const rewardDistributor = getContract({
278
- address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
279
- abi: l1Artifacts.rewardDistributor.contractAbi,
280
- client: deployL1ContractsValues.publicClient
281
- });
282
- const blockReward = await rewardDistributor.read.BLOCK_REWARD();
283
- const mintAmount = 10_000n * blockReward;
284
- const feeJuice = getContract({
285
- address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
286
- abi: l1Artifacts.feeAsset.contractAbi,
287
- client: deployL1ContractsValues.walletClient
288
- });
289
- const rewardDistributorMintTxHash = await feeJuice.write.mint([
290
- rewardDistributor.address,
291
- mintAmount
292
- ], {});
293
- await deployL1ContractsValues.publicClient.waitForTransactionReceipt({
294
- hash: rewardDistributorMintTxHash
295
- });
296
- logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
297
- }
298
- const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.publicClient);
299
- await watcher.start();
300
- const acvmConfig = await getACVMConfig(logger);
301
- if (acvmConfig) {
302
- aztecNodeConfig.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
303
- aztecNodeConfig.acvmBinaryPath = acvmConfig.acvmBinaryPath;
304
- }
305
- const bbConfig = await getBBConfig(logger);
306
- if (bbConfig) {
307
- aztecNodeConfig.bbBinaryPath = bbConfig.bbBinaryPath;
308
- aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
309
- }
310
- const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);
311
- logger.verbose('Creating and synching an aztec node...');
312
- const dateProvider = new TestDateProvider();
313
- const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig, {
314
- telemetry,
315
- dateProvider
316
- }, {
317
- prefilledPublicData
318
- });
319
- let proverNode = undefined;
320
- if (opts.startProverNode) {
321
- logger.verbose('Creating and syncing a simulated prover node...');
322
- proverNode = await createAndSyncProverNode(`0x${proverNodePrivateKey.toString('hex')}`, aztecNodeConfig, aztecNode, path.join(directoryToCleanup, randomBytes(8).toString('hex')), prefilledPublicData);
323
- }
324
- logger.verbose('Creating pxe...');
325
- const pxeConfig = getPXEServiceConfig();
326
- pxeConfig.dataDirectory = statePath ?? path.join(directoryToCleanup, randomBytes(8).toString('hex'));
327
- const pxe = await createPXEService(aztecNode, pxeConfig);
328
- const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
329
- if (statePath) {
330
- writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
331
- writeFileSync(`${statePath}/accounts.json`, JSON.stringify(initialFundedAccounts, resolver));
332
- }
333
- return {
334
- aztecNodeConfig,
335
- anvil,
336
- aztecNode,
337
- pxe,
338
- acvmConfig,
339
- bbConfig,
340
- deployL1ContractsValues,
341
- proverNode,
342
- watcher,
343
- cheatCodes,
344
- dateProvider,
345
- blobSink,
346
- initialFundedAccounts,
347
- directoryToCleanup
348
- };
349
- }
350
- /**
351
- * Given a statePath, setup the system starting from that state.
352
- */ async function setupFromState(statePath, logger) {
353
- logger.verbose(`Initializing with saved state at ${statePath}...`);
354
- const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
355
- await fs.mkdir(directoryToCleanup, {
356
- recursive: true
357
- });
358
- // Run the blob sink on a random port
359
- const blobSinkPort = await getPort();
360
- // TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
361
- const aztecNodeConfig = JSON.parse(readFileSync(`${statePath}/aztec_node_config.json`, 'utf-8'), reviver);
362
- aztecNodeConfig.dataDirectory = statePath;
363
- aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
364
- const initialFundedAccounts = JSON.parse(readFileSync(`${statePath}/accounts.json`, 'utf-8'), reviver) || [];
365
- const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address));
366
- const blobSink = await createBlobSinkServer({
367
- port: blobSinkPort,
368
- dataStoreConfig: {
369
- dataDirectory: statePath,
370
- dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB
371
- }
372
- });
373
- await blobSink.start();
374
- // Start anvil. We go via a wrapper script to ensure if the parent dies, anvil dies.
375
- const { anvil, rpcUrl } = await startAnvil();
376
- aztecNodeConfig.l1RpcUrls = [
377
- rpcUrl
378
- ];
379
- // Load anvil state.
380
- const anvilStateFile = `${statePath}/anvil.dat`;
381
- const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
382
- await ethCheatCodes.loadChainState(anvilStateFile);
383
- // TODO: Encapsulate this in a NativeAcvm impl.
384
- const acvmConfig = await getACVMConfig(logger);
385
- if (acvmConfig) {
386
- aztecNodeConfig.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
387
- aztecNodeConfig.acvmBinaryPath = acvmConfig.acvmBinaryPath;
388
- }
389
- const bbConfig = await getBBConfig(logger);
390
- if (bbConfig) {
391
- aztecNodeConfig.bbBinaryPath = bbConfig.bbBinaryPath;
392
- aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
393
- }
394
- logger.verbose('Creating ETH clients...');
395
- const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
396
- const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls), aztecNodeConfig.l1Contracts.rollupAddress, publicClient);
397
- await watcher.start();
398
- logger.verbose('Creating aztec node...');
399
- const telemetry = initTelemetryClient(getTelemetryConfig());
400
- const dateProvider = new TestDateProvider();
401
- const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig, {
402
- telemetry,
403
- dateProvider
404
- }, {
405
- prefilledPublicData
406
- });
407
- let proverNode = undefined;
408
- if (aztecNodeConfig.startProverNode) {
409
- logger.verbose('Creating and syncing a simulated prover node...');
410
- const proverNodePrivateKey = getPrivateKeyFromIndex(2);
411
- const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
412
- proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, aztecNodeConfig, aztecNode, path.join(directoryToCleanup, randomBytes(8).toString('hex')), prefilledPublicData);
413
- }
414
- logger.verbose('Creating pxe...');
415
- const pxeConfig = getPXEServiceConfig();
416
- pxeConfig.dataDirectory = statePath;
417
- const pxe = await createPXEService(aztecNode, pxeConfig);
418
- const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
419
- return {
420
- aztecNodeConfig,
421
- anvil,
422
- aztecNode,
423
- pxe,
424
- acvmConfig,
425
- bbConfig,
426
- proverNode,
427
- deployL1ContractsValues: {
428
- walletClient,
429
- publicClient,
430
- l1ContractAddresses: aztecNodeConfig.l1Contracts
431
- },
432
- watcher,
433
- cheatCodes,
434
- dateProvider,
435
- blobSink,
436
- initialFundedAccounts,
437
- directoryToCleanup
438
- };
439
- }
440
- /**
441
- * Snapshot 'apply' helper function to add accounts.
442
- * The 'restore' function is not provided, as it must be a closure within the test context to capture the results.
443
- */ export const deployAccounts = (numberOfAccounts, logger, waitUntilProven = false)=>async ({ pxe, initialFundedAccounts })=>{
444
- if (initialFundedAccounts.length < numberOfAccounts) {
445
- throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
446
- }
447
- logger.verbose('Deploying accounts funded with fee juice...');
448
- const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
449
- await deployFundedSchnorrAccounts(pxe, deployedAccounts, {
450
- proven: waitUntilProven
451
- });
452
- return {
453
- deployedAccounts
454
- };
455
- };
456
- /**
457
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
458
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
459
- * @param sender - Wallet to send the deployment tx.
460
- * @param accountsToDeploy - Which accounts to publicly deploy.
461
- */ export async function publicDeployAccounts(sender, accountsToDeploy, waitUntilProven = false) {
462
- const accountAddressesToDeploy = accountsToDeploy.map((a)=>'address' in a ? a.address : a);
463
- const instances = (await Promise.all(accountAddressesToDeploy.map((account)=>sender.getContractMetadata(account)))).map((metadata)=>metadata.contractInstance);
464
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
465
- const alreadyRegistered = (await sender.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
466
- const fns = await Promise.all([
467
- ...!alreadyRegistered ? [
468
- registerContractClass(sender, SchnorrAccountContractArtifact)
469
- ] : [],
470
- ...instances.map((instance)=>deployInstance(sender, instance))
471
- ]);
472
- const calls = await Promise.all(fns.map((fn)=>fn.request()));
473
- const capsules = fns.map((fn)=>fn.getCapsules()).flat();
474
- const batch = new BatchCall(sender, calls);
475
- batch.addCapsules(capsules);
476
- await batch.send().wait({
477
- proven: waitUntilProven
478
- });
479
- }
@@ -1,41 +0,0 @@
1
- import type { Logger } from '@aztec/aztec.js';
2
- export interface AlertConfig {
3
- alert: string;
4
- expr: string;
5
- start?: number;
6
- end?: number;
7
- step?: number;
8
- for: string;
9
- labels: Record<string, string>;
10
- annotations: Record<string, string>;
11
- }
12
- export interface AlertCheckerConfig {
13
- grafanaEndpoint: string;
14
- grafanaCredentials: string;
15
- }
16
- export declare class AlertChecker {
17
- private config;
18
- private logger;
19
- constructor(logger: Logger, config?: Partial<AlertCheckerConfig>);
20
- /**
21
- * Load the alerts config from a file path.
22
- * @param filePath - The absolute path to the alerts file.
23
- */
24
- private loadAlertsConfig;
25
- private queryGrafana;
26
- private checkAlerts;
27
- /**
28
- * Run the alert check based on the alerts defined in an array.
29
- * @param alerts - The alerts to check.
30
- */
31
- runAlertCheck(alerts: AlertConfig[]): Promise<void>;
32
- /**
33
- * Run the alert check based on the alerts defined in a yaml file.
34
- * @param filePath - The absolute path to the alerts file.
35
- */
36
- runAlertCheckFromFilePath(filePath: string): Promise<void>;
37
- }
38
- export declare class AlertTriggeredError extends Error {
39
- name: string;
40
- }
41
- //# sourceMappingURL=alert_checker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alert_checker.d.ts","sourceRoot":"","sources":["../../src/quality_of_service/alert_checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAK9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAQD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAKpE;;;OAGG;IACH,OAAO,CAAC,gBAAgB;YAMV,YAAY;YAqCZ,WAAW;IAqBzB;;;OAGG;IACU,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhE;;;OAGG;IACU,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxE;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IACnC,IAAI,SAAyB;CACvC"}
@@ -1,12 +0,0 @@
1
- // docs:start:all
2
- import { createPXEClient } from '@aztec/aztec.js';
3
- const { PXE_URL = 'http://localhost:8080' } = process.env;
4
- async function main() {
5
- const pxe = await createPXEClient(PXE_URL);
6
- const { l1ChainId } = await pxe.getNodeInfo();
7
- console.log(`Connected to chain ${l1ChainId}`);
8
- }
9
- main().catch((err)=>{
10
- console.error(`Error in app: ${err}`);
11
- process.exit(1);
12
- }); // docs:end:all
@@ -1,10 +0,0 @@
1
- // docs:start:imports
2
- import { AztecAddress } from '@aztec/aztec.js';
3
- import { TokenContract } from '@aztec/noir-contracts.js/Token';
4
- import { readFileSync } from 'fs';
5
- // docs:end:imports
6
- // docs:start:get-tokens
7
- export async function getToken(wallet) {
8
- const addresses = JSON.parse(readFileSync('addresses.json'));
9
- return TokenContract.at(AztecAddress.fromString(addresses.token), wallet);
10
- } // docs:end:get-tokens