@aztec/end-to-end 0.0.1-commit.d431d1c → 0.0.1-commit.d939eb5aa

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 (221) 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 +25 -17
  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 +5 -4
  9. package/dest/bench/utils.d.ts.map +1 -1
  10. package/dest/bench/utils.js +13 -8
  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 +28 -19
  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 +17 -7
  20. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  21. package/dest/e2e_epochs/epochs_test.js +92 -42
  22. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  23. package/dest/e2e_fees/fees_test.d.ts +2 -2
  24. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  25. package/dest/e2e_fees/fees_test.js +25 -18
  26. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  27. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  28. package/dest/e2e_l1_publisher/write_json.js +1 -7
  29. package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
  30. package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
  31. package/dest/e2e_p2p/p2p_network.d.ts +9 -10
  32. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  33. package/dest/e2e_p2p/p2p_network.js +43 -21
  34. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  35. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  36. package/dest/e2e_p2p/reqresp/utils.js +190 -0
  37. package/dest/e2e_p2p/shared.d.ts +30 -12
  38. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  39. package/dest/e2e_p2p/shared.js +62 -60
  40. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  41. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  42. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  43. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  44. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  45. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  46. package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
  47. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  48. package/dest/e2e_token_contract/token_contract_test.js +20 -10
  49. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  50. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  51. package/dest/fixtures/authwit_proxy.js +34 -0
  52. package/dest/fixtures/e2e_prover_test.d.ts +7 -6
  53. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  54. package/dest/fixtures/e2e_prover_test.js +40 -49
  55. package/dest/fixtures/elu_monitor.d.ts +21 -0
  56. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  57. package/dest/fixtures/elu_monitor.js +102 -0
  58. package/dest/fixtures/fixtures.d.ts +5 -1
  59. package/dest/fixtures/fixtures.d.ts.map +1 -1
  60. package/dest/fixtures/fixtures.js +6 -0
  61. package/dest/fixtures/get_bb_config.d.ts +1 -1
  62. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  63. package/dest/fixtures/get_bb_config.js +5 -5
  64. package/dest/fixtures/ha_setup.d.ts +71 -0
  65. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  66. package/dest/fixtures/ha_setup.js +116 -0
  67. package/dest/fixtures/index.d.ts +2 -1
  68. package/dest/fixtures/index.d.ts.map +1 -1
  69. package/dest/fixtures/index.js +1 -0
  70. package/dest/fixtures/setup.d.ts +57 -31
  71. package/dest/fixtures/setup.d.ts.map +1 -1
  72. package/dest/fixtures/setup.js +105 -178
  73. package/dest/fixtures/setup_p2p_test.d.ts +18 -11
  74. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  75. package/dest/fixtures/setup_p2p_test.js +43 -32
  76. package/dest/fixtures/token_utils.d.ts +2 -2
  77. package/dest/fixtures/token_utils.d.ts.map +1 -1
  78. package/dest/fixtures/token_utils.js +7 -6
  79. package/dest/legacy-jest-resolver.d.cts +3 -0
  80. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  81. package/dest/shared/cross_chain_test_harness.d.ts +3 -4
  82. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  83. package/dest/shared/cross_chain_test_harness.js +24 -24
  84. package/dest/shared/gas_portal_test_harness.js +3 -3
  85. package/dest/shared/index.d.ts +2 -1
  86. package/dest/shared/index.d.ts.map +1 -1
  87. package/dest/shared/index.js +1 -0
  88. package/dest/shared/jest_setup.js +41 -1
  89. package/dest/shared/mock_state_view.d.ts +86 -0
  90. package/dest/shared/mock_state_view.d.ts.map +1 -0
  91. package/dest/shared/mock_state_view.js +186 -0
  92. package/dest/shared/submit-transactions.d.ts +4 -4
  93. package/dest/shared/submit-transactions.d.ts.map +1 -1
  94. package/dest/shared/submit-transactions.js +9 -11
  95. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  96. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  97. package/dest/shared/uniswap_l1_l2.js +27 -28
  98. package/dest/simulators/lending_simulator.d.ts +1 -1
  99. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  100. package/dest/simulators/lending_simulator.js +6 -6
  101. package/dest/simulators/token_simulator.d.ts +1 -1
  102. package/dest/simulators/token_simulator.d.ts.map +1 -1
  103. package/dest/simulators/token_simulator.js +3 -24
  104. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  105. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  106. package/dest/spartan/setup_test_wallets.js +130 -42
  107. package/dest/spartan/tx_metrics.d.ts +38 -2
  108. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  109. package/dest/spartan/tx_metrics.js +179 -5
  110. package/dest/spartan/utils/bot.d.ts +28 -0
  111. package/dest/spartan/utils/bot.d.ts.map +1 -0
  112. package/dest/spartan/utils/bot.js +142 -0
  113. package/dest/spartan/utils/chaos.d.ts +79 -0
  114. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  115. package/dest/spartan/utils/chaos.js +142 -0
  116. package/dest/spartan/utils/clients.d.ts +39 -0
  117. package/dest/spartan/utils/clients.d.ts.map +1 -0
  118. package/dest/spartan/utils/clients.js +90 -0
  119. package/dest/spartan/utils/config.d.ts +45 -0
  120. package/dest/spartan/utils/config.d.ts.map +1 -0
  121. package/dest/spartan/utils/config.js +23 -0
  122. package/dest/spartan/utils/health.d.ts +63 -0
  123. package/dest/spartan/utils/health.d.ts.map +1 -0
  124. package/dest/spartan/utils/health.js +202 -0
  125. package/dest/spartan/utils/helm.d.ts +15 -0
  126. package/dest/spartan/utils/helm.d.ts.map +1 -0
  127. package/dest/spartan/utils/helm.js +47 -0
  128. package/dest/spartan/utils/index.d.ts +11 -0
  129. package/dest/spartan/utils/index.d.ts.map +1 -0
  130. package/dest/spartan/utils/index.js +22 -0
  131. package/dest/spartan/utils/k8s.d.ts +128 -0
  132. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  133. package/dest/spartan/utils/k8s.js +381 -0
  134. package/dest/spartan/utils/nodes.d.ts +40 -0
  135. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  136. package/dest/spartan/utils/nodes.js +461 -0
  137. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  138. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  139. package/dest/spartan/utils/pod_logs.js +74 -0
  140. package/dest/spartan/utils/scripts.d.ts +30 -0
  141. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  142. package/dest/spartan/utils/scripts.js +81 -0
  143. package/dest/spartan/utils.d.ts +2 -260
  144. package/dest/spartan/utils.d.ts.map +1 -1
  145. package/dest/spartan/utils.js +1 -942
  146. package/dest/test-wallet/test_wallet.d.ts +84 -0
  147. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  148. package/dest/test-wallet/test_wallet.js +249 -0
  149. package/dest/test-wallet/utils.d.ts +41 -0
  150. package/dest/test-wallet/utils.d.ts.map +1 -0
  151. package/dest/test-wallet/utils.js +71 -0
  152. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  153. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  154. package/dest/test-wallet/wallet_worker_script.js +48 -0
  155. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  156. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  157. package/dest/test-wallet/worker_wallet.js +151 -0
  158. package/dest/test-wallet/worker_wallet_schema.d.ts +279 -0
  159. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  160. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  161. package/package.json +46 -43
  162. package/src/bench/client_flows/client_flows_benchmark.ts +36 -36
  163. package/src/bench/client_flows/config.ts +9 -1
  164. package/src/bench/utils.ts +15 -8
  165. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +36 -29
  166. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
  167. package/src/e2e_deploy_contract/deploy_test.ts +3 -3
  168. package/src/e2e_epochs/epochs_test.ts +140 -92
  169. package/src/e2e_fees/bridging_race.notest.ts +2 -5
  170. package/src/e2e_fees/fees_test.ts +29 -41
  171. package/src/e2e_l1_publisher/write_json.ts +3 -8
  172. package/src/e2e_nested_contract/nested_contract_test.ts +7 -7
  173. package/src/e2e_p2p/inactivity_slash_test.ts +7 -7
  174. package/src/e2e_p2p/p2p_network.ts +71 -44
  175. package/src/e2e_p2p/reqresp/utils.ts +256 -0
  176. package/src/e2e_p2p/shared.ts +92 -80
  177. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  178. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  179. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  180. package/src/e2e_token_contract/token_contract_test.ts +27 -12
  181. package/src/fixtures/authwit_proxy.ts +54 -0
  182. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  183. package/src/fixtures/e2e_prover_test.ts +49 -63
  184. package/src/fixtures/elu_monitor.ts +126 -0
  185. package/src/fixtures/fixtures.ts +10 -0
  186. package/src/fixtures/get_bb_config.ts +7 -6
  187. package/src/fixtures/ha_setup.ts +186 -0
  188. package/src/fixtures/index.ts +1 -0
  189. package/src/fixtures/setup.ts +144 -244
  190. package/src/fixtures/setup_p2p_test.ts +48 -52
  191. package/src/fixtures/token_utils.ts +7 -6
  192. package/src/guides/up_quick_start.sh +3 -3
  193. package/src/legacy-jest-resolver.cjs +135 -0
  194. package/src/shared/cross_chain_test_harness.ts +24 -34
  195. package/src/shared/gas_portal_test_harness.ts +2 -2
  196. package/src/shared/index.ts +1 -0
  197. package/src/shared/jest_setup.ts +51 -1
  198. package/src/shared/mock_state_view.ts +188 -0
  199. package/src/shared/submit-transactions.ts +11 -16
  200. package/src/shared/uniswap_l1_l2.ts +49 -51
  201. package/src/simulators/lending_simulator.ts +10 -6
  202. package/src/simulators/token_simulator.ts +6 -30
  203. package/src/spartan/setup_test_wallets.ts +183 -26
  204. package/src/spartan/tx_metrics.ts +153 -8
  205. package/src/spartan/utils/bot.ts +188 -0
  206. package/src/spartan/utils/chaos.ts +253 -0
  207. package/src/spartan/utils/clients.ts +100 -0
  208. package/src/spartan/utils/config.ts +29 -0
  209. package/src/spartan/utils/health.ts +255 -0
  210. package/src/spartan/utils/helm.ts +84 -0
  211. package/src/spartan/utils/index.ts +71 -0
  212. package/src/spartan/utils/k8s.ts +535 -0
  213. package/src/spartan/utils/nodes.ts +543 -0
  214. package/src/spartan/utils/pod_logs.ts +99 -0
  215. package/src/spartan/utils/scripts.ts +99 -0
  216. package/src/spartan/utils.ts +1 -1246
  217. package/src/test-wallet/test_wallet.ts +351 -0
  218. package/src/test-wallet/utils.ts +112 -0
  219. package/src/test-wallet/wallet_worker_script.ts +60 -0
  220. package/src/test-wallet/worker_wallet.ts +214 -0
  221. 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
20
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
19
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
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,6 +181,8 @@ 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;
196
188
  /** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
@@ -199,6 +191,11 @@ export type SetupOptions = {
199
191
  anvilAccounts?: number;
200
192
  /** Port to start anvil (defaults to 8545) */
201
193
  anvilPort?: number;
194
+ /**
195
+ * Number of slots per epoch for Anvil's finality simulation.
196
+ * Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
197
+ */
198
+ anvilSlotsInAnEpoch?: number;
202
199
  /** Key to use for publishing L1 contracts */
203
200
  l1PublisherKey?: SecretValue<`0x${string}`>;
204
201
  /** ZkPassport configuration (domain, scope, mock verifier) */
@@ -209,6 +206,8 @@ export type SetupOptions = {
209
206
  skipAccountDeployment?: boolean;
210
207
  /** L1 contracts deployment arguments. */
211
208
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
209
+ /** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
210
+ walletMinFeePadding?: number;
212
211
  } & Partial<AztecNodeConfig>;
213
212
 
214
213
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -216,14 +215,14 @@ export type EndToEndContext = {
216
215
  /** The Anvil instance (only set if anvil was started locally). */
217
216
  anvil: Anvil | undefined;
218
217
  /** 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) */
218
+ aztecNode: AztecNode & AztecNodeDebug;
219
+ /** The Aztec Node as a service. */
220
+ aztecNodeService: AztecNodeService;
221
+ /** Client to the Aztec Node admin interface. */
222
+ aztecNodeAdmin: AztecNodeAdmin;
223
+ /** The aztec node running the prover node subsystem (only set if startProverNode is true). */
224
+ proverNode: AztecNodeService | undefined;
225
+ /** A client to the sequencer service. */
227
226
  sequencer: SequencerClient | undefined;
228
227
  /** Return values from deployAztecL1Contracts function. */
229
228
  deployL1ContractsValues: DeployAztecL1ContractsReturnType;
@@ -243,97 +242,30 @@ export type EndToEndContext = {
243
242
  cheatCodes: CheatCodes;
244
243
  /** The cheat codes for L1 */
245
244
  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;
245
+ /** The anvil test watcher. */
246
+ watcher: AnvilTestWatcher;
247
+ /** Allows tweaking current system time, used by the epoch cache only. */
248
+ dateProvider: TestDateProvider;
250
249
  /** Telemetry client */
251
- telemetryClient: TelemetryClient | undefined;
250
+ telemetryClient: TelemetryClient;
252
251
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
253
252
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
254
- /** Prefilled public data used for setting up nodes. */
255
- prefilledPublicData: PublicDataTreeLeaf[] | undefined;
253
+ /** Delayer for sequencer L1 txs (only when enableDelayer is true). */
254
+ sequencerDelayer: Delayer | undefined;
255
+ /** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
256
+ proverDelayer: Delayer | undefined;
257
+ /** Genesis data used for setting up nodes. */
258
+ genesis: GenesisData | undefined;
256
259
  /** ACVM config (only set if running locally). */
257
260
  acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
258
261
  /** BB config (only set if running locally). */
259
262
  bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
260
263
  /** Directory to cleanup on teardown. */
261
- directoryToCleanup: string | undefined;
264
+ directoryToCleanup: string;
262
265
  /** Function to stop the started services. */
263
266
  teardown: () => Promise<void>;
264
267
  };
265
268
 
266
- /**
267
- * Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
268
- */
269
- async function setupWithRemoteEnvironment(
270
- account: HDAccount | PrivateKeyAccount,
271
- config: AztecNodeConfig,
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
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
293
- const teardown = () => Promise.resolve();
294
-
295
- logger.verbose('Populating wallet from already registered accounts...');
296
- const initialFundedAccounts = await getInitialTestAccountsData();
297
-
298
- if (initialFundedAccounts.length < numberOfAccounts) {
299
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
300
- }
301
-
302
- const testAccounts = await Promise.all(
303
- initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
304
- const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
305
- return accountManager.address;
306
- }),
307
- );
308
-
309
- return {
310
- anvil: undefined,
311
- aztecNode,
312
- aztecNodeService: undefined,
313
- aztecNodeAdmin: undefined,
314
- sequencer: undefined,
315
- proverNode: undefined,
316
- deployL1ContractsValues,
317
- config,
318
- aztecNodeConfig: config,
319
- initialFundedAccounts,
320
- wallet,
321
- accounts: testAccounts,
322
- logger,
323
- cheatCodes,
324
- ethCheatCodes,
325
- prefilledPublicData: undefined,
326
- mockGossipSubNetwork: undefined,
327
- watcher: undefined,
328
- dateProvider: undefined,
329
- telemetryClient: undefined,
330
- acvmConfig: undefined,
331
- bbConfig: undefined,
332
- directoryToCleanup: undefined,
333
- teardown,
334
- };
335
- }
336
-
337
269
  /**
338
270
  * Sets up the environment for the end-to-end tests.
339
271
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
@@ -349,7 +281,7 @@ export async function setup(
349
281
  let anvil: Anvil | undefined;
350
282
  try {
351
283
  opts.aztecTargetCommitteeSize ??= 0;
352
- opts.slasherFlavor ??= 'none';
284
+ opts.slasherEnabled ??= false;
353
285
 
354
286
  const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
355
287
  // use initialValidators for the node config
@@ -361,8 +293,12 @@ export async function setup(
361
293
  config.realProofs = !!opts.realProofs;
362
294
  // Only enforce the time table if requested
363
295
  config.enforceTimeTable = !!opts.enforceTimeTable;
296
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
297
+ config.enableDelayer = true;
364
298
  config.listenAddress = '127.0.0.1';
365
299
 
300
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
301
+
366
302
  const logger = getLogger();
367
303
 
368
304
  // Create a temp directory for any services that need it and cleanup later
@@ -372,20 +308,18 @@ export async function setup(
372
308
  config.dataDirectory = directoryToCleanup;
373
309
  }
374
310
 
311
+ const dateProvider = new TestDateProvider();
312
+
375
313
  if (!config.l1RpcUrls?.length) {
376
314
  if (!isAnvilTestChain(chain.id)) {
377
315
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
378
316
  }
379
- if (AZTEC_NODE_URL) {
380
- throw new Error(
381
- `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`,
382
- );
383
- }
384
-
385
317
  const res = await startAnvil({
386
318
  l1BlockTime: opts.ethereumSlotDuration,
387
319
  accounts: opts.anvilAccounts,
388
- port: opts.anvilPort,
320
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
321
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
322
+ dateProvider,
389
323
  });
390
324
  anvil = res.anvil;
391
325
  config.l1RpcUrls = [res.rpcUrl];
@@ -397,8 +331,6 @@ export async function setup(
397
331
  logger.info(`Logging metrics to ${filename}`);
398
332
  setupMetricsLogger(filename);
399
333
  }
400
-
401
- const dateProvider = new TestDateProvider();
402
334
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
403
335
 
404
336
  if (opts.stateLoad) {
@@ -416,11 +348,11 @@ export async function setup(
416
348
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
417
349
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
418
350
  } else if (
419
- config.publisherPrivateKeys &&
420
- config.publisherPrivateKeys.length > 0 &&
421
- config.publisherPrivateKeys[0].getValue() != NULL_KEY
351
+ config.sequencerPublisherPrivateKeys &&
352
+ config.sequencerPublisherPrivateKeys.length > 0 &&
353
+ config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
422
354
  ) {
423
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
355
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
424
356
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
425
357
  } else if (!MNEMONIC) {
426
358
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -429,18 +361,13 @@ export async function setup(
429
361
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
430
362
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
431
363
  publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
432
- config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
364
+ config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
433
365
  }
434
366
 
435
367
  if (config.coinbase === undefined) {
436
368
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
437
369
  }
438
370
 
439
- if (AZTEC_NODE_URL) {
440
- // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
441
- return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
442
- }
443
-
444
371
  // Determine which addresses to fund in genesis
445
372
  const initialFundedAccounts =
446
373
  opts.initialFundedAccounts ??
@@ -453,10 +380,12 @@ export async function setup(
453
380
  addressesToFund.push(sponsoredFPCAddress);
454
381
  }
455
382
 
456
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
383
+ const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
384
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
457
385
  addressesToFund,
458
386
  opts.initialAccountFeeJuice,
459
387
  opts.genesisPublicData,
388
+ genesisTimestamp,
460
389
  );
461
390
 
462
391
  const wasAutomining = await ethCheatCodes.isAutoMining();
@@ -497,7 +426,13 @@ export async function setup(
497
426
  if (enableAutomine) {
498
427
  await ethCheatCodes.setAutomine(false);
499
428
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
500
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
429
+ }
430
+
431
+ // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
432
+ // ahead of system time due to the local-network watcher warping time forward on each filled slot.
433
+ // When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
434
+ if (!anvil) {
435
+ dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
501
436
  }
502
437
 
503
438
  if (opts.l2StartTime) {
@@ -536,10 +471,10 @@ export async function setup(
536
471
  }
537
472
 
538
473
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
539
- let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
474
+ let p2pClientDeps: P2PClientDeps | undefined = undefined;
540
475
 
541
476
  if (opts.mockGossipSubNetwork) {
542
- mockGossipSubNetwork = new MockGossipSubNetwork();
477
+ mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
543
478
  p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
544
479
  }
545
480
 
@@ -567,44 +502,48 @@ export async function setup(
567
502
  }
568
503
  }
569
504
 
570
- const aztecNodeService = await AztecNodeService.createAndSync(
571
- config,
572
- { dateProvider, telemetry: telemetryClient, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
573
- { prefilledPublicData },
505
+ const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
506
+ AztecNodeService.createAndSync(config, { dateProvider, telemetry: telemetryClient, p2pClientDeps }, { genesis }),
574
507
  );
575
508
  const sequencerClient = aztecNodeService.getSequencer();
576
509
 
577
- if (sequencerClient) {
578
- const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
579
- publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
580
- }
581
-
582
- let proverNode: ProverNode | undefined = undefined;
510
+ let proverNode: AztecNodeService | undefined = undefined;
583
511
  if (opts.startProverNode) {
584
512
  logger.verbose('Creating and syncing a simulated prover node...');
585
513
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
586
514
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
587
515
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
588
- const proverNodeConfig = {
589
- ...config.proverNodeConfig,
590
- dataDirectory: proverNodeDataDirectory,
591
- p2pEnabled: false,
516
+
517
+ const p2pClientDeps: Partial<P2PClientDeps> = {
518
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
519
+ rpcTxProviders: [aztecNodeService],
592
520
  };
593
- proverNode = await createAndSyncProverNode(
521
+
522
+ ({ proverNode } = await createAndSyncProverNode(
594
523
  proverNodePrivateKeyHex,
595
524
  config,
596
- proverNodeConfig,
597
- aztecNodeService,
598
- prefilledPublicData,
599
- );
525
+ {
526
+ ...config.proverNodeConfig,
527
+ dataDirectory: proverNodeDataDirectory,
528
+ },
529
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
530
+ { genesis },
531
+ ));
600
532
  }
601
533
 
534
+ const sequencerDelayer = sequencerClient?.getDelayer();
535
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
536
+
602
537
  logger.verbose('Creating a pxe...');
603
538
  const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
604
539
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
605
540
  // For tests we only want proving enabled if specifically requested
606
541
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
607
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
542
+ const wallet = await TestWallet.create(aztecNodeService, pxeConfig, { loggerActorLabel: 'pxe-0' });
543
+
544
+ if (opts.walletMinFeePadding !== undefined) {
545
+ wallet.setMinFeePadding(opts.walletMinFeePadding);
546
+ }
608
547
 
609
548
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
610
549
 
@@ -629,7 +568,7 @@ export async function setup(
629
568
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
630
569
  );
631
570
  const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
632
- const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNodeService, accountsData);
571
+ const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
633
572
  accounts = accountManagers.map(accountManager => accountManager.address);
634
573
  } else if (needsEmptyBlock) {
635
574
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
@@ -672,7 +611,7 @@ export async function setup(
672
611
  logger.error(`Error during e2e test teardown`, err);
673
612
  } finally {
674
613
  try {
675
- await telemetryClient?.stop();
614
+ await telemetryClient.stop();
676
615
  } catch (err) {
677
616
  logger.error(`Error during telemetry client stop`, err);
678
617
  }
@@ -693,8 +632,10 @@ export async function setup(
693
632
  initialFundedAccounts,
694
633
  logger,
695
634
  mockGossipSubNetwork,
696
- prefilledPublicData,
635
+ genesis,
697
636
  proverNode,
637
+ sequencerDelayer,
638
+ proverDelayer,
698
639
  sequencer: sequencerClient,
699
640
  teardown,
700
641
  telemetryClient,
@@ -778,93 +719,55 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
778
719
  );
779
720
  }
780
721
 
722
+ /**
723
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
724
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
725
+ */
781
726
  export function createAndSyncProverNode(
782
727
  proverNodePrivateKey: `0x${string}`,
783
- aztecNodeConfig: AztecNodeConfig,
784
- proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & { dontStart?: boolean },
785
- aztecNode: AztecNode | undefined,
786
- prefilledPublicData: PublicDataTreeLeaf[] = [],
787
- proverNodeDeps: ProverNodeDeps = {},
788
- ) {
789
- return withLogNameSuffix('prover-node', async () => {
790
- const aztecNodeTxProvider = aztecNode && {
791
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
792
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
793
- stop: () => Promise.resolve(),
794
- };
795
-
796
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
797
-
798
- const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
799
- const archiver = await createArchiver(
800
- archiverConfig,
801
- { blobClient, dateProvider: proverNodeDeps.dateProvider },
802
- { blockUntilSync: true },
803
- );
804
-
805
- const proverConfig: ProverNodeConfig = {
806
- ...aztecNodeConfig,
807
- txCollectionNodeRpcUrls: [],
808
- realProofs: false,
809
- proverAgentCount: 2,
810
- publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
811
- proverNodeMaxPendingJobs: 10,
812
- proverNodeMaxParallelBlocksPerEpoch: 32,
813
- proverNodePollingIntervalMs: 200,
814
- txGatheringIntervalMs: 1000,
815
- txGatheringBatchSize: 10,
816
- txGatheringMaxParallelRequestsPerNode: 10,
817
- txGatheringTimeoutMs: 24_000,
818
- proverNodeFailedEpochStore: undefined,
819
- proverId: EthAddress.fromNumber(1),
820
- proverNodeEpochProvingDelayMs: undefined,
821
- ...proverNodeConfig,
822
- };
823
-
824
- const l1TxUtils = createDelayedL1TxUtils(
825
- aztecNodeConfig,
826
- proverNodePrivateKey,
827
- 'prover-node',
828
- proverNodeDeps.dateProvider,
728
+ baseConfig: AztecNodeConfig,
729
+ configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
730
+ deps: {
731
+ telemetry?: TelemetryClient;
732
+ dateProvider: DateProvider;
733
+ p2pClientDeps?: P2PClientDeps;
734
+ },
735
+ options: { genesis?: GenesisData; dontStart?: boolean },
736
+ ): Promise<{ proverNode: AztecNodeService }> {
737
+ return withLoggerBindings({ actor: 'prover-0' }, async () => {
738
+ const proverNode = await AztecNodeService.createAndSync(
739
+ {
740
+ ...baseConfig,
741
+ ...configOverrides,
742
+ p2pPort: 0,
743
+ enableProverNode: true,
744
+ disableValidator: true,
745
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
746
+ },
747
+ deps,
748
+ { genesis: options.genesis, dontStartProverNode: options.dontStart },
829
749
  );
830
750
 
831
- const proverNode = await createProverNode(
832
- proverConfig,
833
- { ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
834
- { prefilledPublicData },
835
- );
836
- getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
837
- if (!proverNodeConfig.dontStart) {
838
- await proverNode.start();
751
+ if (!proverNode.getProverNode()) {
752
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
839
753
  }
840
- return proverNode;
841
- });
842
- }
843
-
844
- function createDelayedL1TxUtils(
845
- aztecNodeConfig: AztecNodeConfig,
846
- privateKey: `0x${string}`,
847
- logName: string,
848
- dateProvider?: DateProvider,
849
- ) {
850
- const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
851
754
 
852
- const log = createLogger(logName);
853
- const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
854
- l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
855
- return l1TxUtils;
755
+ getLogger().info(`Created and synced prover node`);
756
+ return { proverNode };
757
+ });
856
758
  }
857
759
 
858
760
  export type BalancesFn = ReturnType<typeof getBalancesFn>;
859
761
  export function getBalancesFn(
860
762
  symbol: string,
861
763
  method: ContractMethod,
862
- from: AztecAddress,
863
764
  logger: any,
864
765
  ): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
865
766
  const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
866
767
  const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
867
- const b = await Promise.all(addresses.map(address => method(address).simulate({ from })));
768
+ const b = await Promise.all(
769
+ addresses.map(async address => (await method(address).simulate({ from: address })).result),
770
+ );
868
771
  const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
869
772
  logger.verbose(debugString);
870
773
  return b;
@@ -921,13 +824,11 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
921
824
  ).map(contractMetadata => contractMetadata.instance);
922
825
  const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
923
826
  if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
924
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
925
- .send({ from: accountsToDeploy[0] })
926
- .wait();
827
+ await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
927
828
  }
928
829
  const requests = instances.map(instance => publishInstance(wallet, instance!));
929
830
  const batch = new BatchCall(wallet, requests);
930
- await batch.send({ from: accountsToDeploy[0] }).wait();
831
+ await batch.send({ from: accountsToDeploy[0] });
931
832
  }
932
833
 
933
834
  /**
@@ -935,7 +836,7 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
935
836
  * Returns deployed account data that can be used by tests.
936
837
  */
937
838
  export const deployAccounts =
938
- (numberOfAccounts: number, logger: Logger) =>
839
+ (numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<DeployInteractionWaitOptions>>) =>
939
840
  async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
940
841
  if (initialFundedAccounts.length < numberOfAccounts) {
941
842
  throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
@@ -951,12 +852,11 @@ export const deployAccounts =
951
852
  deployedAccounts[i].signingKey,
952
853
  );
953
854
  const deployMethod = await accountManager.getDeployMethod();
954
- await deployMethod
955
- .send({
956
- from: AztecAddress.ZERO,
957
- skipClassPublication: i !== 0, // Publish the contract class at most once.
958
- })
959
- .wait();
855
+ await deployMethod.send({
856
+ from: NO_FROM,
857
+ skipClassPublication: i !== 0, // Publish the contract class at most once.
858
+ ...deployOptions,
859
+ });
960
860
  }
961
861
 
962
862
  return { deployedAccounts };
@@ -986,7 +886,7 @@ export async function publicDeployAccounts(
986
886
 
987
887
  const batch = new BatchCall(wallet, calls);
988
888
 
989
- const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
889
+ const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
990
890
  if (waitUntilProven) {
991
891
  if (!node) {
992
892
  throw new Error('Need to provide an AztecNode to wait for proven.');