@aztec/archiver 0.0.1-commit.1bea0213 → 0.0.1-commit.21ecf947b

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 (64) hide show
  1. package/dest/archiver.d.ts +3 -2
  2. package/dest/archiver.d.ts.map +1 -1
  3. package/dest/archiver.js +15 -2
  4. package/dest/factory.d.ts +3 -1
  5. package/dest/factory.d.ts.map +1 -1
  6. package/dest/factory.js +6 -5
  7. package/dest/l1/bin/retrieve-calldata.js +18 -19
  8. package/dest/l1/calldata_retriever.d.ts +3 -1
  9. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  10. package/dest/l1/calldata_retriever.js +4 -2
  11. package/dest/l1/data_retrieval.d.ts +3 -2
  12. package/dest/l1/data_retrieval.d.ts.map +1 -1
  13. package/dest/l1/data_retrieval.js +4 -3
  14. package/dest/l1/validate_trace.d.ts +6 -3
  15. package/dest/l1/validate_trace.d.ts.map +1 -1
  16. package/dest/l1/validate_trace.js +13 -9
  17. package/dest/modules/data_source_base.d.ts +5 -5
  18. package/dest/modules/data_source_base.d.ts.map +1 -1
  19. package/dest/modules/instrumentation.d.ts +1 -1
  20. package/dest/modules/instrumentation.d.ts.map +1 -1
  21. package/dest/modules/instrumentation.js +17 -10
  22. package/dest/modules/l1_synchronizer.d.ts +1 -1
  23. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  24. package/dest/modules/l1_synchronizer.js +2 -3
  25. package/dest/store/block_store.d.ts +2 -2
  26. package/dest/store/block_store.d.ts.map +1 -1
  27. package/dest/store/block_store.js +2 -2
  28. package/dest/store/contract_class_store.d.ts +1 -1
  29. package/dest/store/contract_class_store.d.ts.map +1 -1
  30. package/dest/store/contract_class_store.js +11 -7
  31. package/dest/store/kv_archiver_store.d.ts +5 -5
  32. package/dest/store/kv_archiver_store.d.ts.map +1 -1
  33. package/dest/store/kv_archiver_store.js +2 -3
  34. package/dest/store/log_store.d.ts +1 -1
  35. package/dest/store/log_store.d.ts.map +1 -1
  36. package/dest/store/log_store.js +56 -36
  37. package/dest/test/index.js +3 -1
  38. package/dest/test/mock_l2_block_source.d.ts +4 -4
  39. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  40. package/dest/test/mock_l2_block_source.js +3 -3
  41. package/dest/test/mock_structs.d.ts +3 -2
  42. package/dest/test/mock_structs.d.ts.map +1 -1
  43. package/dest/test/mock_structs.js +7 -5
  44. package/dest/test/noop_l1_archiver.d.ts +23 -0
  45. package/dest/test/noop_l1_archiver.d.ts.map +1 -0
  46. package/dest/test/noop_l1_archiver.js +68 -0
  47. package/package.json +14 -13
  48. package/src/archiver.ts +22 -2
  49. package/src/factory.ts +19 -11
  50. package/src/l1/bin/retrieve-calldata.ts +17 -23
  51. package/src/l1/calldata_retriever.ts +5 -1
  52. package/src/l1/data_retrieval.ts +4 -1
  53. package/src/l1/validate_trace.ts +24 -6
  54. package/src/modules/data_source_base.ts +4 -4
  55. package/src/modules/instrumentation.ts +15 -10
  56. package/src/modules/l1_synchronizer.ts +2 -3
  57. package/src/store/block_store.ts +2 -2
  58. package/src/store/contract_class_store.ts +11 -7
  59. package/src/store/kv_archiver_store.ts +5 -5
  60. package/src/store/log_store.ts +95 -33
  61. package/src/test/index.ts +3 -0
  62. package/src/test/mock_l2_block_source.ts +5 -5
  63. package/src/test/mock_structs.ts +22 -6
  64. package/src/test/noop_l1_archiver.ts +109 -0
@@ -20,6 +20,7 @@ import {
20
20
  Tag,
21
21
  TxScopedL2Log,
22
22
  } from '@aztec/stdlib/logs';
23
+ import { TxHash } from '@aztec/stdlib/tx';
23
24
 
24
25
  import type { BlockStore } from './block_store.js';
25
26
 
@@ -219,6 +220,7 @@ export class LogStore {
219
220
  .map((txEffect, txIndex) =>
220
221
  [
221
222
  numToUInt32BE(txIndex),
223
+ txEffect.txHash.toBuffer(),
222
224
  numToUInt32BE(txEffect.publicLogs.length),
223
225
  txEffect.publicLogs.map(log => log.toBuffer()),
224
226
  ].flat(),
@@ -242,6 +244,7 @@ export class LogStore {
242
244
  .map((txEffect, txIndex) =>
243
245
  [
244
246
  numToUInt32BE(txIndex),
247
+ txEffect.txHash.toBuffer(),
245
248
  numToUInt32BE(txEffect.contractClassLogs.length),
246
249
  txEffect.contractClassLogs.map(log => log.toBuffer()),
247
250
  ].flat(),
@@ -271,7 +274,7 @@ export class LogStore {
271
274
  });
272
275
  }
273
276
 
274
- #packWithBlockHash(blockHash: Fr, data: Buffer<ArrayBufferLike>[]): Buffer<ArrayBufferLike> {
277
+ #packWithBlockHash(blockHash: BlockHash, data: Buffer<ArrayBufferLike>[]): Buffer<ArrayBufferLike> {
275
278
  return Buffer.concat([blockHash.toBuffer(), ...data]);
276
279
  }
277
280
 
@@ -282,7 +285,7 @@ export class LogStore {
282
285
  throw new Error('Failed to read block hash from log entry buffer');
283
286
  }
284
287
 
285
- return BlockHash.fromField(blockHash);
288
+ return new BlockHash(blockHash);
286
289
  }
287
290
 
288
291
  deleteLogs(blocks: L2Block[]): Promise<boolean> {
@@ -386,24 +389,33 @@ export class LogStore {
386
389
  }
387
390
 
388
391
  const buffer = (await this.#publicLogsByBlock.getAsync(blockNumber)) ?? Buffer.alloc(0);
389
- const publicLogsInBlock: [PublicLog[]] = [[]];
392
+ const publicLogsInBlock: { txHash: TxHash; logs: PublicLog[] }[] = [];
390
393
  const reader = new BufferReader(buffer);
391
394
 
392
395
  const blockHash = this.#unpackBlockHash(reader);
393
396
 
394
397
  while (reader.remainingBytes() > 0) {
395
398
  const indexOfTx = reader.readNumber();
399
+ const txHash = reader.readObject(TxHash);
396
400
  const numLogsInTx = reader.readNumber();
397
- publicLogsInBlock[indexOfTx] = [];
401
+ publicLogsInBlock[indexOfTx] = { txHash, logs: [] };
398
402
  for (let i = 0; i < numLogsInTx; i++) {
399
- publicLogsInBlock[indexOfTx].push(reader.readObject(PublicLog));
403
+ publicLogsInBlock[indexOfTx].logs.push(reader.readObject(PublicLog));
400
404
  }
401
405
  }
402
406
 
403
- const txLogs = publicLogsInBlock[txIndex];
407
+ const txData = publicLogsInBlock[txIndex];
404
408
 
405
409
  const logs: ExtendedPublicLog[] = [];
406
- const maxLogsHit = this.#accumulateLogs(logs, blockNumber, blockHash, txIndex, txLogs, filter);
410
+ const maxLogsHit = this.#accumulatePublicLogs(
411
+ logs,
412
+ blockNumber,
413
+ blockHash,
414
+ txIndex,
415
+ txData.txHash,
416
+ txData.logs,
417
+ filter,
418
+ );
407
419
 
408
420
  return { logs, maxLogsHit };
409
421
  }
@@ -424,22 +436,31 @@ export class LogStore {
424
436
 
425
437
  let maxLogsHit = false;
426
438
  loopOverBlocks: for await (const [blockNumber, logBuffer] of this.#publicLogsByBlock.entriesAsync({ start, end })) {
427
- const publicLogsInBlock: [PublicLog[]] = [[]];
439
+ const publicLogsInBlock: { txHash: TxHash; logs: PublicLog[] }[] = [];
428
440
  const reader = new BufferReader(logBuffer);
429
441
 
430
442
  const blockHash = this.#unpackBlockHash(reader);
431
443
 
432
444
  while (reader.remainingBytes() > 0) {
433
445
  const indexOfTx = reader.readNumber();
446
+ const txHash = reader.readObject(TxHash);
434
447
  const numLogsInTx = reader.readNumber();
435
- publicLogsInBlock[indexOfTx] = [];
448
+ publicLogsInBlock[indexOfTx] = { txHash, logs: [] };
436
449
  for (let i = 0; i < numLogsInTx; i++) {
437
- publicLogsInBlock[indexOfTx].push(reader.readObject(PublicLog));
450
+ publicLogsInBlock[indexOfTx].logs.push(reader.readObject(PublicLog));
438
451
  }
439
452
  }
440
453
  for (let txIndex = filter.afterLog?.txIndex ?? 0; txIndex < publicLogsInBlock.length; txIndex++) {
441
- const txLogs = publicLogsInBlock[txIndex];
442
- maxLogsHit = this.#accumulateLogs(logs, blockNumber, blockHash, txIndex, txLogs, filter);
454
+ const txData = publicLogsInBlock[txIndex];
455
+ maxLogsHit = this.#accumulatePublicLogs(
456
+ logs,
457
+ blockNumber,
458
+ blockHash,
459
+ txIndex,
460
+ txData.txHash,
461
+ txData.logs,
462
+ filter,
463
+ );
443
464
  if (maxLogsHit) {
444
465
  this.#log.debug(`Max logs hit at block ${blockNumber}`);
445
466
  break loopOverBlocks;
@@ -475,24 +496,33 @@ export class LogStore {
475
496
  return { logs: [], maxLogsHit: false };
476
497
  }
477
498
  const contractClassLogsBuffer = (await this.#contractClassLogsByBlock.getAsync(blockNumber)) ?? Buffer.alloc(0);
478
- const contractClassLogsInBlock: [ContractClassLog[]] = [[]];
499
+ const contractClassLogsInBlock: { txHash: TxHash; logs: ContractClassLog[] }[] = [];
479
500
 
480
501
  const reader = new BufferReader(contractClassLogsBuffer);
481
502
  const blockHash = this.#unpackBlockHash(reader);
482
503
 
483
504
  while (reader.remainingBytes() > 0) {
484
505
  const indexOfTx = reader.readNumber();
506
+ const txHash = reader.readObject(TxHash);
485
507
  const numLogsInTx = reader.readNumber();
486
- contractClassLogsInBlock[indexOfTx] = [];
508
+ contractClassLogsInBlock[indexOfTx] = { txHash, logs: [] };
487
509
  for (let i = 0; i < numLogsInTx; i++) {
488
- contractClassLogsInBlock[indexOfTx].push(reader.readObject(ContractClassLog));
510
+ contractClassLogsInBlock[indexOfTx].logs.push(reader.readObject(ContractClassLog));
489
511
  }
490
512
  }
491
513
 
492
- const txLogs = contractClassLogsInBlock[txIndex];
514
+ const txData = contractClassLogsInBlock[txIndex];
493
515
 
494
516
  const logs: ExtendedContractClassLog[] = [];
495
- const maxLogsHit = this.#accumulateLogs(logs, blockNumber, blockHash, txIndex, txLogs, filter);
517
+ const maxLogsHit = this.#accumulateContractClassLogs(
518
+ logs,
519
+ blockNumber,
520
+ blockHash,
521
+ txIndex,
522
+ txData.txHash,
523
+ txData.logs,
524
+ filter,
525
+ );
496
526
 
497
527
  return { logs, maxLogsHit };
498
528
  }
@@ -516,20 +546,29 @@ export class LogStore {
516
546
  start,
517
547
  end,
518
548
  })) {
519
- const contractClassLogsInBlock: [ContractClassLog[]] = [[]];
549
+ const contractClassLogsInBlock: { txHash: TxHash; logs: ContractClassLog[] }[] = [];
520
550
  const reader = new BufferReader(logBuffer);
521
551
  const blockHash = this.#unpackBlockHash(reader);
522
552
  while (reader.remainingBytes() > 0) {
523
553
  const indexOfTx = reader.readNumber();
554
+ const txHash = reader.readObject(TxHash);
524
555
  const numLogsInTx = reader.readNumber();
525
- contractClassLogsInBlock[indexOfTx] = [];
556
+ contractClassLogsInBlock[indexOfTx] = { txHash, logs: [] };
526
557
  for (let i = 0; i < numLogsInTx; i++) {
527
- contractClassLogsInBlock[indexOfTx].push(reader.readObject(ContractClassLog));
558
+ contractClassLogsInBlock[indexOfTx].logs.push(reader.readObject(ContractClassLog));
528
559
  }
529
560
  }
530
561
  for (let txIndex = filter.afterLog?.txIndex ?? 0; txIndex < contractClassLogsInBlock.length; txIndex++) {
531
- const txLogs = contractClassLogsInBlock[txIndex];
532
- maxLogsHit = this.#accumulateLogs(logs, blockNumber, blockHash, txIndex, txLogs, filter);
562
+ const txData = contractClassLogsInBlock[txIndex];
563
+ maxLogsHit = this.#accumulateContractClassLogs(
564
+ logs,
565
+ blockNumber,
566
+ blockHash,
567
+ txIndex,
568
+ txData.txHash,
569
+ txData.logs,
570
+ filter,
571
+ );
533
572
  if (maxLogsHit) {
534
573
  this.#log.debug(`Max logs hit at block ${blockNumber}`);
535
574
  break loopOverBlocks;
@@ -540,12 +579,13 @@ export class LogStore {
540
579
  return { logs, maxLogsHit };
541
580
  }
542
581
 
543
- #accumulateLogs(
544
- results: (ExtendedContractClassLog | ExtendedPublicLog)[],
582
+ #accumulatePublicLogs(
583
+ results: ExtendedPublicLog[],
545
584
  blockNumber: number,
546
585
  blockHash: BlockHash,
547
586
  txIndex: number,
548
- txLogs: (ContractClassLog | PublicLog)[],
587
+ txHash: TxHash,
588
+ txLogs: PublicLog[],
549
589
  filter: LogFilter = {},
550
590
  ): boolean {
551
591
  let maxLogsHit = false;
@@ -553,15 +593,37 @@ export class LogStore {
553
593
  for (; logIndex < txLogs.length; logIndex++) {
554
594
  const log = txLogs[logIndex];
555
595
  if (!filter.contractAddress || log.contractAddress.equals(filter.contractAddress)) {
556
- if (log instanceof ContractClassLog) {
557
- results.push(
558
- new ExtendedContractClassLog(new LogId(BlockNumber(blockNumber), blockHash, txIndex, logIndex), log),
559
- );
560
- } else if (log instanceof PublicLog) {
561
- results.push(new ExtendedPublicLog(new LogId(BlockNumber(blockNumber), blockHash, txIndex, logIndex), log));
562
- } else {
563
- throw new Error('Unknown log type');
596
+ results.push(
597
+ new ExtendedPublicLog(new LogId(BlockNumber(blockNumber), blockHash, txHash, txIndex, logIndex), log),
598
+ );
599
+
600
+ if (results.length >= this.#logsMaxPageSize) {
601
+ maxLogsHit = true;
602
+ break;
564
603
  }
604
+ }
605
+ }
606
+
607
+ return maxLogsHit;
608
+ }
609
+
610
+ #accumulateContractClassLogs(
611
+ results: ExtendedContractClassLog[],
612
+ blockNumber: number,
613
+ blockHash: BlockHash,
614
+ txIndex: number,
615
+ txHash: TxHash,
616
+ txLogs: ContractClassLog[],
617
+ filter: LogFilter = {},
618
+ ): boolean {
619
+ let maxLogsHit = false;
620
+ let logIndex = typeof filter.afterLog?.logIndex === 'number' ? filter.afterLog.logIndex + 1 : 0;
621
+ for (; logIndex < txLogs.length; logIndex++) {
622
+ const log = txLogs[logIndex];
623
+ if (!filter.contractAddress || log.contractAddress.equals(filter.contractAddress)) {
624
+ results.push(
625
+ new ExtendedContractClassLog(new LogId(BlockNumber(blockNumber), blockHash, txHash, txIndex, logIndex), log),
626
+ );
565
627
 
566
628
  if (results.length >= this.#logsMaxPageSize) {
567
629
  maxLogsHit = true;
package/src/test/index.ts CHANGED
@@ -2,3 +2,6 @@ export * from './mock_structs.js';
2
2
  export * from './mock_l2_block_source.js';
3
3
  export * from './mock_l1_to_l2_message_source.js';
4
4
  export * from './mock_archiver.js';
5
+ // NOTE: noop_l1_archiver.js is intentionally NOT exported here because it imports
6
+ // jest-mock-extended, which depends on @jest/globals and can only run inside Jest.
7
+ // Import it directly: import { NoopL1Archiver } from '@aztec/archiver/test/noop-l1';
@@ -195,7 +195,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
195
195
  return checkpoint;
196
196
  }
197
197
 
198
- public async getCheckpointedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined> {
198
+ public async getCheckpointedBlockByHash(blockHash: BlockHash): Promise<CheckpointedL2Block | undefined> {
199
199
  for (const block of this.l2Blocks) {
200
200
  const hash = await block.hash();
201
201
  if (hash.equals(blockHash)) {
@@ -225,7 +225,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
225
225
  );
226
226
  }
227
227
 
228
- public async getL2BlockByHash(blockHash: Fr): Promise<L2Block | undefined> {
228
+ public async getL2BlockByHash(blockHash: BlockHash): Promise<L2Block | undefined> {
229
229
  for (const block of this.l2Blocks) {
230
230
  const hash = await block.hash();
231
231
  if (hash.equals(blockHash)) {
@@ -240,7 +240,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
240
240
  return Promise.resolve(block);
241
241
  }
242
242
 
243
- public async getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined> {
243
+ public async getBlockHeaderByHash(blockHash: BlockHash): Promise<BlockHeader | undefined> {
244
244
  for (const block of this.l2Blocks) {
245
245
  const hash = await block.hash();
246
246
  if (hash.equals(blockHash)) {
@@ -322,7 +322,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
322
322
  return {
323
323
  data: txEffect,
324
324
  l2BlockNumber: block.number,
325
- l2BlockHash: BlockHash.fromField(await block.hash()),
325
+ l2BlockHash: await block.hash(),
326
326
  txIndexInBlock: block.body.txEffects.indexOf(txEffect),
327
327
  };
328
328
  }
@@ -343,7 +343,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
343
343
  TxExecutionResult.SUCCESS,
344
344
  undefined,
345
345
  txEffect.transactionFee.toBigInt(),
346
- BlockHash.fromField(await block.hash()),
346
+ await block.hash(),
347
347
  block.number,
348
348
  );
349
349
  }
@@ -46,24 +46,40 @@ export function makeInboxMessage(
46
46
  }
47
47
 
48
48
  export function makeInboxMessages(
49
- count: number,
49
+ totalCount: number,
50
50
  opts: {
51
51
  initialHash?: Buffer16;
52
52
  initialCheckpointNumber?: CheckpointNumber;
53
+ messagesPerCheckpoint?: number;
53
54
  overrideFn?: (msg: InboxMessage, index: number) => InboxMessage;
54
55
  } = {},
55
56
  ): InboxMessage[] {
56
- const { initialHash = Buffer16.ZERO, overrideFn = msg => msg, initialCheckpointNumber = 1 } = opts;
57
+ const {
58
+ initialHash = Buffer16.ZERO,
59
+ overrideFn = msg => msg,
60
+ initialCheckpointNumber = CheckpointNumber(1),
61
+ messagesPerCheckpoint = 1,
62
+ } = opts;
63
+
57
64
  const messages: InboxMessage[] = [];
58
65
  let rollingHash = initialHash;
59
- for (let i = 0; i < count; i++) {
66
+ for (let i = 0; i < totalCount; i++) {
67
+ const msgIndex = i % messagesPerCheckpoint;
68
+ const checkpointNumber = CheckpointNumber.fromBigInt(
69
+ BigInt(initialCheckpointNumber) + BigInt(i) / BigInt(messagesPerCheckpoint),
70
+ );
60
71
  const leaf = Fr.random();
61
- const checkpointNumber = CheckpointNumber(i + initialCheckpointNumber);
62
- const message = overrideFn(makeInboxMessage(rollingHash, { leaf, checkpointNumber }), i);
72
+ const message = overrideFn(
73
+ makeInboxMessage(rollingHash, {
74
+ leaf,
75
+ checkpointNumber,
76
+ index: InboxLeaf.smallestIndexForCheckpoint(checkpointNumber) + BigInt(msgIndex),
77
+ }),
78
+ i,
79
+ );
63
80
  rollingHash = message.rollingHash;
64
81
  messages.push(message);
65
82
  }
66
-
67
83
  return messages;
68
84
  }
69
85
 
@@ -0,0 +1,109 @@
1
+ import type { BlobClientInterface } from '@aztec/blob-client/client';
2
+ import type { RollupContract } from '@aztec/ethereum/contracts';
3
+ import type { ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum/types';
4
+ import { Buffer32 } from '@aztec/foundation/buffer';
5
+ import { Fr } from '@aztec/foundation/curves/bn254';
6
+ import { EthAddress } from '@aztec/foundation/eth-address';
7
+ import type { FunctionsOf } from '@aztec/foundation/types';
8
+ import type { ArchiverEmitter } from '@aztec/stdlib/block';
9
+ import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
10
+ import { type TelemetryClient, type Tracer, getTelemetryClient } from '@aztec/telemetry-client';
11
+
12
+ import { mock } from 'jest-mock-extended';
13
+ import { EventEmitter } from 'node:events';
14
+
15
+ import { Archiver } from '../archiver.js';
16
+ import { ArchiverInstrumentation } from '../modules/instrumentation.js';
17
+ import type { ArchiverL1Synchronizer } from '../modules/l1_synchronizer.js';
18
+ import type { KVArchiverDataStore } from '../store/kv_archiver_store.js';
19
+
20
+ /** Noop L1 synchronizer for testing without L1 connectivity. */
21
+ class NoopL1Synchronizer implements FunctionsOf<ArchiverL1Synchronizer> {
22
+ public readonly tracer: Tracer;
23
+
24
+ constructor(tracer: Tracer) {
25
+ this.tracer = tracer;
26
+ }
27
+
28
+ setConfig(_config: unknown) {}
29
+ getL1BlockNumber(): bigint | undefined {
30
+ return 0n;
31
+ }
32
+ getL1Timestamp(): bigint | undefined {
33
+ return 0n;
34
+ }
35
+ testEthereumNodeSynced(): Promise<void> {
36
+ return Promise.resolve();
37
+ }
38
+ syncFromL1(_initialSyncComplete: boolean): Promise<void> {
39
+ return Promise.resolve();
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Archiver with mocked L1 connectivity for testing.
45
+ * Uses mock L1 clients and a noop synchronizer, enabling tests that
46
+ * don't require real Ethereum connectivity.
47
+ */
48
+ export class NoopL1Archiver extends Archiver {
49
+ constructor(
50
+ dataStore: KVArchiverDataStore,
51
+ l1Constants: L1RollupConstants & { genesisArchiveRoot: Fr },
52
+ instrumentation: ArchiverInstrumentation,
53
+ ) {
54
+ // Create mocks for L1 clients
55
+ const publicClient = mock<ViemPublicClient>();
56
+ const debugClient = mock<ViemPublicDebugClient>();
57
+ const rollup = mock<RollupContract>();
58
+ const blobClient = mock<BlobClientInterface>();
59
+
60
+ // Mock methods called during start()
61
+ blobClient.testSources.mockResolvedValue();
62
+ publicClient.getBlockNumber.mockResolvedValue(1n);
63
+
64
+ const events = new EventEmitter() as ArchiverEmitter;
65
+ const synchronizer = new NoopL1Synchronizer(instrumentation.tracer);
66
+
67
+ super(
68
+ publicClient,
69
+ debugClient,
70
+ rollup,
71
+ {
72
+ registryAddress: EthAddress.ZERO,
73
+ governanceProposerAddress: EthAddress.ZERO,
74
+ slashFactoryAddress: EthAddress.ZERO,
75
+ slashingProposerAddress: EthAddress.ZERO,
76
+ },
77
+ dataStore,
78
+ {
79
+ pollingIntervalMs: 1000,
80
+ batchSize: 100,
81
+ skipValidateCheckpointAttestations: true,
82
+ maxAllowedEthClientDriftSeconds: 300,
83
+ ethereumAllowNoDebugHosts: true, // Skip trace validation
84
+ },
85
+ blobClient,
86
+ instrumentation,
87
+ { ...l1Constants, l1StartBlockHash: Buffer32.random() },
88
+ synchronizer as ArchiverL1Synchronizer,
89
+ events,
90
+ );
91
+ }
92
+
93
+ /** Override start to skip L1 validation checks. */
94
+ public override start(_blockUntilSynced?: boolean): Promise<void> {
95
+ // Just start the running promise without L1 checks
96
+ this.runningPromise.start();
97
+ return Promise.resolve();
98
+ }
99
+ }
100
+
101
+ /** Creates an archiver with mocked L1 connectivity for testing. */
102
+ export async function createNoopL1Archiver(
103
+ dataStore: KVArchiverDataStore,
104
+ l1Constants: L1RollupConstants & { genesisArchiveRoot: Fr },
105
+ telemetry: TelemetryClient = getTelemetryClient(),
106
+ ): Promise<NoopL1Archiver> {
107
+ const instrumentation = await ArchiverInstrumentation.new(telemetry, () => dataStore.estimateSize());
108
+ return new NoopL1Archiver(dataStore, l1Constants, instrumentation);
109
+ }