-
Notifications
You must be signed in to change notification settings - Fork 518
network: silently fall back if uncompressed vote received for stateless decoder #6495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6495 +/- ##
==========================================
- Coverage 47.59% 47.44% -0.15%
==========================================
Files 666 659 -7
Lines 88484 88409 -75
==========================================
- Hits 42110 41945 -165
- Misses 43611 43691 +80
- Partials 2763 2773 +10 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds silent fallback handling when a peer sends uncompressed vote messages to a stateless decoder that expects compressed data. Instead of logging warnings for this valid scenario, the code now detects the uncompressed msgpack pattern and falls back gracefully without error messages.
Key Changes:
- Added detection for uncompressed msgpack vote data that mimics the expected compressed format
- Introduced
ErrLikelyUncompressederror type to distinguish uncompressed data from corrupted data - Suppressed warning logs when uncompressed votes are received by the stateless decoder
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| network/vpack/vpack.go | Added detection logic for uncompressed msgpack and new error type to distinguish from corruption |
| network/vpack/parse_test.go | Added test coverage for both uncompressed msgpack detection and corrupted vpack non-detection scenarios |
| network/msgCompressor.go | Modified error handling to suppress warnings for uncompressed votes while maintaining them for other errors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if c.avdec.enabled { | ||
| res, err := c.avdec.convert(data) | ||
| if err != nil { | ||
| c.log.Warnf("peer %s vote decompress error: %v", c.origin, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote for disconnecting from nodes who advertised vpack compression but fail to fulfill it
Summary
This removes warning log messages for the case where a peer sends valid-seeming uncompressed AV messages instead of stateless-compressed votes.
Test Plan
New tests added.