Skip to content

Commit

Permalink
fix: Prover node does not err upon an empty epoch (#11204)
Browse files Browse the repository at this point in the history
If there was a reorg, an epoch will be regarded as empty. The prover
node should not attempt to create a quote for it. Today, the node tries
to get block data and fails loudly.
  • Loading branch information
spalladino authored Jan 14, 2025
1 parent 6ec343b commit 2c3ab84
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions yarn-project/prover-node/src/prover-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ export class ProverNode implements ClaimsMonitorHandler, EpochMonitorHandler, Pr
);
await this.doSendEpochProofQuote(signed);
} catch (err) {
this.log.error(`Error handling epoch completed`, err);
if (err instanceof EmptyEpochError) {
this.log.info(`Not producing quote for ${epochNumber} since no blocks were found`);
} else {
this.log.error(`Error handling epoch completed`, err);
}
}
}

Expand Down Expand Up @@ -316,7 +320,7 @@ export class ProverNode implements ClaimsMonitorHandler, EpochMonitorHandler, Pr
private async gatherBlocks(epochNumber: bigint) {
const blocks = await this.l2BlockSource.getBlocksForEpoch(epochNumber);
if (blocks.length === 0) {
throw new Error(`No blocks found for epoch ${epochNumber}`);
throw new EmptyEpochError(epochNumber);
}
return blocks;
}
Expand Down Expand Up @@ -418,3 +422,10 @@ export class ProverNode implements ClaimsMonitorHandler, EpochMonitorHandler, Pr
await this.claimsMonitor.work();
}
}

class EmptyEpochError extends Error {
constructor(epochNumber: bigint) {
super(`No blocks found for epoch ${epochNumber}`);
this.name = 'EmptyEpochError';
}
}

0 comments on commit 2c3ab84

Please sign in to comment.