libp2p / js-libp2p-webtransport

WebTranport module that libp2p uses and that implements the interface-transport spec
Other
15 stars 5 forks source link

bug: p2p-circuit webtransport multiaddr failing #61

Open SgtPooki opened 1 year ago

SgtPooki commented 1 year ago

I'm working on https://github.com/ipfs-shipyard/helia-service-worker-gateway.

I was debugging why I could only ever connect to a limited number of unique peers, even though there are 175 with valid webtransport addresses, so i started logging peerIds with valid webtransport addresses that I could then search my console for other libp2p:* debug messages, and I discovered that one peer had the following "valid" address:

/ip4/108.62.0.103/udp/4001/quic-v1/webtransport/certhash/uEiD4910kDDyQfhYln8G5KDQmp71tmWFzS35GU0C2BI6Gzw/certhash/uEiABwkoVynkcX6U02j8snwCMVv2HP1mA6zc0iJtxYxSL4A/p2p/12D3KooWStaeh9g1m4fqsGSKdNGDHtifEBd4NhSRMLfBNoN8YRhn/p2p-circuit

libp2p:dialer shows the following addresses for this peer:

libp2p:dialer peer 12D3KooWHCiY5NqNFu29BSyydye4ZfJtJNmti2GjmG8YUHdmudZ5 addresses: /ip4/108.62.0.103/tcp/4001/p2p/12D3KooWStaeh9g1m4fqsGSKdNGDHtifEBd4NhSRMLfBNoN8YRhn/p2p-circuit, /ip4/108.62.0.103/udp/4001/quic-v1/p2p/12D3KooWStaeh9g1m4fqsGSKdNGDHtifEBd4NhSRMLfBNoN8YRhn/p2p-circuit, /ip4/108.62.0.103/udp/4001/quic-v1/webtransport/certhash/uEiD4910kDDyQfhYln8G5KDQmp71tmWFzS35GU0C2BI6Gzw/certhash/uEiABwkoVynkcX6U02j8snwCMVv2HP1mA6zc0iJtxYxSL4A/p2p/12D3KooWStaeh9g1m4fqsGSKdNGDHtifEBd4NhSRMLfBNoN8YRhn/p2p-circuit, /ip4/108.62.0.103/udp/4001/quic/p2p/12D3KooWStaeh9g1m4fqsGSKdNGDHtifEBd4NhSRMLfBNoN8YRhn/p2p-circuit, /ip4/193.8.130.157/tcp/4001/p2p/12D3KooWCYiXcXw8WoFVuX3pKBMXwBQ28Rf4B29r4wAyhsU4jdPi/p2p-circuit, /ip4/193.8.130.157/udp/4001/quic-v1/p2p/12D3KooWCYiXcXw8WoFVuX3pKBMXwBQ28Rf4B29r4wAyhsU4jdPi/p2p-circuit, /ip4/193.8.130.157/udp/4001/quic/p2p/12D3KooWCYiXcXw8WoFVuX3pKBMXwBQ28Rf4B29r4wAyhsU4jdPi/p2p-circuit, /ip4/127.0.0.1/tcp/4001, /ip4/127.0.0.1/udp/4001/quic, /ip4/127.0.0.1/udp/4001/quic-v1, /ip6/::1/tcp/4001, /ip6/::1/udp/4001/quic, /ip6/::1/udp/4001/quic-v1

but then libp2p:dialer and libp2p:connection-manager throw the following error:

libp2p:dialer dial failed to 12D3KooWHCiY5NqNFu29BSyydye4ZfJtJNmti2GjmG8YUHdmudZ5 +0ms Error: unexpected component in multiaddr: 290 p2p-circuit  
    at parts.reduce.url (http://localhost:3000/vendors-node_modules_file-type_core_js-node_modules_chainsafe_libp2p-yamux_dist_src_index_js--def13e.bundle.js:66128:23)
    at Array.reduce (<anonymous>)
    at parseMultiaddr (http://localhost:3000/vendors-node_modules_file-type_core_js-node_modules_chainsafe_libp2p-yamux_dist_src_index_js--def13e.bundle.js:66071:51)
    at WebTransportTransport.dial (http://localhost:3000/vendors-node_modules_file-type_core_js-node_modules_chainsafe_libp2p-yamux_dist_src_index_js--def13e.bundle.js:66172:49)
    at DefaultTransportManager.dial (http://localhost:3000/vendors-node_modules_file-type_core_js-node_modules_chainsafe_libp2p-yamux_dist_src_index_js--def13e.bundle.js:103241:36)
    at DialRequest.dialAction (http://localhost:3000/vendors-node_modules_file-type_core_js-node_modules_chainsafe_libp2p-yamux_dist_src_index_js--def13e.bundle.js:99263:59)
    at http://localhost:3000/vendors-node_modules_file-type_core_js-node_modules_chainsafe_libp2p-yamux_dist_src_index_js--def13e.bundle.js:98942:39
    at async Promise.any (index 0)
    at async DialRequest.run (http://localhost:3000/vendors-node_modules_file-type_core_js-node_modules_chainsafe_libp2p-yamux_dist_src_index_js--def13e.bundle.js:98928:20)
    at async DefaultDialer.dial (http://localhost:3000/vendors-node_modules_file-type_core_js-node_modules_chainsafe_libp2p-yamux_dist_src_index_js--def13e.bundle.js:99126:32)

I am not familiar with p2p-circuit nor if this is actually a valid address, but it seems valid, and we should probably add support here.

related