Cleanup syncer encodingtype - #11036
Draft
TechLateef wants to merge 4 commits into
Draft
Conversation
This commit removes support for the deprecated EncodingSortedZlib format (type 1) which was dropped from the BOLT 7 specification. All zlib compression and decompression logic has been removed from lnwire messages. The EncodingSortedZlib constant is now marked as Deprecated to retain protocol documentation. The decode path now explicitly returns an error when a peer attempts to send zlib-encoded data, rather than a generic unknown encoding error. All tests that previously verified zlib scenarios have been cleaned up or deleted. This removal is safe because lnd has never sent zlib-encoded data, and nobody on the network sends type 1. Additionally, dropping this encoding removes the package-global zlibDecodeMtx, improving performance and security without introducing new DoS vectors, as receiving type 1 now simply triggers an instant disconnect.
This commit removes zlib-specific chunking logic from the discovery syncer. Since LND no longer supports zlib compression for gossip queries, the corresponding chunking factors and parsing cases in the syncer are no longer needed.
Now that zlib compression for gossip queries has been removed and lnd only produces plain encoding (EncodingSortedPlain), the encodingType field in gossipSyncerCfg, the single-entry encodingTypeToChunkSize map, and the single-arm switch in syncer.go are redundant. This commit cleans up the syncer configuration by removing the encodingType field and replacing encodingTypeToChunkSize with the defaultChunkSize constant. Outgoing QueryShortChanIDs and ReplyChannelRange messages now directly specify EncodingSortedPlain.
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.
Change Description
This PR is a follow-up to PR #10980.
With zlib compression for gossip queries dropped and
lndexclusively usingEncodingSortedPlain,several pieces of syncer configuration that existed solely to select between plain and zlib encodings are
now redundant.
Changes
encodingTypefield fromgossipSyncerCfg.encodingTypeToChunkSizemap with thedefaultChunkSize = 8000constantin
discovery/syncer.go.switch g.cfg.encodingTypeblock inprocessChanRangeReply.EncodingType: lnwire.EncodingSortedPlainon outgoingReplyChannelRangemessages,aligning with
QueryShortChanIDs.SyncManagerand test helpers acrosssyncer_test.go,syncer_atomic_test.go, andsyncer_queue_test.go.Related PRs