-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Validator missed blocks count is incorrect after decreasing slashing window #12541
Comments
Yeah this is a problem due to "stateless"-parameter changes, i.e. params change w/o having any possible desired side affects. Unfortunately, I don't think there's much you can do in this case. This is why we're deprecating In this particular case, you sort of have three options:
|
Good to hear it's on the radar already! The new direction makes sense but I'm not quite following the implementation details. Is Waiting for the release probably makes sense for us (I'd love to contribute if there's anything a relative beginner could tackle). If there's a simple way to reset the current miss counts to 0 so they'd fill in properly from then on that would be ideal, but we at least can do manual calculations for missed blocks in the explorer as a workaround. |
Yes and here. This is where we can perform all sorts of side effects as we have access to the entire keeper. Note, we currently dont have any logic, here but we need to!
I think you have to perform an upgrade to fix them :/ |
Cool, I spotted that function earlier and it makes sense to put the side effects there. How does that function get called via governance though?
That's unfortunate but I'm sure we'll figure it out, appreciate your help. |
Governance just executes a series of one or more The issue still stands though -- we need to figure out what kind of logic we need to perform when updating these params. |
Got it, thanks!
Yeah, so in this case (the slashing window) I see two options: we can either set all missed counts to 0 at update time and allow a slight blip in the data, or else we need to recalculate the totals by checking every block in the window. I'm not sure what the performance requirements are for these updates but I'm guessing the second option might be a bit heavy. |
Yeah true, but this only gets executed on proposal updates as a proposal, so a slight performance hit isn't too much of a concern. |
now that params have migrated to modules we can tackle this issue. |
Yes, the
|
by default i was thinking we could reset, we dont want the case of there are 5 validators who have 10k missed blocks and now the window is 5k and they get slashed right away. If you are fine with this i can make the change |
In my personal opinion, such a change on a network means that the protocol is becoming more stringent with liveness guarantees, and thus I believe that validator should be slashed. However, that's just my opinion. Networks might see it differently. Also, what do you do in the case when the window increases? In that case, I'm even more firm on not reseting. |
why would we need to get, clear and set? couldnt we iterate and clear anything past a certain window? |
You need to resize the bitmap, requiring you to get all the validator's missed blocks. If we go with the simple approach of just resetting, then the migration is dead simple -- just delete! |
Summary of Bug
After lowering the slashing window from 35000 to 18000 on the Kujira blockchain some validators are stuck with a missed block count that won't clear even if they don't miss any more blocks. Querying all blocks in the signing window for some validators (e.g. kujiravaloper1pshqems6hdka48gc56r2ykshyaarkt40hl0rlh) shows no misses while
kujirad query slashing signing-info
reports a positive count.I believe the issue is here:
cosmos-sdk/x/slashing/keeper/infractions.go
Lines 23 to 49 in 23576d3
This code updates the missed block count by checking the current value against the previous value at that index. The problem is any blocks missed at indexes above 18000 in the bit array are "lost" when the window changes because they'll contribute to the count but never be checked again. That explains the behavior we're seeing where multiple validators have miss counts that won't go below where they were on 7/3 when the parameter change took effect.
Version
v0.45.4
Steps to Reproduce
Cause a validator to miss blocks distributed throughout the slashing window and then lower the slashing window parameter for the chain. Compare manual missed block counts from checking signatures against what's reported by
query slashing signing-info
.For Admin Use
The text was updated successfully, but these errors were encountered: