@aztec/end-to-end 0.0.1-commit.993d240 → 0.0.1-commit.9a89641

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