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

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 (274) 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/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 +48 -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 +48 -42
  52. package/dest/fixtures/setup.d.ts.map +1 -1
  53. package/dest/fixtures/setup.js +194 -229
  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/standard_contracts_genesis.d.ts +16 -0
  58. package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
  59. package/dest/fixtures/standard_contracts_genesis.js +25 -0
  60. package/dest/fixtures/timing.d.ts +42 -0
  61. package/dest/fixtures/timing.d.ts.map +1 -0
  62. package/dest/fixtures/timing.js +72 -0
  63. package/dest/fixtures/token_utils.d.ts +22 -4
  64. package/dest/fixtures/token_utils.d.ts.map +1 -1
  65. package/dest/fixtures/token_utils.js +21 -1
  66. package/dest/fixtures/utils.d.ts +2 -2
  67. package/dest/fixtures/utils.d.ts.map +1 -1
  68. package/dest/fixtures/utils.js +1 -1
  69. package/dest/fixtures/wait_helpers.d.ts +135 -0
  70. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  71. package/dest/fixtures/wait_helpers.js +154 -0
  72. package/dest/forward-compatibility/wallet_service.js +3 -3
  73. package/dest/multi-node/block-production/setup.d.ts +97 -0
  74. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  75. package/dest/multi-node/block-production/setup.js +158 -0
  76. package/dest/multi-node/governance/setup.d.ts +67 -0
  77. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  78. package/dest/multi-node/governance/setup.js +126 -0
  79. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  80. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  81. package/dest/multi-node/multi_node_test_context.js +347 -0
  82. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  83. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  84. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  85. package/dest/multi-node/slashing/setup.d.ts +167 -0
  86. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  87. package/dest/multi-node/slashing/setup.js +275 -0
  88. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +10 -2
  89. package/dest/p2p/p2p_network.d.ts.map +1 -0
  90. package/dest/{e2e_p2p → p2p}/p2p_network.js +41 -16
  91. package/dest/p2p/reqresp/utils.d.ts +19 -0
  92. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  93. package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -17
  94. package/dest/p2p/shared.d.ts +72 -0
  95. package/dest/p2p/shared.d.ts.map +1 -0
  96. package/dest/p2p/shared.js +212 -0
  97. package/dest/shared/cross_chain_test_harness.d.ts +3 -3
  98. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  99. package/dest/shared/cross_chain_test_harness.js +24 -16
  100. package/dest/shared/gas_portal_test_harness.d.ts +1 -1
  101. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  102. package/dest/shared/gas_portal_test_harness.js +8 -5
  103. package/dest/shared/submit-transactions.d.ts +1 -1
  104. package/dest/shared/submit-transactions.d.ts.map +1 -1
  105. package/dest/shared/submit-transactions.js +12 -5
  106. package/dest/shared/timing_env.d.js +5 -0
  107. package/dest/shared/timing_env.js +365 -0
  108. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  109. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  110. package/dest/shared/uniswap_l1_l2.js +1 -6
  111. package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
  112. package/dest/simulators/lending_simulator.js +1 -1
  113. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  114. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  115. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  116. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  117. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  118. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  119. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  120. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  121. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
  122. package/dest/single-node/fees/fees_test.d.ts +95 -0
  123. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  124. package/dest/{e2e_fees → single-node/fees}/fees_test.js +126 -60
  125. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  126. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  127. package/dest/single-node/l1-reorgs/setup.js +57 -0
  128. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  129. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  130. package/dest/single-node/partial-proofs/setup.js +5 -0
  131. package/dest/single-node/proving/setup.d.ts +5 -0
  132. package/dest/single-node/proving/setup.d.ts.map +1 -0
  133. package/dest/single-node/proving/setup.js +5 -0
  134. package/dest/single-node/recovery/setup.d.ts +5 -0
  135. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  136. package/dest/single-node/recovery/setup.js +5 -0
  137. package/dest/single-node/setup.d.ts +49 -0
  138. package/dest/single-node/setup.d.ts.map +1 -0
  139. package/dest/single-node/setup.js +56 -0
  140. package/dest/single-node/single_node_test_context.d.ts +374 -0
  141. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  142. package/dest/single-node/single_node_test_context.js +847 -0
  143. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  144. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  145. package/dest/spartan/setup_test_wallets.js +19 -9
  146. package/dest/spartan/tx_metrics.d.ts +10 -1
  147. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  148. package/dest/spartan/tx_metrics.js +32 -0
  149. package/dest/test-wallet/test_wallet.d.ts +23 -3
  150. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  151. package/dest/test-wallet/test_wallet.js +56 -9
  152. package/dest/test-wallet/utils.d.ts +36 -1
  153. package/dest/test-wallet/utils.d.ts.map +1 -1
  154. package/dest/test-wallet/utils.js +64 -4
  155. package/dest/test-wallet/wallet_worker_script.js +5 -2
  156. package/dest/test-wallet/worker_wallet.d.ts +5 -5
  157. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  158. package/dest/test-wallet/worker_wallet.js +5 -3
  159. package/dest/test-wallet/worker_wallet_schema.d.ts +3 -159
  160. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
  161. package/dest/test-wallet/worker_wallet_schema.js +2 -1
  162. package/package.json +41 -41
  163. package/src/automine/README.md +60 -0
  164. package/src/automine/automine_test_context.ts +153 -0
  165. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  166. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  167. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +20 -57
  168. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -57
  169. package/src/automine/token/token_test_helpers.ts +138 -0
  170. package/src/bench/client_flows/benchmark.ts +3 -1
  171. package/src/bench/client_flows/client_flows_benchmark.ts +45 -26
  172. package/src/bench/client_flows/data_extractor.ts +1 -0
  173. package/src/bench/utils.ts +109 -6
  174. package/src/composed/ha/ha_full_setup.ts +466 -0
  175. package/src/fixtures/e2e_prover_test.ts +60 -47
  176. package/src/fixtures/fixtures.ts +28 -11
  177. package/src/fixtures/ha_setup.ts +7 -3
  178. package/src/fixtures/index.ts +1 -0
  179. package/src/fixtures/setup.ts +245 -290
  180. package/src/fixtures/setup_p2p_test.ts +3 -3
  181. package/src/fixtures/standard_contracts_genesis.ts +28 -0
  182. package/src/fixtures/timing.ts +97 -0
  183. package/src/fixtures/token_utils.ts +39 -4
  184. package/src/fixtures/utils.ts +0 -3
  185. package/src/fixtures/wait_helpers.ts +333 -0
  186. package/src/forward-compatibility/wallet_service.ts +6 -4
  187. package/src/guides/up_quick_start.sh +5 -0
  188. package/src/infra/README.md +12 -0
  189. package/src/multi-node/README.md +96 -0
  190. package/src/multi-node/block-production/setup.ts +272 -0
  191. package/src/multi-node/governance/setup.ts +172 -0
  192. package/src/multi-node/multi_node_test_context.ts +447 -0
  193. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  194. package/src/multi-node/slashing/setup.ts +433 -0
  195. package/src/p2p/README.md +78 -0
  196. package/src/{e2e_p2p → p2p}/p2p_network.ts +40 -13
  197. package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -16
  198. package/src/p2p/shared.ts +329 -0
  199. package/src/shared/cross_chain_test_harness.ts +22 -13
  200. package/src/shared/gas_portal_test_harness.ts +13 -5
  201. package/src/shared/submit-transactions.ts +13 -5
  202. package/src/shared/timing_env.d.mts +39 -0
  203. package/src/shared/timing_env.mjs +363 -0
  204. package/src/shared/uniswap_l1_l2.ts +1 -8
  205. package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
  206. package/src/simulators/lending_simulator.ts +1 -1
  207. package/src/single-node/README.md +66 -0
  208. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  209. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  210. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
  211. package/src/{e2e_fees → single-node/fees}/fees_test.ts +143 -70
  212. package/src/single-node/l1-reorgs/setup.ts +93 -0
  213. package/src/single-node/partial-proofs/setup.ts +8 -0
  214. package/src/single-node/proving/setup.ts +15 -0
  215. package/src/single-node/recovery/setup.ts +8 -0
  216. package/src/single-node/setup.ts +63 -0
  217. package/src/single-node/single_node_test_context.ts +1058 -0
  218. package/src/spartan/setup_test_wallets.ts +24 -9
  219. package/src/spartan/tx_metrics.ts +26 -0
  220. package/src/test-wallet/test_wallet.ts +60 -10
  221. package/src/test-wallet/utils.ts +102 -5
  222. package/src/test-wallet/wallet_worker_script.ts +6 -3
  223. package/src/test-wallet/worker_wallet.ts +10 -12
  224. package/src/test-wallet/worker_wallet_schema.ts +3 -2
  225. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
  226. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  227. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -58
  228. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  229. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -161
  230. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  231. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  232. package/dest/e2e_deploy_contract/deploy_test.js +0 -51
  233. package/dest/e2e_epochs/epochs_test.d.ts +0 -125
  234. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  235. package/dest/e2e_epochs/epochs_test.js +0 -460
  236. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  237. package/dest/e2e_fees/fees_test.d.ts +0 -91
  238. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  239. package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
  240. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  241. package/dest/e2e_l1_publisher/write_json.js +0 -56
  242. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  243. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  244. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  245. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  246. package/dest/e2e_nested_contract/nested_contract_test.js +0 -55
  247. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  248. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  249. package/dest/e2e_p2p/inactivity_slash_test.js +0 -137
  250. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  251. package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
  252. package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
  253. package/dest/e2e_p2p/shared.d.ts +0 -75
  254. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  255. package/dest/e2e_p2p/shared.js +0 -217
  256. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
  257. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
  258. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
  259. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
  260. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  261. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -231
  262. package/src/e2e_deploy_contract/deploy_test.ts +0 -86
  263. package/src/e2e_epochs/epochs_test.ts +0 -575
  264. package/src/e2e_l1_publisher/write_json.ts +0 -77
  265. package/src/e2e_nested_contract/nested_contract_test.ts +0 -77
  266. package/src/e2e_p2p/inactivity_slash_test.ts +0 -180
  267. package/src/e2e_p2p/shared.ts +0 -332
  268. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
  269. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
  270. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  271. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
  272. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
  273. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
  274. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -1,23 +1,13 @@
1
- import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
1
  import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
3
- import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
4
- import { NO_FROM } from '@aztec/aztec.js/account';
2
+ import { type AztecNodeConfig, AztecNodeService, createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
3
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
6
- import {
7
- BatchCall,
8
- type ContractFunctionInteraction,
9
- type ContractMethod,
10
- type DeployOptions,
11
- type InteractionWaitOptions,
12
- getContractClassFromArtifact,
13
- waitForProven,
14
- } from '@aztec/aztec.js/contracts';
4
+ import type { ContractMethod } from '@aztec/aztec.js/contracts';
15
5
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
16
6
  import { Fr } from '@aztec/aztec.js/fields';
17
7
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
18
8
  import type { AztecNode } from '@aztec/aztec.js/node';
19
9
  import type { Wallet } from '@aztec/aztec.js/wallet';
20
- import { AnvilTestWatcher, type AnvilTestWatcherOpts, CheatCodes } from '@aztec/aztec/testing';
10
+ import { CheatCodes } from '@aztec/aztec/testing';
21
11
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
22
12
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
23
13
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -32,22 +22,22 @@ import {
32
22
  deployAztecL1Contracts,
33
23
  } from '@aztec/ethereum/deploy-aztec-l1-contracts';
34
24
  import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
35
- import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
25
+ import { EthCheatCodes, EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
36
26
  import type { Anvil } from '@aztec/ethereum/test';
27
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
37
28
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
38
29
  import { SecretValue } from '@aztec/foundation/config';
39
30
  import { randomBytes } from '@aztec/foundation/crypto/random';
40
31
  import { tryRmDir } from '@aztec/foundation/fs';
41
32
  import { withLoggerBindings } from '@aztec/foundation/log/server';
42
33
  import { retryUntil } from '@aztec/foundation/retry';
43
- import { sleep } from '@aztec/foundation/sleep';
44
34
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
45
35
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
46
36
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
47
37
  import type { P2PClientDeps } from '@aztec/p2p';
48
38
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
49
39
  import { protocolContractsHash } from '@aztec/protocol-contracts';
50
- import type { ProverNodeConfig } from '@aztec/prover-node';
40
+ import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
51
41
  import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
52
42
  import type { SequencerClient } from '@aztec/sequencer-client';
53
43
  import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
@@ -66,7 +56,7 @@ import {
66
56
  initTelemetryClient,
67
57
  } from '@aztec/telemetry-client';
68
58
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
69
- import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
59
+ import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
70
60
  import { getGenesisValues } from '@aztec/world-state/testing';
71
61
 
72
62
  import fs from 'fs/promises';
@@ -87,6 +77,8 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
87
77
  import { getACVMConfig } from './get_acvm_config.js';
88
78
  import { getBBConfig } from './get_bb_config.js';
89
79
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
80
+ import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
81
+ import { testSpan } from './timing.js';
90
82
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
91
83
 
92
84
  export { startAnvil };
@@ -119,6 +111,8 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
119
111
  /**
120
112
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
121
113
  * @param aztecNode - An instance of Aztec Node.
114
+ * @param nodeDebug - The node's debug API, used to register public function signatures for named traces; pass
115
+ * `undefined` when the node does not expose it.
122
116
  * @param opts - Partial configuration for the PXE.
123
117
  * @param logger - The logger to be used.
124
118
  * @param actor - Actor label to include in log output (e.g., 'pxe-test').
@@ -126,6 +120,7 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
126
120
  */
127
121
  export async function setupPXEAndGetWallet(
128
122
  aztecNode: AztecNode,
123
+ nodeDebug: AztecNodeDebug | undefined,
129
124
  opts: Partial<PXEConfig> = {},
130
125
  logger = getLogger(),
131
126
  actor?: string,
@@ -146,7 +141,10 @@ export async function setupPXEAndGetWallet(
146
141
 
147
142
  const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
148
143
 
149
- const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
144
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, {
145
+ loggerActorLabel: actor,
146
+ nodeDebug,
147
+ });
150
148
 
151
149
  return {
152
150
  wallet,
@@ -156,7 +154,7 @@ export async function setupPXEAndGetWallet(
156
154
  }
157
155
 
158
156
  /** Options for the e2e tests setup */
159
- export type SetupOptions = {
157
+ export type SetupOptions<TDeployExtraL1ContractsReturnType = unknown> = {
160
158
  /** State load */
161
159
  stateLoad?: string;
162
160
  /** Whether to enable metrics collection, if undefined, metrics collection is disabled */
@@ -165,10 +163,11 @@ export type SetupOptions = {
165
163
  deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
166
164
  /** Initial fee juice for default accounts */
167
165
  initialAccountFeeJuice?: Fr;
168
- /** Number of initial accounts funded with fee juice */
169
- numberOfInitialFundedAccounts?: number;
170
- /** Data of the initial funded accounts */
171
- initialFundedAccounts?: InitialAccountData[];
166
+ /**
167
+ * Extra accounts to fund at genesis beyond the `numberOfAccounts` initializerless accounts that setup
168
+ * creates. Setup funds these but does NOT create or deploy them — the test creates/deploys them itself
169
+ */
170
+ additionallyFundedAccounts?: InitialAccountData[];
172
171
  /** An initial set of validators */
173
172
  initialValidators?: (Operator & { privateKey: `0x${string}` })[];
174
173
  /** Anvil Start time */
@@ -187,11 +186,26 @@ export type SetupOptions = {
187
186
  mockGossipSubNetwork?: boolean;
188
187
  /** Whether to add simulated latency to the mock gossipsub network (in ms) */
189
188
  mockGossipSubNetworkLatency?: number;
190
- /** Whether to disable the anvil test watcher (can still be manually started) */
191
- disableAnvilTestWatcher?: boolean;
192
- anvilTestWatcherOpts?: AnvilTestWatcherOpts;
193
- /** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
189
+ /**
190
+ * Whether to mine the L1 setup txs (Multicall3 + rollup contract deployment) under anvil automine
191
+ * instead of waiting on the block interval. Defaults to `true` (set in `setupInner`); only suites
192
+ * that assert on genesis-relative L1 timing need to opt out with `false`.
193
+ */
194
194
  automineL1Setup?: boolean;
195
+ /**
196
+ * Hook invoked after the Aztec L1 rollup contracts are deployed but BEFORE the node/sequencer
197
+ * start, while anvil automine is still enabled (when `automineL1Setup` is true, the default).
198
+ * Deploy extra L1 contracts a test needs here (e.g. a cross-chain token portal + ERC20) so they
199
+ * mine instantly under automine instead of paying the L1 block interval once the node is running
200
+ * (and racing the live sequencer/archiver). The resolved value is exposed on the returned context
201
+ * as `extraL1DeployResult`. The hook receives setup's L1 deployer client (the same one used to
202
+ * deploy Multicall3).
203
+ */
204
+ deployExtraL1Contracts?: (deps: {
205
+ l1Client: ExtendedViemWalletClient;
206
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
207
+ logger: Logger;
208
+ }) => Promise<TDeployExtraL1ContractsReturnType>;
195
209
  /** How many accounts to seed and unlock in anvil. */
196
210
  anvilAccounts?: number;
197
211
  /** Port to start anvil (defaults to 8545) */
@@ -207,8 +221,14 @@ export type SetupOptions = {
207
221
  zkPassportArgs?: ZKPassportArgs;
208
222
  /** Whether to fund the sponsored FPC in genesis (defaults to false). */
209
223
  fundSponsoredFPC?: boolean;
210
- /** Whether to skip deploying accounts during setup (legacy behavior for tests using deployAccounts helper). */
211
- skipAccountDeployment?: boolean;
224
+ /**
225
+ * Compute extra addresses to fund at genesis from the accounts setup just generated (passed as the
226
+ * argument). Runs after the default accounts are created and before genesis values are computed, so a
227
+ * test can genesis-fund a contract whose address derives from a default account (e.g. an FPC whose
228
+ * admin is the first account) instead of bridging fee juice to it during setup. Each returned address
229
+ * is funded with the same fee juice as an initial account and included in the L1 portal `fundingNeeded`.
230
+ */
231
+ computeExtraGenesisFundedAddresses?: (defaultAccounts: InitialAccountData[]) => Promise<AztecAddress[]>;
212
232
  /** L1 contracts deployment arguments. */
213
233
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
214
234
  /** Wallet minimum fee padding multiplier */
@@ -224,7 +244,7 @@ export type SetupOptions = {
224
244
  } & Partial<AztecNodeConfig>;
225
245
 
226
246
  /** Context for an end-to-end test as returned by the `setup` function */
227
- export type EndToEndContext = {
247
+ export type EndToEndContext<TDeployExtraL1ContractsReturnType = unknown> = {
228
248
  /** The Anvil instance (only set if anvil was started locally). */
229
249
  anvil: Anvil | undefined;
230
250
  /** The Aztec Node service or client a connected to it. */
@@ -243,8 +263,8 @@ export type EndToEndContext = {
243
263
  config: AztecNodeConfig;
244
264
  /** The Aztec Node configuration (alias for config for backward compatibility). */
245
265
  aztecNodeConfig: AztecNodeConfig;
246
- /** The data for the initial funded accounts. */
247
- initialFundedAccounts: InitialAccountData[];
266
+ /** Data for the extra accounts funded at genesis but not created by setup (the test creates/deploys them). */
267
+ additionallyFundedAccounts: InitialAccountData[];
248
268
  /** The wallet to be used. */
249
269
  wallet: TestWallet;
250
270
  /** The wallets to be used. */
@@ -255,8 +275,6 @@ export type EndToEndContext = {
255
275
  cheatCodes: CheatCodes;
256
276
  /** The cheat codes for L1 */
257
277
  ethCheatCodes: EthCheatCodes;
258
- /** The anvil test watcher. */
259
- watcher: AnvilTestWatcher;
260
278
  /** Allows tweaking current system time, used by the epoch cache only. */
261
279
  dateProvider: TestDateProvider;
262
280
  /** Telemetry client */
@@ -269,6 +287,8 @@ export type EndToEndContext = {
269
287
  proverDelayer: Delayer | undefined;
270
288
  /** Genesis data used for setting up nodes. */
271
289
  genesis: GenesisData | undefined;
290
+ /** Resolved value of the `deployExtraL1Contracts` setup hook, if one was provided. */
291
+ extraL1DeployResult: TDeployExtraL1ContractsReturnType;
272
292
  /** ACVM config (only set if running locally). */
273
293
  acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
274
294
  /** BB config (only set if running locally). */
@@ -311,17 +331,43 @@ function assertContractArtifactsVersion() {
311
331
  * @param opts - Options to pass to the node initialization and to the setup script.
312
332
  * @param pxeOpts - Options to pass to the PXE initialization.
313
333
  */
314
- export async function setup(
334
+ export function setup<TDeployExtraL1ContractsReturnType = unknown>(
315
335
  numberOfAccounts = 1,
316
- opts: SetupOptions = {},
336
+ opts: SetupOptions<TDeployExtraL1ContractsReturnType> = {},
317
337
  pxeOpts: Partial<PXEConfig> = {},
318
338
  chain: Chain = foundry,
319
- ): Promise<EndToEndContext> {
339
+ ): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
340
+ // Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
341
+ // swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
342
+ // (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
343
+ const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
344
+ return testSpan(`setup:env:${proverMode}`, async () => {
345
+ const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
346
+ if (process.env.EXIT_E2E_AFTER_SETUP) {
347
+ ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
348
+ throw new Error('EXIT_E2E_AFTER_SETUP');
349
+ }
350
+ return ctx;
351
+ });
352
+ }
353
+
354
+ async function setupInner<TDeployExtraL1ContractsReturnType = unknown>(
355
+ numberOfAccounts: number,
356
+ opts: SetupOptions<TDeployExtraL1ContractsReturnType>,
357
+ pxeOpts: Partial<PXEConfig>,
358
+ chain: Chain,
359
+ ): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
320
360
  assertContractArtifactsVersion();
361
+ const logger = getLogger();
321
362
  let anvil: Anvil | undefined;
322
363
  try {
323
364
  opts.aztecTargetCommitteeSize ??= 0;
324
365
  opts.slasherEnabled ??= false;
366
+ // Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
367
+ // waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
368
+ // assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
369
+ opts.automineL1Setup ??= true;
370
+ logger.trace('Starting e2e test setup');
325
371
 
326
372
  const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
327
373
  // use initialValidators for the node config
@@ -331,16 +377,12 @@ export async function setup(
331
377
  config.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
332
378
  // For tests we only want proving enabled if specifically requested
333
379
  config.realProofs = !!opts.realProofs;
334
- // Only enforce the time table if requested
335
- config.enforceTimeTable = !!opts.enforceTimeTable;
336
380
  // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
337
381
  config.enableDelayer = true;
338
382
  config.listenAddress = '127.0.0.1';
339
383
 
340
384
  config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
341
385
 
342
- const logger = getLogger();
343
-
344
386
  // Create a temp directory for any services that need it and cleanup later
345
387
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
346
388
  await fs.mkdir(directoryToCleanup, { recursive: true });
@@ -354,16 +396,19 @@ export async function setup(
354
396
  if (!isAnvilTestChain(chain.id)) {
355
397
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
356
398
  }
357
- const res = await startAnvil({
358
- l1BlockTime: opts.ethereumSlotDuration,
359
- accounts: opts.anvilAccounts,
360
- port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
361
- slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
362
- dateProvider,
363
- });
399
+ const res = await testSpan('setup:env:anvil', () =>
400
+ startAnvil({
401
+ l1BlockTime: opts.ethereumSlotDuration,
402
+ accounts: opts.anvilAccounts,
403
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
404
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
405
+ dateProvider,
406
+ }),
407
+ );
364
408
  anvil = res.anvil;
365
409
  config.l1RpcUrls = [res.rpcUrl];
366
410
  }
411
+ logger.trace('Started anvil and L1 RPC client');
367
412
 
368
413
  // Enable logging metrics to a local file named after the test suite
369
414
  if (isMetricsLoggingRequested()) {
@@ -380,6 +425,7 @@ export async function setup(
380
425
  if (opts.l1StartTime) {
381
426
  await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
382
427
  }
428
+ logger.trace('Initialized L1 cheat codes and applied state/time overrides');
383
429
 
384
430
  let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
385
431
  let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
@@ -407,12 +453,14 @@ export async function setup(
407
453
  if (config.coinbase === undefined) {
408
454
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
409
455
  }
456
+ logger.trace('Resolved L1 publisher account');
410
457
 
411
- // Determine which addresses to fund in genesis
412
- const initialFundedAccounts =
413
- opts.initialFundedAccounts ??
414
- (await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10)));
415
- const addressesToFund = initialFundedAccounts.map(a => a.address);
458
+ // The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
459
+ // funded at genesis so they are immediately usable.
460
+ const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
461
+ // Extra accounts the test wants funded at genesis but will create/deploy itself.
462
+ const additionallyFundedAccounts = opts.additionallyFundedAccounts ?? [];
463
+ const addressesToFund = [...defaultAccounts, ...additionallyFundedAccounts].map(a => a.address);
416
464
 
417
465
  // Optionally fund the sponsored FPC
418
466
  if (opts.fundSponsoredFPC) {
@@ -420,13 +468,29 @@ export async function setup(
420
468
  addressesToFund.push(sponsoredFPCAddress);
421
469
  }
422
470
 
471
+ // Fund any extra addresses whose value depends on the just-generated accounts (e.g. an FPC admin'd
472
+ // by a default account), so a test can genesis-fund them instead of bridging fee juice during setup.
473
+ if (opts.computeExtraGenesisFundedAddresses) {
474
+ addressesToFund.push(...(await opts.computeExtraGenesisFundedAddresses(defaultAccounts)));
475
+ }
476
+ logger.trace('Generated test accounts to fund at genesis');
477
+
478
+ // Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) so their `ensure*Published` setup
479
+ // helpers short-circuit their publish txs. The archiver flag seeds the bytecode/instance into every spawned node's
480
+ // contract store; the genesis nullifiers make the AVM's deployment-nullifier check pass when they are called. Both
481
+ // must go together (flag alone would recreate the publish-collision bug), so the flag lives here beside the seeding.
482
+ config.testPreloadStandardContracts = true;
483
+ const standardContractNullifiers = await getStandardContractGenesisNullifiers();
484
+
423
485
  const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
424
486
  const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
425
487
  addressesToFund,
426
488
  opts.initialAccountFeeJuice,
427
489
  opts.genesisPublicData,
428
490
  genesisTimestamp,
491
+ standardContractNullifiers,
429
492
  );
493
+ logger.trace('Computed genesis values');
430
494
 
431
495
  const wasAutomining = await ethCheatCodes.isAutoMining();
432
496
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
@@ -436,18 +500,21 @@ export async function setup(
436
500
 
437
501
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
438
502
 
503
+ // Warm both KZG trusted setups (ours + anvil's) in parallel
504
+ if (anvil && isAnvilTestChain(chain.id)) {
505
+ await warmBlobKzg(l1Client, logger);
506
+ }
507
+
439
508
  // Deploy Multicall3 if running locally
440
509
  await deployMulticall3(l1Client, logger);
441
510
 
442
511
  // Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
443
512
  // This is necessary because deployMulticall3 sends multiple transactions and viem may cache a stale nonce
444
513
  await l1Client.getTransactionCount({ address: l1Client.account.address });
514
+ logger.trace('Deployed Multicall3');
445
515
 
446
- const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await deployAztecL1Contracts(
447
- config.l1RpcUrls[0],
448
- publisherPrivKeyHex!,
449
- chain.id,
450
- {
516
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await testSpan('setup:env:l1-deploy', () =>
517
+ deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex!, chain.id, {
451
518
  ...getL1ContractsConfigEnvVars(),
452
519
  ...opts,
453
520
  ...opts.l1ContractsArgs,
@@ -457,7 +524,7 @@ export async function setup(
457
524
  initialValidators: opts.initialValidators,
458
525
  feeJuicePortalInitialBalance: fundingNeeded,
459
526
  realVerifier: false,
460
- },
527
+ }),
461
528
  );
462
529
 
463
530
  Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
@@ -481,14 +548,28 @@ export async function setup(
481
548
  }
482
549
  }
483
550
 
551
+ // Deploy any test-specific L1 contracts while automine is still on and before the node starts,
552
+ // so they mine instantly rather than paying the L1 block interval once the sequencer is live.
553
+ let extraL1DeployResult: TDeployExtraL1ContractsReturnType = undefined as TDeployExtraL1ContractsReturnType;
554
+ if (opts.deployExtraL1Contracts) {
555
+ logger.trace('Running deployExtraL1Contracts hook');
556
+ extraL1DeployResult = await opts.deployExtraL1Contracts({
557
+ l1Client,
558
+ deployL1ContractsValues,
559
+ logger,
560
+ });
561
+ // The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
562
+ // stale cached nonce for later transactions on the publisher account.
563
+ await l1Client.getTransactionCount({ address: l1Client.account.address });
564
+ }
565
+
484
566
  if (enableAutomine) {
485
- await ethCheatCodes.setAutomine(false);
486
- await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
567
+ await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
487
568
  }
488
569
 
489
570
  // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
490
- // ahead of system time due to the local-network watcher warping time forward on each filled slot.
491
- // When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
571
+ // ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
572
+ // the stdout listener.
492
573
  if (!anvil) {
493
574
  dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
494
575
  }
@@ -496,38 +577,34 @@ export async function setup(
496
577
  if (opts.l2StartTime) {
497
578
  await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
498
579
  }
580
+ logger.trace('Deployed L1 rollup contracts');
581
+
582
+ // These boot steps are independent and write disjoint config keys, so run them concurrently:
583
+ // telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
584
+ // and the ACVM/BB config resolvers write their own acvm*/bb* keys.
585
+ const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
586
+ // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
587
+ opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
588
+ setupSharedBlobStorage(config),
589
+ getACVMConfig(logger),
590
+ getBBConfig(logger),
591
+ ]);
592
+ logger.trace('Created telemetry client');
593
+ logger.trace('Set up shared blob storage');
499
594
 
500
- const watcher = new AnvilTestWatcher(
501
- new EthCheatCodesWithState(config.l1RpcUrls, dateProvider),
502
- deployL1ContractsValues.l1ContractAddresses.rollupAddress,
503
- deployL1ContractsValues.l1Client,
504
- dateProvider,
505
- opts.anvilTestWatcherOpts,
506
- );
507
- if (!opts.disableAnvilTestWatcher) {
508
- await watcher.start();
509
- }
510
-
511
- // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
512
- const telemetryClient = opts.metricsPort
513
- ? await getEndToEndTestTelemetryClient(opts.metricsPort)
514
- : await getTelemetryClient(opts.telemetryConfig);
515
-
516
- await setupSharedBlobStorage(config);
517
-
518
- logger.verbose('Creating and synching an aztec node', config);
519
-
520
- const acvmConfig = await getACVMConfig(logger);
521
595
  if (acvmConfig) {
522
596
  config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
523
597
  config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
524
598
  }
599
+ logger.trace('Resolved ACVM config');
525
600
 
526
- const bbConfig = await getBBConfig(logger);
527
601
  if (bbConfig) {
528
602
  config.bbBinaryPath = bbConfig.bbBinaryPath;
529
603
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
530
604
  }
605
+ logger.trace('Resolved Barretenberg config');
606
+
607
+ logger.verbose('Creating and synching an aztec node', config);
531
608
 
532
609
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
533
610
  let p2pClientDeps: P2PClientDeps | undefined = undefined;
@@ -537,27 +614,6 @@ export async function setup(
537
614
  p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
538
615
  }
539
616
 
540
- // Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
541
- // To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
542
- // For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
543
- // If no accounts need deployment, we await an empty block to confirm network progression.
544
- const originalMinTxsPerBlock = config.minTxsPerBlock;
545
- if (originalMinTxsPerBlock === undefined) {
546
- throw new Error('minTxsPerBlock is undefined in e2e test setup');
547
- }
548
-
549
- // Whether we're deploying accounts (and therefore need reliable block inclusion past genesis)
550
- const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
551
- // Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
552
- const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
553
- // Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at
554
- // slot N start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on
555
- // alternating slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) for account
556
- // deployment. Automine is unaffected: its runBuild clamps mempool builds to
557
- // Math.max(minTxsPerBlock ?? 1, 1) and still requires minValidTxs: 1.
558
- const accountsDeployMinTxs = 0;
559
- config.minTxsPerBlock = shouldDeployAccounts ? accountsDeployMinTxs : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
560
-
561
617
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
562
618
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
563
619
 
@@ -577,15 +633,19 @@ export async function setup(
577
633
  ...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
578
634
  }
579
635
  : config;
580
-
581
- const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
582
- AztecNodeService.createAndSync(
583
- initialNodeConfig,
584
- { dateProvider, telemetry: telemetryClient, p2pClientDeps },
585
- { genesis, dontStartSequencer: opts.skipInitialSequencer },
636
+ logger.trace('Prepared aztec node config');
637
+
638
+ const aztecNodeService = await testSpan('setup:env:sequencer-start', () =>
639
+ withLoggerBindings({ actor: 'node-0' }, () =>
640
+ createAztecNodeService(
641
+ initialNodeConfig,
642
+ { dateProvider, telemetry: telemetryClient, p2pClientDeps },
643
+ { genesis, dontStartSequencer: opts.skipInitialSequencer },
644
+ ),
586
645
  ),
587
646
  );
588
647
  const sequencerClient = aztecNodeService.getSequencer();
648
+ logger.trace('Created and synced aztec node');
589
649
 
590
650
  let proverNode: AztecNodeService | undefined = undefined;
591
651
  if (opts.startProverNode) {
@@ -599,16 +659,19 @@ export async function setup(
599
659
  rpcTxProviders: [aztecNodeService],
600
660
  };
601
661
 
602
- ({ proverNode } = await createAndSyncProverNode(
603
- proverNodePrivateKeyHex,
604
- config,
605
- {
606
- ...config.proverNodeConfig,
607
- dataDirectory: proverNodeDataDirectory,
608
- },
609
- { dateProvider, p2pClientDeps, telemetry: telemetryClient },
610
- { genesis },
662
+ ({ proverNode } = await testSpan('setup:env:prover-node', () =>
663
+ createAndSyncProverNode(
664
+ proverNodePrivateKeyHex,
665
+ config,
666
+ {
667
+ ...config.proverNodeConfig,
668
+ dataDirectory: proverNodeDataDirectory,
669
+ },
670
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
671
+ { genesis },
672
+ ),
611
673
  ));
674
+ logger.trace('Created prover node');
612
675
  }
613
676
 
614
677
  const sequencerDelayer = sequencerClient?.getDelayer();
@@ -619,21 +682,22 @@ export async function setup(
619
682
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
620
683
  // For tests we only want proving enabled if specifically requested
621
684
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
622
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
623
- loggerActorLabel: 'pxe-0',
624
- ...opts.pxeCreationOptions,
625
- });
685
+ const wallet = await testSpan('setup:env:pxe', () =>
686
+ TestWallet.create(aztecNodeService, pxeConfig, {
687
+ loggerActorLabel: 'pxe-0',
688
+ // In-process node implements the debug API, so register public function signatures for named traces.
689
+ nodeDebug: aztecNodeService,
690
+ ...opts.pxeCreationOptions,
691
+ }),
692
+ );
626
693
 
627
694
  if (opts.walletMinFeePadding !== undefined) {
628
695
  wallet.setMinFeePadding(opts.walletMinFeePadding);
629
696
  }
697
+ logger.trace('Created PXE and test wallet');
630
698
 
631
- const cheatCodes = await CheatCodes.create(
632
- config.l1RpcUrls,
633
- aztecNodeService,
634
- dateProvider,
635
- aztecNodeService.getAutomineSequencer(),
636
- );
699
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
700
+ logger.trace('Created cheat codes');
637
701
 
638
702
  if (
639
703
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
@@ -647,71 +711,48 @@ export async function setup(
647
711
  );
648
712
  await cheatCodes.rollup.setupEpoch();
649
713
  await cheatCodes.rollup.debugRollup();
714
+ logger.trace('Advanced chain to set up validator committee');
650
715
  }
651
716
 
652
717
  let accounts: AztecAddress[] = [];
653
718
 
654
- if (opts.skipInitialSequencer) {
655
- logger.info('Sequencer not started on initial node, skipping block progression');
656
- } else if (shouldDeployAccounts) {
657
- logger.info(
658
- `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by waiting for the accounts to be deployed`,
659
- );
660
- const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
661
- const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
662
- accounts = accountManagers.map(accountManager => accountManager.address);
663
- } else if (needsEmptyBlock) {
664
- logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
665
- // AutomineSequencer only builds on tx arrival; explicitly request an empty block.
666
- const automine = aztecNodeService.getAutomineSequencer();
667
- if (automine) {
668
- await automine.buildEmptyBlock();
669
- }
670
- while ((await aztecNodeService.getBlockNumber()) === 0) {
671
- await sleep(2000);
672
- }
673
- }
674
- // If skipAccountDeployment is true, we don't deploy or wait - tests will handle account deployment later
675
-
676
- // Now we restore the original minTxsPerBlock setting if we changed it.
677
- if (sequencerClient && config.minTxsPerBlock !== originalMinTxsPerBlock) {
678
- sequencerClient.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
719
+ // Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
720
+ // + a simulated store call) with no on-chain tx, independent of the sequencer.
721
+ if (numberOfAccounts > 0) {
722
+ logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
723
+ await testSpan('wallet:create', () => createFundedInitializerlessAccounts(wallet, defaultAccounts));
724
+ accounts = defaultAccounts.map(a => a.address);
679
725
  }
726
+ logger.trace('Created funded test accounts');
680
727
 
681
- if (initialFundedAccounts.length < numberOfAccounts) {
682
- throw new Error(
683
- `Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`,
684
- );
685
- }
728
+ const teardown = () =>
729
+ testSpan('teardown:env', async () => {
730
+ try {
731
+ await tryStop(wallet, logger);
732
+ await tryStop(aztecNodeService, logger);
733
+ await tryStop(proverNode, logger);
686
734
 
687
- const teardown = async () => {
688
- try {
689
- await tryStop(wallet, logger);
690
- await tryStop(aztecNodeService, logger);
691
- await tryStop(proverNode, logger);
735
+ if (acvmConfig?.cleanup) {
736
+ await acvmConfig.cleanup();
737
+ }
692
738
 
693
- if (acvmConfig?.cleanup) {
694
- await acvmConfig.cleanup();
695
- }
739
+ if (bbConfig?.cleanup) {
740
+ await bbConfig.cleanup();
741
+ }
696
742
 
697
- if (bbConfig?.cleanup) {
698
- await bbConfig.cleanup();
699
- }
700
-
701
- await tryStop(watcher, logger);
702
- await tryStop(anvil, logger);
743
+ await tryStop(anvil, logger);
703
744
 
704
- await tryRmDir(directoryToCleanup, logger);
705
- } catch (err) {
706
- logger.error(`Error during e2e test teardown`, err);
707
- } finally {
708
- try {
709
- await telemetryClient.stop();
745
+ await tryRmDir(directoryToCleanup, logger);
710
746
  } catch (err) {
711
- logger.error(`Error during telemetry client stop`, err);
747
+ logger.error(`Error during e2e test teardown`, err);
748
+ } finally {
749
+ try {
750
+ await telemetryClient.stop();
751
+ } catch (err) {
752
+ logger.error(`Error during telemetry client stop`, err);
753
+ }
712
754
  }
713
- }
714
- };
755
+ });
715
756
 
716
757
  return {
717
758
  anvil,
@@ -724,10 +765,11 @@ export async function setup(
724
765
  aztecNodeConfig: config,
725
766
  dateProvider,
726
767
  deployL1ContractsValues,
727
- initialFundedAccounts,
768
+ additionallyFundedAccounts,
728
769
  logger,
729
770
  mockGossipSubNetwork,
730
771
  genesis,
772
+ extraL1DeployResult,
731
773
  proverNode,
732
774
  sequencerDelayer,
733
775
  proverDelayer,
@@ -736,7 +778,6 @@ export async function setup(
736
778
  telemetryClient,
737
779
  wallet,
738
780
  accounts,
739
- watcher,
740
781
  acvmConfig,
741
782
  bbConfig,
742
783
  directoryToCleanup,
@@ -803,7 +844,12 @@ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
803
844
  await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
804
845
  }
805
846
 
806
- export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNumber, timeoutSec = 60, intervalSec = 1) {
847
+ export async function waitForProvenChain(
848
+ node: AztecNode,
849
+ targetBlock?: BlockNumber,
850
+ timeoutSec = 60,
851
+ intervalSec = 0.25,
852
+ ) {
807
853
  targetBlock ??= await node.getBlockNumber();
808
854
 
809
855
  await retryUntil(
@@ -826,11 +872,12 @@ export function createAndSyncProverNode(
826
872
  telemetry?: TelemetryClient;
827
873
  dateProvider: DateProvider;
828
874
  p2pClientDeps?: P2PClientDeps;
875
+ proverNodeDeps?: Partial<ProverNodeDeps>;
829
876
  },
830
877
  options: { genesis?: GenesisData; dontStart?: boolean },
831
878
  ): Promise<{ proverNode: AztecNodeService }> {
832
879
  return withLoggerBindings({ actor: 'prover-0' }, async () => {
833
- const proverNode = await AztecNodeService.createAndSync(
880
+ const proverNode = await createAztecNodeService(
834
881
  {
835
882
  ...baseConfig,
836
883
  ...configOverrides,
@@ -905,14 +952,16 @@ export async function expectMappingDelta<K, V extends number | bigint>(
905
952
  * surface as generic "Assertion failed:" and tests that match on the real message fail).
906
953
  */
907
954
  export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
908
- const { instance, contractClass } = await getStandardAuthRegistry();
909
- if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
910
- await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
911
- }
912
- if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
913
- await publishInstance(wallet, instance).send({ from });
914
- }
915
- await wallet.registerContract(instance, AuthRegistryArtifact);
955
+ await testSpan('setup:auth-registry', async () => {
956
+ const { instance, contractClass } = await getStandardAuthRegistry();
957
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
958
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
959
+ }
960
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
961
+ await publishInstance(wallet, instance).send({ from });
962
+ }
963
+ await wallet.registerContract(instance, AuthRegistryArtifact);
964
+ });
916
965
  }
917
966
 
918
967
  /**
@@ -948,100 +997,6 @@ export async function ensureHandshakeRegistryPublished(wallet: Wallet, from: Azt
948
997
  await wallet.registerContract(instance, HandshakeRegistryArtifact);
949
998
  }
950
999
 
951
- /**
952
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
953
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
954
- */
955
- export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
956
- const accountsAndAddresses = await Promise.all(
957
- accountsToDeploy.map(async address => {
958
- return {
959
- address,
960
- deployed: (await wallet.getContractMetadata(address)).isContractPublished,
961
- };
962
- }),
963
- );
964
- const instances = (
965
- await Promise.all(
966
- accountsAndAddresses
967
- .filter(({ deployed }) => !deployed)
968
- .map(({ address }) => wallet.getContractMetadata(address)),
969
- )
970
- ).map(contractMetadata => contractMetadata.instance);
971
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
972
- if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
973
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
974
- }
975
- const requests = instances.map(instance => publishInstance(wallet, instance!));
976
- const batch = new BatchCall(wallet, requests);
977
- await batch.send({ from: accountsToDeploy[0] });
978
- }
979
-
980
- /**
981
- * Helper function to deploy accounts.
982
- * Returns deployed account data that can be used by tests.
983
- */
984
- export const deployAccounts =
985
- (numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<InteractionWaitOptions>>) =>
986
- async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
987
- if (initialFundedAccounts.length < numberOfAccounts) {
988
- throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
989
- }
990
-
991
- logger.verbose('Deploying accounts funded with fee juice...');
992
- const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
993
- // Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
994
- for (let i = 0; i < deployedAccounts.length; i++) {
995
- const accountManager = await wallet.createSchnorrAccount(
996
- deployedAccounts[i].secret,
997
- deployedAccounts[i].salt,
998
- deployedAccounts[i].signingKey,
999
- );
1000
- const deployMethod = await accountManager.getDeployMethod();
1001
- await deployMethod.send({
1002
- from: NO_FROM,
1003
- skipClassPublication: i !== 0, // Publish the contract class at most once.
1004
- ...deployOptions,
1005
- });
1006
- }
1007
-
1008
- return { deployedAccounts };
1009
- };
1010
-
1011
- /**
1012
- * Registers the contract class used for test accounts and publicly deploys the instances requested.
1013
- * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
1014
- */
1015
- export async function publicDeployAccounts(
1016
- wallet: Wallet,
1017
- accountsToDeploy: AztecAddress[],
1018
- waitUntilProven = false,
1019
- node?: AztecNode,
1020
- ) {
1021
- const instances = (await Promise.all(accountsToDeploy.map(account => wallet.getContractMetadata(account)))).map(
1022
- metadata => metadata.instance,
1023
- );
1024
-
1025
- const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
1026
- const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
1027
-
1028
- const calls: ContractFunctionInteraction[] = await Promise.all([
1029
- ...(!alreadyRegistered ? [publishContractClass(wallet, SchnorrAccountContractArtifact)] : []),
1030
- ...instances.map(instance => publishInstance(wallet, instance!)),
1031
- ]);
1032
-
1033
- const batch = new BatchCall(wallet, calls);
1034
-
1035
- const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
1036
- if (waitUntilProven) {
1037
- if (!node) {
1038
- throw new Error('Need to provide an AztecNode to wait for proven.');
1039
- } else {
1040
- await waitForProven(node, txReceipt);
1041
- }
1042
- }
1043
- }
1044
-
1045
1000
  /**
1046
1001
  * Destroys the current context.
1047
1002
  */