-
Notifications
You must be signed in to change notification settings - Fork 45
Description
File: network/identify/p2p_network_identify_protocol.rs:168-181
parse_protocol() returns Err(UnsupportedProtocol) for any protocol string not in Token::ALL. The TryFrom<pb::Identify> impl propagates this with ?, rejecting the entire Identify` message.
pub fn parse_protocol(name: &str) -> Result<StreamKind, ...> {
for tok in token::Token::ALL.iter() {
if let token::Token::Protocol(token::Protocol::Stream(a)) = tok {
if a.name_str() == name {
return Ok(*a);
}
}
}
Err(P2pNetworkIdentifyFromMessageError::UnsupportedProtocol(
name.to_string(),
))
}Impact:
- Adding new capability strings (e.g.,
/mina/webrtc-relay/1.0.0) would cause
older Rust nodes to reject the sender's Identify message entirely - If either the Rust or OCaml nodes ever add a new protocol string, Rust nodes break
- This is inconsistent with the multistream-select parser (
token.rs:parse_token) which gracefully returnsToken::UnknownProtocolfor unknowns - go-libp2p handles this correctly: unknown protocol strings are stored and simply never matched
This is a prerequisite for any capability advertisement work (#2034).
Reactions are currently unavailable