From 3f27d4e3c59925b185fed9da7efb334a89f494dc Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 22 Nov 2022 14:29:23 +0100 Subject: [PATCH] chore: move solomachine CheckForMisbehaviour to `misbehaviour_handle.go` (#2802) --- .../06-solomachine/misbehaviour_handle.go | 10 ++++++++++ modules/light-clients/06-solomachine/update.go | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/light-clients/06-solomachine/misbehaviour_handle.go b/modules/light-clients/06-solomachine/misbehaviour_handle.go index 26d8d0f5442..e13e23ae46e 100644 --- a/modules/light-clients/06-solomachine/misbehaviour_handle.go +++ b/modules/light-clients/06-solomachine/misbehaviour_handle.go @@ -7,8 +7,18 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types" + "github.com/cosmos/ibc-go/v6/modules/core/exported" ) +// CheckForMisbehaviour returns true for type Misbehaviour (passed VerifyClientMessage check), otherwise returns false +func (cs ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, clientMsg exported.ClientMessage) bool { + if _, ok := clientMsg.(*Misbehaviour); ok { + return true + } + + return false +} + func (cs ClientState) verifyMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, misbehaviour *Misbehaviour) error { // NOTE: a check that the misbehaviour message data are not equal is done by // misbehaviour.ValidateBasic which is called by the 02-client keeper. diff --git a/modules/light-clients/06-solomachine/update.go b/modules/light-clients/06-solomachine/update.go index ae32cc95cae..2ccd4d74add 100644 --- a/modules/light-clients/06-solomachine/update.go +++ b/modules/light-clients/06-solomachine/update.go @@ -106,15 +106,6 @@ func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, client return []exported.Height{clienttypes.NewHeight(0, cs.Sequence)} } -// CheckForMisbehaviour returns true for type Misbehaviour (passed VerifyClientMessage check), otherwise returns false -func (cs ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, clientMsg exported.ClientMessage) bool { - if _, ok := clientMsg.(*Misbehaviour); ok { - return true - } - - return false -} - // UpdateStateOnMisbehaviour updates state upon misbehaviour. This method should only be called on misbehaviour // as it does not perform any misbehaviour checks. func (cs ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, _ exported.ClientMessage) {