Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libp2p 2.4.0 No Multiaddrs after connecting to relay #2883

Closed
sneaker1 opened this issue Dec 9, 2024 · 3 comments · Fixed by #2886 or #2887
Closed

libp2p 2.4.0 No Multiaddrs after connecting to relay #2883

sneaker1 opened this issue Dec 9, 2024 · 3 comments · Fixed by #2886 or #2887
Labels
need/author-input Needs input from the original author

Comments

@sneaker1
Copy link
Contributor

sneaker1 commented Dec 9, 2024

  • Version:
    libp2p 2.4.0
    circuit-relay-v2 3.1.4

  • Platform:
    Linux

Severity:

High - The main functionality of the application does not work, API breakage, repo format breakage, etc.

Description:

After upgrading from libp2p 2.3.1 to 2.4.0 i noticed that the peers in my network could not connect to each other via the relay.

Node A has the following addresses configuration:

addresses: {
  listen: [
    "/p2p-circuit",
    "/p2p-circuit",
  ],
},

Node A connects to a relay node B.
After connecting to the relay B, the multiaddrs of Node A are empty. In the peerstore of Node B, the entry of Node A also has no Multiaddrs.
Because of that peers can not connect to each other.

Expected Behavior:

After connecting to the relay, NodeA should get a multiaddr like this:
/dns4/relay.example.com/tcp/443/wss/p2p/QmNzZCxCahWDLSMfxouxoSikA861uvZvp32G3RJ8UNodeB/p2p-circuit/p2p/QmVyuQ4uvR9d7wnafdJYNQ1zLEzFEFvQqwUcXeoYsNodeA

@sneaker1 sneaker1 added the need/triage Needs initial labeling and prioritization label Dec 9, 2024
@achingbrain
Copy link
Member

Please can you share your full node config?

@achingbrain achingbrain added need/author-input Needs input from the original author and removed need/triage Needs initial labeling and prioritization labels Dec 10, 2024
@sneaker1
Copy link
Contributor Author

sneaker1 commented Dec 10, 2024

Sure.

This is the config I use for Node A (and other peers)

var NodeA = {
  privateKey: privateKey,
  addresses: {
    listen: [
      "/p2p-circuit",
      "/p2p-circuit",
    ],
  },
  transports: [
    webSockets(),
    webTransport(),
    circuitRelayTransport({
      reservationConcurrency: 2
    })
  ],
  peerDiscovery: [
   pubsubPeerDiscovery({
     interval: 1000
   }),
   bootstrap({
     list: [
      "/dns4/relay.example.com/tcp/443/wss/p2p/QmNzZCxCahWDLSMfxouxoSikA861uvZvp32G3RJ8UNodeB"
     ],
   })
  ],
  connectionEncrypters: [
    noise()
  ],
  streamMuxers: [
    yamux()
  ],
  randomWalk: {
    enabled: true
  },
  services: {
    identify: identify(),
    identifyPush: identifyPush(),
    ping: ping(),
    pubsub: gossipsub({allowPublishToZeroTopicPeers: true}),
  }
}

And this is the config for relay NodeB

var NodeB_Relay = {
  privateKey: privateKey,
  addresses: {
    listen: [
      "/ip4/0.0.0.0/tcp/44443/ws"
    ],
    announce: [
      "/dns4/relay.example.com/tcp/443/wss"
    ],
  },
  transports: [
    webSockets(),
    webTransport(),
  ],
  peerDiscovery: [
   pubsubPeerDiscovery({
     interval: 1000
   }),
  ],
   connectionEncrypters: [
     noise()
   ],
   streamMuxers: [
     yamux(),
   ],
   connectionManager: {
     minConnections: 3,
     maxConnections: 100
   },
   services: {
     identify: identify(),
     identifyPush: identifyPush(),
     ping: ping(),
     pubsub: gossipsub({allowPublishToZeroTopicPeers: true}),
     relay: circuitRelayServer({
       hopTimeout: 600 * 1000,
       advertise: {
         bootDelay: 15 * 60 * 1000
       },
       reservations: {
         maxReservations: 100,
         reservationClearInterval: 300 * 1000,
         applyDefaultLimit: true,
         defaultDurationLimit: 60*60 * 1000, 
         defaultDataLimit: BigInt(2 << 20), 
         maxInboundHopStreams: 32, 
         maxOutboundHopStreams: 64,
       }
     }),
   }
 }

NodeB runs on a public server in a docker container. I use reverse proxy to forward the https requests to http in the container.

achingbrain added a commit that referenced this issue Dec 10, 2024
After we have created a reservation on a relay, automatically confirm
that it is publicly dialable.

Fixes #2883
@silkroadnomad
Copy link

@sneaker1 does this fix provide you with the MultiAddress? I am having the same issue since some time, updated my packages but still don't see the multiaddress of a connecting peer other than the relays.

Also, I use PubsubPeerDiscovery and it naturally doesn't connect the peers because of it. Can you send me the exact packages.json dependencies you are using?

"@chainsafe/libp2p-gossipsub": "^14.1.0",
"@chainsafe/libp2p-noise": "^16.0.1",
"@chainsafe/libp2p-yamux": "^7.0.1",
"@helia/block-brokers": "^4.0.3",
"@helia/http": "^2.0.3",
"@helia/unixfs": "^4.0.2",
"@libp2p/autonat": "^2.0.16",
"@libp2p/bootstrap": "^11.0.17",
"@libp2p/circuit-relay-v2": "^3.1.7",
"@libp2p/crypto": "^5.0.9",
"@libp2p/dcutr": "^2.0.15",
"@libp2p/identify": "^3.0.15",
"@libp2p/interface": "^2.4.0",
"@libp2p/interface-internal": "^2.2.2",
"@libp2p/interface-pubsub": "^4.0.1",
"@libp2p/interface-transport": "^4.0.3",
"@libp2p/peer-id": "^5.0.10",
"@libp2p/peer-id-factory": "^4.2.4",
"@libp2p/ping": "^2.0.14",
"@libp2p/pubsub-peer-discovery": "^11.0.1",
"@libp2p/tcp": "^10.0.15",
"@libp2p/utils": "^6.3.1",
"@libp2p/webrtc": "^5.0.23",
"@libp2p/websockets": "^9.1.2",
"@libp2p/webtransport": "^5.0.20",
"@multiformats/multiaddr": "^12.3.4",
"helia": "^5.2.0",
"libp2p": "^2.5.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/author-input Needs input from the original author
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants