@aztec/end-to-end 0.0.1-commit.b9865e97 → 0.0.1-commit.be03c316

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 (270) hide show
  1. package/README.md +203 -27
  2. package/dest/automine/automine_test_context.d.ts +85 -0
  3. package/dest/automine/automine_test_context.d.ts.map +1 -0
  4. package/dest/automine/automine_test_context.js +98 -0
  5. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
  6. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  7. package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
  8. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
  9. package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
  10. package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
  11. package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
  12. package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
  13. package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
  14. package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
  15. package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
  16. package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
  17. package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +18 -40
  18. package/dest/automine/token/token_contract_test.d.ts +40 -0
  19. package/dest/automine/token/token_contract_test.d.ts.map +1 -0
  20. package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +22 -39
  21. package/dest/automine/token/token_test_helpers.d.ts +73 -0
  22. package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
  23. package/dest/automine/token/token_test_helpers.js +97 -0
  24. package/dest/bench/client_flows/benchmark.d.ts +1 -1
  25. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  26. package/dest/bench/client_flows/benchmark.js +3 -1
  27. package/dest/bench/client_flows/client_flows_benchmark.d.ts +4 -4
  28. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  29. package/dest/bench/client_flows/client_flows_benchmark.js +31 -19
  30. package/dest/bench/client_flows/data_extractor.js +1 -0
  31. package/dest/bench/utils.d.ts +3 -3
  32. package/dest/bench/utils.d.ts.map +1 -1
  33. package/dest/bench/utils.js +95 -6
  34. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  35. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  36. package/dest/composed/ha/ha_full_setup.js +383 -0
  37. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  38. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  39. package/dest/fixtures/e2e_prover_test.d.ts +12 -9
  40. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  41. package/dest/fixtures/e2e_prover_test.js +47 -28
  42. package/dest/fixtures/fixtures.d.ts +19 -10
  43. package/dest/fixtures/fixtures.d.ts.map +1 -1
  44. package/dest/fixtures/fixtures.js +26 -11
  45. package/dest/fixtures/ha_setup.d.ts +3 -3
  46. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  47. package/dest/fixtures/ha_setup.js +4 -1
  48. package/dest/fixtures/index.d.ts +2 -1
  49. package/dest/fixtures/index.d.ts.map +1 -1
  50. package/dest/fixtures/index.js +1 -0
  51. package/dest/fixtures/setup.d.ts +38 -41
  52. package/dest/fixtures/setup.d.ts.map +1 -1
  53. package/dest/fixtures/setup.js +181 -228
  54. package/dest/fixtures/setup_p2p_test.d.ts +1 -1
  55. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  56. package/dest/fixtures/setup_p2p_test.js +3 -3
  57. package/dest/fixtures/timing.d.ts +42 -0
  58. package/dest/fixtures/timing.d.ts.map +1 -0
  59. package/dest/fixtures/timing.js +72 -0
  60. package/dest/fixtures/token_utils.d.ts +22 -4
  61. package/dest/fixtures/token_utils.d.ts.map +1 -1
  62. package/dest/fixtures/token_utils.js +21 -1
  63. package/dest/fixtures/utils.d.ts +2 -2
  64. package/dest/fixtures/utils.d.ts.map +1 -1
  65. package/dest/fixtures/utils.js +1 -1
  66. package/dest/fixtures/wait_helpers.d.ts +135 -0
  67. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  68. package/dest/fixtures/wait_helpers.js +154 -0
  69. package/dest/forward-compatibility/wallet_service.js +3 -3
  70. package/dest/multi-node/block-production/setup.d.ts +97 -0
  71. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  72. package/dest/multi-node/block-production/setup.js +158 -0
  73. package/dest/multi-node/governance/setup.d.ts +67 -0
  74. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  75. package/dest/multi-node/governance/setup.js +126 -0
  76. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  77. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  78. package/dest/multi-node/multi_node_test_context.js +347 -0
  79. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  80. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  81. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  82. package/dest/multi-node/slashing/setup.d.ts +167 -0
  83. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  84. package/dest/multi-node/slashing/setup.js +275 -0
  85. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +10 -2
  86. package/dest/p2p/p2p_network.d.ts.map +1 -0
  87. package/dest/{e2e_p2p → p2p}/p2p_network.js +39 -15
  88. package/dest/p2p/reqresp/utils.d.ts +19 -0
  89. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  90. package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -17
  91. package/dest/p2p/shared.d.ts +72 -0
  92. package/dest/p2p/shared.d.ts.map +1 -0
  93. package/dest/p2p/shared.js +212 -0
  94. package/dest/shared/cross_chain_test_harness.d.ts +3 -3
  95. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  96. package/dest/shared/cross_chain_test_harness.js +16 -15
  97. package/dest/shared/gas_portal_test_harness.d.ts +1 -1
  98. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  99. package/dest/shared/gas_portal_test_harness.js +8 -5
  100. package/dest/shared/submit-transactions.d.ts +1 -1
  101. package/dest/shared/submit-transactions.d.ts.map +1 -1
  102. package/dest/shared/submit-transactions.js +12 -5
  103. package/dest/shared/timing_env.d.js +5 -0
  104. package/dest/shared/timing_env.js +365 -0
  105. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  106. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  107. package/dest/shared/uniswap_l1_l2.js +1 -6
  108. package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
  109. package/dest/simulators/lending_simulator.js +1 -1
  110. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  111. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  112. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  113. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  114. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  115. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  116. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  117. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  118. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
  119. package/dest/single-node/fees/fees_test.d.ts +93 -0
  120. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  121. package/dest/{e2e_fees → single-node/fees}/fees_test.js +48 -55
  122. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  123. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  124. package/dest/single-node/l1-reorgs/setup.js +57 -0
  125. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  126. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  127. package/dest/single-node/partial-proofs/setup.js +5 -0
  128. package/dest/single-node/proving/setup.d.ts +5 -0
  129. package/dest/single-node/proving/setup.d.ts.map +1 -0
  130. package/dest/single-node/proving/setup.js +5 -0
  131. package/dest/single-node/recovery/setup.d.ts +5 -0
  132. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  133. package/dest/single-node/recovery/setup.js +5 -0
  134. package/dest/single-node/setup.d.ts +49 -0
  135. package/dest/single-node/setup.d.ts.map +1 -0
  136. package/dest/single-node/setup.js +56 -0
  137. package/dest/single-node/single_node_test_context.d.ts +360 -0
  138. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  139. package/dest/single-node/single_node_test_context.js +833 -0
  140. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  141. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  142. package/dest/spartan/setup_test_wallets.js +19 -9
  143. package/dest/spartan/tx_metrics.d.ts +10 -1
  144. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  145. package/dest/spartan/tx_metrics.js +32 -0
  146. package/dest/test-wallet/test_wallet.d.ts +23 -3
  147. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  148. package/dest/test-wallet/test_wallet.js +56 -9
  149. package/dest/test-wallet/utils.d.ts +36 -1
  150. package/dest/test-wallet/utils.d.ts.map +1 -1
  151. package/dest/test-wallet/utils.js +64 -4
  152. package/dest/test-wallet/wallet_worker_script.js +5 -2
  153. package/dest/test-wallet/worker_wallet.d.ts +5 -5
  154. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  155. package/dest/test-wallet/worker_wallet.js +5 -3
  156. package/dest/test-wallet/worker_wallet_schema.d.ts +3 -159
  157. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
  158. package/dest/test-wallet/worker_wallet_schema.js +2 -1
  159. package/package.json +41 -41
  160. package/src/automine/README.md +60 -0
  161. package/src/automine/automine_test_context.ts +153 -0
  162. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  163. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  164. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +20 -57
  165. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -57
  166. package/src/automine/token/token_test_helpers.ts +138 -0
  167. package/src/bench/client_flows/benchmark.ts +3 -1
  168. package/src/bench/client_flows/client_flows_benchmark.ts +45 -26
  169. package/src/bench/client_flows/data_extractor.ts +1 -0
  170. package/src/bench/utils.ts +109 -6
  171. package/src/composed/ha/ha_full_setup.ts +466 -0
  172. package/src/fixtures/e2e_prover_test.ts +58 -47
  173. package/src/fixtures/fixtures.ts +28 -11
  174. package/src/fixtures/ha_setup.ts +7 -3
  175. package/src/fixtures/index.ts +1 -0
  176. package/src/fixtures/setup.ts +220 -289
  177. package/src/fixtures/setup_p2p_test.ts +3 -3
  178. package/src/fixtures/timing.ts +97 -0
  179. package/src/fixtures/token_utils.ts +39 -4
  180. package/src/fixtures/utils.ts +0 -3
  181. package/src/fixtures/wait_helpers.ts +333 -0
  182. package/src/forward-compatibility/wallet_service.ts +6 -4
  183. package/src/guides/up_quick_start.sh +5 -0
  184. package/src/infra/README.md +12 -0
  185. package/src/multi-node/README.md +95 -0
  186. package/src/multi-node/block-production/setup.ts +272 -0
  187. package/src/multi-node/governance/setup.ts +172 -0
  188. package/src/multi-node/multi_node_test_context.ts +447 -0
  189. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  190. package/src/multi-node/slashing/setup.ts +433 -0
  191. package/src/p2p/README.md +78 -0
  192. package/src/{e2e_p2p → p2p}/p2p_network.ts +38 -13
  193. package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -16
  194. package/src/p2p/shared.ts +329 -0
  195. package/src/shared/cross_chain_test_harness.ts +21 -10
  196. package/src/shared/gas_portal_test_harness.ts +13 -5
  197. package/src/shared/submit-transactions.ts +13 -5
  198. package/src/shared/timing_env.d.mts +39 -0
  199. package/src/shared/timing_env.mjs +363 -0
  200. package/src/shared/uniswap_l1_l2.ts +1 -8
  201. package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
  202. package/src/simulators/lending_simulator.ts +1 -1
  203. package/src/single-node/README.md +60 -0
  204. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  205. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  206. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
  207. package/src/{e2e_fees → single-node/fees}/fees_test.ts +69 -65
  208. package/src/single-node/l1-reorgs/setup.ts +93 -0
  209. package/src/single-node/partial-proofs/setup.ts +8 -0
  210. package/src/single-node/proving/setup.ts +15 -0
  211. package/src/single-node/recovery/setup.ts +8 -0
  212. package/src/single-node/setup.ts +63 -0
  213. package/src/single-node/single_node_test_context.ts +1041 -0
  214. package/src/spartan/setup_test_wallets.ts +24 -9
  215. package/src/spartan/tx_metrics.ts +26 -0
  216. package/src/test-wallet/test_wallet.ts +60 -10
  217. package/src/test-wallet/utils.ts +102 -5
  218. package/src/test-wallet/wallet_worker_script.ts +6 -3
  219. package/src/test-wallet/worker_wallet.ts +10 -12
  220. package/src/test-wallet/worker_wallet_schema.ts +3 -2
  221. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
  222. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  223. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -58
  224. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  225. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -161
  226. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  227. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  228. package/dest/e2e_deploy_contract/deploy_test.js +0 -51
  229. package/dest/e2e_epochs/epochs_test.d.ts +0 -125
  230. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  231. package/dest/e2e_epochs/epochs_test.js +0 -460
  232. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  233. package/dest/e2e_fees/fees_test.d.ts +0 -91
  234. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  235. package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
  236. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  237. package/dest/e2e_l1_publisher/write_json.js +0 -56
  238. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  239. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  240. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  241. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  242. package/dest/e2e_nested_contract/nested_contract_test.js +0 -55
  243. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  244. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  245. package/dest/e2e_p2p/inactivity_slash_test.js +0 -137
  246. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  247. package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
  248. package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
  249. package/dest/e2e_p2p/shared.d.ts +0 -75
  250. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  251. package/dest/e2e_p2p/shared.js +0 -217
  252. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
  253. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
  254. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
  255. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
  256. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  257. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -231
  258. package/src/e2e_deploy_contract/deploy_test.ts +0 -86
  259. package/src/e2e_epochs/epochs_test.ts +0 -575
  260. package/src/e2e_l1_publisher/write_json.ts +0 -77
  261. package/src/e2e_nested_contract/nested_contract_test.ts +0 -77
  262. package/src/e2e_p2p/inactivity_slash_test.ts +0 -180
  263. package/src/e2e_p2p/shared.ts +0 -332
  264. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
  265. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
  266. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  267. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
  268. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
  269. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
  270. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -1,13 +1,10 @@
1
- import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
1
  import { generateSchnorrAccounts } from '@aztec/accounts/testing';
3
- import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
4
- import { NO_FROM } from '@aztec/aztec.js/account';
2
+ import { createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
3
  import { EthAddress } from '@aztec/aztec.js/addresses';
6
- import { BatchCall, getContractClassFromArtifact, waitForProven } from '@aztec/aztec.js/contracts';
7
4
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
8
5
  import { Fr } from '@aztec/aztec.js/fields';
9
6
  import { createLogger } from '@aztec/aztec.js/log';
10
- import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
7
+ import { CheatCodes } from '@aztec/aztec/testing';
11
8
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
12
9
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
13
10
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -15,14 +12,13 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
15
12
  import { NULL_KEY } from '@aztec/ethereum/constants';
16
13
  import { deployMulticall3 } from '@aztec/ethereum/contracts';
17
14
  import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
18
- import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
15
+ import { EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
19
16
  import { EpochNumber } from '@aztec/foundation/branded-types';
20
17
  import { SecretValue } from '@aztec/foundation/config';
21
18
  import { randomBytes } from '@aztec/foundation/crypto/random';
22
19
  import { tryRmDir } from '@aztec/foundation/fs';
23
20
  import { withLoggerBindings } from '@aztec/foundation/log/server';
24
21
  import { retryUntil } from '@aztec/foundation/retry';
25
- import { sleep } from '@aztec/foundation/sleep';
26
22
  import { TestDateProvider } from '@aztec/foundation/timer';
27
23
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
28
24
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
@@ -37,7 +33,7 @@ import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contra
37
33
  import { tryStop } from '@aztec/stdlib/interfaces/server';
38
34
  import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
39
35
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
40
- import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
36
+ import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
41
37
  import { getGenesisValues } from '@aztec/world-state/testing';
42
38
  import fs from 'fs/promises';
43
39
  import { tmpdir } from 'os';
@@ -49,6 +45,7 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
49
45
  import { getACVMConfig } from './get_acvm_config.js';
50
46
  import { getBBConfig } from './get_bb_config.js';
51
47
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
48
+ import { testSpan } from './timing.js';
52
49
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
53
50
  export { startAnvil };
54
51
  let telemetry = undefined;
@@ -84,11 +81,13 @@ export const getPrivateKeyFromIndex = (index)=>{
84
81
  /**
85
82
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
86
83
  * @param aztecNode - An instance of Aztec Node.
84
+ * @param nodeDebug - The node's debug API, used to register public function signatures for named traces; pass
85
+ * `undefined` when the node does not expose it.
87
86
  * @param opts - Partial configuration for the PXE.
88
87
  * @param logger - The logger to be used.
89
88
  * @param actor - Actor label to include in log output (e.g., 'pxe-test').
90
89
  * @returns A test wallet, logger and teardown function.
91
- */ export async function setupPXEAndGetWallet(aztecNode, opts = {}, logger = getLogger(), actor) {
90
+ */ export async function setupPXEAndGetWallet(aztecNode, nodeDebug, opts = {}, logger = getLogger(), actor) {
92
91
  const PXEConfig = {
93
92
  ...getPXEConfig(),
94
93
  ...opts
@@ -102,7 +101,8 @@ export const getPrivateKeyFromIndex = (index)=>{
102
101
  }
103
102
  const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(PXEConfig.dataDirectory);
104
103
  const wallet = await TestWallet.create(aztecNode, PXEConfig, {
105
- loggerActorLabel: actor
104
+ loggerActorLabel: actor,
105
+ nodeDebug
106
106
  });
107
107
  return {
108
108
  wallet,
@@ -134,12 +134,32 @@ export const getPrivateKeyFromIndex = (index)=>{
134
134
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
135
135
  * @param opts - Options to pass to the node initialization and to the setup script.
136
136
  * @param pxeOpts - Options to pass to the PXE initialization.
137
- */ export async function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
137
+ */ export function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
138
+ // Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
139
+ // swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
140
+ // (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
141
+ const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
142
+ return testSpan(`setup:env:${proverMode}`, async ()=>{
143
+ const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
144
+ if (process.env.EXIT_E2E_AFTER_SETUP) {
145
+ ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
146
+ throw new Error('EXIT_E2E_AFTER_SETUP');
147
+ }
148
+ return ctx;
149
+ });
150
+ }
151
+ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
138
152
  assertContractArtifactsVersion();
153
+ const logger = getLogger();
139
154
  let anvil;
140
155
  try {
141
156
  opts.aztecTargetCommitteeSize ??= 0;
142
157
  opts.slasherEnabled ??= false;
158
+ // Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
159
+ // waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
160
+ // assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
161
+ opts.automineL1Setup ??= true;
162
+ logger.trace('Starting e2e test setup');
143
163
  const config = {
144
164
  ...getConfigEnvVars(),
145
165
  ...opts
@@ -150,13 +170,10 @@ export const getPrivateKeyFromIndex = (index)=>{
150
170
  config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
151
171
  // For tests we only want proving enabled if specifically requested
152
172
  config.realProofs = !!opts.realProofs;
153
- // Only enforce the time table if requested
154
- config.enforceTimeTable = !!opts.enforceTimeTable;
155
173
  // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
156
174
  config.enableDelayer = true;
157
175
  config.listenAddress = '127.0.0.1';
158
176
  config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
159
- const logger = getLogger();
160
177
  // Create a temp directory for any services that need it and cleanup later
161
178
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
162
179
  await fs.mkdir(directoryToCleanup, {
@@ -170,18 +187,19 @@ export const getPrivateKeyFromIndex = (index)=>{
170
187
  if (!isAnvilTestChain(chain.id)) {
171
188
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
172
189
  }
173
- const res = await startAnvil({
174
- l1BlockTime: opts.ethereumSlotDuration,
175
- accounts: opts.anvilAccounts,
176
- port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
177
- slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
178
- dateProvider
179
- });
190
+ const res = await testSpan('setup:env:anvil', ()=>startAnvil({
191
+ l1BlockTime: opts.ethereumSlotDuration,
192
+ accounts: opts.anvilAccounts,
193
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
194
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
195
+ dateProvider
196
+ }));
180
197
  anvil = res.anvil;
181
198
  config.l1RpcUrls = [
182
199
  res.rpcUrl
183
200
  ];
184
201
  }
202
+ logger.trace('Started anvil and L1 RPC client');
185
203
  // Enable logging metrics to a local file named after the test suite
186
204
  if (isMetricsLoggingRequested()) {
187
205
  const filename = path.join('log', getJobName() + '.jsonl');
@@ -197,6 +215,7 @@ export const getPrivateKeyFromIndex = (index)=>{
197
215
  resetBlockInterval: true
198
216
  });
199
217
  }
218
+ logger.trace('Initialized L1 cheat codes and applied state/time overrides');
200
219
  let publisherPrivKeyHex = undefined;
201
220
  let publisherHdAccount = undefined;
202
221
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
@@ -221,22 +240,35 @@ export const getPrivateKeyFromIndex = (index)=>{
221
240
  if (config.coinbase === undefined) {
222
241
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
223
242
  }
224
- // Determine which addresses to fund in genesis
225
- const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10));
226
- const addressesToFund = initialFundedAccounts.map((a)=>a.address);
243
+ logger.trace('Resolved L1 publisher account');
244
+ // The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
245
+ // funded at genesis so they are immediately usable.
246
+ const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
247
+ // Extra accounts the test wants funded at genesis but will create/deploy itself.
248
+ const additionallyFundedAccounts = opts.additionallyFundedAccounts ?? [];
249
+ const addressesToFund = [
250
+ ...defaultAccounts,
251
+ ...additionallyFundedAccounts
252
+ ].map((a)=>a.address);
227
253
  // Optionally fund the sponsored FPC
228
254
  if (opts.fundSponsoredFPC) {
229
255
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
230
256
  addressesToFund.push(sponsoredFPCAddress);
231
257
  }
258
+ logger.trace('Generated test accounts to fund at genesis');
232
259
  const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
233
260
  const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp);
261
+ logger.trace('Computed genesis values');
234
262
  const wasAutomining = await ethCheatCodes.isAutoMining();
235
263
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
236
264
  if (enableAutomine) {
237
265
  await ethCheatCodes.setAutomine(true);
238
266
  }
239
267
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount, chain);
268
+ // Warm both KZG trusted setups (ours + anvil's) in parallel
269
+ if (anvil && isAnvilTestChain(chain.id)) {
270
+ await warmBlobKzg(l1Client, logger);
271
+ }
240
272
  // Deploy Multicall3 if running locally
241
273
  await deployMulticall3(l1Client, logger);
242
274
  // Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
@@ -244,17 +276,18 @@ export const getPrivateKeyFromIndex = (index)=>{
244
276
  await l1Client.getTransactionCount({
245
277
  address: l1Client.account.address
246
278
  });
247
- const deployL1ContractsValues = await deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
248
- ...getL1ContractsConfigEnvVars(),
249
- ...opts,
250
- ...opts.l1ContractsArgs,
251
- vkTreeRoot: getVKTreeRoot(),
252
- protocolContractsHash,
253
- genesisArchiveRoot,
254
- initialValidators: opts.initialValidators,
255
- feeJuicePortalInitialBalance: fundingNeeded,
256
- realVerifier: false
257
- });
279
+ logger.trace('Deployed Multicall3');
280
+ const deployL1ContractsValues = await testSpan('setup:env:l1-deploy', ()=>deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
281
+ ...getL1ContractsConfigEnvVars(),
282
+ ...opts,
283
+ ...opts.l1ContractsArgs,
284
+ vkTreeRoot: getVKTreeRoot(),
285
+ protocolContractsHash,
286
+ genesisArchiveRoot,
287
+ initialValidators: opts.initialValidators,
288
+ feeJuicePortalInitialBalance: fundingNeeded,
289
+ realVerifier: false
290
+ }));
258
291
  Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
259
292
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
260
293
  // Propagate L1-contracts-config overrides back to the node config so the archiver's
@@ -274,13 +307,28 @@ export const getPrivateKeyFromIndex = (index)=>{
274
307
  }
275
308
  }
276
309
  }
310
+ // Deploy any test-specific L1 contracts while automine is still on and before the node starts,
311
+ // so they mine instantly rather than paying the L1 block interval once the sequencer is live.
312
+ let extraL1DeployResult = undefined;
313
+ if (opts.deployExtraL1Contracts) {
314
+ logger.trace('Running deployExtraL1Contracts hook');
315
+ extraL1DeployResult = await opts.deployExtraL1Contracts({
316
+ l1Client,
317
+ deployL1ContractsValues,
318
+ logger
319
+ });
320
+ // The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
321
+ // stale cached nonce for later transactions on the publisher account.
322
+ await l1Client.getTransactionCount({
323
+ address: l1Client.account.address
324
+ });
325
+ }
277
326
  if (enableAutomine) {
278
- await ethCheatCodes.setAutomine(false);
279
- await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
327
+ await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
280
328
  }
281
329
  // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
282
- // ahead of system time due to the local-network watcher warping time forward on each filled slot.
283
- // When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
330
+ // ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
331
+ // the stdout listener.
284
332
  if (!anvil) {
285
333
  dateProvider.setTime(await ethCheatCodes.lastBlockTimestamp() * 1000);
286
334
  }
@@ -289,24 +337,30 @@ export const getPrivateKeyFromIndex = (index)=>{
289
337
  resetBlockInterval: true
290
338
  });
291
339
  }
292
- const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider, opts.anvilTestWatcherOpts);
293
- if (!opts.disableAnvilTestWatcher) {
294
- await watcher.start();
295
- }
296
- // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
297
- const telemetryClient = opts.metricsPort ? await getEndToEndTestTelemetryClient(opts.metricsPort) : await getTelemetryClient(opts.telemetryConfig);
298
- await setupSharedBlobStorage(config);
299
- logger.verbose('Creating and synching an aztec node', config);
300
- const acvmConfig = await getACVMConfig(logger);
340
+ logger.trace('Deployed L1 rollup contracts');
341
+ // These boot steps are independent and write disjoint config keys, so run them concurrently:
342
+ // telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
343
+ // and the ACVM/BB config resolvers write their own acvm*/bb* keys.
344
+ const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
345
+ // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
346
+ opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
347
+ setupSharedBlobStorage(config),
348
+ getACVMConfig(logger),
349
+ getBBConfig(logger)
350
+ ]);
351
+ logger.trace('Created telemetry client');
352
+ logger.trace('Set up shared blob storage');
301
353
  if (acvmConfig) {
302
354
  config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
303
355
  config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
304
356
  }
305
- const bbConfig = await getBBConfig(logger);
357
+ logger.trace('Resolved ACVM config');
306
358
  if (bbConfig) {
307
359
  config.bbBinaryPath = bbConfig.bbBinaryPath;
308
360
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
309
361
  }
362
+ logger.trace('Resolved Barretenberg config');
363
+ logger.verbose('Creating and synching an aztec node', config);
310
364
  let mockGossipSubNetwork;
311
365
  let p2pClientDeps = undefined;
312
366
  if (opts.mockGossipSubNetwork) {
@@ -315,25 +369,6 @@ export const getPrivateKeyFromIndex = (index)=>{
315
369
  p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
316
370
  };
317
371
  }
318
- // Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
319
- // To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
320
- // For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
321
- // If no accounts need deployment, we await an empty block to confirm network progression.
322
- const originalMinTxsPerBlock = config.minTxsPerBlock;
323
- if (originalMinTxsPerBlock === undefined) {
324
- throw new Error('minTxsPerBlock is undefined in e2e test setup');
325
- }
326
- // Whether we're deploying accounts (and therefore need reliable block inclusion past genesis)
327
- const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
328
- // Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
329
- const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
330
- // Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at
331
- // slot N start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on
332
- // alternating slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) for account
333
- // deployment. Automine is unaffected: its runBuild clamps mempool builds to
334
- // Math.max(minTxsPerBlock ?? 1, 1) and still requires minValidTxs: 1.
335
- const accountsDeployMinTxs = 0;
336
- config.minTxsPerBlock = shouldDeployAccounts ? accountsDeployMinTxs : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
337
372
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
338
373
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
339
374
  if (!config.disableValidator) {
@@ -354,17 +389,19 @@ export const getPrivateKeyFromIndex = (index)=>{
354
389
  bootstrapNodes: []
355
390
  }
356
391
  } : config;
357
- const aztecNodeService = await withLoggerBindings({
358
- actor: 'node-0'
359
- }, ()=>AztecNodeService.createAndSync(initialNodeConfig, {
360
- dateProvider,
361
- telemetry: telemetryClient,
362
- p2pClientDeps
363
- }, {
364
- genesis,
365
- dontStartSequencer: opts.skipInitialSequencer
366
- }));
392
+ logger.trace('Prepared aztec node config');
393
+ const aztecNodeService = await testSpan('setup:env:sequencer-start', ()=>withLoggerBindings({
394
+ actor: 'node-0'
395
+ }, ()=>createAztecNodeService(initialNodeConfig, {
396
+ dateProvider,
397
+ telemetry: telemetryClient,
398
+ p2pClientDeps
399
+ }, {
400
+ genesis,
401
+ dontStartSequencer: opts.skipInitialSequencer
402
+ })));
367
403
  const sequencerClient = aztecNodeService.getSequencer();
404
+ logger.trace('Created and synced aztec node');
368
405
  let proverNode = undefined;
369
406
  if (opts.startProverNode) {
370
407
  logger.verbose('Creating and syncing a simulated prover node...');
@@ -377,16 +414,17 @@ export const getPrivateKeyFromIndex = (index)=>{
377
414
  aztecNodeService
378
415
  ]
379
416
  };
380
- ({ proverNode } = await createAndSyncProverNode(proverNodePrivateKeyHex, config, {
381
- ...config.proverNodeConfig,
382
- dataDirectory: proverNodeDataDirectory
383
- }, {
384
- dateProvider,
385
- p2pClientDeps,
386
- telemetry: telemetryClient
387
- }, {
388
- genesis
389
- }));
417
+ ({ proverNode } = await testSpan('setup:env:prover-node', ()=>createAndSyncProverNode(proverNodePrivateKeyHex, config, {
418
+ ...config.proverNodeConfig,
419
+ dataDirectory: proverNodeDataDirectory
420
+ }, {
421
+ dateProvider,
422
+ p2pClientDeps,
423
+ telemetry: telemetryClient
424
+ }, {
425
+ genesis
426
+ })));
427
+ logger.trace('Created prover node');
390
428
  }
391
429
  const sequencerDelayer = sequencerClient?.getDelayer();
392
430
  const proverDelayer = proverNode?.getProverNode()?.getDelayer();
@@ -398,73 +436,57 @@ export const getPrivateKeyFromIndex = (index)=>{
398
436
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
399
437
  // For tests we only want proving enabled if specifically requested
400
438
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
401
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
402
- loggerActorLabel: 'pxe-0',
403
- ...opts.pxeCreationOptions
404
- });
439
+ const wallet = await testSpan('setup:env:pxe', ()=>TestWallet.create(aztecNodeService, pxeConfig, {
440
+ loggerActorLabel: 'pxe-0',
441
+ // In-process node implements the debug API, so register public function signatures for named traces.
442
+ nodeDebug: aztecNodeService,
443
+ ...opts.pxeCreationOptions
444
+ }));
405
445
  if (opts.walletMinFeePadding !== undefined) {
406
446
  wallet.setMinFeePadding(opts.walletMinFeePadding);
407
447
  }
408
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider, aztecNodeService.getAutomineSequencer());
448
+ logger.trace('Created PXE and test wallet');
449
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
450
+ logger.trace('Created cheat codes');
409
451
  if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
410
452
  // We need to advance such that the committee is set up.
411
453
  await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1)));
412
454
  await cheatCodes.rollup.setupEpoch();
413
455
  await cheatCodes.rollup.debugRollup();
456
+ logger.trace('Advanced chain to set up validator committee');
414
457
  }
415
458
  let accounts = [];
416
- if (opts.skipInitialSequencer) {
417
- logger.info('Sequencer not started on initial node, skipping block progression');
418
- } else if (shouldDeployAccounts) {
419
- logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by waiting for the accounts to be deployed`);
420
- const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
421
- const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
422
- accounts = accountManagers.map((accountManager)=>accountManager.address);
423
- } else if (needsEmptyBlock) {
424
- logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
425
- // AutomineSequencer only builds on tx arrival; explicitly request an empty block.
426
- const automine = aztecNodeService.getAutomineSequencer();
427
- if (automine) {
428
- await automine.buildEmptyBlock();
429
- }
430
- while(await aztecNodeService.getBlockNumber() === 0){
431
- await sleep(2000);
432
- }
459
+ // Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
460
+ // + a simulated store call) with no on-chain tx, independent of the sequencer.
461
+ if (numberOfAccounts > 0) {
462
+ logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
463
+ await testSpan('wallet:create', ()=>createFundedInitializerlessAccounts(wallet, defaultAccounts));
464
+ accounts = defaultAccounts.map((a)=>a.address);
433
465
  }
434
- // If skipAccountDeployment is true, we don't deploy or wait - tests will handle account deployment later
435
- // Now we restore the original minTxsPerBlock setting if we changed it.
436
- if (sequencerClient && config.minTxsPerBlock !== originalMinTxsPerBlock) {
437
- sequencerClient.getSequencer().updateConfig({
438
- minTxsPerBlock: originalMinTxsPerBlock
439
- });
440
- }
441
- if (initialFundedAccounts.length < numberOfAccounts) {
442
- throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
443
- }
444
- const teardown = async ()=>{
445
- try {
446
- await tryStop(wallet, logger);
447
- await tryStop(aztecNodeService, logger);
448
- await tryStop(proverNode, logger);
449
- if (acvmConfig?.cleanup) {
450
- await acvmConfig.cleanup();
451
- }
452
- if (bbConfig?.cleanup) {
453
- await bbConfig.cleanup();
454
- }
455
- await tryStop(watcher, logger);
456
- await tryStop(anvil, logger);
457
- await tryRmDir(directoryToCleanup, logger);
458
- } catch (err) {
459
- logger.error(`Error during e2e test teardown`, err);
460
- } finally{
466
+ logger.trace('Created funded test accounts');
467
+ const teardown = ()=>testSpan('teardown:env', async ()=>{
461
468
  try {
462
- await telemetryClient.stop();
469
+ await tryStop(wallet, logger);
470
+ await tryStop(aztecNodeService, logger);
471
+ await tryStop(proverNode, logger);
472
+ if (acvmConfig?.cleanup) {
473
+ await acvmConfig.cleanup();
474
+ }
475
+ if (bbConfig?.cleanup) {
476
+ await bbConfig.cleanup();
477
+ }
478
+ await tryStop(anvil, logger);
479
+ await tryRmDir(directoryToCleanup, logger);
463
480
  } catch (err) {
464
- logger.error(`Error during telemetry client stop`, err);
481
+ logger.error(`Error during e2e test teardown`, err);
482
+ } finally{
483
+ try {
484
+ await telemetryClient.stop();
485
+ } catch (err) {
486
+ logger.error(`Error during telemetry client stop`, err);
487
+ }
465
488
  }
466
- }
467
- };
489
+ });
468
490
  return {
469
491
  anvil,
470
492
  aztecNode: aztecNodeService,
@@ -476,10 +498,11 @@ export const getPrivateKeyFromIndex = (index)=>{
476
498
  aztecNodeConfig: config,
477
499
  dateProvider,
478
500
  deployL1ContractsValues,
479
- initialFundedAccounts,
501
+ additionallyFundedAccounts,
480
502
  logger,
481
503
  mockGossipSubNetwork,
482
504
  genesis,
505
+ extraL1DeployResult,
483
506
  proverNode,
484
507
  sequencerDelayer,
485
508
  proverDelayer,
@@ -488,7 +511,6 @@ export const getPrivateKeyFromIndex = (index)=>{
488
511
  telemetryClient,
489
512
  wallet,
490
513
  accounts,
491
- watcher,
492
514
  acvmConfig,
493
515
  bbConfig,
494
516
  directoryToCleanup
@@ -539,7 +561,7 @@ export const getPrivateKeyFromIndex = (index)=>{
539
561
  */ export async function registerSponsoredFPC(wallet) {
540
562
  await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
541
563
  }
542
- export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 1) {
564
+ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 0.25) {
543
565
  targetBlock ??= await node.getBlockNumber();
544
566
  await retryUntil(async ()=>await node.getBlockNumber('proven') >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
545
567
  }
@@ -550,7 +572,7 @@ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, int
550
572
  return withLoggerBindings({
551
573
  actor: 'prover-0'
552
574
  }, async ()=>{
553
- const proverNode = await AztecNodeService.createAndSync({
575
+ const proverNode = await createAztecNodeService({
554
576
  ...baseConfig,
555
577
  ...configOverrides,
556
578
  p2pPort: 0,
@@ -602,18 +624,20 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
602
624
  * required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
603
625
  * surface as generic "Assertion failed:" and tests that match on the real message fail).
604
626
  */ export async function ensureAuthRegistryPublished(wallet, from) {
605
- const { instance, contractClass } = await getStandardAuthRegistry();
606
- if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
607
- await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
608
- from
609
- });
610
- }
611
- if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
612
- await publishInstance(wallet, instance).send({
613
- from
614
- });
615
- }
616
- await wallet.registerContract(instance, AuthRegistryArtifact);
627
+ await testSpan('setup:auth-registry', async ()=>{
628
+ const { instance, contractClass } = await getStandardAuthRegistry();
629
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
630
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
631
+ from
632
+ });
633
+ }
634
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
635
+ await publishInstance(wallet, instance).send({
636
+ from
637
+ });
638
+ }
639
+ await wallet.registerContract(instance, AuthRegistryArtifact);
640
+ });
617
641
  }
618
642
  /**
619
643
  * Registers the public_checks contract class and publishes its standard instance if not already
@@ -652,77 +676,6 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
652
676
  }
653
677
  await wallet.registerContract(instance, HandshakeRegistryArtifact);
654
678
  }
655
- /**
656
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
657
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
658
- */ export async function ensureAccountContractsPublished(wallet, accountsToDeploy) {
659
- const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (address)=>{
660
- return {
661
- address,
662
- deployed: (await wallet.getContractMetadata(address)).isContractPublished
663
- };
664
- }));
665
- const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>wallet.getContractMetadata(address)))).map((contractMetadata)=>contractMetadata.instance);
666
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
667
- if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
668
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({
669
- from: accountsToDeploy[0]
670
- });
671
- }
672
- const requests = instances.map((instance)=>publishInstance(wallet, instance));
673
- const batch = new BatchCall(wallet, requests);
674
- await batch.send({
675
- from: accountsToDeploy[0]
676
- });
677
- }
678
- /**
679
- * Helper function to deploy accounts.
680
- * Returns deployed account data that can be used by tests.
681
- */ export const deployAccounts = (numberOfAccounts, logger, deployOptions)=>async ({ wallet, initialFundedAccounts })=>{
682
- if (initialFundedAccounts.length < numberOfAccounts) {
683
- throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
684
- }
685
- logger.verbose('Deploying accounts funded with fee juice...');
686
- const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
687
- // Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
688
- for(let i = 0; i < deployedAccounts.length; i++){
689
- const accountManager = await wallet.createSchnorrAccount(deployedAccounts[i].secret, deployedAccounts[i].salt, deployedAccounts[i].signingKey);
690
- const deployMethod = await accountManager.getDeployMethod();
691
- await deployMethod.send({
692
- from: NO_FROM,
693
- skipClassPublication: i !== 0,
694
- ...deployOptions
695
- });
696
- }
697
- return {
698
- deployedAccounts
699
- };
700
- };
701
- /**
702
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
703
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
704
- */ export async function publicDeployAccounts(wallet, accountsToDeploy, waitUntilProven = false, node) {
705
- const instances = (await Promise.all(accountsToDeploy.map((account)=>wallet.getContractMetadata(account)))).map((metadata)=>metadata.instance);
706
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
707
- const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
708
- const calls = await Promise.all([
709
- ...!alreadyRegistered ? [
710
- publishContractClass(wallet, SchnorrAccountContractArtifact)
711
- ] : [],
712
- ...instances.map((instance)=>publishInstance(wallet, instance))
713
- ]);
714
- const batch = new BatchCall(wallet, calls);
715
- const { receipt: txReceipt } = await batch.send({
716
- from: accountsToDeploy[0]
717
- });
718
- if (waitUntilProven) {
719
- if (!node) {
720
- throw new Error('Need to provide an AztecNode to wait for proven.');
721
- } else {
722
- await waitForProven(node, txReceipt);
723
- }
724
- }
725
- }
726
679
  /**
727
680
  * Destroys the current context.
728
681
  */ export async function teardown(context) {