-
Notifications
You must be signed in to change notification settings - Fork 959
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
kad: FIND_NODE not conform to specs #5269
Comments
This was discussed here and here. I think if the latter was discussed more that could provide more clarification not just to |
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. |
Currently go-libp2p-kad-dht is returning only itself when its own key is requested through 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). So both rust-libp2p and go-libp2p-kad-dht should should return the list of their closest peers, when receiving a |
As mentioned above, I think there could be a valid reason why you would want the latest peer record |
I don't unfortunately @guillaumemichel. |
The spec says:
So the response should contain |
@achingbrain did you check the js-libp2p behavior to see how it behaves? |
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 |
Thanks for the fix! Is there a planned release of |
@dariusc93 Thanks for the info! BTW, does rust-libp2p accept cross-language compatibility/regression tests? If so I can port ChainSafe/forest#4622 to rust-libp2p. Thanks! |
Hi @hanabi1224 I'd suggest to instead turn that into an interop test wdyt? cc @dhuseby |
Summary
According to kad specs,
FIND_NODE
is expected to return the closest nodes to the requested key. Currently, receiving aFIND_NODE
request for self (node's own key) results in an empty response. BecauseFIND_NODE
is expected to return the closest nodes, the closest nodes to self should also be returned in the response.IMO it isn't necessary to include self in the response though, because the requester is already aware of it.
Related issue: libp2p/go-libp2p-kad-dht#966
Expected behavior
When a
FIND_NODE
request for self (node's own key) is received, the response should contain the closest known peers.Actual behavior
When a
FIND_NODE
request for self (node's own key) is received, an empty response is returned.rust-libp2p/protocols/kad/src/behaviour.rs
Lines 1183 to 1184 in a579e69
Relevant log output
No response
Possible Solution
Don't return an empty response, but rather the closest peers to the requested key (excluding self).
Version
No response
Would you like to work on fixing this bug ?
Yes
The text was updated successfully, but these errors were encountered: