@aztec/end-to-end 0.0.1-commit.86469d5 → 0.0.1-commit.8655d4a

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 (226) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/benchmark.d.ts +15 -1
  3. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  4. package/dest/bench/client_flows/benchmark.js +17 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts +3 -3
  6. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  7. package/dest/bench/client_flows/client_flows_benchmark.js +36 -39
  8. package/dest/bench/client_flows/config.d.ts +2 -2
  9. package/dest/bench/client_flows/config.d.ts.map +1 -1
  10. package/dest/bench/client_flows/config.js +18 -0
  11. package/dest/bench/utils.d.ts +1 -1
  12. package/dest/bench/utils.d.ts.map +1 -1
  13. package/dest/bench/utils.js +8 -3
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -5
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +36 -17
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +16 -5
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +42 -9
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -4
  21. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  22. package/dest/e2e_deploy_contract/deploy_test.js +2 -1
  23. package/dest/e2e_epochs/epochs_test.d.ts +33 -8
  24. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  25. package/dest/e2e_epochs/epochs_test.js +143 -44
  26. package/dest/e2e_fees/fees_test.d.ts +6 -3
  27. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  28. package/dest/e2e_fees/fees_test.js +50 -17
  29. package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.js +6 -7
  32. package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  34. package/dest/e2e_p2p/inactivity_slash_test.js +5 -3
  35. package/dest/e2e_p2p/p2p_network.d.ts +14 -12
  36. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  37. package/dest/e2e_p2p/p2p_network.js +70 -34
  38. package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
  39. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
  40. package/dest/e2e_p2p/reqresp/utils.js +67 -14
  41. package/dest/e2e_p2p/shared.d.ts +26 -8
  42. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  43. package/dest/e2e_p2p/shared.js +78 -51
  44. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  45. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  46. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  47. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  48. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  49. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  50. package/dest/e2e_token_contract/token_contract_test.d.ts +6 -4
  51. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  52. package/dest/e2e_token_contract/token_contract_test.js +23 -11
  53. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  54. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  55. package/dest/fixtures/authwit_proxy.js +34 -0
  56. package/dest/fixtures/e2e_prover_test.d.ts +9 -8
  57. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  58. package/dest/fixtures/e2e_prover_test.js +39 -50
  59. package/dest/fixtures/elu_monitor.d.ts +21 -0
  60. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  61. package/dest/fixtures/elu_monitor.js +102 -0
  62. package/dest/fixtures/fixtures.d.ts +77 -1
  63. package/dest/fixtures/fixtures.d.ts.map +1 -1
  64. package/dest/fixtures/fixtures.js +74 -0
  65. package/dest/fixtures/get_bb_config.d.ts +1 -1
  66. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  67. package/dest/fixtures/get_bb_config.js +5 -5
  68. package/dest/fixtures/ha_setup.d.ts +2 -2
  69. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  70. package/dest/fixtures/ha_setup.js +4 -2
  71. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  72. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  73. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  74. package/dest/fixtures/setup.d.ts +80 -32
  75. package/dest/fixtures/setup.d.ts.map +1 -1
  76. package/dest/fixtures/setup.js +186 -167
  77. package/dest/fixtures/setup_p2p_test.d.ts +22 -10
  78. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  79. package/dest/fixtures/setup_p2p_test.js +23 -17
  80. package/dest/fixtures/token_utils.d.ts +2 -2
  81. package/dest/fixtures/token_utils.d.ts.map +1 -1
  82. package/dest/fixtures/token_utils.js +5 -7
  83. package/dest/fixtures/utils.d.ts +2 -2
  84. package/dest/fixtures/utils.d.ts.map +1 -1
  85. package/dest/fixtures/utils.js +1 -1
  86. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  87. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  88. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  89. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  90. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  91. package/dest/forward-compatibility/wallet_service.js +109 -0
  92. package/dest/install_legacy_contracts.d.cts +10 -0
  93. package/dest/install_legacy_contracts.d.cts.map +1 -0
  94. package/dest/legacy-jest-resolver.d.cts +3 -0
  95. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  96. package/dest/shared/cross_chain_test_harness.d.ts +4 -2
  97. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  98. package/dest/shared/cross_chain_test_harness.js +22 -18
  99. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  100. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  101. package/dest/shared/gas_portal_test_harness.js +19 -10
  102. package/dest/shared/index.d.ts +2 -1
  103. package/dest/shared/index.d.ts.map +1 -1
  104. package/dest/shared/index.js +1 -0
  105. package/dest/shared/jest_setup.js +41 -1
  106. package/dest/shared/mock_state_view.d.ts +86 -0
  107. package/dest/shared/mock_state_view.d.ts.map +1 -0
  108. package/dest/shared/mock_state_view.js +186 -0
  109. package/dest/shared/submit-transactions.d.ts +2 -2
  110. package/dest/shared/submit-transactions.d.ts.map +1 -1
  111. package/dest/shared/submit-transactions.js +1 -1
  112. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  113. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  114. package/dest/shared/uniswap_l1_l2.js +62 -39
  115. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  116. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  117. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  118. package/dest/simulators/lending_simulator.d.ts +10 -3
  119. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  120. package/dest/simulators/lending_simulator.js +26 -14
  121. package/dest/simulators/token_simulator.d.ts +1 -1
  122. package/dest/simulators/token_simulator.d.ts.map +1 -1
  123. package/dest/simulators/token_simulator.js +3 -24
  124. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  125. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  126. package/dest/spartan/setup_test_wallets.js +103 -40
  127. package/dest/spartan/tx_metrics.d.ts +18 -4
  128. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  129. package/dest/spartan/tx_metrics.js +74 -21
  130. package/dest/spartan/utils/bot.d.ts +3 -2
  131. package/dest/spartan/utils/bot.d.ts.map +1 -1
  132. package/dest/spartan/utils/bot.js +2 -1
  133. package/dest/spartan/utils/config.d.ts +11 -28
  134. package/dest/spartan/utils/config.d.ts.map +1 -1
  135. package/dest/spartan/utils/config.js +4 -1
  136. package/dest/spartan/utils/index.d.ts +5 -3
  137. package/dest/spartan/utils/index.d.ts.map +1 -1
  138. package/dest/spartan/utils/index.js +5 -1
  139. package/dest/spartan/utils/k8s.d.ts +3 -1
  140. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  141. package/dest/spartan/utils/k8s.js +6 -0
  142. package/dest/spartan/utils/nodes.d.ts +4 -5
  143. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  144. package/dest/spartan/utils/nodes.js +11 -11
  145. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  146. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  147. package/dest/spartan/utils/pod_logs.js +74 -0
  148. package/dest/spartan/utils/scripts.d.ts +18 -4
  149. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  150. package/dest/spartan/utils/scripts.js +19 -4
  151. package/dest/test-wallet/test_wallet.d.ts +85 -0
  152. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  153. package/dest/test-wallet/test_wallet.js +273 -0
  154. package/dest/test-wallet/utils.d.ts +41 -0
  155. package/dest/test-wallet/utils.d.ts.map +1 -0
  156. package/dest/test-wallet/utils.js +66 -0
  157. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  158. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  159. package/dest/test-wallet/wallet_worker_script.js +48 -0
  160. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  161. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  162. package/dest/test-wallet/worker_wallet.js +155 -0
  163. package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
  164. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  165. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  166. package/package.json +49 -45
  167. package/src/bench/client_flows/benchmark.ts +19 -0
  168. package/src/bench/client_flows/client_flows_benchmark.ts +64 -49
  169. package/src/bench/client_flows/config.ts +9 -1
  170. package/src/bench/utils.ts +10 -4
  171. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +52 -25
  172. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +56 -19
  173. package/src/e2e_deploy_contract/deploy_test.ts +6 -5
  174. package/src/e2e_epochs/epochs_test.ts +166 -68
  175. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  176. package/src/e2e_fees/fees_test.ts +57 -32
  177. package/src/e2e_nested_contract/nested_contract_test.ts +10 -6
  178. package/src/e2e_p2p/inactivity_slash_test.ts +9 -7
  179. package/src/e2e_p2p/p2p_network.ts +93 -49
  180. package/src/e2e_p2p/reqresp/utils.ts +84 -17
  181. package/src/e2e_p2p/shared.ts +95 -65
  182. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  183. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  184. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  185. package/src/e2e_token_contract/token_contract_test.ts +38 -11
  186. package/src/fixtures/authwit_proxy.ts +54 -0
  187. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  188. package/src/fixtures/e2e_prover_test.ts +49 -56
  189. package/src/fixtures/elu_monitor.ts +126 -0
  190. package/src/fixtures/fixtures.ts +96 -0
  191. package/src/fixtures/get_bb_config.ts +7 -6
  192. package/src/fixtures/ha_setup.ts +7 -3
  193. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  194. package/src/fixtures/setup.ts +251 -231
  195. package/src/fixtures/setup_p2p_test.ts +37 -32
  196. package/src/fixtures/token_utils.ts +3 -3
  197. package/src/fixtures/utils.ts +2 -0
  198. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  199. package/src/forward-compatibility/wallet_service.ts +104 -0
  200. package/src/guides/up_quick_start.sh +3 -5
  201. package/src/install_legacy_contracts.cjs +75 -0
  202. package/src/legacy-jest-resolver.cjs +112 -0
  203. package/src/shared/cross_chain_test_harness.ts +27 -13
  204. package/src/shared/gas_portal_test_harness.ts +21 -11
  205. package/src/shared/index.ts +1 -0
  206. package/src/shared/jest_setup.ts +51 -1
  207. package/src/shared/mock_state_view.ts +188 -0
  208. package/src/shared/submit-transactions.ts +3 -2
  209. package/src/shared/uniswap_l1_l2.ts +80 -55
  210. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  211. package/src/simulators/lending_simulator.ts +32 -14
  212. package/src/simulators/token_simulator.ts +6 -30
  213. package/src/spartan/setup_test_wallets.ts +142 -34
  214. package/src/spartan/tx_metrics.ts +82 -24
  215. package/src/spartan/utils/bot.ts +4 -1
  216. package/src/spartan/utils/config.ts +3 -0
  217. package/src/spartan/utils/index.ts +8 -1
  218. package/src/spartan/utils/k8s.ts +8 -0
  219. package/src/spartan/utils/nodes.ts +17 -12
  220. package/src/spartan/utils/pod_logs.ts +99 -0
  221. package/src/spartan/utils/scripts.ts +43 -7
  222. package/src/test-wallet/test_wallet.ts +376 -0
  223. package/src/test-wallet/utils.ts +108 -0
  224. package/src/test-wallet/wallet_worker_script.ts +60 -0
  225. package/src/test-wallet/worker_wallet.ts +218 -0
  226. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -1,22 +1,23 @@
1
1
  import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import { type InitialAccountData, generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
3
- import { type Archiver, createArchiver } from '@aztec/archiver';
2
+ import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
4
3
  import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
4
+ import { NO_FROM } from '@aztec/aztec.js/account';
5
5
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
6
6
  import {
7
7
  BatchCall,
8
8
  type ContractFunctionInteraction,
9
9
  type ContractMethod,
10
+ type DeployOptions,
11
+ type InteractionWaitOptions,
10
12
  getContractClassFromArtifact,
11
13
  waitForProven,
12
14
  } from '@aztec/aztec.js/contracts';
13
15
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
14
16
  import { Fr } from '@aztec/aztec.js/fields';
15
17
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
16
- import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
18
+ import type { AztecNode } from '@aztec/aztec.js/node';
17
19
  import type { Wallet } from '@aztec/aztec.js/wallet';
18
- import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
19
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
20
+ import { AnvilTestWatcher, type AnvilTestWatcherOpts, CheatCodes } from '@aztec/aztec/testing';
20
21
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
21
22
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
22
23
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -30,13 +31,9 @@ import {
30
31
  type ZKPassportArgs,
31
32
  deployAztecL1Contracts,
32
33
  } from '@aztec/ethereum/deploy-aztec-l1-contracts';
33
- import {
34
- DelayedTxUtils,
35
- EthCheatCodes,
36
- EthCheatCodesWithState,
37
- createDelayedL1TxUtilsFromViemWallet,
38
- startAnvil,
39
- } from '@aztec/ethereum/test';
34
+ import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
35
+ import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
36
+ import type { Anvil } from '@aztec/ethereum/test';
40
37
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
41
38
  import { SecretValue } from '@aztec/foundation/config';
42
39
  import { randomBytes } from '@aztec/foundation/crypto/random';
@@ -45,21 +42,22 @@ import { withLoggerBindings } from '@aztec/foundation/log/server';
45
42
  import { retryUntil } from '@aztec/foundation/retry';
46
43
  import { sleep } from '@aztec/foundation/sleep';
47
44
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
48
- import type { DataStoreConfig } from '@aztec/kv-store/config';
49
45
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
50
46
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
51
47
  import type { P2PClientDeps } from '@aztec/p2p';
52
48
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
53
49
  import { protocolContractsHash } from '@aztec/protocol-contracts';
54
- import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
55
- import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
50
+ import type { ProverNodeConfig } from '@aztec/prover-node';
51
+ import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
56
52
  import type { SequencerClient } from '@aztec/sequencer-client';
57
- import type { TestSequencerClient } from '@aztec/sequencer-client/test';
53
+ import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
54
+ import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
55
+ import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
58
56
  import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
59
- import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
57
+ import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
60
58
  import { tryStop } from '@aztec/stdlib/interfaces/server';
61
- import type { P2PClientType } from '@aztec/stdlib/p2p';
62
59
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
60
+ import type { GenesisData } from '@aztec/stdlib/world-state';
63
61
  import {
64
62
  type TelemetryClient,
65
63
  type TelemetryClientConfig,
@@ -67,10 +65,9 @@ import {
67
65
  initTelemetryClient,
68
66
  } from '@aztec/telemetry-client';
69
67
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
70
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
68
+ import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
71
69
  import { getGenesisValues } from '@aztec/world-state/testing';
72
70
 
73
- import type { Anvil } from '@viem/anvil';
74
71
  import fs from 'fs/promises';
75
72
  import { tmpdir } from 'os';
76
73
  import path from 'path';
@@ -84,6 +81,7 @@ import {
84
81
  } from 'viem/accounts';
85
82
  import { type Chain, foundry } from 'viem/chains';
86
83
 
84
+ import { TestWallet } from '../test-wallet/test_wallet.js';
87
85
  import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
88
86
  import { getACVMConfig } from './get_acvm_config.js';
89
87
  import { getBBConfig } from './get_bb_config.js';
@@ -92,9 +90,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
92
90
 
93
91
  export { startAnvil };
94
92
 
95
- const { AZTEC_NODE_URL = '' } = process.env;
96
- const getAztecUrl = () => AZTEC_NODE_URL;
97
-
98
93
  let telemetry: TelemetryClient | undefined = undefined;
99
94
  async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
100
95
  if (!telemetry) {
@@ -189,14 +184,22 @@ export type SetupOptions = {
189
184
  proverNodeConfig?: Partial<ProverNodeConfig>;
190
185
  /** Whether to use a mock gossip sub network for p2p clients. */
191
186
  mockGossipSubNetwork?: boolean;
187
+ /** Whether to add simulated latency to the mock gossipsub network (in ms) */
188
+ mockGossipSubNetworkLatency?: number;
192
189
  /** Whether to disable the anvil test watcher (can still be manually started) */
193
190
  disableAnvilTestWatcher?: boolean;
191
+ anvilTestWatcherOpts?: AnvilTestWatcherOpts;
194
192
  /** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
195
193
  automineL1Setup?: boolean;
196
194
  /** How many accounts to seed and unlock in anvil. */
197
195
  anvilAccounts?: number;
198
196
  /** Port to start anvil (defaults to 8545) */
199
197
  anvilPort?: number;
198
+ /**
199
+ * Number of slots per epoch for Anvil's finality simulation.
200
+ * Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
201
+ */
202
+ anvilSlotsInAnEpoch?: number;
200
203
  /** Key to use for publishing L1 contracts */
201
204
  l1PublisherKey?: SecretValue<`0x${string}`>;
202
205
  /** ZkPassport configuration (domain, scope, mock verifier) */
@@ -207,8 +210,16 @@ export type SetupOptions = {
207
210
  skipAccountDeployment?: boolean;
208
211
  /** L1 contracts deployment arguments. */
209
212
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
210
- /** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
213
+ /** Wallet minimum fee padding multiplier */
211
214
  walletMinFeePadding?: number;
215
+ /** Whether the initial node should be a lightweight RPC-only node (no sequencer, no validator).
216
+ * Use for tests that create their own validator nodes and don't need the initial sequencer. */
217
+ skipInitialSequencer?: boolean;
218
+ /** Whether to swap the production Sequencer for the minimal AutomineSequencer.
219
+ * Use only for single-sequencer non-block-building tests. See AUTOMINE_E2E_OPTS in `fixtures.ts`. */
220
+ useAutomineSequencer?: boolean;
221
+ /** Options forwarded to PXE creation (e.g. execution hooks). */
222
+ pxeCreationOptions?: PXECreationOptions;
212
223
  } & Partial<AztecNodeConfig>;
213
224
 
214
225
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -216,14 +227,14 @@ export type EndToEndContext = {
216
227
  /** The Anvil instance (only set if anvil was started locally). */
217
228
  anvil: Anvil | undefined;
218
229
  /** The Aztec Node service or client a connected to it. */
219
- aztecNode: AztecNode;
220
- /** The Aztec Node as a service (only set if running locally). */
221
- aztecNodeService: AztecNodeService | undefined;
222
- /** Client to the Aztec Node admin interface (undefined if connected to remote environment) */
223
- aztecNodeAdmin: AztecNodeAdmin | undefined;
224
- /** The prover node service (only set if startProverNode is true) */
225
- proverNode: ProverNode | undefined;
226
- /** A client to the sequencer service (undefined if connected to remote environment) */
230
+ aztecNode: AztecNode & AztecNodeDebug;
231
+ /** The Aztec Node as a service. */
232
+ aztecNodeService: AztecNodeService;
233
+ /** Client to the Aztec Node admin interface. */
234
+ aztecNodeAdmin: AztecNodeAdmin;
235
+ /** The aztec node running the prover node subsystem (only set if startProverNode is true). */
236
+ proverNode: AztecNodeService | undefined;
237
+ /** A client to the sequencer service. */
227
238
  sequencer: SequencerClient | undefined;
228
239
  /** Return values from deployAztecL1Contracts function. */
229
240
  deployL1ContractsValues: DeployAztecL1ContractsReturnType;
@@ -243,100 +254,54 @@ export type EndToEndContext = {
243
254
  cheatCodes: CheatCodes;
244
255
  /** The cheat codes for L1 */
245
256
  ethCheatCodes: EthCheatCodes;
246
- /** The anvil test watcher (undefined if connected to remote environment) */
247
- watcher: AnvilTestWatcher | undefined;
248
- /** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
249
- dateProvider: TestDateProvider | undefined;
257
+ /** The anvil test watcher. */
258
+ watcher: AnvilTestWatcher;
259
+ /** Allows tweaking current system time, used by the epoch cache only. */
260
+ dateProvider: TestDateProvider;
250
261
  /** Telemetry client */
251
- telemetryClient: TelemetryClient | undefined;
262
+ telemetryClient: TelemetryClient;
252
263
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
253
264
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
254
- /** Prefilled public data used for setting up nodes. */
255
- prefilledPublicData: PublicDataTreeLeaf[] | undefined;
265
+ /** Delayer for sequencer L1 txs (only when enableDelayer is true). */
266
+ sequencerDelayer: Delayer | undefined;
267
+ /** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
268
+ proverDelayer: Delayer | undefined;
269
+ /** Genesis data used for setting up nodes. */
270
+ genesis: GenesisData | undefined;
256
271
  /** ACVM config (only set if running locally). */
257
272
  acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
258
273
  /** BB config (only set if running locally). */
259
274
  bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
260
275
  /** Directory to cleanup on teardown. */
261
- directoryToCleanup: string | undefined;
276
+ directoryToCleanup: string;
262
277
  /** Function to stop the started services. */
263
278
  teardown: () => Promise<void>;
264
279
  };
265
280
 
266
281
  /**
267
- * Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
282
+ * When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
283
+ * aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
284
+ * actually swapped in the correct version.
268
285
  */
269
- async function setupWithRemoteEnvironment(
270
- account: HDAccount | PrivateKeyAccount,
271
- config: AztecNodeConfig & SetupOptions,
272
- logger: Logger,
273
- numberOfAccounts: number,
274
- ): Promise<EndToEndContext> {
275
- const aztecNodeUrl = getAztecUrl();
276
- logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
277
- const aztecNode = createAztecNodeClient(aztecNodeUrl);
278
- await waitForNode(aztecNode, logger);
279
- logger.verbose('JSON RPC client connected to Aztec Node');
280
- logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
281
- const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
282
-
283
- const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
284
-
285
- const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
286
- l1ContractAddresses,
287
- l1Client,
288
- rollupVersion,
289
- };
290
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
291
- const wallet = await TestWallet.create(aztecNode);
292
-
293
- if (config.walletMinFeePadding !== undefined) {
294
- wallet.setMinFeePadding(config.walletMinFeePadding);
286
+ function assertContractArtifactsVersion() {
287
+ const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
288
+ if (!expected) {
289
+ return;
295
290
  }
296
-
297
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
298
- const teardown = () => Promise.resolve();
299
-
300
- logger.verbose('Populating wallet from already registered accounts...');
301
- const initialFundedAccounts = await getInitialTestAccountsData();
302
-
303
- if (initialFundedAccounts.length < numberOfAccounts) {
304
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
291
+ const { aztecVersion } = SponsoredFPCContract.artifact;
292
+ // TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
293
+ if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
294
+ createLogger('e2e:setup').info(
295
+ `Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`,
296
+ );
297
+ return;
298
+ }
299
+ if (aztecVersion !== expected) {
300
+ throw new Error(
301
+ `Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` +
302
+ `The legacy artifact resolver may not have swapped in the correct version.`,
303
+ );
305
304
  }
306
-
307
- const testAccounts = await Promise.all(
308
- initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
309
- const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
310
- return accountManager.address;
311
- }),
312
- );
313
-
314
- return {
315
- anvil: undefined,
316
- aztecNode,
317
- aztecNodeService: undefined,
318
- aztecNodeAdmin: undefined,
319
- sequencer: undefined,
320
- proverNode: undefined,
321
- deployL1ContractsValues,
322
- config,
323
- aztecNodeConfig: config,
324
- initialFundedAccounts,
325
- wallet,
326
- accounts: testAccounts,
327
- logger,
328
- cheatCodes,
329
- ethCheatCodes,
330
- prefilledPublicData: undefined,
331
- mockGossipSubNetwork: undefined,
332
- watcher: undefined,
333
- dateProvider: undefined,
334
- telemetryClient: undefined,
335
- acvmConfig: undefined,
336
- bbConfig: undefined,
337
- directoryToCleanup: undefined,
338
- teardown,
339
- };
340
305
  }
341
306
 
342
307
  /**
@@ -351,10 +316,11 @@ export async function setup(
351
316
  pxeOpts: Partial<PXEConfig> = {},
352
317
  chain: Chain = foundry,
353
318
  ): Promise<EndToEndContext> {
319
+ assertContractArtifactsVersion();
354
320
  let anvil: Anvil | undefined;
355
321
  try {
356
322
  opts.aztecTargetCommitteeSize ??= 0;
357
- opts.slasherFlavor ??= 'none';
323
+ opts.slasherEnabled ??= false;
358
324
 
359
325
  const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
360
326
  // use initialValidators for the node config
@@ -366,8 +332,12 @@ export async function setup(
366
332
  config.realProofs = !!opts.realProofs;
367
333
  // Only enforce the time table if requested
368
334
  config.enforceTimeTable = !!opts.enforceTimeTable;
335
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
336
+ config.enableDelayer = true;
369
337
  config.listenAddress = '127.0.0.1';
370
338
 
339
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
340
+
371
341
  const logger = getLogger();
372
342
 
373
343
  // Create a temp directory for any services that need it and cleanup later
@@ -377,20 +347,18 @@ export async function setup(
377
347
  config.dataDirectory = directoryToCleanup;
378
348
  }
379
349
 
350
+ const dateProvider = new TestDateProvider();
351
+
380
352
  if (!config.l1RpcUrls?.length) {
381
353
  if (!isAnvilTestChain(chain.id)) {
382
354
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
383
355
  }
384
- if (AZTEC_NODE_URL) {
385
- throw new Error(
386
- `AZTEC_NODE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`,
387
- );
388
- }
389
-
390
356
  const res = await startAnvil({
391
357
  l1BlockTime: opts.ethereumSlotDuration,
392
358
  accounts: opts.anvilAccounts,
393
359
  port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
360
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
361
+ dateProvider,
394
362
  });
395
363
  anvil = res.anvil;
396
364
  config.l1RpcUrls = [res.rpcUrl];
@@ -402,8 +370,6 @@ export async function setup(
402
370
  logger.info(`Logging metrics to ${filename}`);
403
371
  setupMetricsLogger(filename);
404
372
  }
405
-
406
- const dateProvider = new TestDateProvider();
407
373
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
408
374
 
409
375
  if (opts.stateLoad) {
@@ -421,11 +387,11 @@ export async function setup(
421
387
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
422
388
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
423
389
  } else if (
424
- config.publisherPrivateKeys &&
425
- config.publisherPrivateKeys.length > 0 &&
426
- config.publisherPrivateKeys[0].getValue() != NULL_KEY
390
+ config.sequencerPublisherPrivateKeys &&
391
+ config.sequencerPublisherPrivateKeys.length > 0 &&
392
+ config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
427
393
  ) {
428
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
394
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
429
395
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
430
396
  } else if (!MNEMONIC) {
431
397
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -434,18 +400,13 @@ export async function setup(
434
400
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
435
401
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
436
402
  publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
437
- config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
403
+ config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
438
404
  }
439
405
 
440
406
  if (config.coinbase === undefined) {
441
407
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
442
408
  }
443
409
 
444
- if (AZTEC_NODE_URL) {
445
- // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
446
- return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
447
- }
448
-
449
410
  // Determine which addresses to fund in genesis
450
411
  const initialFundedAccounts =
451
412
  opts.initialFundedAccounts ??
@@ -458,10 +419,12 @@ export async function setup(
458
419
  addressesToFund.push(sponsoredFPCAddress);
459
420
  }
460
421
 
461
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
422
+ const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
423
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
462
424
  addressesToFund,
463
425
  opts.initialAccountFeeJuice,
464
426
  opts.genesisPublicData,
427
+ genesisTimestamp,
465
428
  );
466
429
 
467
430
  const wasAutomining = await ethCheatCodes.isAutoMining();
@@ -496,13 +459,37 @@ export async function setup(
496
459
  },
497
460
  );
498
461
 
499
- config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
462
+ Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
500
463
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
501
464
 
465
+ // Propagate L1-contracts-config overrides back to the node config so the archiver's
466
+ // `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
467
+ // Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
468
+ // but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
469
+ // `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
470
+ // `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
471
+ // Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
472
+ // by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
473
+ // as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
474
+ // in this function and crash `setupSharedBlobStorage`.
475
+ if (opts.l1ContractsArgs) {
476
+ for (const [key, value] of Object.entries(opts.l1ContractsArgs)) {
477
+ if (value !== undefined) {
478
+ (config as unknown as Record<string, unknown>)[key] = value;
479
+ }
480
+ }
481
+ }
482
+
502
483
  if (enableAutomine) {
503
484
  await ethCheatCodes.setAutomine(false);
504
485
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
505
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
486
+ }
487
+
488
+ // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
489
+ // ahead of system time due to the local-network watcher warping time forward on each filled slot.
490
+ // When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
491
+ if (!anvil) {
492
+ dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
506
493
  }
507
494
 
508
495
  if (opts.l2StartTime) {
@@ -514,6 +501,7 @@ export async function setup(
514
501
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
515
502
  deployL1ContractsValues.l1Client,
516
503
  dateProvider,
504
+ opts.anvilTestWatcherOpts,
517
505
  );
518
506
  if (!opts.disableAnvilTestWatcher) {
519
507
  await watcher.start();
@@ -541,10 +529,10 @@ export async function setup(
541
529
  }
542
530
 
543
531
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
544
- let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
532
+ let p2pClientDeps: P2PClientDeps | undefined = undefined;
545
533
 
546
534
  if (opts.mockGossipSubNetwork) {
547
- mockGossipSubNetwork = new MockGossipSubNetwork();
535
+ mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
548
536
  p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
549
537
  }
550
538
 
@@ -561,7 +549,11 @@ export async function setup(
561
549
  const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
562
550
  // Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
563
551
  const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
564
- config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
552
+ // Under proposer pipelining the sequencer builds during slot N-1 for slot N. A tx submitted at
553
+ // slot N start is too late -- it arrives after the build. Forcing minTxsPerBlock=1 then stalls
554
+ // the chain on alternating slots, so allow empty checkpoints under pipelining.
555
+ const accountsDeployMinTxs = config.enableProposerPipelining ? 0 : 1;
556
+ config.minTxsPerBlock = shouldDeployAccounts ? accountsDeployMinTxs : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
565
557
 
566
558
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
567
559
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
@@ -572,52 +564,73 @@ export async function setup(
572
564
  }
573
565
  }
574
566
 
567
+ // When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
568
+ // We apply these overrides to a copy so they don't leak into the returned config.
569
+ // Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
570
+ const initialNodeConfig = opts.skipInitialSequencer
571
+ ? {
572
+ ...config,
573
+ disableValidator: true,
574
+ ...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
575
+ }
576
+ : config;
577
+
575
578
  const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
576
579
  AztecNodeService.createAndSync(
577
- config,
580
+ initialNodeConfig,
578
581
  { dateProvider, telemetry: telemetryClient, p2pClientDeps },
579
- { prefilledPublicData },
582
+ { genesis, dontStartSequencer: opts.skipInitialSequencer },
580
583
  ),
581
584
  );
582
585
  const sequencerClient = aztecNodeService.getSequencer();
583
586
 
584
- if (sequencerClient) {
585
- const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
586
- publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
587
- }
588
-
589
- let proverNode: ProverNode | undefined = undefined;
587
+ let proverNode: AztecNodeService | undefined = undefined;
590
588
  if (opts.startProverNode) {
591
589
  logger.verbose('Creating and syncing a simulated prover node...');
592
590
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
593
591
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
594
592
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
595
- const proverNodeConfig = {
596
- ...config.proverNodeConfig,
597
- dataDirectory: proverNodeDataDirectory,
598
- p2pEnabled: false,
593
+
594
+ const p2pClientDeps: Partial<P2PClientDeps> = {
595
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
596
+ rpcTxProviders: [aztecNodeService],
599
597
  };
600
- proverNode = await createAndSyncProverNode(
598
+
599
+ ({ proverNode } = await createAndSyncProverNode(
601
600
  proverNodePrivateKeyHex,
602
601
  config,
603
- proverNodeConfig,
604
- aztecNodeService,
605
- prefilledPublicData,
606
- );
602
+ {
603
+ ...config.proverNodeConfig,
604
+ dataDirectory: proverNodeDataDirectory,
605
+ },
606
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
607
+ { genesis },
608
+ ));
607
609
  }
608
610
 
611
+ const sequencerDelayer = sequencerClient?.getDelayer();
612
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
613
+
609
614
  logger.verbose('Creating a pxe...');
610
615
  const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
611
616
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
612
617
  // For tests we only want proving enabled if specifically requested
613
618
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
614
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig, { loggerActorLabel: 'pxe-0' });
619
+ const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
620
+ loggerActorLabel: 'pxe-0',
621
+ ...opts.pxeCreationOptions,
622
+ });
615
623
 
616
624
  if (opts.walletMinFeePadding !== undefined) {
617
625
  wallet.setMinFeePadding(opts.walletMinFeePadding);
618
626
  }
619
627
 
620
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
628
+ const cheatCodes = await CheatCodes.create(
629
+ config.l1RpcUrls,
630
+ aztecNodeService,
631
+ dateProvider,
632
+ aztecNodeService.getAutomineSequencer(),
633
+ );
621
634
 
622
635
  if (
623
636
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
@@ -635,7 +648,9 @@ export async function setup(
635
648
 
636
649
  let accounts: AztecAddress[] = [];
637
650
 
638
- if (shouldDeployAccounts) {
651
+ if (opts.skipInitialSequencer) {
652
+ logger.info('Sequencer not started on initial node, skipping block progression');
653
+ } else if (shouldDeployAccounts) {
639
654
  logger.info(
640
655
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
641
656
  );
@@ -644,6 +659,11 @@ export async function setup(
644
659
  accounts = accountManagers.map(accountManager => accountManager.address);
645
660
  } else if (needsEmptyBlock) {
646
661
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
662
+ // AutomineSequencer only builds on tx arrival; explicitly request an empty block.
663
+ const automine = aztecNodeService.getAutomineSequencer();
664
+ if (automine) {
665
+ await automine.buildEmptyBlock();
666
+ }
647
667
  while ((await aztecNodeService.getBlockNumber()) === 0) {
648
668
  await sleep(2000);
649
669
  }
@@ -683,7 +703,7 @@ export async function setup(
683
703
  logger.error(`Error during e2e test teardown`, err);
684
704
  } finally {
685
705
  try {
686
- await telemetryClient?.stop();
706
+ await telemetryClient.stop();
687
707
  } catch (err) {
688
708
  logger.error(`Error during telemetry client stop`, err);
689
709
  }
@@ -704,8 +724,10 @@ export async function setup(
704
724
  initialFundedAccounts,
705
725
  logger,
706
726
  mockGossipSubNetwork,
707
- prefilledPublicData,
727
+ genesis,
708
728
  proverNode,
729
+ sequencerDelayer,
730
+ proverDelayer,
709
731
  sequencer: sequencerClient,
710
732
  teardown,
711
733
  telemetryClient,
@@ -782,100 +804,62 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
782
804
  targetBlock ??= await node.getBlockNumber();
783
805
 
784
806
  await retryUntil(
785
- async () => (await node.getProvenBlockNumber()) >= targetBlock,
807
+ async () => (await node.getBlockNumber('proven')) >= targetBlock,
786
808
  'proven chain status',
787
809
  timeoutSec,
788
810
  intervalSec,
789
811
  );
790
812
  }
791
813
 
814
+ /**
815
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
816
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
817
+ */
792
818
  export function createAndSyncProverNode(
793
819
  proverNodePrivateKey: `0x${string}`,
794
- aztecNodeConfig: AztecNodeConfig,
795
- proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & { dontStart?: boolean },
796
- aztecNode: AztecNode | undefined,
797
- prefilledPublicData: PublicDataTreeLeaf[] = [],
798
- proverNodeDeps: ProverNodeDeps = {},
799
- ) {
820
+ baseConfig: AztecNodeConfig,
821
+ configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
822
+ deps: {
823
+ telemetry?: TelemetryClient;
824
+ dateProvider: DateProvider;
825
+ p2pClientDeps?: P2PClientDeps;
826
+ },
827
+ options: { genesis?: GenesisData; dontStart?: boolean },
828
+ ): Promise<{ proverNode: AztecNodeService }> {
800
829
  return withLoggerBindings({ actor: 'prover-0' }, async () => {
801
- const aztecNodeTxProvider = aztecNode && {
802
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
803
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
804
- stop: () => Promise.resolve(),
805
- };
806
-
807
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
808
-
809
- const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
810
- const archiver = await createArchiver(
811
- archiverConfig,
812
- { blobClient, dateProvider: proverNodeDeps.dateProvider },
813
- { blockUntilSync: true },
814
- );
815
-
816
- const proverConfig: ProverNodeConfig = {
817
- ...aztecNodeConfig,
818
- txCollectionNodeRpcUrls: [],
819
- realProofs: false,
820
- proverAgentCount: 2,
821
- publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
822
- proverNodeMaxPendingJobs: 10,
823
- proverNodeMaxParallelBlocksPerEpoch: 32,
824
- proverNodePollingIntervalMs: 200,
825
- txGatheringIntervalMs: 1000,
826
- txGatheringBatchSize: 10,
827
- txGatheringMaxParallelRequestsPerNode: 10,
828
- txGatheringTimeoutMs: 24_000,
829
- proverNodeFailedEpochStore: undefined,
830
- proverId: EthAddress.fromNumber(1),
831
- proverNodeEpochProvingDelayMs: undefined,
832
- ...proverNodeConfig,
833
- };
834
-
835
- const l1TxUtils = createDelayedL1TxUtils(
836
- aztecNodeConfig,
837
- proverNodePrivateKey,
838
- 'prover-node',
839
- proverNodeDeps.dateProvider,
830
+ const proverNode = await AztecNodeService.createAndSync(
831
+ {
832
+ ...baseConfig,
833
+ ...configOverrides,
834
+ p2pPort: 0,
835
+ enableProverNode: true,
836
+ disableValidator: true,
837
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
838
+ },
839
+ deps,
840
+ { genesis: options.genesis, dontStartProverNode: options.dontStart },
840
841
  );
841
842
 
842
- const proverNode = await createProverNode(
843
- proverConfig,
844
- { ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
845
- { prefilledPublicData },
846
- );
847
- getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
848
- if (!proverNodeConfig.dontStart) {
849
- await proverNode.start();
843
+ if (!proverNode.getProverNode()) {
844
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
850
845
  }
851
- return proverNode;
852
- });
853
- }
854
846
 
855
- function createDelayedL1TxUtils(
856
- aztecNodeConfig: AztecNodeConfig,
857
- privateKey: `0x${string}`,
858
- logName: string,
859
- dateProvider?: DateProvider,
860
- ) {
861
- const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
862
-
863
- const log = createLogger(logName);
864
- const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
865
- l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
866
- return l1TxUtils;
847
+ getLogger().info(`Created and synced prover node`);
848
+ return { proverNode };
849
+ });
867
850
  }
868
851
 
869
852
  export type BalancesFn = ReturnType<typeof getBalancesFn>;
870
853
  export function getBalancesFn(
871
854
  symbol: string,
872
855
  method: ContractMethod,
873
- from: AztecAddress,
874
856
  logger: any,
875
857
  ): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
876
858
  const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
877
859
  const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
878
- const b = await Promise.all(addresses.map(address => method(address).simulate({ from })));
860
+ const b = await Promise.all(
861
+ addresses.map(async address => (await method(address).simulate({ from: address })).result),
862
+ );
879
863
  const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
880
864
  logger.verbose(debugString);
881
865
  return b;
@@ -910,6 +894,41 @@ export async function expectMappingDelta<K, V extends number | bigint>(
910
894
  expect(diffs).toEqual(expectedDiffs);
911
895
  }
912
896
 
897
+ /**
898
+ * Registers the auth_registry contract class and publishes its standard instance if not already
899
+ * present, and registers the artifact with PXE. Publishing is required before exercising the public
900
+ * authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
901
+ * required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
902
+ * surface as generic "Assertion failed:" and tests that match on the real message fail).
903
+ */
904
+ export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
905
+ const { instance, contractClass } = await getStandardAuthRegistry();
906
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
907
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
908
+ }
909
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
910
+ await publishInstance(wallet, instance).send({ from });
911
+ }
912
+ await wallet.registerContract(instance, AuthRegistryArtifact);
913
+ }
914
+
915
+ /**
916
+ * Registers the public_checks contract class and publishes its standard instance if not already
917
+ * present, and registers the artifact with PXE. Required for any contract that calls
918
+ * `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
919
+ * deployed PublicChecks contract via an enqueued public call).
920
+ */
921
+ export async function ensurePublicChecksPublished(wallet: Wallet, from: AztecAddress) {
922
+ const { instance, contractClass } = await getStandardPublicChecks();
923
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
924
+ await (await publishContractClass(wallet, PublicChecksArtifact)).send({ from });
925
+ }
926
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
927
+ await publishInstance(wallet, instance).send({ from });
928
+ }
929
+ await wallet.registerContract(instance, PublicChecksArtifact);
930
+ }
931
+
913
932
  /**
914
933
  * Registers the contract class used for test accounts and publicly deploys the instances requested.
915
934
  * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
@@ -944,7 +963,7 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
944
963
  * Returns deployed account data that can be used by tests.
945
964
  */
946
965
  export const deployAccounts =
947
- (numberOfAccounts: number, logger: Logger) =>
966
+ (numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<InteractionWaitOptions>>) =>
948
967
  async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
949
968
  if (initialFundedAccounts.length < numberOfAccounts) {
950
969
  throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
@@ -961,8 +980,9 @@ export const deployAccounts =
961
980
  );
962
981
  const deployMethod = await accountManager.getDeployMethod();
963
982
  await deployMethod.send({
964
- from: AztecAddress.ZERO,
983
+ from: NO_FROM,
965
984
  skipClassPublication: i !== 0, // Publish the contract class at most once.
985
+ ...deployOptions,
966
986
  });
967
987
  }
968
988
 
@@ -993,7 +1013,7 @@ export async function publicDeployAccounts(
993
1013
 
994
1014
  const batch = new BatchCall(wallet, calls);
995
1015
 
996
- const txReceipt = await batch.send({ from: accountsToDeploy[0] });
1016
+ const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
997
1017
  if (waitUntilProven) {
998
1018
  if (!node) {
999
1019
  throw new Error('Need to provide an AztecNode to wait for proven.');