fix(p2p): gracefully handle unknown protocols in Identify#2200
Open
fix(p2p): gracefully handle unknown protocols in Identify#2200
Conversation
messages (#2189) Replace the strict parse_protocol() that rejected entire Identify messages on unknown protocol strings with a new StreamProtocolId enum (Known/Unknown) that preserves unrecognized protocols for forward compatibility. This prevents older Rust nodes from breaking when peers advertise new capability strings, consistent with how go-libp2p and our own multistream-select parser handle unknown protocols.
OCaml Reference Validation ResultsRepository: https://github.com/MinaProtocol/mina.git Click to see full validation output |
✓ Code Reference Verification PassedAll code references in the documentation have been verified successfully! Total references checked: 1 The documentation is in sync with the codebase on the |
This was referenced Mar 26, 2026
richardpringle
previously approved these changes
Mar 27, 2026
Collaborator
richardpringle
left a comment
There was a problem hiding this comment.
I think you just need a clippy --fix run
| pub enum StreamProtocolId { | ||
| Known(StreamKind), | ||
| Unknown(String), | ||
| } |
| .iter() | ||
| .map(String::as_str) | ||
| .map(parse_protocol) | ||
| .collect(); |
| .map(|v| v.name_str().into()) | ||
| .map(|v| match v { | ||
| StreamProtocolId::Known(k) => k.name_str().into(), | ||
| StreamProtocolId::Unknown(s) => s.clone().into(), |
Collaborator
There was a problem hiding this comment.
One of the linters is complaining about this. I think into is unnecessary
c7157e7 to
4edae62
Compare
4edae62 to
045fa7b
Compare
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.
(stacked PRs: this is 1 of 3, merge this before #2201 and #2202)
Description
Replace the strict
parse_protocol()that rejected entire Identify messageson unknown protocol strings with a
StreamProtocolIdenum (Known/Unknown)that preserves unrecognized protocols for forward compatibility. This prevents
older Rust nodes from disconnecting peers that advertise new capability
strings, consistent with how go-libp2p handles unknown protocols.
Related Issue(s)
Closes #2189
Type of Change
Testing
parse_protocolno longer returnsResult,so unknown strings are silently preserved rather than causing errors.
Changelog Entry
Fixed: P2P: Identify protocol no longer rejects peers that advertise unknown
protocol strings, improving forward compatibility with newer nodes (#2200)