Repository navigation
fix(blocksync): validate blocksync response sender and signature count (backport #5860) - #5863
Merged
Merged
Conversation
#5860) --- 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. #### PR checklist - [x] Tests written/updated - [x] Changelog entry added in `CHANGELOG.md` - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments (cherry picked from commit 4590e7a) # Conflicts: # blocksync/reactor.go # lp2p/stream_test.go # lp2p/switch.go # lp2p/switch_test.go
Contributor
Author
|
Cherry-pick of 4590e7a has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Contributor
|
PR author is not in the allowed authors list. |
mattac21
approved these changes
May 12, 2026
mattac21
enabled auto-merge
May 12, 2026 16:57
tqin7
added a commit
to dydxprotocol/cometbft
that referenced
this pull request
Oct 28, 2026
…t (backport cometbft#5860) (cometbft#5863) (#66) --- 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). Co-authored-by: mattac21 <[email protected]>
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.
Adds additional validation to blocksync, ensuring before response unmarshalling that we have made a
BlockRequestto the peer that is sending us aBlockResponserecently, and also that the response contains a valid amount of commit signatures (not > MaxVoteCount). To do this preunmarshal validation, we have added aMsgBytesFilterinterface thatReactorscan implement. Currently onlyBLOCKSYNCdoes. TheFilterMsgBytesfunction is called for both comet P2P and libp2p implementations, inside of theonReceivefunction when setting up a peer for comet p2p, and inside ofhandleStreamfor libp2p, just before unmarshalling the message in both.PR checklist
CHANGELOG.mddocs/orspec/) and code commentsThis is an automatic backport of pull request #5860 done by [Mergify](https://mergify.com).