diff --git a/CHANGELOG.md b/CHANGELOG.md index c970fd44340..68e425a272d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,9 +48,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (modules/core/02-client) [\#1196](https://github.com/cosmos/ibc-go/pull/1196) Adding VerifyClientMessage to ClientState interface. * (modules/core/02-client) [\#1198](https://github.com/cosmos/ibc-go/pull/1198) Adding UpdateStateOnMisbehaviour to ClientState interface. * (modules/core/02-client) [\#1170](https://github.com/cosmos/ibc-go/pull/1170) Updating `ClientUpdateProposal` to set client state in lightclient implementations `CheckSubstituteAndUpdateState` methods. +* (modules/core/02-client) [\#1197](https://github.com/cosmos/ibc-go/pull/1197) Adding `CheckForMisbehaviour` to `ClientState` interface. * (modules/core/exported) [\#1206](https://github.com/cosmos/ibc-go/pull/1206) Adding new method `UpdateState` to `ClientState` interface. - ### Features ### Bug Fixes diff --git a/modules/core/02-client/legacy/v100/solomachine.go b/modules/core/02-client/legacy/v100/solomachine.go index 3696c89a458..2ef2cc19eac 100644 --- a/modules/core/02-client/legacy/v100/solomachine.go +++ b/modules/core/02-client/legacy/v100/solomachine.go @@ -88,6 +88,11 @@ func (cs ClientState) ExportMetadata(_ sdk.KVStore) []exported.GenesisMetadata { panic("legacy solo machine is deprecated!") } +// CheckForMisbehaviour panics! +func (cs ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, msg exported.ClientMessage) bool { + panic("legacy solo machine is deprecated!") +} + // UpdateStateOnMisbehaviour panics! func (cs *ClientState) UpdateStateOnMisbehaviour( _ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, diff --git a/modules/core/exported/client.go b/modules/core/exported/client.go index 9490e633984..643c254cbeb 100644 --- a/modules/core/exported/client.go +++ b/modules/core/exported/client.go @@ -49,6 +49,9 @@ type ClientState interface { // Clients must return their status. Only Active clients are allowed to process packets. Status(ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec) Status + // Checks for evidence of a misbehaviour in Header or Misbehaviour type + CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, msg ClientMessage) bool + // Genesis function ExportMetadata(sdk.KVStore) []GenesisMetadata diff --git a/modules/light-clients/07-tendermint/types/update_test.go b/modules/light-clients/07-tendermint/types/update_test.go index bdc38e2486c..788ccdb2bad 100644 --- a/modules/light-clients/07-tendermint/types/update_test.go +++ b/modules/light-clients/07-tendermint/types/update_test.go @@ -741,14 +741,9 @@ func (suite *TendermintTestSuite) TestCheckForMisbehaviour() { tc.malleate() clientState := path.EndpointA.GetClientState() - - // TODO: remove casting when 'UpdateState' is an interface function. - tmClientState, ok := clientState.(*types.ClientState) - suite.Require().True(ok) - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - foundMisbehaviour := tmClientState.CheckForMisbehaviour( + foundMisbehaviour := clientState.CheckForMisbehaviour( suite.chainA.GetContext(), suite.chainA.App.AppCodec(), clientStore, // pass in clientID prefixed clientStore