@aztec/end-to-end 5.0.0-rc.1 → 5.0.0

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 (257) 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 +17 -24
  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 -28
  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 +25 -10
  30. package/dest/bench/utils.d.ts +1 -1
  31. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  32. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  33. package/dest/composed/ha/ha_full_setup.js +383 -0
  34. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  35. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  36. package/dest/fixtures/e2e_prover_test.d.ts +10 -7
  37. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  38. package/dest/fixtures/e2e_prover_test.js +33 -14
  39. package/dest/fixtures/fixtures.d.ts +8 -5
  40. package/dest/fixtures/fixtures.d.ts.map +1 -1
  41. package/dest/fixtures/fixtures.js +12 -4
  42. package/dest/fixtures/ha_setup.d.ts +3 -3
  43. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  44. package/dest/fixtures/ha_setup.js +4 -1
  45. package/dest/fixtures/index.d.ts +2 -1
  46. package/dest/fixtures/index.d.ts.map +1 -1
  47. package/dest/fixtures/index.js +1 -0
  48. package/dest/fixtures/setup.d.ts +35 -9
  49. package/dest/fixtures/setup.d.ts.map +1 -1
  50. package/dest/fixtures/setup.js +175 -142
  51. package/dest/fixtures/setup_p2p_test.d.ts +1 -1
  52. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  53. package/dest/fixtures/setup_p2p_test.js +3 -3
  54. package/dest/fixtures/standard_contracts_genesis.d.ts +16 -0
  55. package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
  56. package/dest/fixtures/standard_contracts_genesis.js +25 -0
  57. package/dest/fixtures/timing.d.ts +42 -0
  58. package/dest/fixtures/timing.d.ts.map +1 -0
  59. package/dest/fixtures/timing.js +72 -0
  60. package/dest/fixtures/token_utils.d.ts +22 -4
  61. package/dest/fixtures/token_utils.d.ts.map +1 -1
  62. package/dest/fixtures/token_utils.js +21 -1
  63. package/dest/fixtures/wait_helpers.d.ts +135 -0
  64. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  65. package/dest/fixtures/wait_helpers.js +154 -0
  66. package/dest/forward-compatibility/wallet_service.js +1 -1
  67. package/dest/multi-node/block-production/setup.d.ts +97 -0
  68. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  69. package/dest/multi-node/block-production/setup.js +158 -0
  70. package/dest/multi-node/governance/setup.d.ts +67 -0
  71. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  72. package/dest/multi-node/governance/setup.js +126 -0
  73. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  74. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  75. package/dest/multi-node/multi_node_test_context.js +347 -0
  76. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  77. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  78. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  79. package/dest/multi-node/slashing/setup.d.ts +167 -0
  80. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  81. package/dest/multi-node/slashing/setup.js +275 -0
  82. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +10 -2
  83. package/dest/p2p/p2p_network.d.ts.map +1 -0
  84. package/dest/{e2e_p2p → p2p}/p2p_network.js +36 -9
  85. package/dest/p2p/reqresp/utils.d.ts +19 -0
  86. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  87. package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -15
  88. package/dest/p2p/shared.d.ts +72 -0
  89. package/dest/p2p/shared.d.ts.map +1 -0
  90. package/dest/p2p/shared.js +212 -0
  91. package/dest/shared/cross_chain_test_harness.d.ts +3 -3
  92. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  93. package/dest/shared/cross_chain_test_harness.js +24 -16
  94. package/dest/shared/gas_portal_test_harness.d.ts +1 -1
  95. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  96. package/dest/shared/gas_portal_test_harness.js +8 -5
  97. package/dest/shared/submit-transactions.d.ts +1 -1
  98. package/dest/shared/submit-transactions.d.ts.map +1 -1
  99. package/dest/shared/submit-transactions.js +12 -5
  100. package/dest/shared/timing_env.d.js +5 -0
  101. package/dest/shared/timing_env.js +365 -0
  102. package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
  103. package/dest/simulators/lending_simulator.js +1 -1
  104. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  105. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  106. package/dest/{e2e_cross_chain_messaging → single-node/cross-chain}/cross_chain_messaging_test.js +77 -27
  107. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  108. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  109. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  110. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  111. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  112. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
  113. package/dest/single-node/fees/fees_test.d.ts +95 -0
  114. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  115. package/dest/{e2e_fees → single-node/fees}/fees_test.js +124 -46
  116. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  117. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  118. package/dest/single-node/l1-reorgs/setup.js +57 -0
  119. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  120. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  121. package/dest/single-node/partial-proofs/setup.js +5 -0
  122. package/dest/single-node/proving/setup.d.ts +5 -0
  123. package/dest/single-node/proving/setup.d.ts.map +1 -0
  124. package/dest/single-node/proving/setup.js +5 -0
  125. package/dest/single-node/recovery/setup.d.ts +5 -0
  126. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  127. package/dest/single-node/recovery/setup.js +5 -0
  128. package/dest/single-node/setup.d.ts +49 -0
  129. package/dest/single-node/setup.d.ts.map +1 -0
  130. package/dest/single-node/setup.js +56 -0
  131. package/dest/single-node/single_node_test_context.d.ts +373 -0
  132. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  133. package/dest/single-node/single_node_test_context.js +845 -0
  134. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  135. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  136. package/dest/spartan/setup_test_wallets.js +18 -8
  137. package/dest/spartan/tx_metrics.d.ts +10 -1
  138. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  139. package/dest/spartan/tx_metrics.js +32 -0
  140. package/dest/test-wallet/test_wallet.d.ts +23 -4
  141. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  142. package/dest/test-wallet/test_wallet.js +20 -4
  143. package/dest/test-wallet/utils.d.ts +36 -1
  144. package/dest/test-wallet/utils.d.ts.map +1 -1
  145. package/dest/test-wallet/utils.js +64 -4
  146. package/dest/test-wallet/wallet_worker_script.js +5 -2
  147. package/dest/test-wallet/worker_wallet.d.ts +5 -5
  148. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  149. package/dest/test-wallet/worker_wallet.js +2 -2
  150. package/dest/test-wallet/worker_wallet_schema.js +2 -1
  151. package/package.json +41 -41
  152. package/src/automine/README.md +60 -0
  153. package/src/automine/automine_test_context.ts +153 -0
  154. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  155. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  156. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +19 -39
  157. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -43
  158. package/src/automine/token/token_test_helpers.ts +138 -0
  159. package/src/bench/client_flows/benchmark.ts +3 -1
  160. package/src/bench/client_flows/client_flows_benchmark.ts +39 -12
  161. package/src/composed/ha/ha_full_setup.ts +466 -0
  162. package/src/fixtures/e2e_prover_test.ts +40 -23
  163. package/src/fixtures/fixtures.ts +14 -4
  164. package/src/fixtures/ha_setup.ts +7 -3
  165. package/src/fixtures/index.ts +1 -0
  166. package/src/fixtures/setup.ts +217 -146
  167. package/src/fixtures/setup_p2p_test.ts +3 -3
  168. package/src/fixtures/standard_contracts_genesis.ts +28 -0
  169. package/src/fixtures/timing.ts +97 -0
  170. package/src/fixtures/token_utils.ts +39 -4
  171. package/src/fixtures/wait_helpers.ts +333 -0
  172. package/src/forward-compatibility/wallet_service.ts +2 -2
  173. package/src/guides/up_quick_start.sh +5 -0
  174. package/src/infra/README.md +12 -0
  175. package/src/multi-node/README.md +96 -0
  176. package/src/multi-node/block-production/setup.ts +272 -0
  177. package/src/multi-node/governance/setup.ts +172 -0
  178. package/src/multi-node/multi_node_test_context.ts +447 -0
  179. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  180. package/src/multi-node/slashing/setup.ts +433 -0
  181. package/src/p2p/README.md +78 -0
  182. package/src/{e2e_p2p → p2p}/p2p_network.ts +36 -7
  183. package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -14
  184. package/src/p2p/shared.ts +329 -0
  185. package/src/shared/cross_chain_test_harness.ts +22 -13
  186. package/src/shared/gas_portal_test_harness.ts +13 -5
  187. package/src/shared/submit-transactions.ts +13 -5
  188. package/src/shared/timing_env.d.mts +39 -0
  189. package/src/shared/timing_env.mjs +363 -0
  190. package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
  191. package/src/simulators/lending_simulator.ts +1 -1
  192. package/src/single-node/README.md +66 -0
  193. package/src/{e2e_cross_chain_messaging → single-node/cross-chain}/cross_chain_messaging_test.ts +110 -39
  194. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  195. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
  196. package/src/{e2e_fees → single-node/fees}/fees_test.ts +141 -48
  197. package/src/single-node/l1-reorgs/setup.ts +93 -0
  198. package/src/single-node/partial-proofs/setup.ts +8 -0
  199. package/src/single-node/proving/setup.ts +15 -0
  200. package/src/single-node/recovery/setup.ts +8 -0
  201. package/src/single-node/setup.ts +63 -0
  202. package/src/single-node/single_node_test_context.ts +1054 -0
  203. package/src/spartan/setup_test_wallets.ts +23 -8
  204. package/src/spartan/tx_metrics.ts +26 -0
  205. package/src/test-wallet/test_wallet.ts +28 -6
  206. package/src/test-wallet/utils.ts +102 -5
  207. package/src/test-wallet/wallet_worker_script.ts +6 -3
  208. package/src/test-wallet/worker_wallet.ts +5 -9
  209. package/src/test-wallet/worker_wallet_schema.ts +1 -1
  210. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
  211. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  212. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -58
  213. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  214. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
  215. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  216. package/dest/e2e_deploy_contract/deploy_test.js +0 -42
  217. package/dest/e2e_epochs/epochs_test.d.ts +0 -137
  218. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  219. package/dest/e2e_epochs/epochs_test.js +0 -485
  220. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  221. package/dest/e2e_fees/fees_test.d.ts +0 -89
  222. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  223. package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
  224. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  225. package/dest/e2e_l1_publisher/write_json.js +0 -56
  226. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  227. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  228. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -22
  229. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  230. package/dest/e2e_nested_contract/nested_contract_test.js +0 -40
  231. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  232. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  233. package/dest/e2e_p2p/inactivity_slash_test.js +0 -138
  234. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  235. package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
  236. package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
  237. package/dest/e2e_p2p/shared.d.ts +0 -75
  238. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  239. package/dest/e2e_p2p/shared.js +0 -217
  240. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
  241. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
  242. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
  243. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
  244. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  245. package/src/e2e_deploy_contract/deploy_test.ts +0 -73
  246. package/src/e2e_epochs/epochs_test.ts +0 -596
  247. package/src/e2e_l1_publisher/write_json.ts +0 -77
  248. package/src/e2e_nested_contract/nested_contract_test.ts +0 -51
  249. package/src/e2e_p2p/inactivity_slash_test.ts +0 -181
  250. package/src/e2e_p2p/shared.ts +0 -332
  251. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
  252. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
  253. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  254. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
  255. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
  256. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
  257. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
2
- import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
2
+ import { type AztecNodeConfig, AztecNodeService, createAztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
3
3
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
4
  import type { ContractMethod } from '@aztec/aztec.js/contracts';
5
5
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
@@ -22,15 +22,15 @@ import {
22
22
  deployAztecL1Contracts,
23
23
  } from '@aztec/ethereum/deploy-aztec-l1-contracts';
24
24
  import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
25
- import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
25
+ import { EthCheatCodes, EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
26
26
  import type { Anvil } from '@aztec/ethereum/test';
27
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
27
28
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
28
29
  import { SecretValue } from '@aztec/foundation/config';
29
30
  import { randomBytes } from '@aztec/foundation/crypto/random';
30
31
  import { tryRmDir } from '@aztec/foundation/fs';
31
32
  import { withLoggerBindings } from '@aztec/foundation/log/server';
32
33
  import { retryUntil } from '@aztec/foundation/retry';
33
- import { sleep } from '@aztec/foundation/sleep';
34
34
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
35
35
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
36
36
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
@@ -77,6 +77,8 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
77
77
  import { getACVMConfig } from './get_acvm_config.js';
78
78
  import { getBBConfig } from './get_bb_config.js';
79
79
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
80
+ import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
81
+ import { testSpan } from './timing.js';
80
82
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
81
83
 
82
84
  export { startAnvil };
@@ -109,6 +111,8 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
109
111
  /**
110
112
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
111
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.
112
116
  * @param opts - Partial configuration for the PXE.
113
117
  * @param logger - The logger to be used.
114
118
  * @param actor - Actor label to include in log output (e.g., 'pxe-test').
@@ -116,6 +120,7 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
116
120
  */
117
121
  export async function setupPXEAndGetWallet(
118
122
  aztecNode: AztecNode,
123
+ nodeDebug: AztecNodeDebug | undefined,
119
124
  opts: Partial<PXEConfig> = {},
120
125
  logger = getLogger(),
121
126
  actor?: string,
@@ -136,7 +141,10 @@ export async function setupPXEAndGetWallet(
136
141
 
137
142
  const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
138
143
 
139
- const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
144
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, {
145
+ loggerActorLabel: actor,
146
+ nodeDebug,
147
+ });
140
148
 
141
149
  return {
142
150
  wallet,
@@ -146,7 +154,7 @@ export async function setupPXEAndGetWallet(
146
154
  }
147
155
 
148
156
  /** Options for the e2e tests setup */
149
- export type SetupOptions = {
157
+ export type SetupOptions<TDeployExtraL1ContractsReturnType = unknown> = {
150
158
  /** State load */
151
159
  stateLoad?: string;
152
160
  /** Whether to enable metrics collection, if undefined, metrics collection is disabled */
@@ -178,8 +186,26 @@ export type SetupOptions = {
178
186
  mockGossipSubNetwork?: boolean;
179
187
  /** Whether to add simulated latency to the mock gossipsub network (in ms) */
180
188
  mockGossipSubNetworkLatency?: number;
181
- /** 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
+ */
182
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>;
183
209
  /** How many accounts to seed and unlock in anvil. */
184
210
  anvilAccounts?: number;
185
211
  /** Port to start anvil (defaults to 8545) */
@@ -196,10 +222,13 @@ export type SetupOptions = {
196
222
  /** Whether to fund the sponsored FPC in genesis (defaults to false). */
197
223
  fundSponsoredFPC?: boolean;
198
224
  /**
199
- * Whether to advance the chain past genesis by mining an empty block during setup (defaults to true).
200
- * Set to false for tests that must observe the chain at genesis (block 0).
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`.
201
230
  */
202
- advancePastGenesis?: boolean;
231
+ computeExtraGenesisFundedAddresses?: (defaultAccounts: InitialAccountData[]) => Promise<AztecAddress[]>;
203
232
  /** L1 contracts deployment arguments. */
204
233
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
205
234
  /** Wallet minimum fee padding multiplier */
@@ -215,7 +244,7 @@ export type SetupOptions = {
215
244
  } & Partial<AztecNodeConfig>;
216
245
 
217
246
  /** Context for an end-to-end test as returned by the `setup` function */
218
- export type EndToEndContext = {
247
+ export type EndToEndContext<TDeployExtraL1ContractsReturnType = unknown> = {
219
248
  /** The Anvil instance (only set if anvil was started locally). */
220
249
  anvil: Anvil | undefined;
221
250
  /** The Aztec Node service or client a connected to it. */
@@ -258,6 +287,8 @@ export type EndToEndContext = {
258
287
  proverDelayer: Delayer | undefined;
259
288
  /** Genesis data used for setting up nodes. */
260
289
  genesis: GenesisData | undefined;
290
+ /** Resolved value of the `deployExtraL1Contracts` setup hook, if one was provided. */
291
+ extraL1DeployResult: TDeployExtraL1ContractsReturnType;
261
292
  /** ACVM config (only set if running locally). */
262
293
  acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
263
294
  /** BB config (only set if running locally). */
@@ -300,17 +331,43 @@ function assertContractArtifactsVersion() {
300
331
  * @param opts - Options to pass to the node initialization and to the setup script.
301
332
  * @param pxeOpts - Options to pass to the PXE initialization.
302
333
  */
303
- export async function setup(
334
+ export function setup<TDeployExtraL1ContractsReturnType = unknown>(
304
335
  numberOfAccounts = 1,
305
- opts: SetupOptions = {},
336
+ opts: SetupOptions<TDeployExtraL1ContractsReturnType> = {},
306
337
  pxeOpts: Partial<PXEConfig> = {},
307
338
  chain: Chain = foundry,
308
- ): 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>> {
309
360
  assertContractArtifactsVersion();
361
+ const logger = getLogger();
310
362
  let anvil: Anvil | undefined;
311
363
  try {
312
364
  opts.aztecTargetCommitteeSize ??= 0;
313
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');
314
371
 
315
372
  const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
316
373
  // use initialValidators for the node config
@@ -326,8 +383,6 @@ export async function setup(
326
383
 
327
384
  config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
328
385
 
329
- const logger = getLogger();
330
-
331
386
  // Create a temp directory for any services that need it and cleanup later
332
387
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
333
388
  await fs.mkdir(directoryToCleanup, { recursive: true });
@@ -341,16 +396,19 @@ export async function setup(
341
396
  if (!isAnvilTestChain(chain.id)) {
342
397
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
343
398
  }
344
- const res = await startAnvil({
345
- l1BlockTime: opts.ethereumSlotDuration,
346
- accounts: opts.anvilAccounts,
347
- port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
348
- slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
349
- dateProvider,
350
- });
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
+ );
351
408
  anvil = res.anvil;
352
409
  config.l1RpcUrls = [res.rpcUrl];
353
410
  }
411
+ logger.trace('Started anvil and L1 RPC client');
354
412
 
355
413
  // Enable logging metrics to a local file named after the test suite
356
414
  if (isMetricsLoggingRequested()) {
@@ -367,6 +425,7 @@ export async function setup(
367
425
  if (opts.l1StartTime) {
368
426
  await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
369
427
  }
428
+ logger.trace('Initialized L1 cheat codes and applied state/time overrides');
370
429
 
371
430
  let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
372
431
  let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
@@ -394,6 +453,7 @@ export async function setup(
394
453
  if (config.coinbase === undefined) {
395
454
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
396
455
  }
456
+ logger.trace('Resolved L1 publisher account');
397
457
 
398
458
  // The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
399
459
  // funded at genesis so they are immediately usable.
@@ -408,13 +468,29 @@ export async function setup(
408
468
  addressesToFund.push(sponsoredFPCAddress);
409
469
  }
410
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
+
411
485
  const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
412
486
  const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
413
487
  addressesToFund,
414
488
  opts.initialAccountFeeJuice,
415
489
  opts.genesisPublicData,
416
490
  genesisTimestamp,
491
+ standardContractNullifiers,
417
492
  );
493
+ logger.trace('Computed genesis values');
418
494
 
419
495
  const wasAutomining = await ethCheatCodes.isAutoMining();
420
496
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
@@ -424,18 +500,21 @@ export async function setup(
424
500
 
425
501
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
426
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
+
427
508
  // Deploy Multicall3 if running locally
428
509
  await deployMulticall3(l1Client, logger);
429
510
 
430
511
  // Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
431
512
  // This is necessary because deployMulticall3 sends multiple transactions and viem may cache a stale nonce
432
513
  await l1Client.getTransactionCount({ address: l1Client.account.address });
514
+ logger.trace('Deployed Multicall3');
433
515
 
434
- const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await deployAztecL1Contracts(
435
- config.l1RpcUrls[0],
436
- publisherPrivKeyHex!,
437
- chain.id,
438
- {
516
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await testSpan('setup:env:l1-deploy', () =>
517
+ deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex!, chain.id, {
439
518
  ...getL1ContractsConfigEnvVars(),
440
519
  ...opts,
441
520
  ...opts.l1ContractsArgs,
@@ -445,7 +524,7 @@ export async function setup(
445
524
  initialValidators: opts.initialValidators,
446
525
  feeJuicePortalInitialBalance: fundingNeeded,
447
526
  realVerifier: false,
448
- },
527
+ }),
449
528
  );
450
529
 
451
530
  Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
@@ -469,9 +548,23 @@ export async function setup(
469
548
  }
470
549
  }
471
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
+
472
566
  if (enableAutomine) {
473
- await ethCheatCodes.setAutomine(false);
474
- await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
567
+ await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
475
568
  }
476
569
 
477
570
  // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
@@ -484,27 +577,34 @@ export async function setup(
484
577
  if (opts.l2StartTime) {
485
578
  await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
486
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');
487
594
 
488
- // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
489
- const telemetryClient = opts.metricsPort
490
- ? await getEndToEndTestTelemetryClient(opts.metricsPort)
491
- : await getTelemetryClient(opts.telemetryConfig);
492
-
493
- await setupSharedBlobStorage(config);
494
-
495
- logger.verbose('Creating and synching an aztec node', config);
496
-
497
- const acvmConfig = await getACVMConfig(logger);
498
595
  if (acvmConfig) {
499
596
  config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
500
597
  config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
501
598
  }
599
+ logger.trace('Resolved ACVM config');
502
600
 
503
- const bbConfig = await getBBConfig(logger);
504
601
  if (bbConfig) {
505
602
  config.bbBinaryPath = bbConfig.bbBinaryPath;
506
603
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
507
604
  }
605
+ logger.trace('Resolved Barretenberg config');
606
+
607
+ logger.verbose('Creating and synching an aztec node', config);
508
608
 
509
609
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
510
610
  let p2pClientDeps: P2PClientDeps | undefined = undefined;
@@ -514,27 +614,6 @@ export async function setup(
514
614
  p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
515
615
  }
516
616
 
517
- // Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
518
- // To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
519
- const originalMinTxsPerBlock = config.minTxsPerBlock;
520
- if (originalMinTxsPerBlock === undefined) {
521
- throw new Error('minTxsPerBlock is undefined in e2e test setup');
522
- }
523
- const originalBuildCheckpointIfEmpty = config.buildCheckpointIfEmpty ?? false;
524
-
525
- // Allow an empty checkpoint so the empty block can be built; leave untouched when not advancing.
526
- const advancePastGenesis = (opts.advancePastGenesis ?? true) && !opts.skipInitialSequencer;
527
- config.minTxsPerBlock = advancePastGenesis ? 0 : originalMinTxsPerBlock;
528
- // Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at slot N
529
- // start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on alternating
530
- // slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) while advancing past genesis.
531
- // Automine is unaffected: its runBuild clamps mempool builds to Math.max(minTxsPerBlock ?? 1, 1) and
532
- // still requires minValidTxs: 1.
533
- const shouldTemporarilyBuildEmptyCheckpoints = advancePastGenesis && config.useAutomineSequencer !== true;
534
- if (shouldTemporarilyBuildEmptyCheckpoints) {
535
- config.buildCheckpointIfEmpty = true;
536
- }
537
-
538
617
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
539
618
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
540
619
 
@@ -554,15 +633,19 @@ export async function setup(
554
633
  ...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
555
634
  }
556
635
  : config;
557
-
558
- const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
559
- AztecNodeService.createAndSync(
560
- initialNodeConfig,
561
- { dateProvider, telemetry: telemetryClient, p2pClientDeps },
562
- { 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
+ ),
563
645
  ),
564
646
  );
565
647
  const sequencerClient = aztecNodeService.getSequencer();
648
+ logger.trace('Created and synced aztec node');
566
649
 
567
650
  let proverNode: AztecNodeService | undefined = undefined;
568
651
  if (opts.startProverNode) {
@@ -576,16 +659,19 @@ export async function setup(
576
659
  rpcTxProviders: [aztecNodeService],
577
660
  };
578
661
 
579
- ({ proverNode } = await createAndSyncProverNode(
580
- proverNodePrivateKeyHex,
581
- config,
582
- {
583
- ...config.proverNodeConfig,
584
- dataDirectory: proverNodeDataDirectory,
585
- },
586
- { dateProvider, p2pClientDeps, telemetry: telemetryClient },
587
- { 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
+ ),
588
673
  ));
674
+ logger.trace('Created prover node');
589
675
  }
590
676
 
591
677
  const sequencerDelayer = sequencerClient?.getDelayer();
@@ -596,21 +682,22 @@ export async function setup(
596
682
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
597
683
  // For tests we only want proving enabled if specifically requested
598
684
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
599
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
600
- loggerActorLabel: 'pxe-0',
601
- ...opts.pxeCreationOptions,
602
- });
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
+ );
603
693
 
604
694
  if (opts.walletMinFeePadding !== undefined) {
605
695
  wallet.setMinFeePadding(opts.walletMinFeePadding);
606
696
  }
697
+ logger.trace('Created PXE and test wallet');
607
698
 
608
- const cheatCodes = await CheatCodes.create(
609
- config.l1RpcUrls,
610
- aztecNodeService,
611
- dateProvider,
612
- aztecNodeService.getAutomineSequencer(),
613
- );
699
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
700
+ logger.trace('Created cheat codes');
614
701
 
615
702
  if (
616
703
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
@@ -624,6 +711,7 @@ export async function setup(
624
711
  );
625
712
  await cheatCodes.rollup.setupEpoch();
626
713
  await cheatCodes.rollup.debugRollup();
714
+ logger.trace('Advanced chain to set up validator committee');
627
715
  }
628
716
 
629
717
  let accounts: AztecAddress[] = [];
@@ -632,64 +720,39 @@ export async function setup(
632
720
  // + a simulated store call) with no on-chain tx, independent of the sequencer.
633
721
  if (numberOfAccounts > 0) {
634
722
  logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
635
- await createFundedInitializerlessAccounts(wallet, defaultAccounts);
723
+ await testSpan('wallet:create', () => createFundedInitializerlessAccounts(wallet, defaultAccounts));
636
724
  accounts = defaultAccounts.map(a => a.address);
637
725
  }
726
+ logger.trace('Created funded test accounts');
638
727
 
639
- // Advancing past genesis needs a running sequencer to build the empty block; advancePastGenesis is
640
- // already false when skipInitialSequencer is set.
641
- if (advancePastGenesis) {
642
- logger.info('Mining an empty block to progress past genesis');
643
- const automine = aztecNodeService.getAutomineSequencer();
644
- if (automine) {
645
- await automine.buildEmptyBlock();
646
- }
647
- while ((await aztecNodeService.getBlockNumber()) === 0) {
648
- await sleep(2000);
649
- }
650
- } else if (opts.skipInitialSequencer) {
651
- logger.info('Sequencer not started on initial node, skipping block progression');
652
- }
653
-
654
- // Now we restore the original minTxsPerBlock setting if we changed it.
655
- if (sequencerClient) {
656
- const sequencer = sequencerClient.getSequencer();
657
- if (config.minTxsPerBlock !== originalMinTxsPerBlock) {
658
- sequencer.updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
659
- }
660
- if (shouldTemporarilyBuildEmptyCheckpoints) {
661
- sequencer.updateConfig({ buildCheckpointIfEmpty: originalBuildCheckpointIfEmpty });
662
- config.buildCheckpointIfEmpty = originalBuildCheckpointIfEmpty;
663
- }
664
- }
665
-
666
- const teardown = async () => {
667
- try {
668
- await tryStop(wallet, logger);
669
- await tryStop(aztecNodeService, logger);
670
- await tryStop(proverNode, logger);
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);
671
734
 
672
- if (acvmConfig?.cleanup) {
673
- await acvmConfig.cleanup();
674
- }
735
+ if (acvmConfig?.cleanup) {
736
+ await acvmConfig.cleanup();
737
+ }
675
738
 
676
- if (bbConfig?.cleanup) {
677
- await bbConfig.cleanup();
678
- }
739
+ if (bbConfig?.cleanup) {
740
+ await bbConfig.cleanup();
741
+ }
679
742
 
680
- await tryStop(anvil, logger);
743
+ await tryStop(anvil, logger);
681
744
 
682
- await tryRmDir(directoryToCleanup, logger);
683
- } catch (err) {
684
- logger.error(`Error during e2e test teardown`, err);
685
- } finally {
686
- try {
687
- await telemetryClient.stop();
745
+ await tryRmDir(directoryToCleanup, logger);
688
746
  } catch (err) {
689
- 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
+ }
690
754
  }
691
- }
692
- };
755
+ });
693
756
 
694
757
  return {
695
758
  anvil,
@@ -706,6 +769,7 @@ export async function setup(
706
769
  logger,
707
770
  mockGossipSubNetwork,
708
771
  genesis,
772
+ extraL1DeployResult,
709
773
  proverNode,
710
774
  sequencerDelayer,
711
775
  proverDelayer,
@@ -780,7 +844,12 @@ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
780
844
  await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
781
845
  }
782
846
 
783
- 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
+ ) {
784
853
  targetBlock ??= await node.getBlockNumber();
785
854
 
786
855
  await retryUntil(
@@ -807,7 +876,7 @@ export function createAndSyncProverNode(
807
876
  options: { genesis?: GenesisData; dontStart?: boolean },
808
877
  ): Promise<{ proverNode: AztecNodeService }> {
809
878
  return withLoggerBindings({ actor: 'prover-0' }, async () => {
810
- const proverNode = await AztecNodeService.createAndSync(
879
+ const proverNode = await createAztecNodeService(
811
880
  {
812
881
  ...baseConfig,
813
882
  ...configOverrides,
@@ -882,14 +951,16 @@ export async function expectMappingDelta<K, V extends number | bigint>(
882
951
  * surface as generic "Assertion failed:" and tests that match on the real message fail).
883
952
  */
884
953
  export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
885
- const { instance, contractClass } = await getStandardAuthRegistry();
886
- if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
887
- await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
888
- }
889
- if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
890
- await publishInstance(wallet, instance).send({ from });
891
- }
892
- await wallet.registerContract(instance, AuthRegistryArtifact);
954
+ await testSpan('setup:auth-registry', async () => {
955
+ const { instance, contractClass } = await getStandardAuthRegistry();
956
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
957
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
958
+ }
959
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
960
+ await publishInstance(wallet, instance).send({ from });
961
+ }
962
+ await wallet.registerContract(instance, AuthRegistryArtifact);
963
+ });
893
964
  }
894
965
 
895
966
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Test fixtures and utilities to set up and run a test using multiple validators
3
3
  */
4
- import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
4
+ import { type AztecNodeConfig, AztecNodeService, createAztecNodeService } from '@aztec/aztec-node';
5
5
  import { range } from '@aztec/foundation/array';
6
6
  import { SecretValue } from '@aztec/foundation/config';
7
7
  import { withLoggerBindings } from '@aztec/foundation/log/server';
@@ -109,7 +109,7 @@ export async function createNode(
109
109
  return await withLoggerBindings({ actor: `validator-${actorIndex}` }, async () => {
110
110
  const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
111
111
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
112
- return await AztecNodeService.createAndSync(
112
+ return await createAztecNodeService(
113
113
  validatorConfig,
114
114
  { telemetry, dateProvider },
115
115
  { genesis, dontStartSequencer: config.dontStartSequencer },
@@ -137,7 +137,7 @@ export async function createNonValidatorNode(
137
137
  sequencerPublisherPrivateKeys: [],
138
138
  };
139
139
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
140
- return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { genesis });
140
+ return await createAztecNodeService(config, { telemetry, dateProvider }, { genesis });
141
141
  });
142
142
  }
143
143