-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Do not reject peers if --p2p-max-peers is reached #5588
Comments
This is what a Lighthouse peer observes once a Prysm node reached the max peers limit:
|
Wouldn’t that open up an attack vector? I could create thousands of nodes and your node would peer with all of them if they all dialed you? Your node would be overwhelmed with resource consumption. With regards to disabling active discovery, I don’t think this functionality is available in libp2p configuration so we haven’t taken the time to add it upstream yet. cc: @nisdas |
No, we discussed this on discord and I'm sorry for using the terms in a confusing way. Actually, But internally, there could be a soft-limit in place, let's call it The very theoretical worst-case scenario we discussed: Imagine a network with 31 nodes all connected to each other. How would a 32nd node be able to join the network if all disconnect immediately. And the more practical scenario we encountered: Trying to setup some local testnet nodes and manually connecting two local nodes kept failing due to the prysm node quickly filling up all 30 peer slots. |
@prestonvanloon This would be possible with discoveryV5, it would actually be very simple so its not such a big issue. The only place we can't do this is when using kad dht, but since that is not a part of mainnet discovery spec we can ignore it. I think this is possible to achieve using libp2p's connection manager. Its just that we disabled using it before as our nodes were getting overwhelmed from a large number of peers. We needed a strict peer limit so that our nodes did not get exhausted which the connection manager did not provide. However we have had a lot of improvements to prysm and it is able to handle a larger number of peers much more easily now. What the connection manager does is that it manages peers between a This is in theory how the connection manager should work, however we did face a lot of issues using libp2p's connection manager in prysm. Which is why we opened issues here: We did not have any way to deny active discovery using kademlia-dht in prysm previously which was our main problem, however with discoveryV5 it is much more simple to implement. Two potential solutions to resolve this:
|
To give an update, I tried running libp2p's connection manager with a So the connection manager is pretty much ineffective here and does not do active pruning very well. or at all for that matter. Any solution would have to be with a custom connection manager which would manage peers dynamically without any static hard limit. |
💎 Issue
Background
I would suggest that
--p2p-max-peers
should be a soft limit, not a hard limit.Description
In ETH1 clients, we do something along the lines:
peerCount < maxPeers
: do active peer-discovery and accept incoming peerspeerCount >= maxPeers
: don't do active peer-discovery but still accept incoming peersThe way you could implement these limits could be along the notion of
--p2p-min-peers
and--p2p-max-peers
where min-peers would be the soft limit, e.g., 30 peer target, and max-peers would be a hard limit.So, the client would try to maintain 30 peers but not reject incoming peers up to a more strictly defined hard cap. Additionally, after reaching the hard limit, it would be nice to send a Goobye to inform the peer why they were kicked.
The text was updated successfully, but these errors were encountered: