-
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: Validator unbonding state #2163
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2163 +/- ##
==========================================
Coverage ? 64.18%
==========================================
Files ? 140
Lines ? 8567
Branches ? 0
==========================================
Hits ? 5499
Misses ? 2692
Partials ? 376 |
x/stake/types/validator.go
Outdated
@@ -423,6 +418,19 @@ func (v Validator) BondedTokens() sdk.Dec { | |||
return sdk.ZeroDec() | |||
} | |||
|
|||
// Returns if the validator should be considered unbonded | |||
func (v Validator) IsUnbonded(ctx sdk.Context) bool { | |||
if v.Status == sdk.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.
why not switch
here too?
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.
++
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.
oh ic switch on the status. Okay yup ++
@@ -134,12 +143,12 @@ func (k Keeper) Unjail(ctx sdk.Context, pubkey crypto.PubKey) { | |||
} | |||
|
|||
// set the jailed flag on a validator | |||
func (k Keeper) setJailed(ctx sdk.Context, pubkey crypto.PubKey, jailed bool) { | |||
func (k Keeper) setJailed(ctx sdk.Context, pubkey crypto.PubKey, isJailed bool) { |
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.
(out of curiosity) why did you decide to rename?
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.
When I first read this it confused me a bit, had to read it twice before it clicked - so I figured it'd probably confuse others at some point too. I think the word jailed might be overloaded just a tiny bit - I figured isJailed
is just a little bit more explicit. Very minor though.
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.
On the surface, looks good. I'll want to play around with this a bit too.
x/stake/types/validator.go
Outdated
@@ -423,6 +418,19 @@ func (v Validator) BondedTokens() sdk.Dec { | |||
return sdk.ZeroDec() | |||
} | |||
|
|||
// Returns if the validator should be considered unbonded | |||
func (v Validator) IsUnbonded(ctx sdk.Context) bool { | |||
if v.Status == sdk.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.
++
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 -- minor question, does a validator go from unbonding
to unbonded
after UnbondingMinTime
automatically? Or is IsUnbonded
meant to be the only method used for determining that status.
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 pending merge conflict resolution - and we should merge develop
first, ensure all changes from #2040 are reflected
@@ -45,6 +45,7 @@ func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) sim | |||
case sdk.Bonded: | |||
bonded = bonded.Add(validator.GetPower()) | |||
case sdk.Unbonding: | |||
loose = loose.Add(validator.GetTokens().RoundInt()) |
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.
💯 for updating the invariants!
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.
:)
Making required updates now |
@cwgoes corrections for the new develop have been made |
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
Closes #1676
Closes #1877
docs/
)PENDING.md
with issue #Files changed
in the github PR explorerFor Admin Use: