diff --git a/tests/integration/double_vote.go b/tests/integration/double_vote.go index ee0e313fdf..7970c7b654 100644 --- a/tests/integration/double_vote.go +++ b/tests/integration/double_vote.go @@ -4,10 +4,8 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types" "github.com/cosmos/interchain-security/v2/x/ccv/provider/types" "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" ) @@ -53,7 +51,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { testCases := []struct { name string ev *tmtypes.DuplicateVoteEvidence - header *ibctmtypes.Header + chainID string expPass bool }{ { @@ -65,13 +63,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: val.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - &ibctmtypes.Header{ - SignedHeader: &tmproto.SignedHeader{ - Header: &tmproto.Header{ - ChainID: "chainID", - }, - }, - }, + "chainID", false, }, { @@ -84,7 +76,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: val.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - s.consumerChain.LastHeader, + s.consumerChain.ChainID, false, }, { @@ -99,7 +91,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: val.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - s.consumerChain.LastHeader, + s.consumerChain.ChainID, true, }, } @@ -112,7 +104,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { err = s.providerApp.GetProviderKeeper().HandleConsumerDoubleVoting( s.providerCtx(), tc.ev, - tc.header, + tc.chainID, ) if tc.expPass { s.Require().NoError(err) diff --git a/x/ccv/provider/keeper/double_vote.go b/x/ccv/provider/keeper/double_vote.go index bb39af2d77..1ac8408758 100644 --- a/x/ccv/provider/keeper/double_vote.go +++ b/x/ccv/provider/keeper/double_vote.go @@ -7,7 +7,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types" "github.com/cosmos/interchain-security/v2/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v2/x/ccv/types" tmprotocrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" @@ -16,10 +15,7 @@ import ( // HandleConsumerDoubleVoting verifies a double voting evidence for a given a consumer chain and, // if successful, executes the the jailing and the tombstoning of the malicious validator. -// Note that the infraction header argument is temporarily only used to get the consumer chain ID. -func (k Keeper) HandleConsumerDoubleVoting(ctx sdk.Context, evidence *tmtypes.DuplicateVoteEvidence, h *ibctmtypes.Header) error { - chainID := h.Header.ChainID - +func (k Keeper) HandleConsumerDoubleVoting(ctx sdk.Context, evidence *tmtypes.DuplicateVoteEvidence, chainID string) error { // get the validator's consensus address on the provider providerAddr := k.GetProviderAddrFromConsumerAddr( ctx, diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 5863ff8b2c..b6b96bb010 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -156,7 +156,7 @@ func (k msgServer) SubmitConsumerDoubleVoting(goCtx context.Context, msg *types. return nil, err } - if err := k.Keeper.HandleConsumerDoubleVoting(ctx, evidence, msg.InfractionBlockHeader); err != nil { + if err := k.Keeper.HandleConsumerDoubleVoting(ctx, evidence, msg.InfractionBlockHeader.Header.ChainID); err != nil { return &types.MsgSubmitConsumerDoubleVotingResponse{}, err } @@ -164,7 +164,7 @@ func (k msgServer) SubmitConsumerDoubleVoting(goCtx context.Context, msg *types. sdk.NewEvent( ccvtypes.EventTypeSubmitConsumerMisbehaviour, sdk.NewAttribute(ccvtypes.AttributeConsumerDoubleVoting, msg.DuplicateVoteEvidence.String()), - sdk.NewAttribute(ccvtypes.AttributeInfractionBlockHeader, msg.InfractionBlockHeader.String()), + sdk.NewAttribute(ccvtypes.AttributeChainID, msg.InfractionBlockHeader.Header.ChainID), sdk.NewAttribute(ccvtypes.AttributeSubmitterAddress, msg.Submitter), ), }) diff --git a/x/ccv/types/events.go b/x/ccv/types/events.go index e38300dcb9..28796144fe 100644 --- a/x/ccv/types/events.go +++ b/x/ccv/types/events.go @@ -39,7 +39,6 @@ const ( AttributeMisbehaviourHeight1 = "misbehaviour_height_1" AttributeMisbehaviourHeight2 = "misbehaviour_height_2" AttributeConsumerDoubleVoting = "consumer_double_voting" - AttributeInfractionBlockHeader = "infraction_block_header" AttributeDistributionCurrentHeight = "current_distribution_height" AttributeDistributionNextHeight = "next_distribution_height"