-
Notifications
You must be signed in to change notification settings - Fork 11
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: Update routing table on kademlia established connections #184
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
I was thinking about this at some point, but ended up deciding that it can make things worse for kademlia, as the endpoint addresses are not necessarily the reachable ones. I think the current implementation of reporting back the observed addresses by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entry lookup optimization in bucket.rs
looks good, but I don't think we should add endpoint addresses as is to the routing table. At least not in the Manual
update mode.
As for Automatic
routing table update mode, I actually wonder how a new node joining DHT should end up in the other nodes' routing tables. Current kademlia implementation spreads routing table entries to other peers via FIND_NODE
and GET_VALUE
responses, but we have a chicken and egg problem with new nodes joining the network. Correct me if I'm wrong, but it looks like the current Automatic
implementation is going to have issues with connectivity (the network will never learn the address of a new-joiner). And it looks like this PR fixes it (even though it might not work good enough, as the endpoint address can have an ephemeral port, or can suffer NAT translation not suitable for incoming TCP connections).
I see what you mean now, yep that makes sense! Thanks for the info 🙏 Thinking out loud, we can probably close the gap and make things a bit more resilient with:
The first issue tracks addresses a bit more robustly from the transport manager perspective, without necessarily loosing track of dialed addresses, or potential addresses to dial in the future. After reading your message and looking back over the issue of authority-discovery not finding external addresses, I realized that we keep a static list of "listen addrs" in the Idenitfy protocol. The second issue should close the gap and provide proper information back to the remote peer. All this relies on the fact that we report peer addresses via We are also populating the routing table on automatic below, and reporting the address to the transport manager: litep2p/src/protocol/libp2p/kademlia/mod.rs Lines 367 to 377 in 2d1a4b4
Making the transport manager a bit more robust in tracking addresses should help out. Let me know if this sounds like a plan 🙏 |
Very good findings. Reporting discovered external addresses in |
In this PR:
Automatic
.RoutingTableUpdate::Manual
option is set (ie Substrate)Kbucket::entry
function to iterate only once through the nodes, instead of twiceCannotConnect
andCanConnect
. The terminology comes from the kademlia peer status in low-level commands. However, the routing table only needs to know if the peer is connected or disconnected (similar to libp2p).cc @paritytech/networking