@aztec/end-to-end 0.0.1-commit.2f68f620 → 0.0.1-commit.3100065

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 (272) hide show
  1. package/README.md +215 -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/utils.d.ts +3 -3
  31. package/dest/bench/utils.d.ts.map +1 -1
  32. package/dest/bench/utils.js +95 -6
  33. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  34. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  35. package/dest/composed/ha/ha_full_setup.js +383 -0
  36. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  37. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  38. package/dest/fixtures/e2e_prover_test.d.ts +12 -9
  39. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  40. package/dest/fixtures/e2e_prover_test.js +48 -28
  41. package/dest/fixtures/fixtures.d.ts +17 -9
  42. package/dest/fixtures/fixtures.d.ts.map +1 -1
  43. package/dest/fixtures/fixtures.js +21 -8
  44. package/dest/fixtures/ha_setup.d.ts +3 -3
  45. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  46. package/dest/fixtures/ha_setup.js +4 -1
  47. package/dest/fixtures/index.d.ts +2 -1
  48. package/dest/fixtures/index.d.ts.map +1 -1
  49. package/dest/fixtures/index.js +1 -0
  50. package/dest/fixtures/setup.d.ts +46 -41
  51. package/dest/fixtures/setup.d.ts.map +1 -1
  52. package/dest/fixtures/setup.js +194 -229
  53. package/dest/fixtures/setup_p2p_test.d.ts +1 -1
  54. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  55. package/dest/fixtures/setup_p2p_test.js +3 -3
  56. package/dest/fixtures/standard_contracts_genesis.d.ts +16 -0
  57. package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
  58. package/dest/fixtures/standard_contracts_genesis.js +25 -0
  59. package/dest/fixtures/timing.d.ts +42 -0
  60. package/dest/fixtures/timing.d.ts.map +1 -0
  61. package/dest/fixtures/timing.js +72 -0
  62. package/dest/fixtures/token_utils.d.ts +22 -4
  63. package/dest/fixtures/token_utils.d.ts.map +1 -1
  64. package/dest/fixtures/token_utils.js +21 -1
  65. package/dest/fixtures/utils.d.ts +2 -2
  66. package/dest/fixtures/utils.d.ts.map +1 -1
  67. package/dest/fixtures/utils.js +1 -1
  68. package/dest/fixtures/wait_helpers.d.ts +135 -0
  69. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  70. package/dest/fixtures/wait_helpers.js +154 -0
  71. package/dest/forward-compatibility/wallet_service.js +3 -3
  72. package/dest/multi-node/block-production/setup.d.ts +97 -0
  73. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  74. package/dest/multi-node/block-production/setup.js +158 -0
  75. package/dest/multi-node/governance/setup.d.ts +67 -0
  76. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  77. package/dest/multi-node/governance/setup.js +126 -0
  78. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  79. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  80. package/dest/multi-node/multi_node_test_context.js +347 -0
  81. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  82. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  83. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  84. package/dest/multi-node/slashing/setup.d.ts +167 -0
  85. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  86. package/dest/multi-node/slashing/setup.js +275 -0
  87. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +10 -2
  88. package/dest/p2p/p2p_network.d.ts.map +1 -0
  89. package/dest/{e2e_p2p → p2p}/p2p_network.js +41 -16
  90. package/dest/p2p/reqresp/utils.d.ts +19 -0
  91. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  92. package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -17
  93. package/dest/p2p/shared.d.ts +72 -0
  94. package/dest/p2p/shared.d.ts.map +1 -0
  95. package/dest/p2p/shared.js +212 -0
  96. package/dest/shared/cross_chain_test_harness.d.ts +3 -3
  97. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  98. package/dest/shared/cross_chain_test_harness.js +24 -16
  99. package/dest/shared/gas_portal_test_harness.d.ts +1 -1
  100. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  101. package/dest/shared/gas_portal_test_harness.js +8 -5
  102. package/dest/shared/submit-transactions.d.ts +1 -1
  103. package/dest/shared/submit-transactions.d.ts.map +1 -1
  104. package/dest/shared/submit-transactions.js +12 -5
  105. package/dest/shared/timing_env.d.js +5 -0
  106. package/dest/shared/timing_env.js +365 -0
  107. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  108. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  109. package/dest/shared/uniswap_l1_l2.js +1 -6
  110. package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
  111. package/dest/simulators/lending_simulator.js +1 -1
  112. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  113. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  114. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  115. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  116. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  117. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  118. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  119. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  120. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
  121. package/dest/single-node/fees/fees_test.d.ts +95 -0
  122. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  123. package/dest/{e2e_fees → single-node/fees}/fees_test.js +126 -60
  124. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  125. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  126. package/dest/single-node/l1-reorgs/setup.js +57 -0
  127. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  128. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  129. package/dest/single-node/partial-proofs/setup.js +5 -0
  130. package/dest/single-node/proving/setup.d.ts +5 -0
  131. package/dest/single-node/proving/setup.d.ts.map +1 -0
  132. package/dest/single-node/proving/setup.js +5 -0
  133. package/dest/single-node/recovery/setup.d.ts +5 -0
  134. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  135. package/dest/single-node/recovery/setup.js +5 -0
  136. package/dest/single-node/setup.d.ts +49 -0
  137. package/dest/single-node/setup.d.ts.map +1 -0
  138. package/dest/single-node/setup.js +56 -0
  139. package/dest/single-node/single_node_test_context.d.ts +373 -0
  140. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  141. package/dest/single-node/single_node_test_context.js +845 -0
  142. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  143. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  144. package/dest/spartan/setup_test_wallets.js +19 -9
  145. package/dest/spartan/tx_metrics.d.ts +10 -1
  146. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  147. package/dest/spartan/tx_metrics.js +32 -0
  148. package/dest/test-wallet/test_wallet.d.ts +23 -3
  149. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  150. package/dest/test-wallet/test_wallet.js +54 -7
  151. package/dest/test-wallet/utils.d.ts +36 -1
  152. package/dest/test-wallet/utils.d.ts.map +1 -1
  153. package/dest/test-wallet/utils.js +64 -4
  154. package/dest/test-wallet/wallet_worker_script.js +5 -2
  155. package/dest/test-wallet/worker_wallet.d.ts +5 -5
  156. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  157. package/dest/test-wallet/worker_wallet.js +2 -2
  158. package/dest/test-wallet/worker_wallet_schema.d.ts +3 -159
  159. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
  160. package/dest/test-wallet/worker_wallet_schema.js +2 -1
  161. package/package.json +41 -41
  162. package/src/automine/README.md +60 -0
  163. package/src/automine/automine_test_context.ts +153 -0
  164. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  165. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  166. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +20 -57
  167. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -57
  168. package/src/automine/token/token_test_helpers.ts +138 -0
  169. package/src/bench/client_flows/benchmark.ts +3 -1
  170. package/src/bench/client_flows/client_flows_benchmark.ts +45 -26
  171. package/src/bench/utils.ts +109 -6
  172. package/src/composed/ha/ha_full_setup.ts +466 -0
  173. package/src/fixtures/e2e_prover_test.ts +60 -47
  174. package/src/fixtures/fixtures.ts +23 -8
  175. package/src/fixtures/ha_setup.ts +7 -3
  176. package/src/fixtures/index.ts +1 -0
  177. package/src/fixtures/setup.ts +243 -289
  178. package/src/fixtures/setup_p2p_test.ts +3 -3
  179. package/src/fixtures/standard_contracts_genesis.ts +28 -0
  180. package/src/fixtures/timing.ts +97 -0
  181. package/src/fixtures/token_utils.ts +39 -4
  182. package/src/fixtures/utils.ts +0 -3
  183. package/src/fixtures/wait_helpers.ts +333 -0
  184. package/src/forward-compatibility/wallet_service.ts +6 -4
  185. package/src/guides/up_quick_start.sh +5 -0
  186. package/src/infra/README.md +12 -0
  187. package/src/multi-node/README.md +96 -0
  188. package/src/multi-node/block-production/setup.ts +272 -0
  189. package/src/multi-node/governance/setup.ts +172 -0
  190. package/src/multi-node/multi_node_test_context.ts +447 -0
  191. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  192. package/src/multi-node/slashing/setup.ts +433 -0
  193. package/src/p2p/README.md +78 -0
  194. package/src/{e2e_p2p → p2p}/p2p_network.ts +40 -13
  195. package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -16
  196. package/src/p2p/shared.ts +329 -0
  197. package/src/shared/cross_chain_test_harness.ts +22 -13
  198. package/src/shared/gas_portal_test_harness.ts +13 -5
  199. package/src/shared/submit-transactions.ts +13 -5
  200. package/src/shared/timing_env.d.mts +39 -0
  201. package/src/shared/timing_env.mjs +363 -0
  202. package/src/shared/uniswap_l1_l2.ts +1 -8
  203. package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
  204. package/src/simulators/lending_simulator.ts +1 -1
  205. package/src/single-node/README.md +66 -0
  206. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  207. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  208. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
  209. package/src/{e2e_fees → single-node/fees}/fees_test.ts +143 -70
  210. package/src/single-node/l1-reorgs/setup.ts +93 -0
  211. package/src/single-node/partial-proofs/setup.ts +8 -0
  212. package/src/single-node/proving/setup.ts +15 -0
  213. package/src/single-node/recovery/setup.ts +8 -0
  214. package/src/single-node/setup.ts +63 -0
  215. package/src/single-node/single_node_test_context.ts +1054 -0
  216. package/src/spartan/setup_test_wallets.ts +24 -9
  217. package/src/spartan/tx_metrics.ts +26 -0
  218. package/src/test-wallet/test_wallet.ts +58 -8
  219. package/src/test-wallet/utils.ts +102 -5
  220. package/src/test-wallet/wallet_worker_script.ts +6 -3
  221. package/src/test-wallet/worker_wallet.ts +5 -9
  222. package/src/test-wallet/worker_wallet_schema.ts +3 -2
  223. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
  224. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  225. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -58
  226. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  227. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -161
  228. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  229. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  230. package/dest/e2e_deploy_contract/deploy_test.js +0 -51
  231. package/dest/e2e_epochs/epochs_test.d.ts +0 -125
  232. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  233. package/dest/e2e_epochs/epochs_test.js +0 -460
  234. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  235. package/dest/e2e_fees/fees_test.d.ts +0 -91
  236. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  237. package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
  238. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  239. package/dest/e2e_l1_publisher/write_json.js +0 -56
  240. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  241. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  242. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  243. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  244. package/dest/e2e_nested_contract/nested_contract_test.js +0 -55
  245. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  246. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  247. package/dest/e2e_p2p/inactivity_slash_test.js +0 -137
  248. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  249. package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
  250. package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
  251. package/dest/e2e_p2p/shared.d.ts +0 -75
  252. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  253. package/dest/e2e_p2p/shared.js +0 -217
  254. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
  255. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
  256. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
  257. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
  258. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  259. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -231
  260. package/src/e2e_deploy_contract/deploy_test.ts +0 -86
  261. package/src/e2e_epochs/epochs_test.ts +0 -575
  262. package/src/e2e_l1_publisher/write_json.ts +0 -77
  263. package/src/e2e_nested_contract/nested_contract_test.ts +0 -77
  264. package/src/e2e_p2p/inactivity_slash_test.ts +0 -180
  265. package/src/e2e_p2p/shared.ts +0 -332
  266. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
  267. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
  268. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  269. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
  270. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
  271. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
  272. /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,8 @@ 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 { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
49
+ import { testSpan } from './timing.js';
52
50
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
53
51
  export { startAnvil };
54
52
  let telemetry = undefined;
@@ -84,11 +82,13 @@ export const getPrivateKeyFromIndex = (index)=>{
84
82
  /**
85
83
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
86
84
  * @param aztecNode - An instance of Aztec Node.
85
+ * @param nodeDebug - The node's debug API, used to register public function signatures for named traces; pass
86
+ * `undefined` when the node does not expose it.
87
87
  * @param opts - Partial configuration for the PXE.
88
88
  * @param logger - The logger to be used.
89
89
  * @param actor - Actor label to include in log output (e.g., 'pxe-test').
90
90
  * @returns A test wallet, logger and teardown function.
91
- */ export async function setupPXEAndGetWallet(aztecNode, opts = {}, logger = getLogger(), actor) {
91
+ */ export async function setupPXEAndGetWallet(aztecNode, nodeDebug, opts = {}, logger = getLogger(), actor) {
92
92
  const PXEConfig = {
93
93
  ...getPXEConfig(),
94
94
  ...opts
@@ -102,7 +102,8 @@ export const getPrivateKeyFromIndex = (index)=>{
102
102
  }
103
103
  const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(PXEConfig.dataDirectory);
104
104
  const wallet = await TestWallet.create(aztecNode, PXEConfig, {
105
- loggerActorLabel: actor
105
+ loggerActorLabel: actor,
106
+ nodeDebug
106
107
  });
107
108
  return {
108
109
  wallet,
@@ -134,12 +135,32 @@ export const getPrivateKeyFromIndex = (index)=>{
134
135
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
135
136
  * @param opts - Options to pass to the node initialization and to the setup script.
136
137
  * @param pxeOpts - Options to pass to the PXE initialization.
137
- */ export async function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
138
+ */ export function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
139
+ // Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
140
+ // swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
141
+ // (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
142
+ const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
143
+ return testSpan(`setup:env:${proverMode}`, async ()=>{
144
+ const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
145
+ if (process.env.EXIT_E2E_AFTER_SETUP) {
146
+ ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
147
+ throw new Error('EXIT_E2E_AFTER_SETUP');
148
+ }
149
+ return ctx;
150
+ });
151
+ }
152
+ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
138
153
  assertContractArtifactsVersion();
154
+ const logger = getLogger();
139
155
  let anvil;
140
156
  try {
141
157
  opts.aztecTargetCommitteeSize ??= 0;
142
158
  opts.slasherEnabled ??= false;
159
+ // Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
160
+ // waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
161
+ // assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
162
+ opts.automineL1Setup ??= true;
163
+ logger.trace('Starting e2e test setup');
143
164
  const config = {
144
165
  ...getConfigEnvVars(),
145
166
  ...opts
@@ -150,13 +171,10 @@ export const getPrivateKeyFromIndex = (index)=>{
150
171
  config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
151
172
  // For tests we only want proving enabled if specifically requested
152
173
  config.realProofs = !!opts.realProofs;
153
- // Only enforce the time table if requested
154
- config.enforceTimeTable = !!opts.enforceTimeTable;
155
174
  // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
156
175
  config.enableDelayer = true;
157
176
  config.listenAddress = '127.0.0.1';
158
177
  config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
159
- const logger = getLogger();
160
178
  // Create a temp directory for any services that need it and cleanup later
161
179
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
162
180
  await fs.mkdir(directoryToCleanup, {
@@ -170,18 +188,19 @@ export const getPrivateKeyFromIndex = (index)=>{
170
188
  if (!isAnvilTestChain(chain.id)) {
171
189
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
172
190
  }
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
- });
191
+ const res = await testSpan('setup:env:anvil', ()=>startAnvil({
192
+ l1BlockTime: opts.ethereumSlotDuration,
193
+ accounts: opts.anvilAccounts,
194
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
195
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
196
+ dateProvider
197
+ }));
180
198
  anvil = res.anvil;
181
199
  config.l1RpcUrls = [
182
200
  res.rpcUrl
183
201
  ];
184
202
  }
203
+ logger.trace('Started anvil and L1 RPC client');
185
204
  // Enable logging metrics to a local file named after the test suite
186
205
  if (isMetricsLoggingRequested()) {
187
206
  const filename = path.join('log', getJobName() + '.jsonl');
@@ -197,6 +216,7 @@ export const getPrivateKeyFromIndex = (index)=>{
197
216
  resetBlockInterval: true
198
217
  });
199
218
  }
219
+ logger.trace('Initialized L1 cheat codes and applied state/time overrides');
200
220
  let publisherPrivKeyHex = undefined;
201
221
  let publisherHdAccount = undefined;
202
222
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
@@ -221,22 +241,46 @@ export const getPrivateKeyFromIndex = (index)=>{
221
241
  if (config.coinbase === undefined) {
222
242
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
223
243
  }
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);
244
+ logger.trace('Resolved L1 publisher account');
245
+ // The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
246
+ // funded at genesis so they are immediately usable.
247
+ const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
248
+ // Extra accounts the test wants funded at genesis but will create/deploy itself.
249
+ const additionallyFundedAccounts = opts.additionallyFundedAccounts ?? [];
250
+ const addressesToFund = [
251
+ ...defaultAccounts,
252
+ ...additionallyFundedAccounts
253
+ ].map((a)=>a.address);
227
254
  // Optionally fund the sponsored FPC
228
255
  if (opts.fundSponsoredFPC) {
229
256
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
230
257
  addressesToFund.push(sponsoredFPCAddress);
231
258
  }
259
+ // Fund any extra addresses whose value depends on the just-generated accounts (e.g. an FPC admin'd
260
+ // by a default account), so a test can genesis-fund them instead of bridging fee juice during setup.
261
+ if (opts.computeExtraGenesisFundedAddresses) {
262
+ addressesToFund.push(...await opts.computeExtraGenesisFundedAddresses(defaultAccounts));
263
+ }
264
+ logger.trace('Generated test accounts to fund at genesis');
265
+ // Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) so their `ensure*Published` setup
266
+ // helpers short-circuit their publish txs. The archiver flag seeds the bytecode/instance into every spawned node's
267
+ // contract store; the genesis nullifiers make the AVM's deployment-nullifier check pass when they are called. Both
268
+ // must go together (flag alone would recreate the publish-collision bug), so the flag lives here beside the seeding.
269
+ config.testPreloadStandardContracts = true;
270
+ const standardContractNullifiers = await getStandardContractGenesisNullifiers();
232
271
  const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
233
- const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp);
272
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp, standardContractNullifiers);
273
+ logger.trace('Computed genesis values');
234
274
  const wasAutomining = await ethCheatCodes.isAutoMining();
235
275
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
236
276
  if (enableAutomine) {
237
277
  await ethCheatCodes.setAutomine(true);
238
278
  }
239
279
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount, chain);
280
+ // Warm both KZG trusted setups (ours + anvil's) in parallel
281
+ if (anvil && isAnvilTestChain(chain.id)) {
282
+ await warmBlobKzg(l1Client, logger);
283
+ }
240
284
  // Deploy Multicall3 if running locally
241
285
  await deployMulticall3(l1Client, logger);
242
286
  // Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
@@ -244,17 +288,18 @@ export const getPrivateKeyFromIndex = (index)=>{
244
288
  await l1Client.getTransactionCount({
245
289
  address: l1Client.account.address
246
290
  });
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
- });
291
+ logger.trace('Deployed Multicall3');
292
+ const deployL1ContractsValues = await testSpan('setup:env:l1-deploy', ()=>deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
293
+ ...getL1ContractsConfigEnvVars(),
294
+ ...opts,
295
+ ...opts.l1ContractsArgs,
296
+ vkTreeRoot: getVKTreeRoot(),
297
+ protocolContractsHash,
298
+ genesisArchiveRoot,
299
+ initialValidators: opts.initialValidators,
300
+ feeJuicePortalInitialBalance: fundingNeeded,
301
+ realVerifier: false
302
+ }));
258
303
  Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
259
304
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
260
305
  // Propagate L1-contracts-config overrides back to the node config so the archiver's
@@ -274,13 +319,28 @@ export const getPrivateKeyFromIndex = (index)=>{
274
319
  }
275
320
  }
276
321
  }
322
+ // Deploy any test-specific L1 contracts while automine is still on and before the node starts,
323
+ // so they mine instantly rather than paying the L1 block interval once the sequencer is live.
324
+ let extraL1DeployResult = undefined;
325
+ if (opts.deployExtraL1Contracts) {
326
+ logger.trace('Running deployExtraL1Contracts hook');
327
+ extraL1DeployResult = await opts.deployExtraL1Contracts({
328
+ l1Client,
329
+ deployL1ContractsValues,
330
+ logger
331
+ });
332
+ // The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
333
+ // stale cached nonce for later transactions on the publisher account.
334
+ await l1Client.getTransactionCount({
335
+ address: l1Client.account.address
336
+ });
337
+ }
277
338
  if (enableAutomine) {
278
- await ethCheatCodes.setAutomine(false);
279
- await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
339
+ await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
280
340
  }
281
341
  // 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.
342
+ // ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
343
+ // the stdout listener.
284
344
  if (!anvil) {
285
345
  dateProvider.setTime(await ethCheatCodes.lastBlockTimestamp() * 1000);
286
346
  }
@@ -289,24 +349,30 @@ export const getPrivateKeyFromIndex = (index)=>{
289
349
  resetBlockInterval: true
290
350
  });
291
351
  }
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);
352
+ logger.trace('Deployed L1 rollup contracts');
353
+ // These boot steps are independent and write disjoint config keys, so run them concurrently:
354
+ // telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
355
+ // and the ACVM/BB config resolvers write their own acvm*/bb* keys.
356
+ const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
357
+ // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
358
+ opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
359
+ setupSharedBlobStorage(config),
360
+ getACVMConfig(logger),
361
+ getBBConfig(logger)
362
+ ]);
363
+ logger.trace('Created telemetry client');
364
+ logger.trace('Set up shared blob storage');
301
365
  if (acvmConfig) {
302
366
  config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
303
367
  config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
304
368
  }
305
- const bbConfig = await getBBConfig(logger);
369
+ logger.trace('Resolved ACVM config');
306
370
  if (bbConfig) {
307
371
  config.bbBinaryPath = bbConfig.bbBinaryPath;
308
372
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
309
373
  }
374
+ logger.trace('Resolved Barretenberg config');
375
+ logger.verbose('Creating and synching an aztec node', config);
310
376
  let mockGossipSubNetwork;
311
377
  let p2pClientDeps = undefined;
312
378
  if (opts.mockGossipSubNetwork) {
@@ -315,25 +381,6 @@ export const getPrivateKeyFromIndex = (index)=>{
315
381
  p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
316
382
  };
317
383
  }
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
384
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
338
385
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
339
386
  if (!config.disableValidator) {
@@ -354,17 +401,19 @@ export const getPrivateKeyFromIndex = (index)=>{
354
401
  bootstrapNodes: []
355
402
  }
356
403
  } : 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
- }));
404
+ logger.trace('Prepared aztec node config');
405
+ const aztecNodeService = await testSpan('setup:env:sequencer-start', ()=>withLoggerBindings({
406
+ actor: 'node-0'
407
+ }, ()=>createAztecNodeService(initialNodeConfig, {
408
+ dateProvider,
409
+ telemetry: telemetryClient,
410
+ p2pClientDeps
411
+ }, {
412
+ genesis,
413
+ dontStartSequencer: opts.skipInitialSequencer
414
+ })));
367
415
  const sequencerClient = aztecNodeService.getSequencer();
416
+ logger.trace('Created and synced aztec node');
368
417
  let proverNode = undefined;
369
418
  if (opts.startProverNode) {
370
419
  logger.verbose('Creating and syncing a simulated prover node...');
@@ -377,16 +426,17 @@ export const getPrivateKeyFromIndex = (index)=>{
377
426
  aztecNodeService
378
427
  ]
379
428
  };
380
- ({ proverNode } = await createAndSyncProverNode(proverNodePrivateKeyHex, config, {
381
- ...config.proverNodeConfig,
382
- dataDirectory: proverNodeDataDirectory
383
- }, {
384
- dateProvider,
385
- p2pClientDeps,
386
- telemetry: telemetryClient
387
- }, {
388
- genesis
389
- }));
429
+ ({ proverNode } = await testSpan('setup:env:prover-node', ()=>createAndSyncProverNode(proverNodePrivateKeyHex, config, {
430
+ ...config.proverNodeConfig,
431
+ dataDirectory: proverNodeDataDirectory
432
+ }, {
433
+ dateProvider,
434
+ p2pClientDeps,
435
+ telemetry: telemetryClient
436
+ }, {
437
+ genesis
438
+ })));
439
+ logger.trace('Created prover node');
390
440
  }
391
441
  const sequencerDelayer = sequencerClient?.getDelayer();
392
442
  const proverDelayer = proverNode?.getProverNode()?.getDelayer();
@@ -398,73 +448,57 @@ export const getPrivateKeyFromIndex = (index)=>{
398
448
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
399
449
  // For tests we only want proving enabled if specifically requested
400
450
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
401
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
402
- loggerActorLabel: 'pxe-0',
403
- ...opts.pxeCreationOptions
404
- });
451
+ const wallet = await testSpan('setup:env:pxe', ()=>TestWallet.create(aztecNodeService, pxeConfig, {
452
+ loggerActorLabel: 'pxe-0',
453
+ // In-process node implements the debug API, so register public function signatures for named traces.
454
+ nodeDebug: aztecNodeService,
455
+ ...opts.pxeCreationOptions
456
+ }));
405
457
  if (opts.walletMinFeePadding !== undefined) {
406
458
  wallet.setMinFeePadding(opts.walletMinFeePadding);
407
459
  }
408
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider, aztecNodeService.getAutomineSequencer());
460
+ logger.trace('Created PXE and test wallet');
461
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
462
+ logger.trace('Created cheat codes');
409
463
  if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
410
464
  // We need to advance such that the committee is set up.
411
465
  await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1)));
412
466
  await cheatCodes.rollup.setupEpoch();
413
467
  await cheatCodes.rollup.debugRollup();
468
+ logger.trace('Advanced chain to set up validator committee');
414
469
  }
415
470
  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
- }
471
+ // Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
472
+ // + a simulated store call) with no on-chain tx, independent of the sequencer.
473
+ if (numberOfAccounts > 0) {
474
+ logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
475
+ await testSpan('wallet:create', ()=>createFundedInitializerlessAccounts(wallet, defaultAccounts));
476
+ accounts = defaultAccounts.map((a)=>a.address);
433
477
  }
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{
478
+ logger.trace('Created funded test accounts');
479
+ const teardown = ()=>testSpan('teardown:env', async ()=>{
461
480
  try {
462
- await telemetryClient.stop();
481
+ await tryStop(wallet, logger);
482
+ await tryStop(aztecNodeService, logger);
483
+ await tryStop(proverNode, logger);
484
+ if (acvmConfig?.cleanup) {
485
+ await acvmConfig.cleanup();
486
+ }
487
+ if (bbConfig?.cleanup) {
488
+ await bbConfig.cleanup();
489
+ }
490
+ await tryStop(anvil, logger);
491
+ await tryRmDir(directoryToCleanup, logger);
463
492
  } catch (err) {
464
- logger.error(`Error during telemetry client stop`, err);
493
+ logger.error(`Error during e2e test teardown`, err);
494
+ } finally{
495
+ try {
496
+ await telemetryClient.stop();
497
+ } catch (err) {
498
+ logger.error(`Error during telemetry client stop`, err);
499
+ }
465
500
  }
466
- }
467
- };
501
+ });
468
502
  return {
469
503
  anvil,
470
504
  aztecNode: aztecNodeService,
@@ -476,10 +510,11 @@ export const getPrivateKeyFromIndex = (index)=>{
476
510
  aztecNodeConfig: config,
477
511
  dateProvider,
478
512
  deployL1ContractsValues,
479
- initialFundedAccounts,
513
+ additionallyFundedAccounts,
480
514
  logger,
481
515
  mockGossipSubNetwork,
482
516
  genesis,
517
+ extraL1DeployResult,
483
518
  proverNode,
484
519
  sequencerDelayer,
485
520
  proverDelayer,
@@ -488,7 +523,6 @@ export const getPrivateKeyFromIndex = (index)=>{
488
523
  telemetryClient,
489
524
  wallet,
490
525
  accounts,
491
- watcher,
492
526
  acvmConfig,
493
527
  bbConfig,
494
528
  directoryToCleanup
@@ -539,7 +573,7 @@ export const getPrivateKeyFromIndex = (index)=>{
539
573
  */ export async function registerSponsoredFPC(wallet) {
540
574
  await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
541
575
  }
542
- export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 1) {
576
+ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 0.25) {
543
577
  targetBlock ??= await node.getBlockNumber();
544
578
  await retryUntil(async ()=>await node.getBlockNumber('proven') >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
545
579
  }
@@ -550,7 +584,7 @@ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, int
550
584
  return withLoggerBindings({
551
585
  actor: 'prover-0'
552
586
  }, async ()=>{
553
- const proverNode = await AztecNodeService.createAndSync({
587
+ const proverNode = await createAztecNodeService({
554
588
  ...baseConfig,
555
589
  ...configOverrides,
556
590
  p2pPort: 0,
@@ -602,18 +636,20 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
602
636
  * required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
603
637
  * surface as generic "Assertion failed:" and tests that match on the real message fail).
604
638
  */ 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);
639
+ await testSpan('setup:auth-registry', async ()=>{
640
+ const { instance, contractClass } = await getStandardAuthRegistry();
641
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
642
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
643
+ from
644
+ });
645
+ }
646
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
647
+ await publishInstance(wallet, instance).send({
648
+ from
649
+ });
650
+ }
651
+ await wallet.registerContract(instance, AuthRegistryArtifact);
652
+ });
617
653
  }
618
654
  /**
619
655
  * Registers the public_checks contract class and publishes its standard instance if not already
@@ -652,77 +688,6 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
652
688
  }
653
689
  await wallet.registerContract(instance, HandshakeRegistryArtifact);
654
690
  }
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
691
  /**
727
692
  * Destroys the current context.
728
693
  */ export async function teardown(context) {