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: implement validator queue #2451

Merged
merged 18 commits into from
Oct 15, 2018
Merged

R4R: implement validator queue #2451

merged 18 commits into from
Oct 15, 2018

Conversation

sunnya97
Copy link
Member

@sunnya97 sunnya97 commented Oct 6, 2018

closes #2412

  • 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)

@sunnya97 sunnya97 changed the title implement validator queue WIP: implement validator queue Oct 6, 2018
@codecov
Copy link

codecov bot commented Oct 6, 2018

Codecov Report

❗ No coverage uploaded for pull request base (develop@dd8b574). Click here to learn what that means.
The diff coverage is 53.84%.

@@            Coverage Diff             @@
##             develop    #2451   +/-   ##
==========================================
  Coverage           ?   61.93%           
==========================================
  Files              ?      150           
  Lines              ?     9476           
  Branches           ?        0           
==========================================
  Hits               ?     5869           
  Misses             ?     3199           
  Partials           ?      408

@sunnya97 sunnya97 requested a review from zramsay as a code owner October 6, 2018 21:08
@sunnya97 sunnya97 changed the title WIP: implement validator queue R4R: implement validator queue Oct 6, 2018
@sunnya97 sunnya97 added this to the 0.25 milestone Oct 6, 2018
}
k.UnbondingToUnbonded(ctx, val)

// endBlockerTags.AppendTags(sdk.NewTags(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be deleted/uncommented ?

Copy link
Contributor

@rigelrozanski rigelrozanski left a comment

Choose a reason for hiding this comment

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

Dopeness! Thanks for this! - few comments

x/stake/handler.go Outdated Show resolved Hide resolved
x/stake/keeper/val_state_change.go Outdated Show resolved Hide resolved
x/stake/types/validator.go Show resolved Hide resolved
got = handleMsgBeginUnbonding(ctx, msgBeginUnbondingValidator, keeper)
require.True(t, got.IsOK(), "expected no error: %v", got)
var finishTime time.Time
types.MsgCdc.MustUnmarshalBinary(got.Data, &finishTime)
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is okay - I think it would be a bit nicer if we queried for the validator, and used the finish time from that object

@jackzampolin
Copy link
Member

@sunnya97 Any chance you can address these comments today so we can get this merged?

@sunnya97 sunnya97 changed the base branch from sunny/staking-unbonding-queue to develop October 10, 2018 08:54
@jackzampolin
Copy link
Member

Lets try to get this in today cc @cwgoes @rigelrozanski @jaekwon

@cwgoes
Copy link
Contributor

cwgoes commented Oct 10, 2018

It's failing test_cover and also test_lint, those need to be fixed first.

@jackzampolin
Copy link
Member

Does this have to do with the non-determinism @cwgoes

@cwgoes
Copy link
Contributor

cwgoes commented Oct 11, 2018

Not the lint, maybe test_cover.

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.

A few concerns, see comments.

types/context.go Show resolved Hide resolved
x/stake/keeper/validator.go Outdated Show resolved Hide resolved
}

// Returns a concatenated list of all the timeslices before currTime, and deletes the timeslices from the queue
func (k Keeper) DequeueAllMatureValidatorQueue(ctx sdk.Context, currTime time.Time) (matureValsAddrs []sdk.ValAddress) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we copy these into memory instead of executing the validator state transition during iteration?

Copy link
Member Author

@sunnya97 sunnya97 Oct 13, 2018

Choose a reason for hiding this comment

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

Left over from the Unbonding/Redelegations queue where the actual unbonding was done in the Handler, so it could add tags (and not double iterate)

Copy link
Member Author

@sunnya97 sunnya97 Oct 13, 2018

Choose a reason for hiding this comment

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

Maybe keeping a separate GetAllMatureValidatorQueue function could be useful for a future querier endpoint.

@sunnya97
Copy link
Member Author

I think test_cover failing has to do with the CI non determinism. I can't reproduce it on my local machine, and at current CI run has it passing 🤷‍♂️

@rigelrozanski
Copy link
Contributor

yeah there's some non-determinism lingering - I noticed it in some other PRs forsure

@cwgoes
Copy link
Contributor

cwgoes commented Oct 13, 2018

LGTM - giving @rigelrozanski a chance to final-review.

@rigelrozanski rigelrozanski merged commit 6c9e71b into develop Oct 15, 2018
@jackzampolin
Copy link
Member

Nice job @sunnya97 🎉 !!!

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.

Implement Validator Queue
5 participants