-
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: Split up UpdateValidator into distinct state transitions applied only in EndBlock #2394
Conversation
@alexanderbez Thanks for the review, comments addressed. This PR now additionally (sorry for slight mega-PR, but these updates have to happen together):
|
8cc2ccc
to
1c1183a
Compare
cc @HaoyangLiu, @kidinamoto01 This is the major staking refactor that will be included in Cosmos SDK 0.25, you might find it helpful to read over (and any comments are welcome). |
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.
Changes look great -- hard to see if any corner cases arise. Curious how intra-block validator power changes will work out since that was a cause for a lot of bugs in the old code. Looks like this will address any concerns though.
Will approve once passing CI!
operator := sdk.ValAddress(iterator.Value()) | ||
validator := k.mustGetValidator(ctx, operator) | ||
|
||
if validator.Jailed { |
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.
👌
It is - I think this logic is simpler, which makes corner cases less likely, but we can still add more defensive asserts in the staking code later (I'm trying to avoid adding anything more to this PR). |
// update then remove validator if necessary | ||
validator = k.UpdateValidator(ctx, validator) | ||
if validator.DelegatorShares.IsZero() { | ||
if validator.DelegatorShares.IsZero() && validator.Status != sdk.Bonded { |
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.
I'm confused, why is this the correct logic? Is the validator's self bond included as a delegator share?
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.
RemoveValidator
is called because I think it needs to be removed from the new power store ranking.
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.
Yes, the self-bond is a usual bond. Has to be removed here since we won't necessarily iterate over it in endblock (we'll only necessarily iterate over it if the validator was bonded).
lcd test failing locally (after
|
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.
Frick yeah! thanks for your contribs - left some comments here :)
This is caused by the underlying TM 0.24 issue. |
Now fixed since we temporarily disabled proof verification. |
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 for @rigelrozanski (hint hint Github: PR ownership change would be a great feature)
:D |
Co-authored-by: Marius Poke <[email protected]>
closes #2351
ref #2312
docs/
)PENDING.md
with issue #Files changed
in the github PR explorerFor Admin Use: