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

R4R: Refactor validator deletion #2514

Merged
merged 5 commits into from
Oct 18, 2018
Merged

Conversation

sunnya97
Copy link
Member

@sunnya97 sunnya97 commented Oct 16, 2018

closes #1673

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented Oct 17, 2018

Codecov Report

Merging #2514 into develop will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           develop   #2514      +/-   ##
==========================================
+ Coverage    57.87%   57.9%   +0.02%     
==========================================
  Files          140     140              
  Lines         8119    8119              
==========================================
+ Hits          4699    4701       +2     
+ Misses        3123    3121       -2     
  Partials       297     297

@sunnya97 sunnya97 force-pushed the sunny/refactor-validator-deletion-2 branch from 193e53f to e8c7a2f Compare October 18, 2018 04:28
@sunnya97 sunnya97 force-pushed the sunny/refactor-validator-deletion-2 branch from 381be29 to 88f3b03 Compare October 18, 2018 05:02
@sunnya97 sunnya97 changed the title WIP: Refactor validator deletion R4R: Refactor validator deletion Oct 18, 2018
@ValarDragon
Copy link
Contributor

Can you make a follow-up issue to ensure the simulator will run this scenario?

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, otherwise LGTM.

if validator.DelegatorShares != 0 {
RemoveValidator(unbondingValidator)
} else {
validator.Status = sdk.Bonded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh why would we set the status to bonded?

Copy link
Member Author

@sunnya97 sunnya97 Oct 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch, should be unbonded

if validator.DelegatorShares.IsZero() && validator.Status != sdk.Bonded {
// if bonded, we must remove in EndBlocker instead
if validator.DelegatorShares.IsZero() && validator.Status == sdk.Unbonded {
// if not unbonded, we must remove in EndBlocker instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"we must remove in EndBlocker or at the end of the unbonding queue instead"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are the same thing. The unbonding queue is processed during the EndBlocker

if validator.Tokens.IsZero() && validator.Status != sdk.Bonded {
// if bonded, we must remove in ApplyAndReturnValidatorSetUpdates instead
if validator.Tokens.IsZero() && validator.Status == sdk.Unbonded {
// if not unbonded, we must remove in EndBlocker instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check DelegatorShares instead of Tokens here? Also I think the comment needs to be updated - "we must remove in EndBlocker or at the end of the unbonding queue instead".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure. They should have the same effect, but can I can change it to DelegatorShares.IsZero() to remain consistent.

@cwgoes cwgoes merged commit 505c356 into develop Oct 18, 2018
@cwgoes cwgoes deleted the sunny/refactor-validator-deletion-2 branch October 18, 2018 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure that unbonding-delegations/redelegations for removed validators are still slashable
4 participants