-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix queryDelegationRewards #4047
Conversation
@@ -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 |
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.
We should be using those error types defined in staking
. I see a few options:
- Simply import and use
staking/types
- Add alias functions in
distribution
which are set at runtime by thestaking
module - Have methods in the
staking
keeper actually return an appropriate error instead ofnil
or abool
(i.e.GetValidator
should return(Validator, sdk.Error/error)
instead ofbool
)
I'm biased towards (3) as that is the cleanest approach.
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.
+1 to option (3)
Codecov Report
@@ 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 |
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.
LGTM
Is this something we want in the release? |
Probably we should |
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 explorerFor Admin Use: