-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: Change /staking/validators endpoint to return all validators candidates #4067
Conversation
…tes as stated in API documentation.
Codecov Report
@@ Coverage Diff @@
## develop #4067 +/- ##
==========================================
- Coverage 60.01% 60% -0.01%
==========================================
Files 212 212
Lines 15107 15106 -1
==========================================
- Hits 9066 9065 -1
Misses 5420 5420
Partials 621 621 |
1 similar comment
Codecov Report
@@ Coverage Diff @@
## develop #4067 +/- ##
==========================================
- Coverage 60.01% 60% -0.01%
==========================================
Files 212 212
Lines 15107 15106 -1
==========================================
- Hits 9066 9065 -1
Misses 5420 5420
Partials 621 621 |
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.
Thanks @Vuksan! Left a question for @rigelrozanski to get clarification. Also, this needs a pending change log entry.
|
||
res, errRes := codec.MarshalJSONIndent(cdc, validators) | ||
if err != nil { | ||
if errRes != nil { |
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.
Good catch. I recall fixing the same issue elsewhere in staking. Perhaps we should do a quick pass through and make sure there aren't other bugs like this 👍
@@ -129,11 +129,10 @@ func NewQueryRedelegationParams(delegatorAddr sdk.AccAddress, srcValidatorAddr s | |||
} | |||
|
|||
func queryValidators(ctx sdk.Context, cdc *codec.Codec, k keep.Keeper) (res []byte, err sdk.Error) { | |||
stakingParams := k.GetParams(ctx) | |||
validators := k.GetValidators(ctx, stakingParams.MaxValidators) | |||
validators := k.GetAllValidators(ctx) |
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.
If the query's documentation states all validators instead of all bonded validators, then this change make sense. Is this the expectation @rigelrozanski?
API documentation states "Get all validator candidates".
It was returning up to
maxValidators
validator candidates, not all of them.Also, error below never got returned, because of typo: condition was checking err instead of errRes.
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. - I searched through issues, but couldn't find any related to this.
Wrote tests
Updated relevant documentation (
docs/
) - API documentation already states that all validator candidates should be returned.Added a relevant changelog entry:
sdkch add [section] [stanza] [message]
rereviewed
Files changed
in the github PR explorerFor Admin Use: