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

Connection to found peers does not work #149

Open
ZababurinSergei opened this issue Sep 16, 2024 · 2 comments
Open

Connection to found peers does not work #149

ZababurinSergei opened this issue Sep 16, 2024 · 2 comments

Comments

@ZababurinSergei
Copy link

ZababurinSergei commented Sep 16, 2024

I have updated all libraries to the latest versions at the moment.

 "dependencies": {
    "@chainsafe/libp2p-gossipsub": "^14.1.0",
    "@chainsafe/libp2p-noise": "^16.0.0",
    "@chainsafe/libp2p-yamux": "^7.0.0",
    "@libp2p/autonat": "^2.0.1",
    "@libp2p/bootstrap": "^11.0.1",
    "@libp2p/circuit-relay-v2": "^2.0.1",
    "@libp2p/crypto": "^5.0.1",
    "@libp2p/dcutr": "^2.0.1",
    "@libp2p/identify": "^3.0.1",
    "@libp2p/interface-transport": "^4.0.3",
    "@libp2p/kad-dht": "^13.0.1",
    "@libp2p/logger": "^5.0.1",
    "@libp2p/peer-id": "^5.0.1",
    "@libp2p/peer-store": "^11.0.1",
    "@libp2p/ping": "^2.0.1",
    "@libp2p/pubsub-peer-discovery": "^11.0.0",
    "@libp2p/tcp": "^10.0.1",
    "@libp2p/webrtc": "^5.0.2",
    "@libp2p/websockets": "^9.0.1",
    "@libp2p/webtransport": "^5.0.2",
    "@multiformats/multiaddr": "^12.3.1",
    "blockstore-core": "^5.0.2",
    "datastore-core": "^10.0.2",
    "datastore-idb": "^3.0.1"
  }

Node configuration.

const libp2p = await createLibp2p({
  addresses: {
    listen: [
      '/webrtc-direct',
      '/webrtc'
    ]
  },
  transports: [
    webRTCDirect(),
    webSockets({
      filter: filters.all
    }),
    webRTC(),
    circuitRelayTransport({
      discoverRelays: 4
    })
  ],
  peerDiscovery: [
      pubsubPeerDiscovery({
        interval: 10000,
        topics: [PUBSUB_PEER_DISCOVERY],
        listenOnly: false
      }),
      bootstrap({
        list: ["/dns4/localhost/tcp/4839/ws/p2p/12D3KooWAJKSV1yF6XVZRzMnh6YFd5tbXbQQZxwHAMxZXfWyQpm6"]
      })
    ],
  connectionEncrypters: [noise()],
  streamMuxers: [yamux()],
  connectionManager: {
    minConnections: 20,
  },
  transportManager: {
    faultTolerance: FaultTolerance.NO_FATAL
  },
  services: {
    identify: identify(),
    identifyPush: identifyPush(),
    pubsub: gossipsub(),
    dcutr: dcutr(),
    ping: ping()
  }
}

relay

 const libp2p = await createLibp2p({
        peerStore: PersistentPeerStore,
        MemoryDatastore,
        privateKey: peerId,
        addresses: addresses,
        transports: [
            webTransport(),
            webSockets({ server }),
            tcp(),
        ],
        connectionEncrypters: [
            noise()
        ],
        streamMuxers: [yamux()],
        services: {
            identify: identify(),
            identifyPush: identifyPush(),
            pubsub: gossipsub(),
            relay: circuitRelayServer(),
            ping: ping()
        }
    })

    libp2p.services.pubsub.subscribe(PUBSUB_PEER_DISCOVERY)

Before the update, the search worked.

Peer search event is triggered now.
Request is made.
But connection is not made.

logs

libp2p:discovery:pubsub discovered peer 12D3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ on discovery +9s
index.js:344 ------------ MESSAGE ------------ {type: 'signed', from: Ed25519PeerId, data: Uint8Array(446), sequenceNumber: 16363233405102080667n, topic: 'discovery', …}
index.js:212 -------- filterMultiaddrForPeer -------- 12D3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ _Multiaddr {bytes: Uint8Array(100), #string: '/dns4/localhost/tcp/4839/p2p/12D3KooWAJKSV1yF6XVZR…3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ', #tuples: Array(6), #stringTuples: Array(6), #path: null, …}
index.js:212 -------- filterMultiaddrForPeer -------- 12D3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ _Multiaddr {bytes: Uint8Array(102), #string: '/dns4/localhost/tcp/4839/ws/p2p/12D3KooWAJKSV1yF6X…3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ', #tuples: Array(7), #stringTuples: Array(7), #path: null, …}
index.js:212 -------- filterMultiaddrForPeer -------- 12D3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ _Multiaddr {bytes: Uint8Array(98), #string: '/dns4/localhost/tcp/4839/p2p/12D3KooWAJKSV1yF6XVZR…3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ', #tuples: Array(5), #stringTuples: Array(5), #path: null, …}
index.js:212 -------- filterMultiaddrForPeer -------- 12D3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ _Multiaddr {bytes: Uint8Array(100), #string: '/dns4/localhost/tcp/4839/ws/p2p/12D3KooWAJKSV1yF6X…3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ', #tuples: Array(6), #stringTuples: Array(6), #path: null, …}
index.js:265 peer:discovery 12D3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ
common.ts:122 libp2p:connection:outbound:7k26001726515400390 incoming stream opened on /ipfs/ping/1.0.0 +7s
index.js:212 -------- filterMultiaddrForPeer -------- 12D3KooWAJKSV1yF6XVZRzMnh6YFd5tbXbQQZxwHAMxZXfWyQpm6 _Multiaddr {bytes: Uint8Array(14), #string: '/dns4/localhost/tcp/4839', #tuples: Array(2), #stringTuples: Array(2), #path: null, …}
index.js:212 -------- filterMultiaddrForPeer -------- 12D3KooWAJKSV1yF6XVZRzMnh6YFd5tbXbQQZxwHAMxZXfWyQpm6 _Multiaddr {bytes: Uint8Array(16), #string: '/dns4/localhost/tcp/4839/ws', #tuples: Array(3), #stringTuples: Array(3), #path: null, …}
common.ts:122 libp2p:ping incoming ping from 12D3KooWAJKSV1yF6XVZRzMnh6YFd5tbXbQQZxwHAMxZXfWyQpm6 +0ms
common.ts:122 libp2p:ping incoming ping from 12D3KooWAJKSV1yF6XVZRzMnh6YFd5tbXbQQZxwHAMxZXfWyQpm6 complete in 6ms +7ms
common.ts:122 libp2p:connection:outbound:7k26001726515400390 starting new stream for protocols /ipfs/ping/1.0.0 +1s
common.ts:122 libp2p:yamux:outbound:9 selected protocol /ipfs/ping/1.0.0 +0ms
index.js:212 -------- filterMultiaddrForPeer -------- 12D3KooWAJKSV1yF6XVZRzMnh6YFd5tbXbQQZxwHAMxZXfWyQpm6 _Multiaddr {bytes: Uint8Array(14), #string: '/dns4/localhost/tcp/4839', #tuples: Array(2), #stringTuples: Array(2), #path: null, …}
index.js:212 -------- filterMultiaddrForPeer -------- 12D3KooWAJKSV1yF6XVZRzMnh6YFd5tbXbQQZxwHAMxZXfWyQpm6 _Multiaddr {bytes: Uint8Array(16), #string: '/dns4/localhost/tcp/4839/ws', #tuples: Array(3), #stringTuples: Array(3), #path: null, …}
common.ts:122 libp2p:yamux frame for missing stream id=9 +8s
common.ts:122 libp2p:discovery:pubsub broadcasting our peer data on topic discovery +1s
common.ts:122 libp2p:gossipsub rpc.from 12D3KooWAJKSV1yF6XVZRzMnh6YFd5tbXbQQZxwHAMxZXfWyQpm6 subscriptions 0 messages 1 ihave 0 iwant 0 graft 0 prune 0 +10s
common.ts:122 libp2p:discovery:pubsub discovered peer 12D3KooWRhwKCP5WR943Gm4XrbypBAPYKiSQThX628PCajX9GnNZ on discovery +9s

And this log is repeated.

In the new version of the libp2p library, the autoDial module was removed. Apparently, this is why the module stopped working.

Do I have any errors in the configuration or do I need to change something in the library?

@ZababurinSergei
Copy link
Author

ZababurinSergei commented Sep 18, 2024

The connection is happening.
But in the logs I saw that an error occurs when creating a stream

image

image

@elielnfinic
Copy link

Is this issue fixed?

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

No branches or pull requests

2 participants