Skip to content

Commit

Permalink
Extra archiver logging
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Jan 7, 2025
1 parent 0026464 commit 1d9b16a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions yarn-project/archiver/src/archiver/archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ export class Archiver implements ArchiveSource, Traceable {
}

if (initialRun) {
this.log.info(`Initial archiver sync to L1 block ${currentL1BlockNumber} complete.`);
this.log.info(`Initial archiver sync to L1 block ${currentL1BlockNumber} complete.`, {
l1BlockNumber: currentL1BlockNumber,
...(await this.getL2Tips()),
});
}
}

Expand Down Expand Up @@ -361,6 +364,16 @@ export class Archiver implements ArchiveSource, Traceable {

const updateProvenBlock = async () => {
const localBlockForDestinationProvenBlockNumber = await this.getBlock(Number(provenBlockNumber));

// Sanity check. I've hit what seems to be a state where the proven block is set to a value greater than the latest
// synched block when requesting L2Tips from the archiver. This is the only place where the proven block is set.
const synched = await this.store.getSynchedL2BlockNumber();
if (localBlockForDestinationProvenBlockNumber && synched < localBlockForDestinationProvenBlockNumber?.number) {
this.log.error(
`Hit local block greater than last synched block: ${localBlockForDestinationProvenBlockNumber.number} > ${synched}`,
);
}

if (
localBlockForDestinationProvenBlockNumber &&
provenArchive === localBlockForDestinationProvenBlockNumber.archive.root.toString()
Expand Down Expand Up @@ -795,11 +808,13 @@ export class Archiver implements ArchiveSource, Traceable {
] as const);

if (latestBlockNumber > 0 && !latestBlockHeader) {
throw new Error('Failed to retrieve latest block header');
throw new Error(`Failed to retrieve latest block header for block ${latestBlockNumber}`);
}

if (provenBlockNumber > 0 && !provenBlockHeader) {
throw new Error('Failed to retrieve proven block header');
throw new Error(
`Failed to retrieve proven block header for block ${provenBlockNumber} (latest block is ${latestBlockNumber})`,
);
}

return {
Expand Down

0 comments on commit 1d9b16a

Please sign in to comment.