Skip to content
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: clarify bootstrap process #658

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guillaumemichel
Copy link
Contributor

The below is one possible algorithm to bootstrap. Implementations may diverge from this base algorithm as long as they adhere to the wire format and keep their routing table up-to-date, especially with peers
closest to themselves.

  • Update default bootstrap interval to 10 minutes (go-libp2p-kad-dht, IPFS doc)
  • Replace a random peer ID with a random peer ID for every non-empty routing table's k-bucket.
    • The random peer ID has a very low probability to land in a bucket close to the node, hence the close buckets (with a high bucket ID), will (statistically) never be refreshed.
    • Taking a random peer ID falling in every non-empty k-bucket makes sure to refresh all populated buckets.
  • Remove the mention of QueryCount since it isn't mentioned anywhere else in the document, and it isn't necessary to perform this operation multiple times since all buckets are refreshed by the described process.

cc: @stormshield-frb

Copy link
Member

@sukunrt sukunrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the k-bucket is full before the query, how do we decide which peers to ultimately keep in the bucket?

@guillaumemichel
Copy link
Contributor Author

If the k-bucket is full before the query, how do we decide which peers to ultimately keep in the bucket?

This is implementation specific, here is how it works for the Amino DHT

@MarcoPolo
Copy link
Contributor

For reference, can you point to what we do in go-libp2p-kad-dht @guillaumemichel ?

@guillaumemichel
Copy link
Contributor Author

That is the function responsible for refreshing the routing table in go-libp2p-kad-dht. It is more complicated than the provided example since go-libp2p-kad-dht also uses timings to decide whether a bucket should be refreshed. It also does some poorly documented optimizations.

I wouldn't link to the code in the spec, since the spec only states a simple example, we don't want to rely on a single implementation, and the code is constantly evolving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

4 participants