Skip to content

fix: resolve connectivity issues — DHT bootstrap, browser DHT, pairEnterPin#4

Merged
moukrea merged 5 commits intomainfrom
fix/connectivity
Mar 29, 2026
Merged

fix: resolve connectivity issues — DHT bootstrap, browser DHT, pairEnterPin#4
moukrea merged 5 commits intomainfrom
fix/connectivity

Conversation

@moukrea
Copy link
Copy Markdown
Owner

@moukrea moukrea commented Mar 29, 2026

Summary

  • Fix DHT bootstrap: Enable rsa feature in libp2p (IPFS bootstrap nodes use RSA keys). Replace unresolvable /dnsaddr/ multiaddrs with resolved /dns/ addresses (QUIC+TCP per node).
  • Async DHT providing: KadStartProviding now waits for actual DHT propagation before replying, instead of returning immediately on local accept.
  • Browser DHT bootstrap: Wire @libp2p/bootstrap with WSS addresses so the browser's Kademlia routing table has peers to query.
  • Fix pairEnterPin: Accept optional remotePeerId (from connection profiles), fall back to DHT lookup. No longer returns random bytes.
  • Update test: pairEnterPin test 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:

  1. rsa feature was missing — all IPFS bootstrap PeerIDs (Qm...) were rejected
  2. /dnsaddr/ multiaddrs require TXT record resolution that libp2p doesn't perform
  3. Browser DHT had zero bootstrap peers, making lookupPinOnDht always fail
  4. pairEnterPin returned random bytes instead of the actual host's peer ID

Test plan

  • cargo fmt --check passes
  • cargo clippy -p cairn-p2p -- -D warnings passes
  • cargo 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

moukrea added 5 commits March 29, 2026 16:32
…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.
@moukrea moukrea merged commit ebf3eb4 into main Mar 29, 2026
6 checks passed
@moukrea moukrea deleted the fix/connectivity branch March 29, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant