Repository navigation
blocksync: validate block response sender and signature count (upstream #5863) - #66
Merged
Merged
Conversation
…t (backport cometbft#5860) (cometbft#5863) --- Adds additional validation to blocksync, ensuring _before response unmarshalling_ that we have made a `BlockRequest` to the peer that is sending us a `BlockResponse` recently, and also that the response contains a valid amount of commit signatures (not > MaxVoteCount). To do this preunmarshal validation, we have added a `MsgBytesFilter` interface that `Reactors` can implement. Currently only `BLOCKSYNC` does. The `FilterMsgBytes` function is called for both comet P2P and libp2p implementations, inside of the `onReceive` function when setting up a peer for comet p2p, and inside of `handleStream` for libp2p, just before unmarshalling the message in both. - [x] Tests written/updated - [x] Changelog entry added in `CHANGELOG.md` - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments <hr>This is an automatic backport of pull request cometbft#5860 done by [Mergify](https://mergify.com).
Kefancao
approved these changes
Oct 28, 2026
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.
Cherry-pick of upstream cometbft#5863, the v0.38.x backport of cometbft#5860, onto the current
dydx-fork-v0.38.5tip. This is #58 without its dependency and Go version bumps, which are unrelated to the fix and conflict with the fork's own vulncheck work.Block sync now validates a
BlockResponsebefore unmarshalling it: the sending peer must have a recent pendingBlockRequestfrom us, and the response may carry at mostMaxVotesCountcommit signatures. Reactors can opt into this pre-unmarshal check through the newMsgBytesFilterinterface; only the block-sync reactor implements it.