fix: Explicit mtSQUELCH classification in Message::compress switch (#6740) - #7879
Open
svirdi-ripple wants to merge 1 commit into
Open
fix: Explicit mtSQUELCH classification in Message::compress switch (#6740)#7879svirdi-ripple wants to merge 1 commit into
svirdi-ripple wants to merge 1 commit into
Conversation
…RPLF#6740) Add mtSQUELCH to the non-compressible message-type group and a default case with XRPL_ASSERT to catch future omissions. Remove the redundant NOLINTNEXTLINE suppression.Add regression test locking in that mtSQUELCH stays uncompressed even for payloads that would otherwise be eligible for compression.
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.
High Level Overview of Change
Fix for #6740:
Message::compress()insrc/xrpld/overlay/detail/Message.cppenumerates message types in a switch statement to decide compressibility, butmtSQUELCHwas absent from both the compressible and non-compressible groups. Silent fall-through happened to produce the correct behavior (uncompressed), but any futureMessageTypeenum value would silently inherit the same fall-through — a maintenance hazard flagged by theNOLINTNEXTLINE(bugprone-switch-missing-default-case)suppression.This PR:
case protocol::mtSQUELCH: break;to the non-compressible group.default:case withXRPL_ASSERT(false, ...)so future omissions surface loudly in debug/test builds instead of silently falling through.NOLINTNEXTLINEsuppression.src/test/overlay/compression_test.cpp(testMtSquelchUncompressed) that constructs aTMSquelchpayload padded above the 70-byte compression gate and assertsgetBuffer(Compressed::On)andgetBuffer(Compressed::Off)return byte-identical buffers — locking in the non-compressible classification.Context of Change
INFORMATIONAL — no security impact, no observable behavior change. Code hygiene / maintenance fix.
Continues work from closed PR #6805, which had the code change but no test, kept the
NOLINTNEXTLINE, and was closed due to unsigned commits.API Impact
libxrplchangeInternal
xrpld/overlaychange only — no public or wire-protocol impact.Test plan
Run the compression suite:
```
./xrpld --unittest=xrpl.overlay.compression --unittest-log
```