From f3e3a30e5ef0b72f78badd6513c5721a839d17d1 Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Wed, 6 May 2020 13:06:35 -0400 Subject: [PATCH] x/ibc: add missing query height (#6157) --- x/ibc/02-client/client/cli/query.go | 11 ++++++++--- x/ibc/04-channel/client/cli/query.go | 1 + x/ibc/20-transfer/client/cli/query.go | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/x/ibc/02-client/client/cli/query.go b/x/ibc/02-client/client/cli/query.go index e77f82f4a0..3325fc1a42 100644 --- a/x/ibc/02-client/client/cli/query.go +++ b/x/ibc/02-client/client/cli/query.go @@ -36,11 +36,12 @@ $ %s query ibc client states page := viper.GetInt(flags.FlagPage) limit := viper.GetInt(flags.FlagLimit) - clientStates, _, err := utils.QueryAllClientStates(cliCtx, page, limit) + clientStates, height, err := utils.QueryAllClientStates(cliCtx, page, limit) if err != nil { return err } + cliCtx = cliCtx.WithHeight(height) return cliCtx.PrintOutput(clientStates) }, } @@ -77,6 +78,7 @@ $ %s query ibc client state [client-id] return err } + cliCtx = cliCtx.WithHeight(int64(clientStateRes.ProofHeight)) return cliCtx.PrintOutput(clientStateRes) }, } @@ -112,6 +114,7 @@ func GetCmdQueryConsensusState(queryRoute string, cdc *codec.Codec) *cobra.Comma return err } + cliCtx = cliCtx.WithHeight(int64(csRes.ProofHeight)) return cliCtx.PrintOutput(csRes) }, } @@ -129,11 +132,12 @@ func GetCmdQueryHeader(cdc *codec.Codec) *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) - header, _, err := utils.QueryTendermintHeader(cliCtx) + header, height, err := utils.QueryTendermintHeader(cliCtx) if err != nil { return err } + cliCtx = cliCtx.WithHeight(height) return cliCtx.PrintOutput(header) }, } @@ -156,11 +160,12 @@ $ %s query ibc client node-state RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) - state, _, err := utils.QueryNodeConsensusState(cliCtx) + state, height, err := utils.QueryNodeConsensusState(cliCtx) if err != nil { return err } + cliCtx = cliCtx.WithHeight(height) return cliCtx.PrintOutput(state) }, } diff --git a/x/ibc/04-channel/client/cli/query.go b/x/ibc/04-channel/client/cli/query.go index e04e943d33..aecbde5b6f 100644 --- a/x/ibc/04-channel/client/cli/query.go +++ b/x/ibc/04-channel/client/cli/query.go @@ -38,6 +38,7 @@ $ %s query ibc channel end [port-id] [channel-id] return err } + cliCtx = cliCtx.WithHeight(int64(channelRes.ProofHeight)) return cliCtx.PrintOutput(channelRes) }, } diff --git a/x/ibc/20-transfer/client/cli/query.go b/x/ibc/20-transfer/client/cli/query.go index 6c431ea1ee..794c70cd8f 100644 --- a/x/ibc/20-transfer/client/cli/query.go +++ b/x/ibc/20-transfer/client/cli/query.go @@ -38,6 +38,7 @@ $ %s query ibc channel next-recv [port-id] [channel-id] return err } + cliCtx = cliCtx.WithHeight(int64(sequenceRes.ProofHeight)) return cliCtx.PrintOutput(sequenceRes) }, }