Skip to content
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

refactor: Move validator voting restrictions from Msg handler to Keeper #104

Merged
merged 2 commits into from Aug 17, 2022
Merged

refactor: Move validator voting restrictions from Msg handler to Keeper #104

merged 2 commits into from Aug 17, 2022

Conversation

edk208
Copy link

@edk208 edk208 commented Aug 11, 2022

Description

The previous validator voting restriction only handled an increase to voting power through the Msg Handler Delegate command. The following refactoring pull request moves the validator restriction code to the delegation.go Keeper. This will protect against greater than 20% voting power in delegate, redelegate, and create validator situations.

Tests performed:

  • create-validator with 23% self delegation voting power - correctly fails
    Error: rpc error: code = InvalidArgument desc = recovered: validator power is over the allowed limit

  • create-validator with 9% self delegation voting power - success

  • increase delegation from 91% to 92% voting power - correctly fails

  • delegate from 9% voting power to 16% - success

  • delegate from 16% voting power to 23% - correctly fails


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...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

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...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@vegasmorph
Copy link

@YunSuk-Yeo

@edk208
Copy link
Author

edk208 commented Aug 15, 2022

Hi @YunSuk-Yeo, if you are ok with these changes and merge the changes, could I also request that the terra-money/classic-core go.mod be adjusted to reflect the terra-money/cosmos-sdk commit? I can also make the changes to classic-core in another PR if this get's pulled in if you would prefer. Thank you!!

@yun-yeo yun-yeo merged commit f77977f into terra-money:release/v0.44.x Aug 17, 2022
@GODoal
Copy link

GODoal commented Aug 17, 2022

@YunSuk-Yeo To avoid any confusion; will you also be doing the terra-money/classic-core go.mod adjustments to reflect this commit?

@aeuser999
Copy link

aeuser999 commented Aug 27, 2022

Thank you so much @YunSuk-Yeo for your very helpful review, recommendations, your graciousness, and for your work in helping to restore Terra v1 governance to all LUNA v1 holders who stake. Thank You.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants