Skip to content

Commit

Permalink
chore: drop func to provide proof
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim committed Dec 6, 2024
1 parent 8f28494 commit 18b217c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
29 changes: 0 additions & 29 deletions modules/core/04-channel/v2/client/cli/abci.go
Original file line number Diff line number Diff line change
@@ -1,46 +1,17 @@
package cli

import (
"context"
"encoding/binary"

errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/client"

clientutils "github.com/cosmos/ibc-go/v9/modules/core/02-client/client/utils"
clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types"
hostv2 "github.com/cosmos/ibc-go/v9/modules/core/24-host/v2"
ibcclient "github.com/cosmos/ibc-go/v9/modules/core/client"
)

func queryChannelClientStateABCI(clientCtx client.Context, channelID string) (*types.QueryChannelClientStateResponse, error) {
queryClient := types.NewQueryClient(clientCtx)
req := &types.QueryChannelClientStateRequest{
ChannelId: channelID,
}

res, err := queryClient.ChannelClientState(context.Background(), req)
if err != nil {
return nil, err
}

clientStateRes, err := clientutils.QueryClientStateABCI(clientCtx, res.IdentifiedClientState.ClientId)
if err != nil {
return nil, err
}

// use client state returned from ABCI query in case query height differs
identifiedClientState := clienttypes.IdentifiedClientState{
ClientId: res.IdentifiedClientState.ClientId,
ClientState: clientStateRes.ClientState,
}
res = types.NewQueryChannelClientStateResponse(identifiedClientState, clientStateRes.Proof, clientStateRes.ProofHeight)

return res, nil
}

func queryNextSequenceSendABCI(clientCtx client.Context, channelID string) (*types.QueryNextSequenceSendResponse, error) {
key := hostv2.NextSequenceSendKey(channelID)
value, proofBz, proofHeight, err := ibcclient.QueryTendermintProof(clientCtx, key)
Expand Down
16 changes: 1 addition & 15 deletions modules/core/04-channel/v2/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,8 @@ func getCmdQueryChannelClientState() *cobra.Command {
}

channelID := args[0]
prove, err := cmd.Flags().GetBool(flags.FlagProve)
if err != nil {
return err
}

if prove {
res, err := queryChannelClientStateABCI(clientCtx, channelID)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
}

queryClient := types.NewQueryClient(clientCtx)

res, err := queryClient.ChannelClientState(cmd.Context(), types.NewQueryChannelClientStateRequest(channelID))
if err != nil {
return err
Expand All @@ -88,7 +75,6 @@ func getCmdQueryChannelClientState() *cobra.Command {
},
}

cmd.Flags().Bool(flags.FlagProve, true, "show proofs for the query results")
flags.AddQueryFlagsToCmd(cmd)

return cmd
Expand Down

0 comments on commit 18b217c

Please sign in to comment.