Migrate tendermint consensus state to proto (#6957)

* migrate tm consensus state to proto

* update con state

* register con state

* add confio to proto lint exclude

* Update proto/ibc/tendermint/tendermint.proto

* casttype to hexbytes

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
colin axnér 2020-08-06 11:21:56 +02:00 committed by GitHub
parent ba140c90f5
commit 3076a8b12e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 370 additions and 47 deletions

View File

@ -18,6 +18,7 @@ lint:
- tendermint - tendermint
- gogoproto - gogoproto
- cosmos_proto - cosmos_proto
- confio
breaking: breaking:
use: use:
- FILE - FILE

View File

@ -5,6 +5,8 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types";
import "confio/proofs.proto"; import "confio/proofs.proto";
import "google/protobuf/duration.proto"; import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "ibc/commitment/commitment.proto";
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
// ClientState from Tendermint tracks the current validator set, latest height, // ClientState from Tendermint tracks the current validator set, latest height,
@ -45,6 +47,24 @@ message ClientState {
[(gogoproto.moretags) = "yaml:\"proof_specs\""]; [(gogoproto.moretags) = "yaml:\"proof_specs\""];
} }
// ConsensusState defines the consensus state from Tendermint.
message ConsensusState {
option (gogoproto.goproto_getters) = false;
// timestamp that corresponds to the block height in which the ConsensusState
// was stored.
google.protobuf.Timestamp timestamp = 1
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// commitment root (i.e app hash)
ibc.commitment.MerkleRoot root = 2 [(gogoproto.nullable) = false];
// height at which the consensus state was stored.
uint64 height = 3;
bytes next_validators_hash = 4 [
(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes",
(gogoproto.moretags) = "yaml:\"next_validators_hash\""
];
}
// Fraction defines the protobuf message type for tmmath.Fraction // Fraction defines the protobuf message type for tmmath.Fraction
message Fraction { message Fraction {
int64 numerator = 1; int64 numerator = 1;

View File

@ -26,6 +26,10 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
(*clientexported.ClientState)(nil), (*clientexported.ClientState)(nil),
&ClientState{}, &ClientState{},
) )
registry.RegisterImplementations(
(*clientexported.ConsensusState)(nil),
&ConsensusState{},
)
} }
var ( var (

View File

@ -10,19 +10,12 @@ import (
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
) )
// ConsensusState defines a Tendermint consensus state
type ConsensusState struct {
Timestamp time.Time `json:"timestamp" yaml:"timestamp"`
Root commitmentexported.Root `json:"root" yaml:"root"`
Height uint64 `json:"height" yaml:"height"`
NextValidatorsHash tmbytes.HexBytes `json:"next_validators_hash"` // validators hash for the next block
}
// NewConsensusState creates a new ConsensusState instance. // NewConsensusState creates a new ConsensusState instance.
func NewConsensusState( func NewConsensusState(
timestamp time.Time, root commitmentexported.Root, height uint64, timestamp time.Time, root commitmenttypes.MerkleRoot, height uint64,
nextValsHash tmbytes.HexBytes, nextValsHash tmbytes.HexBytes,
) ConsensusState { ) ConsensusState {
return ConsensusState{ return ConsensusState{
@ -55,7 +48,7 @@ func (cs ConsensusState) GetTimestamp() uint64 {
// ValidateBasic defines a basic validation for the tendermint consensus state. // ValidateBasic defines a basic validation for the tendermint consensus state.
func (cs ConsensusState) ValidateBasic() error { func (cs ConsensusState) ValidateBasic() error {
if cs.Root == nil || cs.Root.Empty() { if cs.Root.Empty() {
return sdkerrors.Wrap(clienttypes.ErrInvalidConsensus, "root cannot be empty") return sdkerrors.Wrap(clienttypes.ErrInvalidConsensus, "root cannot be empty")
} }
if err := tmtypes.ValidateHash(cs.NextValidatorsHash); err != nil { if err := tmtypes.ValidateHash(cs.NextValidatorsHash); err != nil {

View File

@ -26,7 +26,7 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
ibctmtypes.ConsensusState{ ibctmtypes.ConsensusState{
Timestamp: suite.now, Timestamp: suite.now,
Height: height, Height: height,
Root: nil, Root: commitmenttypes.MerkleRoot{},
NextValidatorsHash: suite.valsHash, NextValidatorsHash: suite.valsHash,
}, },
false}, false},

View File

@ -6,10 +6,13 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
_go "github.com/confio/ics23/go" _go "github.com/confio/ics23/go"
types "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
_ "github.com/golang/protobuf/ptypes/duration" _ "github.com/golang/protobuf/ptypes/duration"
_ "github.com/golang/protobuf/ptypes/timestamp"
github_com_tendermint_tendermint_libs_bytes "github.com/tendermint/tendermint/libs/bytes"
io "io" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
@ -81,6 +84,51 @@ func (m *ClientState) XXX_DiscardUnknown() {
var xxx_messageInfo_ClientState proto.InternalMessageInfo var xxx_messageInfo_ClientState proto.InternalMessageInfo
// ConsensusState defines the consensus state from Tendermint.
type ConsensusState struct {
// timestamp that corresponds to the block height in which the ConsensusState
// was stored.
Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"`
// commitment root (i.e app hash)
Root types.MerkleRoot `protobuf:"bytes,2,opt,name=root,proto3" json:"root"`
// height at which the consensus state was stored.
Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
NextValidatorsHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,4,opt,name=next_validators_hash,json=nextValidatorsHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"next_validators_hash,omitempty" yaml:"next_validators_hash"`
}
func (m *ConsensusState) Reset() { *m = ConsensusState{} }
func (m *ConsensusState) String() string { return proto.CompactTextString(m) }
func (*ConsensusState) ProtoMessage() {}
func (*ConsensusState) Descriptor() ([]byte, []int) {
return fileDescriptor_76a953d5a747dd66, []int{1}
}
func (m *ConsensusState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ConsensusState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ConsensusState) XXX_Merge(src proto.Message) {
xxx_messageInfo_ConsensusState.Merge(m, src)
}
func (m *ConsensusState) XXX_Size() int {
return m.Size()
}
func (m *ConsensusState) XXX_DiscardUnknown() {
xxx_messageInfo_ConsensusState.DiscardUnknown(m)
}
var xxx_messageInfo_ConsensusState proto.InternalMessageInfo
// Fraction defines the protobuf message type for tmmath.Fraction // Fraction defines the protobuf message type for tmmath.Fraction
type Fraction struct { type Fraction struct {
Numerator int64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"` Numerator int64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"`
@ -91,7 +139,7 @@ func (m *Fraction) Reset() { *m = Fraction{} }
func (m *Fraction) String() string { return proto.CompactTextString(m) } func (m *Fraction) String() string { return proto.CompactTextString(m) }
func (*Fraction) ProtoMessage() {} func (*Fraction) ProtoMessage() {}
func (*Fraction) Descriptor() ([]byte, []int) { func (*Fraction) Descriptor() ([]byte, []int) {
return fileDescriptor_76a953d5a747dd66, []int{1} return fileDescriptor_76a953d5a747dd66, []int{2}
} }
func (m *Fraction) XXX_Unmarshal(b []byte) error { func (m *Fraction) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -136,47 +184,59 @@ func (m *Fraction) GetDenominator() int64 {
func init() { func init() {
proto.RegisterType((*ClientState)(nil), "ibc.tendermint.ClientState") proto.RegisterType((*ClientState)(nil), "ibc.tendermint.ClientState")
proto.RegisterType((*ConsensusState)(nil), "ibc.tendermint.ConsensusState")
proto.RegisterType((*Fraction)(nil), "ibc.tendermint.Fraction") proto.RegisterType((*Fraction)(nil), "ibc.tendermint.Fraction")
} }
func init() { proto.RegisterFile("ibc/tendermint/tendermint.proto", fileDescriptor_76a953d5a747dd66) } func init() { proto.RegisterFile("ibc/tendermint/tendermint.proto", fileDescriptor_76a953d5a747dd66) }
var fileDescriptor_76a953d5a747dd66 = []byte{ var fileDescriptor_76a953d5a747dd66 = []byte{
// 541 bytes of a gzipped FileDescriptorProto // 710 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x31, 0x6f, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6a, 0xdb, 0x4c,
0x18, 0x8d, 0x9b, 0xb4, 0x49, 0xcf, 0x6d, 0x53, 0x99, 0xaa, 0x98, 0x08, 0xd9, 0x91, 0x91, 0x50, 0x14, 0xb5, 0x12, 0x27, 0x71, 0x46, 0xf9, 0x43, 0x5f, 0xc8, 0xa7, 0xba, 0xc5, 0x32, 0x2a, 0x14,
0x96, 0xda, 0x28, 0x95, 0x40, 0xaa, 0xc4, 0xe2, 0x44, 0x88, 0x20, 0x86, 0xc8, 0x15, 0x0b, 0x8b, 0x6f, 0x22, 0x15, 0x27, 0xb4, 0x10, 0xe8, 0x46, 0x0e, 0x25, 0x29, 0x2d, 0x04, 0xa5, 0x3f, 0xd0,
0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x5f, 0x75, 0x1a, 0xef, 0x9f, 0xd4, 0x9e, 0xda, 0x27, 0x34, 0x21,
0xb4, 0xfc, 0xd9, 0xa6, 0xc1, 0x89, 0x39, 0x32, 0xf9, 0xa7, 0xe8, 0xf1, 0xd3, 0xed, 0xfa, 0x41,
0x67, 0x29, 0xa4, 0xde, 0xa2, 0xf8, 0x9b, 0x76, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x81,
0xb1, 0x35, 0x33, 0x05, 0x00, 0x00,
} }
func (m *ClientState) Marshal() (dAtA []byte, err error) { func (m *ClientState) Marshal() (dAtA []byte, err error) {
@ -267,6 +327,59 @@ func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ConsensusState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ConsensusState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.NextValidatorsHash) > 0 {
i -= len(m.NextValidatorsHash)
copy(dAtA[i:], m.NextValidatorsHash)
i = encodeVarintTendermint(dAtA, i, uint64(len(m.NextValidatorsHash)))
i--
dAtA[i] = 0x22
}
if m.Height != 0 {
i = encodeVarintTendermint(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x18
}
{
size, err := m.Root.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTendermint(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):])
if err6 != nil {
return 0, err6
}
i -= n6
i = encodeVarintTendermint(dAtA, i, uint64(n6))
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *Fraction) Marshal() (dAtA []byte, err error) { func (m *Fraction) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
@ -344,6 +457,26 @@ func (m *ClientState) Size() (n int) {
return n return n
} }
func (m *ConsensusState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp)
n += 1 + l + sovTendermint(uint64(l))
l = m.Root.Size()
n += 1 + l + sovTendermint(uint64(l))
if m.Height != 0 {
n += 1 + sovTendermint(uint64(m.Height))
}
l = len(m.NextValidatorsHash)
if l > 0 {
n += 1 + l + sovTendermint(uint64(l))
}
return n
}
func (m *Fraction) Size() (n int) { func (m *Fraction) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
@ -654,6 +787,178 @@ func (m *ClientState) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *ConsensusState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTendermint
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ConsensusState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ConsensusState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTendermint
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTendermint
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTendermint
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Root", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTendermint
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTendermint
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTendermint
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Root.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTendermint
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTendermint
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTendermint
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTendermint
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NextValidatorsHash = append(m.NextValidatorsHash[:0], dAtA[iNdEx:postIndex]...)
if m.NextValidatorsHash == nil {
m.NextValidatorsHash = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTendermint(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTendermint
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTendermint
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Fraction) Unmarshal(dAtA []byte) error { func (m *Fraction) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0