-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
R4R: Fix broken invariant of bonded validator power decrease #2083
R4R: Fix broken invariant of bonded validator power decrease #2083
Conversation
validator = k.bondValidator(ctx, validatorToBond) | ||
if bytes.Equal(validator.Owner, affectedValidator.Owner) { | ||
return validator, true | ||
} | ||
|
||
return affectedValidator, 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.
Not sure if this is ideal, but in case line # 472 get executed, I need to make sure UpdateValidator
set's the newly modified affectedValidator
which should have it's status set to unbonded.
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 seems right
x/stake/keeper/validator.go
Outdated
if !found { | ||
panic(fmt.Sprintf("validator record not found for address: %v\n", oldCliffValidatorAddr)) | ||
} | ||
|
||
k.unbondValidator(ctx, cliffVal) | ||
affectedValRank := GetValidatorsByPowerIndexKey(affectedValidator, pool) |
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.
@cwgoes lmk if this is analogous to what you had in your initial fix?
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.
TestGetValidatorsEdgeCases
is now failing too, maybe we should debug that before debugging the simulation.
PENDING.md
Outdated
@@ -47,6 +47,7 @@ BUG FIXES | |||
* Gaia CLI (`gaiacli`) | |||
|
|||
* Gaia | |||
* [x/stake] [#2083] Fix broken invariant of bonded validator power decrease |
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.
Put this in CHANGELOG.md
since we're merging into the release
validator = k.bondValidator(ctx, validatorToBond) | ||
if bytes.Equal(validator.Owner, affectedValidator.Owner) { | ||
return validator, true | ||
} | ||
|
||
return affectedValidator, 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.
This seems right
Codecov Report
@@ Coverage Diff @@
## release/v0.24.0 #2083 +/- ##
===================================================
+ Coverage 63.73% 63.75% +0.02%
===================================================
Files 113 113
Lines 6667 6671 +4
===================================================
+ Hits 4249 4253 +4
Misses 2133 2133
Partials 285 285 |
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.
utACK, thanks!
closes: #2071
docs/
)PENDING.md
that include links to the relevant issue or PR that most accurately describes the change.cmd/gaia
andexamples/
For Admin Use: