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

Fix queryDelegationRewards #4047

Merged
merged 4 commits into from
Apr 4, 2019

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Apr 4, 2019

closes: #4020


  • 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 a relevant changelog entry: sdkch add [section] [stanza] [message]

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

@@ -207,7 +207,17 @@ func queryDelegationRewards(ctx sdk.Context, _ []string, req abci.RequestQuery,
ctx, _ = ctx.CacheContext()

val := k.stakingKeeper.Validator(ctx, params.ValidatorAddress)
if val == nil {
// TODO: Should use ErrNoValidatorFound from staking/types
Copy link
Contributor Author

@alexanderbez alexanderbez Apr 4, 2019

Choose a reason for hiding this comment

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

We should be using those error types defined in staking. I see a few options:

  1. Simply import and use staking/types
  2. Add alias functions in distribution which are set at runtime by the staking module
  3. Have methods in the staking keeper actually return an appropriate error instead of nil or a bool (i.e. GetValidator should return (Validator, sdk.Error/error) instead of bool)

I'm biased towards (3) as that is the cleanest approach.

/cc @rigelrozanski @cwgoes

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 to option (3)

@alexanderbez alexanderbez added the C:x/distribution distribution module related label Apr 4, 2019
@codecov
Copy link

codecov bot commented Apr 4, 2019

Codecov Report

Merging #4047 into release/v0.34.0 will decrease coverage by <.01%.
The diff coverage is 0%.

@@                 Coverage Diff                 @@
##           release/v0.34.0    #4047      +/-   ##
===================================================
- Coverage            59.99%   59.99%   -0.01%     
===================================================
  Files                  212      212              
  Lines                15107    15111       +4     
===================================================
+ Hits                  9064     9066       +2     
  Misses                5422     5422              
- Partials               621      623       +2

@alexanderbez alexanderbez marked this pull request as ready for review April 4, 2019 14:27
Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

LGTM

@jackzampolin
Copy link
Member

Is this something we want in the release?

@fedekunze
Copy link
Collaborator

Probably we should

@alexanderbez alexanderbez changed the base branch from develop to release/v0.34.0 April 4, 2019 17:50
@alexanderbez alexanderbez merged commit 3361871 into release/v0.34.0 Apr 4, 2019
@alexanderbez alexanderbez deleted the bez/4020-fix-queryDelegationRewards branch April 4, 2019 17:53
@alexanderbez alexanderbez mentioned this pull request Apr 9, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/distribution distribution module related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants