-
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
Query proposal lcd endpoint not working #4927
Comments
Thanks @sahith-narahari!
Indeed, it seems this happens because the initial query for a vote returned an empty (pruned?) response and thus the following fails: var vote gov.Vote
if err := cdc.UnmarshalJSON(res, &vote); err != nil {
return err
} because func VoteOptionFromString(str string) (VoteOption, error) {
switch str {
case "Yes":
return OptionYes, nil
case "Abstain":
return OptionAbstain, nil
case "No":
return OptionNo, nil
case "NoWithVeto":
return OptionNoWithVeto, nil
default:
return VoteOption(0xff), fmt.Errorf("'%s' is not a valid vote option", str)
}
} Solution: We should just ignore the error in var vote gov.Vote
_ = cdc.UnmarshalJSON(res, &vote)
if vote.Empty() {
// ...
}
You're querying for a proposal which has passed the voting period (all proposals have at the time of this writing). That being the case, the votes have been pruned from state. This means we query the txs for you behind the scenes. However, tx querying obviously uses pagination and this pagination has defaults (page 1, 30 limit), hence you're not getting the full result. This ties into the larger scope of introducing pagination CLI flags into the CLI. |
Thanks for the explanation @alexanderbez .Can you also check /gov/proposals endpoint which happens to return only few proposals(missing 9 and 11 in response) |
There is nothing custom in the proposals query handler. If you're only seeing a few resources returned, then you're probably querying against a pruning node. Any chance you can try against an archive node? |
Summary of Bug
When I try to query voters of any proposal id,it only returns few of the voters and their response.And also query vote of a particular address returns an error "error": "'' is not a valid vote option"
Version
v0.34.7 - current mainnet version
Steps to Reproduce
You can checkitout on https://cosmos.network/rpc.I also tried on my own server lcd and still got the same outputs
For Admin Use
The text was updated successfully, but these errors were encountered: