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

Add support for query parameters on staking queriers #2202

Closed
4 tasks
fedekunze opened this issue Aug 31, 2018 · 11 comments
Closed
4 tasks

Add support for query parameters on staking queriers #2202

fedekunze opened this issue Aug 31, 2018 · 11 comments

Comments

@fedekunze
Copy link
Collaborator

fedekunze commented Aug 31, 2018

Summary

Add support for query parameters on staking queriers for Gaia-lite GET requests

Problem Definition

No current way to query staking parameters from validators or delegation txs.

Rephrasing @sunnya97 #2139 (comment):

It'd be nice for staking queriers to support query parameters so you can query specifically bonded, jailed, etc

Same applies for the state of delegations, unbonds and redelegations on a specific block height, which is currently supported on CLI

Proposal

Delegation txs:

For the following endpoints:

  • delegator summary (delegators/{delegatorAddr})
  • .../<delegations>/...
  • .../unbonding-delegations/...
  • .../redelegations/...

Queries supported:

  • ?height=<block_height>: status at a specific block height.

Examples:

GET /stake/delegators/{delegatorAddr}?height=<block_height>
GET /stake/delegators/{delegatorAddr}/delegations/{validatorAddr}?height=<block_height>
GET /stake/delegators/{delegatorAddr}/unbonding-delegations/{validatorAddr}?height=<block_height>

Validators query

For the following endpoints:

  • .../validators:

Queries supported:

  • ?jailed=<true/false>
  • ?status=<bonded/unbonding/unbonded>
  • ?height=<block_height>: status at a specific block height. Useful to track voting power progress
  • ?moniker=<name>
  • ?website=<website>

Examples:

GET /stake/delegators/{delegatorAddr}/validators?jailed=true&status=unbonded
GET /stake/validators?height=32213

For Admin Use

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

cwgoes commented Aug 31, 2018

Concept ACK.

Some of these are efficient and others are not - retrieving bonded validators, for example, is easy - but we aren't going to add an index from monikers or websites to validator addresses, so those queries would require O(n) iteration.

@faboweb
Copy link
Contributor

faboweb commented Sep 25, 2018

What is the benefit of querying for jailed or status?
I also don't think splitting the delegation summary provides a huge benefit. An application will probably always want to query all of them.

@cwgoes
Copy link
Contributor

cwgoes commented Dec 14, 2018

@fedekunze Can this be closed?

@fedekunze
Copy link
Collaborator Author

@cwgoes I don't think so. We can label it pre1.0 if you want, not high priority but definitely a nice to have

@cwgoes
Copy link
Contributor

cwgoes commented Jan 21, 2019

cc @alessio

@jackzampolin
Copy link
Member

Is this still something we want @fedekunze?

@fedekunze
Copy link
Collaborator Author

I think so, yes. Would it be possible to set the context to a specific height i.e ctx = ctx.WithBlockHeight(height) and then do the query as usual ? cc @alexanderbez @rigelrozanski

@alexanderbez
Copy link
Contributor

I've already implemented supporting height queries for querier-based queries (wow) here. Does this accomplish your needs?

@fedekunze
Copy link
Collaborator Author

cool ! do we need to add REST query params or it only supports CLI for the moment ?

@alexanderbez
Copy link
Contributor

Only CLI atm because it was super trivial. REST will involve more work. Essentially each REST handler will have to parse for a height query param and update the context. Still trivial and easy to implement, just more places in the code to this.

cc @aayushijain23

@jackzampolin
Copy link
Member

Closing as implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants