From 1573e591240b128358e836588e7bd7fe6580966c Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Mon, 12 Oct 2020 15:21:39 +0200 Subject: [PATCH 1/4] add timestamp to SignatureAndData Add timestamp field to signature and data. Add ValidateBasic check for timestamp. Add ValidateBasic test. Update misbehaviour handler to use supplied timestamp. --- .../solomachine/v1/solomachine.proto | 1 + .../06-solomachine/types/misbehaviour.go | 3 + .../types/misbehaviour_handle.go | 2 +- .../types/misbehaviour_handle_test.go | 20 ++ .../06-solomachine/types/misbehaviour_test.go | 12 ++ .../06-solomachine/types/solomachine.pb.go | 202 ++++++++++-------- x/ibc/testing/solomachine.go | 5 + 7 files changed, 157 insertions(+), 88 deletions(-) diff --git a/proto/ibc/lightclients/solomachine/v1/solomachine.proto b/proto/ibc/lightclients/solomachine/v1/solomachine.proto index 605af48b5b53..5903b1b651cf 100644 --- a/proto/ibc/lightclients/solomachine/v1/solomachine.proto +++ b/proto/ibc/lightclients/solomachine/v1/solomachine.proto @@ -63,6 +63,7 @@ message SignatureAndData { bytes signature = 1; DataType data_type = 2 [(gogoproto.moretags) = "yaml:\"data_type\""]; bytes data = 3; + uint64 timestamp = 4; } // TimestampedSignatureData contains the signature data and the timestamp of the diff --git a/x/ibc/light-clients/06-solomachine/types/misbehaviour.go b/x/ibc/light-clients/06-solomachine/types/misbehaviour.go index 8a54e23b6c43..1f97f323ce81 100644 --- a/x/ibc/light-clients/06-solomachine/types/misbehaviour.go +++ b/x/ibc/light-clients/06-solomachine/types/misbehaviour.go @@ -85,6 +85,9 @@ func (sd SignatureAndData) ValidateBasic() error { if sd.DataType == UNSPECIFIED { return sdkerrors.Wrap(ErrInvalidSignatureAndData, "data type cannot be UNSPECIFIED") } + if sd.Timestamp == 0 { + return sdkerrors.Wrap(ErrInvalidSignatureAndData, "timestamp cannot be 0") + } return nil } diff --git a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go index 45ae344cdcae..4abbbb19a57c 100644 --- a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go +++ b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go @@ -58,7 +58,7 @@ func verifySignatureAndData(cdc codec.BinaryMarshaler, clientState ClientState, data, err := MisbehaviourSignBytes( cdc, - misbehaviour.Sequence, clientState.ConsensusState.Timestamp, + misbehaviour.Sequence, sigAndData.Timestamp, clientState.ConsensusState.Diversifier, sigAndData.DataType, sigAndData.Data, diff --git a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go index bec4afaf277b..d8e9e45f41b3 100644 --- a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go +++ b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go @@ -75,6 +75,26 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { misbehaviour = m }, false, }, + { + "invalid SignatureOne timestamp", + func() { + clientState = solomachine.ClientState() + m := solomachine.CreateMisbehaviour() + + m.SignatureOne.Timestamp = 1000000000000 + misbehaviour = m + }, false, + }, + { + "invalid SignatureTwo timestamp", + func() { + clientState = solomachine.ClientState() + m := solomachine.CreateMisbehaviour() + + m.SignatureOne.Timestamp = 1000000000000 + misbehaviour = m + }, false, + }, { "invalid first signature data", func() { diff --git a/x/ibc/light-clients/06-solomachine/types/misbehaviour_test.go b/x/ibc/light-clients/06-solomachine/types/misbehaviour_test.go index a1138d5d801a..311dc8d8c85d 100644 --- a/x/ibc/light-clients/06-solomachine/types/misbehaviour_test.go +++ b/x/ibc/light-clients/06-solomachine/types/misbehaviour_test.go @@ -96,6 +96,18 @@ func (suite *SoloMachineTestSuite) TestMisbehaviourValidateBasic() { misbehaviour.SignatureTwo.DataType = types.UNSPECIFIED }, false, }, + { + "timestamp for SignatureOne is zero", + func(misbehaviour *types.Misbehaviour) { + misbehaviour.SignatureOne.Timestamp = 0 + }, false, + }, + { + "timestamp for SignatureTwo is zero", + func(misbehaviour *types.Misbehaviour) { + misbehaviour.SignatureTwo.Timestamp = 0 + }, false, + }, } for _, tc := range testCases { diff --git a/x/ibc/light-clients/06-solomachine/types/solomachine.pb.go b/x/ibc/light-clients/06-solomachine/types/solomachine.pb.go index 1d4f8cb2624a..833535da16ee 100644 --- a/x/ibc/light-clients/06-solomachine/types/solomachine.pb.go +++ b/x/ibc/light-clients/06-solomachine/types/solomachine.pb.go @@ -267,6 +267,7 @@ type SignatureAndData struct { Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` DataType DataType `protobuf:"varint,2,opt,name=data_type,json=dataType,proto3,enum=ibc.lightclients.solomachine.v1.DataType" json:"data_type,omitempty" yaml:"data_type"` Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + Timestamp uint64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (m *SignatureAndData) Reset() { *m = SignatureAndData{} } @@ -819,93 +820,93 @@ func init() { } var fileDescriptor_6cc2ee18f7f86d4e = []byte{ - // 1361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x8f, 0xdb, 0x54, - 0x10, 0x5f, 0xa7, 0xe9, 0x76, 0x33, 0xd9, 0x66, 0x83, 0x9b, 0xb6, 0x59, 0xb7, 0x4a, 0x8c, 0x11, - 0x65, 0x41, 0x34, 0x61, 0x8b, 0xa8, 0x50, 0x85, 0x00, 0xc7, 0x31, 0x34, 0xed, 0xae, 0x37, 0x38, - 0x5e, 0xa0, 0x15, 0x92, 0xe5, 0xd8, 0x6f, 0x13, 0x6b, 0x13, 0x3b, 0xc4, 0x4e, 0xd2, 0x20, 0x21, - 0x21, 0x4e, 0x25, 0xe2, 0xc0, 0x91, 0x4b, 0x24, 0x04, 0x42, 0xe2, 0xa3, 0x20, 0x71, 0x29, 0x37, - 0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00, + // 1368 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdf, 0x8f, 0xdb, 0xc4, + 0x13, 0x3f, 0xa7, 0xe9, 0xf5, 0x32, 0xb9, 0xe6, 0xf2, 0x75, 0xd3, 0x36, 0xe7, 0x56, 0x89, 0xbf, + 0x46, 0x94, 0x03, 0xd1, 0x84, 0x2b, 0xa2, 0x42, 0x15, 0x02, 0x1c, 0xc7, 0xd0, 0xb4, 0x77, 0xbe, + 0xe0, 0xf8, 0x80, 0x56, 0x48, 0x96, 0xe3, 0xec, 0x25, 0xd6, 0x25, 0x76, 0x88, 0x9d, 0xa4, 0x41, + 0x42, 0x42, 0x3c, 0x95, 0x88, 0x07, 0x1e, 0x79, 0x89, 0x84, 0x40, 0xfc, 0x2b, 0x08, 0x89, 0x97, + 0xf2, 0xc6, 0x53, 0x40, 0xed, 0x7f, 0x90, 0xbf, 0x00, 0xad, 0x77, 0x13, 0xdb, 0xb9, 0x5e, 0x4e, + 0xfc, 0x7a, 0xca, 0xee, 0xcc, 0x67, 0x3e, 0x33, 0x3b, 0x33, 0x99, 0x5d, 0xc3, 0xae, 0x55, 0x37, + 0x8b, 0x6d, 0xab, 0xd9, 0xf2, 0xcc, 0xb6, 0x85, 0x6c, 0xcf, 0x2d, 0xba, 0x4e, 0xdb, 0xe9, 0x18, + 0x66, 0xcb, 0xb2, 0x51, 0x71, 0xb0, 0x1b, 0xde, 0x16, 0xba, 0x3d, 0xc7, 0x73, 0xd8, 0xbc, 0x55, + 0x37, 0x0b, 0x61, 0x93, 0x42, 0x18, 0x33, 0xd8, 0xe5, 0x5e, 0xc2, 0x9c, 0xa6, 0xd3, 0x43, 0x45, + 0xd3, 0xb1, 0x6d, 0x64, 0x7a, 0x96, 0x63, 0x63, 0xaa, 0x60, 0x47, 0x98, 0xb8, 0xff, 0x07, 0xc0, + 0x96, 0x61, 0xdb, 0xa8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, 0xdf, 0xe5, 0xd7, 0x84, 0xef, 0x19, 0x48, + 0x45, 0x63, 0x65, 0xef, 0x01, 0x74, 0xfb, 0xf5, 0xb6, 0x65, 0xea, 0xc7, 0x68, 0xe4, 0x27, 0x36, + 0x79, 0x2b, 0x53, 0x20, 0x65, 0x29, 0xcc, 0xcb, 0x52, 0x10, 0xed, 0x51, 0xe9, 0xf2, 0x6c, 0x9a, + 0xff, 0x1f, 0x09, 0x22, 0xb0, 0x10, 0xd4, 0x04, 0xd9, 0xdc, 0x47, 0x23, 0x96, 0x87, 0x64, 0xc3, + 0x1a, 0xa0, 0x9e, 0x6b, 0x1d, 0x59, 0xa8, 0xe7, 0x97, 0x20, 0xa1, 0x86, 0x45, 0xec, 0x75, 0x48, + 0x78, 0x56, 0x07, 0xb9, 0x9e, 0xd1, 0xe9, 0xfa, 0xd9, 0x8d, 0xab, 0x81, 0x80, 0x06, 0xf9, 0x65, + 0x0c, 0xd6, 0xef, 0x22, 0xa3, 0x81, 0x7a, 0x2b, 0x6b, 0x1e, 0xa1, 0x8a, 0x2d, 0x51, 0x61, 0xad, + 0x6b, 0x35, 0x6d, 0xc3, 0xeb, 0xf7, 0x48, 0x19, 0x37, 0xd5, 0x40, 0xc0, 0x1e, 0x42, 0xca, 0x46, + 0x43, 0x3d, 0x74, 0xf0, 0xf8, 0x8a, 0x83, 0x6f, 0xcf, 0xa6, 0xf9, 0xcb, 0xe4, 0xe0, 0x51, 0x2b, + 0x41, 0xdd, 0xb4, 0xd1, 0xb0, 0xba, 0x38, 0xbf, 0x04, 0x5b, 0x18, 0x10, 0xce, 0xc1, 0x79, 0x9c, + 0x83, 0x70, 0x43, 0x2c, 0x01, 0x04, 0x15, 0x47, 0x52, 0x0e, 0x04, 0x34, 0x09, 0xbf, 0xc4, 0x60, + 0x73, 0xdf, 0x72, 0xeb, 0xa8, 0x65, 0x0c, 0x2c, 0xa7, 0xdf, 0x63, 0x77, 0x21, 0x41, 0x9a, 0x4f, + 0xb7, 0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0xcb, 0x3d, 0xc8, + 0x54, 0x0d, 0xf3, 0x18, 0x79, 0x92, 0xd3, 0xe9, 0x58, 0x5e, 0x07, 0xd9, 0xde, 0xa9, 0x9e, 0x72, + 0xf8, 0x78, 0x73, 0x94, 0xef, 0x6c, 0x53, 0x0d, 0x49, 0x84, 0x07, 0xb0, 0x4d, 0xb8, 0x44, 0xf3, + 0xd8, 0x76, 0x86, 0x6d, 0xd4, 0x68, 0xa2, 0x95, 0x84, 0x3b, 0xb0, 0x65, 0x44, 0xa1, 0x94, 0x75, + 0x59, 0x2c, 0x14, 0x20, 0x4b, 0xa8, 0x55, 0x64, 0x22, 0xab, 0xeb, 0x89, 0x75, 0x17, 0xcf, 0x81, + 0xd3, 0x98, 0x85, 0x16, 0x64, 0x14, 0xf4, 0xc8, 0x9b, 0x3f, 0xc0, 0x54, 0x64, 0x0e, 0x4e, 0x8d, + 0xe2, 0x2d, 0xb8, 0x68, 0xa3, 0x47, 0x1e, 0x7e, 0xbe, 0xe9, 0x3d, 0x64, 0x0e, 0xe8, 0xfb, 0x2e, + 0x74, 0x15, 0x44, 0xd4, 0x82, 0x9a, 0xb4, 0x09, 0x35, 0x66, 0x7d, 0xe5, 0xeb, 0x38, 0x6c, 0xcc, + 0x07, 0x03, 0xfb, 0x26, 0xbc, 0x50, 0x16, 0x35, 0x51, 0xd7, 0x1e, 0x54, 0x65, 0xfd, 0x50, 0xa9, + 0x28, 0x15, 0xad, 0x22, 0xee, 0x55, 0x1e, 0xca, 0x65, 0xfd, 0x50, 0xa9, 0x55, 0x65, 0xa9, 0xf2, + 0x5e, 0x45, 0x2e, 0xa7, 0xd7, 0xb8, 0xad, 0xf1, 0x84, 0x4f, 0x86, 0x44, 0xec, 0x0d, 0xb8, 0x12, + 0x58, 0x4a, 0x7b, 0x15, 0x59, 0xd1, 0xf4, 0x9a, 0x26, 0x6a, 0x72, 0x9a, 0xe1, 0x60, 0x3c, 0xe1, + 0xd7, 0x89, 0x8c, 0x7d, 0x15,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9, 0x71, 0xf1, 0xc7, 0x3f, + 0xe4, 0xd6, 0x4a, 0xfa, 0xcf, 0x4f, 0x73, 0xcc, 0x93, 0xa7, 0x39, 0xe6, 0x8f, 0xa7, 0x39, 0xe6, + 0x9b, 0x67, 0xb9, 0xb5, 0x27, 0xcf, 0x72, 0x6b, 0xbf, 0x3d, 0xcb, 0xad, 0x3d, 0x94, 0x9b, 0x96, + 0xd7, 0xea, 0xd7, 0x0b, 0xa6, 0xd3, 0x29, 0x9a, 0x8e, 0xdb, 0x71, 0x5c, 0xfa, 0x73, 0xd3, 0x6d, + 0x1c, 0x17, 0x1f, 0x15, 0x17, 0x1f, 0x59, 0x37, 0xe7, 0x5f, 0x59, 0xaf, 0xdd, 0xbe, 0x19, 0xfe, + 0xd0, 0xc2, 0xb7, 0x8c, 0x5b, 0x5f, 0xf7, 0xc7, 0xd9, 0xeb, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, + 0x20, 0x84, 0x51, 0xf7, 0x95, 0x0d, 0x00, 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -1148,6 +1149,11 @@ func (m *SignatureAndData) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Timestamp != 0 { + i = encodeVarintSolomachine(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x20 + } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) @@ -1727,6 +1733,9 @@ func (m *SignatureAndData) Size() (n int) { if l > 0 { n += 1 + l + sovSolomachine(uint64(l)) } + if m.Timestamp != 0 { + n += 1 + sovSolomachine(uint64(m.Timestamp)) + } return n } @@ -2698,6 +2707,25 @@ func (m *SignatureAndData) Unmarshal(dAtA []byte) error { m.Data = []byte{} } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSolomachine + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipSolomachine(dAtA[iNdEx:]) diff --git a/x/ibc/testing/solomachine.go b/x/ibc/testing/solomachine.go index c0f9befaa0a6..21b02516e9e2 100644 --- a/x/ibc/testing/solomachine.go +++ b/x/ibc/testing/solomachine.go @@ -181,8 +181,12 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour { Signature: sig, DataType: solomachinetypes.CLIENT, Data: dataOne, + Timestamp: solo.Time, } + // misbehaviour signaturess can have different timestamps + solo.Time++ + signBytes = &solomachinetypes.SignBytes{ Sequence: solo.Sequence, Timestamp: solo.Time, @@ -199,6 +203,7 @@ func (solo *Solomachine) CreateMisbehaviour() *solomachinetypes.Misbehaviour { Signature: sig, DataType: solomachinetypes.CONSENSUS, Data: dataTwo, + Timestamp: solo.Time, } return &solomachinetypes.Misbehaviour{ From a18352176e4e3a4eddd0767be191f0fc23ccea9a Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Mon, 12 Oct 2020 15:24:39 +0200 Subject: [PATCH 2/4] fix typo --- .../06-solomachine/types/misbehaviour_handle_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go index d8e9e45f41b3..0d6318384bb2 100644 --- a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go +++ b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go @@ -91,7 +91,7 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { clientState = solomachine.ClientState() m := solomachine.CreateMisbehaviour() - m.SignatureOne.Timestamp = 1000000000000 + m.SignatureTwo.Timestamp = 1000000000000 misbehaviour = m }, false, }, From ce62980a6c0f9f72fca3e365dd9d5127f10e23f1 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Mon, 12 Oct 2020 15:31:05 +0200 Subject: [PATCH 3/4] add timestamp check --- .../06-solomachine/types/misbehaviour_handle.go | 9 ++++++++- .../06-solomachine/types/misbehaviour_handle_test.go | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go index 4abbbb19a57c..de6415e933ef 100644 --- a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go +++ b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go @@ -49,8 +49,15 @@ 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. +// unmarshaled into the specified data type or the timestamp of the signature is less +// than the consensus state timestamp. func verifySignatureAndData(cdc codec.BinaryMarshaler, clientState ClientState, misbehaviour *Misbehaviour, sigAndData *SignatureAndData) error { + // timestamp less than consensus state would always fail and not succeed in fooling the + // light client + if sigAndData.Timestamp < clientState.ConsensusState.Timestamp { + return sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour, "timestamp is less than consensus state timestmap (%d < %d)", sigAndData.Timestamp, clientState.ConsensusState.Timestamp) + } + // ensure data can be unmarshaled to the specified data type if _, err := UnmarshalDataByType(cdc, sigAndData.DataType, sigAndData.Data); err != nil { return err diff --git a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go index 0d6318384bb2..fd5871adc630 100644 --- a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go +++ b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle_test.go @@ -95,6 +95,14 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() { misbehaviour = m }, false, }, + { + "timestamp is less than consensus state timestamp", + func() { + clientState = solomachine.ClientState() + solomachine.Time = solomachine.Time - 5 + misbehaviour = solomachine.CreateMisbehaviour() + }, false, + }, { "invalid first signature data", func() { From 3b333799ab66afcec33222810d1c4e905e4d0edd Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Mon, 12 Oct 2020 15:35:41 +0200 Subject: [PATCH 4/4] fix lint --- x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go index de6415e933ef..2fcbe75c7a5e 100644 --- a/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go +++ b/x/ibc/light-clients/06-solomachine/types/misbehaviour_handle.go @@ -55,7 +55,7 @@ func verifySignatureAndData(cdc codec.BinaryMarshaler, clientState ClientState, // timestamp less than consensus state would always fail and not succeed in fooling the // light client if sigAndData.Timestamp < clientState.ConsensusState.Timestamp { - return sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour, "timestamp is less than consensus state timestmap (%d < %d)", sigAndData.Timestamp, clientState.ConsensusState.Timestamp) + return sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour, "timestamp is less than consensus state timestamp (%d < %d)", sigAndData.Timestamp, clientState.ConsensusState.Timestamp) } // ensure data can be unmarshaled to the specified data type