feat: peers discovery lookups#411
Merged
Merged
Conversation
it has been fixed by sending them in four different packets
ElFantasma
reviewed
Sep 18, 2024
temporary change to see where it fails
Contributor
Author
|
I've added recursive lookups, @ElFantasma would you mind doing a review, thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Implements lookups in the discovery server.
Description
In the discovery protocol, for every
xunit of time (currently hardcoded to 30 min) we need to run lookups to find new peers and fill our buckets. In theory, we should preferably run lookups on the least filled buckets, that is: when sendingfind_nodes, we should set a public key (target field) such that its distance from the peer to be queried returns the corresponding bucket number. This step is not trivial at all unless we do some brute generation. Instead, we are just sending lookups to three randomly generated pub keys. See more here.Changes in detail:
find_noderequest target field.discovery peernow spawns a new task for the lookups.peers_lookupfunction that handles the random lookups.And here is the lookup flow in detail:
find_nodeto the closest 3 nodes (that we have not yet asked) from the pubkey.Finally, this implementation is supported by some custom unit and e2e tests.
Closes #154