Jacek Sieka Profile picture
14 Jan, 18 tweets, 4 min read
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!
#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.
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..
.. 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:
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..
..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!
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.
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..
.. 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!
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.
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..
...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!
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..
.."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..
.. 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..
...find a client they share subnets with! You will benefit because when it's your turn to produce a block, your client can include previously unseen attestations from more subnets and thus grab a larger reward!
is a an excellent way to make upgrades smooth: statically peer at least two nodes and have these subscribe to all subnets!
... and upgrade one at a time, of coz :)

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Jacek Sieka

Jacek Sieka Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @jcksie

28 Oct 20
The medalla #eth2 testnet hasn't been finalizing for a while which puts some additional stress on clients as the number of possible valid chain histories, or branches, grows - here's what goes on in an @ethnimbus client in this case:
* We use more memory - normally we hover around 500mb but memory consumption now goes up to 1-2gb: In each possible history, votes and validator assignments might be different - we keep a compressed in-memory cache of the most crucial information
The caches are used to process attestations - the network becomes unhealthy if attestation processing is slow or if we have to drop some because we don't have time to recreate the committee to validate them - for this we need access to the shuffling of active validators
Read 13 tweets
1 May 20
Curious what goes on inside an #eth2 client? Let's take a look at some colourful boxes loosely depicting the @ethnimbus implementation..
#eth2 uses #libp2p to establish a peer-to-peer network - each node opens encrypted connections to other nodes using chronos and nim-libp2p, purpose-built networking libraries in @nim_lang, and multiplex several protocols like gossip and eth2/sync over that link using `mplex`
On top of #libp2p, we build the #eth2 network core - protocol details, serialization, peer scoring, discv5 to feed it with fresh peers etc - we get a little playful here with @nim_lang, using some of its niche features to good performance and readability advantage
Read 7 tweets
14 Mar 19
So what does an #eth2 beacon node actually do, in practice? Well, here's a tweet storm to find out. We'll follow the logs of a node backwards, just like following a block chain that effectively is a singly linked list going back in time. Reverse engineering, like :)
The beacon node establishes the current head of the list effectively by voting, or attesting, as it's called here. Time progresses in slots, and for every slot, we broadcast and collect votes. Several nodes are voting for block B9F2ED1F, us included.
Apart from the head block, rewards will be handed out for getting a few other pieces of data right - including nailing justification as per Casper: ethresear.ch/t/beacon-chain…. 10 validators connected to this node, but only 3 are voting this round - it's split by shard.
Read 19 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!