Several people have noticed during upgrades that it's hard to find peers in #eth2 - there's a couple of reasons so let's go over them, but long story short, it's generally good and cheap for yourself and the network to set a high maximum peer count and allow incoming connections!
12:47 PM ยท Jan 14, 2021
4
16
25
#eth2 uses gossip to disseminate blocks and attestations - attestations make up the bulk as there are many, so in an effort to save bandwidth and processing, eth2 splits up the workload into 64 separate gossip channels based on committee assignment - aka subnet topics.
1
0
0
For every topic, the client will select 6-12 peers that are interested in the same topic and chat with them - this is the gossip mesh for that topic. Already, we can derive two pieces of important information: beyond 12 peers on the same subnet, there's no additional bandwidth..
1
0
0
.. used and even if you're connected to 30 peers, none of them might be interested in the same subnets, meaning your attestations will not be published! So, how do clients work with this? Each client must, for every validator that's attached to it, subscribe to two subnets:
1
0
0
The subnet of the committee that it's attesting to - this changes every epoch - and a long-term stability subnet that it advertises to others - the latter makes it easier to find subnets that you will need for attesting. A consequence of this design is..
1
0
0
..that if your max peer count is low, every 6 minutes you must disconnect some peers and connect to others so that you get enough coverage for the subnet topics - connecting to new peers takes time because they might also have reached their max peer count and won't let you in!
1
0
0
The other strategy is simply to keep a high max peer count and stay connected to peers, even if momentarily you don't need them! The client will keep them in a pool and when the time comes, it will subscribe and use these peers without having to search and connect.
1
0
0
The other important setup task to get connected to peers more quickly is to allow incoming connections - this allows others - even those that haven't configured their client correctly for incoming connections - to connect to you, thus increasing the chances of you finding..
1
0
0
.. peers more quickly for two reasons: the peers connecting to you are known to be looking for peers and haven't yet hit their peer limit, and you get access to a more diverse peer set - both those that allow incoming connections and those that don't!
1
0
0
We see many misconfigured peers in the network: those that advertise none, private or stale IP addresses - these peers will inevitably miss attestations because it's hard to connect to them and they'll have a hard time connecting to each other.
1
0
0
Above all, this happens during upgrades - if you had a stable set of good peers you were connected to, they will most likely now give their peer slots to others - specially if _they_ had a low max peer count setting - the best thing you can do in this situation is to check..
1
0
0
...that your node is correctly configured for incoming connections and set a high max peer count that allows a diverse peer selection to connect to you! It will cost you almost nothing as the protocol will automatically put a cap on active peers!
1
0
0
A final important aspect of subnets is that the more validators you run, the more subnets you will be subscribed to - this does not have a large impact on your maximum bandwidth usage but it does increase the total bandwidth usage - the reason is that the subnets are..
1
0
0
.."active" on a rolling basis - first, there's traffic on subnet a, then b, then c etc as attestations are produced for each slot - when the slot has passed, the subnet generally grows quiet until the next epoch. While there are some savings in being subscribed to fewer..
1
0
0
.. subnets, if you have the bandwidth and CPU capacity to spare, both you and the network will benefit from being subscribed to all subnets - clients have a special option for this - this way, you get to see all attestations early and you increase the chances for everyone to..
1
0
0
