-
Notifications
You must be signed in to change notification settings - Fork 31
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
Adjust approach of randomNodes to a more lookup based system for providing peers #271
Comments
The interest might be two-folded:
|
TLDR: I believe there is a way to abuse the current implementation of On the topic of efficiency, suggestions have been made (mostly by @cheatfate) to work on improving the Giving this some thought, I believe this can introduce a security risk. Especially when the number of nodes in the routing table is still low or almost none, e.g. before or during first lookup.
And giving this some further thought, the exact same abuse can be done currently already with the All this might be difficult to abuse in practise, but nevertheless we need to be careful when trying to optimise the provisioning of peers and keep this in mind. Else the original intent of using kademlia based discovery might be ignored/negated. The way I see forward now is:
|
The proper fix for this issue is to maintain predefined set of peers which was obtained via previous runs and saved in some sort of peer table.
To fix this issue you should maintain proper peerPool and number of places which can be controlled by remote nodes should be limited. So for example you can have 80% of places which you populating by your own discovery and 20% of places can be occupied by remote pings. Also you need to implement network rate limits. |
Yes, this is what I proposed as option at the end of previous comment: "Or have some additional structure inside discovery that provides the newly discovered nodes, possible with some filtering, but need to be careful there not introducing bias. This is what I was thinking about before the NBC side of seen peers filtering was introduced."
Yes, with structure mentioned above in place, which fills only discovered nodes, by which I meant, discovered through lookup, you would be practically doing this. Just a general Rate limits is another point, that has not only implications on the poisoning of peers and thus that deserves its separate issue. Created that issue: #284 |
The idea that the lookup approach would be more resilient than the Additionally the lookup approach could also be abused by a malicious actor by precomputing lots of IDs to be able to provide the closest ids and as such filling the lookup request with only/mostly the node ids of the malicious actor. This is described in this paper: https://arxiv.org/pdf/1908.10141.pdf For this reason, the Because of this, the query call will be more resilient than the lookup call, and also faster. Thus it can be used instead of randomNodes, and will provide more unique peers. An additional Node/ENR cache could still be added, that provides a set of "latest discovered" nodes (and perhaps with some timer on which ones were last provided to the application above), but I'm not sure if would give very different results. It might turn out to be useful however if we need to get new peers with a specific ENR field (e.g. eth2 attnets) fast (no time to do findnode requests). |
Resolved with #322 |
Currently lookups are done automatically at specific interval.
Applications using discoveryv5 can then request nodes with
randomNodes
. This will select nodes from the routing table.If wanted,
lookup
orrandomLookup
can still be called to provide potentially extra peers.It might however be of interest to only use
randomLookup
(orlookup
) to provide peers. Discovery could have a timer to be sure that a lookup is done every x minutes, in case it would not be trigger by the application.EDIT: Some discussion and thinking has brought us to the conclusion (see comments below) that
randomNodes
in its current form is not only inefficient, but also likely to have security flaws. Additionally, the idea of usingrandomLookup
directly does not seem to get much approval. The alternative idea is something proposed a while back with an additional structure holding latest discovered nodes through lookup, which would be triggered to provide these peers after a new lookup.The text was updated successfully, but these errors were encountered: