Repository navigation
Why is Behavior::find_closest_local_peers() limited to the replication_factor instead of K_VALUE?
#5969
Replies: 5 comments 1 reply
|
cc @guillaumemichel since you are more familiar with Kadelima. |
|
Thanks @drHuangMHT for the heads up! AFAIK the Kademlia
There is no strict requirement that all 3 values should be the same. In your example, it is totally fine to set a replication factor lower than I think the reason for which I would suggest to adapt the code to allow a replication factor distinct from |
|
Hey @guillaumemichel, Thank you for the quick reply!
Wouldn't it make more sense to limit the number of peers returned in I was wondering if that cascades unexpected behaviour into other parts of the Kad logic, such as bootstrapping / bucket refreshing, because that also relies on |
|
Example PR of the change that I want to propose: #5971 I don't understand why you would want the amount of results here to be different than |
|
Fixed now with PR #5971 , thank you @guillaumemichel ! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
When performing a
FIND_NODErequest, we expect a node to return up toKclosest nodes to the key, as specified in the Kademlia protocol. However, Libp2p limits the number of returned nodes to thereplication_factor:https://github.com/libp2p/rust-libp2p/blob/master/protocols/kad/src/behaviour.rs#L773-L783 .
By default,
replication_factoris set toK_VALUE:rust-libp2p/protocols/kad/src/query.rs
Line 274 in f4322c5
However, it can be manually adjusted. For instance, our application sets the replication factor to
7using this function here:rust-libp2p/protocols/kad/src/behaviour.rs
Line 256 in f4322c5
FIND_NODEreturns only up to7nodes instead ofK=20, which seems unexpected.Could someone clarify the reasoning behind limiting the results to
replication_factorinstead ofK?Thanks in advance!
All reactions