-
Notifications
You must be signed in to change notification settings - Fork 537
Description
TL;DR;
- Peers in Gossipsub are not properly scored
- We should revisit GossipSub scoring tresholds
- We should merge application-level scoring with Gossipsub scoring
- We shoul revisit application-level scoring
Gossipsub scoring
Gossip sub scores peers on different metrics, specs are here. One of these metrics is gossiping of (new) messages. By default JS implementation of Gossip sub expects 10 msg/s per topic, after which it starts to score peer negatively.
Aztec shouldn't expect such a large number of messages per (most) topics (e.g., block proposals & attestations).
So we should fine-tune this properely. For example, here is how lodestar calculates these scores.
Tresholds
We should also revisit score tresholds after whcih GossipSub starts penalizing peers. Here are our tresholds. Which I believe are too lax. For example if the peer is not gossiping messges, the score (by default) will be deceased by -400 most. Given our thresholds (e.g. -14k) - this won't ever negatively impact bad behaving peer.
Disconnecting from peers
Negative GossipSub doesn't imply disconnect from peer, meaning GossipSub will never initiate disconnect.
Nor wil libp2p untill we hit peer limits. Only then is the disconnect initated. There is sorting logic defined here - how libp2p decides to disconnec. One of the factors is peer tags - one can tag peer with certain score. Bigger the score, the less likely the peer will be disconnected. This is what GossipSub also uses - peers in Mesh will be tagged with some good score. Once peer leaves the mesh, the tag is removed (source).
Still if we are not hiting these limits we could be left with peers which are not actively and altruistically participating in the network. This is why I believe we shold proactively disconnect from bad peers on application level - as we already do.
Application scoring
We already score peers on application level (manily baded on Req/Resp) and we are disconnecting from bad peers. We should adjust these scores appropriately keeping in mind the GossipSub trehsolds and scoring AND merge the application-level scoring with GossipSub, as for example lodestar does.
On each heartbeat the bad peers should be disconnected.