diff --git a/CHANGELOG.md b/CHANGELOG.md index c34dde4ec31a..36f92a0a2451 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (client) [\#7588](https://github.com/cosmos/cosmos-sdk/issues/7588) Fix gov votes querier to use proper query params. * (types) [\#7038](https://github.com/cosmos/cosmos-sdk/issues/7038) Fix infinite looping of `ApproxRoot` by including a hard-coded maximum iterations limit of 100. * (types) [\#7084](https://github.com/cosmos/cosmos-sdk/pull/7084) Fix panic when calling `BigInt()` on an uninitialized `Int`. * (client) [\#7048](https://github.com/cosmos/cosmos-sdk/issues/7048) Fix client `keys add` failure when generating mnemonic in interactive mode. diff --git a/x/gov/client/rest/query.go b/x/gov/client/rest/query.go index 3eb5800d7a99..59aaa735a03a 100644 --- a/x/gov/client/rest/query.go +++ b/x/gov/client/rest/query.go @@ -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 @@ -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) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + res, _, err = cliCtx.QueryWithData("custom/gov/votes", bz) }