Coder Social home page Coder Social logo

[Parachain] Trying to add an already reserved node 12D3KooWJb4BDK6gRLH27mYnd22igZQi6W3xraAJsvSanaccPNVx as reserved on SetId(0). about api HOT 6 CLOSED

Andrewjkim2014 avatar Andrewjkim2014 commented on June 7, 2024
[Parachain] Trying to add an already reserved node 12D3KooWJb4BDK6gRLH27mYnd22igZQi6W3xraAJsvSanaccPNVx as reserved on SetId(0).

from api.

Comments (6)

TarikGul avatar TarikGul commented on June 7, 2024

I moved this issue to the api since it doesn't have anything to do with the apps.

In order to properly help I need a reproducible code example, and a proper question to work off of. Please format it using markdown code formatting. Thank you

from api.

Andrewjkim2014 avatar Andrewjkim2014 commented on June 7, 2024

Thank you TarikGul for responding.

This is current log that I get from the polkadot parachain network using the chain flag (--chain contracts-rococo-local).

2024-03-02 19:17:21.748 TRACE tokio-runtime-worker peerset: [Parachain] Adding reserved node 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 on SetId(0).
2024-03-02 19:17:21.749 TRACE tokio-runtime-worker peerset: [Parachain] Connecting to 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 on SetId(0) (0/8 num_out/max_out).
2024-03-02 19:17:21.750 WARN tokio-runtime-worker peerset: [Parachain] Trying to add an already reserved node 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 as reserved on SetId(0).
2024-03-02 19:17:21.750 TRACE tokio-runtime-worker peerset: [Parachain] Adding a new known peer 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6.
2024-03-02 19:17:21.750 TRACE tokio-runtime-worker peerset: [Parachain] Trying to add an already known peer 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6, bumping last_updated.
2024-03-02 19:17:21.759 WARN tokio-runtime-worker peerset: [Parachain] Trying to add an already reserved node 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 as reserved on SetId(0).
2024-03-02 19:17:21.769 TRACE tokio-runtime-worker peerset: [Parachain] Reserved peer 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 (Outbound) dropped from SetId(0).
2024-03-02 19:17:21.769 TRACE tokio-runtime-worker peerset: [Parachain] Peer 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 disconnected, reputation: -256 to -256
2024-03-02 19:17:21.899 TRACE tokio-runtime-worker peerset: [Parachain] Connecting to 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 on SetId(0) (0/8 num_out/max_out).
2024-03-02 19:17:22.067 WARN tokio-runtime-worker peerset: [Parachain] Trying to add an already reserved node 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 as reserved on SetId(0).
2024-03-02 19:17:22.077 WARN tokio-runtime-worker peerset: [Parachain] Trying to add an already reserved node 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 as reserved on SetId(0).
2024-03-02 19:17:22.105 WARN tokio-runtime-worker peerset: [Parachain] Trying to add an already reserved node 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6 as reserved on SetId(0).
2024-03-02 19:17:22.193 TRACE tokio-runtime-worker peerset: [Parachain] Trying to add an already known peer 12D3KooWMi8BPM372mzMjtsiKjgHMDiSYFFgmJ58U8AeVsQNXAP6, bumping last_updated.

This is the nodejs libp2p configuration for my node:
const options = {
peerId: peerId,
addresses: {
listen: ['/ip4/192.168.1.203/tcp/9944/ws']
},
transports: [
tcp(),
webSockets(),
circuitRelayTransport({
discoverRelays: 2,
})
],
connectionEncryption: [noise()],
streamMuxers: [yamux(), mplex()],
dht: kadDHT(),
peerDiscovery: [
mdns(),
pubsubPeerDiscovery(),
bootstrap({
list: bootstrapNodes
}),
],
services: {
identify: identify(),
ping: ping({
protocolPrefix: 'ipfs',
}),
dht: kadDHT({
kBucketSize: 20,
clientMode: false,
broadcast: true,
}),
relay: circuitRelayServer(),
pubsub: gossipsub({
allowPublishToZeroPeers: true,
emitSelf: true,
floodPublish: false,
gossipIncoming: true,
doPX: false,
directPeers: gossipPeers,
allowedTopics: 'Login'
})
},
config: {
dht: {
kBucketSize: 20,
enabled: true,
randomWalk: {
enabled: true,
interval: 300e3,
timeout: 10e3
}
},
pubsub: {
enabled: true,
emitSelf: false,
},
relay: {
enabled: true,
hop: {
enabled: true,
active: true
}
},
autoNAT: {
enabled: true,
},
},
connectionManager: {
autoDial: true,
maxConnections: 50,
minConnections: 10,
},
}

This is the rpc call to the parachain node thats result in that response from the blockchain terminal:
const rpcUrl = 'http://127.0.0.1:9944';

const body = JSON.stringify({
jsonrpc: '2.0',
method: 'system_addReservedPeer',
params: [
/ip4/192.168.1.203/tcp/4003/ws/p2p/${peerId}
],
id: 2
});

const response = await fetch(rpcUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body
});

My goal is to be able to see the discover, incoming connection, and accepting connection in the parachain network, which I'm guessing should update the Idle 0 Peers to 1 Peer.
I'm still currently trying to fix this issue. If theres anything else that you need from me, please let me know!

from api.

Andrewjkim2014 avatar Andrewjkim2014 commented on June 7, 2024

This is my reproducible code example.

   const options = {
       peerId: peerId,
       addresses: {
           listen: ['/ip4/192.168.1.203/tcp/9944/ws']
       },
       transports: [
         tcp(),
         webSockets(),
         circuitRelayTransport({
           discoverRelays: 2,
         })
       ],
       connectionEncryption: [noise()],
       streamMuxers: [yamux(), mplex()],
       dht: kadDHT(),
       peerDiscovery: [
           mdns(),
           pubsubPeerDiscovery(),
           bootstrap({
               list: bootstrapNodes
           }),
       ],
       services: {
           identify: identify(),
           ping: ping({
               protocolPrefix: 'ipfs',
           }),
           dht: kadDHT({
               kBucketSize: 20,
               clientMode: false,
               broadcast: true,
           }),
           relay: circuitRelayServer(),
           pubsub: gossipsub({
               allowPublishToZeroPeers: true,
               emitSelf: true,
               floodPublish: false,
               gossipIncoming: true,
               doPX: false,
               directPeers: gossipPeers,
               allowedTopics: 'Login'
           })
       },
       config: {
           dht: {
               kBucketSize: 20,
               enabled: true,
               randomWalk: {
                 enabled: true,
                 interval: 300e3,
                 timeout: 10e3
               }
           },
           pubsub: {
               enabled: true,
               emitSelf: false,
           },
           relay: {
               enabled: true,      
               hop: {
               enabled: true,    
               active: true      
               }
           },
           autoNAT: {
               enabled: true,
           },
       },
       connectionManager: {
           autoDial: true,
           maxConnections: 50,
           minConnections: 10,
       },
   }
   
   const node = await createLibp2p(options);

   node.addEventListener('peer:discovery', async (event) => {     
     const peerInfo = event.detail;
     console.log("New peer discovered", peerInfo.id.toString());

    const rpcUrl = 'http://127.0.0.1:9944';
      
      const body = JSON.stringify({
        jsonrpc: '2.0',
        method: 'system_addReservedPeer',
        params: [
          `/ip4/192.168.1.203/tcp/4003/ws/p2p/${peerId}`
        ],
        id: 2
      });

      const response = await fetch(rpcUrl, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json'
        },
        body
      });
   })

   node.addEventListener('peer:connect', async (event) => {
     console.log('peer connect', event.detail)
   })



   await node.start();
 }

}

from api.

TarikGul avatar TarikGul commented on June 7, 2024

So from the code you provided it seems this is out of scope for these libraries as this is not a polkadot-js issue.

from api.

TarikGul avatar TarikGul commented on June 7, 2024

Best to ask this question in Substrate Stack Exchange: https://substrate.stackexchange.com/questions

from api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.