Skip to content

blocksync: validate block response sender and signature count (upstream #5863) - #66

Merged
tqin7 merged 1 commit into
dydx-fork-v0.38.5from
tq/blocksync-response-validation
Oct 28, 2026
Merged

tqin7 merged 1 commit into
dydx-fork-v0.38.5from
tq/blocksync-response-validation

Conversation

@tqin7

@tqin7 tqin7 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Cherry-pick of upstream cometbft#5863, the v0.38.x backport of cometbft#5860, onto the current dydx-fork-v0.38.5 tip. 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 BlockResponse before unmarshalling it: the sending peer must have a recent pending BlockRequest from us, and the response may carry at most MaxVotesCount commit signatures. Reactors can opt into this pre-unmarshal check through the new MsgBytesFilter interface; only the block-sync reactor implements it.

…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).
@tqin7
tqin7 merged commit 267c79f into dydx-fork-v0.38.5 Oct 28, 2026
15 of 16 checks passed
@tqin7
tqin7 deleted the tq/blocksync-response-validation branch October 28, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants