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: Change /staking/validators endpoint to return all validators candidates #4067

Closed
wants to merge 1 commit into from
Closed

Conversation

Vuksan
Copy link

@Vuksan Vuksan commented Apr 7, 2019

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 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 Apr 7, 2019

Codecov Report

Merging #4067 into develop will decrease coverage by <.01%.
The diff coverage is 50%.

@@            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
Copy link

codecov bot commented Apr 7, 2019

Codecov Report

Merging #4067 into develop will decrease coverage by <.01%.
The diff coverage is 50%.

@@            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

Copy link
Contributor

@alexanderbez alexanderbez left a 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 {
Copy link
Contributor

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)
Copy link
Contributor

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?

@alexanderbez
Copy link
Contributor

Thank you for the contribution @Vuksan! So I believe this PR will be superseded through #4099. I still think we need the error check fix.

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.

2 participants