Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prover node does not err upon an empty epoch #11204

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
}
}
Loading