Skip to content

Commit

Permalink
fix typo and improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sainoe committed Jun 26, 2023
1 parent 2c796cd commit 7310e42
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 90 deletions.
3 changes: 1 addition & 2 deletions proto/interchain_security/ccv/provider/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/any.proto";
import "ibc/lightclients/tendermint/v1/tendermint.proto";
import "tendermint/types/evidence.proto";

// Msg defines the Msg service.
service Msg {
Expand Down Expand Up @@ -46,10 +45,10 @@ message MsgRegisterConsumerRewardDenom {

// MsgRegisterConsumerRewardDenomResponse defines the Msg/RegisterConsumerRewardDenom response type.
message MsgRegisterConsumerRewardDenomResponse {}
// MsgSubmitConsumerMisbehaviour reports a consumer chain Misbehaviour

// MsgSubmitConsumerMisbehaviour defines a message that reports a misbehaviour
// observed on a consumer chain
// Note that the misbheaviour' headers must contain the same trusted states
message MsgSubmitConsumerMisbehaviour {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/misbehaviour.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ func (s *CCVTestSuite) TestHandleConsumerMisbehaviour() {

for _, v := range altValset.Validators {
consuAddr := sdk.ConsAddress(v.Address.Bytes())
provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, types.ConsumerConsAddress{consuAddr})
provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, types.NewConsumerConsAddress(consuAddr))
val, ok := s.providerApp.GetTestStakingKeeper().GetValidatorByConsAddr(s.providerCtx(), provAddr.Address)
s.Require().True(ok)
s.Require().True(val.Jailed)
s.Require().True(s.providerApp.GetTestSlashingKeeper().IsTombstoned(s.providerCtx(), provAddr.Address))
}
}

func (s *CCVTestSuite) TestConstructLigthClientEvidence() {
func (s *CCVTestSuite) TestConstructLightClientEvidence() {
s.SetupCCVChannel(s.path)
// required to have the consumer client revision height greater than 0
s.SendEmptyVSCPacket()
Expand Down Expand Up @@ -208,7 +208,7 @@ func (s *CCVTestSuite) TestConstructLigthClientEvidence() {

for _, tc := range testCases {
s.Run(tc.name, func() {
ev, err := s.providerApp.GetProviderKeeper().ConstructLigthClientEvidence(
ev, err := s.providerApp.GetProviderKeeper().ConstructLightClientEvidence(
s.providerCtx(),
*tc.misbehaviour,
)
Expand Down
4 changes: 2 additions & 2 deletions testutil/integration/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,6 @@ func TestHandleConsumerMisbehaviour(t *testing.T) {
runCCVTestByName(t, "TestHandleConsumerMisbehaviour")
}

func TestConstructLigthClientEvidence(t *testing.T) {
runCCVTestByName(t, "TestConstructLigthClientEvidence")
func TestConstructLightClientEvidence(t *testing.T) {
runCCVTestByName(t, "TestConstructLightClientEvidence")
}
39 changes: 0 additions & 39 deletions x/ccv/provider/keeper/double_vote.go

This file was deleted.

10 changes: 5 additions & 5 deletions x/ccv/provider/keeper/misbehaviour.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

// HandleConsumerMisbehaviour checks whether the given IBC misbehaviour is valid and, if they are, the misbehaving
// CheckConsumerMisbehaviour check that the given IBC misbehaviour headers forms a valid light client attck evidence.
// CheckConsumerMisbehaviour check that the given IBC misbehaviour headers forms a valid light client attack evidence.
// proceed to the jailing and tombstoning of the bzyantine validators.
func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) error {
logger := ctx.Logger()
Expand All @@ -27,7 +27,7 @@ func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmty
// isn't too old. see ibc-go/modules/light-clients/07-tendermint/types/misbehaviour_handle.go

// construct a ligth client attack evidence
evidence, err := k.ConstructLigthClientEvidence(ctx, misbehaviour)
evidence, err := k.ConstructLightClientEvidence(ctx, misbehaviour)
if err != nil {
return err
}
Expand All @@ -36,7 +36,7 @@ func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmty
for _, v := range evidence.ByzantineValidators {
// convert consumer consensus address
consuAddr := sdk.ConsAddress(v.Address.Bytes())
provAddr := k.GetProviderAddrFromConsumerAddr(ctx, misbehaviour.Header1.Header.ChainID, types.ConsumerConsAddress{consuAddr})
provAddr := k.GetProviderAddrFromConsumerAddr(ctx, misbehaviour.Header1.Header.ChainID, types.NewConsumerConsAddress(consuAddr))
k.stakingKeeper.ValidatorByConsAddr(ctx, consuAddr)
val, ok := k.stakingKeeper.GetValidatorByConsAddr(ctx, provAddr.Address)

Expand Down Expand Up @@ -67,9 +67,9 @@ func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmty
return nil
}

// ConstructLigthClientEvidence constructs and returns a CometBFT Ligth Client Attack(LCA) evidence struct
// ConstructLightClientEvidence constructs and returns a CometBFT Ligth Client Attack(LCA) evidence struct
// from the given misbehaviour
func (k Keeper) ConstructLigthClientEvidence(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) (*tmtypes.LightClientAttackEvidence, error) {
func (k Keeper) ConstructLightClientEvidence(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) (*tmtypes.LightClientAttackEvidence, error) {

// construct the trusted and conflicetd ligth blocks
trusted, err := headerToLightBlock(*misbehaviour.Header1)
Expand Down
5 changes: 5 additions & 0 deletions x/ccv/provider/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
&EquivocationProposal{},
)

registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgSubmitConsumerMisbehaviour{},
)

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

Expand Down
77 changes: 38 additions & 39 deletions x/ccv/provider/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7310e42

Please sign in to comment.