lnwire: remove legacy zlib encoding for channel queries#10980
lnwire: remove legacy zlib encoding for channel queries#10980TechLateef wants to merge 1 commit into
Conversation
🔴 PR Severity: CRITICAL
🔴 Critical (3 files)
🟠 High (1 file)
🟢 Low (4 files)
AnalysisThe highest-severity files are in No severity bump applied: only 5 non-test files and ~189 non-test lines changed (well under the 20-file/500-line thresholds), and only one critical package ( To override, add a |
saubyk
left a comment
There was a problem hiding this comment.
Please correct the file for the release note entry
0982ef4 to
7611d8f
Compare
|
/gateway review |
There was a problem hiding this comment.
Gateway review — 2 findings
🔴 0 Blocker · 🟠 1 Major · 🟡 1 Minor · 🔵 0 Nit
Summary
This PR removes the deprecated EncodingSortedZlib (type 1) gossip-query encoding, matching its removal from BOLT 7. The bulk of the change is clean deletion: the zlib encode block, the maxZlibBufSize/zlibDecodeMtx memory guards, the maxQueryChanRangeRepliesZlibFactor reply multiplier, and the corresponding test fixtures. The processChanRangeReply and encode-side removals are effectively dead-code cleanup — both key off g.cfg.encodingType, which only ever holds EncodingSortedPlain (encodingTypeToChunkSize has no other entry).
The one change that alters behavior on untrusted input is the decode path: decodeShortChanIDs now returns a hard error for type 1 instead of decompressing, and this function backs both QueryShortChanIDs.Decode and ReplyChannelRange.Decode. That behavior change, and its effect on peers that still emit zlib, is the main thing to confirm before merge. A secondary API-hygiene issue remains around the retained-but-unencodable exported constant.
Bot commands
/gateway re-review— re-run after pushing changes/gateway dismiss <id>— silence a finding (maintainers)/gateway explain <id>— elaborate on a finding (anyone)
|
🤖 gateway audit metadata for this PR — auto-generated, please don't edit. |
7611d8f to
d0a3fa5
Compare
|
/gateway re-review |
There was a problem hiding this comment.
Gateway review — 2 findings
🔴 0 Blocker · 🟠 1 Major · 🟡 1 Minor · 🔵 0 Nit
Summary
Since the last review the author addressed F2: encodeShortChanIDs now has an explicit case EncodingSortedZlib returning ErrZlibNotSupported instead of falling through to the misleading ErrUnknownShortChanIDEncoding, and the EncodingSortedZlib doc in encoding.go now states the constant is "retained for detection on the decode side only — it must never be used for encoding."
F1 remains unresolved. The decode side still hard-rejects a peer-controlled type-1 encoding byte with a wire-decode error. The specialist pass sharpens, but does not clear, the concern: the guard removal itself is safe within lnwire (the maxZlibBufSize limit and zlibDecodeMtx only ever protected the now-deleted inflate loop, and both were unexported so channeldb/migration could never have referenced them), so the live risk is the interop/propagation behavior against not-yet-upgraded peers, which still cannot be confirmed from the loaded context.
One genuinely-new minor finding: the new encode-side error branch has no test.
Status of prior findings
- F2 addressed: Fixed in
lnwire/query_short_chan_ids.go—encodeShortChanIDsnow has an explicitcase EncodingSortedZlibreturningErrZlibNotSupported(no longer falling through toErrUnknownShortChanIDEncoding), andlnwire/encoding.gotightens theDeprecateddoc to state the constant is "retained for detection on the decode side only — it must never be used for encoding."
Bot commands
/gateway re-review— re-run after pushing changes/gateway dismiss <id>— silence a finding (maintainers)/gateway explain <id>— elaborate on a finding (anyone)
This commit removes support for the deprecated EncodingSortedZlib format (type 1) which was dropped from the BOLT 7 specification. Changes: - Removes all zlib compression/decompression logic from lnwire messages. - Marks EncodingSortedZlib constant as Deprecated. - Updates the decode path to explicitly return an error when a peer attempts to send zlib-encoded data, rather than a generic unknown encoding error. - Removes zlib-specific logic from the discovery syncer. - Cleans up all tests that previously verified zlib scenarios.
d0a3fa5 to
7b27191
Compare
|
/gateway dismiss F1 per #10980 (comment) |
|
🚫 Dismissed F1 (major) by @saubyk — per #10980 (comment) Open findings on this PR: 🟡 F3 (minor) |
|
/gateway re-review |
There was a problem hiding this comment.
Gateway review
No findings.
Status of prior findings
- F2 addressed: Addressed —
encodeShortChanIDscarries an explicitcase EncodingSortedZlibreturningErrZlibNotSupported(lnwire/query_short_chan_ids.go), and theDeprecated:doc comment in encoding.go now states the constant is decode/detection-only. - F3 addressed: Addressed —
TestEncodeShortChanIDsZlibRejection(lnwire/query_short_chan_ids_test.go) assertsencodeShortChanIDs(&b, EncodingSortedZlib, nil)returnsErrZlibNotSupportedviarequire.ErrorIs, covering the encode branch that was previously untested.
Bot commands
/gateway re-review— re-run after pushing changes/gateway dismiss <id>— silence a finding (maintainers)/gateway explain <id>— elaborate on a finding (anyone)
|
/gateway approve |
There was a problem hiding this comment.
✅ Approved — all prior findings addressed.
Findings recap
Findings:
F1(major) — unresolved:decodeShortChanIDsnow returnsfmt.Errorf("zlib encoding (type %d) is no longer supported", ...)for a type-1 payload instead of decodin…F2(minor) — addressed:EncodingSortedZlibremains an exported constant, but theEncodingSortedZlibcase was fully removed fromencodeShortChanIDs, so it now …F3(minor) — addressed: The newEncodingSortedZlibbranch inencodeShortChanIDsreturnsErrZlibNotSupported, but only the decode-side rejection is covered by …
Dismissed:
F1by @saubyk — per #10980 (comment)
Approved by @saubyk via /gateway approve. Last reviewed at 7b27191. Skill v0.3.0, model claude-opus-4-8.
Change Description
This PR removes support for the deprecated
EncodingSortedZlibformat (type 1) which was officially dropped from the BOLT 7 specification in lightning/bolts#981.Changes:
lnwiremessages.EncodingSortedZlibconstant asDeprecatedto retain protocol documentation.maxQueryChanRangeRepliesZlibFactor) from thediscoverysyncer.message_test.go,reply_channel_range_test.go,query_short_chan_ids_test.go) that previously verified zlib scenarios.channeldb/migrationfiles untouched to ensure historical snapshots remain intact.Fixes #10694
Steps to Test
make unitto ensure alllnwireanddiscoverytests pass.EncodingSortedZlib.Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.