Skip to content

Commit

Permalink
chore: move solomachine CheckForMisbehaviour to `misbehaviour_handle.…
Browse files Browse the repository at this point in the history
…go` (#2802)
  • Loading branch information
charleenfei authored Nov 22, 2022
1 parent f9b8d6a commit 3f27d4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 10 additions & 0 deletions modules/light-clients/06-solomachine/misbehaviour_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 0 additions & 9 deletions modules/light-clients/06-solomachine/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3f27d4e

Please sign in to comment.