From afec8bf7e543bc98fe1c7870bb0dd5c68eaff183 Mon Sep 17 00:00:00 2001 From: shakeshack Date: Wed, 9 Feb 2022 19:32:25 -0500 Subject: [PATCH 1/6] chore: remove GetClientID() from Misbehaviour interface --- modules/core/02-client/client/cli/tx.go | 13 +++++++------ modules/core/02-client/keeper/client.go | 18 +++++++++--------- modules/core/02-client/types/msgs.go | 7 ------- modules/core/exported/client.go | 1 - modules/core/keeper/msg_server.go | 2 +- 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index ca65d5b2b17..36a1225fcec 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -129,11 +129,11 @@ func NewUpdateClientCmd() *cobra.Command { // future updates. func NewSubmitMisbehaviourCmd() *cobra.Command { return &cobra.Command{ - Use: "misbehaviour [path/to/misbehaviour.json]", + Use: "misbehaviour [clientID] [path/to/misbehaviour.json]", Short: "submit a client misbehaviour", Long: "submit a client misbehaviour to prevent future updates", - Example: fmt.Sprintf("%s tx ibc %s misbehaviour [path/to/misbehaviour.json] --from node0 --home ../node0/cli --chain-id $CID", version.AppName, types.SubModuleName), - Args: cobra.ExactArgs(1), + Example: fmt.Sprintf("%s tx ibc %s misbehaviour [clientID] [path/to/misbehaviour.json] --from node0 --home ../node0/cli --chain-id $CID", version.AppName, types.SubModuleName), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -141,8 +141,9 @@ func NewSubmitMisbehaviourCmd() *cobra.Command { } cdc := codec.NewProtoCodec(clientCtx.InterfaceRegistry) - var misbehaviour exported.Misbehaviour - misbehaviourContentOrFileName := args[0] + var misbehaviour exported.Header + clientID := args[0] + misbehaviourContentOrFileName := args[1] if err := cdc.UnmarshalInterfaceJSON([]byte(misbehaviourContentOrFileName), &misbehaviour); err != nil { // check for file path if JSON input is not provided @@ -156,7 +157,7 @@ func NewSubmitMisbehaviourCmd() *cobra.Command { } } - msg, err := types.NewMsgSubmitMisbehaviour(misbehaviour.GetClientID(), misbehaviour, clientCtx.GetFromAddress().String()) + msg, err := types.NewMsgSubmitMisbehaviour(clientID, misbehaviour, clientCtx.GetFromAddress().String()) if err != nil { return err } diff --git a/modules/core/02-client/keeper/client.go b/modules/core/02-client/keeper/client.go index d8085ac719f..600519bf5f4 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -188,16 +188,16 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e // CheckMisbehaviourAndUpdateState checks for client misbehaviour and freezes the // client if so. -func (k Keeper) CheckMisbehaviourAndUpdateState(ctx sdk.Context, misbehaviour exported.Misbehaviour) error { - clientState, found := k.GetClientState(ctx, misbehaviour.GetClientID()) +func (k Keeper) CheckMisbehaviourAndUpdateState(ctx sdk.Context, clientID string, misbehaviour exported.Misbehaviour) error { + clientState, found := k.GetClientState(ctx, clientID) if !found { - return sdkerrors.Wrapf(types.ErrClientNotFound, "cannot check misbehaviour for client with ID %s", misbehaviour.GetClientID()) + return sdkerrors.Wrapf(types.ErrClientNotFound, "cannot check misbehaviour for client with ID %s", clientID) } - clientStore := k.ClientStore(ctx, misbehaviour.GetClientID()) + clientStore := k.ClientStore(ctx, clientID) if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active { - return sdkerrors.Wrapf(types.ErrClientNotActive, "cannot process misbehaviour for client (%s) with status %s", misbehaviour.GetClientID(), status) + return sdkerrors.Wrapf(types.ErrClientNotActive, "cannot process misbehaviour for client (%s) with status %s", clientID, status) } if err := misbehaviour.ValidateBasic(); err != nil { @@ -209,8 +209,8 @@ func (k Keeper) CheckMisbehaviourAndUpdateState(ctx sdk.Context, misbehaviour ex return err } - k.SetClientState(ctx, misbehaviour.GetClientID(), clientState) - k.Logger(ctx).Info("client frozen due to misbehaviour", "client-id", misbehaviour.GetClientID()) + k.SetClientState(ctx, clientID, clientState) + k.Logger(ctx).Info("client frozen due to misbehaviour", "client-id", clientID) defer func() { telemetry.IncrCounterWithLabels( @@ -218,12 +218,12 @@ func (k Keeper) CheckMisbehaviourAndUpdateState(ctx sdk.Context, misbehaviour ex 1, []metrics.Label{ telemetry.NewLabel(types.LabelClientType, misbehaviour.ClientType()), - telemetry.NewLabel(types.LabelClientID, misbehaviour.GetClientID()), + telemetry.NewLabel(types.LabelClientID, clientID), }, ) }() - EmitSubmitMisbehaviourEvent(ctx, misbehaviour.GetClientID(), clientState) + EmitSubmitMisbehaviourEvent(ctx, clientID, clientState) return nil } diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index d80fe8b0592..843070b289f 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -255,13 +255,6 @@ func (msg MsgSubmitMisbehaviour) ValidateBasic() error { if err := misbehaviour.ValidateBasic(); err != nil { return err } - if misbehaviour.GetClientID() != msg.ClientId { - return sdkerrors.Wrapf( - ErrInvalidMisbehaviour, - "misbehaviour client-id doesn't match client-id from message (%s ≠ %s)", - misbehaviour.GetClientID(), msg.ClientId, - ) - } return host.ClientIdentifierValidator(msg.ClientId) } diff --git a/modules/core/exported/client.go b/modules/core/exported/client.go index 4dce203bea4..a4839bdbf97 100644 --- a/modules/core/exported/client.go +++ b/modules/core/exported/client.go @@ -199,7 +199,6 @@ type Misbehaviour interface { proto.Message ClientType() string - GetClientID() string ValidateBasic() error } diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index b19041f636d..a36f064e8ae 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -87,7 +87,7 @@ func (k Keeper) SubmitMisbehaviour(goCtx context.Context, msg *clienttypes.MsgSu return nil, err } - if err := k.ClientKeeper.CheckMisbehaviourAndUpdateState(ctx, misbehaviour); err != nil { + if err := k.ClientKeeper.CheckMisbehaviourAndUpdateState(ctx, msg.ClientId, misbehaviour); err != nil { return nil, sdkerrors.Wrap(err, "failed to process misbehaviour for IBC client") } From 75b1e349c9d222d6434eba292a1335f3545010a2 Mon Sep 17 00:00:00 2001 From: shakeshack Date: Wed, 9 Feb 2022 20:01:37 -0500 Subject: [PATCH 2/6] chore: changed too much --- modules/core/02-client/client/cli/tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index 36a1225fcec..65703fb1f4c 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -141,7 +141,7 @@ func NewSubmitMisbehaviourCmd() *cobra.Command { } cdc := codec.NewProtoCodec(clientCtx.InterfaceRegistry) - var misbehaviour exported.Header + var misbehaviour exported.Misbehaviour clientID := args[0] misbehaviourContentOrFileName := args[1] if err := cdc.UnmarshalInterfaceJSON([]byte(misbehaviourContentOrFileName), &misbehaviour); err != nil { From 78520a28db81c6c47da3355b9c53e0662ae45f55 Mon Sep 17 00:00:00 2001 From: shakeshack Date: Thu, 10 Feb 2022 01:45:02 -0500 Subject: [PATCH 3/6] chore: replace misbehaviour with header + rename misbehaviour protos --- docs/ibc/proto-docs.md | 118 +++++----- modules/core/02-client/client/cli/tx.go | 2 +- modules/core/02-client/keeper/client.go | 2 +- .../core/02-client/legacy/v100/solomachine.go | 2 +- .../02-client/legacy/v100/solomachine.pb.go | 220 +++++++++--------- modules/core/02-client/types/codec.go | 34 +-- modules/core/02-client/types/codec_test.go | 51 +--- modules/core/02-client/types/msgs.go | 8 +- modules/core/02-client/types/msgs_test.go | 14 +- modules/core/exported/client.go | 10 +- modules/core/keeper/msg_server.go | 2 +- .../06-solomachine/types/codec.go | 4 +- .../06-solomachine/types/misbehaviour.go | 38 +-- .../types/misbehaviour_handle.go | 12 +- .../types/misbehaviour_handle_test.go | 34 +-- .../06-solomachine/types/misbehaviour_test.go | 32 +-- .../06-solomachine/types/solomachine.pb.go | 220 +++++++++--------- .../07-tendermint/types/codec.go | 4 +- .../07-tendermint/types/misbehaviour.go | 94 ++++---- .../types/misbehaviour_handle.go | 26 +-- .../types/misbehaviour_handle_test.go | 46 ++-- .../07-tendermint/types/misbehaviour_test.go | 66 +++--- .../07-tendermint/types/tendermint.pb.go | 186 +++++++-------- .../09-localhost/types/client_state.go | 2 +- .../solomachine/v1/solomachine.proto | 4 +- .../solomachine/v2/solomachine.proto | 4 +- .../tendermint/v1/tendermint.proto | 6 +- testing/solomachine.go | 6 +- 28 files changed, 591 insertions(+), 656 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 79d56a6a541..0bf22e95231 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -222,12 +222,12 @@ - [ChannelStateData](#ibc.lightclients.solomachine.v1.ChannelStateData) - [ClientState](#ibc.lightclients.solomachine.v1.ClientState) - [ClientStateData](#ibc.lightclients.solomachine.v1.ClientStateData) + - [ConflictingSignaturesHeader](#ibc.lightclients.solomachine.v1.ConflictingSignaturesHeader) - [ConnectionStateData](#ibc.lightclients.solomachine.v1.ConnectionStateData) - [ConsensusState](#ibc.lightclients.solomachine.v1.ConsensusState) - [ConsensusStateData](#ibc.lightclients.solomachine.v1.ConsensusStateData) - [Header](#ibc.lightclients.solomachine.v1.Header) - [HeaderData](#ibc.lightclients.solomachine.v1.HeaderData) - - [Misbehaviour](#ibc.lightclients.solomachine.v1.Misbehaviour) - [NextSequenceRecvData](#ibc.lightclients.solomachine.v1.NextSequenceRecvData) - [PacketAcknowledgementData](#ibc.lightclients.solomachine.v1.PacketAcknowledgementData) - [PacketCommitmentData](#ibc.lightclients.solomachine.v1.PacketCommitmentData) @@ -242,12 +242,12 @@ - [ChannelStateData](#ibc.lightclients.solomachine.v2.ChannelStateData) - [ClientState](#ibc.lightclients.solomachine.v2.ClientState) - [ClientStateData](#ibc.lightclients.solomachine.v2.ClientStateData) + - [ConflictingSignaturesHeader](#ibc.lightclients.solomachine.v2.ConflictingSignaturesHeader) - [ConnectionStateData](#ibc.lightclients.solomachine.v2.ConnectionStateData) - [ConsensusState](#ibc.lightclients.solomachine.v2.ConsensusState) - [ConsensusStateData](#ibc.lightclients.solomachine.v2.ConsensusStateData) - [Header](#ibc.lightclients.solomachine.v2.Header) - [HeaderData](#ibc.lightclients.solomachine.v2.HeaderData) - - [Misbehaviour](#ibc.lightclients.solomachine.v2.Misbehaviour) - [NextSequenceRecvData](#ibc.lightclients.solomachine.v2.NextSequenceRecvData) - [PacketAcknowledgementData](#ibc.lightclients.solomachine.v2.PacketAcknowledgementData) - [PacketCommitmentData](#ibc.lightclients.solomachine.v2.PacketCommitmentData) @@ -261,9 +261,9 @@ - [ibc/lightclients/tendermint/v1/tendermint.proto](#ibc/lightclients/tendermint/v1/tendermint.proto) - [ClientState](#ibc.lightclients.tendermint.v1.ClientState) - [ConsensusState](#ibc.lightclients.tendermint.v1.ConsensusState) + - [DuplicateHeaderHeader](#ibc.lightclients.tendermint.v1.DuplicateHeaderHeader) - [Fraction](#ibc.lightclients.tendermint.v1.Fraction) - [Header](#ibc.lightclients.tendermint.v1.Header) - - [Misbehaviour](#ibc.lightclients.tendermint.v1.Misbehaviour) - [Scalar Value Types](#scalar-value-types) @@ -3309,6 +3309,25 @@ ClientStateData returns the SignBytes data for client state verification. + + +### ConflictingSignaturesHeader +ConflictingSignaturesHeader defines misbehaviour for a solo machine which consists +of a sequence and two signatures over different messages at that sequence. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `client_id` | [string](#string) | | | +| `sequence` | [uint64](#uint64) | | | +| `signature_one` | [SignatureAndData](#ibc.lightclients.solomachine.v1.SignatureAndData) | | | +| `signature_two` | [SignatureAndData](#ibc.lightclients.solomachine.v1.SignatureAndData) | | | + + + + + + ### ConnectionStateData @@ -3397,25 +3416,6 @@ HeaderData returns the SignBytes data for update verification. - - -### Misbehaviour -Misbehaviour defines misbehaviour for a solo machine which consists -of a sequence and two signatures over different messages at that sequence. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `client_id` | [string](#string) | | | -| `sequence` | [uint64](#uint64) | | | -| `signature_one` | [SignatureAndData](#ibc.lightclients.solomachine.v1.SignatureAndData) | | | -| `signature_two` | [SignatureAndData](#ibc.lightclients.solomachine.v1.SignatureAndData) | | | - - - - - - ### NextSequenceRecvData @@ -3627,6 +3627,25 @@ ClientStateData returns the SignBytes data for client state verification. + + +### ConflictingSignaturesHeader +ConflictingSignaturesHeader defines misbehaviour for a solo machine which consists +of a sequence and two signatures over different messages at that sequence. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `client_id` | [string](#string) | | | +| `sequence` | [uint64](#uint64) | | | +| `signature_one` | [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData) | | | +| `signature_two` | [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData) | | | + + + + + + ### ConnectionStateData @@ -3715,25 +3734,6 @@ HeaderData returns the SignBytes data for update verification. - - -### Misbehaviour -Misbehaviour defines misbehaviour for a solo machine which consists -of a sequence and two signatures over different messages at that sequence. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `client_id` | [string](#string) | | | -| `sequence` | [uint64](#uint64) | | | -| `signature_one` | [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData) | | | -| `signature_two` | [SignatureAndData](#ibc.lightclients.solomachine.v2.SignatureAndData) | | | - - - - - - ### NextSequenceRecvData @@ -3936,6 +3936,24 @@ ConsensusState defines the consensus state from Tendermint. + + +### DuplicateHeaderHeader +DuplicateHeaderHeader is a wrapper over two conflicting Headers +that implements Header interface expected by ICS-02 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `client_id` | [string](#string) | | | +| `header_1` | [Header](#ibc.lightclients.tendermint.v1.Header) | | | +| `header_2` | [Header](#ibc.lightclients.tendermint.v1.Header) | | | + + + + + + ### Fraction @@ -3981,24 +3999,6 @@ trusted validator set at the TrustedHeight. - - - -### Misbehaviour -Misbehaviour is a wrapper over two conflicting Headers -that implements Misbehaviour interface expected by ICS-02 - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `client_id` | [string](#string) | | | -| `header_1` | [Header](#ibc.lightclients.tendermint.v1.Header) | | | -| `header_2` | [Header](#ibc.lightclients.tendermint.v1.Header) | | | - - - - - diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index 65703fb1f4c..36a1225fcec 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -141,7 +141,7 @@ func NewSubmitMisbehaviourCmd() *cobra.Command { } cdc := codec.NewProtoCodec(clientCtx.InterfaceRegistry) - var misbehaviour exported.Misbehaviour + var misbehaviour exported.Header clientID := args[0] misbehaviourContentOrFileName := args[1] if err := cdc.UnmarshalInterfaceJSON([]byte(misbehaviourContentOrFileName), &misbehaviour); err != nil { diff --git a/modules/core/02-client/keeper/client.go b/modules/core/02-client/keeper/client.go index 600519bf5f4..756ff5e25ba 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -188,7 +188,7 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e // CheckMisbehaviourAndUpdateState checks for client misbehaviour and freezes the // client if so. -func (k Keeper) CheckMisbehaviourAndUpdateState(ctx sdk.Context, clientID string, misbehaviour exported.Misbehaviour) error { +func (k Keeper) CheckMisbehaviourAndUpdateState(ctx sdk.Context, clientID string, misbehaviour exported.Header) error { clientState, found := k.GetClientState(ctx, clientID) if !found { return sdkerrors.Wrapf(types.ErrClientNotFound, "cannot check misbehaviour for client with ID %s", clientID) diff --git a/modules/core/02-client/legacy/v100/solomachine.go b/modules/core/02-client/legacy/v100/solomachine.go index b9ae2b1005e..45f355f4563 100644 --- a/modules/core/02-client/legacy/v100/solomachine.go +++ b/modules/core/02-client/legacy/v100/solomachine.go @@ -97,7 +97,7 @@ func (cs *ClientState) CheckHeaderAndUpdateState( // CheckMisbehaviourAndUpdateState panics! func (cs ClientState) CheckMisbehaviourAndUpdateState( - _ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, _ exported.Misbehaviour, + _ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, _ exported.Header, ) (exported.ClientState, error) { panic("legacy solo machine is deprecated!") } diff --git a/modules/core/02-client/legacy/v100/solomachine.pb.go b/modules/core/02-client/legacy/v100/solomachine.pb.go index 1c87a4d9d2f..08c3abd6e28 100644 --- a/modules/core/02-client/legacy/v100/solomachine.pb.go +++ b/modules/core/02-client/legacy/v100/solomachine.pb.go @@ -222,27 +222,27 @@ func (m *Header) XXX_DiscardUnknown() { var xxx_messageInfo_Header proto.InternalMessageInfo -// Misbehaviour defines misbehaviour for a solo machine which consists +// ConflictingSignaturesHeader defines misbehaviour for a solo machine which consists // of a sequence and two signatures over different messages at that sequence. -type Misbehaviour struct { +type ConflictingSignaturesHeader struct { ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` SignatureOne *SignatureAndData `protobuf:"bytes,3,opt,name=signature_one,json=signatureOne,proto3" json:"signature_one,omitempty" yaml:"signature_one"` SignatureTwo *SignatureAndData `protobuf:"bytes,4,opt,name=signature_two,json=signatureTwo,proto3" json:"signature_two,omitempty" yaml:"signature_two"` } -func (m *Misbehaviour) Reset() { *m = Misbehaviour{} } -func (m *Misbehaviour) String() string { return proto.CompactTextString(m) } -func (*Misbehaviour) ProtoMessage() {} -func (*Misbehaviour) Descriptor() ([]byte, []int) { +func (m *ConflictingSignaturesHeader) Reset() { *m = ConflictingSignaturesHeader{} } +func (m *ConflictingSignaturesHeader) String() string { return proto.CompactTextString(m) } +func (*ConflictingSignaturesHeader) ProtoMessage() {} +func (*ConflictingSignaturesHeader) Descriptor() ([]byte, []int) { return fileDescriptor_6cc2ee18f7f86d4e, []int{3} } -func (m *Misbehaviour) XXX_Unmarshal(b []byte) error { +func (m *ConflictingSignaturesHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ConflictingSignaturesHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Misbehaviour.Marshal(b, m, deterministic) + return xxx_messageInfo_ConflictingSignaturesHeader.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -252,17 +252,17 @@ func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *Misbehaviour) XXX_Merge(src proto.Message) { - xxx_messageInfo_Misbehaviour.Merge(m, src) +func (m *ConflictingSignaturesHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConflictingSignaturesHeader.Merge(m, src) } -func (m *Misbehaviour) XXX_Size() int { +func (m *ConflictingSignaturesHeader) XXX_Size() int { return m.Size() } -func (m *Misbehaviour) XXX_DiscardUnknown() { - xxx_messageInfo_Misbehaviour.DiscardUnknown(m) +func (m *ConflictingSignaturesHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ConflictingSignaturesHeader.DiscardUnknown(m) } -var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo +var xxx_messageInfo_ConflictingSignaturesHeader proto.InternalMessageInfo // SignatureAndData contains a signature and the data signed over to create that // signature. @@ -803,7 +803,7 @@ func init() { proto.RegisterType((*ClientState)(nil), "ibc.lightclients.solomachine.v1.ClientState") proto.RegisterType((*ConsensusState)(nil), "ibc.lightclients.solomachine.v1.ConsensusState") proto.RegisterType((*Header)(nil), "ibc.lightclients.solomachine.v1.Header") - proto.RegisterType((*Misbehaviour)(nil), "ibc.lightclients.solomachine.v1.Misbehaviour") + proto.RegisterType((*ConflictingSignaturesHeader)(nil), "ibc.lightclients.solomachine.v1.ConflictingSignaturesHeader") proto.RegisterType((*SignatureAndData)(nil), "ibc.lightclients.solomachine.v1.SignatureAndData") proto.RegisterType((*TimestampedSignatureData)(nil), "ibc.lightclients.solomachine.v1.TimestampedSignatureData") proto.RegisterType((*SignBytes)(nil), "ibc.lightclients.solomachine.v1.SignBytes") @@ -823,93 +823,93 @@ func init() { } var fileDescriptor_6cc2ee18f7f86d4e = []byte{ - // 1369 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x5f, 0x6f, 0xdb, 0x54, - 0x14, 0xaf, 0xb3, 0xac, 0x6b, 0x4e, 0xba, 0x36, 0x78, 0xd9, 0x96, 0x7a, 0x53, 0x62, 0x8c, 0x18, - 0x05, 0xb1, 0x78, 0xed, 0xc4, 0x84, 0x26, 0x34, 0x70, 0x1c, 0xc3, 0xb2, 0xb5, 0x6e, 0x70, 0x5c, - 0xd8, 0x26, 0x24, 0xcb, 0x71, 0x6e, 0x53, 0x6b, 0x89, 0x6f, 0x88, 0x9d, 0x74, 0x41, 0x42, 0x42, - 0x3c, 0x8d, 0x88, 0x07, 0xbe, 0x40, 0x24, 0x04, 0xe2, 0xab, 0x00, 0x8f, 0xe3, 0x8d, 0xa7, 0x80, - 0xb6, 0x6f, 0x90, 0x4f, 0x80, 0xec, 0x7b, 0x13, 0xdb, 0xe9, 0x9a, 0x8a, 0x7f, 0x6f, 0xf7, 0x9e, - 0xf3, 0x3b, 0xbf, 0x73, 0xee, 0x39, 0xc7, 0xe7, 0x5e, 0xc3, 0x96, 0x5d, 0xb7, 0xc4, 0x96, 0xdd, - 0x3c, 0xf4, 0xac, 0x96, 0x8d, 0x1c, 0xcf, 0x15, 0x5d, 0xdc, 0xc2, 0x6d, 0xd3, 0x3a, 0xb4, 0x1d, - 0x24, 0xf6, 0xb7, 0xa2, 0xdb, 0x62, 0xa7, 0x8b, 0x3d, 0xcc, 0x16, 0xec, 0xba, 0x55, 0x8c,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0xdd, 0xa8, 0x29, 0x1f, 0xef, 0xfb, 0x2a, 0x9f, 0xe6, 0x93, 0xcc, 0x0a, 0x09, - 0xdc, 0xd7, 0x4c, 0x15, 0xbe, 0x9c, 0xe5, 0x21, 0x13, 0xda, 0xdd, 0x55, 0xa4, 0xb2, 0xa2, 0x65, - 0x52, 0xa4, 0x32, 0x64, 0xc7, 0x25, 0x9f, 0xfe, 0x98, 0x5f, 0x2a, 0x3d, 0xf8, 0xf5, 0x79, 0x9e, - 0x79, 0xf6, 0x3c, 0xcf, 0xfc, 0xf9, 0x3c, 0xcf, 0x7c, 0xf7, 0x22, 0xbf, 0xf4, 0xec, 0x45, 0x7e, - 0xe9, 0xf7, 0x17, 0xf9, 0xa5, 0x47, 0x77, 0x9a, 0xb6, 0x77, 0xd8, 0xab, 0x17, 0x2d, 0xdc, 0x16, - 0x2d, 0xec, 0xb6, 0xb1, 0x2b, 0xda, 0x75, 0xeb, 0x7a, 0x13, 0x8b, 0xfd, 0x9b, 0x62, 0x1b, 0x37, - 0x7a, 0x2d, 0xe4, 0x92, 0x9f, 0x9c, 0x1b, 0xdb, 0xd7, 0xc9, 0x48, 0x14, 0x5b, 0xa8, 0x69, 0x5a, - 0x03, 0xb1, 0xbf, 0x75, 0xe3, 0x46, 0x7d, 0x39, 0x98, 0x63, 0x37, 0xff, 0x0a, 0x00, 0x00, 0xff, - 0xff, 0x48, 0x29, 0x5f, 0x10, 0x8a, 0x0d, 0x00, 0x00, + // 1373 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x5f, 0x8f, 0xdb, 0x44, + 0x10, 0x3f, 0xa7, 0xe9, 0xf5, 0xb2, 0xb9, 0xe6, 0x82, 0x9b, 0xb6, 0x39, 0xb7, 0x4a, 0x8c, 0x11, + 0xe5, 0x40, 0x34, 0xee, 0x5d, 0x45, 0x85, 0x2a, 0x54, 0x70, 0x1c, 0x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x59, 0xa8, 0x2d, 0x5a, 0xc8, 0x6b, 0x23, 0x4f, 0xb4, 0x1b, 0xd6, 0xf5, 0x16, 0x12, 0xfb, + 0x37, 0xc5, 0x36, 0x6a, 0xf6, 0x1c, 0xe8, 0x91, 0x7f, 0x9e, 0x1b, 0x3b, 0xd7, 0x49, 0x4b, 0x14, + 0x1d, 0xd8, 0x32, 0xad, 0xa1, 0xd8, 0xdf, 0xbe, 0x71, 0xa3, 0xb1, 0x1a, 0xf4, 0xb1, 0x9b, 0x7f, + 0x05, 0x00, 0x00, 0xff, 0xff, 0x77, 0x71, 0x26, 0x87, 0x99, 0x0d, 0x00, 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -1073,7 +1073,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { +func (m *ConflictingSignaturesHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1083,12 +1083,12 @@ func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Misbehaviour) MarshalTo(dAtA []byte) (int, error) { +func (m *ConflictingSignaturesHeader) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ConflictingSignaturesHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1695,7 +1695,7 @@ func (m *Header) Size() (n int) { return n } -func (m *Misbehaviour) Size() (n int) { +func (m *ConflictingSignaturesHeader) Size() (n int) { if m == nil { return 0 } @@ -2409,7 +2409,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } return nil } -func (m *Misbehaviour) Unmarshal(dAtA []byte) error { +func (m *ConflictingSignaturesHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2432,10 +2432,10 @@ func (m *Misbehaviour) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Misbehaviour: wiretype end group for non-group") + return fmt.Errorf("proto: ConflictingSignaturesHeader: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Misbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConflictingSignaturesHeader: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index 0497fa15f37..31e160b1261 100644 --- a/modules/core/02-client/types/codec.go +++ b/modules/core/02-client/types/codec.go @@ -32,7 +32,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { ) registry.RegisterInterface( "ibc.core.client.v1.Misbehaviour", - (*exported.Misbehaviour)(nil), + (*exported.Height)(nil), ) registry.RegisterImplementations( (*govtypes.Content)(nil), @@ -155,35 +155,3 @@ func UnpackHeader(any *codectypes.Any) (exported.Header, error) { return header, nil } - -// PackMisbehaviour constructs a new Any packed with the given misbehaviour value. It returns -// an error if the misbehaviour can't be casted to a protobuf message or if the concrete -// implemention is not registered to the protobuf codec. -func PackMisbehaviour(misbehaviour exported.Misbehaviour) (*codectypes.Any, error) { - msg, ok := misbehaviour.(proto.Message) - if !ok { - return nil, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", misbehaviour) - } - - anyMisbhaviour, err := codectypes.NewAnyWithValue(msg) - if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrPackAny, err.Error()) - } - - return anyMisbhaviour, nil -} - -// UnpackMisbehaviour unpacks an Any into a Misbehaviour. It returns an error if the -// Any can't be unpacked into a Misbehaviour. -func UnpackMisbehaviour(any *codectypes.Any) (exported.Misbehaviour, error) { - if any == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnpackAny, "protobuf Any message cannot be nil") - } - - misbehaviour, ok := any.GetCachedValue().(exported.Misbehaviour) - if !ok { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnpackAny, "cannot unpack Any into Misbehaviour %T", any) - } - - return misbehaviour, nil -} diff --git a/modules/core/02-client/types/codec_test.go b/modules/core/02-client/types/codec_test.go index 85b53e5ad84..6fc48d9f79b 100644 --- a/modules/core/02-client/types/codec_test.go +++ b/modules/core/02-client/types/codec_test.go @@ -133,50 +133,13 @@ func (suite *TypesTestSuite) TestPackHeader() { true, }, { - "nil", - nil, - false, - }, - } - - testCasesAny := []caseAny{} - - for _, tc := range testCases { - clientAny, err := types.PackHeader(tc.header) - if tc.expPass { - suite.Require().NoError(err, tc.name) - } else { - suite.Require().Error(err, tc.name) - } - - testCasesAny = append(testCasesAny, caseAny{tc.name, clientAny, tc.expPass}) - } - - for i, tc := range testCasesAny { - cs, err := types.UnpackHeader(tc.any) - if tc.expPass { - suite.Require().NoError(err, tc.name) - suite.Require().Equal(testCases[i].header, cs, tc.name) - } else { - suite.Require().Error(err, tc.name) - } - } -} - -func (suite *TypesTestSuite) TestPackMisbehaviour() { - testCases := []struct { - name string - misbehaviour exported.Misbehaviour - expPass bool - }{ - { - "solo machine misbehaviour", - ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2).CreateMisbehaviour(), + "solo machine conflicting signatures header", + ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2).CreateConflictingSignaturesHeader(), true, }, { - "tendermint misbehaviour", - ibctmtypes.NewMisbehaviour("tendermint", suite.chainA.LastHeader, suite.chainA.LastHeader), + "tendermint duplicate header header", + ibctmtypes.NewDuplicateHeaderHeader("tendermint", suite.chainA.LastHeader, suite.chainA.LastHeader), true, }, { @@ -189,7 +152,7 @@ func (suite *TypesTestSuite) TestPackMisbehaviour() { testCasesAny := []caseAny{} for _, tc := range testCases { - clientAny, err := types.PackMisbehaviour(tc.misbehaviour) + clientAny, err := types.PackHeader(tc.header) if tc.expPass { suite.Require().NoError(err, tc.name) } else { @@ -200,10 +163,10 @@ func (suite *TypesTestSuite) TestPackMisbehaviour() { } for i, tc := range testCasesAny { - cs, err := types.UnpackMisbehaviour(tc.any) + cs, err := types.UnpackHeader(tc.any) if tc.expPass { suite.Require().NoError(err, tc.name) - suite.Require().Equal(testCases[i].misbehaviour, cs, tc.name) + suite.Require().Equal(testCases[i].header, cs, tc.name) } else { suite.Require().Error(err, tc.name) } diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 843070b289f..abb5f35b092 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -229,8 +229,8 @@ func (msg MsgUpgradeClient) UnpackInterfaces(unpacker codectypes.AnyUnpacker) er // NewMsgSubmitMisbehaviour creates a new MsgSubmitMisbehaviour instance. //nolint:interfacer -func NewMsgSubmitMisbehaviour(clientID string, misbehaviour exported.Misbehaviour, signer string) (*MsgSubmitMisbehaviour, error) { - anyMisbehaviour, err := PackMisbehaviour(misbehaviour) +func NewMsgSubmitMisbehaviour(clientID string, misbehaviour exported.Header, signer string) (*MsgSubmitMisbehaviour, error) { + anyMisbehaviour, err := PackHeader(misbehaviour) if err != nil { return nil, err } @@ -248,7 +248,7 @@ func (msg MsgSubmitMisbehaviour) ValidateBasic() error { if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) } - misbehaviour, err := UnpackMisbehaviour(msg.Misbehaviour) + misbehaviour, err := UnpackHeader(msg.Misbehaviour) if err != nil { return err } @@ -270,6 +270,6 @@ func (msg MsgSubmitMisbehaviour) GetSigners() []sdk.AccAddress { // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (msg MsgSubmitMisbehaviour) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - var misbehaviour exported.Misbehaviour + var misbehaviour exported.Header return unpacker.UnpackAny(msg.Misbehaviour, &misbehaviour) } diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index 35dd08aedba..93be49c3ad7 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -482,7 +482,7 @@ func (suite *TypesTestSuite) TestMarshalMsgSubmitMisbehaviour() { { "solo machine client", func() { soloMachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2) - msg, err = types.NewMsgSubmitMisbehaviour(soloMachine.ClientID, soloMachine.CreateMisbehaviour(), suite.chainA.SenderAccount.GetAddress().String()) + msg, err = types.NewMsgSubmitMisbehaviour(soloMachine.ClientID, soloMachine.CreateConflictingSignaturesHeader(), suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) }, }, @@ -493,7 +493,7 @@ func (suite *TypesTestSuite) TestMarshalMsgSubmitMisbehaviour() { header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) - misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", header1, header2) + misbehaviour := ibctmtypes.NewDuplicateHeaderHeader("tendermint", header1, header2) msg, err = types.NewMsgSubmitMisbehaviour("tendermint", misbehaviour, suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) @@ -551,7 +551,7 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() { header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) - misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", header1, header2) + misbehaviour := ibctmtypes.NewDuplicateHeaderHeader("tendermint", header1, header2) msg, err = types.NewMsgSubmitMisbehaviour("tendermint", misbehaviour, suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) }, @@ -560,7 +560,7 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() { { "invalid tendermint misbehaviour", func() { - msg, err = types.NewMsgSubmitMisbehaviour("tendermint", &ibctmtypes.Misbehaviour{}, suite.chainA.SenderAccount.GetAddress().String()) + msg, err = types.NewMsgSubmitMisbehaviour("tendermint", &ibctmtypes.DuplicateHeaderHeader{}, suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) }, false, @@ -583,7 +583,7 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() { "valid - solomachine misbehaviour", func() { soloMachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2) - msg, err = types.NewMsgSubmitMisbehaviour(soloMachine.ClientID, soloMachine.CreateMisbehaviour(), suite.chainA.SenderAccount.GetAddress().String()) + msg, err = types.NewMsgSubmitMisbehaviour(soloMachine.ClientID, soloMachine.CreateConflictingSignaturesHeader(), suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) }, true, @@ -591,7 +591,7 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() { { "invalid solomachine misbehaviour", func() { - msg, err = types.NewMsgSubmitMisbehaviour("solomachine", &solomachinetypes.Misbehaviour{}, suite.chainA.SenderAccount.GetAddress().String()) + msg, err = types.NewMsgSubmitMisbehaviour("solomachine", &solomachinetypes.ConflictingSignaturesHeader{}, suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) }, false, @@ -599,7 +599,7 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() { { "client-id mismatch", func() { - soloMachineMisbehaviour := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2).CreateMisbehaviour() + soloMachineMisbehaviour := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2).CreateConflictingSignaturesHeader() msg, err = types.NewMsgSubmitMisbehaviour("external", soloMachineMisbehaviour, suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) }, diff --git a/modules/core/exported/client.go b/modules/core/exported/client.go index a4839bdbf97..6d221ff346e 100644 --- a/modules/core/exported/client.go +++ b/modules/core/exported/client.go @@ -59,7 +59,7 @@ type ClientState interface { // Update and Misbehaviour functions CheckHeaderAndUpdateState(sdk.Context, codec.BinaryCodec, sdk.KVStore, Header) (ClientState, ConsensusState, error) - CheckMisbehaviourAndUpdateState(sdk.Context, codec.BinaryCodec, sdk.KVStore, Misbehaviour) (ClientState, error) + CheckMisbehaviourAndUpdateState(sdk.Context, codec.BinaryCodec, sdk.KVStore, Header) (ClientState, error) CheckSubstituteAndUpdateState(ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore, substituteClientStore sdk.KVStore, substituteClient ClientState) (ClientState, error) // Upgrade functions @@ -194,14 +194,6 @@ type ConsensusState interface { ValidateBasic() error } -// Misbehaviour defines counterparty misbehaviour for a specific consensus type -type Misbehaviour interface { - proto.Message - - ClientType() string - ValidateBasic() error -} - // Header is the consensus state update information type Header interface { proto.Message diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index a36f064e8ae..9e380f14c3e 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -82,7 +82,7 @@ func (k Keeper) UpgradeClient(goCtx context.Context, msg *clienttypes.MsgUpgrade func (k Keeper) SubmitMisbehaviour(goCtx context.Context, msg *clienttypes.MsgSubmitMisbehaviour) (*clienttypes.MsgSubmitMisbehaviourResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - misbehaviour, err := clienttypes.UnpackMisbehaviour(msg.Misbehaviour) + misbehaviour, err := clienttypes.UnpackHeader(msg.Misbehaviour) if err != nil { return nil, err } diff --git a/modules/light-clients/06-solomachine/types/codec.go b/modules/light-clients/06-solomachine/types/codec.go index 1db36165157..1484f0dd6d8 100644 --- a/modules/light-clients/06-solomachine/types/codec.go +++ b/modules/light-clients/06-solomachine/types/codec.go @@ -26,8 +26,8 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &Header{}, ) registry.RegisterImplementations( - (*exported.Misbehaviour)(nil), - &Misbehaviour{}, + (*exported.Header)(nil), + &ConflictingSignaturesHeader{}, ) } diff --git a/modules/light-clients/06-solomachine/types/misbehaviour.go b/modules/light-clients/06-solomachine/types/misbehaviour.go index f5df3e1bad9..d736dd696d1 100644 --- a/modules/light-clients/06-solomachine/types/misbehaviour.go +++ b/modules/light-clients/06-solomachine/types/misbehaviour.go @@ -10,49 +10,55 @@ import ( "github.com/cosmos/ibc-go/v3/modules/core/exported" ) -var _ exported.Misbehaviour = &Misbehaviour{} +var _ exported.Header = &ConflictingSignaturesHeader{} // ClientType is a Solo Machine light client. -func (misbehaviour Misbehaviour) ClientType() string { +func (h ConflictingSignaturesHeader) ClientType() string { return exported.Solomachine } -// GetClientID returns the ID of the client that committed a misbehaviour. -func (misbehaviour Misbehaviour) GetClientID() string { - return misbehaviour.ClientId +// GetClientID returns the ID of the client that committed a ConflictingSignaturesHeader. +func (h ConflictingSignaturesHeader) GetClientID() string { + return h.ClientId +} + +// GetHeight is added for compatibility between PRs. +// TODO: Remove after GetHeight() is removed from Header interface. +func (h ConflictingSignaturesHeader) GetHeight() exported.Height { + return nil } // Type implements Evidence interface. -func (misbehaviour Misbehaviour) Type() string { +func (h ConflictingSignaturesHeader) Type() string { return exported.TypeClientMisbehaviour } // ValidateBasic implements Evidence interface. -func (misbehaviour Misbehaviour) ValidateBasic() error { - if err := host.ClientIdentifierValidator(misbehaviour.ClientId); err != nil { +func (h ConflictingSignaturesHeader) ValidateBasic() error { + if err := host.ClientIdentifierValidator(h.ClientId); err != nil { return sdkerrors.Wrap(err, "invalid client identifier for solo machine") } - if misbehaviour.Sequence == 0 { + if h.Sequence == 0 { return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "sequence cannot be 0") } - if err := misbehaviour.SignatureOne.ValidateBasic(); err != nil { + if err := h.SignatureOne.ValidateBasic(); err != nil { return sdkerrors.Wrap(err, "signature one failed basic validation") } - if err := misbehaviour.SignatureTwo.ValidateBasic(); err != nil { + if err := h.SignatureTwo.ValidateBasic(); err != nil { return sdkerrors.Wrap(err, "signature two failed basic validation") } - // misbehaviour signatures cannot be identical - if bytes.Equal(misbehaviour.SignatureOne.Signature, misbehaviour.SignatureTwo.Signature) { - return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "misbehaviour signatures cannot be equal") + // ConflictingSignaturesHeader signatures cannot be identical + if bytes.Equal(h.SignatureOne.Signature, h.SignatureTwo.Signature) { + return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "ConflictingSignaturesHeader signatures cannot be equal") } // message data signed cannot be identical - if bytes.Equal(misbehaviour.SignatureOne.Data, misbehaviour.SignatureTwo.Data) { - return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "misbehaviour signature data must be signed over different messages") + if bytes.Equal(h.SignatureOne.Data, h.SignatureTwo.Data) { + return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "ConflictingSignaturesHeader signature data must be signed over different messages") } return nil diff --git a/modules/light-clients/06-solomachine/types/misbehaviour_handle.go b/modules/light-clients/06-solomachine/types/misbehaviour_handle.go index d5a1d57cb57..dd75effa803 100644 --- a/modules/light-clients/06-solomachine/types/misbehaviour_handle.go +++ b/modules/light-clients/06-solomachine/types/misbehaviour_handle.go @@ -19,14 +19,14 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, - misbehaviour exported.Misbehaviour, + header exported.Header, ) (exported.ClientState, error) { - soloMisbehaviour, ok := misbehaviour.(*Misbehaviour) + misbehaviour, ok := header.(*ConflictingSignaturesHeader) if !ok { return nil, sdkerrors.Wrapf( clienttypes.ErrInvalidClientType, - "misbehaviour type %T, expected %T", misbehaviour, &Misbehaviour{}, + "misbehaviour type %T, expected %T", header, &ConflictingSignaturesHeader{}, ) } @@ -34,12 +34,12 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( // misbehaviour.ValidateBasic which is called by the 02-client keeper. // verify first signature - if err := verifySignatureAndData(cdc, cs, soloMisbehaviour, soloMisbehaviour.SignatureOne); err != nil { + if err := verifySignatureAndData(cdc, cs, misbehaviour, misbehaviour.SignatureOne); err != nil { return nil, sdkerrors.Wrap(err, "failed to verify signature one") } // verify second signature - if err := verifySignatureAndData(cdc, cs, soloMisbehaviour, soloMisbehaviour.SignatureTwo); err != nil { + if err := verifySignatureAndData(cdc, cs, misbehaviour, misbehaviour.SignatureTwo); err != nil { return nil, sdkerrors.Wrap(err, "failed to verify signature two") } @@ -50,7 +50,7 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( // verifySignatureAndData verifies that the currently registered public key has signed // over the provided data and that the data is valid. The data is valid if it can be // unmarshaled into the specified data type. -func verifySignatureAndData(cdc codec.BinaryCodec, clientState ClientState, misbehaviour *Misbehaviour, sigAndData *SignatureAndData) error { +func verifySignatureAndData(cdc codec.BinaryCodec, clientState ClientState, misbehaviour *ConflictingSignaturesHeader, sigAndData *SignatureAndData) error { // do not check misbehaviour timestamp since we want to allow processing of past misbehaviour diff --git a/modules/light-clients/06-solomachine/types/misbehaviour_handle_test.go b/modules/light-clients/06-solomachine/types/misbehaviour_handle_test.go index db58b710772..2913506fd1f 100644 --- a/modules/light-clients/06-solomachine/types/misbehaviour_handle_test.go +++ b/modules/light-clients/06-solomachine/types/misbehaviour_handle_test.go @@ -10,7 +10,7 @@ import ( func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { var ( clientState exported.ClientState - misbehaviour exported.Misbehaviour + misbehaviour exported.Header ) // test singlesig and multisig public keys @@ -25,7 +25,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { "valid misbehaviour", func() { clientState = solomachine.ClientState() - misbehaviour = solomachine.CreateMisbehaviour() + misbehaviour = solomachine.CreateConflictingSignaturesHeader() }, true, }, @@ -34,14 +34,14 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { func() { clientState = solomachine.ClientState() solomachine.Time = solomachine.Time - 5 - misbehaviour = solomachine.CreateMisbehaviour() + misbehaviour = solomachine.CreateConflictingSignaturesHeader() }, true, }, { "wrong client state type", func() { clientState = &ibctmtypes.ClientState{} - misbehaviour = solomachine.CreateMisbehaviour() + misbehaviour = solomachine.CreateConflictingSignaturesHeader() }, false, }, @@ -49,7 +49,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { "invalid misbehaviour type", func() { clientState = solomachine.ClientState() - misbehaviour = &ibctmtypes.Misbehaviour{} + misbehaviour = &ibctmtypes.DuplicateHeaderHeader{} }, false, }, @@ -57,7 +57,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { "invalid SignatureOne SignatureData", func() { clientState = solomachine.ClientState() - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() m.SignatureOne.Signature = suite.GetInvalidProof() misbehaviour = m @@ -67,7 +67,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { "invalid SignatureTwo SignatureData", func() { clientState = solomachine.ClientState() - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() m.SignatureTwo.Signature = suite.GetInvalidProof() misbehaviour = m @@ -77,7 +77,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { "invalid SignatureOne timestamp", func() { clientState = solomachine.ClientState() - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() m.SignatureOne.Timestamp = 1000000000000 misbehaviour = m @@ -87,7 +87,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { "invalid SignatureTwo timestamp", func() { clientState = solomachine.ClientState() - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() m.SignatureTwo.Timestamp = 1000000000000 misbehaviour = m @@ -99,7 +99,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { clientState = solomachine.ClientState() // store in temp before assigning to interface type - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() msg := []byte("DATA ONE") signBytes := &types.SignBytes{ @@ -127,7 +127,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { clientState = solomachine.ClientState() // store in temp before assigning to interface type - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() msg := []byte("DATA TWO") signBytes := &types.SignBytes{ @@ -153,11 +153,11 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { "wrong pubkey generates first signature", func() { clientState = solomachine.ClientState() - badMisbehaviour := solomachine.CreateMisbehaviour() + badMisbehaviour := solomachine.CreateConflictingSignaturesHeader() // update public key to a new one solomachine.CreateHeader() - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() // set SignatureOne to use the wrong signature m.SignatureOne = badMisbehaviour.SignatureOne @@ -168,11 +168,11 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { "wrong pubkey generates second signature", func() { clientState = solomachine.ClientState() - badMisbehaviour := solomachine.CreateMisbehaviour() + badMisbehaviour := solomachine.CreateConflictingSignaturesHeader() // update public key to a new one solomachine.CreateHeader() - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() // set SignatureTwo to use the wrong signature m.SignatureTwo = badMisbehaviour.SignatureTwo @@ -186,7 +186,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { clientState = solomachine.ClientState() // store in temp before assigning to interface type - m := solomachine.CreateMisbehaviour() + m := solomachine.CreateConflictingSignaturesHeader() // Signature One msg := []byte("DATA ONE") @@ -237,7 +237,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { cs := solomachine.ClientState() cs.ConsensusState.PublicKey = nil clientState = cs - misbehaviour = solomachine.CreateMisbehaviour() + misbehaviour = solomachine.CreateConflictingSignaturesHeader() }, false, }, diff --git a/modules/light-clients/06-solomachine/types/misbehaviour_test.go b/modules/light-clients/06-solomachine/types/misbehaviour_test.go index 813a8520ee7..1610026dbc0 100644 --- a/modules/light-clients/06-solomachine/types/misbehaviour_test.go +++ b/modules/light-clients/06-solomachine/types/misbehaviour_test.go @@ -7,7 +7,7 @@ import ( ) func (suite *SoloMachineTestSuite) TestMisbehaviour() { - misbehaviour := suite.solomachine.CreateMisbehaviour() + misbehaviour := suite.solomachine.CreateConflictingSignaturesHeader() suite.Require().Equal(exported.Solomachine, misbehaviour.ClientType()) suite.Require().Equal(suite.solomachine.ClientID, misbehaviour.GetClientID()) @@ -19,91 +19,91 @@ func (suite *SoloMachineTestSuite) TestMisbehaviourValidateBasic() { testCases := []struct { name string - malleateMisbehaviour func(misbehaviour *types.Misbehaviour) + malleateMisbehaviour func(misbehaviour *types.ConflictingSignaturesHeader) expPass bool }{ { "valid misbehaviour", - func(*types.Misbehaviour) {}, + func(*types.ConflictingSignaturesHeader) {}, true, }, { "invalid client ID", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.ClientId = "(badclientid)" }, false, }, { "sequence is zero", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.Sequence = 0 }, false, }, { "signature one sig is empty", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureOne.Signature = []byte{} }, false, }, { "signature two sig is empty", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureTwo.Signature = []byte{} }, false, }, { "signature one data is empty", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureOne.Data = nil }, false, }, { "signature two data is empty", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureTwo.Data = []byte{} }, false, }, { "signatures are identical", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureTwo.Signature = misbehaviour.SignatureOne.Signature }, false, }, { "data signed is identical", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureTwo.Data = misbehaviour.SignatureOne.Data }, false, }, { "data type for SignatureOne is unspecified", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureOne.DataType = types.UNSPECIFIED }, false, }, { "data type for SignatureTwo is unspecified", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureTwo.DataType = types.UNSPECIFIED }, false, }, { "timestamp for SignatureOne is zero", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureOne.Timestamp = 0 }, false, }, { "timestamp for SignatureTwo is zero", - func(misbehaviour *types.Misbehaviour) { + func(misbehaviour *types.ConflictingSignaturesHeader) { misbehaviour.SignatureTwo.Timestamp = 0 }, false, }, @@ -114,7 +114,7 @@ func (suite *SoloMachineTestSuite) TestMisbehaviourValidateBasic() { suite.Run(tc.name, func() { - misbehaviour := solomachine.CreateMisbehaviour() + misbehaviour := solomachine.CreateConflictingSignaturesHeader() tc.malleateMisbehaviour(misbehaviour) err := misbehaviour.ValidateBasic() diff --git a/modules/light-clients/06-solomachine/types/solomachine.pb.go b/modules/light-clients/06-solomachine/types/solomachine.pb.go index 441a7030402..5577293ad5f 100644 --- a/modules/light-clients/06-solomachine/types/solomachine.pb.go +++ b/modules/light-clients/06-solomachine/types/solomachine.pb.go @@ -222,27 +222,27 @@ func (m *Header) XXX_DiscardUnknown() { var xxx_messageInfo_Header proto.InternalMessageInfo -// Misbehaviour defines misbehaviour for a solo machine which consists +// ConflictingSignaturesHeader defines misbehaviour for a solo machine which consists // of a sequence and two signatures over different messages at that sequence. -type Misbehaviour struct { +type ConflictingSignaturesHeader struct { ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` SignatureOne *SignatureAndData `protobuf:"bytes,3,opt,name=signature_one,json=signatureOne,proto3" json:"signature_one,omitempty" yaml:"signature_one"` SignatureTwo *SignatureAndData `protobuf:"bytes,4,opt,name=signature_two,json=signatureTwo,proto3" json:"signature_two,omitempty" yaml:"signature_two"` } -func (m *Misbehaviour) Reset() { *m = Misbehaviour{} } -func (m *Misbehaviour) String() string { return proto.CompactTextString(m) } -func (*Misbehaviour) ProtoMessage() {} -func (*Misbehaviour) Descriptor() ([]byte, []int) { +func (m *ConflictingSignaturesHeader) Reset() { *m = ConflictingSignaturesHeader{} } +func (m *ConflictingSignaturesHeader) String() string { return proto.CompactTextString(m) } +func (*ConflictingSignaturesHeader) ProtoMessage() {} +func (*ConflictingSignaturesHeader) Descriptor() ([]byte, []int) { return fileDescriptor_141333b361aae010, []int{3} } -func (m *Misbehaviour) XXX_Unmarshal(b []byte) error { +func (m *ConflictingSignaturesHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ConflictingSignaturesHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Misbehaviour.Marshal(b, m, deterministic) + return xxx_messageInfo_ConflictingSignaturesHeader.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -252,17 +252,17 @@ func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *Misbehaviour) XXX_Merge(src proto.Message) { - xxx_messageInfo_Misbehaviour.Merge(m, src) +func (m *ConflictingSignaturesHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConflictingSignaturesHeader.Merge(m, src) } -func (m *Misbehaviour) XXX_Size() int { +func (m *ConflictingSignaturesHeader) XXX_Size() int { return m.Size() } -func (m *Misbehaviour) XXX_DiscardUnknown() { - xxx_messageInfo_Misbehaviour.DiscardUnknown(m) +func (m *ConflictingSignaturesHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ConflictingSignaturesHeader.DiscardUnknown(m) } -var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo +var xxx_messageInfo_ConflictingSignaturesHeader proto.InternalMessageInfo // SignatureAndData contains a signature and the data signed over to create that // signature. @@ -803,7 +803,7 @@ func init() { proto.RegisterType((*ClientState)(nil), "ibc.lightclients.solomachine.v2.ClientState") proto.RegisterType((*ConsensusState)(nil), "ibc.lightclients.solomachine.v2.ConsensusState") proto.RegisterType((*Header)(nil), "ibc.lightclients.solomachine.v2.Header") - proto.RegisterType((*Misbehaviour)(nil), "ibc.lightclients.solomachine.v2.Misbehaviour") + proto.RegisterType((*ConflictingSignaturesHeader)(nil), "ibc.lightclients.solomachine.v2.ConflictingSignaturesHeader") proto.RegisterType((*SignatureAndData)(nil), "ibc.lightclients.solomachine.v2.SignatureAndData") proto.RegisterType((*TimestampedSignatureData)(nil), "ibc.lightclients.solomachine.v2.TimestampedSignatureData") proto.RegisterType((*SignBytes)(nil), "ibc.lightclients.solomachine.v2.SignBytes") @@ -823,93 +823,93 @@ func init() { } var fileDescriptor_141333b361aae010 = []byte{ - // 1370 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x5f, 0x8f, 0xdb, 0x44, - 0x10, 0x3f, 0xa7, 0xe9, 0xf5, 0x32, 0xb9, 0xde, 0x05, 0x37, 0x6d, 0x73, 0x6e, 0x95, 0x18, 0x23, - 0xca, 0x81, 0x68, 0xc2, 0x5d, 0x45, 0x85, 0x2a, 0x04, 0x38, 0x8e, 0x4b, 0xd3, 0xde, 0xf9, 0x82, - 0xe3, 0x03, 0x5a, 0x21, 0x19, 0xc7, 0xd9, 0x4b, 0xac, 0x26, 0xde, 0x34, 0x76, 0x92, 0x06, 0x09, - 0x09, 0xf1, 0x54, 0x22, 0x1e, 0xf8, 0x02, 0x91, 0x10, 0x88, 0xcf, 0xc1, 0x1b, 0xf0, 0xd8, 0x47, - 0x9e, 0x02, 0x6a, 0xbf, 0x41, 0x3e, 0x01, 0xb2, 0x77, 0x13, 0xdb, 0xb9, 0x5e, 0x4e, 0xfc, 0x7b, - 0xdb, 0x9d, 0xdf, 0xcc, 0x6f, 0x66, 0x67, 0xc6, 0xb3, 0x6b, 0xd8, 0xb1, 0x6a, 0x66, 0xa1, 0x65, - 0x35, 0x9a, 0xae, 0xd9, 0xb2, 0x90, 0xed, 0x3a, 0x05, 0x07, 0xb7, 0x70, 0xdb, 0x30, 0x9b, 0x96, - 0x8d, 0x0a, 0xfd, 0xdd, 0xf0, 0x36, 0xdf, 0xe9, 0x62, 0x17, 0xb3, 0x39, 0xab, 0x66, 0xe6, 0xc3, - 0x26, 0xf9, 0xb0, 0x4e, 0x7f, 0x97, 0x7b, 0xcd, 0xe3, 0x34, 0x71, 0x17, 0x15, 0x4c, 0x6c, 0xdb, - 0xc8, 0x74, 0x2d, 0x6c, 0x17, 0xfa, 0x3b, 0xa1, 0x1d, 0x61, 0xe2, 0x5e, 0x0e, 0x14, 0x9b, 0x86, - 0x6d, 0xa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0xf4, 0x0e, 0x94, 0xaa, 0xac, 0x54, 0x0f, 0xab, 0x54, 0x35, 0xc6, 0x9d, 0x1f, 0x8d, 0xf9, - 0xc4, 0x5c, 0xcc, 0xe6, 0x81, 0x8b, 0x68, 0x2b, 0xb2, 0xa4, 0x95, 0x0f, 0x14, 0xaa, 0x7e, 0x86, - 0xdb, 0x18, 0x8d, 0x79, 0x08, 0xe4, 0xec, 0x36, 0x5c, 0x0e, 0xe9, 0xdf, 0x11, 0x15, 0x45, 0xde, - 0xa3, 0xca, 0x71, 0x2e, 0x39, 0x1a, 0xf3, 0xe7, 0xa8, 0x90, 0x7d, 0x1b, 0xae, 0x04, 0x9a, 0x15, - 0x51, 0xba, 0x27, 0x6b, 0xba, 0x74, 0xb0, 0xbf, 0x5f, 0xd6, 0xf6, 0x65, 0x45, 0x4b, 0x9d, 0xe5, - 0xd2, 0xa3, 0x31, 0x9f, 0x22, 0x40, 0x20, 0x67, 0xdf, 0x07, 0xfe, 0x98, 0x99, 0x28, 0xdd, 0x53, - 0x0e, 0x3e, 0xd9, 0x93, 0x4b, 0x1f, 0xca, 0xbe, 0xed, 0x2a, 0xb7, 0x35, 0x1a, 0xf3, 0x17, 0x09, - 0xba, 0x00, 0xb2, 0xef, 0xbd, 0x80, 0x40, 0x95, 0x25, 0xb9, 0x5c, 0xd1, 0x74, 0xb1, 0x58, 0x95, - 0x15, 0x49, 0x4e, 0x9d, 0xe3, 0x32, 0xa3, 0x31, 0x9f, 0x26, 0x28, 0x05, 0x29, 0xc6, 0xde, 0x84, - 0xab, 0x81, 0xbd, 0x22, 0x7f, 0xaa, 0xe9, 0x55, 0xf9, 0xa3, 0x43, 0x0f, 0xf2, 0x68, 0x3e, 0x4e, - 0xad, 0x91, 0xc0, 0x3d, 0x64, 0x06, 0x78, 0x72, 0x96, 0x87, 0x54, 0x60, 0x77, 0x47, 0x16, 0x4b, - 0xb2, 0x9a, 0x4a, 0x90, 0xca, 0x90, 0x1d, 0x17, 0x7f, 0xf2, 0x63, 0x76, 0xa5, 0xf8, 0xf9, 0x6f, - 0xcf, 0xb2, 0xcc, 0xd3, 0x67, 0x59, 0xe6, 0xcf, 0x67, 0x59, 0xe6, 0xbb, 0xe7, 0xd9, 0x95, 0xa7, - 0xcf, 0xb3, 0x2b, 0xbf, 0x3f, 0xcf, 0xae, 0x3c, 0xb8, 0xdd, 0xb0, 0xdc, 0x66, 0xaf, 0x96, 0x37, - 0x71, 0xbb, 0x60, 0x62, 0xa7, 0x8d, 0x9d, 0x82, 0x55, 0x33, 0xaf, 0x37, 0x70, 0xa1, 0x7f, 0xa3, - 0xd0, 0xc6, 0xf5, 0x5e, 0x0b, 0x39, 0xe4, 0x7f, 0xea, 0xfa, 0xec, 0x87, 0xea, 0xad, 0x9b, 0xd7, - 0xc3, 0xff, 0x54, 0xde, 0x35, 0xe3, 0xd4, 0x56, 0xfd, 0x79, 0x76, 0xe3, 0xaf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x5d, 0xd4, 0x6c, 0xfb, 0x80, 0x0d, 0x00, 0x00, + // 1374 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x5f, 0x6f, 0xdb, 0x54, + 0x14, 0xaf, 0xb3, 0xac, 0x4b, 0x4e, 0xba, 0x36, 0x78, 0xd9, 0x96, 0x7a, 0x53, 0x62, 0x8c, 0x18, + 0x05, 0xb1, 0x84, 0x76, 0x62, 0x42, 0x13, 0x02, 0x1c, 0xc7, 0x63, 0xd9, 0x3a, 0x37, 0x38, 0x2e, + 0xb0, 0x09, 0xc9, 0x38, 0xce, 0x6d, 0x6a, 0x2d, 0xf1, 0xcd, 0x62, 0x27, 0x59, 0x90, 0x90, 0x10, + 0x4f, 0x23, 0xe2, 0x81, 0x2f, 0x10, 0x09, 0x81, 0xf8, 0x1c, 0xbc, 0x21, 0x1e, 0xf7, 0x84, 0x78, + 0x0a, 0x68, 0xf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 0x53, 0x5f, 0xf5, 0xe7, 0xd9, 0x8d, + 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x51, 0xf9, 0xc2, 0x3c, 0x8f, 0x0d, 0x00, 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -1078,7 +1078,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { +func (m *ConflictingSignaturesHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1088,12 +1088,12 @@ func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Misbehaviour) MarshalTo(dAtA []byte) (int, error) { +func (m *ConflictingSignaturesHeader) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ConflictingSignaturesHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1700,7 +1700,7 @@ func (m *Header) Size() (n int) { return n } -func (m *Misbehaviour) Size() (n int) { +func (m *ConflictingSignaturesHeader) Size() (n int) { if m == nil { return 0 } @@ -2415,7 +2415,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } return nil } -func (m *Misbehaviour) Unmarshal(dAtA []byte) error { +func (m *ConflictingSignaturesHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2438,10 +2438,10 @@ func (m *Misbehaviour) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Misbehaviour: wiretype end group for non-group") + return fmt.Errorf("proto: ConflictingSignaturesHeader: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Misbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConflictingSignaturesHeader: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/modules/light-clients/07-tendermint/types/codec.go b/modules/light-clients/07-tendermint/types/codec.go index c363a0cbe65..737ad3dc447 100644 --- a/modules/light-clients/07-tendermint/types/codec.go +++ b/modules/light-clients/07-tendermint/types/codec.go @@ -22,7 +22,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &Header{}, ) registry.RegisterImplementations( - (*exported.Misbehaviour)(nil), - &Misbehaviour{}, + (*exported.Header)(nil), + &DuplicateHeaderHeader{}, ) } diff --git a/modules/light-clients/07-tendermint/types/misbehaviour.go b/modules/light-clients/07-tendermint/types/misbehaviour.go index 28ea7aa3666..c896e385ff3 100644 --- a/modules/light-clients/07-tendermint/types/misbehaviour.go +++ b/modules/light-clients/07-tendermint/types/misbehaviour.go @@ -12,108 +12,114 @@ import ( "github.com/cosmos/ibc-go/v3/modules/core/exported" ) -var _ exported.Misbehaviour = &Misbehaviour{} +var _ exported.Header = &DuplicateHeaderHeader{} -// Use the same FrozenHeight for all misbehaviour +// FrozenHeight is the same for all DuplicateHeaderHeader. var FrozenHeight = clienttypes.NewHeight(0, 1) -// NewMisbehaviour creates a new Misbehaviour instance. -func NewMisbehaviour(clientID string, header1, header2 *Header) *Misbehaviour { - return &Misbehaviour{ +// NewDuplicateHeaderHeader creates a new DuplicateHeaderHeader instance. +func NewDuplicateHeaderHeader(clientID string, header1, header2 *Header) *DuplicateHeaderHeader { + return &DuplicateHeaderHeader{ ClientId: clientID, Header1: header1, Header2: header2, } } -// ClientType is Tendermint light client -func (misbehaviour Misbehaviour) ClientType() string { +// ClientType is Tendermint light client. +func (h DuplicateHeaderHeader) ClientType() string { return exported.Tendermint } -// GetClientID returns the ID of the client that committed a misbehaviour. -func (misbehaviour Misbehaviour) GetClientID() string { - return misbehaviour.ClientId +// GetClientID returns the ID of the client that committed a DuplicateHeaderHeader. +func (h DuplicateHeaderHeader) GetClientID() string { + return h.ClientId } -// GetTime returns the timestamp at which misbehaviour occurred. It uses the +// GetHeight is added for compatibility between PRs. +// TODO: Remove after GetHeight() is removed from Header interface. +func (h DuplicateHeaderHeader) GetHeight() exported.Height { + return nil +} + +// GetTime returns the timestamp at which DuplicateHeaderHeader occurred. It uses the // maximum value from both headers to prevent producing an invalid header outside -// of the misbehaviour age range. -func (misbehaviour Misbehaviour) GetTime() time.Time { - t1, t2 := misbehaviour.Header1.GetTime(), misbehaviour.Header2.GetTime() +// of the DuplicateHeaderHeader age range. +func (h DuplicateHeaderHeader) GetTime() time.Time { + t1, t2 := h.Header1.GetTime(), h.Header2.GetTime() if t1.After(t2) { return t1 } return t2 } -// ValidateBasic implements Misbehaviour interface -func (misbehaviour Misbehaviour) ValidateBasic() error { - if misbehaviour.Header1 == nil { - return sdkerrors.Wrap(ErrInvalidHeader, "misbehaviour Header1 cannot be nil") +// ValidateBasic implements DuplicateHeaderHeader interface. +func (h DuplicateHeaderHeader) ValidateBasic() error { + if h.Header1 == nil { + return sdkerrors.Wrap(ErrInvalidHeader, "DuplicateHeaderHeader Header1 cannot be nil") } - if misbehaviour.Header2 == nil { - return sdkerrors.Wrap(ErrInvalidHeader, "misbehaviour Header2 cannot be nil") + if h.Header2 == nil { + return sdkerrors.Wrap(ErrInvalidHeader, "DuplicateHeaderHeader Header2 cannot be nil") } - if misbehaviour.Header1.TrustedHeight.RevisionHeight == 0 { - return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "misbehaviour Header1 cannot have zero revision height") + if h.Header1.TrustedHeight.RevisionHeight == 0 { + return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "DuplicateHeaderHeader Header1 cannot have zero revision height") } - if misbehaviour.Header2.TrustedHeight.RevisionHeight == 0 { - return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "misbehaviour Header2 cannot have zero revision height") + if h.Header2.TrustedHeight.RevisionHeight == 0 { + return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "DuplicateHeaderHeader Header2 cannot have zero revision height") } - if misbehaviour.Header1.TrustedValidators == nil { + if h.Header1.TrustedValidators == nil { return sdkerrors.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header1 cannot be empty") } - if misbehaviour.Header2.TrustedValidators == nil { + if h.Header2.TrustedValidators == nil { return sdkerrors.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header2 cannot be empty") } - if misbehaviour.Header1.Header.ChainID != misbehaviour.Header2.Header.ChainID { + if h.Header1.Header.ChainID != h.Header2.Header.ChainID { return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers must have identical chainIDs") } - if err := host.ClientIdentifierValidator(misbehaviour.ClientId); err != nil { - return sdkerrors.Wrap(err, "misbehaviour client ID is invalid") + if err := host.ClientIdentifierValidator(h.ClientId); err != nil { + return sdkerrors.Wrap(err, "DuplicateHeaderHeader client ID is invalid") } - // ValidateBasic on both validators - if err := misbehaviour.Header1.ValidateBasic(); err != nil { + // ValidateBasic on both validators. + if err := h.Header1.ValidateBasic(); err != nil { return sdkerrors.Wrap( clienttypes.ErrInvalidMisbehaviour, sdkerrors.Wrap(err, "header 1 failed validation").Error(), ) } - if err := misbehaviour.Header2.ValidateBasic(); err != nil { + if err := h.Header2.ValidateBasic(); err != nil { return sdkerrors.Wrap( clienttypes.ErrInvalidMisbehaviour, sdkerrors.Wrap(err, "header 2 failed validation").Error(), ) } - // Ensure that Height1 is greater than or equal to Height2 - if misbehaviour.Header1.GetHeight().LT(misbehaviour.Header2.GetHeight()) { - return sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour, "Header1 height is less than Header2 height (%s < %s)", misbehaviour.Header1.GetHeight(), misbehaviour.Header2.GetHeight()) + // Ensure that Height1 is greater than or equal to Height2. + if h.Header1.GetHeight().LT(h.Header2.GetHeight()) { + return sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour, "Header1 height is less than Header2 height (%s < %s)", h.Header1.GetHeight(), h.Header2.GetHeight()) } - blockID1, err := tmtypes.BlockIDFromProto(&misbehaviour.Header1.SignedHeader.Commit.BlockID) + blockID1, err := tmtypes.BlockIDFromProto(&h.Header1.SignedHeader.Commit.BlockID) if err != nil { - return sdkerrors.Wrap(err, "invalid block ID from header 1 in misbehaviour") + return sdkerrors.Wrap(err, "invalid block ID from header 1 in DuplicateHeaderHeader") } - blockID2, err := tmtypes.BlockIDFromProto(&misbehaviour.Header2.SignedHeader.Commit.BlockID) + blockID2, err := tmtypes.BlockIDFromProto(&h.Header2.SignedHeader.Commit.BlockID) if err != nil { - return sdkerrors.Wrap(err, "invalid block ID from header 2 in misbehaviour") + return sdkerrors.Wrap(err, "invalid block ID from header 2 in DuplicateHeaderHeader") } - if err := validCommit(misbehaviour.Header1.Header.ChainID, *blockID1, - misbehaviour.Header1.Commit, misbehaviour.Header1.ValidatorSet); err != nil { + if err := validCommit(h.Header1.Header.ChainID, *blockID1, + h.Header1.Commit, h.Header1.ValidatorSet); err != nil { return err } - if err := validCommit(misbehaviour.Header2.Header.ChainID, *blockID2, - misbehaviour.Header2.Commit, misbehaviour.Header2.ValidatorSet); err != nil { + if err := validCommit(h.Header2.Header.ChainID, *blockID2, + h.Header2.Commit, h.Header2.ValidatorSet); err != nil { return err } return nil } -// validCommit checks if the given commit is a valid commit from the passed-in validatorset +// validCommit checks if the given commit is a valid commit from the passed-in validatorset. func validCommit(chainID string, blockID tmtypes.BlockID, commit *tmproto.Commit, valSet *tmproto.ValidatorSet) (err error) { tmCommit, err := tmtypes.CommitFromProto(commit) if err != nil { diff --git a/modules/light-clients/07-tendermint/types/misbehaviour_handle.go b/modules/light-clients/07-tendermint/types/misbehaviour_handle.go index 4c8224bde09..718ae4a6c48 100644 --- a/modules/light-clients/07-tendermint/types/misbehaviour_handle.go +++ b/modules/light-clients/07-tendermint/types/misbehaviour_handle.go @@ -25,23 +25,23 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, - misbehaviour exported.Misbehaviour, + header exported.Header, ) (exported.ClientState, error) { - tmMisbehaviour, ok := misbehaviour.(*Misbehaviour) + misbehaviour, ok := header.(*DuplicateHeaderHeader) if !ok { - return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "expected type %T, got %T", misbehaviour, &Misbehaviour{}) + return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "expected type %T, got %T", misbehaviour, &DuplicateHeaderHeader{}) } // The status of the client is checked in 02-client // if heights are equal check that this is valid misbehaviour of a fork // otherwise if heights are unequal check that this is valid misbehavior of BFT time violation - if tmMisbehaviour.Header1.GetHeight().EQ(tmMisbehaviour.Header2.GetHeight()) { - blockID1, err := tmtypes.BlockIDFromProto(&tmMisbehaviour.Header1.SignedHeader.Commit.BlockID) + if misbehaviour.Header1.GetHeight().EQ(misbehaviour.Header2.GetHeight()) { + blockID1, err := tmtypes.BlockIDFromProto(&misbehaviour.Header1.SignedHeader.Commit.BlockID) if err != nil { return nil, sdkerrors.Wrap(err, "invalid block ID from header 1 in misbehaviour") } - blockID2, err := tmtypes.BlockIDFromProto(&tmMisbehaviour.Header2.SignedHeader.Commit.BlockID) + blockID2, err := tmtypes.BlockIDFromProto(&misbehaviour.Header2.SignedHeader.Commit.BlockID) if err != nil { return nil, sdkerrors.Wrap(err, "invalid block ID from header 2 in misbehaviour") } @@ -53,7 +53,7 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( } else { // Header1 is at greater height than Header2, therefore Header1 time must be less than or equal to // Header2 time in order to be valid misbehaviour (violation of monotonic time). - if tmMisbehaviour.Header1.SignedHeader.Header.Time.After(tmMisbehaviour.Header2.SignedHeader.Header.Time) { + if misbehaviour.Header1.SignedHeader.Header.Time.After(misbehaviour.Header2.SignedHeader.Header.Time) { return nil, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers are not at same height and are monotonically increasing") } } @@ -64,15 +64,15 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( // and unmarshal from clientStore // Get consensus bytes from clientStore - tmConsensusState1, err := GetConsensusState(clientStore, cdc, tmMisbehaviour.Header1.TrustedHeight) + tmConsensusState1, err := GetConsensusState(clientStore, cdc, misbehaviour.Header1.TrustedHeight) if err != nil { - return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header1 at TrustedHeight: %s", tmMisbehaviour.Header1) + return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header1 at TrustedHeight: %s", misbehaviour.Header1) } // Get consensus bytes from clientStore - tmConsensusState2, err := GetConsensusState(clientStore, cdc, tmMisbehaviour.Header2.TrustedHeight) + tmConsensusState2, err := GetConsensusState(clientStore, cdc, misbehaviour.Header2.TrustedHeight) if err != nil { - return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header2 at TrustedHeight: %s", tmMisbehaviour.Header2) + return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header2 at TrustedHeight: %s", misbehaviour.Header2) } // Check the validity of the two conflicting headers against their respective @@ -81,12 +81,12 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( // misbehaviour.ValidateBasic by the client keeper and msg.ValidateBasic // by the base application. if err := checkMisbehaviourHeader( - &cs, tmConsensusState1, tmMisbehaviour.Header1, ctx.BlockTime(), + &cs, tmConsensusState1, misbehaviour.Header1, ctx.BlockTime(), ); err != nil { return nil, sdkerrors.Wrap(err, "verifying Header1 in Misbehaviour failed") } if err := checkMisbehaviourHeader( - &cs, tmConsensusState2, tmMisbehaviour.Header2, ctx.BlockTime(), + &cs, tmConsensusState2, misbehaviour.Header2, ctx.BlockTime(), ); err != nil { return nil, sdkerrors.Wrap(err, "verifying Header2 in Misbehaviour failed") } diff --git a/modules/light-clients/07-tendermint/types/misbehaviour_handle_test.go b/modules/light-clients/07-tendermint/types/misbehaviour_handle_test.go index da1efc665da..1250e90156a 100644 --- a/modules/light-clients/07-tendermint/types/misbehaviour_handle_test.go +++ b/modules/light-clients/07-tendermint/types/misbehaviour_handle_test.go @@ -45,7 +45,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height1 clienttypes.Height consensusState2 exported.ConsensusState height2 clienttypes.Height - misbehaviour exported.Misbehaviour + misbehaviour exported.Header timestamp time.Time expPass bool }{ @@ -56,7 +56,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -71,7 +71,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -86,7 +86,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Hour), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -101,7 +101,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { heightMinus1, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), heightMinus1, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -116,7 +116,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { heightMinus1, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, @@ -131,7 +131,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { heightMinus1, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainIDRevision0, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainIDRevision0, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, @@ -146,7 +146,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { heightMinus1, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainIDRevision0, 3, heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainIDRevision0, 3, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, @@ -161,7 +161,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { heightMinus1, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainIDRevision1, 1, heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainIDRevision1, 1, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, @@ -176,7 +176,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, suite.valSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, @@ -191,7 +191,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -206,7 +206,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -221,7 +221,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader("ethermint", int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader("ethermint", int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -236,7 +236,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { heightMinus1, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, @@ -251,7 +251,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { heightMinus1, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -266,7 +266,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -281,7 +281,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { clienttypes.Height{}, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -307,7 +307,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -322,7 +322,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { heightMinus1, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -337,7 +337,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, suite.valSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, @@ -352,7 +352,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, altValSet, bothValSet, altSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, @@ -367,7 +367,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners), ClientId: chainID, @@ -382,7 +382,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { height, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, altValSet, bothValSet, altSigners), Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners), ClientId: chainID, diff --git a/modules/light-clients/07-tendermint/types/misbehaviour_test.go b/modules/light-clients/07-tendermint/types/misbehaviour_test.go index bba616bc5e4..9d1c266cd5a 100644 --- a/modules/light-clients/07-tendermint/types/misbehaviour_test.go +++ b/modules/light-clients/07-tendermint/types/misbehaviour_test.go @@ -18,7 +18,7 @@ func (suite *TendermintTestSuite) TestMisbehaviour() { signers := []tmtypes.PrivValidator{suite.privVal} heightMinus1 := clienttypes.NewHeight(0, height.RevisionHeight-1) - misbehaviour := &types.Misbehaviour{ + misbehaviour := &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers), ClientId: clientID, @@ -54,130 +54,130 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() { testCases := []struct { name string - misbehaviour *types.Misbehaviour - malleateMisbehaviour func(misbehaviour *types.Misbehaviour) error + misbehaviour *types.DuplicateHeaderHeader + malleateMisbehaviour func(misbehaviour *types.DuplicateHeaderHeader) error expPass bool }{ { "valid fork misbehaviour, two headers at same height have different time", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, true, }, { "valid time misbehaviour, both headers at different heights are at same time", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+5), heightMinus1, suite.now, suite.valSet, suite.valSet, signers), Header2: suite.header, ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, true, }, { "misbehaviour Header1 is nil", - types.NewMisbehaviour(clientID, nil, suite.header), - func(m *types.Misbehaviour) error { return nil }, + types.NewDuplicateHeaderHeader(clientID, nil, suite.header), + func(m *types.DuplicateHeaderHeader) error { return nil }, false, }, { "misbehaviour Header2 is nil", - types.NewMisbehaviour(clientID, suite.header, nil), - func(m *types.Misbehaviour) error { return nil }, + types.NewDuplicateHeaderHeader(clientID, suite.header, nil), + func(m *types.DuplicateHeaderHeader) error { return nil }, false, }, { "valid misbehaviour with different trusted headers", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.NewHeight(0, height.RevisionHeight-3), suite.now.Add(time.Minute), suite.valSet, bothValSet, signers), ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, true, }, { "trusted height is 0 in Header1", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), Header2: suite.header, ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, false, }, { "trusted height is 0 in Header2", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, false, }, { "trusted valset is nil in Header1", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers), Header2: suite.header, ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, false, }, { "trusted valset is nil in Header2", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers), ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, false, }, { "invalid client ID ", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers), ClientId: "GAIA", }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, false, }, { "chainIDs do not match", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader("ethermint", int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers), ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, false, }, { "header2 height is greater", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, 6, clienttypes.NewHeight(0, height.RevisionHeight+1), suite.now, suite.valSet, suite.valSet, signers), ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { return nil }, + func(misbehaviour *types.DuplicateHeaderHeader) error { return nil }, false, }, { "header 1 doesn't have 2/3 majority", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners), Header2: suite.header, ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { + func(misbehaviour *types.DuplicateHeaderHeader) error { // voteSet contains only altVal which is less than 2/3 of total power (height/1height) wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header1.GetHeight().GetRevisionHeight()), 1, tmproto.PrecommitType, altValSet) blockID, err := tmtypes.BlockIDFromProto(&misbehaviour.Header1.Commit.BlockID) @@ -193,12 +193,12 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() { }, { "header 2 doesn't have 2/3 majority", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners), ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { + func(misbehaviour *types.DuplicateHeaderHeader) error { // voteSet contains only altVal which is less than 2/3 of total power (height/1height) wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header2.GetHeight().GetRevisionHeight()), 1, tmproto.PrecommitType, altValSet) blockID, err := tmtypes.BlockIDFromProto(&misbehaviour.Header2.Commit.BlockID) @@ -214,12 +214,12 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() { }, { "validators sign off on wrong commit", - &types.Misbehaviour{ + &types.DuplicateHeaderHeader{ Header1: suite.header, Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners), ClientId: clientID, }, - func(misbehaviour *types.Misbehaviour) error { + func(misbehaviour *types.DuplicateHeaderHeader) error { tmBlockID := ibctesting.MakeBlockID(tmhash.Sum([]byte("other_hash")), 3, tmhash.Sum([]byte("other_partset"))) misbehaviour.Header2.Commit.BlockID = tmBlockID.ToProto() return nil diff --git a/modules/light-clients/07-tendermint/types/tendermint.pb.go b/modules/light-clients/07-tendermint/types/tendermint.pb.go index 6436578b2ae..961e430fe17 100644 --- a/modules/light-clients/07-tendermint/types/tendermint.pb.go +++ b/modules/light-clients/07-tendermint/types/tendermint.pb.go @@ -143,26 +143,26 @@ func (m *ConsensusState) XXX_DiscardUnknown() { var xxx_messageInfo_ConsensusState proto.InternalMessageInfo -// Misbehaviour is a wrapper over two conflicting Headers -// that implements Misbehaviour interface expected by ICS-02 -type Misbehaviour struct { +// DuplicateHeaderHeader is a wrapper over two conflicting Headers +// that implements Header interface expected by ICS-02 +type DuplicateHeaderHeader struct { ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` Header1 *Header `protobuf:"bytes,2,opt,name=header_1,json=header1,proto3" json:"header_1,omitempty" yaml:"header_1"` Header2 *Header `protobuf:"bytes,3,opt,name=header_2,json=header2,proto3" json:"header_2,omitempty" yaml:"header_2"` } -func (m *Misbehaviour) Reset() { *m = Misbehaviour{} } -func (m *Misbehaviour) String() string { return proto.CompactTextString(m) } -func (*Misbehaviour) ProtoMessage() {} -func (*Misbehaviour) Descriptor() ([]byte, []int) { +func (m *DuplicateHeaderHeader) Reset() { *m = DuplicateHeaderHeader{} } +func (m *DuplicateHeaderHeader) String() string { return proto.CompactTextString(m) } +func (*DuplicateHeaderHeader) ProtoMessage() {} +func (*DuplicateHeaderHeader) Descriptor() ([]byte, []int) { return fileDescriptor_c6d6cf2b288949be, []int{2} } -func (m *Misbehaviour) XXX_Unmarshal(b []byte) error { +func (m *DuplicateHeaderHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *DuplicateHeaderHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Misbehaviour.Marshal(b, m, deterministic) + return xxx_messageInfo_DuplicateHeaderHeader.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -172,17 +172,17 @@ func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *Misbehaviour) XXX_Merge(src proto.Message) { - xxx_messageInfo_Misbehaviour.Merge(m, src) +func (m *DuplicateHeaderHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_DuplicateHeaderHeader.Merge(m, src) } -func (m *Misbehaviour) XXX_Size() int { +func (m *DuplicateHeaderHeader) XXX_Size() int { return m.Size() } -func (m *Misbehaviour) XXX_DiscardUnknown() { - xxx_messageInfo_Misbehaviour.DiscardUnknown(m) +func (m *DuplicateHeaderHeader) XXX_DiscardUnknown() { + xxx_messageInfo_DuplicateHeaderHeader.DiscardUnknown(m) } -var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo +var xxx_messageInfo_DuplicateHeaderHeader proto.InternalMessageInfo // Header defines the Tendermint client consensus Header. // It encapsulates all the information necessary to update from a trusted @@ -314,7 +314,7 @@ func (m *Fraction) GetDenominator() uint64 { func init() { proto.RegisterType((*ClientState)(nil), "ibc.lightclients.tendermint.v1.ClientState") proto.RegisterType((*ConsensusState)(nil), "ibc.lightclients.tendermint.v1.ConsensusState") - proto.RegisterType((*Misbehaviour)(nil), "ibc.lightclients.tendermint.v1.Misbehaviour") + proto.RegisterType((*DuplicateHeaderHeader)(nil), "ibc.lightclients.tendermint.v1.DuplicateHeaderHeader") proto.RegisterType((*Header)(nil), "ibc.lightclients.tendermint.v1.Header") proto.RegisterType((*Fraction)(nil), "ibc.lightclients.tendermint.v1.Fraction") } @@ -324,75 +324,75 @@ func init() { } var fileDescriptor_c6d6cf2b288949be = []byte{ - // 1080 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0x6e, 0xda, 0xb2, 0x4d, 0x26, 0xe9, 0x76, 0x31, 0xa5, 0x9b, 0x96, 0x6e, 0x1c, 0x19, 0xb4, - 0x44, 0x48, 0xb5, 0x49, 0x8a, 0x84, 0x54, 0x71, 0xc1, 0xdd, 0x45, 0x2d, 0x62, 0xa5, 0xca, 0xe5, - 0x87, 0x84, 0x84, 0xcc, 0xc4, 0x9e, 0x24, 0xa3, 0xb5, 0x3d, 0xc6, 0x33, 0x09, 0x2d, 0x7f, 0x01, - 0x1c, 0x90, 0xf6, 0x88, 0x38, 0x71, 0xe0, 0x8f, 0xd9, 0x63, 0x8f, 0x9c, 0x0c, 0x6a, 0x2f, 0x9c, - 0x73, 0xe4, 0x84, 0xe6, 0x87, 0xed, 0x69, 0xb6, 0x4b, 0xb5, 0x5c, 0xa2, 0x79, 0xef, 0x7d, 0xef, - 0xfb, 0x32, 0x6f, 0xde, 0xbc, 0x31, 0x70, 0xf0, 0x30, 0x70, 0x22, 0x3c, 0x9e, 0xb0, 0x20, 0xc2, - 0x28, 0x61, 0xd4, 0x61, 0x28, 0x09, 0x51, 0x16, 0xe3, 0x84, 0x39, 0xb3, 0xbe, 0x66, 0xd9, 0x69, - 0x46, 0x18, 0x31, 0x3a, 0x78, 0x18, 0xd8, 0x7a, 0x82, 0xad, 0x41, 0x66, 0xfd, 0x9d, 0xae, 0x96, - 0xcf, 0xce, 0x53, 0x44, 0x9d, 0x19, 0x8c, 0x70, 0x08, 0x19, 0xc9, 0x24, 0xc3, 0xce, 0xee, 0x0b, - 0x08, 0xf1, 0xab, 0xa2, 0xad, 0x34, 0x23, 0x64, 0x54, 0x58, 0x9d, 0x31, 0x21, 0xe3, 0x08, 0x39, - 0xc2, 0x1a, 0x4e, 0x47, 0x4e, 0x38, 0xcd, 0x20, 0xc3, 0x24, 0x51, 0x71, 0x73, 0x31, 0xce, 0x70, - 0x8c, 0x28, 0x83, 0x71, 0x5a, 0x00, 0xf8, 0xfe, 0x02, 0x92, 0x21, 0x47, 0xfe, 0x5d, 0xbe, 0x27, - 0xb9, 0x52, 0x80, 0x77, 0x2b, 0x00, 0x89, 0x63, 0xcc, 0xe2, 0x02, 0x54, 0x5a, 0x0a, 0xb8, 0x39, - 0x26, 0x63, 0x22, 0x96, 0x0e, 0x5f, 0x49, 0xaf, 0xf5, 0xf7, 0x1a, 0x68, 0x1e, 0x0a, 0xbe, 0x53, - 0x06, 0x19, 0x32, 0xb6, 0x41, 0x3d, 0x98, 0x40, 0x9c, 0xf8, 0x38, 0x6c, 0xd7, 0xba, 0xb5, 0x5e, - 0xc3, 0x5b, 0x13, 0xf6, 0x71, 0x68, 0x20, 0xd0, 0x64, 0xd9, 0x94, 0x32, 0x3f, 0x42, 0x33, 0x14, - 0xb5, 0x97, 0xbb, 0xb5, 0x5e, 0x73, 0xd0, 0xb3, 0xff, 0xbb, 0x9e, 0xf6, 0x27, 0x19, 0x0c, 0xf8, - 0x86, 0xdd, 0x9d, 0xe7, 0xb9, 0xb9, 0x34, 0xcf, 0x4d, 0xe3, 0x1c, 0xc6, 0xd1, 0x81, 0xa5, 0x51, - 0x59, 0x1e, 0x10, 0xd6, 0x67, 0xdc, 0x30, 0x46, 0x60, 0x43, 0x58, 0x38, 0x19, 0xfb, 0x29, 0xca, - 0x30, 0x09, 0xdb, 0x2b, 0x42, 0x6a, 0xdb, 0x96, 0xc5, 0xb2, 0x8b, 0x62, 0xd9, 0x8f, 0x54, 0x31, - 0x5d, 0x4b, 0x71, 0x6f, 0x69, 0xdc, 0x55, 0xbe, 0xf5, 0xcb, 0x9f, 0x66, 0xcd, 0xbb, 0x5b, 0x78, - 0x4f, 0x84, 0xd3, 0xc0, 0xe0, 0xde, 0x34, 0x19, 0x92, 0x24, 0xd4, 0x84, 0x56, 0x6f, 0x13, 0x7a, - 0x5b, 0x09, 0xdd, 0x97, 0x42, 0x8b, 0x04, 0x52, 0x69, 0xa3, 0x74, 0x2b, 0x29, 0x04, 0x36, 0x62, - 0x78, 0xe6, 0x07, 0x11, 0x09, 0x9e, 0xfa, 0x61, 0x86, 0x47, 0xac, 0xfd, 0xda, 0x2b, 0x6e, 0x69, - 0x21, 0x5f, 0x0a, 0xad, 0xc7, 0xf0, 0xec, 0x90, 0x3b, 0x1f, 0x71, 0x9f, 0xf1, 0x0d, 0x58, 0x1f, - 0x65, 0xe4, 0x07, 0x94, 0xf8, 0x13, 0xc4, 0x0f, 0xa4, 0x7d, 0x47, 0x88, 0xec, 0x88, 0x23, 0xe2, - 0x2d, 0x62, 0xab, 0xce, 0x99, 0xf5, 0xed, 0x23, 0x81, 0x70, 0x77, 0x95, 0xca, 0xa6, 0x54, 0xb9, - 0x96, 0x6e, 0x79, 0x2d, 0x69, 0x4b, 0x2c, 0xa7, 0x8f, 0x20, 0x43, 0x94, 0x15, 0xf4, 0x6b, 0xaf, - 0x4a, 0x7f, 0x2d, 0xdd, 0xf2, 0x5a, 0xd2, 0x56, 0xf4, 0xc7, 0xa0, 0x29, 0xae, 0x8e, 0x4f, 0x53, - 0x14, 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b1, 0x76, 0xc5, 0x02, 0x42, 0x63, 0x42, 0xf9, 0x67, 0xd7, 0xde, 0x98, 0x38, - 0xb3, 0x7d, 0x27, 0x26, 0xe1, 0x34, 0x42, 0x54, 0x7e, 0x84, 0xed, 0x15, 0x5f, 0x61, 0xef, 0x7f, - 0xb8, 0xb7, 0xf8, 0x99, 0x34, 0xbc, 0x23, 0x46, 0xca, 0xfe, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0xc4, 0x2b, 0x98, 0x08, 0xb4, 0x09, 0x00, 0x00, + // 1087 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6f, 0xe3, 0x44, + 0x14, 0x6f, 0xda, 0xd2, 0x26, 0x93, 0x74, 0x5b, 0x4c, 0xb7, 0x9b, 0x96, 0x6e, 0x1c, 0x19, 0xb4, + 0x44, 0x48, 0xb5, 0x49, 0x8a, 0x84, 0x54, 0x71, 0xc1, 0xed, 0xa2, 0x16, 0xb1, 0x52, 0xe5, 0xf2, + 0x21, 0x21, 0x21, 0x33, 0xb1, 0x27, 0xc9, 0x68, 0x6d, 0x8f, 0xf1, 0x8c, 0x43, 0xcb, 0x5f, 0x00, + 0xb7, 0x3d, 0x21, 0xc4, 0x89, 0x03, 0x7f, 0xcc, 0x1e, 0x7b, 0xe4, 0x64, 0x50, 0x7b, 0xe1, 0x9c, + 0x23, 0x27, 0x34, 0x1f, 0xfe, 0x68, 0xb6, 0x4b, 0xb5, 0x7b, 0x89, 0xe6, 0xbd, 0xf7, 0x7b, 0xbf, + 0x5f, 0xe6, 0xcd, 0x9b, 0x37, 0x06, 0x16, 0x1e, 0x7a, 0x56, 0x80, 0xc7, 0x13, 0xe6, 0x05, 0x18, + 0x45, 0x8c, 0x5a, 0x0c, 0x45, 0x3e, 0x4a, 0x42, 0x1c, 0x31, 0x6b, 0xda, 0xaf, 0x58, 0x66, 0x9c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x48, 0x28, 0xff, 0xfe, 0xda, 0x1b, 0x13, 0x6b, 0xba, 0x6f, 0x85, 0xc4, 0x4f, 0x03, 0x44, 0xe5, + 0xd7, 0xd8, 0x5e, 0xfe, 0x39, 0xf6, 0xc1, 0x47, 0x7b, 0xf3, 0xdf, 0x4b, 0xc3, 0x15, 0x31, 0x5b, + 0xf6, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x3c, 0xca, 0x8b, 0xbd, 0x09, 0x00, 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -570,7 +570,7 @@ func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { +func (m *DuplicateHeaderHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -580,12 +580,12 @@ func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Misbehaviour) MarshalTo(dAtA []byte) (int, error) { +func (m *DuplicateHeaderHeader) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DuplicateHeaderHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -797,7 +797,7 @@ func (m *ConsensusState) Size() (n int) { return n } -func (m *Misbehaviour) Size() (n int) { +func (m *DuplicateHeaderHeader) Size() (n int) { if m == nil { return 0 } @@ -1398,7 +1398,7 @@ func (m *ConsensusState) Unmarshal(dAtA []byte) error { } return nil } -func (m *Misbehaviour) Unmarshal(dAtA []byte) error { +func (m *DuplicateHeaderHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1421,10 +1421,10 @@ func (m *Misbehaviour) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Misbehaviour: wiretype end group for non-group") + return fmt.Errorf("proto: DuplicateHeaderHeader: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Misbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DuplicateHeaderHeader: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/modules/light-clients/09-localhost/types/client_state.go b/modules/light-clients/09-localhost/types/client_state.go index 1670d4f1e6b..847f9720b29 100644 --- a/modules/light-clients/09-localhost/types/client_state.go +++ b/modules/light-clients/09-localhost/types/client_state.go @@ -92,7 +92,7 @@ func (cs *ClientState) CheckHeaderAndUpdateState( // Since localhost is the client of the running chain, misbehaviour cannot be submitted to it // Thus, CheckMisbehaviourAndUpdateState returns an error for localhost func (cs ClientState) CheckMisbehaviourAndUpdateState( - _ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, _ exported.Misbehaviour, + _ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, _ exported.Header, ) (exported.ClientState, error) { return nil, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "cannot submit misbehaviour to localhost client") } diff --git a/proto/ibc/lightclients/solomachine/v1/solomachine.proto b/proto/ibc/lightclients/solomachine/v1/solomachine.proto index c279f5e728e..e2f35b340d1 100644 --- a/proto/ibc/lightclients/solomachine/v1/solomachine.proto +++ b/proto/ibc/lightclients/solomachine/v1/solomachine.proto @@ -48,9 +48,9 @@ message Header { string new_diversifier = 5 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; } -// Misbehaviour defines misbehaviour for a solo machine which consists +// ConflictingSignaturesHeader defines misbehaviour for a solo machine which consists // of a sequence and two signatures over different messages at that sequence. -message Misbehaviour { +message ConflictingSignaturesHeader { option (gogoproto.goproto_getters) = false; string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; uint64 sequence = 2; diff --git a/proto/ibc/lightclients/solomachine/v2/solomachine.proto b/proto/ibc/lightclients/solomachine/v2/solomachine.proto index e626c18ac66..0d47b3913cc 100644 --- a/proto/ibc/lightclients/solomachine/v2/solomachine.proto +++ b/proto/ibc/lightclients/solomachine/v2/solomachine.proto @@ -48,9 +48,9 @@ message Header { string new_diversifier = 5 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; } -// Misbehaviour defines misbehaviour for a solo machine which consists +// ConflictingSignaturesHeader defines misbehaviour for a solo machine which consists // of a sequence and two signatures over different messages at that sequence. -message Misbehaviour { +message ConflictingSignaturesHeader { option (gogoproto.goproto_getters) = false; string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; uint64 sequence = 2; diff --git a/proto/ibc/lightclients/tendermint/v1/tendermint.proto b/proto/ibc/lightclients/tendermint/v1/tendermint.proto index 322574fa5bf..afd961da24c 100644 --- a/proto/ibc/lightclients/tendermint/v1/tendermint.proto +++ b/proto/ibc/lightclients/tendermint/v1/tendermint.proto @@ -75,9 +75,9 @@ message ConsensusState { ]; } -// Misbehaviour is a wrapper over two conflicting Headers -// that implements Misbehaviour interface expected by ICS-02 -message Misbehaviour { +// DuplicateHeaderHeader is a wrapper over two conflicting Headers +// that implements Header interface expected by ICS-02 +message DuplicateHeaderHeader { option (gogoproto.goproto_getters) = false; string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; diff --git a/testing/solomachine.go b/testing/solomachine.go index 485fb75be0e..125b1404631 100644 --- a/testing/solomachine.go +++ b/testing/solomachine.go @@ -152,9 +152,9 @@ func (solo *Solomachine) CreateHeader() *solomachinetypes.Header { return header } -// CreateMisbehaviour constructs testing misbehaviour for the solo machine client +// CreateConflictingSignaturesHeader constructs testing misbehaviour for the solo machine client // by signing over two different data bytes at the same sequence. -func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour { +func (solo *Solomachine) CreateConflictingSignaturesHeader() *solomachinetypes.ConflictingSignaturesHeader { path := solo.GetClientStatePath("counterparty") dataOne, err := solomachinetypes.ClientStateDataBytes(solo.cdc, path, solo.ClientState()) require.NoError(solo.t, err) @@ -204,7 +204,7 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour { Timestamp: solo.Time, } - return &solomachinetypes.Misbehaviour{ + return &solomachinetypes.ConflictingSignaturesHeader{ ClientId: solo.ClientID, Sequence: solo.Sequence, SignatureOne: &signatureOne, From 2f114f7d2828be672aba18df3c160d39832dd562 Mon Sep 17 00:00:00 2001 From: shakeshack Date: Thu, 10 Feb 2022 19:23:30 -0500 Subject: [PATCH 4/6] chore: add 668 fns to tm client --- .../types/misbehaviour_handle.go | 39 ++- .../07-tendermint/types/update.go | 323 +++++++++++------- 2 files changed, 224 insertions(+), 138 deletions(-) diff --git a/modules/light-clients/07-tendermint/types/misbehaviour_handle.go b/modules/light-clients/07-tendermint/types/misbehaviour_handle.go index 718ae4a6c48..cccd3987588 100644 --- a/modules/light-clients/07-tendermint/types/misbehaviour_handle.go +++ b/modules/light-clients/07-tendermint/types/misbehaviour_handle.go @@ -31,30 +31,47 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( if !ok { return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "expected type %T, got %T", misbehaviour, &DuplicateHeaderHeader{}) } - // The status of the client is checked in 02-client + misbehaving, err := cs.checkDuplicateHeaderHeader(ctx, cdc, clientStore, misbehaviour) + if err != nil { + return nil, err + } + // NB: Technically this check isn't required as checkDuplicateHeaderHeader() returns an error if misbehaviour header is not valid. + if misbehaving { + cs.FrozenHeight = FrozenHeight + } + + return &cs, nil +} + +func (cs ClientState) checkDuplicateHeaderHeader( + ctx sdk.Context, + cdc codec.BinaryCodec, + clientStore sdk.KVStore, + misbehaviour *DuplicateHeaderHeader, +) (bool, error) { // if heights are equal check that this is valid misbehaviour of a fork // otherwise if heights are unequal check that this is valid misbehavior of BFT time violation if misbehaviour.Header1.GetHeight().EQ(misbehaviour.Header2.GetHeight()) { blockID1, err := tmtypes.BlockIDFromProto(&misbehaviour.Header1.SignedHeader.Commit.BlockID) if err != nil { - return nil, sdkerrors.Wrap(err, "invalid block ID from header 1 in misbehaviour") + return false, sdkerrors.Wrap(err, "invalid block ID from header 1 in misbehaviour") } blockID2, err := tmtypes.BlockIDFromProto(&misbehaviour.Header2.SignedHeader.Commit.BlockID) if err != nil { - return nil, sdkerrors.Wrap(err, "invalid block ID from header 2 in misbehaviour") + return false, sdkerrors.Wrap(err, "invalid block ID from header 2 in misbehaviour") } // Ensure that Commit Hashes are different if bytes.Equal(blockID1.Hash, blockID2.Hash) { - return nil, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers block hashes are equal") + return false, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers block hashes are equal") } } else { // Header1 is at greater height than Header2, therefore Header1 time must be less than or equal to // Header2 time in order to be valid misbehaviour (violation of monotonic time). if misbehaviour.Header1.SignedHeader.Header.Time.After(misbehaviour.Header2.SignedHeader.Header.Time) { - return nil, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers are not at same height and are monotonically increasing") + return false, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers are not at same height and are monotonically increasing") } } @@ -66,13 +83,13 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( // Get consensus bytes from clientStore tmConsensusState1, err := GetConsensusState(clientStore, cdc, misbehaviour.Header1.TrustedHeight) if err != nil { - return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header1 at TrustedHeight: %s", misbehaviour.Header1) + return false, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header1 at TrustedHeight: %s", misbehaviour.Header1) } // Get consensus bytes from clientStore tmConsensusState2, err := GetConsensusState(clientStore, cdc, misbehaviour.Header2.TrustedHeight) if err != nil { - return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header2 at TrustedHeight: %s", misbehaviour.Header2) + return false, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header2 at TrustedHeight: %s", misbehaviour.Header2) } // Check the validity of the two conflicting headers against their respective @@ -83,17 +100,15 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( if err := checkMisbehaviourHeader( &cs, tmConsensusState1, misbehaviour.Header1, ctx.BlockTime(), ); err != nil { - return nil, sdkerrors.Wrap(err, "verifying Header1 in Misbehaviour failed") + return false, sdkerrors.Wrap(err, "verifying Header1 in Misbehaviour failed") } if err := checkMisbehaviourHeader( &cs, tmConsensusState2, misbehaviour.Header2, ctx.BlockTime(), ); err != nil { - return nil, sdkerrors.Wrap(err, "verifying Header2 in Misbehaviour failed") + return false, sdkerrors.Wrap(err, "verifying Header2 in Misbehaviour failed") } - cs.FrozenHeight = FrozenHeight - - return &cs, nil + return true, nil } // checkMisbehaviourHeader checks that a Header in Misbehaviour is valid misbehaviour given diff --git a/modules/light-clients/07-tendermint/types/update.go b/modules/light-clients/07-tendermint/types/update.go index c4d422ccb73..d91f94e4b62 100644 --- a/modules/light-clients/07-tendermint/types/update.go +++ b/modules/light-clients/07-tendermint/types/update.go @@ -3,7 +3,6 @@ package types import ( "bytes" "reflect" - "time" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -53,159 +52,91 @@ func (cs ClientState) CheckHeaderAndUpdateState( ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, header exported.Header, ) (exported.ClientState, exported.ConsensusState, error) { - tmHeader, ok := header.(*Header) - if !ok { - return nil, nil, sdkerrors.Wrapf( - clienttypes.ErrInvalidHeader, "expected type %T, got %T", &Header{}, header, - ) - } - - // Check if the Client store already has a consensus state for the header's height - // If the consensus state exists, and it matches the header then we return early - // since header has already been submitted in a previous UpdateClient. - var conflictingHeader bool - prevConsState, _ := GetConsensusState(clientStore, cdc, header.GetHeight()) - if prevConsState != nil { - // This header has already been submitted and the necessary state is already stored - // in client store, thus we can return early without further validation. - if reflect.DeepEqual(prevConsState, tmHeader.ConsensusState()) { - return &cs, prevConsState, nil - } - // A consensus state already exists for this height, but it does not match the provided header. - // Thus, we must check that this header is valid, and if so we will freeze the client. - conflictingHeader = true + if err := cs.VerifyHeader(ctx, cdc, clientStore, header); err != nil { + // NB: We're not wrapping the error here for consistency with previous behaviour. Outer fn is to be removed later. + return nil, nil, err } - // get consensus state from clientStore - trustedConsState, err := GetConsensusState(clientStore, cdc, tmHeader.TrustedHeight) + misbehaving, err := cs.CheckForMisbehaviour(ctx, cdc, clientStore, header) if err != nil { - return nil, nil, sdkerrors.Wrapf( - err, "could not get consensus state from clientstore at TrustedHeight: %s", tmHeader.TrustedHeight, - ) - } - - if err := checkValidity(&cs, trustedConsState, tmHeader, ctx.BlockTime()); err != nil { return nil, nil, err } - - consState := tmHeader.ConsensusState() - // Header is different from existing consensus state and also valid, so freeze the client and return - if conflictingHeader { - cs.FrozenHeight = FrozenHeight - return &cs, consState, nil - } - // Check that consensus state timestamps are monotonic - prevCons, prevOk := GetPreviousConsensusState(clientStore, cdc, header.GetHeight()) - nextCons, nextOk := GetNextConsensusState(clientStore, cdc, header.GetHeight()) - // if previous consensus state exists, check consensus state time is greater than previous consensus state time - // if previous consensus state is not before current consensus state, freeze the client and return. - if prevOk && !prevCons.Timestamp.Before(consState.Timestamp) { - cs.FrozenHeight = FrozenHeight - return &cs, consState, nil - } - // if next consensus state exists, check consensus state time is less than next consensus state time - // if next consensus state is not after current consensus state, freeze the client and return. - if nextOk && !nextCons.Timestamp.After(consState.Timestamp) { - cs.FrozenHeight = FrozenHeight - return &cs, consState, nil - } - - // Check the earliest consensus state to see if it is expired, if so then set the prune height - // so that we can delete consensus state and all associated metadata. - var ( - pruneHeight exported.Height - pruneError error - ) - pruneCb := func(height exported.Height) bool { - consState, err := GetConsensusState(clientStore, cdc, height) - // this error should never occur - if err != nil { - pruneError = err - return true - } - if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) { - pruneHeight = height - } - return true - } - IterateConsensusStateAscending(clientStore, pruneCb) - if pruneError != nil { - return nil, nil, pruneError - } - // if pruneHeight is set, delete consensus state and metadata - if pruneHeight != nil { - deleteConsensusState(clientStore, pruneHeight) - deleteConsensusMetadata(clientStore, pruneHeight) + if misbehaving { + updated := cs.UpdateStateOnMisbehaviour(ctx, cdc, clientStore) + // NB: Hack to grab consState temporarily since we're only processing tm `Header`s here. + tmHeader := header.(*Header) + return updated, tmHeader.ConsensusState(), nil } - - newClientState, consensusState := update(ctx, clientStore, &cs, tmHeader) - return newClientState, consensusState, nil + return cs.UpdateState(ctx, cdc, clientStore, header) } -// checkTrustedHeader checks that consensus state matches trusted fields of Header -func checkTrustedHeader(header *Header, consState *ConsensusState) error { - tmTrustedValidators, err := tmtypes.ValidatorSetFromProto(header.TrustedValidators) - if err != nil { - return sdkerrors.Wrap(err, "trusted validator set in not tendermint validator set type") +// VerifyHeader checks if the provided header is valid. +// It returns an error if: +// - the client or header provided are not parseable to tendermint types +// - the header is invalid +// - header height is less than or equal to the trusted header height +// - header revision is not equal to trusted header revision +// - header valset commit verification fails +// - header timestamp is past the trusting period in relation to the consensus state +// - header timestamp is less than or equal to the consensus state timestamp +func (cs ClientState) VerifyHeader( + ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, + header exported.Header, +) error { + tmHeader, ok := header.(*Header) + if !ok { + return sdkerrors.Wrapf( + clienttypes.ErrInvalidHeader, "expected type %T, got %T", &Header{}, header, + ) } - // assert that trustedVals is NextValidators of last trusted header - // to do this, we check that trustedVals.Hash() == consState.NextValidatorsHash - tvalHash := tmTrustedValidators.Hash() - if !bytes.Equal(consState.NextValidatorsHash, tvalHash) { + // get consensus state from clientStore + trustedConsState, err := GetConsensusState(clientStore, cdc, tmHeader.TrustedHeight) + if err != nil { return sdkerrors.Wrapf( - ErrInvalidValidatorSet, - "trusted validators %s, does not hash to latest trusted validators. Expected: %X, got: %X", - header.TrustedValidators, consState.NextValidatorsHash, tvalHash, + err, "could not get consensus state from clientstore at TrustedHeight: %s", tmHeader.TrustedHeight, ) } - return nil -} -// checkValidity checks if the Tendermint header is valid. -// CONTRACT: consState.Height == header.TrustedHeight -func checkValidity( - clientState *ClientState, consState *ConsensusState, - header *Header, currentTimestamp time.Time, -) error { - if err := checkTrustedHeader(header, consState); err != nil { + // CONTRACT: consState.Height == header.TrustedHeight + if err := checkTrustedHeader(tmHeader, trustedConsState); err != nil { return err } // UpdateClient only accepts updates with a header at the same revision // as the trusted consensus state - if header.GetHeight().GetRevisionNumber() != header.TrustedHeight.RevisionNumber { + if tmHeader.GetHeight().GetRevisionNumber() != tmHeader.TrustedHeight.RevisionNumber { return sdkerrors.Wrapf( ErrInvalidHeaderHeight, "header height revision %d does not match trusted header revision %d", - header.GetHeight().GetRevisionNumber(), header.TrustedHeight.RevisionNumber, + tmHeader.GetHeight().GetRevisionNumber(), tmHeader.TrustedHeight.RevisionNumber, ) } - tmTrustedValidators, err := tmtypes.ValidatorSetFromProto(header.TrustedValidators) + tmTrustedValidators, err := tmtypes.ValidatorSetFromProto(tmHeader.TrustedValidators) if err != nil { return sdkerrors.Wrap(err, "trusted validator set in not tendermint validator set type") } - tmSignedHeader, err := tmtypes.SignedHeaderFromProto(header.SignedHeader) + tmSignedHeader, err := tmtypes.SignedHeaderFromProto(tmHeader.SignedHeader) if err != nil { return sdkerrors.Wrap(err, "signed header in not tendermint signed header type") } - tmValidatorSet, err := tmtypes.ValidatorSetFromProto(header.ValidatorSet) + tmValidatorSet, err := tmtypes.ValidatorSetFromProto(tmHeader.ValidatorSet) if err != nil { return sdkerrors.Wrap(err, "validator set in not tendermint validator set type") } // assert header height is newer than consensus state - if header.GetHeight().LTE(header.TrustedHeight) { + if tmHeader.GetHeight().LTE(tmHeader.TrustedHeight) { return sdkerrors.Wrapf( clienttypes.ErrInvalidHeader, - "header height ≤ consensus state height (%s ≤ %s)", header.GetHeight(), header.TrustedHeight, + "header height ≤ consensus state height (%s ≤ %s)", tmHeader.GetHeight(), tmHeader.TrustedHeight, ) } - chainID := clientState.GetChainID() + chainID := cs.GetChainID() // If chainID is in revision format, then set revision number of chainID with the revision number // of the header we are verifying // This is useful if the update is at a previous revision rather than an update to the latest revision @@ -213,16 +144,16 @@ func checkValidity( // The chainID must be set correctly for the previous revision before attempting verification. // Updates for previous revisions are not supported if the chainID is not in revision format. if clienttypes.IsRevisionFormat(chainID) { - chainID, _ = clienttypes.SetRevisionNumber(chainID, header.GetHeight().GetRevisionNumber()) + chainID, _ = clienttypes.SetRevisionNumber(chainID, tmHeader.GetHeight().GetRevisionNumber()) } // Construct a trusted header using the fields in consensus state // Only Height, Time, and NextValidatorsHash are necessary for verification trustedHeader := tmtypes.Header{ ChainID: chainID, - Height: int64(header.TrustedHeight.RevisionHeight), - Time: consState.Timestamp, - NextValidatorsHash: consState.NextValidatorsHash, + Height: int64(tmHeader.TrustedHeight.RevisionHeight), + Time: trustedConsState.Timestamp, + NextValidatorsHash: trustedConsState.NextValidatorsHash, } signedHeader := tmtypes.SignedHeader{ Header: &trustedHeader, @@ -236,7 +167,7 @@ func checkValidity( err = light.Verify( &signedHeader, tmTrustedValidators, tmSignedHeader, tmValidatorSet, - clientState.TrustingPeriod, currentTimestamp, clientState.MaxClockDrift, clientState.TrustLevel.ToTendermint(), + cs.TrustingPeriod, ctx.BlockTime(), cs.MaxClockDrift, cs.TrustLevel.ToTendermint(), ) if err != nil { return sdkerrors.Wrap(err, "failed to verify header") @@ -244,20 +175,160 @@ func checkValidity( return nil } -// update the consensus state from a new header and set processed time metadata -func update(ctx sdk.Context, clientStore sdk.KVStore, clientState *ClientState, header *Header) (*ClientState, *ConsensusState) { - height := header.GetHeight().(clienttypes.Height) - if height.GT(clientState.LatestHeight) { - clientState.LatestHeight = height +// CheckForMisbehaviour will detect implicit misbehaviour by enforcing certain invariants on any new update call and will return a frozen client. +// 1. Any valid update that creates a different consensus state for an already existing height is evidence of misbehaviour and will freeze client. +// 2. Any valid update that breaks time monotonicity with respect to its neighboring consensus states is evidence of misbehaviour and will freeze client. +// Misbehaviour sets frozen height to {0, 1} since it is only used as a boolean value (zero or non-zero). +// +func (cs ClientState) CheckForMisbehaviour( + ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, + header exported.Header, +) (bool, error) { + tmHeader, ok := header.(*Header) + if ok { + return cs.checkHeader(ctx, cdc, clientStore, tmHeader), nil + } + + misbehaviour, ok := header.(*DuplicateHeaderHeader) + if ok { + return cs.checkDuplicateHeaderHeader(ctx, cdc, clientStore, misbehaviour) + } + + return false, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "unknown header type") +} + +// 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, +) *ClientState { + cs.FrozenHeight = FrozenHeight + return &cs +} + +func (cs ClientState) checkHeader( + ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, + header *Header, +) bool { + // Check if the Client store already has a consensus state for the header's height + // If the consensus state exists, and it matches the header then we return early + // since header has already been submitted in a previous UpdateClient. + var conflictingHeader bool + prevConsState, _ := GetConsensusState(clientStore, cdc, header.GetHeight()) + if prevConsState != nil { + // This header has already been submitted and the necessary state is already stored + // in client store, thus we can return early without further validation. + if reflect.DeepEqual(prevConsState, header.ConsensusState()) { + return false + } + // A consensus state already exists for this height, but it does not match the provided header. + // Thus, we must check that this header is valid, and if so we will freeze the client. + conflictingHeader = true + } + + consState := header.ConsensusState() + // Header is different from existing consensus state and also valid, so freeze the client and return + if conflictingHeader { + return true + } + // Check that consensus state timestamps are monotonic + prevCons, prevOk := GetPreviousConsensusState(clientStore, cdc, header.GetHeight()) + nextCons, nextOk := GetNextConsensusState(clientStore, cdc, header.GetHeight()) + // if previous consensus state exists, check consensus state time is greater than previous consensus state time + // if previous consensus state is not before current consensus state, freeze the client and return. + if prevOk && !prevCons.Timestamp.Before(consState.Timestamp) { + return true + } + // if next consensus state exists, check consensus state time is less than next consensus state time + // if next consensus state is not after current consensus state, freeze the client and return. + if nextOk && !nextCons.Timestamp.After(consState.Timestamp) { + return true + } + + return false +} + +// checkTrustedHeader checks that consensus state matches trusted fields of Header +func checkTrustedHeader(header *Header, consState *ConsensusState) error { + tmTrustedValidators, err := tmtypes.ValidatorSetFromProto(header.TrustedValidators) + if err != nil { + return sdkerrors.Wrap(err, "trusted validator set in not tendermint validator set type") + } + + // assert that trustedVals is NextValidators of last trusted header + // to do this, we check that trustedVals.Hash() == consState.NextValidatorsHash + tvalHash := tmTrustedValidators.Hash() + if !bytes.Equal(consState.NextValidatorsHash, tvalHash) { + return sdkerrors.Wrapf( + ErrInvalidValidatorSet, + "trusted validators %s, does not hash to latest trusted validators. Expected: %X, got: %X", + header.TrustedValidators, consState.NextValidatorsHash, tvalHash, + ) + } + return nil +} + +// UpdateState may be used to either create a consensus state for: +// - a future height greater than the latest client state height +// - a past height that was skipped during bisection +// If we are updating to a past height, a consensus state is created for that height to be persisted in client store +// If we are updating to a future height, the consensus state is created and the client state is updated to reflect +// the new latest height +// UpdateClient must only be used to update within a single revision, thus header revision number and trusted height's revision +// number must be the same. To update to a new revision, use a separate upgrade path +// Tendermint client validity checking uses the bisection algorithm described +// in the [Tendermint spec](https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md). +// +// Pruning: +// UpdateState will additionally retrieve the earliest consensus state for this clientID and check if it is expired. If it is, +// that consensus state will be pruned from store along with all associated metadata. This will prevent the client store from +// becoming bloated with expired consensus states that can no longer be used for updates and packet verification. +func (cs ClientState) UpdateState( + ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, + header exported.Header, +) (*ClientState, *ConsensusState, error) { + tmHeader := header.(*Header) + // Check if the Client store already has a consensus state for the header's height + // Check the earliest consensus state to see if it is expired, if so then set the prune height + // so that we can delete consensus state and all associated metadata. + var ( + pruneHeight exported.Height + pruneError error + ) + pruneCb := func(height exported.Height) bool { + consState, err := GetConsensusState(clientStore, cdc, height) + // this error should never occur + if err != nil { + pruneError = err + return true + } + if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) { + pruneHeight = height + } + return true + } + IterateConsensusStateAscending(clientStore, pruneCb) + if pruneError != nil { + return nil, nil, pruneError + } + // if pruneHeight is set, delete consensus state and metadata + if pruneHeight != nil { + deleteConsensusState(clientStore, pruneHeight) + deleteConsensusMetadata(clientStore, pruneHeight) + } + + height := tmHeader.GetHeight().(clienttypes.Height) + if height.GT(cs.LatestHeight) { + cs.LatestHeight = height } consensusState := &ConsensusState{ - Timestamp: header.GetTime(), - Root: commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), - NextValidatorsHash: header.Header.NextValidatorsHash, + Timestamp: tmHeader.GetTime(), + Root: commitmenttypes.NewMerkleRoot(tmHeader.Header.GetAppHash()), + NextValidatorsHash: tmHeader.Header.NextValidatorsHash, } // set metadata for this consensus state - setConsensusMetadata(ctx, clientStore, header.GetHeight()) + setConsensusMetadata(ctx, clientStore, tmHeader.GetHeight()) - return clientState, consensusState + return &cs, consensusState, nil } From 8f543d54be4f42d7deb2ab1fb51467ccb9deb1d6 Mon Sep 17 00:00:00 2001 From: Bo Du Date: Thu, 10 Feb 2022 22:43:45 -0500 Subject: [PATCH 5/6] chore: add comment --- modules/light-clients/07-tendermint/types/update.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/light-clients/07-tendermint/types/update.go b/modules/light-clients/07-tendermint/types/update.go index d91f94e4b62..e0ca529c63d 100644 --- a/modules/light-clients/07-tendermint/types/update.go +++ b/modules/light-clients/07-tendermint/types/update.go @@ -200,7 +200,7 @@ func (cs ClientState) CheckForMisbehaviour( // 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, + _ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, // prematurely include args for self persistence of consensus state ) *ClientState { cs.FrozenHeight = FrozenHeight return &cs From 15d2b9f37f78d7b4ebfb2c2031f89163d99f15ea Mon Sep 17 00:00:00 2001 From: Bo Du Date: Fri, 11 Feb 2022 00:54:23 -0500 Subject: [PATCH 6/6] chore: add error --- modules/light-clients/07-tendermint/types/update.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/light-clients/07-tendermint/types/update.go b/modules/light-clients/07-tendermint/types/update.go index e0ca529c63d..264bc9b993a 100644 --- a/modules/light-clients/07-tendermint/types/update.go +++ b/modules/light-clients/07-tendermint/types/update.go @@ -62,7 +62,7 @@ func (cs ClientState) CheckHeaderAndUpdateState( return nil, nil, err } if misbehaving { - updated := cs.UpdateStateOnMisbehaviour(ctx, cdc, clientStore) + updated, _ := cs.UpdateStateOnMisbehaviour(ctx, cdc, clientStore) // no error // NB: Hack to grab consState temporarily since we're only processing tm `Header`s here. tmHeader := header.(*Header) return updated, tmHeader.ConsensusState(), nil @@ -201,9 +201,9 @@ func (cs ClientState) CheckForMisbehaviour( // as it does not perform any misbehaviour checks. func (cs ClientState) UpdateStateOnMisbehaviour( _ sdk.Context, _ codec.BinaryCodec, _ sdk.KVStore, // prematurely include args for self persistence of consensus state -) *ClientState { +) (*ClientState, error) { cs.FrozenHeight = FrozenHeight - return &cs + return &cs, nil } func (cs ClientState) checkHeader(