Better interoperability with Go/rust peers#10
Open
waus wants to merge 5 commits into
Open
Conversation
rust-libp2p uses lazy yamux acknowledgement — the ACK flag is piggybacked on the first data/window-update frame rather than sent as a standalone ACK. dart_libp2p blocks on a Completer awaiting an explicit ACK after sending SYN, causing a deadlock: the dart side waits for ACK before sending data, while the rust side waits for data before sending ACK. The yamux spec allows the initiator to send data immediately after SYN without waiting for ACK. This change makes the ACK wait non-blocking — the Completer is still tracked for logging, but stream.open() proceeds immediately after SYN is sent. See: https://github.com/hashicorp/yamux/blob/master/spec.md Tested against: rust-libp2p 0.56.0 (yamux 0.12.1 / 0.13.10)
The Noise handshake payload verification was hardcoded to Ed25519, rejecting connections to any peer using RSA keys (PeerIDs starting with "Qm"). This blocked connectivity to IPFS bootstrap relay servers which all use RSA keys. Changes: - noise_protocol.dart: Use generic publicKeyFromProto() to unmarshal remote identity keys in _verifyHandshakePayload, secureOutbound, and secureInbound. Supports Ed25519, RSA, and ECDSA. - rsa.dart: Handle SPKI (SubjectPublicKeyInfo) format in fromRawBytes() alongside PKCS#1. IPFS nodes encode RSA public keys in SPKI format which wraps the key in an algorithm identifier sequence. Tested: dart_libp2p successfully connects to IPFS bootstrap relay QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN via TCP + Noise.
Fix yamux ACK deadlock when interoperating with rust-libp2p
Support RSA peers in Noise handshake for relay connectivity
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.
Summary
This change improves interoperability with Go/libp2p peers, especially legacy RSA peer IDs used by public IPFS/libp2p bootstrap nodes.
Changes
PeerIdparsing now falls back to decoding any valid raw base58 multihash, not only strings that start with1.Qm...,22..., andDA...forms to be parsed when they are not represented as CIDv1libp2p-keystrings.dart_udxpath dependency override frompubspec.yamland restored the published dependency constraint.Why
Go/libp2p and the public IPFS DHT still expose many RSA peers as raw base58 multihashes. The previous parser only accepted CID-style IDs and a narrow legacy identity-multihash case, so valid RSA peers could not be dialed or used as DHT bootstrap/query peers.
This blocked DHT traversal against mixed public networks and made discovery fail before the DHT protocol exchange could happen.
Validation
test/core/peer/.