@aztec/end-to-end 0.0.1-commit.5476d83 → 0.0.1-commit.6230efd

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 (98) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +3 -3
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +5 -3
  4. package/dest/bench/utils.d.ts +2 -2
  5. package/dest/bench/utils.d.ts.map +1 -1
  6. package/dest/bench/utils.js +10 -6
  7. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +5 -4
  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 +2 -1
  10. package/dest/e2e_epochs/epochs_test.d.ts +11 -9
  11. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  12. package/dest/e2e_epochs/epochs_test.js +13 -11
  13. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  14. package/dest/e2e_fees/fees_test.d.ts +8 -4
  15. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  16. package/dest/e2e_fees/fees_test.js +4 -1
  17. package/dest/e2e_multi_validator/utils.js +1 -1
  18. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  19. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  20. package/dest/e2e_p2p/inactivity_slash_test.js +3 -6
  21. package/dest/e2e_p2p/p2p_network.d.ts +7 -6
  22. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  23. package/dest/e2e_p2p/p2p_network.js +10 -8
  24. package/dest/e2e_p2p/shared.d.ts +2 -2
  25. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  26. package/dest/fixtures/e2e_prover_test.d.ts +3 -5
  27. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  28. package/dest/fixtures/e2e_prover_test.js +6 -9
  29. package/dest/fixtures/fixtures.d.ts +2 -3
  30. package/dest/fixtures/fixtures.d.ts.map +1 -1
  31. package/dest/fixtures/fixtures.js +2 -3
  32. package/dest/fixtures/get_acvm_config.js +1 -1
  33. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  34. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  35. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  36. package/dest/fixtures/setup_p2p_test.js +3 -3
  37. package/dest/fixtures/snapshot_manager.d.ts +6 -8
  38. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  39. package/dest/fixtures/snapshot_manager.js +34 -46
  40. package/dest/fixtures/utils.d.ts +20 -463
  41. package/dest/fixtures/utils.d.ts.map +1 -1
  42. package/dest/fixtures/utils.js +50 -78
  43. package/dest/fixtures/web3signer.js +1 -1
  44. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  45. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  46. package/dest/fixtures/with_telemetry_utils.js +2 -2
  47. package/dest/shared/cross_chain_test_harness.d.ts +5 -3
  48. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  49. package/dest/shared/cross_chain_test_harness.js +1 -1
  50. package/dest/shared/gas_portal_test_harness.d.ts +2 -2
  51. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  52. package/dest/shared/uniswap_l1_l2.d.ts +4 -3
  53. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  54. package/dest/shared/uniswap_l1_l2.js +4 -2
  55. package/dest/simulators/lending_simulator.d.ts +2 -2
  56. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  57. package/dest/simulators/lending_simulator.js +1 -1
  58. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  59. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  60. package/dest/spartan/setup_test_wallets.js +2 -1
  61. package/dest/spartan/tx_metrics.d.ts +39 -0
  62. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  63. package/dest/spartan/tx_metrics.js +95 -0
  64. package/dest/spartan/utils.d.ts +43 -10
  65. package/dest/spartan/utils.d.ts.map +1 -1
  66. package/dest/spartan/utils.js +148 -38
  67. package/package.json +40 -40
  68. package/src/bench/client_flows/client_flows_benchmark.ts +7 -4
  69. package/src/bench/utils.ts +11 -7
  70. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +13 -9
  71. package/src/e2e_epochs/epochs_test.ts +33 -20
  72. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  73. package/src/e2e_fees/fees_test.ts +10 -4
  74. package/src/e2e_multi_validator/utils.ts +1 -1
  75. package/src/e2e_p2p/inactivity_slash_test.ts +4 -7
  76. package/src/e2e_p2p/p2p_network.ts +9 -16
  77. package/src/e2e_p2p/shared.ts +5 -1
  78. package/src/fixtures/e2e_prover_test.ts +8 -10
  79. package/src/fixtures/fixtures.ts +2 -5
  80. package/src/fixtures/get_acvm_config.ts +1 -1
  81. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  82. package/src/fixtures/setup_p2p_test.ts +3 -3
  83. package/src/fixtures/snapshot_manager.ts +51 -65
  84. package/src/fixtures/utils.ts +79 -138
  85. package/src/fixtures/web3signer.ts +1 -1
  86. package/src/fixtures/with_telemetry_utils.ts +2 -2
  87. package/src/shared/cross_chain_test_harness.ts +5 -2
  88. package/src/shared/gas_portal_test_harness.ts +1 -1
  89. package/src/shared/uniswap_l1_l2.ts +8 -10
  90. package/src/simulators/lending_simulator.ts +2 -2
  91. package/src/spartan/DEVELOP.md +7 -0
  92. package/src/spartan/setup_test_wallets.ts +2 -1
  93. package/src/spartan/tx_metrics.ts +130 -0
  94. package/src/spartan/utils.ts +207 -31
  95. package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
  96. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  97. package/dest/fixtures/setup_l1_contracts.js +0 -17
  98. package/src/fixtures/setup_l1_contracts.ts +0 -26
@@ -8,7 +8,7 @@ export const shouldCollectMetrics = () => {
8
8
  };
9
9
 
10
10
  export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
11
- export const TEST_MAX_TX_POOL_SIZE = 2 * 1024 * 1024 * 1024; // 2GB
11
+ export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
12
12
 
13
13
  export const MNEMONIC = 'test test test test test test test test test test test junk';
14
14
  export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
@@ -22,8 +22,5 @@ export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_s
22
22
  export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
23
23
  export const NO_L1_TO_L2_MSG_ERROR =
24
24
  /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
25
- export const STATIC_CALL_STATE_MODIFICATION_ERROR =
26
- /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
25
+ export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state.*/;
27
26
  export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
28
-
29
- export const DEFAULT_BLOB_SINK_PORT = '5052';
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '@aztec/aztec.js/log';
2
2
  import { parseBooleanEnv } from '@aztec/foundation/config';
3
- import { randomBytes } from '@aztec/foundation/crypto';
3
+ import { randomBytes } from '@aztec/foundation/crypto/random';
4
4
  import { tryRmDir } from '@aztec/foundation/fs';
5
5
 
6
6
  import { promises as fs } from 'fs';
@@ -1,5 +1,7 @@
1
- import { type ExtendedViemWalletClient, type L1ContractAddresses, RollupContract } from '@aztec/ethereum';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { RollupContract } from '@aztec/ethereum/contracts';
2
+ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
3
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
5
  import { tryJsonStringify } from '@aztec/foundation/json-rpc';
4
6
  import { InboxAbi } from '@aztec/l1-artifacts';
5
7
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -99,7 +99,7 @@ export async function createNode(
99
99
  ) {
100
100
  const createNode = async () => {
101
101
  const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
102
- const telemetry = getEndToEndTestTelemetryClient(metricsPort);
102
+ const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
103
103
  return await AztecNodeService.createAndSync(
104
104
  validatorConfig,
105
105
  { telemetry, dateProvider },
@@ -128,7 +128,7 @@ export async function createNonValidatorNode(
128
128
  validatorPrivateKeys: undefined,
129
129
  publisherPrivateKeys: [],
130
130
  };
131
- const telemetry = getEndToEndTestTelemetryClient(metricsPort);
131
+ const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
132
132
  return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
133
133
  };
134
134
  return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
@@ -147,7 +147,7 @@ export async function createProverNode(
147
147
  ) {
148
148
  const createProverNode = async () => {
149
149
  const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
150
- const telemetry = getEndToEndTestTelemetryClient(metricsPort);
150
+ const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
151
151
 
152
152
  const proverConfig: Partial<ProverNodeConfig> = await createP2PConfig(
153
153
  config,
@@ -9,22 +9,25 @@ import type { Logger } from '@aztec/aztec.js/log';
9
9
  import type { AztecNode } from '@aztec/aztec.js/node';
10
10
  import type { Wallet } from '@aztec/aztec.js/wallet';
11
11
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
12
- import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
12
+ import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
13
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
14
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
15
+ import { deployMulticall3 } from '@aztec/ethereum/contracts';
13
16
  import {
14
- type DeployL1ContractsArgs,
15
- type DeployL1ContractsReturnType,
16
- createExtendedL1Client,
17
- deployMulticall3,
18
- getL1ContractsConfigEnvVars,
19
- } from '@aztec/ethereum';
17
+ type DeployAztecL1ContractsArgs,
18
+ type DeployAztecL1ContractsReturnType,
19
+ deployAztecL1Contracts,
20
+ } from '@aztec/ethereum/deploy-aztec-l1-contracts';
20
21
  import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
21
22
  import { asyncMap } from '@aztec/foundation/async-map';
22
23
  import { SecretValue } from '@aztec/foundation/config';
23
- import { randomBytes } from '@aztec/foundation/crypto';
24
+ import { randomBytes } from '@aztec/foundation/crypto/random';
24
25
  import { tryRmDir } from '@aztec/foundation/fs';
25
26
  import { createLogger } from '@aztec/foundation/log';
26
27
  import { resolver, reviver } from '@aztec/foundation/serialize';
27
28
  import { TestDateProvider } from '@aztec/foundation/timer';
29
+ import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
30
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
28
31
  import type { ProverNode } from '@aztec/prover-node';
29
32
  import { getPXEConfig } from '@aztec/pxe/server';
30
33
  import type { SequencerClient } from '@aztec/sequencer-client';
@@ -37,23 +40,22 @@ import type { Anvil } from '@viem/anvil';
37
40
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
38
41
  import { copySync, removeSync } from 'fs-extra/esm';
39
42
  import fs from 'fs/promises';
40
- import getPort from 'get-port';
41
43
  import { tmpdir } from 'os';
42
44
  import path, { join } from 'path';
43
45
  import type { Hex } from 'viem';
44
46
  import { mnemonicToAccount } from 'viem/accounts';
45
47
  import { foundry } from 'viem/chains';
46
48
 
47
- import { MNEMONIC, TEST_MAX_TX_POOL_SIZE, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
49
+ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
48
50
  import { getACVMConfig } from './get_acvm_config.js';
49
51
  import { getBBConfig } from './get_bb_config.js';
50
- import { setupL1Contracts } from './setup_l1_contracts.js';
51
52
  import {
52
53
  type SetupOptions,
53
54
  createAndSyncProverNode,
54
55
  getLogger,
55
56
  getPrivateKeyFromIndex,
56
57
  getSponsoredFPCAddress,
58
+ setupSharedBlobStorage,
57
59
  } from './utils.js';
58
60
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
59
61
 
@@ -64,13 +66,12 @@ export type SubsystemsContext = {
64
66
  aztecNode: AztecNodeService;
65
67
  aztecNodeConfig: AztecNodeConfig;
66
68
  wallet: TestWallet;
67
- deployL1ContractsValues: DeployL1ContractsReturnType;
69
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
68
70
  proverNode?: ProverNode;
69
71
  watcher: AnvilTestWatcher;
70
72
  cheatCodes: CheatCodes;
71
73
  sequencer: SequencerClient;
72
74
  dateProvider: TestDateProvider;
73
- blobSink: BlobSinkServer;
74
75
  initialFundedAccounts: InitialAccountData[];
75
76
  directoryToCleanup?: string;
76
77
  };
@@ -86,7 +87,7 @@ export function createSnapshotManager(
86
87
  testName: string,
87
88
  dataPath?: string,
88
89
  config: Partial<SetupOptions> = {},
89
- deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {
90
+ deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {
90
91
  initialValidators: [],
91
92
  },
92
93
  ) {
@@ -115,7 +116,7 @@ class MockSnapshotManager implements ISnapshotManager {
115
116
  constructor(
116
117
  testName: string,
117
118
  private config: Partial<AztecNodeConfig> = {},
118
- private deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {},
119
+ private deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
119
120
  ) {
120
121
  this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
121
122
  this.logger.warn(`No data path given, will not persist any snapshots.`);
@@ -163,7 +164,7 @@ class SnapshotManager implements ISnapshotManager {
163
164
  testName: string,
164
165
  private dataPath: string,
165
166
  private config: Partial<SetupOptions> = {},
166
- private deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {},
167
+ private deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
167
168
  ) {
168
169
  this.livePath = join(this.dataPath, 'live', testName);
169
170
  this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
@@ -273,7 +274,6 @@ async function teardown(context: SubsystemsContext | undefined) {
273
274
  await context.bbConfig?.cleanup();
274
275
  await tryStop(context.anvil);
275
276
  await tryStop(context.watcher);
276
- await tryStop(context.blobSink);
277
277
  await tryRmDir(context.directoryToCleanup, logger);
278
278
  } catch (err) {
279
279
  logger.error('Error during teardown', err);
@@ -289,14 +289,12 @@ async function setupFromFresh(
289
289
  statePath: string | undefined,
290
290
  logger: Logger,
291
291
  { numberOfInitialFundedAccounts = 10, ...opts }: SetupOptions = {},
292
- deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {
292
+ deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {
293
293
  initialValidators: [],
294
294
  },
295
295
  ): Promise<SubsystemsContext> {
296
296
  logger.verbose(`Initializing state...`);
297
297
 
298
- const blobSinkPort = await getPort();
299
-
300
298
  // Default to no slashing
301
299
  opts.slasherFlavor ??= 'none';
302
300
  deployL1ContractsArgs.slasherFlavor ??= opts.slasherFlavor;
@@ -305,7 +303,7 @@ async function setupFromFresh(
305
303
  // TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
306
304
  const aztecNodeConfig: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
307
305
  aztecNodeConfig.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
308
- aztecNodeConfig.maxTxPoolSize = opts.maxTxPoolSize ?? TEST_MAX_TX_POOL_SIZE;
306
+ aztecNodeConfig.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
309
307
  // Only enable proving if specifically requested.
310
308
  aztecNodeConfig.realProofs = !!opts.realProofs;
311
309
  // Only enforce the time table if requested
@@ -324,18 +322,20 @@ async function setupFromFresh(
324
322
  } else {
325
323
  aztecNodeConfig.dataDirectory = statePath;
326
324
  }
327
- aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
325
+
326
+ await setupSharedBlobStorage(aztecNodeConfig);
328
327
 
329
328
  const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
330
329
  const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
331
330
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
331
+ const publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` satisfies `0x${string}`;
332
332
 
333
333
  const l1Client = createExtendedL1Client([aztecNodeConfig.l1RpcUrls[0]], hdAccount, foundry);
334
334
 
335
335
  const validatorPrivKey = getPrivateKeyFromIndex(0);
336
336
  const proverNodePrivateKey = getPrivateKeyFromIndex(0);
337
337
 
338
- aztecNodeConfig.publisherPrivateKeys = [new SecretValue<`0x${string}`>(`0x${publisherPrivKey!.toString('hex')}`)];
338
+ aztecNodeConfig.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
339
339
  aztecNodeConfig.validatorPrivateKeys = new SecretValue([`0x${validatorPrivKey!.toString('hex')}`]);
340
340
  aztecNodeConfig.coinbase = opts.coinbase ?? EthAddress.fromString(`${hdAccount.address}`);
341
341
 
@@ -351,7 +351,7 @@ async function setupFromFresh(
351
351
  const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
352
352
 
353
353
  // Deploy our L1 contracts.
354
- logger.verbose('Deploying L1 contracts...');
354
+ logger.verbose('Deploying Aztec L1 contracts...');
355
355
  if (opts.l1StartTime) {
356
356
  await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
357
357
  }
@@ -363,16 +363,28 @@ async function setupFromFresh(
363
363
  opts.initialAccountFeeJuice,
364
364
  );
365
365
 
366
+ const vkTreeRoot = getVKTreeRoot();
366
367
  await deployMulticall3(l1Client, logger);
367
368
 
368
- const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrls[0], hdAccount, logger, {
369
+ // Define args, defaulted to our environment variables.
370
+ const args: DeployAztecL1ContractsArgs = {
369
371
  ...getL1ContractsConfigEnvVars(),
370
- genesisArchiveRoot,
371
- feeJuicePortalInitialBalance: fundingNeeded,
372
- salt: opts.salt,
373
372
  ...deployL1ContractsArgs,
373
+ vkTreeRoot,
374
+ genesisArchiveRoot,
375
+ protocolContractsHash,
374
376
  initialValidators: opts.initialValidators,
375
- });
377
+ feeJuicePortalInitialBalance: fundingNeeded,
378
+ realVerifier: false,
379
+ };
380
+
381
+ const deployL1ContractsValues = await deployAztecL1Contracts(
382
+ aztecNodeConfig.l1RpcUrls[0],
383
+ publisherPrivKeyHex,
384
+ foundry.id,
385
+ args,
386
+ );
387
+
376
388
  aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
377
389
  aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
378
390
 
@@ -396,26 +408,14 @@ async function setupFromFresh(
396
408
  aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
397
409
  }
398
410
 
399
- const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);
400
-
401
- // Setup blob sink service
402
- const blobSink = await createBlobSinkServer(
403
- {
404
- l1ChainId: aztecNodeConfig.l1ChainId,
405
- l1RpcUrls: aztecNodeConfig.l1RpcUrls,
406
- l1Contracts: aztecNodeConfig.l1Contracts,
407
- port: blobSinkPort,
408
- dataDirectory: aztecNodeConfig.dataDirectory,
409
- dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb,
410
- },
411
- telemetry,
412
- );
413
- await blobSink.start();
411
+ const telemetry = await getEndToEndTestTelemetryClient(opts.metricsPort);
412
+
413
+ const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('node:blob-client:client'));
414
414
 
415
415
  logger.info('Creating and synching an aztec node...');
416
416
  const aztecNode = await AztecNodeService.createAndSync(
417
417
  aztecNodeConfig,
418
- { telemetry, dateProvider },
418
+ { telemetry, dateProvider, blobClient },
419
419
  { prefilledPublicData },
420
420
  );
421
421
 
@@ -461,7 +461,6 @@ async function setupFromFresh(
461
461
  watcher,
462
462
  cheatCodes,
463
463
  dateProvider,
464
- blobSink,
465
464
  initialFundedAccounts,
466
465
  directoryToCleanup,
467
466
  };
@@ -476,18 +475,16 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
476
475
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
477
476
  await fs.mkdir(directoryToCleanup, { recursive: true });
478
477
 
479
- // Run the blob sink on a random port
480
- const blobSinkPort = await getPort();
481
-
482
478
  // TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
483
479
  const aztecNodeConfig: AztecNodeConfig & SetupOptions = JSON.parse(
484
480
  readFileSync(`${statePath}/aztec_node_config.json`, 'utf-8'),
485
481
  reviver,
486
482
  );
487
483
  aztecNodeConfig.dataDirectory = statePath;
488
- aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
489
484
  aztecNodeConfig.listenAddress = '127.0.0.1';
490
485
 
486
+ await setupSharedBlobStorage(aztecNodeConfig);
487
+
491
488
  const initialFundedAccounts: InitialAccountData[] =
492
489
  JSON.parse(readFileSync(`${statePath}/accounts.json`, 'utf-8'), reviver) || [];
493
490
  const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map(a => a.address));
@@ -526,24 +523,14 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
526
523
  );
527
524
  await watcher.start();
528
525
 
529
- const telemetry = initTelemetryClient(getTelemetryConfig());
530
- const blobSink = await createBlobSinkServer(
531
- {
532
- l1ChainId: aztecNodeConfig.l1ChainId,
533
- l1RpcUrls: aztecNodeConfig.l1RpcUrls,
534
- l1Contracts: aztecNodeConfig.l1Contracts,
535
- port: blobSinkPort,
536
- dataDirectory: statePath,
537
- dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb,
538
- },
539
- telemetry,
540
- );
541
- await blobSink.start();
526
+ const telemetry = await initTelemetryClient(getTelemetryConfig());
527
+
528
+ const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('node:blob-client:client'));
542
529
 
543
530
  logger.verbose('Creating aztec node...');
544
531
  const aztecNode = await AztecNodeService.createAndSync(
545
532
  aztecNodeConfig,
546
- { telemetry, dateProvider },
533
+ { telemetry, dateProvider, blobClient },
547
534
  { prefilledPublicData },
548
535
  );
549
536
 
@@ -588,7 +575,6 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
588
575
  watcher,
589
576
  cheatCodes,
590
577
  dateProvider,
591
- blobSink,
592
578
  initialFundedAccounts,
593
579
  directoryToCleanup,
594
580
  };