@aztec/end-to-end 0.85.0 → 0.86.0-nightly.20250426

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 (61) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  2. package/dest/bench/client_flows/client_flows_benchmark.js +6 -7
  3. package/dest/bench/client_flows/config.js +3 -3
  4. package/dest/bench/client_flows/data_extractor.js +12 -7
  5. package/dest/bench/utils.d.ts.map +1 -1
  6. package/dest/bench/utils.js +2 -0
  7. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
  8. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  9. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +11 -11
  10. package/dest/e2e_epochs/epochs_test.d.ts +3 -3
  11. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  12. package/dest/e2e_epochs/epochs_test.js +4 -2
  13. package/dest/e2e_fees/fees_test.d.ts +4 -0
  14. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  15. package/dest/e2e_fees/fees_test.js +22 -10
  16. package/dest/e2e_p2p/p2p_network.d.ts +67 -72
  17. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  18. package/dest/e2e_p2p/p2p_network.js +20 -61
  19. package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
  20. package/dest/e2e_prover/e2e_prover_test.js +10 -9
  21. package/dest/fixtures/l1_to_l2_messaging.d.ts +2 -3
  22. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  23. package/dest/fixtures/l1_to_l2_messaging.js +3 -3
  24. package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
  25. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  26. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  27. package/dest/fixtures/snapshot_manager.js +15 -13
  28. package/dest/fixtures/utils.d.ts +5 -2
  29. package/dest/fixtures/utils.d.ts.map +1 -1
  30. package/dest/fixtures/utils.js +70 -62
  31. package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
  32. package/dest/shared/capture_private_execution_steps.js +3 -17
  33. package/dest/shared/cross_chain_test_harness.d.ts +7 -11
  34. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  35. package/dest/shared/cross_chain_test_harness.js +14 -16
  36. package/dest/shared/gas_portal_test_harness.d.ts +6 -11
  37. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  38. package/dest/shared/gas_portal_test_harness.js +8 -10
  39. package/dest/shared/uniswap_l1_l2.d.ts +3 -5
  40. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  41. package/dest/shared/uniswap_l1_l2.js +18 -19
  42. package/dest/spartan/setup_test_wallets.js +3 -3
  43. package/package.json +34 -35
  44. package/src/bench/client_flows/client_flows_benchmark.ts +6 -8
  45. package/src/bench/client_flows/config.ts +3 -3
  46. package/src/bench/client_flows/data_extractor.ts +10 -6
  47. package/src/bench/utils.ts +2 -0
  48. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +14 -18
  49. package/src/e2e_epochs/epochs_test.ts +9 -5
  50. package/src/e2e_fees/fees_test.ts +32 -10
  51. package/src/e2e_p2p/p2p_network.ts +28 -74
  52. package/src/e2e_prover/e2e_prover_test.ts +10 -14
  53. package/src/fixtures/l1_to_l2_messaging.ts +5 -14
  54. package/src/fixtures/setup_l1_contracts.ts +1 -2
  55. package/src/fixtures/snapshot_manager.ts +11 -13
  56. package/src/fixtures/utils.ts +66 -64
  57. package/src/shared/capture_private_execution_steps.ts +3 -19
  58. package/src/shared/cross_chain_test_harness.ts +14 -31
  59. package/src/shared/gas_portal_test_harness.ts +9 -14
  60. package/src/shared/uniswap_l1_l2.ts +25 -43
  61. package/src/spartan/setup_test_wallets.ts +3 -3
@@ -2,8 +2,13 @@ import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
2
2
  import type { InitialAccountData } from '@aztec/accounts/testing';
3
3
  import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
4
4
  import type { AccountWalletWithSecretKey } from '@aztec/aztec.js';
5
- import { RollupContract, getExpectedAddress, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
6
- import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
5
+ import {
6
+ type ExtendedViemWalletClient,
7
+ L1TxUtils,
8
+ RollupContract,
9
+ getExpectedAddress,
10
+ getL1ContractsConfigEnvVars,
11
+ } from '@aztec/ethereum';
7
12
  import { ChainMonitor, EthCheatCodesWithState } from '@aztec/ethereum/test';
8
13
  import { type Logger, createLogger } from '@aztec/foundation/log';
9
14
  import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
@@ -66,10 +71,6 @@ export class P2PNetworkTest {
66
71
 
67
72
  public bootstrapNode?: BootstrapNode;
68
73
 
69
- private cleanupInterval: NodeJS.Timeout | undefined = undefined;
70
-
71
- private gasUtils: L1TxUtilsWithBlobs | undefined = undefined;
72
-
73
74
  constructor(
74
75
  testName: string,
75
76
  public bootstrapNodeEnr: string,
@@ -147,32 +148,6 @@ export class P2PNetworkTest {
147
148
  return this.deployedAccounts[0];
148
149
  }
149
150
 
150
- /**
151
- * Start a loop to sync the mock system time with the L1 block time
152
- */
153
- public startSyncMockSystemTimeInterval() {
154
- this.cleanupInterval = setInterval(() => {
155
- void this.syncMockSystemTime().catch(err => this.logger.error('Error syncing mock system time', err));
156
- }, l1ContractsConfig.aztecSlotDuration * 1000);
157
- }
158
-
159
- /**
160
- * When using fake timers, we need to keep the system and anvil clocks in sync.
161
- */
162
- public async syncMockSystemTime() {
163
- this.logger.info('Syncing mock system time');
164
- const { dateProvider, deployL1ContractsValues } = this.ctx!;
165
- // Send a tx and only update the time after the tx is mined, as eth time is not continuous
166
- const { receipt } = await this.gasUtils!.sendAndMonitorTransaction({
167
- to: this.baseAccount.address,
168
- data: '0x',
169
- value: 1n,
170
- });
171
- const timestamp = await deployL1ContractsValues.publicClient.getBlock({ blockNumber: receipt.blockNumber });
172
- this.logger.info(`Timestamp: ${timestamp.timestamp}`);
173
- dateProvider.setTime(Number(timestamp.timestamp) * 1000);
174
- }
175
-
176
151
  async addBootstrapNode() {
177
152
  await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
178
153
  const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
@@ -215,14 +190,13 @@ export class P2PNetworkTest {
215
190
 
216
191
  async applyBaseSnapshots() {
217
192
  await this.addBootstrapNode();
218
-
219
193
  await this.snapshotManager.snapshot(
220
194
  'add-validators',
221
195
  async ({ deployL1ContractsValues, aztecNodeConfig, dateProvider }) => {
222
196
  const rollup = getContract({
223
197
  address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
224
198
  abi: RollupAbi,
225
- client: deployL1ContractsValues.walletClient,
199
+ client: deployL1ContractsValues.l1Client,
226
200
  });
227
201
 
228
202
  this.logger.verbose(`Adding ${this.numberOfNodes} validators`);
@@ -230,26 +204,23 @@ export class P2PNetworkTest {
230
204
  const stakingAsset = getContract({
231
205
  address: deployL1ContractsValues.l1ContractAddresses.stakingAssetAddress.toString(),
232
206
  abi: TestERC20Abi,
233
- client: deployL1ContractsValues.walletClient,
207
+ client: deployL1ContractsValues.l1Client,
234
208
  });
235
209
 
236
210
  const stakeNeeded = l1ContractsConfig.minimumStake * BigInt(this.numberOfNodes);
237
211
  await Promise.all(
238
212
  [
239
- await stakingAsset.write.mint(
240
- [deployL1ContractsValues.walletClient.account.address, stakeNeeded],
241
- {} as any,
242
- ),
213
+ await stakingAsset.write.mint([deployL1ContractsValues.l1Client.account.address, stakeNeeded], {} as any),
243
214
  await stakingAsset.write.approve(
244
215
  [deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(), stakeNeeded],
245
216
  {} as any,
246
217
  ),
247
- ].map(txHash => deployL1ContractsValues.publicClient.waitForTransactionReceipt({ hash: txHash })),
218
+ ].map(txHash => deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: txHash })),
248
219
  );
249
220
 
250
221
  const { validators } = this.getValidators();
251
222
  this.validators = validators;
252
- await deployL1ContractsValues.publicClient.waitForTransactionReceipt({
223
+ await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
253
224
  hash: await rollup.write.cheat__InitialiseValidatorSet([this.validators]),
254
225
  });
255
226
 
@@ -263,13 +234,7 @@ export class P2PNetworkTest {
263
234
  }
264
235
 
265
236
  // Send and await a tx to make sure we mine a block for the warp to correctly progress.
266
- await deployL1ContractsValues.publicClient.waitForTransactionReceipt({
267
- hash: await deployL1ContractsValues.walletClient.sendTransaction({
268
- to: this.baseAccount.address,
269
- value: 1n,
270
- account: this.baseAccount,
271
- }),
272
- });
237
+ await this._sendDummyTx(deployL1ContractsValues.l1Client);
273
238
 
274
239
  // Set the system time in the node, only after we have warped the time and waited for a block
275
240
  // Time is only set in the NEXT block
@@ -315,14 +280,8 @@ export class P2PNetworkTest {
315
280
  'remove-inital-validator',
316
281
  async ({ deployL1ContractsValues, aztecNode, dateProvider }) => {
317
282
  // Send and await a tx to make sure we mine a block for the warp to correctly progress.
318
- const receipt = await deployL1ContractsValues.publicClient.waitForTransactionReceipt({
319
- hash: await deployL1ContractsValues.walletClient.sendTransaction({
320
- to: this.baseAccount.address,
321
- value: 1n,
322
- account: this.baseAccount,
323
- }),
324
- });
325
- const block = await deployL1ContractsValues.publicClient.getBlock({
283
+ const { receipt } = await this._sendDummyTx(deployL1ContractsValues.l1Client);
284
+ const block = await deployL1ContractsValues.l1Client.getBlock({
326
285
  blockNumber: receipt.blockNumber,
327
286
  });
328
287
  dateProvider.setTime(Number(block.timestamp) * 1000);
@@ -332,6 +291,18 @@ export class P2PNetworkTest {
332
291
  );
333
292
  }
334
293
 
294
+ async sendDummyTx() {
295
+ return await this._sendDummyTx(this.ctx.deployL1ContractsValues.l1Client);
296
+ }
297
+
298
+ private async _sendDummyTx(l1Client: ExtendedViemWalletClient) {
299
+ const l1TxUtils = new L1TxUtils(l1Client);
300
+ return await l1TxUtils.sendAndMonitorTransaction({
301
+ to: l1Client.account!.address,
302
+ value: 1n,
303
+ });
304
+ }
305
+
335
306
  async setup() {
336
307
  this.ctx = await this.snapshotManager.setup();
337
308
 
@@ -341,22 +312,8 @@ export class P2PNetworkTest {
341
312
  const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
342
313
  this.prefilledPublicData = prefilledPublicData;
343
314
 
344
- this.startSyncMockSystemTimeInterval();
345
-
346
- this.gasUtils = new L1TxUtilsWithBlobs(
347
- this.ctx.deployL1ContractsValues.publicClient,
348
- this.ctx.deployL1ContractsValues.walletClient,
349
- this.logger,
350
- {
351
- gasLimitBufferPercentage: 20,
352
- maxGwei: 500n,
353
- maxAttempts: 3,
354
- checkIntervalMs: 100,
355
- stallTimeMs: 1000,
356
- },
357
- );
358
-
359
315
  this.monitor = new ChainMonitor(RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues)).start();
316
+ this.monitor.on('l1-block', ({ timestamp }) => this.ctx.dateProvider.setTime(Number(timestamp) * 1000));
360
317
  }
361
318
 
362
319
  async stopNodes(nodes: AztecNodeService[]) {
@@ -376,8 +333,5 @@ export class P2PNetworkTest {
376
333
  this.monitor.stop();
377
334
  await this.bootstrapNode?.stop();
378
335
  await this.snapshotManager.teardown();
379
- if (this.cleanupInterval) {
380
- clearInterval(this.cleanupInterval);
381
- }
382
336
  }
383
337
  }
@@ -282,7 +282,7 @@ export class FullProverTest {
282
282
  this.logger.verbose('Starting prover node');
283
283
  const proverConfig: ProverNodeConfig = {
284
284
  ...this.context.aztecNodeConfig,
285
- proverCoordinationNodeUrl: undefined,
285
+ proverCoordinationNodeUrls: [],
286
286
  dataDirectory: undefined,
287
287
  proverId: this.proverAddress.toField(),
288
288
  realProofs: this.realProofs,
@@ -291,9 +291,10 @@ export class FullProverTest {
291
291
  proverNodeMaxPendingJobs: 100,
292
292
  proverNodeMaxParallelBlocksPerEpoch: 32,
293
293
  proverNodePollingIntervalMs: 100,
294
- txGatheringTimeoutMs: 60000,
295
294
  txGatheringIntervalMs: 1000,
296
- txGatheringMaxParallelRequests: 100,
295
+ txGatheringBatchSize: 10,
296
+ txGatheringMaxParallelRequestsPerNode: 100,
297
+ proverNodeFailedEpochStore: undefined,
297
298
  };
298
299
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
299
300
  const { prefilledPublicData } = await getGenesisValues(
@@ -308,7 +309,7 @@ export class FullProverTest {
308
309
  },
309
310
  { prefilledPublicData },
310
311
  );
311
- this.proverNode.start();
312
+ await this.proverNode.start();
312
313
 
313
314
  this.logger.warn(`Proofs are now enabled`);
314
315
  return this;
@@ -316,10 +317,10 @@ export class FullProverTest {
316
317
 
317
318
  private async mintL1ERC20(recipient: Hex, amount: bigint) {
318
319
  const erc20Address = this.context.deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress;
319
- const client = this.context.deployL1ContractsValues.walletClient;
320
+ const client = this.context.deployL1ContractsValues.l1Client;
320
321
  const erc20 = getContract({ abi: TestERC20Abi, address: erc20Address.toString(), client });
321
322
  const hash = await erc20.write.mint([recipient, amount]);
322
- await this.context.deployL1ContractsValues.publicClient.waitForTransactionReceipt({ hash });
323
+ await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
323
324
  }
324
325
 
325
326
  snapshot = <T>(
@@ -399,19 +400,14 @@ export class FullProverTest {
399
400
  throw new Error('No verifier');
400
401
  }
401
402
 
402
- const { walletClient, publicClient, l1ContractAddresses } = this.context.deployL1ContractsValues;
403
+ const { l1Client, l1ContractAddresses } = this.context.deployL1ContractsValues;
403
404
  const rollup = getContract({
404
405
  abi: RollupAbi,
405
406
  address: l1ContractAddresses.rollupAddress.toString(),
406
- client: walletClient,
407
+ client: l1Client,
407
408
  });
408
409
 
409
- const { address: verifierAddress } = await deployL1Contract(
410
- walletClient,
411
- publicClient,
412
- HonkVerifierAbi,
413
- HonkVerifierBytecode,
414
- );
410
+ const { address: verifierAddress } = await deployL1Contract(l1Client, HonkVerifierAbi, HonkVerifierBytecode);
415
411
  this.logger.info(`Deployed honk verifier at ${verifierAddress}`);
416
412
 
417
413
  await rollup.write.setEpochVerifier([verifierAddress.toString()]);
@@ -1,9 +1,4 @@
1
- import {
2
- type L1ContractAddresses,
3
- RollupContract,
4
- type ViemPublicClient,
5
- type ViemWalletClient,
6
- } from '@aztec/ethereum';
1
+ import { type ExtendedViemWalletClient, type L1ContractAddresses, RollupContract } from '@aztec/ethereum';
7
2
  import { Fr } from '@aztec/foundation/fields';
8
3
  import { InboxAbi } from '@aztec/l1-artifacts';
9
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -14,23 +9,19 @@ import { decodeEventLog, getContract } from 'viem';
14
9
  export async function sendL1ToL2Message(
15
10
  message: { recipient: AztecAddress; content: Fr; secretHash: Fr },
16
11
  ctx: {
17
- walletClient: ViemWalletClient;
18
- publicClient: ViemPublicClient;
12
+ l1Client: ExtendedViemWalletClient;
19
13
  l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
20
14
  },
21
15
  ) {
22
16
  const inbox = getContract({
23
17
  address: ctx.l1ContractAddresses.inboxAddress.toString(),
24
18
  abi: InboxAbi,
25
- client: ctx.walletClient,
19
+ client: ctx.l1Client,
26
20
  });
27
21
 
28
22
  const { recipient, content, secretHash } = message;
29
23
 
30
- const version = await new RollupContract(
31
- ctx.publicClient,
32
- ctx.l1ContractAddresses.rollupAddress.toString(),
33
- ).getVersion();
24
+ const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
34
25
 
35
26
  // We inject the message to Inbox
36
27
  const txHash = await inbox.write.sendL2Message([
@@ -40,7 +31,7 @@ export async function sendL1ToL2Message(
40
31
  ]);
41
32
 
42
33
  // We check that the message was correctly injected by checking the emitted event
43
- const txReceipt = await ctx.publicClient.waitForTransactionReceipt({ hash: txHash });
34
+ const txReceipt = await ctx.l1Client.waitForTransactionReceipt({ hash: txHash });
44
35
 
45
36
  // Exactly 1 event should be emitted in the transaction
46
37
  expect(txReceipt.logs.length).toBe(1);
@@ -12,8 +12,7 @@ export const setupL1Contracts = async (
12
12
  l1RpcUrl: string,
13
13
  account: HDAccount | PrivateKeyAccount,
14
14
  logger: Logger,
15
- args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'genesisBlockHash' | 'initialValidators'> &
16
- L1ContractsConfig,
15
+ args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'initialValidators'> & L1ContractsConfig,
17
16
  ) => {
18
17
  const l1Data = await deployL1Contracts([l1RpcUrl], account, foundry, logger, {
19
18
  vkTreeRoot: getVKTreeRoot(),
@@ -20,7 +20,7 @@ import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/serv
20
20
  import {
21
21
  type DeployL1ContractsArgs,
22
22
  type DeployL1ContractsReturnType,
23
- createL1Clients,
23
+ createExtendedL1Client,
24
24
  getL1ContractsConfigEnvVars,
25
25
  l1Artifacts,
26
26
  } from '@aztec/ethereum';
@@ -348,7 +348,7 @@ async function setupFromFresh(
348
348
 
349
349
  const initialFundedAccounts = await generateSchnorrAccounts(numberOfInitialFundedAccounts);
350
350
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
351
- const { genesisArchiveRoot, genesisBlockHash, prefilledPublicData, fundingNeeded } = await getGenesisValues(
351
+ const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
352
352
  initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
353
353
  opts.initialAccountFeeJuice,
354
354
  );
@@ -356,7 +356,6 @@ async function setupFromFresh(
356
356
  const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrls[0], hdAccount, logger, {
357
357
  ...getL1ContractsConfigEnvVars(),
358
358
  genesisArchiveRoot,
359
- genesisBlockHash,
360
359
  feeJuicePortalInitialBalance: fundingNeeded,
361
360
  salt: opts.salt,
362
361
  ...deployL1ContractsArgs,
@@ -371,7 +370,7 @@ async function setupFromFresh(
371
370
  const rewardDistributor = getContract({
372
371
  address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
373
372
  abi: l1Artifacts.rewardDistributor.contractAbi,
374
- client: deployL1ContractsValues.publicClient,
373
+ client: deployL1ContractsValues.l1Client,
375
374
  });
376
375
 
377
376
  const blockReward = await rewardDistributor.read.BLOCK_REWARD();
@@ -380,18 +379,18 @@ async function setupFromFresh(
380
379
  const feeJuice = getContract({
381
380
  address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
382
381
  abi: l1Artifacts.feeAsset.contractAbi,
383
- client: deployL1ContractsValues.walletClient,
382
+ client: deployL1ContractsValues.l1Client,
384
383
  });
385
384
 
386
385
  const rewardDistributorMintTxHash = await feeJuice.write.mint([rewardDistributor.address, mintAmount], {} as any);
387
- await deployL1ContractsValues.publicClient.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
386
+ await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
388
387
  logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
389
388
  }
390
389
 
391
390
  const watcher = new AnvilTestWatcher(
392
391
  new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
393
392
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
394
- deployL1ContractsValues.publicClient,
393
+ deployL1ContractsValues.l1Client,
395
394
  );
396
395
  await watcher.start();
397
396
 
@@ -437,8 +436,8 @@ async function setupFromFresh(
437
436
  proverNode = await createAndSyncProverNode(
438
437
  `0x${proverNodePrivateKey!.toString('hex')}`,
439
438
  aztecNodeConfig,
439
+ { dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')) },
440
440
  aztecNode,
441
- path.join(directoryToCleanup, randomBytes(8).toString('hex')),
442
441
  prefilledPublicData,
443
442
  );
444
443
  }
@@ -522,12 +521,12 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
522
521
  }
523
522
 
524
523
  logger.verbose('Creating ETH clients...');
525
- const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
524
+ const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
526
525
 
527
526
  const watcher = new AnvilTestWatcher(
528
527
  new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
529
528
  aztecNodeConfig.l1Contracts.rollupAddress,
530
- publicClient,
529
+ l1Client,
531
530
  );
532
531
  await watcher.start();
533
532
 
@@ -561,8 +560,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
561
560
  proverNode = await createAndSyncProverNode(
562
561
  proverNodePrivateKeyHex,
563
562
  aztecNodeConfig,
563
+ { dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')) },
564
564
  aztecNode,
565
- path.join(directoryToCleanup, randomBytes(8).toString('hex')),
566
565
  prefilledPublicData,
567
566
  );
568
567
  }
@@ -583,8 +582,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
583
582
  bbConfig,
584
583
  proverNode,
585
584
  deployL1ContractsValues: {
586
- walletClient,
587
- publicClient,
585
+ l1Client,
588
586
  l1ContractAddresses: aztecNodeConfig.l1Contracts,
589
587
  },
590
588
  watcher,
@@ -29,14 +29,14 @@ import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee/testing';
29
29
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
30
30
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
31
31
  import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
32
- import { GENESIS_ARCHIVE_ROOT, GENESIS_BLOCK_HASH, SPONSORED_FPC_SALT } from '@aztec/constants';
32
+ import { GENESIS_ARCHIVE_ROOT, SPONSORED_FPC_SALT } from '@aztec/constants';
33
33
  import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
34
34
  import {
35
35
  type DeployL1ContractsArgs,
36
36
  type DeployL1ContractsReturnType,
37
37
  ForwarderContract,
38
38
  NULL_KEY,
39
- createL1Clients,
39
+ createExtendedL1Client,
40
40
  deployL1Contracts,
41
41
  getL1ContractsConfigEnvVars,
42
42
  isAnvilTestChain,
@@ -46,8 +46,10 @@ import { DelayedTxUtils, EthCheatCodesWithState, startAnvil } from '@aztec/ether
46
46
  import { randomBytes } from '@aztec/foundation/crypto';
47
47
  import { EthAddress } from '@aztec/foundation/eth-address';
48
48
  import { Fr } from '@aztec/foundation/fields';
49
+ import { withLogNameSuffix } from '@aztec/foundation/log';
49
50
  import { retryUntil } from '@aztec/foundation/retry';
50
51
  import { TestDateProvider } from '@aztec/foundation/timer';
52
+ import type { DataStoreConfig } from '@aztec/kv-store/config';
51
53
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
52
54
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
53
55
  import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
@@ -125,7 +127,6 @@ export const setupL1Contracts = async (
125
127
  vkTreeRoot: getVKTreeRoot(),
126
128
  protocolContractTreeRoot,
127
129
  genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
128
- genesisBlockHash: args.genesisBlockHash ?? new Fr(GENESIS_BLOCK_HASH),
129
130
  salt: args.salt,
130
131
  initialValidators: args.initialValidators,
131
132
  ...getL1ContractsConfigEnvVars(),
@@ -224,12 +225,11 @@ async function setupWithRemoteEnvironment(
224
225
  logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
225
226
  const l1Contracts = (await pxeClient.getNodeInfo()).l1ContractAddresses;
226
227
 
227
- const { walletClient, publicClient } = createL1Clients(config.l1RpcUrls, account, foundry);
228
+ const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
228
229
 
229
230
  const deployL1ContractsValues: DeployL1ContractsReturnType = {
230
231
  l1ContractAddresses: l1Contracts,
231
- walletClient,
232
- publicClient,
232
+ l1Client,
233
233
  };
234
234
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient!);
235
235
  const teardown = () => Promise.resolve();
@@ -296,6 +296,8 @@ export type SetupOptions = {
296
296
  telemetryConfig?: Partial<TelemetryClientConfig> & { benchmark?: boolean };
297
297
  /** Public data that will be inserted in the tree in genesis */
298
298
  genesisPublicData?: PublicDataTreeLeaf[];
299
+ /** Specific config for the prover node, if set. */
300
+ proverNodeConfig?: Partial<ProverNodeConfig>;
299
301
  } & Partial<AztecNodeConfig>;
300
302
 
301
303
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -425,7 +427,7 @@ export async function setup(
425
427
  const initialFundedAccounts =
426
428
  opts.initialFundedAccounts ??
427
429
  (await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? numberOfAccounts));
428
- const { genesisBlockHash, genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
430
+ const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
429
431
  initialFundedAccounts.map(a => a.address),
430
432
  opts.initialAccountFeeJuice,
431
433
  opts.genesisPublicData,
@@ -437,7 +439,7 @@ export async function setup(
437
439
  config.l1RpcUrls,
438
440
  publisherHdAccount!,
439
441
  logger,
440
- { ...opts, genesisArchiveRoot, genesisBlockHash, feeJuicePortalInitialBalance: fundingNeeded },
442
+ { ...opts, genesisArchiveRoot, feeJuicePortalInitialBalance: fundingNeeded },
441
443
  chain,
442
444
  ));
443
445
 
@@ -449,7 +451,7 @@ export async function setup(
449
451
  const rewardDistributor = getContract({
450
452
  address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
451
453
  abi: l1Artifacts.rewardDistributor.contractAbi,
452
- client: deployL1ContractsValues.publicClient,
454
+ client: deployL1ContractsValues.l1Client,
453
455
  });
454
456
 
455
457
  const blockReward = await rewardDistributor.read.BLOCK_REWARD();
@@ -458,11 +460,11 @@ export async function setup(
458
460
  const feeJuice = getContract({
459
461
  address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
460
462
  abi: l1Artifacts.feeAsset.contractAbi,
461
- client: deployL1ContractsValues.walletClient,
463
+ client: deployL1ContractsValues.l1Client,
462
464
  });
463
465
 
464
466
  const rewardDistributorMintTxHash = await feeJuice.write.mint([rewardDistributor.address, mintAmount], {} as any);
465
- await deployL1ContractsValues.publicClient.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
467
+ await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
466
468
  logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
467
469
  }
468
470
 
@@ -477,7 +479,7 @@ export async function setup(
477
479
  const watcher = new AnvilTestWatcher(
478
480
  new EthCheatCodesWithState(config.l1RpcUrls),
479
481
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
480
- deployL1ContractsValues.publicClient,
482
+ deployL1ContractsValues.l1Client,
481
483
  dateProvider,
482
484
  );
483
485
 
@@ -516,7 +518,7 @@ export async function setup(
516
518
  }
517
519
  config.l1PublishRetryIntervalMS = 100;
518
520
 
519
- const blobSinkClient = createBlobSinkClient(config);
521
+ const blobSinkClient = createBlobSinkClient(config, { logger: createLogger('node:blob-sink:client') });
520
522
  const aztecNode = await AztecNodeService.createAndSync(
521
523
  config,
522
524
  { dateProvider, blobSinkClient, telemetry },
@@ -534,11 +536,14 @@ export async function setup(
534
536
  logger.verbose('Creating and syncing a simulated prover node...');
535
537
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
536
538
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
539
+ const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
540
+ const proverNodeConfig = { ...config.proverNodeConfig, dataDirectory: proverNodeDataDirectory };
537
541
  proverNode = await createAndSyncProverNode(
538
542
  proverNodePrivateKeyHex,
539
543
  config,
544
+ proverNodeConfig,
540
545
  aztecNode,
541
- path.join(directoryToCleanup, randomBytes(8).toString('hex')),
546
+ prefilledPublicData,
542
547
  );
543
548
  }
544
549
 
@@ -776,65 +781,63 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: number,
776
781
  );
777
782
  }
778
783
 
779
- export async function createAndSyncProverNode(
784
+ export function createAndSyncProverNode(
780
785
  proverNodePrivateKey: `0x${string}`,
781
786
  aztecNodeConfig: AztecNodeConfig,
787
+ proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'>,
782
788
  aztecNode: AztecNode,
783
- dataDirectory: string,
784
789
  prefilledPublicData: PublicDataTreeLeaf[] = [],
785
790
  ) {
786
- // Disable stopping the aztec node as the prover coordination test will kill it otherwise
787
- // This is only required when stopping the prover node for testing
788
- const aztecNodeWithoutStop = {
789
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
790
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
791
- stop: () => Promise.resolve(),
792
- };
793
-
794
- const blobSinkClient = createBlobSinkClient(aztecNodeConfig);
795
- // Creating temp store and archiver for simulated prover node
796
- const archiverConfig = { ...aztecNodeConfig, dataDirectory };
797
- const archiver = await createArchiver(archiverConfig, blobSinkClient, {
798
- blockUntilSync: true,
799
- });
791
+ return withLogNameSuffix('prover-node', async () => {
792
+ // Disable stopping the aztec node as the prover coordination test will kill it otherwise
793
+ // This is only required when stopping the prover node for testing
794
+ const aztecNodeTxProvider = {
795
+ getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
796
+ getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
797
+ stop: () => Promise.resolve(),
798
+ };
800
799
 
801
- // Prover node config is for simulated proofs
802
- const proverConfig: ProverNodeConfig = {
803
- ...aztecNodeConfig,
804
- proverCoordinationNodeUrl: undefined,
805
- dataDirectory: undefined,
806
- realProofs: false,
807
- proverAgentCount: 2,
808
- publisherPrivateKey: proverNodePrivateKey,
809
- proverNodeMaxPendingJobs: 10,
810
- proverNodeMaxParallelBlocksPerEpoch: 32,
811
- proverNodePollingIntervalMs: 200,
812
- txGatheringTimeoutMs: 60000,
813
- txGatheringIntervalMs: 1000,
814
- txGatheringMaxParallelRequests: 100,
815
- };
800
+ const blobSinkClient = createBlobSinkClient(aztecNodeConfig);
801
+
802
+ // Creating temp store and archiver for simulated prover node
803
+ const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
804
+ const archiver = await createArchiver(archiverConfig, blobSinkClient, { blockUntilSync: true });
805
+
806
+ // Prover node config is for simulated proofs
807
+ const proverConfig: ProverNodeConfig = {
808
+ ...aztecNodeConfig,
809
+ proverCoordinationNodeUrls: [],
810
+ realProofs: false,
811
+ proverAgentCount: 2,
812
+ publisherPrivateKey: proverNodePrivateKey,
813
+ proverNodeMaxPendingJobs: 10,
814
+ proverNodeMaxParallelBlocksPerEpoch: 32,
815
+ proverNodePollingIntervalMs: 200,
816
+ txGatheringIntervalMs: 1000,
817
+ txGatheringBatchSize: 10,
818
+ txGatheringMaxParallelRequestsPerNode: 10,
819
+ proverNodeFailedEpochStore: undefined,
820
+ ...proverNodeConfig,
821
+ };
816
822
 
817
- const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node');
823
+ const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node');
818
824
 
819
- const proverNode = await createProverNode(
820
- proverConfig,
821
- {
822
- aztecNodeTxProvider: aztecNodeWithoutStop,
823
- archiver: archiver as Archiver,
824
- l1TxUtils,
825
- },
826
- { prefilledPublicData },
827
- );
828
- getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.walletClient.account.address });
829
- proverNode.start();
830
- return proverNode;
825
+ const proverNode = await createProverNode(
826
+ proverConfig,
827
+ { aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
828
+ { prefilledPublicData },
829
+ );
830
+ getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
831
+ await proverNode.start();
832
+ return proverNode;
833
+ });
831
834
  }
832
835
 
833
836
  function createDelayedL1TxUtils(aztecNodeConfig: AztecNodeConfig, privateKey: `0x${string}`, logName: string) {
834
- const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
837
+ const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
835
838
 
836
839
  const log = createLogger(logName);
837
- const l1TxUtils = new DelayedTxUtils(publicClient, walletClient, log, aztecNodeConfig);
840
+ const l1TxUtils = new DelayedTxUtils(l1Client, log, aztecNodeConfig);
838
841
  l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
839
842
  return l1TxUtils;
840
843
  }
@@ -844,11 +847,10 @@ export async function createForwarderContract(
844
847
  privateKey: `0x${string}`,
845
848
  rollupAddress: Hex,
846
849
  ) {
847
- const { walletClient, publicClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
850
+ const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
848
851
  const forwarderContract = await ForwarderContract.create(
849
- walletClient.account.address,
850
- walletClient,
851
- publicClient,
852
+ l1Client.account.address,
853
+ l1Client,
852
854
  createLogger('forwarder'),
853
855
  rollupAddress,
854
856
  );