fix: resolve connectivity issues — DHT bootstrap, browser DHT, pairEnterPin#4
Merged
fix: resolve connectivity issues — DHT bootstrap, browser DHT, pairEnterPin#4
Conversation
…esses The default IPFS bootstrap nodes used /dnsaddr/ multiaddrs which require TXT record resolution not performed by libp2p's transport layer. Also, all IPFS bootstrap PeerIDs are RSA-based (Qm...) but only the ed25519 feature was enabled. Changes: - Enable `rsa` feature in libp2p and libp2p-identity - Replace /dnsaddr/ addresses with resolved /dns/ addresses (QUIC+TCP) - Make KadStartProviding wait for actual DHT propagation before replying (previously returned Ok immediately on local accept, misleading callers)
Browser DHT was created with clientMode but zero bootstrap peers, making lookupPinOnDht always fail. Add WSS addresses of the IPFS bootstrap nodes via @libp2p/bootstrap (already in deps).
…peer ID pairEnterPin previously returned random bytes as the remote peer ID. Now accepts an optional remotePeerId parameter (from connection profile) and falls back to DHT lookup via lookupPinOnDht. Throws PAIRING error if neither source provides a peer ID.
Test now passes remotePeerId explicitly (simulating profile-based flow) and adds a separate test verifying the error when DHT is unavailable.
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
rsafeature in libp2p (IPFS bootstrap nodes use RSA keys). Replace unresolvable/dnsaddr/multiaddrs with resolved/dns/addresses (QUIC+TCP per node).KadStartProvidingnow waits for actual DHT propagation before replying, instead of returning immediately on local accept.@libp2p/bootstrapwith WSS addresses so the browser's Kademlia routing table has peers to query.pairEnterPin: Accept optionalremotePeerId(from connection profiles), fall back to DHT lookup. No longer returns random bytes.pairEnterPintest now exercises both the explicit peer ID and DHT-unavailable paths.Context
Resolves all cairn-side issues from the jaunt connectivity investigation report. The host was completely isolated in the DHT because:
rsafeature was missing — all IPFS bootstrap PeerIDs (Qm...) were rejected/dnsaddr/multiaddrs require TXT record resolution that libp2p doesn't performlookupPinOnDhtalways failpairEnterPinreturned random bytes instead of the actual host's peer IDTest plan
cargo fmt --checkpassescargo clippy -p cairn-p2p -- -D warningspassescargo test -p cairn-p2p— 764 unit tests pass, integration test passes (1 flaky timing test)npm run lint && npm run typecheck && npm run test && npm run build— 659 tests pass