Giter Site home page Giter Site logo

Comments (9)

achingbrain avatar achingbrain commented on May 28, 2024 2

Sorry - I missed this. It copies the go-libp2p-kad-dht behaviour as that was what was understood to be correct at the time.

This issue has an analogue here: libp2p/js-libp2p#2450 - the fix is here: libp2p/js-libp2p#2499

from rust-libp2p.

dennis-tra avatar dennis-tra commented on May 28, 2024 1

It would be silly, because the requester already know the peer it is sending the request to.

As mentioned above, I think there could be a valid reason why you would want the latest peer record

from rust-libp2p.

mxinden avatar mxinden commented on May 28, 2024 1

I don't unfortunately @guillaumemichel.

from rust-libp2p.

dariusc93 avatar dariusc93 commented on May 28, 2024

This was discussed here and here. I think if the latter was discussed more that could provide more clarification not just to rust-libp2p but other implementations as well but in my opinion, I dont believe it really make much sense to be able to find one self when calling FIND_NODE. I havent tested it recently but i know in go-libp2p i was not able to do the same when I tried it so did something change in the go implementation for this?

from rust-libp2p.

dennis-tra avatar dennis-tra commented on May 28, 2024

IMO it can make sense that the peer returns itself. The response could include additional multiaddresses that the requestor isn't aware of yet. For example, the peer record could include a multiaddress that allows a direct connection while the requestor and requestee are connected through a relay.

You could argue that this is already covered by the identify protocol though 🤷‍♂️ personally I don't find this implicit dependency on another protocol a super compelling argument to not do the suggested change.

from rust-libp2p.

guillaumemichel avatar guillaumemichel commented on May 28, 2024

Currently go-libp2p-kad-dht is returning only itself when its own key is requested through FIND_NODE, which isn't either conform to the libp2p kad specs.

The question isn't: should the node return itself to such queries. It would be silly, because the requester already know the peer it is sending the request to.

My main concern here is that nodes should return the closest nodes to the requested key (excluding themselves, and the requester). FIND_NODE should never return an empty response, unless the routing table of the node is empty.

So both rust-libp2p and go-libp2p-kad-dht should should return the list of their closest peers, when receiving a FIND_NODE request for their own id.

from rust-libp2p.

guillaumemichel avatar guillaumemichel commented on May 28, 2024

@mxinden do you know why the empty response was introduced in ef9cb05?

from rust-libp2p.

guillaumemichel avatar guillaumemichel commented on May 28, 2024

The spec says:

The libp2p Kademlia DHT offers the following types of operations:

  • Peer routing
    • Finding the closest nodes to a given key via FIND_NODE.
  1. Upon a response:
    1. If successful the response will contain the k closest nodes the peer knows to the key Key. Add them to the candidate list Pn, except for those that have already been queried.

So the response should contain k peers (including/excluding self). An empty response isn't conform to specs

from rust-libp2p.

dhuseby avatar dhuseby commented on May 28, 2024

@achingbrain did you check the js-libp2p behavior to see how it behaves?

from rust-libp2p.

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.