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

fix ICS02 queries #5425

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion x/ibc/02-client/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func GetCmdQueryConsensusState(queryRoute string, cdc *codec.Codec) *cobra.Comma

prove := viper.GetBool(flags.FlagProve)

csRes, err := utils.QueryConsensusStateProof(cliCtx, clientID, prove)
csRes, err := utils.QueryConsensusState(cliCtx, clientID, prove)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion x/ibc/02-client/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func queryConsensusStateHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return
}

csRes, err := utils.QueryConsensusStateProof(cliCtx, clientID, prove)
csRes, err := utils.QueryConsensusState(cliCtx, clientID, prove)
if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
Expand Down
10 changes: 5 additions & 5 deletions x/ibc/02-client/client/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func QueryClientState(
}

var clientState types.State
if err := cliCtx.Codec.UnmarshalJSON(res.Value, &clientState); err != nil {
if err := cliCtx.Codec.UnmarshalBinaryLengthPrefixed(res.Value, &clientState); err != nil {
return types.StateResponse{}, err
}

Expand All @@ -64,7 +64,7 @@ func QueryClientState(

// QueryConsensusStateProof queries the store to get the consensus state and a
// merkle proof.
func QueryConsensusStateProof(
func QueryConsensusState(
cliCtx client.CLIContext, clientID string, prove bool) (types.ConsensusStateResponse, error) {
var conStateRes types.ConsensusStateResponse

Expand All @@ -80,7 +80,7 @@ func QueryConsensusStateProof(
}

var cs tendermint.ConsensusState
if err := cliCtx.Codec.UnmarshalJSON(res.Value, &cs); err != nil {
if err := cliCtx.Codec.UnmarshalBinaryLengthPrefixed(res.Value, &cs); err != nil {
return conStateRes, err
}

Expand All @@ -104,7 +104,7 @@ func QueryCommitmentRoot(
}

var root commitment.Root
if err := cliCtx.Codec.UnmarshalJSON(res.Value, &root); err != nil {
if err := cliCtx.Codec.UnmarshalBinaryLengthPrefixed(res.Value, &root); err != nil {
return types.RootResponse{}, err
}

Expand All @@ -129,7 +129,7 @@ func QueryCommitter(
}

var committer tendermint.Committer
if err := cliCtx.Codec.UnmarshalJSON(res.Value, &committer); err != nil {
if err := cliCtx.Codec.UnmarshalBinaryLengthPrefixed(res.Value, &committer); err != nil {
return types.CommitterResponse{}, err
}

Expand Down