@aztec/blob-client 0.0.1-commit.c2eed6949 → 0.0.1-commit.c52d6e7

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.
@@ -20,6 +20,7 @@ export class HttpBlobClient {
20
20
  healthcheckUploadIntervalId;
21
21
  /** Cached beacon genesis time (seconds since Unix epoch). Fetched once at startup. */ beaconGenesisTime;
22
22
  /** Cached beacon slot duration in seconds. Fetched once at startup. */ beaconSecondsPerSlot;
23
+ /** Indexes of consensus hosts that serve blob sidecars (supernodes). Populated by testSources(). */ superNodeHostIndexes;
23
24
  constructor(config, opts = {}){
24
25
  this.opts = opts;
25
26
  this.disabled = false;
@@ -73,6 +74,7 @@ export class HttpBlobClient {
73
74
  let consensusNonSuperNodes = 0;
74
75
  let archiveSources = 0;
75
76
  let blobSinks = 0;
77
+ const detectedSuperNodes = new Set();
76
78
  if (l1ConsensusHostUrls && l1ConsensusHostUrls.length > 0) {
77
79
  for(let l1ConsensusHostIndex = 0; l1ConsensusHostIndex < l1ConsensusHostUrls.length; l1ConsensusHostIndex++){
78
80
  const l1ConsensusHostUrl = l1ConsensusHostUrls[l1ConsensusHostIndex];
@@ -101,9 +103,10 @@ export class HttpBlobClient {
101
103
  this.log.info(`L1 consensus host serves blob sidecars (supernode)`, {
102
104
  l1ConsensusHostUrl
103
105
  });
106
+ detectedSuperNodes.add(l1ConsensusHostIndex);
104
107
  consensusSuperNodes++;
105
108
  } else {
106
- this.log.info(`L1 consensus host does not serve blob sidecars`, {
109
+ this.log.info(`L1 consensus host does not serve blob sidecars, skipping for blob fetching`, {
107
110
  l1ConsensusHostUrl
108
111
  });
109
112
  consensusNonSuperNodes++;
@@ -121,6 +124,7 @@ export class HttpBlobClient {
121
124
  }
122
125
  }
123
126
  }
127
+ this.superNodeHostIndexes = detectedSuperNodes;
124
128
  if (this.archiveClient) {
125
129
  try {
126
130
  const latest = await this.archiveClient.getLatestBlock();
@@ -193,29 +197,25 @@ export class HttpBlobClient {
193
197
  }
194
198
  }
195
199
  /**
196
- * Get the blob sidecar
200
+ * Get the blob sidecar.
197
201
  *
198
- * If requesting from the blob client, we send the blobkHash
199
- * If requesting from the beacon node, we send the slot number
200
- *
201
- * Source ordering depends on sync state:
202
- * - Historical sync: blob client → FileStore → L1 consensus → Archive
203
- * - Near tip sync: blob client → FileStore → L1 consensus → FileStore (with retries) → Archive (eg blobscan)
202
+ * Alternates between two primary sources (consensus and filestore) in a retry loop,
203
+ * then falls back to archive if blobs are still missing. The order of the primary
204
+ * sources is configurable via `blobPreferFilestores`.
204
205
  *
205
206
  * @param blockHash - The block hash
206
207
  * @param blobHashes - The blob hashes to fetch
207
- * @param opts - Options including isHistoricalSync flag
208
+ * @param opts - Options for slot resolution
208
209
  * @returns The blobs
209
210
  */ async getBlobSidecar(blockHash, blobHashes, opts) {
210
211
  if (this.disabled) {
211
212
  this.log.warn('Blob storage is disabled, returning empty blob sidecar');
212
213
  return [];
213
214
  }
214
- const isHistoricalSync = opts?.isHistoricalSync ?? false;
215
215
  // Accumulate blobs across sources, preserving order and handling duplicates
216
216
  // resultBlobs[i] will contain the blob for blobHashes[i], or undefined if not yet found
217
217
  const resultBlobs = new Array(blobHashes.length).fill(undefined);
218
- // Helper to get missing blob hashes that we still need to fetch
218
+ // Helper to get missing blob hashes that we still need to fetch
219
219
  const getMissingBlobHashes = ()=>blobHashes.map((bh, i)=>resultBlobs[i] === undefined ? bh : undefined).filter((bh)=>bh !== undefined);
220
220
  // Return the result, ignoring any undefined ones
221
221
  const getFilledBlobs = ()=>resultBlobs.filter((b)=>b !== undefined);
@@ -237,80 +237,69 @@ export class HttpBlobClient {
237
237
  }
238
238
  return blobs;
239
239
  };
240
- const { l1ConsensusHostUrls } = this.config;
241
240
  const ctx = {
242
241
  blockHash,
243
242
  blobHashes: blobHashes.map(bufferToHex)
244
243
  };
245
- // Try filestore (quick, no retries) - useful for both historical and near-tip sync
246
- if (this.fileStoreClients.length > 0 && getMissingBlobHashes().length > 0) {
247
- await this.tryFileStores(getMissingBlobHashes, fillResults, ctx);
248
- if (getMissingBlobHashes().length === 0) {
249
- return returnWithCallback(getFilledBlobs());
244
+ // Lazily resolve the slot number only resolved when consensus hosts are actually tried.
245
+ let slotNumber;
246
+ let slotResolved = false;
247
+ const getSlotNumber = async ()=>{
248
+ if (!slotResolved) {
249
+ slotNumber = await this.resolveSlotNumber(blockHash, opts);
250
+ slotResolved = true;
250
251
  }
251
- }
252
- const missingAfterSink = getMissingBlobHashes();
253
- if (missingAfterSink.length > 0 && l1ConsensusHostUrls && l1ConsensusHostUrls.length > 0) {
254
- // The beacon api can query by slot number, so we get that first
255
- const consensusCtx = {
256
- l1ConsensusHostUrls,
257
- ...ctx
258
- };
259
- this.log.trace(`Attempting to get slot number for block hash`, consensusCtx);
260
- const slotNumber = await this.getSlotNumber(blockHash, opts?.parentBeaconBlockRoot, opts?.l1BlockTimestamp);
261
- this.log.debug(`Got slot number ${slotNumber} from consensus host for querying blobs`, consensusCtx);
262
- if (slotNumber) {
263
- let l1ConsensusHostUrl;
264
- for(let l1ConsensusHostIndex = 0; l1ConsensusHostIndex < l1ConsensusHostUrls.length; l1ConsensusHostIndex++){
265
- const missingHashes = getMissingBlobHashes();
266
- if (missingHashes.length === 0) {
267
- break;
268
- }
269
- l1ConsensusHostUrl = l1ConsensusHostUrls[l1ConsensusHostIndex];
270
- this.log.trace(`Attempting to get ${missingHashes.length} blobs from consensus host`, {
271
- slotNumber,
272
- l1ConsensusHostUrl,
273
- ...ctx
274
- });
275
- const blobs = await this.getBlobsFromHost(l1ConsensusHostUrl, slotNumber, l1ConsensusHostIndex, getMissingBlobHashes());
276
- const result = await fillResults(blobs);
277
- this.log.debug(`Got ${blobs.length} blobs from consensus host (total: ${result.length}/${blobHashes.length})`, {
278
- slotNumber,
279
- l1ConsensusHostUrl,
280
- ...ctx
281
- });
282
- if (result.length === blobHashes.length) {
283
- return returnWithCallback(result);
284
- }
252
+ return slotNumber;
253
+ };
254
+ // Build the two source-try functions. The order depends on the config.
255
+ const tryConsensus = ()=>this.tryConsensusHosts(getSlotNumber, getMissingBlobHashes, fillResults, ctx);
256
+ const tryFilestores = ()=>this.tryFileStores(getMissingBlobHashes, fillResults, ctx);
257
+ const preferFilestores = this.config.blobPreferFilestores ?? false;
258
+ const [trySourceA, trySourceB] = preferFilestores ? [
259
+ tryFilestores,
260
+ tryConsensus
261
+ ] : [
262
+ tryConsensus,
263
+ tryFilestores
264
+ ];
265
+ // Historical sync: blobs should already exist, use shorter backoff for transient errors.
266
+ // Near-tip sync: blobs may still be uploading, use longer backoff for eventual consistency.
267
+ const isHistoricalSync = opts?.isHistoricalSync ?? false;
268
+ const backoff = isHistoricalSync ? [
269
+ 1,
270
+ 1
271
+ ] : [
272
+ 1,
273
+ 1,
274
+ 1,
275
+ 2,
276
+ 2
277
+ ];
278
+ // Retry loop: alternate between the two primary sources with backoff.
279
+ try {
280
+ await retry(async ()=>{
281
+ if (getMissingBlobHashes().length > 0) {
282
+ await trySourceA();
285
283
  }
286
- }
287
- }
288
- // For near-tip sync, retry filestores with backoff (eventual consistency)
289
- // This handles the case where blobs are still being uploaded by other validators
290
- if (!isHistoricalSync && this.fileStoreClients.length > 0 && getMissingBlobHashes().length > 0) {
291
- try {
292
- await retry(async ()=>{
293
- await this.tryFileStores(getMissingBlobHashes, fillResults, ctx);
294
- if (getMissingBlobHashes().length > 0) {
295
- throw new Error('Still missing blobs from filestores');
296
- }
297
- }, 'filestore blob retrieval', makeBackoff([
298
- 1,
299
- 1,
300
- 2
301
- ]), this.log, true);
302
- return returnWithCallback(getFilledBlobs());
303
- } catch {
304
- // Exhausted retries, continue to archive fallback
305
- }
306
- }
307
- const missingAfterConsensus = getMissingBlobHashes();
308
- if (missingAfterConsensus.length > 0 && this.archiveClient) {
284
+ if (getMissingBlobHashes().length > 0) {
285
+ await trySourceB();
286
+ }
287
+ if (getMissingBlobHashes().length > 0) {
288
+ throw new Error('Still missing blobs after trying all primary sources');
289
+ }
290
+ }, 'blob retrieval', makeBackoff(backoff), this.log, true);
291
+ return returnWithCallback(getFilledBlobs());
292
+ } catch {
293
+ // Exhausted retries, continue to archive fallback
294
+ }
295
+ // Archive fallback
296
+ const missingAfterPrimary = getMissingBlobHashes();
297
+ if (missingAfterPrimary.length > 0 && this.archiveClient) {
309
298
  const archiveCtx = {
310
299
  archiveUrl: this.archiveClient.getBaseUrl(),
311
300
  ...ctx
312
301
  };
313
- this.log.trace(`Attempting to get ${missingAfterConsensus.length} blobs from archive`, archiveCtx);
302
+ this.log.trace(`Attempting to get ${missingAfterPrimary.length} blobs from archive`, archiveCtx);
314
303
  const allBlobs = await this.archiveClient.getBlobsFromBlock(blockHash);
315
304
  if (!allBlobs) {
316
305
  this.log.debug('No blobs found from archive client', archiveCtx);
@@ -326,13 +315,63 @@ export class HttpBlobClient {
326
315
  const result = getFilledBlobs();
327
316
  if (result.length < blobHashes.length) {
328
317
  this.log.warn(`Failed to fetch all blobs for ${blockHash} from all blob sources (got ${result.length}/${blobHashes.length})`, {
329
- l1ConsensusHostUrls,
318
+ l1ConsensusHostUrls: this.config.l1ConsensusHostUrls,
330
319
  archiveUrl: this.archiveClient?.getBaseUrl(),
331
320
  fileStoreUrls: this.fileStoreClients.map((c)=>c.getBaseUrl())
332
321
  });
333
322
  }
334
323
  return returnWithCallback(result);
335
324
  }
325
+ /** Resolves the beacon slot number for the given block hash. Returns undefined if no consensus hosts. */ resolveSlotNumber(blockHash, opts) {
326
+ const { l1ConsensusHostUrls } = this.config;
327
+ if (!l1ConsensusHostUrls || l1ConsensusHostUrls.length === 0) {
328
+ return undefined;
329
+ }
330
+ // If no supernodes, no point resolving the slot
331
+ if (this.superNodeHostIndexes && this.superNodeHostIndexes.size === 0) {
332
+ return undefined;
333
+ }
334
+ return this.getSlotNumber(blockHash, opts?.parentBeaconBlockRoot, opts?.l1BlockTimestamp);
335
+ }
336
+ /**
337
+ * Try all supernode consensus hosts for blob sidecars.
338
+ * Skips hosts that were detected as non-supernodes during testSources().
339
+ */ async tryConsensusHosts(getSlotNumber, getMissingBlobHashes, fillResults, ctx) {
340
+ const { l1ConsensusHostUrls } = this.config;
341
+ if (!l1ConsensusHostUrls || l1ConsensusHostUrls.length === 0) {
342
+ return;
343
+ }
344
+ const slotNumber = await getSlotNumber();
345
+ if (!slotNumber) {
346
+ return;
347
+ }
348
+ for(let l1ConsensusHostIndex = 0; l1ConsensusHostIndex < l1ConsensusHostUrls.length; l1ConsensusHostIndex++){
349
+ const missingHashes = getMissingBlobHashes();
350
+ if (missingHashes.length === 0) {
351
+ break;
352
+ }
353
+ // Skip non-supernode hosts if we've already detected supernodes
354
+ if (this.superNodeHostIndexes && !this.superNodeHostIndexes.has(l1ConsensusHostIndex)) {
355
+ this.log.trace(`Skipping non-supernode consensus host`, {
356
+ l1ConsensusHostUrl: l1ConsensusHostUrls[l1ConsensusHostIndex]
357
+ });
358
+ continue;
359
+ }
360
+ const l1ConsensusHostUrl = l1ConsensusHostUrls[l1ConsensusHostIndex];
361
+ this.log.trace(`Attempting to get ${missingHashes.length} blobs from consensus host`, {
362
+ slotNumber,
363
+ l1ConsensusHostUrl,
364
+ ...ctx
365
+ });
366
+ const blobs = await this.getBlobsFromHost(l1ConsensusHostUrl, slotNumber, l1ConsensusHostIndex, missingHashes);
367
+ const result = await fillResults(blobs);
368
+ this.log.debug(`Got ${blobs.length} blobs from consensus host (total: ${result.length}/${ctx.blobHashes.length})`, {
369
+ slotNumber,
370
+ l1ConsensusHostUrl,
371
+ ...ctx
372
+ });
373
+ }
374
+ }
336
375
  /**
337
376
  * Try all filestores once (shuffled for load distribution).
338
377
  * @param getMissingBlobHashes - Function to get remaining blob hashes to fetch
@@ -419,19 +458,20 @@ export class HttpBlobClient {
419
458
  }
420
459
  baseUrl += `?${params.toString()}`;
421
460
  }
422
- const { url, ...options } = getBeaconNodeFetchOptions(baseUrl, this.config, l1ConsensusHostIndex);
461
+ const { url, logSafeUrl, ...options } = getBeaconNodeFetchOptions(baseUrl, this.config, l1ConsensusHostIndex);
423
462
  this.log.debug(`Fetching blob sidecar for ${blockHashOrSlot}`, {
424
- url,
463
+ url: logSafeUrl,
425
464
  ...options
426
465
  });
427
- return this.fetch(url, options);
466
+ // No retry here — this is called inside the main retry loop in getBlobSidecar
467
+ return fetch(url, options);
428
468
  }
429
469
  async getLatestSlotNumber(hostUrl, l1ConsensusHostIndex) {
430
470
  try {
431
471
  const baseUrl = `${hostUrl}/eth/v1/beacon/headers/head`;
432
- const { url, ...options } = getBeaconNodeFetchOptions(baseUrl, this.config, l1ConsensusHostIndex);
472
+ const { url, logSafeUrl, ...options } = getBeaconNodeFetchOptions(baseUrl, this.config, l1ConsensusHostIndex);
433
473
  this.log.debug(`Fetching latest slot number`, {
434
- url,
474
+ url: logSafeUrl,
435
475
  ...options
436
476
  });
437
477
  const res = await this.fetch(url, options);
@@ -640,11 +680,15 @@ function getBeaconNodeFetchOptions(url, config, l1ConsensusHostIndex) {
640
680
  const l1ConsensusHostApiKey = l1ConsensusHostIndex !== undefined && l1ConsensusHostApiKeys && l1ConsensusHostApiKeys[l1ConsensusHostIndex];
641
681
  const l1ConsensusHostApiKeyHeader = l1ConsensusHostIndex !== undefined && l1ConsensusHostApiKeyHeaders && l1ConsensusHostApiKeyHeaders[l1ConsensusHostIndex];
642
682
  let formattedUrl = url;
683
+ let logSafeUrl = url;
643
684
  if (l1ConsensusHostApiKey && l1ConsensusHostApiKey.getValue() !== '' && !l1ConsensusHostApiKeyHeader) {
644
- formattedUrl += `${formattedUrl.includes('?') ? '&' : '?'}key=${l1ConsensusHostApiKey.getValue()}`;
685
+ const separator = formattedUrl.includes('?') ? '&' : '?';
686
+ formattedUrl += `${separator}key=${l1ConsensusHostApiKey.getValue()}`;
687
+ logSafeUrl += `${separator}key=[REDACTED]`;
645
688
  }
646
689
  return {
647
690
  url: formattedUrl,
691
+ logSafeUrl,
648
692
  ...l1ConsensusHostApiKey && l1ConsensusHostApiKeyHeader && {
649
693
  headers: {
650
694
  [l1ConsensusHostApiKeyHeader]: l1ConsensusHostApiKey.getValue()
@@ -5,9 +5,7 @@ import type { Blob } from '@aztec/blob-lib';
5
5
  export interface GetBlobSidecarOptions {
6
6
  /**
7
7
  * True if the archiver is catching up (historical sync), false if near tip.
8
- * This affects source ordering:
9
- * - Historical: FileStore first (data should exist), then L1 consensus, then archive (eg. blobscan)
10
- * - Near tip: FileStore first with no retries (data should exist), L1 consensus second (freshest data), then FileStore with retries, then archive (eg. blobscan)
8
+ * Historical sync uses a shorter retry backoff since blobs should already exist.
11
9
  */
12
10
  isHistoricalSync?: boolean;
13
11
  /**
@@ -36,4 +34,4 @@ export interface BlobClientInterface {
36
34
  /** Returns true if this client can upload blobs to filestore. */
37
35
  canUpload(): boolean;
38
36
  }
39
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpZW50L2ludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxJQUFJLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUU1Qzs7R0FFRztBQUNILE1BQU0sV0FBVyxxQkFBcUI7SUFDcEM7Ozs7O09BS0c7SUFDSCxnQkFBZ0IsQ0FBQyxFQUFFLE9BQU8sQ0FBQztJQUMzQjs7O09BR0c7SUFDSCxxQkFBcUIsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUMvQjs7OztPQUlHO0lBQ0gsZ0JBQWdCLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDM0I7QUFFRCxNQUFNLFdBQVcsbUJBQW1CO0lBQ2xDLDBFQUEwRTtJQUMxRSxvQkFBb0IsQ0FBQyxLQUFLLEVBQUUsSUFBSSxFQUFFLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ3RELHFFQUF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C,CAAC;IACxB,oFAAoF;IACpF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,IAAI,CAAC,IAAI,IAAI,CAAC;IACd,iEAAiE;IACjE,SAAS,IAAI,OAAO,CAAC;CACtB"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/client/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD,qEAAqE;IACrE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACtG,6EAA6E;IAC7E,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,oFAAoF;IACpF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,IAAI,CAAC,IAAI,IAAI,CAAC;IACd,iEAAiE;IACjE,SAAS,IAAI,OAAO,CAAC;CACtB"}
@@ -1,4 +1,5 @@
1
1
  import { type Logger } from '@aztec/foundation/log';
2
+ import { type HttpFileStoreOptions } from '@aztec/stdlib/file-store';
2
3
  import { FileStoreBlobClient } from './filestore_blob_client.js';
3
4
  /**
4
5
  * Metadata required to construct the base path for blob storage.
@@ -25,8 +26,8 @@ export declare function makeBlobBasePath(metadata: BlobFileStoreMetadata): strin
25
26
  * @param logger - Optional logger
26
27
  * @returns A FileStoreBlobClient for reading blobs, or undefined if storeUrl is undefined
27
28
  */
28
- export declare function createReadOnlyFileStoreBlobClient(storeUrl: string, metadata: BlobFileStoreMetadata, logger?: Logger): Promise<FileStoreBlobClient>;
29
- export declare function createReadOnlyFileStoreBlobClient(storeUrl: string | undefined, metadata: BlobFileStoreMetadata, logger?: Logger): Promise<FileStoreBlobClient | undefined>;
29
+ export declare function createReadOnlyFileStoreBlobClient(storeUrl: string, metadata: BlobFileStoreMetadata, logger?: Logger, httpOptions?: HttpFileStoreOptions): Promise<FileStoreBlobClient>;
30
+ export declare function createReadOnlyFileStoreBlobClient(storeUrl: string | undefined, metadata: BlobFileStoreMetadata, logger?: Logger, httpOptions?: HttpFileStoreOptions): Promise<FileStoreBlobClient | undefined>;
30
31
  /**
31
32
  * Creates multiple read-only FileStoreBlobClients from an array of URLs.
32
33
  *
@@ -35,7 +36,7 @@ export declare function createReadOnlyFileStoreBlobClient(storeUrl: string | und
35
36
  * @param logger - Optional logger
36
37
  * @returns Array of FileStoreBlobClients (excludes any that failed to create)
37
38
  */
38
- export declare function createReadOnlyFileStoreBlobClients(storeUrls: string[] | undefined, metadata: BlobFileStoreMetadata, logger?: Logger): Promise<FileStoreBlobClient[]>;
39
+ export declare function createReadOnlyFileStoreBlobClients(storeUrls: string[] | undefined, metadata: BlobFileStoreMetadata, logger?: Logger, httpOptions?: HttpFileStoreOptions): Promise<FileStoreBlobClient[]>;
39
40
  /**
40
41
  * Creates a writable FileStoreBlobClient for uploading blobs.
41
42
  * Note: https:// URLs are not supported for upload, only s3://, gs://, or file://.
@@ -47,4 +48,4 @@ export declare function createReadOnlyFileStoreBlobClients(storeUrls: string[] |
47
48
  */
48
49
  export declare function createWritableFileStoreBlobClient(storeUrl: string, metadata: BlobFileStoreMetadata, logger?: Logger): Promise<FileStoreBlobClient>;
49
50
  export declare function createWritableFileStoreBlobClient(storeUrl: string |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M,CAAC,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,oBAAoB,GACjC,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;AAoB5C;;;;;;;GAOG;AACH,wBAAsB,kCAAkC,CACtD,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,EAC/B,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,CAAC,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,oBAAoB,GACjC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAoBhC;AAED;;;;;;;;GAQG;AACH,wBAAsB,iCAAiC,CACrD,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAChC,wBAAsB,iCAAiC,CACrD,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC"}
@@ -10,7 +10,7 @@ import { FileStoreBlobClient } from './filestore_blob_client.js';
10
10
  const normalizedAddress = rollupAddress.toLowerCase().replace(/^0x/, '');
11
11
  return `aztec-${l1ChainId}-${rollupVersion}-0x${normalizedAddress}`;
12
12
  }
13
- export async function createReadOnlyFileStoreBlobClient(storeUrl, metadata, logger) {
13
+ export async function createReadOnlyFileStoreBlobClient(storeUrl, metadata, logger, httpOptions) {
14
14
  if (!storeUrl) {
15
15
  return undefined;
16
16
  }
@@ -20,7 +20,7 @@ export async function createReadOnlyFileStoreBlobClient(storeUrl, metadata, logg
20
20
  storeUrl,
21
21
  basePath
22
22
  });
23
- const store = await createReadOnlyFileStore(storeUrl, log);
23
+ const store = await createReadOnlyFileStore(storeUrl, log, httpOptions);
24
24
  return new FileStoreBlobClient(store, basePath, log);
25
25
  }
26
26
  /**
@@ -30,7 +30,7 @@ export async function createReadOnlyFileStoreBlobClient(storeUrl, metadata, logg
30
30
  * @param metadata - Chain metadata for constructing the base path
31
31
  * @param logger - Optional logger
32
32
  * @returns Array of FileStoreBlobClients (excludes any that failed to create)
33
- */ export async function createReadOnlyFileStoreBlobClients(storeUrls, metadata, logger) {
33
+ */ export async function createReadOnlyFileStoreBlobClients(storeUrls, metadata, logger, httpOptions) {
34
34
  if (!storeUrls || storeUrls.length === 0) {
35
35
  return [];
36
36
  }
@@ -38,7 +38,7 @@ export async function createReadOnlyFileStoreBlobClient(storeUrl, metadata, logg
38
38
  const clients = [];
39
39
  for (const storeUrl of storeUrls){
40
40
  try {
41
- const client = await createReadOnlyFileStoreBlobClient(storeUrl, metadata, log);
41
+ const client = await createReadOnlyFileStoreBlobClient(storeUrl, metadata, log, httpOptions);
42
42
  if (client) {
43
43
  clients.push(client);
44
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/blob-client",
3
- "version": "0.0.1-commit.c2eed6949",
3
+ "version": "0.0.1-commit.c52d6e7",
4
4
  "type": "module",
5
5
  "bin": "./dest/client/bin/index.js",
6
6
  "exports": {
@@ -56,18 +56,18 @@
56
56
  ]
57
57
  },
58
58
  "dependencies": {
59
- "@aztec/blob-lib": "0.0.1-commit.c2eed6949",
60
- "@aztec/ethereum": "0.0.1-commit.c2eed6949",
61
- "@aztec/foundation": "0.0.1-commit.c2eed6949",
62
- "@aztec/kv-store": "0.0.1-commit.c2eed6949",
63
- "@aztec/stdlib": "0.0.1-commit.c2eed6949",
64
- "@aztec/telemetry-client": "0.0.1-commit.c2eed6949",
59
+ "@aztec/blob-lib": "0.0.1-commit.c52d6e7",
60
+ "@aztec/ethereum": "0.0.1-commit.c52d6e7",
61
+ "@aztec/foundation": "0.0.1-commit.c52d6e7",
62
+ "@aztec/kv-store": "0.0.1-commit.c52d6e7",
63
+ "@aztec/stdlib": "0.0.1-commit.c52d6e7",
64
+ "@aztec/telemetry-client": "0.0.1-commit.c52d6e7",
65
65
  "express": "^4.21.2",
66
66
  "snappy": "^7.2.2",
67
67
  "source-map-support": "^0.5.21",
68
68
  "tslib": "^2.4.0",
69
69
  "viem": "npm:@aztec/viem@2.38.2",
70
- "zod": "^3.23.8"
70
+ "zod": "^4"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@jest/globals": "^30.0.0",
@@ -59,6 +59,12 @@ export interface BlobClientConfig extends BlobArchiveApiConfig {
59
59
 
60
60
  /** Timeout for HTTP requests to the L1 RPC node in ms. */
61
61
  l1HttpTimeoutMS?: number;
62
+
63
+ /** Whether to prefer filestores over consensus clients when fetching blobs. Default: false (consensus first). */
64
+ blobPreferFilestores?: boolean;
65
+
66
+ /** Timeout in ms for HTTP requests to the blob file store. Default: 10000 (10s). */
67
+ blobFileStoreTimeoutMs?: number;
62
68
  }
63
69
 
64
70
  export const blobClientConfigMapping: ConfigMappingsType<BlobClientConfig> = {
@@ -87,7 +93,7 @@ export const blobClientConfigMapping: ConfigMappingsType<BlobClientConfig> = {
87
93
  blobSinkMapSizeKb: {
88
94
  env: 'BLOB_SINK_MAP_SIZE_KB',
89
95
  description: 'The maximum possible size of the blob sink DB in KB. Overwrites the general dataStoreMapSizeKb.',
90
- parseEnv: (val: string | undefined) => (val ? +val : undefined),
96
+ ...optionalNumberConfigHelper(),
91
97
  },
92
98
  blobAllowEmptySources: {
93
99
  env: 'BLOB_ALLOW_EMPTY_SOURCES',
@@ -110,13 +116,23 @@ export const blobClientConfigMapping: ConfigMappingsType<BlobClientConfig> = {
110
116
  blobHealthcheckUploadIntervalMinutes: {
111
117
  env: 'BLOB_HEALTHCHECK_UPLOAD_INTERVAL_MINUTES',
112
118
  description: 'Interval in minutes for uploading healthcheck file to file store (default: 60 = 1 hour)',
113
- parseEnv: (val: string | undefined) => (val ? +val : undefined),
119
+ ...optionalNumberConfigHelper(),
114
120
  },
115
121
  l1HttpTimeoutMS: {
116
122
  env: 'ETHEREUM_HTTP_TIMEOUT_MS',
117
123
  description: 'Timeout for HTTP requests to the L1 RPC node in ms.',
118
124
  ...optionalNumberConfigHelper(),
119
125
  },
126
+ blobPreferFilestores: {
127
+ env: 'BLOB_PREFER_FILESTORES',
128
+ description: 'Whether to prefer filestores over consensus clients when fetching blobs. Default: false.',
129
+ ...booleanConfigHelper(false),
130
+ },
131
+ blobFileStoreTimeoutMs: {
132
+ env: 'BLOB_FILE_STORE_TIMEOUT_MS',
133
+ description: 'Timeout in ms for HTTP requests to the blob file store. Default: 10000 (10s).',
134
+ ...optionalNumberConfigHelper(),
135
+ },
120
136
  ...blobArchiveApiConfigMappings,
121
137
  };
122
138
 
@@ -48,7 +48,7 @@ export function createBlobClient(config?: BlobClientConfig, deps?: CreateBlobCli
48
48
  export interface BlobClientWithFileStoresConfig extends BlobClientConfig {
49
49
  l1ChainId: number;
50
50
  rollupVersion: number;
51
- l1Contracts: { rollupAddress: { toString(): string } };
51
+ rollupAddress: { toString(): string };
52
52
  }
53
53
 
54
54
  /**
@@ -73,11 +73,18 @@ export async function createBlobClientWithFileStores(
73
73
  const fileStoreMetadata: BlobFileStoreMetadata = {
74
74
  l1ChainId: config.l1ChainId,
75
75
  rollupVersion: config.rollupVersion,
76
- rollupAddress: config.l1Contracts.rollupAddress.toString(),
76
+ rollupAddress: config.rollupAddress.toString(),
77
+ };
78
+
79
+ // Disable internal retries for blob file stores — retry logic is handled by HttpBlobClient.
80
+ // Set a configurable timeout (default 10s) to avoid hanging on slow stores.
81
+ const httpOptions = {
82
+ retryBackoff: [] as number[],
83
+ timeoutMs: config.blobFileStoreTimeoutMs ?? 10_000,
77
84
  };
78
85
 
79
86
  const [fileStoreClients, fileStoreUploadClient] = await Promise.all([
80
- createReadOnlyFileStoreBlobClients(config.blobFileStoreUrls, fileStoreMetadata, log),
87
+ createReadOnlyFileStoreBlobClients(config.blobFileStoreUrls, fileStoreMetadata, log, httpOptions),
81
88
  createWritableFileStoreBlobClient(config.blobFileStoreUploadUrl, fileStoreMetadata, log),
82
89
  ]);
83
90