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

launchpad: fix query params on governance votes querier #7624

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions x/gov/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,7 @@ func queryVotesOnProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return
}

params := types.NewQueryProposalVotesParams(proposalID, page, limit)

bz, err := cliCtx.Codec.MarshalJSON(params)
bz, err := cliCtx.Codec.MarshalJSON(types.NewQueryProposalParams(proposalID))
if err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
Expand All @@ -379,10 +377,18 @@ func queryVotesOnProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {

// For inactive proposals we must query the txs directly to get the votes
// as they're no longer in state.
params := types.NewQueryProposalVotesParams(proposalID, page, limit)

propStatus := proposal.Status
if !(propStatus == types.StatusVotingPeriod || propStatus == types.StatusDepositPeriod) {
res, err = gcutils.QueryVotesByTxQuery(cliCtx, params)
} else {
bz, err := cliCtx.Codec.MarshalJSON(params)
alessio marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
}

res, _, err = cliCtx.QueryWithData("custom/gov/votes", bz)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this error is not checked

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's checked in line 395 ⬇️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, not necessarily - I think you're right Fede

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good

}

Expand Down