fix(peer): drop empty addrs in peer records#3494
Merged
Conversation
A zero-value Multiaddr (since go-multiaddr v0.15 is a slice type) has no components and encodes to zero bytes on the wire. go-libp2p was sealing such empty entries into signed peer records, where peers that skip the empty-input check render them as "/" and reject the address. - core/peer/record.go: skip empty addrs in addrsToProtobuf, and in addrsFromProtobuf as a defensive read - p2p/host/basic/addrs_manager.go: drop empty addrs in makeSignedPeerRecord before sealing the envelope go-libp2p's own decoder errors on zero-byte input via NewMultiaddrBytes, but other implementations such as js-libp2p do not. See libp2p/js-libp2p#3478 (comment)
This was referenced Apr 27, 2026
guillaumemichel
approved these changes
Apr 28, 2026
Contributor
guillaumemichel
left a comment
There was a problem hiding this comment.
Fix looks good
Test failure seem unrelated to recent changes
MarcoPolo
approved these changes
Apr 28, 2026
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.
A zero-value Multiaddr (since go-multiaddr v0.15 is a slice type) has no components and encodes to zero bytes on the wire. go-libp2p was sealing such empty entries into signed peer records, where peers that skip the empty-input check render them as "/" and reject the address.
Changes
go-libp2p's own decoder errors on zero-byte input via NewMultiaddrBytes, but other implementations such as js-libp2p do not.