Fix envelopes-by-range to only serve canonical payloads backward#16553
Open
terencechain wants to merge 4 commits intodevelopfrom
Open
Fix envelopes-by-range to only serve canonical payloads backward#16553terencechain wants to merge 4 commits intodevelopfrom
terencechain wants to merge 4 commits intodevelopfrom
Conversation
08f4c45 to
a63883b
Compare
potuz
reviewed
Mar 17, 2026
Contributor
potuz
left a comment
There was a problem hiding this comment.
First pass, checked up to the db methods and they LGTM
| LatestBlockHash: make([]byte, 32), | ||
| PayloadExpectedWithdrawals: make([]*enginev1.Withdrawal, 0), | ||
| ProposerLookahead: make([]uint64, 64), | ||
| LatestBlockHash: make([]byte, 32), |
Contributor
There was a problem hiding this comment.
linters always want to commit things that are not related :)
beacon-chain/db/kv/blocks.go
Outdated
| if slot == math.MaxUint64 { | ||
| return 0, nil, nil | ||
| } | ||
| // Seek to slot+1 so we find the first key strictly above slot. |
Contributor
There was a problem hiding this comment.
I think it's better to find above or equal and let the caller decide if it needs to send slot + 1. Otherwise it's probably better to add "strictly above" to the name.
| db := setupDB(t) | ||
| ctx := t.Context() | ||
|
|
||
| block1, err := tt.newBlock(primitives.Slot(10), nil) |
Contributor
There was a problem hiding this comment.
Probably good to have a test with different blocks on the same slot.
satushh
reviewed
Mar 18, 2026
Co-authored-by: satushh <satushh@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ExecutionPayloadEnvelopesByRangehandler previously served any envelope found in the DB for canonical blocks, without verifying the payload was actually included (full vs empty). This could serve empty/withheld payloads as if they were canonical.ParentBlockHashchain backward from a successor block: a child'sbid.ParentBlockHashdetermines which parent payload it built on, so only envelopes reachable through this chain are canonical.parent_block_hashfield toBlindedExecutionPayloadEnvelopeproto so the walk can follow the chain using only blinded envelopes from the DB, without loading full beacon blocks.BlockHash → Rootindex look up in the DB.