@aztec/end-to-end 0.0.1-commit.0b941701 → 0.0.1-commit.0dc957cde

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 (214) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
  3. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.js +24 -31
  5. package/dest/bench/client_flows/config.d.ts +2 -2
  6. package/dest/bench/client_flows/config.d.ts.map +1 -1
  7. package/dest/bench/client_flows/config.js +18 -0
  8. package/dest/bench/utils.d.ts +1 -1
  9. package/dest/bench/utils.d.ts.map +1 -1
  10. package/dest/bench/utils.js +6 -3
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -3
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +23 -13
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -2
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  18. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  19. package/dest/e2e_epochs/epochs_test.d.ts +32 -7
  20. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  21. package/dest/e2e_epochs/epochs_test.js +144 -49
  22. package/dest/e2e_fees/fees_test.d.ts +2 -2
  23. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  24. package/dest/e2e_fees/fees_test.js +21 -14
  25. package/dest/e2e_l1_publisher/write_json.d.ts +3 -2
  26. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  27. package/dest/e2e_l1_publisher/write_json.js +1 -7
  28. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  29. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  30. package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
  31. package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
  32. package/dest/e2e_p2p/p2p_network.d.ts +14 -12
  33. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  34. package/dest/e2e_p2p/p2p_network.js +70 -34
  35. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  36. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  37. package/dest/e2e_p2p/reqresp/utils.js +190 -0
  38. package/dest/e2e_p2p/shared.d.ts +26 -8
  39. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  40. package/dest/e2e_p2p/shared.js +76 -52
  41. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  42. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  43. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  44. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  45. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  46. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  47. package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
  48. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  49. package/dest/e2e_token_contract/token_contract_test.js +19 -9
  50. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  51. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  52. package/dest/fixtures/authwit_proxy.js +34 -0
  53. package/dest/fixtures/e2e_prover_test.d.ts +7 -6
  54. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  55. package/dest/fixtures/e2e_prover_test.js +38 -50
  56. package/dest/fixtures/elu_monitor.d.ts +21 -0
  57. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  58. package/dest/fixtures/elu_monitor.js +102 -0
  59. package/dest/fixtures/fixtures.d.ts +16 -1
  60. package/dest/fixtures/fixtures.d.ts.map +1 -1
  61. package/dest/fixtures/fixtures.js +16 -0
  62. package/dest/fixtures/get_bb_config.d.ts +1 -1
  63. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  64. package/dest/fixtures/get_bb_config.js +5 -5
  65. package/dest/fixtures/ha_setup.d.ts +71 -0
  66. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  67. package/dest/fixtures/ha_setup.js +116 -0
  68. package/dest/fixtures/index.d.ts +2 -1
  69. package/dest/fixtures/index.d.ts.map +1 -1
  70. package/dest/fixtures/index.js +1 -0
  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 +39 -0
  74. package/dest/fixtures/setup.d.ts +61 -33
  75. package/dest/fixtures/setup.d.ts.map +1 -1
  76. package/dest/fixtures/setup.js +113 -178
  77. package/dest/fixtures/setup_p2p_test.d.ts +18 -11
  78. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  79. package/dest/fixtures/setup_p2p_test.js +43 -32
  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/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  84. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  85. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  86. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  87. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  88. package/dest/forward-compatibility/wallet_service.js +109 -0
  89. package/dest/legacy-jest-resolver.d.cts +3 -0
  90. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  91. package/dest/shared/cross_chain_test_harness.d.ts +1 -1
  92. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  93. package/dest/shared/cross_chain_test_harness.js +13 -13
  94. package/dest/shared/gas_portal_test_harness.js +3 -3
  95. package/dest/shared/index.d.ts +2 -1
  96. package/dest/shared/index.d.ts.map +1 -1
  97. package/dest/shared/index.js +1 -0
  98. package/dest/shared/jest_setup.js +41 -1
  99. package/dest/shared/mock_state_view.d.ts +86 -0
  100. package/dest/shared/mock_state_view.d.ts.map +1 -0
  101. package/dest/shared/mock_state_view.js +186 -0
  102. package/dest/shared/submit-transactions.d.ts +2 -2
  103. package/dest/shared/submit-transactions.d.ts.map +1 -1
  104. package/dest/shared/submit-transactions.js +1 -1
  105. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  106. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  107. package/dest/shared/uniswap_l1_l2.js +16 -21
  108. package/dest/simulators/lending_simulator.d.ts +1 -1
  109. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  110. package/dest/simulators/lending_simulator.js +4 -4
  111. package/dest/simulators/token_simulator.d.ts +1 -1
  112. package/dest/simulators/token_simulator.d.ts.map +1 -1
  113. package/dest/simulators/token_simulator.js +3 -24
  114. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  115. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  116. package/dest/spartan/setup_test_wallets.js +100 -39
  117. package/dest/spartan/tx_metrics.d.ts +35 -1
  118. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  119. package/dest/spartan/tx_metrics.js +151 -1
  120. package/dest/spartan/utils/bot.d.ts +3 -2
  121. package/dest/spartan/utils/bot.d.ts.map +1 -1
  122. package/dest/spartan/utils/bot.js +2 -1
  123. package/dest/spartan/utils/config.d.ts +10 -1
  124. package/dest/spartan/utils/config.d.ts.map +1 -1
  125. package/dest/spartan/utils/config.js +4 -1
  126. package/dest/spartan/utils/index.d.ts +6 -4
  127. package/dest/spartan/utils/index.d.ts.map +1 -1
  128. package/dest/spartan/utils/index.js +6 -2
  129. package/dest/spartan/utils/k8s.d.ts +31 -1
  130. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  131. package/dest/spartan/utils/k8s.js +124 -0
  132. package/dest/spartan/utils/nodes.d.ts +14 -5
  133. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  134. package/dest/spartan/utils/nodes.js +204 -33
  135. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  136. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  137. package/dest/spartan/utils/pod_logs.js +74 -0
  138. package/dest/spartan/utils/scripts.d.ts +18 -4
  139. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  140. package/dest/spartan/utils/scripts.js +19 -4
  141. package/dest/test-wallet/test_wallet.d.ts +84 -0
  142. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  143. package/dest/test-wallet/test_wallet.js +251 -0
  144. package/dest/test-wallet/utils.d.ts +41 -0
  145. package/dest/test-wallet/utils.d.ts.map +1 -0
  146. package/dest/test-wallet/utils.js +71 -0
  147. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  148. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  149. package/dest/test-wallet/wallet_worker_script.js +48 -0
  150. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  151. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  152. package/dest/test-wallet/worker_wallet.js +151 -0
  153. package/dest/test-wallet/worker_wallet_schema.d.ts +279 -0
  154. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  155. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  156. package/package.json +46 -43
  157. package/src/bench/client_flows/client_flows_benchmark.ts +33 -20
  158. package/src/bench/client_flows/config.ts +9 -1
  159. package/src/bench/utils.ts +8 -3
  160. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +31 -21
  161. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
  162. package/src/e2e_deploy_contract/deploy_test.ts +3 -3
  163. package/src/e2e_epochs/epochs_test.ts +168 -76
  164. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  165. package/src/e2e_fees/fees_test.ts +24 -30
  166. package/src/e2e_l1_publisher/write_json.ts +1 -6
  167. package/src/e2e_nested_contract/nested_contract_test.ts +7 -5
  168. package/src/e2e_p2p/inactivity_slash_test.ts +7 -7
  169. package/src/e2e_p2p/p2p_network.ts +93 -49
  170. package/src/e2e_p2p/reqresp/utils.ts +256 -0
  171. package/src/e2e_p2p/shared.ts +99 -64
  172. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  173. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  174. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  175. package/src/e2e_token_contract/token_contract_test.ts +26 -9
  176. package/src/fixtures/authwit_proxy.ts +54 -0
  177. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  178. package/src/fixtures/e2e_prover_test.ts +47 -56
  179. package/src/fixtures/elu_monitor.ts +126 -0
  180. package/src/fixtures/fixtures.ts +32 -0
  181. package/src/fixtures/get_bb_config.ts +7 -6
  182. package/src/fixtures/ha_setup.ts +188 -0
  183. package/src/fixtures/index.ts +1 -0
  184. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  185. package/src/fixtures/setup.ts +157 -242
  186. package/src/fixtures/setup_p2p_test.ts +48 -52
  187. package/src/fixtures/token_utils.ts +3 -3
  188. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  189. package/src/forward-compatibility/wallet_service.ts +104 -0
  190. package/src/guides/up_quick_start.sh +3 -5
  191. package/src/legacy-jest-resolver.cjs +135 -0
  192. package/src/shared/cross_chain_test_harness.ts +13 -9
  193. package/src/shared/gas_portal_test_harness.ts +1 -2
  194. package/src/shared/index.ts +1 -0
  195. package/src/shared/jest_setup.ts +51 -1
  196. package/src/shared/mock_state_view.ts +188 -0
  197. package/src/shared/submit-transactions.ts +3 -2
  198. package/src/shared/uniswap_l1_l2.ts +38 -37
  199. package/src/simulators/lending_simulator.ts +8 -4
  200. package/src/simulators/token_simulator.ts +6 -30
  201. package/src/spartan/setup_test_wallets.ts +141 -32
  202. package/src/spartan/tx_metrics.ts +127 -1
  203. package/src/spartan/utils/bot.ts +4 -1
  204. package/src/spartan/utils/config.ts +3 -0
  205. package/src/spartan/utils/index.ts +10 -1
  206. package/src/spartan/utils/k8s.ts +160 -0
  207. package/src/spartan/utils/nodes.ts +251 -31
  208. package/src/spartan/utils/pod_logs.ts +99 -0
  209. package/src/spartan/utils/scripts.ts +43 -7
  210. package/src/test-wallet/test_wallet.ts +353 -0
  211. package/src/test-wallet/utils.ts +112 -0
  212. package/src/test-wallet/wallet_worker_script.ts +60 -0
  213. package/src/test-wallet/worker_wallet.ts +214 -0
  214. 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 DeployInteractionWaitOptions,
11
+ type DeployOptions,
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,36 +31,30 @@ 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';
43
40
  import { tryRmDir } from '@aztec/foundation/fs';
44
- import { withLogNameSuffix } from '@aztec/foundation/log';
41
+ 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';
50
+ import type { ProverNodeConfig } from '@aztec/prover-node';
55
51
  import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
56
52
  import type { SequencerClient } from '@aztec/sequencer-client';
57
- import type { TestSequencerClient } from '@aztec/sequencer-client/test';
58
53
  import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
59
- import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
54
+ import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
60
55
  import { tryStop } from '@aztec/stdlib/interfaces/server';
61
- import type { P2PClientType } from '@aztec/stdlib/p2p';
62
56
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
57
+ import type { GenesisData } from '@aztec/stdlib/world-state';
63
58
  import {
64
59
  type TelemetryClient,
65
60
  type TelemetryClientConfig,
@@ -67,10 +62,9 @@ import {
67
62
  initTelemetryClient,
68
63
  } from '@aztec/telemetry-client';
69
64
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
70
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
65
+ import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
71
66
  import { getGenesisValues } from '@aztec/world-state/testing';
72
67
 
73
- import type { Anvil } from '@viem/anvil';
74
68
  import fs from 'fs/promises';
75
69
  import { tmpdir } from 'os';
76
70
  import path from 'path';
@@ -84,6 +78,7 @@ import {
84
78
  } from 'viem/accounts';
85
79
  import { type Chain, foundry } from 'viem/chains';
86
80
 
81
+ import { TestWallet } from '../test-wallet/test_wallet.js';
87
82
  import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
88
83
  import { getACVMConfig } from './get_acvm_config.js';
89
84
  import { getBBConfig } from './get_bb_config.js';
@@ -92,9 +87,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
92
87
 
93
88
  export { startAnvil };
94
89
 
95
- const { AZTEC_NODE_URL = '' } = process.env;
96
- const getAztecUrl = () => AZTEC_NODE_URL;
97
-
98
90
  let telemetry: TelemetryClient | undefined = undefined;
99
91
  async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
100
92
  if (!telemetry) {
@@ -125,14 +117,14 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
125
117
  * @param aztecNode - An instance of Aztec Node.
126
118
  * @param opts - Partial configuration for the PXE.
127
119
  * @param logger - The logger to be used.
128
- * @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
120
+ * @param actor - Actor label to include in log output (e.g., 'pxe-test').
129
121
  * @returns A test wallet, logger and teardown function.
130
122
  */
131
123
  export async function setupPXEAndGetWallet(
132
124
  aztecNode: AztecNode,
133
125
  opts: Partial<PXEConfig> = {},
134
126
  logger = getLogger(),
135
- useLogSuffix = false,
127
+ actor?: string,
136
128
  ): Promise<{
137
129
  wallet: TestWallet;
138
130
  logger: Logger;
@@ -150,9 +142,7 @@ export async function setupPXEAndGetWallet(
150
142
 
151
143
  const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
152
144
 
153
- const wallet = await TestWallet.create(aztecNode, PXEConfig, {
154
- useLogSuffix,
155
- });
145
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
156
146
 
157
147
  return {
158
148
  wallet,
@@ -191,14 +181,22 @@ export type SetupOptions = {
191
181
  proverNodeConfig?: Partial<ProverNodeConfig>;
192
182
  /** Whether to use a mock gossip sub network for p2p clients. */
193
183
  mockGossipSubNetwork?: boolean;
184
+ /** Whether to add simulated latency to the mock gossipsub network (in ms) */
185
+ mockGossipSubNetworkLatency?: number;
194
186
  /** Whether to disable the anvil test watcher (can still be manually started) */
195
187
  disableAnvilTestWatcher?: boolean;
188
+ anvilTestWatcherOpts?: AnvilTestWatcherOpts;
196
189
  /** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
197
190
  automineL1Setup?: boolean;
198
191
  /** How many accounts to seed and unlock in anvil. */
199
192
  anvilAccounts?: number;
200
193
  /** Port to start anvil (defaults to 8545) */
201
194
  anvilPort?: number;
195
+ /**
196
+ * Number of slots per epoch for Anvil's finality simulation.
197
+ * Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
198
+ */
199
+ anvilSlotsInAnEpoch?: number;
202
200
  /** Key to use for publishing L1 contracts */
203
201
  l1PublisherKey?: SecretValue<`0x${string}`>;
204
202
  /** ZkPassport configuration (domain, scope, mock verifier) */
@@ -209,8 +207,11 @@ export type SetupOptions = {
209
207
  skipAccountDeployment?: boolean;
210
208
  /** L1 contracts deployment arguments. */
211
209
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
212
- /** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
210
+ /** Wallet minimum fee padding multiplier */
213
211
  walletMinFeePadding?: number;
212
+ /** Whether the initial node should be a lightweight RPC-only node (no sequencer, no validator).
213
+ * Use for tests that create their own validator nodes and don't need the initial sequencer. */
214
+ skipInitialSequencer?: boolean;
214
215
  } & Partial<AztecNodeConfig>;
215
216
 
216
217
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -218,14 +219,14 @@ export type EndToEndContext = {
218
219
  /** The Anvil instance (only set if anvil was started locally). */
219
220
  anvil: Anvil | undefined;
220
221
  /** The Aztec Node service or client a connected to it. */
221
- aztecNode: AztecNode;
222
- /** The Aztec Node as a service (only set if running locally). */
223
- aztecNodeService: AztecNodeService | undefined;
224
- /** Client to the Aztec Node admin interface (undefined if connected to remote environment) */
225
- aztecNodeAdmin: AztecNodeAdmin | undefined;
226
- /** The prover node service (only set if startProverNode is true) */
227
- proverNode: ProverNode | undefined;
228
- /** A client to the sequencer service (undefined if connected to remote environment) */
222
+ aztecNode: AztecNode & AztecNodeDebug;
223
+ /** The Aztec Node as a service. */
224
+ aztecNodeService: AztecNodeService;
225
+ /** Client to the Aztec Node admin interface. */
226
+ aztecNodeAdmin: AztecNodeAdmin;
227
+ /** The aztec node running the prover node subsystem (only set if startProverNode is true). */
228
+ proverNode: AztecNodeService | undefined;
229
+ /** A client to the sequencer service. */
229
230
  sequencer: SequencerClient | undefined;
230
231
  /** Return values from deployAztecL1Contracts function. */
231
232
  deployL1ContractsValues: DeployAztecL1ContractsReturnType;
@@ -245,102 +246,30 @@ export type EndToEndContext = {
245
246
  cheatCodes: CheatCodes;
246
247
  /** The cheat codes for L1 */
247
248
  ethCheatCodes: EthCheatCodes;
248
- /** The anvil test watcher (undefined if connected to remote environment) */
249
- watcher: AnvilTestWatcher | undefined;
250
- /** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
251
- dateProvider: TestDateProvider | undefined;
249
+ /** The anvil test watcher. */
250
+ watcher: AnvilTestWatcher;
251
+ /** Allows tweaking current system time, used by the epoch cache only. */
252
+ dateProvider: TestDateProvider;
252
253
  /** Telemetry client */
253
- telemetryClient: TelemetryClient | undefined;
254
+ telemetryClient: TelemetryClient;
254
255
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
255
256
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
256
- /** Prefilled public data used for setting up nodes. */
257
- prefilledPublicData: PublicDataTreeLeaf[] | undefined;
257
+ /** Delayer for sequencer L1 txs (only when enableDelayer is true). */
258
+ sequencerDelayer: Delayer | undefined;
259
+ /** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
260
+ proverDelayer: Delayer | undefined;
261
+ /** Genesis data used for setting up nodes. */
262
+ genesis: GenesisData | undefined;
258
263
  /** ACVM config (only set if running locally). */
259
264
  acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
260
265
  /** BB config (only set if running locally). */
261
266
  bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
262
267
  /** Directory to cleanup on teardown. */
263
- directoryToCleanup: string | undefined;
268
+ directoryToCleanup: string;
264
269
  /** Function to stop the started services. */
265
270
  teardown: () => Promise<void>;
266
271
  };
267
272
 
268
- /**
269
- * Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
270
- */
271
- async function setupWithRemoteEnvironment(
272
- account: HDAccount | PrivateKeyAccount,
273
- config: AztecNodeConfig & SetupOptions,
274
- logger: Logger,
275
- numberOfAccounts: number,
276
- ): Promise<EndToEndContext> {
277
- const aztecNodeUrl = getAztecUrl();
278
- logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
279
- const aztecNode = createAztecNodeClient(aztecNodeUrl);
280
- await waitForNode(aztecNode, logger);
281
- logger.verbose('JSON RPC client connected to Aztec Node');
282
- logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
283
- const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
284
-
285
- const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
286
-
287
- const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
288
- l1ContractAddresses,
289
- l1Client,
290
- rollupVersion,
291
- };
292
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
293
- const wallet = await TestWallet.create(aztecNode);
294
-
295
- if (config.walletMinFeePadding !== undefined) {
296
- wallet.setMinFeePadding(config.walletMinFeePadding);
297
- }
298
-
299
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
300
- const teardown = () => Promise.resolve();
301
-
302
- logger.verbose('Populating wallet from already registered accounts...');
303
- const initialFundedAccounts = await getInitialTestAccountsData();
304
-
305
- if (initialFundedAccounts.length < numberOfAccounts) {
306
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
307
- }
308
-
309
- const testAccounts = await Promise.all(
310
- initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
311
- const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
312
- return accountManager.address;
313
- }),
314
- );
315
-
316
- return {
317
- anvil: undefined,
318
- aztecNode,
319
- aztecNodeService: undefined,
320
- aztecNodeAdmin: undefined,
321
- sequencer: undefined,
322
- proverNode: undefined,
323
- deployL1ContractsValues,
324
- config,
325
- aztecNodeConfig: config,
326
- initialFundedAccounts,
327
- wallet,
328
- accounts: testAccounts,
329
- logger,
330
- cheatCodes,
331
- ethCheatCodes,
332
- prefilledPublicData: undefined,
333
- mockGossipSubNetwork: undefined,
334
- watcher: undefined,
335
- dateProvider: undefined,
336
- telemetryClient: undefined,
337
- acvmConfig: undefined,
338
- bbConfig: undefined,
339
- directoryToCleanup: undefined,
340
- teardown,
341
- };
342
- }
343
-
344
273
  /**
345
274
  * Sets up the environment for the end-to-end tests.
346
275
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
@@ -356,7 +285,7 @@ export async function setup(
356
285
  let anvil: Anvil | undefined;
357
286
  try {
358
287
  opts.aztecTargetCommitteeSize ??= 0;
359
- opts.slasherFlavor ??= 'none';
288
+ opts.slasherEnabled ??= false;
360
289
 
361
290
  const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
362
291
  // use initialValidators for the node config
@@ -368,8 +297,12 @@ export async function setup(
368
297
  config.realProofs = !!opts.realProofs;
369
298
  // Only enforce the time table if requested
370
299
  config.enforceTimeTable = !!opts.enforceTimeTable;
300
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
301
+ config.enableDelayer = true;
371
302
  config.listenAddress = '127.0.0.1';
372
303
 
304
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
305
+
373
306
  const logger = getLogger();
374
307
 
375
308
  // Create a temp directory for any services that need it and cleanup later
@@ -379,20 +312,18 @@ export async function setup(
379
312
  config.dataDirectory = directoryToCleanup;
380
313
  }
381
314
 
315
+ const dateProvider = new TestDateProvider();
316
+
382
317
  if (!config.l1RpcUrls?.length) {
383
318
  if (!isAnvilTestChain(chain.id)) {
384
319
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
385
320
  }
386
- if (AZTEC_NODE_URL) {
387
- throw new Error(
388
- `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`,
389
- );
390
- }
391
-
392
321
  const res = await startAnvil({
393
322
  l1BlockTime: opts.ethereumSlotDuration,
394
323
  accounts: opts.anvilAccounts,
395
- port: opts.anvilPort,
324
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
325
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
326
+ dateProvider,
396
327
  });
397
328
  anvil = res.anvil;
398
329
  config.l1RpcUrls = [res.rpcUrl];
@@ -404,8 +335,6 @@ export async function setup(
404
335
  logger.info(`Logging metrics to ${filename}`);
405
336
  setupMetricsLogger(filename);
406
337
  }
407
-
408
- const dateProvider = new TestDateProvider();
409
338
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
410
339
 
411
340
  if (opts.stateLoad) {
@@ -423,11 +352,11 @@ export async function setup(
423
352
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
424
353
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
425
354
  } else if (
426
- config.publisherPrivateKeys &&
427
- config.publisherPrivateKeys.length > 0 &&
428
- config.publisherPrivateKeys[0].getValue() != NULL_KEY
355
+ config.sequencerPublisherPrivateKeys &&
356
+ config.sequencerPublisherPrivateKeys.length > 0 &&
357
+ config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
429
358
  ) {
430
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
359
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
431
360
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
432
361
  } else if (!MNEMONIC) {
433
362
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -436,18 +365,13 @@ export async function setup(
436
365
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
437
366
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
438
367
  publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
439
- config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
368
+ config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
440
369
  }
441
370
 
442
371
  if (config.coinbase === undefined) {
443
372
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
444
373
  }
445
374
 
446
- if (AZTEC_NODE_URL) {
447
- // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
448
- return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
449
- }
450
-
451
375
  // Determine which addresses to fund in genesis
452
376
  const initialFundedAccounts =
453
377
  opts.initialFundedAccounts ??
@@ -460,10 +384,12 @@ export async function setup(
460
384
  addressesToFund.push(sponsoredFPCAddress);
461
385
  }
462
386
 
463
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
387
+ const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
388
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
464
389
  addressesToFund,
465
390
  opts.initialAccountFeeJuice,
466
391
  opts.genesisPublicData,
392
+ genesisTimestamp,
467
393
  );
468
394
 
469
395
  const wasAutomining = await ethCheatCodes.isAutoMining();
@@ -504,7 +430,13 @@ export async function setup(
504
430
  if (enableAutomine) {
505
431
  await ethCheatCodes.setAutomine(false);
506
432
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
507
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
433
+ }
434
+
435
+ // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
436
+ // ahead of system time due to the local-network watcher warping time forward on each filled slot.
437
+ // When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
438
+ if (!anvil) {
439
+ dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
508
440
  }
509
441
 
510
442
  if (opts.l2StartTime) {
@@ -516,6 +448,7 @@ export async function setup(
516
448
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
517
449
  deployL1ContractsValues.l1Client,
518
450
  dateProvider,
451
+ opts.anvilTestWatcherOpts,
519
452
  );
520
453
  if (!opts.disableAnvilTestWatcher) {
521
454
  await watcher.start();
@@ -543,10 +476,10 @@ export async function setup(
543
476
  }
544
477
 
545
478
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
546
- let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
479
+ let p2pClientDeps: P2PClientDeps | undefined = undefined;
547
480
 
548
481
  if (opts.mockGossipSubNetwork) {
549
- mockGossipSubNetwork = new MockGossipSubNetwork();
482
+ mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
550
483
  p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
551
484
  }
552
485
 
@@ -574,44 +507,59 @@ export async function setup(
574
507
  }
575
508
  }
576
509
 
577
- const aztecNodeService = await AztecNodeService.createAndSync(
578
- config,
579
- { dateProvider, telemetry: telemetryClient, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
580
- { prefilledPublicData },
510
+ // When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
511
+ // We apply these overrides to a copy so they don't leak into the returned config.
512
+ // Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
513
+ const initialNodeConfig = opts.skipInitialSequencer
514
+ ? {
515
+ ...config,
516
+ disableValidator: true,
517
+ ...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
518
+ }
519
+ : config;
520
+
521
+ const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
522
+ AztecNodeService.createAndSync(
523
+ initialNodeConfig,
524
+ { dateProvider, telemetry: telemetryClient, p2pClientDeps },
525
+ { genesis, dontStartSequencer: opts.skipInitialSequencer },
526
+ ),
581
527
  );
582
528
  const sequencerClient = aztecNodeService.getSequencer();
583
529
 
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;
530
+ let proverNode: AztecNodeService | undefined = undefined;
590
531
  if (opts.startProverNode) {
591
532
  logger.verbose('Creating and syncing a simulated prover node...');
592
533
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
593
534
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
594
535
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
595
- const proverNodeConfig = {
596
- ...config.proverNodeConfig,
597
- dataDirectory: proverNodeDataDirectory,
598
- p2pEnabled: false,
536
+
537
+ const p2pClientDeps: Partial<P2PClientDeps> = {
538
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
539
+ rpcTxProviders: [aztecNodeService],
599
540
  };
600
- proverNode = await createAndSyncProverNode(
541
+
542
+ ({ proverNode } = await createAndSyncProverNode(
601
543
  proverNodePrivateKeyHex,
602
544
  config,
603
- proverNodeConfig,
604
- aztecNodeService,
605
- prefilledPublicData,
606
- );
545
+ {
546
+ ...config.proverNodeConfig,
547
+ dataDirectory: proverNodeDataDirectory,
548
+ },
549
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
550
+ { genesis },
551
+ ));
607
552
  }
608
553
 
554
+ const sequencerDelayer = sequencerClient?.getDelayer();
555
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
556
+
609
557
  logger.verbose('Creating a pxe...');
610
558
  const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
611
559
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
612
560
  // For tests we only want proving enabled if specifically requested
613
561
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
614
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
562
+ const wallet = await TestWallet.create(aztecNodeService, pxeConfig, { loggerActorLabel: 'pxe-0' });
615
563
 
616
564
  if (opts.walletMinFeePadding !== undefined) {
617
565
  wallet.setMinFeePadding(opts.walletMinFeePadding);
@@ -635,7 +583,9 @@ export async function setup(
635
583
 
636
584
  let accounts: AztecAddress[] = [];
637
585
 
638
- if (shouldDeployAccounts) {
586
+ if (opts.skipInitialSequencer) {
587
+ logger.info('Sequencer not started on initial node, skipping block progression');
588
+ } else if (shouldDeployAccounts) {
639
589
  logger.info(
640
590
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
641
591
  );
@@ -683,7 +633,7 @@ export async function setup(
683
633
  logger.error(`Error during e2e test teardown`, err);
684
634
  } finally {
685
635
  try {
686
- await telemetryClient?.stop();
636
+ await telemetryClient.stop();
687
637
  } catch (err) {
688
638
  logger.error(`Error during telemetry client stop`, err);
689
639
  }
@@ -704,8 +654,10 @@ export async function setup(
704
654
  initialFundedAccounts,
705
655
  logger,
706
656
  mockGossipSubNetwork,
707
- prefilledPublicData,
657
+ genesis,
708
658
  proverNode,
659
+ sequencerDelayer,
660
+ proverDelayer,
709
661
  sequencer: sequencerClient,
710
662
  teardown,
711
663
  telemetryClient,
@@ -789,93 +741,55 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
789
741
  );
790
742
  }
791
743
 
744
+ /**
745
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
746
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
747
+ */
792
748
  export function createAndSyncProverNode(
793
749
  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
- ) {
800
- return withLogNameSuffix('prover-node', 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,
750
+ baseConfig: AztecNodeConfig,
751
+ configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
752
+ deps: {
753
+ telemetry?: TelemetryClient;
754
+ dateProvider: DateProvider;
755
+ p2pClientDeps?: P2PClientDeps;
756
+ },
757
+ options: { genesis?: GenesisData; dontStart?: boolean },
758
+ ): Promise<{ proverNode: AztecNodeService }> {
759
+ return withLoggerBindings({ actor: 'prover-0' }, async () => {
760
+ const proverNode = await AztecNodeService.createAndSync(
761
+ {
762
+ ...baseConfig,
763
+ ...configOverrides,
764
+ p2pPort: 0,
765
+ enableProverNode: true,
766
+ disableValidator: true,
767
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
768
+ },
769
+ deps,
770
+ { genesis: options.genesis, dontStartProverNode: options.dontStart },
840
771
  );
841
772
 
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();
773
+ if (!proverNode.getProverNode()) {
774
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
850
775
  }
851
- return proverNode;
852
- });
853
- }
854
776
 
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;
777
+ getLogger().info(`Created and synced prover node`);
778
+ return { proverNode };
779
+ });
867
780
  }
868
781
 
869
782
  export type BalancesFn = ReturnType<typeof getBalancesFn>;
870
783
  export function getBalancesFn(
871
784
  symbol: string,
872
785
  method: ContractMethod,
873
- from: AztecAddress,
874
786
  logger: any,
875
787
  ): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
876
788
  const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
877
789
  const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
878
- const b = await Promise.all(addresses.map(address => method(address).simulate({ from })));
790
+ const b = await Promise.all(
791
+ addresses.map(async address => (await method(address).simulate({ from: address })).result),
792
+ );
879
793
  const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
880
794
  logger.verbose(debugString);
881
795
  return b;
@@ -944,7 +858,7 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
944
858
  * Returns deployed account data that can be used by tests.
945
859
  */
946
860
  export const deployAccounts =
947
- (numberOfAccounts: number, logger: Logger) =>
861
+ (numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<DeployInteractionWaitOptions>>) =>
948
862
  async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
949
863
  if (initialFundedAccounts.length < numberOfAccounts) {
950
864
  throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
@@ -961,8 +875,9 @@ export const deployAccounts =
961
875
  );
962
876
  const deployMethod = await accountManager.getDeployMethod();
963
877
  await deployMethod.send({
964
- from: AztecAddress.ZERO,
878
+ from: NO_FROM,
965
879
  skipClassPublication: i !== 0, // Publish the contract class at most once.
880
+ ...deployOptions,
966
881
  });
967
882
  }
968
883
 
@@ -993,7 +908,7 @@ export async function publicDeployAccounts(
993
908
 
994
909
  const batch = new BatchCall(wallet, calls);
995
910
 
996
- const txReceipt = await batch.send({ from: accountsToDeploy[0] });
911
+ const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
997
912
  if (waitUntilProven) {
998
913
  if (!node) {
999
914
  throw new Error('Need to provide an AztecNode to wait for proven.');