@aztec/end-to-end 0.0.1-commit.e6bd8901 → 0.0.1-commit.ec5f612

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 (172) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +3 -3
  4. package/dest/bench/client_flows/config.d.ts +2 -2
  5. package/dest/bench/client_flows/config.d.ts.map +1 -1
  6. package/dest/bench/client_flows/config.js +18 -0
  7. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
  8. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  9. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +10 -0
  10. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
  11. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  12. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -2
  13. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  14. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  15. package/dest/e2e_epochs/epochs_test.d.ts +15 -7
  16. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  17. package/dest/e2e_epochs/epochs_test.js +85 -41
  18. package/dest/e2e_fees/fees_test.d.ts +2 -2
  19. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  20. package/dest/e2e_fees/fees_test.js +6 -6
  21. package/dest/e2e_l1_publisher/write_json.d.ts +3 -2
  22. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  23. package/dest/e2e_l1_publisher/write_json.js +1 -7
  24. package/dest/e2e_p2p/p2p_network.d.ts +2 -2
  25. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  26. package/dest/e2e_p2p/p2p_network.js +16 -2
  27. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  28. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  29. package/dest/e2e_p2p/reqresp/utils.js +177 -0
  30. package/dest/e2e_p2p/shared.d.ts +2 -2
  31. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  32. package/dest/e2e_p2p/shared.js +7 -3
  33. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  34. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  35. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  36. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  37. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  38. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  39. package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
  40. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  41. package/dest/e2e_token_contract/token_contract_test.js +10 -0
  42. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  43. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  44. package/dest/fixtures/authwit_proxy.js +30 -0
  45. package/dest/fixtures/e2e_prover_test.d.ts +4 -4
  46. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  47. package/dest/fixtures/e2e_prover_test.js +28 -35
  48. package/dest/fixtures/elu_monitor.d.ts +21 -0
  49. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  50. package/dest/fixtures/elu_monitor.js +102 -0
  51. package/dest/fixtures/fixtures.d.ts +5 -1
  52. package/dest/fixtures/fixtures.d.ts.map +1 -1
  53. package/dest/fixtures/fixtures.js +6 -0
  54. package/dest/fixtures/ha_setup.d.ts +71 -0
  55. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  56. package/dest/fixtures/ha_setup.js +116 -0
  57. package/dest/fixtures/index.d.ts +2 -1
  58. package/dest/fixtures/index.d.ts.map +1 -1
  59. package/dest/fixtures/index.js +1 -0
  60. package/dest/fixtures/setup.d.ts +40 -24
  61. package/dest/fixtures/setup.d.ts.map +1 -1
  62. package/dest/fixtures/setup.js +79 -164
  63. package/dest/fixtures/setup_p2p_test.d.ts +16 -9
  64. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  65. package/dest/fixtures/setup_p2p_test.js +40 -29
  66. package/dest/fixtures/token_utils.d.ts +2 -2
  67. package/dest/fixtures/token_utils.d.ts.map +1 -1
  68. package/dest/fixtures/token_utils.js +3 -2
  69. package/dest/shared/index.d.ts +2 -1
  70. package/dest/shared/index.d.ts.map +1 -1
  71. package/dest/shared/index.js +1 -0
  72. package/dest/shared/jest_setup.js +10 -1
  73. package/dest/shared/mock_state_view.d.ts +86 -0
  74. package/dest/shared/mock_state_view.d.ts.map +1 -0
  75. package/dest/shared/mock_state_view.js +186 -0
  76. package/dest/shared/submit-transactions.d.ts +2 -2
  77. package/dest/shared/submit-transactions.d.ts.map +1 -1
  78. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  79. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  80. package/dest/shared/uniswap_l1_l2.js +8 -6
  81. package/dest/simulators/token_simulator.d.ts +1 -1
  82. package/dest/simulators/token_simulator.d.ts.map +1 -1
  83. package/dest/simulators/token_simulator.js +2 -23
  84. package/dest/spartan/setup_test_wallets.d.ts +9 -2
  85. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  86. package/dest/spartan/setup_test_wallets.js +31 -1
  87. package/dest/spartan/tx_metrics.d.ts +35 -1
  88. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  89. package/dest/spartan/tx_metrics.js +150 -0
  90. package/dest/spartan/utils/bot.d.ts +3 -2
  91. package/dest/spartan/utils/bot.d.ts.map +1 -1
  92. package/dest/spartan/utils/bot.js +2 -1
  93. package/dest/spartan/utils/config.d.ts +7 -1
  94. package/dest/spartan/utils/config.d.ts.map +1 -1
  95. package/dest/spartan/utils/config.js +3 -1
  96. package/dest/spartan/utils/index.d.ts +5 -4
  97. package/dest/spartan/utils/index.d.ts.map +1 -1
  98. package/dest/spartan/utils/index.js +4 -2
  99. package/dest/spartan/utils/k8s.d.ts +31 -1
  100. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  101. package/dest/spartan/utils/k8s.js +124 -0
  102. package/dest/spartan/utils/nodes.d.ts +14 -5
  103. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  104. package/dest/spartan/utils/nodes.js +204 -33
  105. package/dest/spartan/utils/scripts.d.ts +18 -4
  106. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  107. package/dest/spartan/utils/scripts.js +19 -4
  108. package/dest/test-wallet/test_wallet.d.ts +83 -0
  109. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  110. package/dest/test-wallet/test_wallet.js +214 -0
  111. package/dest/test-wallet/utils.d.ts +41 -0
  112. package/dest/test-wallet/utils.d.ts.map +1 -0
  113. package/dest/test-wallet/utils.js +71 -0
  114. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  115. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  116. package/dest/test-wallet/wallet_worker_script.js +48 -0
  117. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  118. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  119. package/dest/test-wallet/worker_wallet.js +151 -0
  120. package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
  121. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  122. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  123. package/package.json +43 -39
  124. package/src/bench/client_flows/client_flows_benchmark.ts +8 -12
  125. package/src/bench/client_flows/config.ts +9 -1
  126. package/src/bench/utils.ts +1 -1
  127. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +11 -2
  128. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
  129. package/src/e2e_deploy_contract/deploy_test.ts +3 -3
  130. package/src/e2e_epochs/epochs_test.ts +103 -72
  131. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  132. package/src/e2e_fees/fees_test.ts +12 -27
  133. package/src/e2e_l1_publisher/write_json.ts +1 -6
  134. package/src/e2e_nested_contract/nested_contract_test.ts +1 -1
  135. package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
  136. package/src/e2e_p2p/p2p_network.ts +29 -7
  137. package/src/e2e_p2p/reqresp/utils.ts +235 -0
  138. package/src/e2e_p2p/shared.ts +13 -3
  139. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  140. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  141. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  142. package/src/e2e_token_contract/token_contract_test.ts +11 -2
  143. package/src/fixtures/authwit_proxy.ts +50 -0
  144. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  145. package/src/fixtures/e2e_prover_test.ts +29 -39
  146. package/src/fixtures/elu_monitor.ts +126 -0
  147. package/src/fixtures/fixtures.ts +10 -0
  148. package/src/fixtures/ha_setup.ts +186 -0
  149. package/src/fixtures/index.ts +1 -0
  150. package/src/fixtures/setup.ts +103 -225
  151. package/src/fixtures/setup_p2p_test.ts +40 -44
  152. package/src/fixtures/token_utils.ts +2 -1
  153. package/src/guides/up_quick_start.sh +3 -3
  154. package/src/shared/index.ts +1 -0
  155. package/src/shared/jest_setup.ts +16 -1
  156. package/src/shared/mock_state_view.ts +188 -0
  157. package/src/shared/submit-transactions.ts +6 -2
  158. package/src/shared/uniswap_l1_l2.ts +9 -11
  159. package/src/simulators/token_simulator.ts +1 -29
  160. package/src/spartan/setup_test_wallets.ts +58 -4
  161. package/src/spartan/tx_metrics.ts +126 -0
  162. package/src/spartan/utils/bot.ts +4 -1
  163. package/src/spartan/utils/config.ts +2 -0
  164. package/src/spartan/utils/index.ts +7 -1
  165. package/src/spartan/utils/k8s.ts +160 -0
  166. package/src/spartan/utils/nodes.ts +251 -31
  167. package/src/spartan/utils/scripts.ts +43 -7
  168. package/src/test-wallet/test_wallet.ts +306 -0
  169. package/src/test-wallet/utils.ts +112 -0
  170. package/src/test-wallet/wallet_worker_script.ts +60 -0
  171. package/src/test-wallet/worker_wallet.ts +213 -0
  172. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -1,6 +1,5 @@
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';
5
4
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
6
5
  import {
@@ -13,10 +12,9 @@ import {
13
12
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
14
13
  import { Fr } from '@aztec/aztec.js/fields';
15
14
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
16
- import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
15
+ import type { AztecNode } from '@aztec/aztec.js/node';
17
16
  import type { Wallet } from '@aztec/aztec.js/wallet';
18
17
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
19
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
20
18
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
21
19
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
22
20
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -30,35 +28,27 @@ import {
30
28
  type ZKPassportArgs,
31
29
  deployAztecL1Contracts,
32
30
  } from '@aztec/ethereum/deploy-aztec-l1-contracts';
33
- import {
34
- DelayedTxUtils,
35
- EthCheatCodes,
36
- EthCheatCodesWithState,
37
- createDelayedL1TxUtilsFromViemWallet,
38
- startAnvil,
39
- } from '@aztec/ethereum/test';
31
+ import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
32
+ import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
40
33
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
41
34
  import { SecretValue } from '@aztec/foundation/config';
42
35
  import { randomBytes } from '@aztec/foundation/crypto/random';
43
36
  import { tryRmDir } from '@aztec/foundation/fs';
44
- import { withLogNameSuffix } from '@aztec/foundation/log';
37
+ import { withLoggerBindings } from '@aztec/foundation/log/server';
45
38
  import { retryUntil } from '@aztec/foundation/retry';
46
39
  import { sleep } from '@aztec/foundation/sleep';
47
40
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
48
- import type { DataStoreConfig } from '@aztec/kv-store/config';
49
41
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
50
42
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
51
43
  import type { P2PClientDeps } from '@aztec/p2p';
52
44
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
53
45
  import { protocolContractsHash } from '@aztec/protocol-contracts';
54
- import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
46
+ import type { ProverNodeConfig } from '@aztec/prover-node';
55
47
  import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
56
48
  import type { SequencerClient } from '@aztec/sequencer-client';
57
- import type { TestSequencerClient } from '@aztec/sequencer-client/test';
58
49
  import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
59
50
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
60
51
  import { tryStop } from '@aztec/stdlib/interfaces/server';
61
- import type { P2PClientType } from '@aztec/stdlib/p2p';
62
52
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
63
53
  import {
64
54
  type TelemetryClient,
@@ -67,7 +57,7 @@ import {
67
57
  initTelemetryClient,
68
58
  } from '@aztec/telemetry-client';
69
59
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
70
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
60
+ import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
71
61
  import { getGenesisValues } from '@aztec/world-state/testing';
72
62
 
73
63
  import type { Anvil } from '@viem/anvil';
@@ -84,6 +74,7 @@ import {
84
74
  } from 'viem/accounts';
85
75
  import { type Chain, foundry } from 'viem/chains';
86
76
 
77
+ import { TestWallet } from '../test-wallet/test_wallet.js';
87
78
  import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
88
79
  import { getACVMConfig } from './get_acvm_config.js';
89
80
  import { getBBConfig } from './get_bb_config.js';
@@ -92,9 +83,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
92
83
 
93
84
  export { startAnvil };
94
85
 
95
- const { AZTEC_NODE_URL = '' } = process.env;
96
- const getAztecUrl = () => AZTEC_NODE_URL;
97
-
98
86
  let telemetry: TelemetryClient | undefined = undefined;
99
87
  async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
100
88
  if (!telemetry) {
@@ -125,14 +113,14 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
125
113
  * @param aztecNode - An instance of Aztec Node.
126
114
  * @param opts - Partial configuration for the PXE.
127
115
  * @param logger - The logger to be used.
128
- * @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
116
+ * @param actor - Actor label to include in log output (e.g., 'pxe-test').
129
117
  * @returns A test wallet, logger and teardown function.
130
118
  */
131
119
  export async function setupPXEAndGetWallet(
132
120
  aztecNode: AztecNode,
133
121
  opts: Partial<PXEConfig> = {},
134
122
  logger = getLogger(),
135
- useLogSuffix = false,
123
+ actor?: string,
136
124
  ): Promise<{
137
125
  wallet: TestWallet;
138
126
  logger: Logger;
@@ -150,9 +138,7 @@ export async function setupPXEAndGetWallet(
150
138
 
151
139
  const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
152
140
 
153
- const wallet = await TestWallet.create(aztecNode, PXEConfig, {
154
- useLogSuffix,
155
- });
141
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
156
142
 
157
143
  return {
158
144
  wallet,
@@ -219,13 +205,13 @@ export type EndToEndContext = {
219
205
  anvil: Anvil | undefined;
220
206
  /** The Aztec Node service or client a connected to it. */
221
207
  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) */
208
+ /** The Aztec Node as a service. */
209
+ aztecNodeService: AztecNodeService;
210
+ /** Client to the Aztec Node admin interface. */
211
+ aztecNodeAdmin: AztecNodeAdmin;
212
+ /** The aztec node running the prover node subsystem (only set if startProverNode is true). */
213
+ proverNode: AztecNodeService | undefined;
214
+ /** A client to the sequencer service. */
229
215
  sequencer: SequencerClient | undefined;
230
216
  /** Return values from deployAztecL1Contracts function. */
231
217
  deployL1ContractsValues: DeployAztecL1ContractsReturnType;
@@ -245,14 +231,18 @@ export type EndToEndContext = {
245
231
  cheatCodes: CheatCodes;
246
232
  /** The cheat codes for L1 */
247
233
  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;
234
+ /** The anvil test watcher. */
235
+ watcher: AnvilTestWatcher;
236
+ /** Allows tweaking current system time, used by the epoch cache only. */
237
+ dateProvider: TestDateProvider;
252
238
  /** Telemetry client */
253
- telemetryClient: TelemetryClient | undefined;
239
+ telemetryClient: TelemetryClient;
254
240
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
255
241
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
242
+ /** Delayer for sequencer L1 txs (only when enableDelayer is true). */
243
+ sequencerDelayer: Delayer | undefined;
244
+ /** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
245
+ proverDelayer: Delayer | undefined;
256
246
  /** Prefilled public data used for setting up nodes. */
257
247
  prefilledPublicData: PublicDataTreeLeaf[] | undefined;
258
248
  /** ACVM config (only set if running locally). */
@@ -260,87 +250,11 @@ export type EndToEndContext = {
260
250
  /** BB config (only set if running locally). */
261
251
  bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
262
252
  /** Directory to cleanup on teardown. */
263
- directoryToCleanup: string | undefined;
253
+ directoryToCleanup: string;
264
254
  /** Function to stop the started services. */
265
255
  teardown: () => Promise<void>;
266
256
  };
267
257
 
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
258
  /**
345
259
  * Sets up the environment for the end-to-end tests.
346
260
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
@@ -368,8 +282,12 @@ export async function setup(
368
282
  config.realProofs = !!opts.realProofs;
369
283
  // Only enforce the time table if requested
370
284
  config.enforceTimeTable = !!opts.enforceTimeTable;
285
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
286
+ config.enableDelayer = true;
371
287
  config.listenAddress = '127.0.0.1';
372
288
 
289
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
290
+
373
291
  const logger = getLogger();
374
292
 
375
293
  // Create a temp directory for any services that need it and cleanup later
@@ -383,16 +301,10 @@ export async function setup(
383
301
  if (!isAnvilTestChain(chain.id)) {
384
302
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
385
303
  }
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
304
  const res = await startAnvil({
393
305
  l1BlockTime: opts.ethereumSlotDuration,
394
306
  accounts: opts.anvilAccounts,
395
- port: opts.anvilPort,
307
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
396
308
  });
397
309
  anvil = res.anvil;
398
310
  config.l1RpcUrls = [res.rpcUrl];
@@ -423,11 +335,11 @@ export async function setup(
423
335
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
424
336
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
425
337
  } else if (
426
- config.publisherPrivateKeys &&
427
- config.publisherPrivateKeys.length > 0 &&
428
- config.publisherPrivateKeys[0].getValue() != NULL_KEY
338
+ config.sequencerPublisherPrivateKeys &&
339
+ config.sequencerPublisherPrivateKeys.length > 0 &&
340
+ config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
429
341
  ) {
430
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
342
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
431
343
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
432
344
  } else if (!MNEMONIC) {
433
345
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -436,18 +348,13 @@ export async function setup(
436
348
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
437
349
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
438
350
  publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
439
- config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
351
+ config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
440
352
  }
441
353
 
442
354
  if (config.coinbase === undefined) {
443
355
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
444
356
  }
445
357
 
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
358
  // Determine which addresses to fund in genesis
452
359
  const initialFundedAccounts =
453
360
  opts.initialFundedAccounts ??
@@ -504,9 +411,14 @@ export async function setup(
504
411
  if (enableAutomine) {
505
412
  await ethCheatCodes.setAutomine(false);
506
413
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
507
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
508
414
  }
509
415
 
416
+ // Always sync dateProvider to L1 time after deploying L1 contracts, regardless of mining mode.
417
+ // In compose mode, L1 time may have drifted ahead of system time due to the local-network watcher
418
+ // warping time forward on each filled slot. Without this sync, the sequencer computes the wrong
419
+ // slot from its dateProvider and cannot propose blocks.
420
+ dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
421
+
510
422
  if (opts.l2StartTime) {
511
423
  await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
512
424
  }
@@ -543,7 +455,7 @@ export async function setup(
543
455
  }
544
456
 
545
457
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
546
- let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
458
+ let p2pClientDeps: P2PClientDeps | undefined = undefined;
547
459
 
548
460
  if (opts.mockGossipSubNetwork) {
549
461
  mockGossipSubNetwork = new MockGossipSubNetwork();
@@ -574,44 +486,48 @@ export async function setup(
574
486
  }
575
487
  }
576
488
 
577
- const aztecNodeService = await AztecNodeService.createAndSync(
578
- config,
579
- { dateProvider, telemetry: telemetryClient, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
580
- { prefilledPublicData },
489
+ const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
490
+ AztecNodeService.createAndSync(
491
+ config,
492
+ { dateProvider, telemetry: telemetryClient, p2pClientDeps },
493
+ { prefilledPublicData },
494
+ ),
581
495
  );
582
496
  const sequencerClient = aztecNodeService.getSequencer();
583
497
 
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;
498
+ let proverNode: AztecNodeService | undefined = undefined;
590
499
  if (opts.startProverNode) {
591
500
  logger.verbose('Creating and syncing a simulated prover node...');
592
501
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
593
502
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
594
503
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
595
- const proverNodeConfig = {
596
- ...config.proverNodeConfig,
597
- dataDirectory: proverNodeDataDirectory,
598
- p2pEnabled: false,
504
+
505
+ const p2pClientDeps: Partial<P2PClientDeps> = {
506
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
507
+ rpcTxProviders: [aztecNodeService],
599
508
  };
600
- proverNode = await createAndSyncProverNode(
509
+
510
+ ({ proverNode } = await createAndSyncProverNode(
601
511
  proverNodePrivateKeyHex,
602
512
  config,
603
- proverNodeConfig,
604
- aztecNodeService,
605
- prefilledPublicData,
606
- );
513
+ {
514
+ ...config.proverNodeConfig,
515
+ dataDirectory: proverNodeDataDirectory,
516
+ },
517
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
518
+ { prefilledPublicData },
519
+ ));
607
520
  }
608
521
 
522
+ const sequencerDelayer = sequencerClient?.getDelayer();
523
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
524
+
609
525
  logger.verbose('Creating a pxe...');
610
526
  const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
611
527
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
612
528
  // For tests we only want proving enabled if specifically requested
613
529
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
614
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
530
+ const wallet = await TestWallet.create(aztecNodeService, pxeConfig, { loggerActorLabel: 'pxe-0' });
615
531
 
616
532
  if (opts.walletMinFeePadding !== undefined) {
617
533
  wallet.setMinFeePadding(opts.walletMinFeePadding);
@@ -683,7 +599,7 @@ export async function setup(
683
599
  logger.error(`Error during e2e test teardown`, err);
684
600
  } finally {
685
601
  try {
686
- await telemetryClient?.stop();
602
+ await telemetryClient.stop();
687
603
  } catch (err) {
688
604
  logger.error(`Error during telemetry client stop`, err);
689
605
  }
@@ -706,6 +622,8 @@ export async function setup(
706
622
  mockGossipSubNetwork,
707
623
  prefilledPublicData,
708
624
  proverNode,
625
+ sequencerDelayer,
626
+ proverDelayer,
709
627
  sequencer: sequencerClient,
710
628
  teardown,
711
629
  telemetryClient,
@@ -789,93 +707,53 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
789
707
  );
790
708
  }
791
709
 
710
+ /**
711
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
712
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
713
+ */
792
714
  export function createAndSyncProverNode(
793
715
  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,
716
+ baseConfig: AztecNodeConfig,
717
+ configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
718
+ deps: {
719
+ telemetry?: TelemetryClient;
720
+ dateProvider: DateProvider;
721
+ p2pClientDeps?: P2PClientDeps;
722
+ },
723
+ options: { prefilledPublicData: PublicDataTreeLeaf[]; dontStart?: boolean },
724
+ ): Promise<{ proverNode: AztecNodeService }> {
725
+ return withLoggerBindings({ actor: 'prover-0' }, async () => {
726
+ const proverNode = await AztecNodeService.createAndSync(
727
+ {
728
+ ...baseConfig,
729
+ ...configOverrides,
730
+ p2pPort: 0,
731
+ enableProverNode: true,
732
+ disableValidator: true,
733
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
734
+ },
735
+ deps,
736
+ { ...options, dontStartProverNode: options.dontStart },
840
737
  );
841
738
 
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();
739
+ if (!proverNode.getProverNode()) {
740
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
850
741
  }
851
- return proverNode;
852
- });
853
- }
854
742
 
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;
743
+ getLogger().info(`Created and synced prover node`);
744
+ return { proverNode };
745
+ });
867
746
  }
868
747
 
869
748
  export type BalancesFn = ReturnType<typeof getBalancesFn>;
870
749
  export function getBalancesFn(
871
750
  symbol: string,
872
751
  method: ContractMethod,
873
- from: AztecAddress,
874
752
  logger: any,
875
753
  ): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
876
754
  const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
877
755
  const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
878
- const b = await Promise.all(addresses.map(address => method(address).simulate({ from })));
756
+ const b = await Promise.all(addresses.map(address => method(address).simulate({ from: address })));
879
757
  const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
880
758
  logger.verbose(debugString);
881
759
  return b;