-
Notifications
You must be signed in to change notification settings - Fork 231
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
Gossip sub attestation subnet scoring #3029
base: unstable
Are you sure you want to change the base?
Conversation
period = slotPeriod, | ||
averageOverNPeriods = ATTESTATION_SUBNET_COUNT, # Smooth out empty committees | ||
peersPerTopic = peersPerTopic, | ||
expectedMessagesPerPeriod = TARGET_COMMITTEE_SIZE.int, #TODO use current number |
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.
If someone has a ~1-liner to get the current average committee size (or number of active validators) from Eth2Node
, I'll take it
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.
we don't have it in here (network doesn't know about dag), but it changes only once per epoch so onSlotEnd
could update it by grabbing an getEpochRef
for (head, wallslot)
similar to how it sets up attestation subnets
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.
more to the point - we might need to update the scoring while nimbus is running - for example during sync, we'll go from 20k "known" validators to 250k
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.
Ah right, didn't think about sync.
But we only subscribe to gossip once synced, no?
My intuition was that the number grows/reduce slowly enough to avoid updating it OTF, but we can do it if needed
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.
we shouldn't assume really that users restart nimbus regularly (they shouldn't have to) - ie there are still users that haven't upgraded since genesis
# In order of priority: | ||
# - A badly behaving peer (eg, sending bad messages) will be heavily sanctionned | ||
# - A good peer will gain good scores | ||
# - Inactive/slow peers will be mildly sanctionned. |
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.
# - Inactive/slow peers will be mildly sanctionned. | |
# - Inactive/slow peers will be mildly sanctioned. |
Before we merge this, we should likely do 2 things:
|
slotPeriod = chronos.seconds(12), | ||
peersPerTopic = 8, | ||
TopicType(topicType) | ||
).validateParameters().tryGet() |
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.
validateParameters
should probably be replaced by a TopicParameters.init
that returns a Result
timeToEndValue = period * averageOverNPeriods.int * 2, | ||
heartbeatPeriod) | ||
|
||
# Start to remove up to 30 points when peer send less |
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.
this can bring a peer into negative score territory?
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'm still tweaking this, but my intuition is that it should be
FirstMessageDeliveriesBonus > InactivePenalty > TimeInMeshBonus
Currently, it's 80 > -30 > 20
A perfect peer would have 100 per topic. If it suddenly becomes inactive, he would gradually (in averageOverNPeriods) drop to -10 (InactivePenalty + TimeInMeshBonus), so it would be negative, meaning you can't grind for points, then become inactive.
So yeah, being inactive could bring to negative score, if you don't do good things aside. Now, what we do when they are into negative score is a different question. As the moment, this PR is fairly conservative on actions (to reach -40 you would need to be inactive on a lot of topics, or more probably, send a lot of invalid messages), since the primary goal as of now is to restore the opportunistic grafting, which helps a lot with inactive peers.
ATM i'm not very happy on the topicWeight computation, need to rework that
I've been running this for a while, and it seem to give reasonable scores. Only weird thing I saw, we often give invalid message penalties to peer on
I'm not sure we need it in this case, because the impact is very minimal (we almost never kick peers because of it, we just prune inactive peers for a while) I'll continue to monitor it, add the dynamic validator count, and should be GTG. |
657f9d5
to
a4667d1
Compare
Completely reworked scoring in gossipsub
First goal was to also score peers in the attestation subnet.
Previously, we only scored peers in global topics which was an issue when running with many peers, since we would only have a few of them in global topics, and the majority of peers wouldn't have a score, which would break, amongst other things, the opportunistic grafting.
The scoring system in gossipsub 1.1 is heavily convoluted, I tried my best to explain it in layman terms, and add helpers functions which allows to input "understable" data to generate the params.
I've not tweaked this yet, so WIP