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

removed QueryLatestConsensusState #5991

Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### API Breaking

* (core/02-client, light-clients) [\#5806](https://github.com/cosmos/ibc-go/pull/5806) Decouple light client routing from their encoding structure.
* (core/04-channel) [\#5991](https://github.com/cosmos/ibc-go/pull/5991) The client CLI `QueryLatestConsensusState` has been removed.

### State Machine Breaking

Expand Down
39 changes: 0 additions & 39 deletions modules/core/04-channel/client/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import (
"github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
ibcclient "github.com/cosmos/ibc-go/v8/modules/core/client"
ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors"
"github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
)

// QueryChannel returns a channel end.
Expand Down Expand Up @@ -126,42 +123,6 @@ func QueryChannelConsensusState(
return res, nil
}

// QueryLatestConsensusState uses the channel Querier to return the
// latest ConsensusState given the source port ID and source channel ID.
// Deprecated: This function will be removed in a later release of ibc-go.
// NOTE: This function only supports querying latest consensus state of 07-tendermint client state implementations.
func QueryLatestConsensusState(
clientCtx client.Context, portID, channelID string,
) (exported.ConsensusState, clienttypes.Height, clienttypes.Height, error) {
clientRes, err := QueryChannelClientState(clientCtx, portID, channelID, false)
if err != nil {
return nil, clienttypes.Height{}, clienttypes.Height{}, err
}

var clientState exported.ClientState
if err := clientCtx.InterfaceRegistry.UnpackAny(clientRes.IdentifiedClientState.ClientState, &clientState); err != nil {
return nil, clienttypes.Height{}, clienttypes.Height{}, err
}

tmClientState, ok := clientState.(*ibctm.ClientState)
if !ok {
return nil, clienttypes.Height{}, clienttypes.Height{}, errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected type: %T, got: %T",
ibctm.ClientState{}, clientState)
}

res, err := QueryChannelConsensusState(clientCtx, portID, channelID, tmClientState.LatestHeight, false)
if err != nil {
return nil, clienttypes.Height{}, clienttypes.Height{}, err
}

var consensusState exported.ConsensusState
if err := clientCtx.InterfaceRegistry.UnpackAny(res.ConsensusState, &consensusState); err != nil {
return nil, clienttypes.Height{}, clienttypes.Height{}, err
}

return consensusState, tmClientState.LatestHeight, res.ProofHeight, nil
}

// QueryNextSequenceReceive returns the next sequence receive.
// If prove is true, it performs an ABCI store query in order to retrieve the merkle proof. Otherwise,
// it uses the gRPC query client.
Expand Down
Loading