@aztec/archiver 0.0.1-commit.e558bd1c → 0.0.1-commit.e5a3663dd

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 (126) hide show
  1. package/README.md +12 -6
  2. package/dest/archiver.d.ts +26 -15
  3. package/dest/archiver.d.ts.map +1 -1
  4. package/dest/archiver.js +161 -153
  5. package/dest/config.d.ts +5 -3
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +16 -4
  8. package/dest/errors.d.ts +61 -10
  9. package/dest/errors.d.ts.map +1 -1
  10. package/dest/errors.js +88 -14
  11. package/dest/factory.d.ts +6 -7
  12. package/dest/factory.d.ts.map +1 -1
  13. package/dest/factory.js +40 -32
  14. package/dest/index.d.ts +11 -3
  15. package/dest/index.d.ts.map +1 -1
  16. package/dest/index.js +10 -2
  17. package/dest/l1/bin/retrieve-calldata.js +32 -28
  18. package/dest/l1/calldata_retriever.d.ts +74 -50
  19. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  20. package/dest/l1/calldata_retriever.js +197 -260
  21. package/dest/l1/data_retrieval.d.ts +26 -17
  22. package/dest/l1/data_retrieval.d.ts.map +1 -1
  23. package/dest/l1/data_retrieval.js +42 -47
  24. package/dest/l1/spire_proposer.d.ts +5 -5
  25. package/dest/l1/spire_proposer.d.ts.map +1 -1
  26. package/dest/l1/spire_proposer.js +9 -17
  27. package/dest/l1/validate_historical_logs.d.ts +23 -0
  28. package/dest/l1/validate_historical_logs.d.ts.map +1 -0
  29. package/dest/l1/validate_historical_logs.js +108 -0
  30. package/dest/modules/contract_data_source_adapter.d.ts +25 -0
  31. package/dest/modules/contract_data_source_adapter.d.ts.map +1 -0
  32. package/dest/modules/contract_data_source_adapter.js +42 -0
  33. package/dest/modules/data_source_base.d.ts +27 -14
  34. package/dest/modules/data_source_base.d.ts.map +1 -1
  35. package/dest/modules/data_source_base.js +98 -125
  36. package/dest/modules/data_store_updater.d.ts +37 -17
  37. package/dest/modules/data_store_updater.d.ts.map +1 -1
  38. package/dest/modules/data_store_updater.js +155 -112
  39. package/dest/modules/instrumentation.d.ts +21 -3
  40. package/dest/modules/instrumentation.d.ts.map +1 -1
  41. package/dest/modules/instrumentation.js +41 -8
  42. package/dest/modules/l1_synchronizer.d.ts +13 -11
  43. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  44. package/dest/modules/l1_synchronizer.js +355 -182
  45. package/dest/modules/validation.d.ts +4 -3
  46. package/dest/modules/validation.d.ts.map +1 -1
  47. package/dest/modules/validation.js +6 -6
  48. package/dest/store/block_store.d.ts +107 -31
  49. package/dest/store/block_store.d.ts.map +1 -1
  50. package/dest/store/block_store.js +477 -141
  51. package/dest/store/contract_class_store.d.ts +17 -4
  52. package/dest/store/contract_class_store.d.ts.map +1 -1
  53. package/dest/store/contract_class_store.js +24 -68
  54. package/dest/store/contract_instance_store.d.ts +28 -1
  55. package/dest/store/contract_instance_store.d.ts.map +1 -1
  56. package/dest/store/contract_instance_store.js +37 -2
  57. package/dest/store/data_stores.d.ts +68 -0
  58. package/dest/store/data_stores.d.ts.map +1 -0
  59. package/dest/store/data_stores.js +50 -0
  60. package/dest/store/function_names_cache.d.ts +17 -0
  61. package/dest/store/function_names_cache.d.ts.map +1 -0
  62. package/dest/store/function_names_cache.js +30 -0
  63. package/dest/store/l2_tips_cache.d.ts +20 -0
  64. package/dest/store/l2_tips_cache.d.ts.map +1 -0
  65. package/dest/store/l2_tips_cache.js +109 -0
  66. package/dest/store/log_store.d.ts +6 -3
  67. package/dest/store/log_store.d.ts.map +1 -1
  68. package/dest/store/log_store.js +95 -20
  69. package/dest/store/message_store.d.ts +11 -1
  70. package/dest/store/message_store.d.ts.map +1 -1
  71. package/dest/store/message_store.js +51 -9
  72. package/dest/test/fake_l1_state.d.ts +25 -1
  73. package/dest/test/fake_l1_state.d.ts.map +1 -1
  74. package/dest/test/fake_l1_state.js +166 -32
  75. package/dest/test/mock_archiver.d.ts +1 -1
  76. package/dest/test/mock_archiver.d.ts.map +1 -1
  77. package/dest/test/mock_archiver.js +3 -2
  78. package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
  79. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  80. package/dest/test/mock_l1_to_l2_message_source.js +2 -1
  81. package/dest/test/mock_l2_block_source.d.ts +35 -5
  82. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  83. package/dest/test/mock_l2_block_source.js +182 -89
  84. package/dest/test/mock_structs.d.ts +4 -1
  85. package/dest/test/mock_structs.d.ts.map +1 -1
  86. package/dest/test/mock_structs.js +13 -1
  87. package/dest/test/noop_l1_archiver.d.ts +7 -4
  88. package/dest/test/noop_l1_archiver.d.ts.map +1 -1
  89. package/dest/test/noop_l1_archiver.js +14 -8
  90. package/package.json +13 -13
  91. package/src/archiver.ts +199 -174
  92. package/src/config.ts +23 -2
  93. package/src/errors.ts +133 -22
  94. package/src/factory.ts +53 -30
  95. package/src/index.ts +18 -2
  96. package/src/l1/README.md +25 -68
  97. package/src/l1/bin/retrieve-calldata.ts +40 -27
  98. package/src/l1/calldata_retriever.ts +261 -379
  99. package/src/l1/data_retrieval.ts +58 -69
  100. package/src/l1/spire_proposer.ts +7 -15
  101. package/src/l1/validate_historical_logs.ts +140 -0
  102. package/src/modules/contract_data_source_adapter.ts +59 -0
  103. package/src/modules/data_source_base.ts +142 -144
  104. package/src/modules/data_store_updater.ts +187 -141
  105. package/src/modules/instrumentation.ts +56 -9
  106. package/src/modules/l1_synchronizer.ts +463 -218
  107. package/src/modules/validation.ts +10 -9
  108. package/src/store/block_store.ts +587 -177
  109. package/src/store/contract_class_store.ts +31 -103
  110. package/src/store/contract_instance_store.ts +51 -5
  111. package/src/store/data_stores.ts +108 -0
  112. package/src/store/function_names_cache.ts +37 -0
  113. package/src/store/l2_tips_cache.ts +134 -0
  114. package/src/store/log_store.ts +128 -32
  115. package/src/store/message_store.ts +60 -10
  116. package/src/structs/inbox_message.ts +1 -1
  117. package/src/test/fake_l1_state.ts +213 -42
  118. package/src/test/mock_archiver.ts +3 -2
  119. package/src/test/mock_l1_to_l2_message_source.ts +1 -0
  120. package/src/test/mock_l2_block_source.ts +230 -82
  121. package/src/test/mock_structs.ts +20 -6
  122. package/src/test/noop_l1_archiver.ts +16 -8
  123. package/dest/store/kv_archiver_store.d.ts +0 -340
  124. package/dest/store/kv_archiver_store.d.ts.map +0 -1
  125. package/dest/store/kv_archiver_store.js +0 -446
  126. package/src/store/kv_archiver_store.ts +0 -639
package/dest/archiver.js CHANGED
@@ -371,23 +371,25 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
371
371
  return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
372
372
  }
373
373
  var _dec, _initProto;
374
- import { GENESIS_BLOCK_HEADER_HASH, INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
375
374
  import { BlockTagTooOldError } from '@aztec/ethereum/contracts';
376
- import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
375
+ import { BlockNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
377
376
  import { Buffer32 } from '@aztec/foundation/buffer';
378
377
  import { merge } from '@aztec/foundation/collection';
379
378
  import { EthAddress } from '@aztec/foundation/eth-address';
380
379
  import { createLogger } from '@aztec/foundation/log';
381
380
  import { promiseWithResolvers } from '@aztec/foundation/promise';
382
381
  import { RunningPromise, makeLoggingErrorHandler } from '@aztec/foundation/running-promise';
383
- import { GENESIS_CHECKPOINT_HEADER_HASH } from '@aztec/stdlib/block';
384
- import { getEpochNumberAtTimestamp, getSlotAtNextL1Block, getSlotAtTimestamp, getSlotRangeForEpoch, getTimestampRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
382
+ import { elapsed } from '@aztec/foundation/timer';
383
+ import { getEpochAtSlot, getSlotAtNextL1Block, getSlotRangeForEpoch, getTimestampForSlot, getTimestampRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
385
384
  import { trackSpan } from '@aztec/telemetry-client';
386
385
  import { mapArchiverConfig } from './config.js';
387
- import { NoBlobBodiesFoundError } from './errors.js';
386
+ import { BlockAlreadyCheckpointedError, BlockOrCheckpointSlotExpiredError, NoBlobBodiesFoundError } from './errors.js';
387
+ import { validateAndLogHistoricalLogsAvailability } from './l1/validate_historical_logs.js';
388
388
  import { validateAndLogTraceAvailability } from './l1/validate_trace.js';
389
389
  import { ArchiverDataSourceBase } from './modules/data_source_base.js';
390
390
  import { ArchiverDataStoreUpdater } from './modules/data_store_updater.js';
391
+ import { backupArchiverDataStores, getArchiverSynchPoint } from './store/data_stores.js';
392
+ import { L2TipsCache } from './store/l2_tips_cache.js';
391
393
  _dec = trackSpan('Archiver.sync');
392
394
  /**
393
395
  * Pulls checkpoints in a non-blocking manner and provides interface for their retrieval.
@@ -398,7 +400,7 @@ _dec = trackSpan('Archiver.sync');
398
400
  debugClient;
399
401
  rollup;
400
402
  l1Addresses;
401
- dataStore;
403
+ dataStores;
402
404
  config;
403
405
  blobClient;
404
406
  l1Constants;
@@ -417,31 +419,36 @@ _dec = trackSpan('Archiver.sync');
417
419
  /** L1 synchronizer that handles fetching checkpoints and messages from L1. */ synchronizer;
418
420
  initialSyncComplete;
419
421
  initialSyncPromise;
420
- /** Queue of blocks to be added to the store, processed by the sync loop. */ blockQueue;
422
+ /** Queue of blocks and checkpoints to be added to the store, processed by the sync loop. */ inboundQueue;
421
423
  /** Helper to handle updates to the store */ updater;
424
+ /** In-memory cache for L2 chain tips. */ l2TipsCache;
422
425
  tracer;
426
+ instrumentation;
423
427
  /**
424
428
  * Creates a new instance of the Archiver.
425
429
  * @param publicClient - A client for interacting with the Ethereum node.
426
430
  * @param debugClient - A client for interacting with the Ethereum node for debug/trace methods.
427
431
  * @param rollup - Rollup contract instance.
428
432
  * @param inbox - Inbox contract instance.
429
- * @param l1Addresses - L1 contract addresses (registry, governance proposer, slash factory, slashing proposer).
430
- * @param dataStore - An archiver data store for storage & retrieval of blocks, encrypted logs & contract data.
433
+ * @param l1Addresses - L1 contract addresses (registry, governance proposer, slashing proposer).
434
+ * @param dataStores - Archiver substores for storage & retrieval of blocks, encrypted logs & contract data.
431
435
  * @param config - Archiver configuration options.
432
436
  * @param blobClient - Client for retrieving blob data.
433
- * @param epochCache - Cache for epoch-related data.
434
437
  * @param dateProvider - Provider for current date/time.
435
438
  * @param instrumentation - Instrumentation for metrics and tracing.
436
439
  * @param l1Constants - L1 rollup constants.
437
440
  * @param log - A logger.
438
- */ constructor(publicClient, debugClient, rollup, l1Addresses, dataStore, config, blobClient, instrumentation, l1Constants, synchronizer, events, log = createLogger('archiver')){
439
- super(dataStore, l1Constants), this.publicClient = publicClient, this.debugClient = debugClient, this.rollup = rollup, this.l1Addresses = l1Addresses, this.dataStore = dataStore, this.config = config, this.blobClient = blobClient, this.l1Constants = l1Constants, this.log = log, this.initialSyncComplete = (_initProto(this), false), this.blockQueue = [];
441
+ */ constructor(publicClient, debugClient, rollup, l1Addresses, dataStores, config, blobClient, instrumentation, l1Constants, synchronizer, events, l2TipsCache, log = createLogger('archiver')){
442
+ super(dataStores, l1Constants), this.publicClient = publicClient, this.debugClient = debugClient, this.rollup = rollup, this.l1Addresses = l1Addresses, this.dataStores = dataStores, this.config = config, this.blobClient = blobClient, this.l1Constants = l1Constants, this.log = log, this.initialSyncComplete = (_initProto(this), false), this.inboundQueue = [];
440
443
  this.tracer = instrumentation.tracer;
444
+ this.instrumentation = instrumentation;
441
445
  this.initialSyncPromise = promiseWithResolvers();
442
446
  this.synchronizer = synchronizer;
443
447
  this.events = events;
444
- this.updater = new ArchiverDataStoreUpdater(this.dataStore);
448
+ this.l2TipsCache = l2TipsCache ?? new L2TipsCache(this.dataStores.blocks);
449
+ this.updater = new ArchiverDataStoreUpdater(this.dataStores, this.l2TipsCache, {
450
+ rollupManaLimit: l1Constants.rollupManaLimit
451
+ });
445
452
  // Running promise starts with a small interval inbetween runs, so all iterations needed for the initial sync
446
453
  // are done as fast as possible. This then gets updated once the initial sync completes.
447
454
  this.runningPromise = new RunningPromise(()=>this.sync(), this.log, this.config.pollingIntervalMs / 10, makeLoggingErrorHandler(this.log, NoBlobBodiesFoundError, BlockTagTooOldError));
@@ -460,9 +467,15 @@ _dec = trackSpan('Archiver.sync');
460
467
  await this.blobClient.testSources();
461
468
  await this.synchronizer.testEthereumNodeSynced();
462
469
  await validateAndLogTraceAvailability(this.debugClient, this.config.ethereumAllowNoDebugHosts ?? false, this.log.getBindings());
470
+ await validateAndLogHistoricalLogsAvailability(this.publicClient, {
471
+ rollupAddress: this.l1Addresses.rollupAddress,
472
+ inboxAddress: this.l1Addresses.inboxAddress,
473
+ registryAddress: this.l1Addresses.registryAddress,
474
+ governanceProposerAddress: this.l1Addresses.governanceProposerAddress
475
+ }, this.config.skipHistoricalLogsCheck ?? false, this.log.getBindings());
463
476
  // Log initial state for the archiver
464
477
  const { l1StartBlock } = this.l1Constants;
465
- const { blocksSynchedTo = l1StartBlock, messagesSynchedTo = l1StartBlock } = await this.store.getSynchPoint();
478
+ const { blocksSynchedTo = l1StartBlock, messagesSynchedTo = l1StartBlock } = await getArchiverSynchPoint(this.stores);
466
479
  const currentL2Checkpoint = await this.getSynchedCheckpointNumber();
467
480
  this.log.info(`Starting archiver sync to rollup contract ${this.rollup.address} from L1 block ${blocksSynchedTo} and L2 checkpoint ${currentL2Checkpoint}`, {
468
481
  blocksSynchedTo,
@@ -478,6 +491,13 @@ _dec = trackSpan('Archiver.sync');
478
491
  syncImmediate() {
479
492
  return this.runningPromise.trigger();
480
493
  }
494
+ trySyncImmediate() {
495
+ try {
496
+ return this.syncImmediate();
497
+ } catch (err) {
498
+ this.log.error(`Failed to trigger immediate archiver sync: ${err}`, err);
499
+ }
500
+ }
481
501
  /**
482
502
  * Queues a block to be added to the archiver store and triggers processing.
483
503
  * The block will be processed by the sync loop.
@@ -485,53 +505,84 @@ _dec = trackSpan('Archiver.sync');
485
505
  * @param block - The L2 block to add.
486
506
  * @returns A promise that resolves when the block has been added to the store, or rejects on error.
487
507
  */ addBlock(block) {
488
- return new Promise((resolve, reject)=>{
489
- this.blockQueue.push({
490
- block,
491
- resolve,
492
- reject
493
- });
494
- this.log.debug(`Queued block ${block.number} for processing`);
495
- // Trigger an immediate sync, but don't wait for it - the promise resolves when the block is processed
496
- this.syncImmediate().catch((err)=>{
497
- this.log.error(`Sync immediate call failed: ${err}`);
498
- });
508
+ const promise = promiseWithResolvers();
509
+ this.inboundQueue.push({
510
+ block,
511
+ ...promise,
512
+ type: 'block'
513
+ });
514
+ this.log.debug(`Queued block ${block.number} for processing`);
515
+ void this.trySyncImmediate();
516
+ return promise.promise;
517
+ }
518
+ /**
519
+ * Queues a new proposed checkpoint into the archiver store.
520
+ * Checks that the checkpoint is not for an L2 slot already synced from L1.
521
+ * Resolves once the checkpoint has been processed.
522
+ */ addProposedCheckpoint(pending) {
523
+ const promise = promiseWithResolvers();
524
+ this.inboundQueue.push({
525
+ checkpoint: pending,
526
+ ...promise,
527
+ type: 'checkpoint'
499
528
  });
529
+ this.log.debug(`Queued checkpoint ${pending.checkpointNumber} for processing`);
530
+ void this.trySyncImmediate();
531
+ return promise.promise;
500
532
  }
501
533
  /**
502
- * Processes all queued blocks, adding them to the store.
534
+ * Processes all queued blocks and checkpoints, adding them to the store.
503
535
  * Called at the beginning of each sync iteration.
504
- * Blocks are processed in the order they were queued.
505
- */ async processQueuedBlocks() {
506
- if (this.blockQueue.length === 0) {
536
+ * Items are processed in the order they were queued.
537
+ */ async processInboundQueue() {
538
+ if (this.inboundQueue.length === 0) {
507
539
  return;
508
540
  }
509
- // Take all blocks from the queue
510
- const queuedItems = this.blockQueue.splice(0, this.blockQueue.length);
511
- this.log.debug(`Processing ${queuedItems.length} queued block(s)`);
541
+ // Take all items from the queue
542
+ const queuedItems = this.inboundQueue.splice(0, this.inboundQueue.length);
543
+ this.log.debug(`Processing ${queuedItems.length} queued inbound items`);
512
544
  // Calculate slot threshold for validation
513
545
  const l1Timestamp = this.synchronizer.getL1Timestamp();
514
546
  const slotAtNextL1Block = l1Timestamp === undefined ? undefined : getSlotAtNextL1Block(l1Timestamp, this.l1Constants);
515
- // Process each block individually to properly resolve/reject each promise
516
- for (const { block, resolve, reject } of queuedItems){
517
- const blockSlot = block.header.globalVariables.slotNumber;
518
- if (slotAtNextL1Block !== undefined && blockSlot < slotAtNextL1Block) {
519
- this.log.warn(`Rejecting proposed block ${block.number} for past slot ${blockSlot} (current is ${slotAtNextL1Block})`, {
520
- block: block.toBlockInfo(),
547
+ // Helpers for manipulating blocks and checkpoints in the queue
548
+ const getSlot = (item)=>item.type === 'block' ? item.block.header.globalVariables.slotNumber : item.checkpoint.header.slotNumber;
549
+ const getNumber = (item)=>item.type === 'block' ? item.block.number : item.checkpoint.checkpointNumber;
550
+ // Process each item individually to properly resolve/reject each promise
551
+ for (const item of queuedItems){
552
+ const { resolve, reject, type } = item;
553
+ const itemSlot = getSlot(item);
554
+ const itemNumber = getNumber(item);
555
+ if (slotAtNextL1Block !== undefined && itemSlot < slotAtNextL1Block) {
556
+ const nextSlotTimestamp = getTimestampForSlot(slotAtNextL1Block, this.l1Constants);
557
+ this.log.warn(`Rejecting proposed ${type} ${itemNumber} for past slot ${itemSlot} (current ${slotAtNextL1Block})`, {
558
+ number: itemNumber,
559
+ type,
521
560
  l1Timestamp,
522
- slotAtNextL1Block
561
+ slotAtNextL1Block,
562
+ nextSlotTimestamp
523
563
  });
524
- reject(new Error(`Block ${block.number} is for past slot ${blockSlot} (current is ${slotAtNextL1Block})`));
564
+ reject(new BlockOrCheckpointSlotExpiredError(itemSlot, nextSlotTimestamp, l1Timestamp));
525
565
  continue;
526
566
  }
527
567
  try {
528
- await this.updater.addProposedBlocks([
529
- block
530
- ]);
531
- this.log.debug(`Added block ${block.number} to store`);
568
+ if (type === 'block') {
569
+ const [durationMs] = await elapsed(()=>this.updater.addProposedBlock(item.block));
570
+ this.instrumentation.processNewProposedBlock(durationMs, item.block);
571
+ } else {
572
+ await this.updater.addProposedCheckpoint(item.checkpoint);
573
+ }
574
+ this.log.debug(`Added ${type} ${itemNumber} to store`);
532
575
  resolve();
533
576
  } catch (err) {
534
- this.log.error(`Failed to add block ${block.number} to store: ${err.message}`);
577
+ if (err instanceof BlockAlreadyCheckpointedError) {
578
+ this.log.debug(`Proposed block ${itemNumber} matches already checkpointed block, ignoring late proposal`);
579
+ resolve();
580
+ continue;
581
+ }
582
+ this.log.error(`Failed to add ${type} ${itemNumber} to store: ${err.message}`, err, {
583
+ number: itemNumber,
584
+ type
585
+ });
535
586
  reject(err);
536
587
  }
537
588
  }
@@ -543,7 +594,7 @@ _dec = trackSpan('Archiver.sync');
543
594
  * Fetches logs from L1 contracts and processes them.
544
595
  */ async sync() {
545
596
  // Process any queued blocks first, before doing L1 sync
546
- await this.processQueuedBlocks();
597
+ await this.processInboundQueue();
547
598
  // Now perform L1 sync
548
599
  await this.syncFromL1();
549
600
  }
@@ -557,7 +608,7 @@ _dec = trackSpan('Archiver.sync');
557
608
  if (currentL1BlockNumber + 1n >= l1BlockNumberAtEnd) {
558
609
  this.log.info(`Initial archiver sync to L1 block ${currentL1BlockNumber} complete`, {
559
610
  l1BlockNumber: currentL1BlockNumber,
560
- syncPoint: await this.store.getSynchPoint(),
611
+ syncPoint: await getArchiverSynchPoint(this.stores),
561
612
  ...await this.getL2Tips()
562
613
  });
563
614
  this.runningPromise.setPollingIntervalMS(this.config.pollingIntervalMs);
@@ -583,7 +634,7 @@ _dec = trackSpan('Archiver.sync');
583
634
  return Promise.resolve();
584
635
  }
585
636
  backupTo(destPath) {
586
- return this.dataStore.backupTo(destPath);
637
+ return backupArchiverDataStores(this.dataStores, destPath);
587
638
  }
588
639
  getL1Constants() {
589
640
  return Promise.resolve(this.l1Constants);
@@ -605,13 +656,45 @@ _dec = trackSpan('Archiver.sync');
605
656
  getL1Timestamp() {
606
657
  return Promise.resolve(this.synchronizer.getL1Timestamp());
607
658
  }
608
- getL2SlotNumber() {
659
+ async getSyncedL2SlotNumber() {
660
+ // The synced L2 slot is the latest slot for which we have all L1 data,
661
+ // either because we have seen all L1 blocks for that slot, or because
662
+ // we have seen the corresponding checkpoint.
663
+ let slotFromL1Sync;
609
664
  const l1Timestamp = this.synchronizer.getL1Timestamp();
610
- return Promise.resolve(l1Timestamp === undefined ? undefined : getSlotAtTimestamp(l1Timestamp, this.l1Constants));
665
+ if (l1Timestamp !== undefined) {
666
+ const nextL1BlockSlot = getSlotAtNextL1Block(l1Timestamp, this.l1Constants);
667
+ if (Number(nextL1BlockSlot) > 0) {
668
+ slotFromL1Sync = SlotNumber.add(nextL1BlockSlot, -1);
669
+ }
670
+ }
671
+ let slotFromCheckpoint;
672
+ const latestCheckpointNumber = await this.stores.blocks.getLatestCheckpointNumber();
673
+ if (latestCheckpointNumber > 0) {
674
+ const checkpointData = await this.stores.blocks.getCheckpointData(latestCheckpointNumber);
675
+ if (checkpointData) {
676
+ slotFromCheckpoint = checkpointData.header.slotNumber;
677
+ }
678
+ }
679
+ if (slotFromL1Sync === undefined && slotFromCheckpoint === undefined) {
680
+ return undefined;
681
+ }
682
+ return SlotNumber(Math.max(slotFromL1Sync ?? 0, slotFromCheckpoint ?? 0));
611
683
  }
612
- getL2EpochNumber() {
613
- const l1Timestamp = this.synchronizer.getL1Timestamp();
614
- return Promise.resolve(l1Timestamp === undefined ? undefined : getEpochNumberAtTimestamp(l1Timestamp, this.l1Constants));
684
+ async getSyncedL2EpochNumber() {
685
+ const syncedSlot = await this.getSyncedL2SlotNumber();
686
+ if (syncedSlot === undefined) {
687
+ return undefined;
688
+ }
689
+ // An epoch is fully synced when all its slots are synced.
690
+ // We check if syncedSlot is the last slot of its epoch; if so, that epoch is fully synced.
691
+ // Otherwise, only the previous epoch is fully synced.
692
+ const epoch = getEpochAtSlot(syncedSlot, this.l1Constants);
693
+ const [, endSlot] = getSlotRangeForEpoch(epoch, this.l1Constants);
694
+ if (syncedSlot >= endSlot) {
695
+ return epoch;
696
+ }
697
+ return Number(epoch) > 0 ? EpochNumber(Number(epoch) - 1) : undefined;
615
698
  }
616
699
  async isEpochComplete(epochNumber) {
617
700
  // The epoch is complete if the current checkpointed L2 block is the last one in the epoch (or later).
@@ -650,106 +733,31 @@ _dec = trackSpan('Archiver.sync');
650
733
  await this.updater.addCheckpoints(checkpoints, pendingChainValidationStatus);
651
734
  return true;
652
735
  }
653
- async getL2Tips() {
654
- const [latestBlockNumber, provenBlockNumber, checkpointedBlockNumber, finalizedBlockNumber] = await Promise.all([
655
- this.getBlockNumber(),
656
- this.getProvenBlockNumber(),
657
- this.getCheckpointedL2BlockNumber(),
658
- this.getFinalizedL2BlockNumber()
659
- ]);
660
- const beforeInitialblockNumber = BlockNumber(INITIAL_L2_BLOCK_NUM - 1);
661
- // Get the latest block header and checkpointed blocks for proven, finalised and checkpointed blocks
662
- const [latestBlockHeader, provenCheckpointedBlock, finalizedCheckpointedBlock, checkpointedBlock] = await Promise.all([
663
- latestBlockNumber > beforeInitialblockNumber ? this.getBlockHeader(latestBlockNumber) : undefined,
664
- provenBlockNumber > beforeInitialblockNumber ? this.getCheckpointedBlock(provenBlockNumber) : undefined,
665
- finalizedBlockNumber > beforeInitialblockNumber ? this.getCheckpointedBlock(finalizedBlockNumber) : undefined,
666
- checkpointedBlockNumber > beforeInitialblockNumber ? this.getCheckpointedBlock(checkpointedBlockNumber) : undefined
667
- ]);
668
- if (latestBlockNumber > beforeInitialblockNumber && !latestBlockHeader) {
669
- throw new Error(`Failed to retrieve latest block header for block ${latestBlockNumber}`);
670
- }
671
- // Checkpointed blocks must exist for proven, finalized and checkpointed tips if they are beyond the initial block number.
672
- if (checkpointedBlockNumber > beforeInitialblockNumber && !checkpointedBlock?.block.header) {
673
- throw new Error(`Failed to retrieve checkpointed block header for block ${checkpointedBlockNumber} (latest block is ${latestBlockNumber})`);
674
- }
675
- if (provenBlockNumber > beforeInitialblockNumber && !provenCheckpointedBlock?.block.header) {
676
- throw new Error(`Failed to retrieve proven checkpointed for block ${provenBlockNumber} (latest block is ${latestBlockNumber})`);
677
- }
678
- if (finalizedBlockNumber > beforeInitialblockNumber && !finalizedCheckpointedBlock?.block.header) {
679
- throw new Error(`Failed to retrieve finalized block header for block ${finalizedBlockNumber} (latest block is ${latestBlockNumber})`);
680
- }
681
- const latestBlockHeaderHash = await latestBlockHeader?.hash() ?? GENESIS_BLOCK_HEADER_HASH;
682
- const provenBlockHeaderHash = await provenCheckpointedBlock?.block.header?.hash() ?? GENESIS_BLOCK_HEADER_HASH;
683
- const finalizedBlockHeaderHash = await finalizedCheckpointedBlock?.block.header?.hash() ?? GENESIS_BLOCK_HEADER_HASH;
684
- const checkpointedBlockHeaderHash = await checkpointedBlock?.block.header?.hash() ?? GENESIS_BLOCK_HEADER_HASH;
685
- // Now attempt to retrieve checkpoints for proven, finalised and checkpointed blocks
686
- const [[provenBlockCheckpoint], [finalizedBlockCheckpoint], [checkpointedBlockCheckpoint]] = await Promise.all([
687
- provenCheckpointedBlock !== undefined ? await this.getCheckpoints(provenCheckpointedBlock?.checkpointNumber, 1) : [
688
- undefined
689
- ],
690
- finalizedCheckpointedBlock !== undefined ? await this.getCheckpoints(finalizedCheckpointedBlock?.checkpointNumber, 1) : [
691
- undefined
692
- ],
693
- checkpointedBlock !== undefined ? await this.getCheckpoints(checkpointedBlock?.checkpointNumber, 1) : [
694
- undefined
695
- ]
696
- ]);
697
- const initialcheckpointId = {
698
- number: CheckpointNumber.ZERO,
699
- hash: GENESIS_CHECKPOINT_HEADER_HASH.toString()
700
- };
701
- const makeCheckpointId = (checkpoint)=>{
702
- if (checkpoint === undefined) {
703
- return initialcheckpointId;
704
- }
705
- return {
706
- number: checkpoint.checkpoint.number,
707
- hash: checkpoint.checkpoint.hash().toString()
708
- };
709
- };
710
- const l2Tips = {
711
- proposed: {
712
- number: latestBlockNumber,
713
- hash: latestBlockHeaderHash.toString()
714
- },
715
- proven: {
716
- block: {
717
- number: provenBlockNumber,
718
- hash: provenBlockHeaderHash.toString()
719
- },
720
- checkpoint: makeCheckpointId(provenBlockCheckpoint)
721
- },
722
- finalized: {
723
- block: {
724
- number: finalizedBlockNumber,
725
- hash: finalizedBlockHeaderHash.toString()
726
- },
727
- checkpoint: makeCheckpointId(finalizedBlockCheckpoint)
728
- },
729
- checkpointed: {
730
- block: {
731
- number: checkpointedBlockNumber,
732
- hash: checkpointedBlockHeaderHash.toString()
733
- },
734
- checkpoint: makeCheckpointId(checkpointedBlockCheckpoint)
735
- }
736
- };
737
- return l2Tips;
736
+ getL2Tips() {
737
+ return this.l2TipsCache.getL2Tips();
738
738
  }
739
739
  async rollbackTo(targetL2BlockNumber) {
740
- // TODO(pw/mbps): This still assumes 1 block per checkpoint
741
740
  const currentBlocks = await this.getL2Tips();
742
741
  const currentL2Block = currentBlocks.proposed.number;
743
742
  const currentProvenBlock = currentBlocks.proven.block.number;
744
743
  if (targetL2BlockNumber >= currentL2Block) {
745
744
  throw new Error(`Target L2 block ${targetL2BlockNumber} must be less than current L2 block ${currentL2Block}`);
746
745
  }
747
- const targetL2Block = await this.store.getCheckpointedBlock(targetL2BlockNumber);
746
+ const targetL2Block = await this.stores.blocks.getCheckpointedBlock(targetL2BlockNumber);
748
747
  if (!targetL2Block) {
749
748
  throw new Error(`Target L2 block ${targetL2BlockNumber} not found`);
750
749
  }
751
- const targetL1BlockNumber = targetL2Block.l1.blockNumber;
752
750
  const targetCheckpointNumber = targetL2Block.checkpointNumber;
751
+ // Rollback operates at checkpoint granularity: the target block must be the last block of its checkpoint.
752
+ const checkpointData = await this.stores.blocks.getCheckpointData(targetCheckpointNumber);
753
+ if (checkpointData) {
754
+ const lastBlockInCheckpoint = BlockNumber(checkpointData.startBlock + checkpointData.blockCount - 1);
755
+ if (targetL2BlockNumber !== lastBlockInCheckpoint) {
756
+ const previousCheckpointBoundary = checkpointData.startBlock > 1 ? BlockNumber(checkpointData.startBlock - 1) : BlockNumber(0);
757
+ throw new Error(`Target L2 block ${targetL2BlockNumber} is not at a checkpoint boundary. ` + `Checkpoint ${targetCheckpointNumber} spans blocks ${checkpointData.startBlock} to ${lastBlockInCheckpoint}. ` + `Use block ${lastBlockInCheckpoint} to roll back to this checkpoint, ` + `or block ${previousCheckpointBoundary} to roll back to the previous one.`);
758
+ }
759
+ }
760
+ const targetL1BlockNumber = targetL2Block.l1.blockNumber;
753
761
  const targetL1Block = await this.publicClient.getBlock({
754
762
  blockNumber: targetL1BlockNumber,
755
763
  includeTransactions: false
@@ -761,21 +769,21 @@ _dec = trackSpan('Archiver.sync');
761
769
  this.log.info(`Removing checkpoints after checkpoint ${targetCheckpointNumber} (target block ${targetL2BlockNumber})`);
762
770
  await this.updater.removeCheckpointsAfter(targetCheckpointNumber);
763
771
  this.log.info(`Rolling back L1 to L2 messages to checkpoint ${targetCheckpointNumber}`);
764
- await this.store.rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber);
772
+ await this.stores.messages.rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber);
765
773
  this.log.info(`Setting L1 syncpoints to ${targetL1BlockNumber}`);
766
- await this.store.setCheckpointSynchedL1BlockNumber(targetL1BlockNumber);
767
- await this.store.setMessageSynchedL1Block({
774
+ await this.stores.blocks.setSynchedL1BlockNumber(targetL1BlockNumber);
775
+ await this.stores.messages.setMessageSyncState({
768
776
  l1BlockNumber: targetL1BlockNumber,
769
777
  l1BlockHash: targetL1BlockHash
770
- });
778
+ }, undefined);
771
779
  if (targetL2BlockNumber < currentProvenBlock) {
772
- this.log.info(`Clearing proven L2 block number`);
773
- await this.store.setProvenCheckpointNumber(CheckpointNumber.ZERO);
774
- }
775
- // TODO(palla/reorg): Set the finalized block when we add support for it.
776
- // if (targetL2BlockNumber < currentFinalizedBlock) {
777
- // this.log.info(`Clearing finalized L2 block number`);
778
- // await this.store.setFinalizedL2BlockNumber(0);
779
- // }
780
+ this.log.info(`Rolling back proven L2 checkpoint to ${targetCheckpointNumber}`);
781
+ await this.updater.setProvenCheckpointNumber(targetCheckpointNumber);
782
+ }
783
+ const currentFinalizedBlock = currentBlocks.finalized.block.number;
784
+ if (targetL2BlockNumber < currentFinalizedBlock) {
785
+ this.log.info(`Rolling back finalized L2 checkpoint to ${targetCheckpointNumber}`);
786
+ await this.updater.setFinalizedCheckpointNumber(targetCheckpointNumber);
787
+ }
780
788
  }
781
789
  }
package/dest/config.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type BlobClientConfig } from '@aztec/blob-client/client/config';
2
2
  import { type L1ContractsConfig } from '@aztec/ethereum/config';
3
3
  import { type L1ReaderConfig } from '@aztec/ethereum/l1-reader';
4
4
  import { type ConfigMappingsType } from '@aztec/foundation/config';
5
- import { type ChainConfig } from '@aztec/stdlib/config';
5
+ import { type ChainConfig, type PipelineConfig } from '@aztec/stdlib/config';
6
6
  import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
7
7
  /**
8
8
  * The archiver configuration.
@@ -11,7 +11,7 @@ import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
11
11
  * Results of calls to eth_blockNumber are cached by viem with this cache being updated periodically at the interval specified by viemPollingIntervalMS.
12
12
  * As a result the maximum observed polling time for new blocks will be viemPollingIntervalMS + archiverPollingIntervalMS.
13
13
  */
14
- export type ArchiverConfig = ArchiverSpecificConfig & L1ReaderConfig & L1ContractsConfig & BlobClientConfig & ChainConfig;
14
+ export type ArchiverConfig = ArchiverSpecificConfig & L1ReaderConfig & L1ContractsConfig & PipelineConfig & BlobClientConfig & ChainConfig;
15
15
  export declare const archiverConfigMappings: ConfigMappingsType<ArchiverConfig>;
16
16
  /**
17
17
  * Returns the archiver configuration from the environment variables.
@@ -24,7 +24,9 @@ export declare function mapArchiverConfig(config: Partial<ArchiverConfig>): {
24
24
  pollingIntervalMs: number | undefined;
25
25
  batchSize: number | undefined;
26
26
  skipValidateCheckpointAttestations: boolean | undefined;
27
+ skipPromoteProposedCheckpointDuringL1Sync: boolean | undefined;
27
28
  maxAllowedEthClientDriftSeconds: number | undefined;
28
29
  ethereumAllowNoDebugHosts: boolean | undefined;
30
+ skipHistoricalLogsCheck: boolean | undefined;
29
31
  };
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUEyQixNQUFNLGtDQUFrQyxDQUFDO0FBQ2xHLE9BQU8sRUFBRSxLQUFLLGlCQUFpQixFQUE2QixNQUFNLHdCQUF3QixDQUFDO0FBRTNGLE9BQU8sRUFBRSxLQUFLLGNBQWMsRUFBMEIsTUFBTSwyQkFBMkIsQ0FBQztBQUN4RixPQUFPLEVBQ0wsS0FBSyxrQkFBa0IsRUFJeEIsTUFBTSwwQkFBMEIsQ0FBQztBQUNsQyxPQUFPLEVBQUUsS0FBSyxXQUFXLEVBQXVCLE1BQU0sc0JBQXNCLENBQUM7QUFDN0UsT0FBTyxLQUFLLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUU5RTs7Ozs7O0dBTUc7QUFDSCxNQUFNLE1BQU0sY0FBYyxHQUFHLHNCQUFzQixHQUNqRCxjQUFjLEdBQ2QsaUJBQWlCLEdBQ2pCLGdCQUFnQixHQUNoQixXQUFXLENBQUM7QUFFZCxlQUFPLE1BQU0sc0JBQXNCLEVBQUUsa0JBQWtCLENBQUMsY0FBYyxDQWdEckUsQ0FBQztBQUVGOzs7O0dBSUc7QUFDSCx3QkFBZ0Isd0JBQXdCLElBQUksY0FBYyxDQUV6RDtBQUVELGdGQUFnRjtBQUNoRix3QkFBZ0IsaUJBQWlCLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxjQUFjLENBQUM7Ozs7OztFQVFoRSJ9
32
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUEyQixNQUFNLGtDQUFrQyxDQUFDO0FBQ2xHLE9BQU8sRUFBRSxLQUFLLGlCQUFpQixFQUE2QixNQUFNLHdCQUF3QixDQUFDO0FBRTNGLE9BQU8sRUFBRSxLQUFLLGNBQWMsRUFBMEIsTUFBTSwyQkFBMkIsQ0FBQztBQUN4RixPQUFPLEVBQ0wsS0FBSyxrQkFBa0IsRUFLeEIsTUFBTSwwQkFBMEIsQ0FBQztBQUNsQyxPQUFPLEVBQ0wsS0FBSyxXQUFXLEVBQ2hCLEtBQUssY0FBYyxFQUdwQixNQUFNLHNCQUFzQixDQUFDO0FBQzlCLE9BQU8sS0FBSyxFQUFFLHNCQUFzQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFOUU7Ozs7OztHQU1HO0FBQ0gsTUFBTSxNQUFNLGNBQWMsR0FBRyxzQkFBc0IsR0FDakQsY0FBYyxHQUNkLGlCQUFpQixHQUNqQixjQUFjLEdBQ2QsZ0JBQWdCLEdBQ2hCLFdBQVcsQ0FBQztBQUVkLGVBQU8sTUFBTSxzQkFBc0IsRUFBRSxrQkFBa0IsQ0FBQyxjQUFjLENBNERyRSxDQUFDO0FBRUY7Ozs7R0FJRztBQUNILHdCQUFnQix3QkFBd0IsSUFBSSxjQUFjLENBRXpEO0FBRUQsZ0ZBQWdGO0FBQ2hGLHdCQUFnQixpQkFBaUIsQ0FBQyxNQUFNLEVBQUUsT0FBTyxDQUFDLGNBQWMsQ0FBQzs7Ozs7Ozs7RUFVaEUifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA2B,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAE,KAAK,iBAAiB,EAA6B,MAAM,wBAAwB,CAAC;AAE3F,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,2BAA2B,CAAC;AACxF,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,sBAAsB,GACjD,cAAc,GACd,iBAAiB,GACjB,gBAAgB,GAChB,WAAW,CAAC;AAEd,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,CAgDrE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,cAAc,CAEzD;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC;;;;;;EAQhE"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA2B,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAE,KAAK,iBAAiB,EAA6B,MAAM,wBAAwB,CAAC;AAE3F,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,2BAA2B,CAAC;AACxF,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAAc,EAGpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,sBAAsB,GACjD,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,WAAW,CAAC;AAEd,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,CA4DrE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,cAAc,CAEzD;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC;;;;;;;;EAUhE"}
package/dest/config.js CHANGED
@@ -2,10 +2,11 @@ import { blobClientConfigMapping } from '@aztec/blob-client/client/config';
2
2
  import { l1ContractsConfigMappings } from '@aztec/ethereum/config';
3
3
  import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
4
4
  import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
5
- import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
6
- import { chainConfigMappings } from '@aztec/stdlib/config';
5
+ import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, optionalNumberConfigHelper } from '@aztec/foundation/config';
6
+ import { chainConfigMappings, pipelineConfigMappings } from '@aztec/stdlib/config';
7
7
  export const archiverConfigMappings = {
8
8
  ...blobClientConfigMapping,
9
+ ...pipelineConfigMappings,
9
10
  archiverPollingIntervalMS: {
10
11
  env: 'ARCHIVER_POLLING_INTERVAL_MS',
11
12
  description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
@@ -23,13 +24,17 @@ export const archiverConfigMappings = {
23
24
  },
24
25
  archiverStoreMapSizeKb: {
25
26
  env: 'ARCHIVER_STORE_MAP_SIZE_KB',
26
- parseEnv: (val)=>val ? +val : undefined,
27
+ ...optionalNumberConfigHelper(),
27
28
  description: 'The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKb.'
28
29
  },
29
30
  skipValidateCheckpointAttestations: {
30
31
  description: 'Skip validating checkpoint attestations (for testing purposes only)',
31
32
  ...booleanConfigHelper(false)
32
33
  },
34
+ skipPromoteProposedCheckpointDuringL1Sync: {
35
+ description: 'Skip promoting proposed checkpoints during L1 sync (for testing purposes only)',
36
+ ...booleanConfigHelper(false)
37
+ },
33
38
  maxAllowedEthClientDriftSeconds: {
34
39
  env: 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS',
35
40
  description: 'Maximum allowed drift in seconds between the Ethereum client and current time.',
@@ -40,6 +45,11 @@ export const archiverConfigMappings = {
40
45
  description: 'Whether to allow starting the archiver without debug/trace method support on Ethereum hosts',
41
46
  ...booleanConfigHelper(true)
42
47
  },
48
+ archiverSkipHistoricalLogsCheck: {
49
+ env: 'ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK',
50
+ description: 'Skip the startup check that probes the L1 RPC for historical Rollup contract logs. ' + 'Set to true to bypass the check when the connected RPC node is known to prune old logs.',
51
+ ...booleanConfigHelper(false)
52
+ },
43
53
  ...chainConfigMappings,
44
54
  ...l1ReaderConfigMappings,
45
55
  viemPollingIntervalMS: {
@@ -65,7 +75,9 @@ export const archiverConfigMappings = {
65
75
  pollingIntervalMs: config.archiverPollingIntervalMS,
66
76
  batchSize: config.archiverBatchSize,
67
77
  skipValidateCheckpointAttestations: config.skipValidateCheckpointAttestations,
78
+ skipPromoteProposedCheckpointDuringL1Sync: config.skipPromoteProposedCheckpointDuringL1Sync,
68
79
  maxAllowedEthClientDriftSeconds: config.maxAllowedEthClientDriftSeconds,
69
- ethereumAllowNoDebugHosts: config.ethereumAllowNoDebugHosts
80
+ ethereumAllowNoDebugHosts: config.ethereumAllowNoDebugHosts,
81
+ skipHistoricalLogsCheck: config.archiverSkipHistoricalLogsCheck
70
82
  };
71
83
  }