-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat: implement v0.50 slashing bitmap logic #548
Conversation
previous := k.GetValidatorMissedBlockBitArray(ctx, consAddr, index) | ||
previous, err := k.GetMissedBlockBitmapValue(ctx, consAddr, index) | ||
if err != nil { | ||
panic(fmt.Sprintf("Expected to get missed block bitmap value for validator %s at index %d but not found, error: %v", consAddr, index, err)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
// Bitmap value has changed from not missed to missed, so we flip the bit | ||
// and increment the counter. | ||
if err := k.SetMissedBlockBitmapValue(ctx, consAddr, index, true); err != nil { | ||
panic(fmt.Sprintf("Expected to set missed block bitmap value for validator %s at index %d but not found, error: %v", consAddr, index, err)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
// Bitmap value has changed from missed to not missed, so we flip the bit | ||
// and decrement the counter. | ||
if err := k.SetMissedBlockBitmapValue(ctx, consAddr, index, false); err != nil { | ||
panic(fmt.Sprintf("Expected to set missed block bitmap value for validator %s at index %d but not found, error: %v", consAddr, index, err)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
k.clearValidatorMissedBlockBitArray(ctx, consAddr) | ||
err = k.DeleteMissedBlockBitmap(ctx, consAddr) | ||
if err != nil { | ||
panic(fmt.Sprintf("Expected to delete missed block bitmap for validator %s but not found, error: %v", consAddr, err)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
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 LGTM!
We should just be careful that we test jailing of a validator that went through migration on our testnet |
@ValarDragon jailing test should just be, if the validator is capable of being downtime jailed and then unjailed, and then double sign slash? |
Description
Closes: #XXXX
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 API or client breaking changeCHANGELOG.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...
!
in the type prefix if API or client breaking change