-
Notifications
You must be signed in to change notification settings - Fork 759
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
Client Discovery Improvements #3120
Conversation
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
e1b66e3
to
df49bac
Compare
Ok, I did some additional improvements and tested under different network conditions (small devnet, testnet, mainnet), following results:
I have also added a descent new test suite with mockups, see Open for review. 🙂 |
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.
One comment, and am still tracking down where the filter for the network is 🤔 (see discord, have to track down a long event queue and likely take a wrong path somewhere there)
*/ | ||
confirmPeer(id: string) { | ||
if (this._confirmedPeers.size < 5000) { | ||
this._confirmedPeers.add(id) |
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.
Peers are never removed from _confirmedPeers
, so at some point we cannot confirm new peers since the set is full? Should the peer id be removed on removePeer
?
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.
Yeah, that was the lazy version assuming a very slow growth. But removing on removePeer
definitely make sense, will add. 👍
Also, the CI fails on the new tests 🤔 |
…ram, add CLI test
… discovery, reactivated discV4 for client
…) and confirmed/unconfirmed refresh() tests, fix bug in getClosestPeers()
…e mainnet peers and peering then goes quicker)
…irmation is possible
df49bac
to
02cfaba
Compare
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.
LGTM
This PR improves DiscV4 discovery in various ways.
First it adds an explicit logging message for discovery on startup. This is helpful since it remains often somewhat unclear if and what form of discovery is running.
Second it expands the
--bootnodes
option for the client to also accept abootnode.txt
file (e.g. from EthPandaOps devnet-10 config.Third it introduces a new confirmed-peers mechanism for devp2p DPT. This allows to set a higher quality bar for sendNeighbour requests by only send to peers which have been manually confirmed. Otherwise discovery is hammering out requests like crazy to - mainly - mainnet peers not finding any needle in this haystack which rendered the feature more or less useless for all networks except mainnet (in fact we had deactivated in client for everything except mainnet).
Now only peers who are on the correct network and where a network connection was/is possible get the
findNeighbour
requests. This makes discV4 discovery requests acceptable again.I was able to re-activate peer discovery by default for small networks - here devnet-10 - and have a slowly growing peer base (here the yellow numbers)! 🎉
Still need to do some testing - also write some tests - but I am confident that this approach works adequately and we can likely merge in.