Skip to content

feat: only verify new headers - #25404

Open
alexghr wants to merge 1 commit into
stack/feat-checkpoint-reward-overridesfrom
stack/feat-only-verify-new-headers
Open

feat: only verify new headers#25404
alexghr wants to merge 1 commit into
stack/feat-checkpoint-reward-overridesfrom
stack/feat-only-verify-new-headers

Conversation

@alexghr

@alexghr alexghr commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

This PR changes the checkpoint header verification from always verifying from index 0 (in the epoch) up to the current proven tip to verifying from the last proven index to up the new proven tip. This reduces the gas cost for partial epoch proofs by about ~3-4k per previously verified checkpoint header.

Fix A-1802

@alexghr
alexghr requested a review from just-mitch as a code owner September 4, 2026 15:53
);

for (uint256 i = 0; i < numCheckpoints; i++) {
for (uint256 i = _firstHeaderToVerify; i < numCheckpoints; i++) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the whole patch.

@spalladino spalladino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, left one question.

Also, how much could we save by not sending the headers? Calldata gas is cheap but not that cheap. If that header prefix is ignored, maybe we don't even need to send it at all?

Comment on lines +120 to +121
uint256 provenPrefixLength = provenBeforeSubmission - _args.start + 1;
uint256 accountedPrefixLength = RewardLib.getLongestProvenLength(endEpoch);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would these two differ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants