-
Notifications
You must be signed in to change notification settings - Fork 607
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
[Valset]: Fix weight calculations to be based on tokens instead of shares #6699
Conversation
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.
Nice job, I am approving but going to see if you agree with these comments prior to merge.
… that modified dependencies locally
…com/osmosis-labs/osmosis into alpo/fix-valset-undelegation-shares
Important Notice This PR modifies an in-repo Go module. It is one of:
The dependent Go modules, especially the root one, will have to be Please follow the instructions below:
Please let us know if you need any help. |
… that modified dependencies locally
…ares (#6699) * fix weight calculations to be based on tokens instead of shares * changelog * add comments and clean up tests * Auto: update go.mod after push to alpo/fix-valset-undelegation-shares that modified dependencies locally * switch rounding to bankers * Auto: update go.mod after push to alpo/fix-valset-undelegation-shares that modified dependencies locally --------- Co-authored-by: github-actions <[email protected]> (cherry picked from commit cf159ac)
…ares (#6699) (#6700) * fix weight calculations to be based on tokens instead of shares * changelog * add comments and clean up tests * Auto: update go.mod after push to alpo/fix-valset-undelegation-shares that modified dependencies locally * switch rounding to bankers * Auto: update go.mod after push to alpo/fix-valset-undelegation-shares that modified dependencies locally --------- Co-authored-by: github-actions <[email protected]> (cherry picked from commit cf159ac) Co-authored-by: Alpo <[email protected]>
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.
Nice job
…ares (#6699) * fix weight calculations to be based on tokens instead of shares * changelog * add comments and clean up tests * Auto: update go.mod after push to alpo/fix-valset-undelegation-shares that modified dependencies locally * switch rounding to bankers * Auto: update go.mod after push to alpo/fix-valset-undelegation-shares that modified dependencies locally --------- Co-authored-by: github-actions <[email protected]>
Closes: #XXX
What is the purpose of the change
Current valset undelegation logic has a bug where it calculates the amount to undelegate based on validator shares instead of their underlying tokens. Since the value of shares are nonfungible and highly variable across validators, this is a fundamentally incorrect way to calculate the correct portion of a valset that corresponds to a given validator. For instance, if a user has delegated 10 shares each to 10 validators and one of the validators gets slashed for 20% of its stake, the current implementation would continue to treat the slashed validator as 10% of the delegator's set.
This PR fixes valset undelegation logic so it works with tokens instead of shares.
Testing and Verifying
The helper that was causing the root issue is fixed and tested in
keeper_test.go
Documentation and Release Note
Unreleased
section ofCHANGELOG.md
?Where is the change documented?
x/{module}/README.md
)