Skip to content

Commit

Permalink
revert misb check fix for ibc 7
Browse files Browse the repository at this point in the history
  • Loading branch information
sainoe committed Nov 9, 2023
1 parent ecd796f commit 6769af5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 64 deletions.
57 changes: 1 addition & 56 deletions tests/integration/misbehaviour.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,33 +352,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() {
},
false,
},
{
"invalid misbehaviour without enough voting power from trusted valset - shouldn't pass",
&ibctmtypes.Misbehaviour{
ClientId: s.path.EndpointA.ClientID,
Header1: s.consumerChain.CreateTMClientHeader(
s.consumerChain.ChainID,
int64(clientHeight.RevisionHeight+1),
clientHeight,
headerTs,
clientTMValset,
clientTMValset,
clientTMValset,
clientSigners,
),
Header2: s.consumerChain.CreateTMClientHeader(
s.consumerChain.ChainID,
int64(clientHeight.RevisionHeight+1),
clientHeight,
headerTs,
altValset2,
altValset2,
clientTMValset,
altSigners2,
),
},
false,
},
// TODO: Add valset signature test case here
{
"valid misbehaviour - should pass",
&ibctmtypes.Misbehaviour{
Expand Down Expand Up @@ -407,35 +381,6 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() {
},
true,
},
{
"valid misbehaviour with already frozen client - should pass",
&ibctmtypes.Misbehaviour{
ClientId: s.path.EndpointA.ClientID,
Header1: s.consumerChain.CreateTMClientHeader(
s.consumerChain.ChainID,
int64(clientHeight.RevisionHeight+1),
clientHeight,
headerTs,
clientTMValset,
clientTMValset,
clientTMValset,
clientSigners,
),
// the resulting Header2 will have a different BlockID
// than Header1 since doesn't share the same valset and signers
Header2: s.consumerChain.CreateTMClientHeader(
s.consumerChain.ChainID,
int64(clientHeight.RevisionHeight+1),
clientHeight,
headerTs,
altValset,
altValset,
clientTMValset,
altSigners,
),
},
true,
},
}

for _, tc := range testCases {
Expand Down
10 changes: 2 additions & 8 deletions x/ccv/provider/keeper/misbehaviour.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,9 @@ func (k Keeper) CheckMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbe
ok := clientState.CheckForMisbehaviour(ctx, k.cdc, clientStore, &misbehaviour)
if !ok {
return errorsmod.Wrapf(ibcclienttypes.ErrInvalidMisbehaviour, "invalid misbehaviour for client-id: %s", misbehaviour.ClientId)
}

// VerifyClientMessage calls verifyMisbehaviour which verifies that the headers in the misbehaviour
// are valid against their respective trusted consensus states and that trustLevel of the validator set signed their commit.
// see checkMisbehaviourHeader in ibc-go/blob/v7.3.0/modules/light-clients/07-tendermint/misbehaviour_handle.go#L126
if err := clientState.VerifyClientMessage(ctx, k.cdc, clientStore, &misbehaviour); err != nil {
return err
}


// TODO check misb valset signatures here
return nil
}

Expand Down

0 comments on commit 6769af5

Please sign in to comment.