@@ -290,6 +290,7 @@ export class Archiver implements ArchiveSource {
290
290
} ;
291
291
292
292
// This is an edge case that we only hit if there are no proposed blocks.
293
+ // If we have 0 blocks locally and there are no blocks onchain there is nothing to do.
293
294
const noBlocks = localPendingBlockNumber === 0n && pendingBlockNumber === 0n ;
294
295
if ( noBlocks ) {
295
296
await this . store . setBlockSynchedL1BlockNumber ( currentL1BlockNumber ) ;
@@ -358,6 +359,7 @@ export class Archiver implements ArchiveSource {
358
359
359
360
if ( retrievedBlocks . length === 0 ) {
360
361
// We are not calling `setBlockSynchedL1BlockNumber` because it may cause sync issues if based off infura.
362
+ // See further details in earlier comments.
361
363
this . log . verbose ( `Retrieved no new blocks from ${ blocksSynchedTo + 1n } to ${ currentL1BlockNumber } ` ) ;
362
364
return ;
363
365
}
@@ -590,7 +592,7 @@ class ArchiverStoreHelper
590
592
if ( operation == Operation . Store ) {
591
593
return await this . store . addContractClasses ( contractClasses , blockNum ) ;
592
594
} else if ( operation == Operation . Delete ) {
593
- // return await this.store.deleteContractClasses(contractClasses, blockNum);
595
+ return await this . store . deleteContractClasses ( contractClasses , blockNum ) ;
594
596
}
595
597
}
596
598
return true ;
@@ -609,7 +611,7 @@ class ArchiverStoreHelper
609
611
if ( operation == Operation . Store ) {
610
612
return await this . store . addContractInstances ( contractInstances , blockNum ) ;
611
613
} else if ( operation == Operation . Delete ) {
612
- // return await this.store.deleteContractInstances(contractInstances, blockNum);
614
+ return await this . store . deleteContractInstances ( contractInstances , blockNum ) ;
613
615
}
614
616
}
615
617
return true ;
@@ -696,7 +698,8 @@ class ArchiverStoreHelper
696
698
throw new Error ( `Can only remove from the tip` ) ;
697
699
}
698
700
699
- const blocks = await this . getBlocks ( from - blocksToUnwind , blocksToUnwind ) ;
701
+ // from - blocksToUnwind = the new head, so + 1 for what we need to remove
702
+ const blocks = await this . getBlocks ( from - blocksToUnwind + 1 , blocksToUnwind ) ;
700
703
701
704
return [
702
705
// Unroll all logs emitted during the retrieved blocks and extract any contract classes and instances from them
0 commit comments