core: qbft improvements#4557
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens QBFT against post-decision amplification and oversized consensus wire messages by adding explicit rebroadcast/count limits, along with focused internal tests to validate the new bounds.
Changes:
- Bound post-decision
MsgDecidedrebroadcasts triggered byROUND-CHANGEmessages (per source, per increasing round, capped). - Add early rejection limits in consensus
handlefor excessivejustificationandvaluescounts to prevent CPU/memory amplification. - Add internal tests covering rebroadcast limits and wire-message amplification limits.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| core/qbft/qbft.go | Adds per-source rebroadcast limiting for post-decision MsgDecided to reduce amplification risk. |
| core/qbft/qbft_internal_test.go | Adds tests validating rebroadcast de-duplication, per-source caps, and forged-source tracking bounds. |
| core/consensus/qbft/qbft.go | Adds early size bounds for justification/value counts before expensive verification/unmarshal work. |
| core/consensus/qbft/qbft_internal_test.go | Adds tests ensuring oversized messages are rejected early and max-bounded messages are accepted. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Set Round explicitly in signedJustification so the test does not depend on newRandomQBFTMsg's random round being non-zero (verifyMsg rejects round <= 0), matching the adjacent signedBase helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4557 +/- ##
==========================================
- Coverage 57.08% 57.08% -0.01%
==========================================
Files 245 245
Lines 33218 33229 +11
==========================================
+ Hits 18963 18969 +6
- Misses 11867 11869 +2
- Partials 2388 2391 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



Various qbft fixes.
category: refactor
ticket: none