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

empty rewards returns null #3705

Closed
4 tasks
fedekunze opened this issue Feb 21, 2019 · 5 comments · Fixed by #4078
Closed
4 tasks

empty rewards returns null #3705

fedekunze opened this issue Feb 21, 2019 · 5 comments · Fixed by #4078
Assignees
Labels
C:CLI C:x/distribution distribution module related T:Bug
Milestone

Comments

@fedekunze
Copy link
Collaborator

Summary of Bug

empty rewards from GET distribution/delegators/{delegatorAddress}/rewards should return [] instead of null


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@faboweb
Copy link
Contributor

faboweb commented Feb 22, 2019

It also crashes for empty validator rewards:

GET distribution/delegators/{delegatorAddress}/rewards/{validatorAddress}

{"message":"ABCIQuery: Response error: RPC error -32603 - Internal error: runtime error: invalid memory address or nil pointer dereference"}

@alexanderbez
Copy link
Contributor

Yeah I remember making a comment about this during the distribution REST/CLI PR. It's fixable, we just need some custom result handling logic -- nothing major.

@jackzampolin
Copy link
Member

@fedekunze Are there any other endpoints that exhibit this behavior? I would imagine yes. Ideally we fix all these in 1 PR. Also should it return a 404 instead of []?

@faboweb
Copy link
Contributor

faboweb commented Feb 26, 2019

I think [] needs less logic client side to handle the response.

@fedekunze fedekunze added this to the v0.35.0 milestone Apr 5, 2019
@alexanderbez alexanderbez self-assigned this Apr 9, 2019
@alexanderbez
Copy link
Contributor

@faboweb what you're describing was fixed in #4047.

alessio pushed a commit that referenced this issue Apr 10, 2019
Return [] instead of null by making the initial
value an empty slice literal opposed to nil.

Closes: #3705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:CLI C:x/distribution distribution module related T:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants