-
Notifications
You must be signed in to change notification settings - Fork 141
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
fix!: Avoid immediately jailing validators that are no longer opted-out #1549
Conversation
// Update smallest validator power that cannot opt out. | ||
am.keeper.UpdateSmallestNonOptOutPower(ctx) | ||
// Execute BeginBlock logic for the Soft Opt-Out sub-protocol | ||
am.keeper.BeginBlockSoftOptOut(ctx) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
Co-authored-by: Simon Noetzlin <simon.ntz@gmail.com>
Co-authored-by: Simon Noetzlin <simon.ntz@gmail.com>
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.
Curious about this: why reset the start height instead of the missed blocks counter?
afaict, the cleanest solution to me seems to be to, for every opt-out validator, set the missed blocks counter to zero in each block, before it is entered on chain.
This has a few advantages:
- No need for an extra field on validators (though it's still state machine breaking)
- Works out-of-the-box with existing downtime checkers (they will just not see the missed blocks)
I might be missing something though. I think the current solution is also fine, maybe not worth changing this for.
@p-offtermatt I didn't want to mess with the downtime logic too much. If you set the missed blocks counter to zero, you risk having the counter negative and potentially never trigger a downtime event. See https://github.com/cosmos/cosmos-sdk/blob/v0.47.7/x/slashing/keeper/infractions.go#L41-L52.
That would be a lot of store writes and I don't see the advantage of doing it like this.
Why is the extra field an issue?
See my comment above. I think reseting the missed blocks counter would mess with the downtime logic. |
Makes sense, thanks. I didn't take a close look at the missed-blocks logic in the slashing module (which is more intricate than I thought), and indeed I think your solution seems good under the constraints. |
Co-authored-by: bernd-m <43466467+bermuell@users.noreply.github.com>
Co-authored-by: bernd-m <43466467+bermuell@users.noreply.github.com>
Co-authored-by: bernd-m <43466467+bermuell@users.noreply.github.com>
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.
pls accept suggested changes on previous comments, thx
Description
Closes: #1517
This PR implements the solution from this comment. Mainly, when a validator can no longer opt out, the
StartHeight
fields in itsSigningInfo
struct (in the slashing module) is set to the current height. As a result, the validator cannot be jailed for downtime for at least the sliding window for downtime slashing (SignedBlocksWindow
).Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if the change is state-machine breakingCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
the type prefix if the change is state-machine breaking