diff --git a/modules/light-clients/06-solomachine/header.go b/modules/light-clients/06-solomachine/header.go index 633c25425bc..382eddfe34e 100644 --- a/modules/light-clients/06-solomachine/header.go +++ b/modules/light-clients/06-solomachine/header.go @@ -36,13 +36,9 @@ func (h Header) GetPubKey() (cryptotypes.PubKey, error) { return publicKey, nil } -// ValidateBasic ensures that the sequence, signature and public key have all +// ValidateBasic ensures that the timestamp, signature and public key have all // been initialized. func (h Header) ValidateBasic() error { - if h.Sequence == 0 { - return sdkerrors.Wrap(clienttypes.ErrInvalidHeader, "sequence number cannot be zero") - } - if h.Timestamp == 0 { return sdkerrors.Wrap(clienttypes.ErrInvalidHeader, "timestamp cannot be zero") } diff --git a/modules/light-clients/06-solomachine/header_test.go b/modules/light-clients/06-solomachine/header_test.go index 7d752d88a8c..4aa9e506711 100644 --- a/modules/light-clients/06-solomachine/header_test.go +++ b/modules/light-clients/06-solomachine/header_test.go @@ -22,21 +22,9 @@ func (suite *SoloMachineTestSuite) TestHeaderValidateBasic() { header, true, }, - { - "sequence is zero", - &solomachine.Header{ - Sequence: 0, - Timestamp: header.Timestamp, - Signature: header.Signature, - NewPublicKey: header.NewPublicKey, - NewDiversifier: header.NewDiversifier, - }, - false, - }, { "timestamp is zero", &solomachine.Header{ - Sequence: header.Sequence, Timestamp: 0, Signature: header.Signature, NewPublicKey: header.NewPublicKey, @@ -47,7 +35,6 @@ func (suite *SoloMachineTestSuite) TestHeaderValidateBasic() { { "signature is empty", &solomachine.Header{ - Sequence: header.Sequence, Timestamp: header.Timestamp, Signature: []byte{}, NewPublicKey: header.NewPublicKey, @@ -58,7 +45,6 @@ func (suite *SoloMachineTestSuite) TestHeaderValidateBasic() { { "diversifier contains only spaces", &solomachine.Header{ - Sequence: header.Sequence, Timestamp: header.Timestamp, Signature: header.Signature, NewPublicKey: header.NewPublicKey, @@ -69,7 +55,6 @@ func (suite *SoloMachineTestSuite) TestHeaderValidateBasic() { { "public key is nil", &solomachine.Header{ - Sequence: header.Sequence, Timestamp: header.Timestamp, Signature: header.Signature, NewPublicKey: nil, diff --git a/modules/light-clients/06-solomachine/solomachine.pb.go b/modules/light-clients/06-solomachine/solomachine.pb.go index 7d2f64ed5ce..a53e2f0380f 100644 --- a/modules/light-clients/06-solomachine/solomachine.pb.go +++ b/modules/light-clients/06-solomachine/solomachine.pb.go @@ -115,12 +115,10 @@ var xxx_messageInfo_ConsensusState proto.InternalMessageInfo // Header defines a solo machine consensus header type Header struct { - // sequence to update solo machine public key at - Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` - Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` - NewPublicKey *types.Any `protobuf:"bytes,4,opt,name=new_public_key,json=newPublicKey,proto3" json:"new_public_key,omitempty" yaml:"new_public_key"` - NewDiversifier string `protobuf:"bytes,5,opt,name=new_diversifier,json=newDiversifier,proto3" json:"new_diversifier,omitempty" yaml:"new_diversifier"` + Timestamp uint64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + NewPublicKey *types.Any `protobuf:"bytes,3,opt,name=new_public_key,json=newPublicKey,proto3" json:"new_public_key,omitempty" yaml:"new_public_key"` + NewDiversifier string `protobuf:"bytes,4,opt,name=new_diversifier,json=newDiversifier,proto3" json:"new_diversifier,omitempty" yaml:"new_diversifier"` } func (m *Header) Reset() { *m = Header{} } @@ -383,52 +381,52 @@ func init() { } var fileDescriptor_264187157b9220a4 = []byte{ - // 711 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x4e, 0xdb, 0x4a, - 0x14, 0xce, 0x04, 0x83, 0xc8, 0x24, 0x37, 0x70, 0xad, 0x80, 0x42, 0x74, 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xc8, 0xad, 0xea, 0xd2, 0xcd, 0x55, 0x9d, 0x0b, 0xa7, 0xdc, 0x22, 0xdc, 0x72, 0x22, 0x5c, 0x8c, - 0xeb, 0x2b, 0x80, 0x30, 0x5a, 0x5a, 0x49, 0xe5, 0x14, 0x96, 0xe3, 0x55, 0xb9, 0xf7, 0xb3, 0xb2, - 0x39, 0x9b, 0x6a, 0x6a, 0x66, 0xbb, 0xe2, 0xef, 0x4a, 0xb4, 0x5a, 0x3f, 0xd9, 0xab, 0xe2, 0xaf, - 0xed, 0x55, 0xbb, 0xf7, 0xed, 0xaa, 0x09, 0x2e, 0xae, 0x9a, 0xe0, 0xfb, 0x55, 0x13, 0x7c, 0xb8, - 0x6e, 0x16, 0x2e, 0xae, 0x9b, 0x85, 0xcb, 0xeb, 0x66, 0xe1, 0xc5, 0xa9, 0x4b, 0x44, 0x3f, 0xb0, - 0x0d, 0x87, 0xf9, 0xa6, 0xc3, 0xb8, 0xcf, 0xb8, 0x49, 0x6c, 0x67, 0xc7, 0x65, 0xe6, 0xe8, 0xc0, - 0xf4, 0x59, 0x37, 0xf0, 0x30, 0x8f, 0xfe, 0x4d, 0x3b, 0xf3, 0x9f, 0xd3, 0xbf, 0x07, 0x3b, 0xa9, - 0xf1, 0xfe, 0x2f, 0x75, 0xb6, 0x57, 0x24, 0xc7, 0xfd, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdb, - 0x7e, 0xaf, 0x7a, 0xd2, 0x06, 0x00, 0x00, + // 708 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, + 0x14, 0xce, 0xa4, 0xbe, 0x55, 0x33, 0xc9, 0x4d, 0x7b, 0xad, 0xb4, 0x4a, 0xa3, 0xab, 0x38, 0xf2, + 0xaa, 0x9b, 0xda, 0xb7, 0xad, 0xd4, 0x45, 0xef, 0x86, 0xa6, 0x15, 0x42, 0x50, 0x04, 0x72, 0xcb, + 0x86, 0x4d, 0x34, 0x76, 0x26, 0xce, 0x08, 0x7b, 0x26, 0x64, 0xc6, 0x89, 0x82, 0x58, 0xb0, 0x64, + 0xc9, 0x02, 0xf6, 0x08, 0x89, 0x77, 0x61, 0xd9, 0x65, 0x57, 0x11, 0x6a, 0x25, 0x1e, 0x20, 0x4f, + 0x80, 0x3c, 0x76, 0xe2, 0x9f, 0x96, 0x54, 0x42, 0xec, 0xe6, 0x9c, 0x39, 0x3f, 0xdf, 0xf7, 0xcd, + 0x39, 0x36, 0xdc, 0x23, 0xb6, 0x63, 0x7a, 0xc4, 0xed, 0x0b, 0xc7, 0x23, 0x98, 0x0a, 0x6e, 0x72, + 0xe6, 0x31, 0x1f, 0x39, 0x7d, 0x42, 0xb1, 0x39, 0x3a, 0x48, 0x9b, 0xc6, 0x60, 0xc8, 0x04, 0x53, + 0x35, 0x62, 0x3b, 0x46, 0x3a, 0xc5, 0x48, 0xc7, 0x8c, 0x0e, 0x1a, 0x35, 0x97, 0xb9, 0x4c, 0xc6, + 0x9a, 0xe1, 0x29, 0x4a, 0x6b, 0x6c, 0xbb, 0x8c, 0xb9, 0x1e, 0x36, 0xa5, 0x65, 0x07, 0x3d, 0x13, + 0xd1, 0x49, 0x74, 0xa5, 0x5f, 0x01, 0x58, 0x3e, 0x91, 0xb5, 0xce, 0x05, 0x12, 0x58, 0x6d, 0xc0, + 0x35, 0x8e, 0x5f, 0x07, 0x98, 0x3a, 0xb8, 0x0e, 0x5a, 0x60, 0x47, 0xb1, 0x16, 0xb6, 0xba, 0x07, + 0x4b, 0x84, 0x77, 0x7a, 0x43, 0xf6, 0x06, 0xd3, 0x7a, 0xb1, 0x05, 0x76, 0xd6, 0xda, 0xb5, 0xd9, + 0x54, 0xdb, 0x98, 0x20, 0xdf, 0x3b, 0xd2, 0x17, 0x57, 0xba, 0xb5, 0x46, 0xf8, 0x43, 0x79, 0x54, + 0x05, 0x5c, 0x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46, 0x8b, 0x29, 0xa9, 0x9c, 0xc1, 0x72, 0xbc, 0x2a, 0xf7, 0x7e, 0x3a, 0xb6, 0x66, 0x53, + 0x4d, 0xcd, 0x6c, 0x57, 0xfc, 0xed, 0x88, 0x56, 0xeb, 0x17, 0x7b, 0x55, 0xfc, 0xbd, 0xbd, 0x6a, + 0xf7, 0xbe, 0x5d, 0x37, 0xc1, 0xe5, 0x75, 0x13, 0x7c, 0xbf, 0x6e, 0x82, 0x0f, 0x37, 0xcd, 0xc2, + 0xe5, 0x4d, 0xb3, 0x70, 0x75, 0xd3, 0x2c, 0xbc, 0x3c, 0x73, 0x89, 0xe8, 0x07, 0xb6, 0xe1, 0x30, + 0xdf, 0x74, 0x18, 0xf7, 0x19, 0x37, 0x89, 0xed, 0xec, 0xba, 0xcc, 0x1c, 0x1d, 0x9a, 0x3e, 0xeb, + 0x06, 0x1e, 0xe6, 0xd1, 0xff, 0x67, 0x77, 0xfe, 0x03, 0xfa, 0xef, 0x70, 0x37, 0x35, 0xde, 0xff, + 0xa7, 0xce, 0xf6, 0xaa, 0xe4, 0x78, 0xf0, 0x33, 0x00, 0x00, 0xff, 0xff, 0x01, 0xee, 0x32, 0x83, + 0xb6, 0x06, 0x00, 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -553,7 +551,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.NewDiversifier) i = encodeVarintSolomachine(dAtA, i, uint64(len(m.NewDiversifier))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if m.NewPublicKey != nil { { @@ -565,23 +563,18 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintSolomachine(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) i = encodeVarintSolomachine(dAtA, i, uint64(len(m.Signature))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if m.Timestamp != 0 { i = encodeVarintSolomachine(dAtA, i, uint64(m.Timestamp)) i-- - dAtA[i] = 0x10 - } - if m.Sequence != 0 { - i = encodeVarintSolomachine(dAtA, i, uint64(m.Sequence)) - i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -875,9 +868,6 @@ func (m *Header) Size() (n int) { } var l int _ = l - if m.Sequence != 0 { - n += 1 + sovSolomachine(uint64(m.Sequence)) - } if m.Timestamp != 0 { n += 1 + sovSolomachine(uint64(m.Timestamp)) } @@ -1298,25 +1288,6 @@ func (m *Header) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSolomachine - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } @@ -1335,7 +1306,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { break } } - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } @@ -1369,7 +1340,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NewPublicKey", wireType) } @@ -1405,7 +1376,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NewDiversifier", wireType) } diff --git a/modules/light-clients/06-solomachine/update.go b/modules/light-clients/06-solomachine/update.go index 2ccd4d74add..fc1bab93601 100644 --- a/modules/light-clients/06-solomachine/update.go +++ b/modules/light-clients/06-solomachine/update.go @@ -26,14 +26,6 @@ func (cs ClientState) VerifyClientMessage(ctx sdk.Context, cdc codec.BinaryCodec } func (cs ClientState) verifyHeader(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, header *Header) error { - // assert update sequence is current sequence - if header.Sequence != cs.Sequence { - return sdkerrors.Wrapf( - clienttypes.ErrInvalidHeader, - "header sequence does not match the client state sequence (%d != %d)", header.Sequence, cs.Sequence, - ) - } - // assert update timestamp is not less than current consensus state timestamp if header.Timestamp < cs.ConsensusState.Timestamp { return sdkerrors.Wrapf( @@ -54,7 +46,7 @@ func (cs ClientState) verifyHeader(ctx sdk.Context, cdc codec.BinaryCodec, clien } signBytes := &SignBytes{ - Sequence: header.Sequence, + Sequence: cs.Sequence, Timestamp: header.Timestamp, Diversifier: cs.ConsensusState.Diversifier, Path: []byte(SentinelHeaderPath), diff --git a/modules/light-clients/06-solomachine/update_test.go b/modules/light-clients/06-solomachine/update_test.go index a8311fbcfbf..8a251dc22cf 100644 --- a/modules/light-clients/06-solomachine/update_test.go +++ b/modules/light-clients/06-solomachine/update_test.go @@ -54,16 +54,6 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() { }, false, }, - { - "wrong sequence in header", - func() { - // store in temp before assigning to interface type - h := sm.CreateHeader(sm.Diversifier) - h.Sequence++ - clientMsg = h - }, - false, - }, { "invalid header Signature", func() { @@ -458,7 +448,6 @@ func (suite *SoloMachineTestSuite) TestUpdateState() { suite.Require().Equal(newClientState.(*solomachine.ClientState).Sequence, consensusHeights[0].GetRevisionHeight()) suite.Require().False(newClientState.(*solomachine.ClientState).IsFrozen) - suite.Require().Equal(clientMsg.(*solomachine.Header).Sequence+1, newClientState.(*solomachine.ClientState).Sequence) suite.Require().Equal(clientMsg.(*solomachine.Header).NewPublicKey, newClientState.(*solomachine.ClientState).ConsensusState.PublicKey) suite.Require().Equal(clientMsg.(*solomachine.Header).NewDiversifier, newClientState.(*solomachine.ClientState).ConsensusState.Diversifier) suite.Require().Equal(clientMsg.(*solomachine.Header).Timestamp, newClientState.(*solomachine.ClientState).ConsensusState.Timestamp) diff --git a/proto/ibc/lightclients/solomachine/v3/solomachine.proto b/proto/ibc/lightclients/solomachine/v3/solomachine.proto index 8203c17796b..09bc97a9aa7 100644 --- a/proto/ibc/lightclients/solomachine/v3/solomachine.proto +++ b/proto/ibc/lightclients/solomachine/v3/solomachine.proto @@ -35,12 +35,11 @@ message ConsensusState { // Header defines a solo machine consensus header message Header { option (gogoproto.goproto_getters) = false; - // sequence to update solo machine public key at - uint64 sequence = 1; - uint64 timestamp = 2; - bytes signature = 3; - google.protobuf.Any new_public_key = 4 [(gogoproto.moretags) = "yaml:\"new_public_key\""]; - string new_diversifier = 5 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + + uint64 timestamp = 1; + bytes signature = 2; + google.protobuf.Any new_public_key = 3 [(gogoproto.moretags) = "yaml:\"new_public_key\""]; + string new_diversifier = 4 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; } // Misbehaviour defines misbehaviour for a solo machine which consists @@ -57,18 +56,20 @@ message Misbehaviour { // signature. message SignatureAndData { option (gogoproto.goproto_getters) = false; - bytes signature = 1; - bytes path = 2; - bytes data = 3; - uint64 timestamp = 4; + + bytes signature = 1; + bytes path = 2; + bytes data = 3; + uint64 timestamp = 4; } // TimestampedSignatureData contains the signature data and the timestamp of the // signature. message TimestampedSignatureData { option (gogoproto.goproto_getters) = false; - bytes signature_data = 1 [(gogoproto.moretags) = "yaml:\"signature_data\""]; - uint64 timestamp = 2; + + bytes signature_data = 1 [(gogoproto.moretags) = "yaml:\"signature_data\""]; + uint64 timestamp = 2; } // SignBytes defines the signed bytes used for signature verification. diff --git a/testing/solomachine.go b/testing/solomachine.go index 0b996781f0a..21dcd67ebcd 100644 --- a/testing/solomachine.go +++ b/testing/solomachine.go @@ -174,7 +174,6 @@ func (solo *Solomachine) CreateHeader(newDiversifier string) *solomachine.Header sig := solo.GenerateSignature(bz) header := &solomachine.Header{ - Sequence: solo.Sequence, Timestamp: solo.Time, Signature: sig, NewPublicKey: publicKey,