Skip to content

fix: Explicit mtSQUELCH classification in Message::compress switch (#6740) - #7879

Open
svirdi-ripple wants to merge 1 commit into
XRPLF:developfrom
svirdi-ripple:fix/6740-mtsquelch-compress-switch
Open

fix: Explicit mtSQUELCH classification in Message::compress switch (#6740)#7879
svirdi-ripple wants to merge 1 commit into
XRPLF:developfrom
svirdi-ripple:fix/6740-mtsquelch-compress-switch

Conversation

@svirdi-ripple

Copy link
Copy Markdown

High Level Overview of Change

Fix for #6740: Message::compress() in src/xrpld/overlay/detail/Message.cpp enumerates message types in a switch statement to decide compressibility, but mtSQUELCH was absent from both the compressible and non-compressible groups. Silent fall-through happened to produce the correct behavior (uncompressed), but any future MessageType enum value would silently inherit the same fall-through — a maintenance hazard flagged by the NOLINTNEXTLINE(bugprone-switch-missing-default-case) suppression.

This PR:

  • Adds case protocol::mtSQUELCH: break; to the non-compressible group.
  • Adds a default: case with XRPL_ASSERT(false, ...) so future omissions surface loudly in debug/test builds instead of silently falling through.
  • Removes the now-redundant NOLINTNEXTLINE suppression.
  • Adds a regression test in src/test/overlay/compression_test.cpp (testMtSquelchUncompressed) that constructs a TMSquelch payload padded above the 70-byte compression gate and asserts getBuffer(Compressed::On) and getBuffer(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

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change
  • libxrpl change
  • Peer protocol change

Internal xrpld/overlay change only — no public or wire-protocol impact.

Test plan

Run the compression suite:

```
./xrpld --unittest=xrpl.overlay.compression --unittest-log
```

  • Full suite passes with the fix in place (16 cases, 0 failures).
  • New `testMtSquelchUncompressed` case runs and asserts the compressed/uncompressed buffers are byte-identical for a padded `TMSquelch` payload.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant