-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add Libp2p Gossipsub Peer Gater #6479
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6479 +/- ##
==========================================
- Coverage 41.48% 41.46% -0.02%
==========================================
Files 2027 2027
Lines 144784 144816 +32
==========================================
- Hits 60060 60051 -9
- Misses 78513 78554 +41
Partials 6211 6211
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
config/default-config.yml
Outdated
@@ -628,6 +628,12 @@ network-config: | |||
# keep the entire network's size. Otherwise, the local node's view of the network will be incomplete due to cache eviction. | |||
# Recommended size is 10x the number of peers in the network. | |||
cache-size: 10000 | |||
peer-gater: | |||
enable: true |
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.
can you make this enabled
so the full name is gossipsub-peer-gater-enabed
. it's more consistent with our other configs
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.
network/p2p/config/gossipsub.go
Outdated
|
||
// TopicDeliveryWeightsOverride topic delivery weights used to override the default topic delivery weight 1.0 of the peer gater. | ||
// Parameters are "numerical values" that are used to compute or build components that compute the score of a peer in GossipSub system. | ||
type TopicDeliveryWeightsOverride struct { |
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.
would it be difficult to allow arbitrary strings here instead of a fixed list? It might be useful to be able to add overrides for other channels without having to rollout a new image
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.
…gater' into khalil/libp2p-peer-gater
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.
I think this PR does introduces an effective way to penalize nodes with dropping their messages with probability (1-threshold
). It is important keep in mind that threshold
is computed and updated for each peer individually. For clarity, lets write
Note the computation of
total := st.deliver + pg.params.DuplicateWeight*st.duplicate + pg.params.IgnoreWeight*st.ignore + pg.params.RejectWeight*st.reject
threshold := (1 + st.deliver) / (1 + total)
I have represented the penalty factors as throttle
will increase, but unless a the score for node DuplicateMessage
), the penalty scores will all be zero :
which yields:
In other words, I think this solution will work very well, if libP2P detects those messages as duplicates. Otherwise, we would still end up with
Can we actively confirm this please, that there is an increased rate of DuplicateMessage
calls? The peer gater is hooked into libP2P's PubSup
by implementing the RawTracer
interface.
I am wondering if we could capture the respective evidence with LocalGossipSubRouterMetrics
?
network/netconf/flags.go
Outdated
"enable the libp2p peer gater") | ||
flags.Float64(BuildFlagName(gossipsubKey, p2pconfig.PeerGaterKey, p2pconfig.TopicDeliveryWeightsKey, channels.ConsensusCommittee.String()), | ||
config.GossipSub.PeerGaterParameters.TopicDeliveryWeightsOverride.ConsensusCommittee, | ||
"topic delivery weights override for the consensus-committee topic") |
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.
I think the goal for the usage
string should be to describe what this flag does. I don't really understand the current string, because it talks about technical details, but not what I should be expecting as a result of it.
Just as an example what I mean, you could write something like:
This is a heuristic for reducing load from nodes that ask a lot of questions,
while relaying fewer up-to-date liveness-critical messages. We do that by
assigning liveness-critical messages (such as messages on the consensus-committee
topic) a higher weight, that is added to a peer's score for successfully delivering this
such message.
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.
network/netconf/flags.go
Outdated
"topic delivery weights override for the consensus-committee topic") | ||
flags.Float64(BuildFlagName(gossipsubKey, p2pconfig.PeerGaterKey, p2pconfig.TopicDeliveryWeightsKey, channels.SyncCommittee.String()), | ||
config.GossipSub.PeerGaterParameters.TopicDeliveryWeightsOverride.SyncCommittee, | ||
"topic delivery weights override for the sync-committee topic") |
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.
similarly here.
I have looked a bit further into the matter, and there is a massive spike in |
- set default source decay to 10m - disable the peer gater by default
Add Libp2p Gossipsub Peer Gater
This PR adds the libp2p gossipsub peer gater option to the flow gossipsub adapter. The peer gater is used by gossipsub to throttle messages from spamming peers. Each topic can be assigned a topic delivery weight which can prioritize messages of one topic from another. Additionally this PR adds the following:
Mainnet 25 outage testing results