diff --git a/crypto/encoding/codec.go b/crypto/encoding/codec.go new file mode 100644 index 000000000..05d64e00e --- /dev/null +++ b/crypto/encoding/codec.go @@ -0,0 +1,75 @@ +package encoding + +import ( + "errors" + "fmt" + + "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/crypto/ed25519" + pc "github.com/tendermint/tendermint/proto/crypto/keys" +) + +// PubKeyToProto takes crypto.PubKey and transforms it to a protobuf Pubkey +func PubKeyToProto(k crypto.PubKey) (pc.PublicKey, error) { + var kp pc.PublicKey + switch k := k.(type) { + case ed25519.PubKeyEd25519: + kp = pc.PublicKey{ + Sum: &pc.PublicKey_Ed25519{ + Ed25519: k[:], + }, + } + default: + return kp, fmt.Errorf("toproto: key type %v is not supported", k) + } + return kp, nil +} + +// PubKeyFromProto takes a protobuf Pubkey and transforms it to a crypto.Pubkey +func PubKeyFromProto(k pc.PublicKey) (crypto.PubKey, error) { + switch k := k.Sum.(type) { + case *pc.PublicKey_Ed25519: + if len(k.Ed25519) != ed25519.PubKeyEd25519Size { + return nil, fmt.Errorf("invalid size for PubKeyEd25519. Got %d, expected %d", + len(k.Ed25519), ed25519.PubKeyEd25519Size) + } + var pk ed25519.PubKeyEd25519 + copy(pk[:], k.Ed25519) + return pk, nil + default: + return nil, fmt.Errorf("fromproto: key type %v is not supported", k) + } +} + +// PrivKeyToProto takes crypto.PrivKey and transforms it to a protobuf PrivKey +func PrivKeyToProto(k crypto.PrivKey) (pc.PrivateKey, error) { + var kp pc.PrivateKey + switch k := k.(type) { + case ed25519.PrivKeyEd25519: + kp = pc.PrivateKey{ + Sum: &pc.PrivateKey_Ed25519{ + Ed25519: k[:], + }, + } + default: + return kp, errors.New("toproto: key type is not supported") + } + return kp, nil +} + +// PrivKeyFromProto takes a protobuf PrivateKey and transforms it to a crypto.PrivKey +func PrivKeyFromProto(k pc.PrivateKey) (crypto.PrivKey, error) { + switch k := k.Sum.(type) { + case *pc.PrivateKey_Ed25519: + + if len(k.Ed25519) != ed25519.PubKeyEd25519Size { + return nil, fmt.Errorf("invalid size for PubKeyEd25519. Got %d, expected %d", + len(k.Ed25519), ed25519.PubKeyEd25519Size) + } + var pk ed25519.PrivKeyEd25519 + copy(pk[:], k.Ed25519) + return pk, nil + default: + return nil, errors.New("fromproto: key type not supported") + } +} diff --git a/libs/bits/bit_array.go b/libs/bits/bit_array.go index 81740336e..2483d76cc 100644 --- a/libs/bits/bit_array.go +++ b/libs/bits/bit_array.go @@ -9,6 +9,7 @@ import ( tmmath "github.com/tendermint/tendermint/libs/math" tmrand "github.com/tendermint/tendermint/libs/rand" + tmprotobits "github.com/tendermint/tendermint/proto/libs/bits" ) // BitArray is a thread-safe implementation of a bit array. @@ -418,3 +419,28 @@ func (bA *BitArray) UnmarshalJSON(bz []byte) error { *bA = *bA2 //nolint:govet return nil } + +// ToProto converts BitArray to protobuf +func (bA *BitArray) ToProto() *tmprotobits.BitArray { + if bA == nil || len(bA.Elems) == 0 { + return nil + } + + return &tmprotobits.BitArray{ + Bits: int64(bA.Bits), + Elems: bA.Elems, + } +} + +// FromProto sets a protobuf BitArray to the given pointer. +func (bA *BitArray) FromProto(protoBitArray *tmprotobits.BitArray) { + if protoBitArray == nil { + bA = nil + return + } + + bA.Bits = int(protoBitArray.Bits) + if len(protoBitArray.Elems) > 0 { + bA.Elems = protoBitArray.Elems + } +} diff --git a/libs/bits/bit_array_test.go b/libs/bits/bit_array_test.go index 449b5a6ef..e4306ecf2 100644 --- a/libs/bits/bit_array_test.go +++ b/libs/bits/bit_array_test.go @@ -265,3 +265,26 @@ func TestJSONMarshalUnmarshal(t *testing.T) { }) } } + +func TestBitArrayProtoBuf(t *testing.T) { + testCases := []struct { + msg string + bA1 *BitArray + expPass bool + }{ + {"success empty", &BitArray{}, true}, + {"success", NewBitArray(1), true}, + {"success", NewBitArray(2), true}, + {"negative", NewBitArray(-1), false}, + } + for _, tc := range testCases { + protoBA := tc.bA1.ToProto() + ba := new(BitArray) + ba.FromProto(protoBA) + if tc.expPass { + require.Equal(t, tc.bA1, ba, tc.msg) + } else { + require.NotEqual(t, tc.bA1, ba, tc.msg) + } + } +} diff --git a/proto/blockchain/msgs.pb.go b/proto/blockchain/msgs.pb.go new file mode 100644 index 000000000..8d233afc3 --- /dev/null +++ b/proto/blockchain/msgs.pb.go @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/blockchain/msgs.proto + +package blockchain + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + types "github.com/tendermint/tendermint/proto/types" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// BlockRequest requests a block for a specific height +type BlockRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockRequest) Reset() { *m = BlockRequest{} } +func (m *BlockRequest) String() string { return proto.CompactTextString(m) } +func (*BlockRequest) ProtoMessage() {} +func (*BlockRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf660069f8bb334, []int{0} +} +func (m *BlockRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockRequest.Unmarshal(m, b) +} +func (m *BlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockRequest.Marshal(b, m, deterministic) +} +func (m *BlockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockRequest.Merge(m, src) +} +func (m *BlockRequest) XXX_Size() int { + return xxx_messageInfo_BlockRequest.Size(m) +} +func (m *BlockRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BlockRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockRequest proto.InternalMessageInfo + +func (m *BlockRequest) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +// NoBlockResponse informs the node that the peer does not have block at the requested height +type NoBlockResponse struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NoBlockResponse) Reset() { *m = NoBlockResponse{} } +func (m *NoBlockResponse) String() string { return proto.CompactTextString(m) } +func (*NoBlockResponse) ProtoMessage() {} +func (*NoBlockResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf660069f8bb334, []int{1} +} +func (m *NoBlockResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NoBlockResponse.Unmarshal(m, b) +} +func (m *NoBlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NoBlockResponse.Marshal(b, m, deterministic) +} +func (m *NoBlockResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NoBlockResponse.Merge(m, src) +} +func (m *NoBlockResponse) XXX_Size() int { + return xxx_messageInfo_NoBlockResponse.Size(m) +} +func (m *NoBlockResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NoBlockResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NoBlockResponse proto.InternalMessageInfo + +func (m *NoBlockResponse) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +// BlockResponse returns block to the requested +type BlockResponse struct { + Block types.Block `protobuf:"bytes,1,opt,name=block,proto3" json:"block"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockResponse) Reset() { *m = BlockResponse{} } +func (m *BlockResponse) String() string { return proto.CompactTextString(m) } +func (*BlockResponse) ProtoMessage() {} +func (*BlockResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf660069f8bb334, []int{2} +} +func (m *BlockResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockResponse.Unmarshal(m, b) +} +func (m *BlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockResponse.Marshal(b, m, deterministic) +} +func (m *BlockResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockResponse.Merge(m, src) +} +func (m *BlockResponse) XXX_Size() int { + return xxx_messageInfo_BlockResponse.Size(m) +} +func (m *BlockResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BlockResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockResponse proto.InternalMessageInfo + +func (m *BlockResponse) GetBlock() types.Block { + if m != nil { + return m.Block + } + return types.Block{} +} + +// StatusRequest requests the status of a node (Height & Base) +type StatusRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Base int64 `protobuf:"varint,2,opt,name=base,proto3" json:"base,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StatusRequest) Reset() { *m = StatusRequest{} } +func (m *StatusRequest) String() string { return proto.CompactTextString(m) } +func (*StatusRequest) ProtoMessage() {} +func (*StatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf660069f8bb334, []int{3} +} +func (m *StatusRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StatusRequest.Unmarshal(m, b) +} +func (m *StatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StatusRequest.Marshal(b, m, deterministic) +} +func (m *StatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatusRequest.Merge(m, src) +} +func (m *StatusRequest) XXX_Size() int { + return xxx_messageInfo_StatusRequest.Size(m) +} +func (m *StatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StatusRequest proto.InternalMessageInfo + +func (m *StatusRequest) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *StatusRequest) GetBase() int64 { + if m != nil { + return m.Base + } + return 0 +} + +// StatusResponse is a peer response to infrom their status +type StatusResponse struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Base int64 `protobuf:"varint,2,opt,name=base,proto3" json:"base,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StatusResponse) Reset() { *m = StatusResponse{} } +func (m *StatusResponse) String() string { return proto.CompactTextString(m) } +func (*StatusResponse) ProtoMessage() {} +func (*StatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf660069f8bb334, []int{4} +} +func (m *StatusResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StatusResponse.Unmarshal(m, b) +} +func (m *StatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StatusResponse.Marshal(b, m, deterministic) +} +func (m *StatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatusResponse.Merge(m, src) +} +func (m *StatusResponse) XXX_Size() int { + return xxx_messageInfo_StatusResponse.Size(m) +} +func (m *StatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StatusResponse proto.InternalMessageInfo + +func (m *StatusResponse) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *StatusResponse) GetBase() int64 { + if m != nil { + return m.Base + } + return 0 +} + +type Message struct { + // Types that are valid to be assigned to Sum: + // *Message_BlockRequest + // *Message_NoBlockResponse + // *Message_BlockResponse + // *Message_StatusRequest + // *Message_StatusResponse + Sum isMessage_Sum `protobuf_oneof:"sum"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf660069f8bb334, []int{5} +} +func (m *Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Message.Unmarshal(m, b) +} +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Message.Marshal(b, m, deterministic) +} +func (m *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(m, src) +} +func (m *Message) XXX_Size() int { + return xxx_messageInfo_Message.Size(m) +} +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_Message proto.InternalMessageInfo + +type isMessage_Sum interface { + isMessage_Sum() +} + +type Message_BlockRequest struct { + BlockRequest *BlockRequest `protobuf:"bytes,1,opt,name=block_request,json=blockRequest,proto3,oneof" json:"block_request,omitempty"` +} +type Message_NoBlockResponse struct { + NoBlockResponse *NoBlockResponse `protobuf:"bytes,2,opt,name=no_block_response,json=noBlockResponse,proto3,oneof" json:"no_block_response,omitempty"` +} +type Message_BlockResponse struct { + BlockResponse *BlockResponse `protobuf:"bytes,3,opt,name=block_response,json=blockResponse,proto3,oneof" json:"block_response,omitempty"` +} +type Message_StatusRequest struct { + StatusRequest *StatusRequest `protobuf:"bytes,4,opt,name=status_request,json=statusRequest,proto3,oneof" json:"status_request,omitempty"` +} +type Message_StatusResponse struct { + StatusResponse *StatusResponse `protobuf:"bytes,5,opt,name=status_response,json=statusResponse,proto3,oneof" json:"status_response,omitempty"` +} + +func (*Message_BlockRequest) isMessage_Sum() {} +func (*Message_NoBlockResponse) isMessage_Sum() {} +func (*Message_BlockResponse) isMessage_Sum() {} +func (*Message_StatusRequest) isMessage_Sum() {} +func (*Message_StatusResponse) isMessage_Sum() {} + +func (m *Message) GetSum() isMessage_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *Message) GetBlockRequest() *BlockRequest { + if x, ok := m.GetSum().(*Message_BlockRequest); ok { + return x.BlockRequest + } + return nil +} + +func (m *Message) GetNoBlockResponse() *NoBlockResponse { + if x, ok := m.GetSum().(*Message_NoBlockResponse); ok { + return x.NoBlockResponse + } + return nil +} + +func (m *Message) GetBlockResponse() *BlockResponse { + if x, ok := m.GetSum().(*Message_BlockResponse); ok { + return x.BlockResponse + } + return nil +} + +func (m *Message) GetStatusRequest() *StatusRequest { + if x, ok := m.GetSum().(*Message_StatusRequest); ok { + return x.StatusRequest + } + return nil +} + +func (m *Message) GetStatusResponse() *StatusResponse { + if x, ok := m.GetSum().(*Message_StatusResponse); ok { + return x.StatusResponse + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Message) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Message_BlockRequest)(nil), + (*Message_NoBlockResponse)(nil), + (*Message_BlockResponse)(nil), + (*Message_StatusRequest)(nil), + (*Message_StatusResponse)(nil), + } +} + +func init() { + proto.RegisterType((*BlockRequest)(nil), "tendermint.proto.blockchain.BlockRequest") + proto.RegisterType((*NoBlockResponse)(nil), "tendermint.proto.blockchain.NoBlockResponse") + proto.RegisterType((*BlockResponse)(nil), "tendermint.proto.blockchain.BlockResponse") + proto.RegisterType((*StatusRequest)(nil), "tendermint.proto.blockchain.StatusRequest") + proto.RegisterType((*StatusResponse)(nil), "tendermint.proto.blockchain.StatusResponse") + proto.RegisterType((*Message)(nil), "tendermint.proto.blockchain.Message") +} + +func init() { proto.RegisterFile("proto/blockchain/msgs.proto", fileDescriptor_ecf660069f8bb334) } + +var fileDescriptor_ecf660069f8bb334 = []byte{ + // 369 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xc1, 0x4e, 0xc2, 0x40, + 0x10, 0x86, 0xc1, 0x02, 0x26, 0x03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0xa7, 0xdc, 0xe6, 0x09, 0xfe, + 0xe3, 0x4f, 0xd3, 0xa0, 0xe6, 0xd8, 0x48, 0xbb, 0x07, 0x42, 0x15, 0x67, 0xfd, 0x1e, 0xda, 0x9b, + 0xe6, 0xfd, 0x96, 0x7f, 0xed, 0xfe, 0x50, 0xe0, 0xf0, 0x91, 0x22, 0xda, 0x2e, 0xd5, 0x9e, 0x41, + 0x15, 0x7e, 0xe6, 0xb1, 0xb4, 0x91, 0xbe, 0x64, 0x48, 0xf6, 0x64, 0x43, 0x76, 0xf7, 0x3a, 0xa9, + 0x58, 0x2d, 0x67, 0x77, 0xcf, 0x33, 0x38, 0x0a, 0xd9, 0x7c, 0x03, 0x95, 0xf6, 0xc4, 0xf8, 0xe6, + 0xe8, 0x7a, 0x2f, 0xb5, 0x90, 0xc2, 0xa4, 0x62, 0x75, 0xc2, 0x42, 0x30, 0x53, 0x68, 0x17, 0xc0, + 0x8a, 0x00, 0x5f, 0x96, 0xb1, 0x9b, 0x61, 0x55, 0xa7, 0x08, 0x45, 0xb1, 0xcc, 0x6c, 0x07, 0xb5, + 0x12, 0xd0, 0x5c, 0x78, 0x6b, 0x28, 0xe6, 0xd2, 0x7c, 0x81, 0x4e, 0x06, 0x4d, 0xad, 0xd6, 0x05, + 0xf5, 0xaa, 0x14, 0x35, 0xf3, 0xda, 0xc6, 0x9c, 0x62, 0xd6, 0x41, 0xc1, 0x24, 0x30, 0xc7, 0xb3, + 0x1b, 0xd7, 0xe7, 0x5e, 0xe2, 0x90, 0x05, 0x0b, 0x8c, 0x2d, 0x71, 0xf7, 0x58, 0xfc, 0xf5, 0x9c, + 0x86, 0x50, 0xc6, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xb9, 0x72, 0x28, 0x95, 0x03, 0x00, + 0x00, +} diff --git a/proto/blockchain/msgs.proto b/proto/blockchain/msgs.proto new file mode 100644 index 000000000..f6e10f8d3 --- /dev/null +++ b/proto/blockchain/msgs.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package tendermint.proto.blockchain; + +option go_package = "github.com/tendermint/tendermint/proto/blockchain"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "proto/types/block.proto"; + +// BlockRequest requests a block for a specific height +message BlockRequest { + int64 height = 1; +} + +// NoBlockResponse informs the node that the peer does not have block at the requested height +message NoBlockResponse { + int64 height = 1; +} + +// BlockResponse returns block to the requested +message BlockResponse { + tendermint.proto.types.Block block = 1 [(gogoproto.nullable) = false]; +} + +// StatusRequest requests the status of a node (Height & Base) +message StatusRequest { + int64 height = 1; + int64 base = 2; +} + +// StatusResponse is a peer response to infrom their status +message StatusResponse { + int64 height = 1; + int64 base = 2; +} + +message Message { + oneof sum { + BlockRequest block_request = 1; + NoBlockResponse no_block_response = 2; + BlockResponse block_response = 3; + StatusRequest status_request = 4; + StatusResponse status_response = 5; + } +} diff --git a/proto/consensus/msgs.pb.go b/proto/consensus/msgs.pb.go new file mode 100644 index 000000000..230832b34 --- /dev/null +++ b/proto/consensus/msgs.pb.go @@ -0,0 +1,794 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/consensus/msgs.proto + +package consensus + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + bits "github.com/tendermint/tendermint/proto/libs/bits" + types "github.com/tendermint/tendermint/proto/types" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// NewRoundStepMessage is sent for every step taken in the ConsensusState. +// For every height/round/step transition +type NewRoundStep struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Step uint32 `protobuf:"varint,3,opt,name=step,proto3" json:"step,omitempty"` + SecondsSinceStartTime int64 `protobuf:"varint,4,opt,name=seconds_since_start_time,json=secondsSinceStartTime,proto3" json:"seconds_since_start_time,omitempty"` + LastCommitRound int32 `protobuf:"varint,5,opt,name=last_commit_round,json=lastCommitRound,proto3" json:"last_commit_round,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NewRoundStep) Reset() { *m = NewRoundStep{} } +func (m *NewRoundStep) String() string { return proto.CompactTextString(m) } +func (*NewRoundStep) ProtoMessage() {} +func (*NewRoundStep) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{0} +} +func (m *NewRoundStep) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NewRoundStep.Unmarshal(m, b) +} +func (m *NewRoundStep) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NewRoundStep.Marshal(b, m, deterministic) +} +func (m *NewRoundStep) XXX_Merge(src proto.Message) { + xxx_messageInfo_NewRoundStep.Merge(m, src) +} +func (m *NewRoundStep) XXX_Size() int { + return xxx_messageInfo_NewRoundStep.Size(m) +} +func (m *NewRoundStep) XXX_DiscardUnknown() { + xxx_messageInfo_NewRoundStep.DiscardUnknown(m) +} + +var xxx_messageInfo_NewRoundStep proto.InternalMessageInfo + +func (m *NewRoundStep) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *NewRoundStep) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *NewRoundStep) GetStep() uint32 { + if m != nil { + return m.Step + } + return 0 +} + +func (m *NewRoundStep) GetSecondsSinceStartTime() int64 { + if m != nil { + return m.SecondsSinceStartTime + } + return 0 +} + +func (m *NewRoundStep) GetLastCommitRound() int32 { + if m != nil { + return m.LastCommitRound + } + return 0 +} + +// NewValidBlockMessage is sent when a validator observes a valid block B in some round r, +//i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. +// In case the block is also committed, then IsCommit flag is set to true. +type NewValidBlock struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + BlockPartsHeader types.PartSetHeader `protobuf:"bytes,3,opt,name=block_parts_header,json=blockPartsHeader,proto3" json:"block_parts_header"` + BlockParts *bits.BitArray `protobuf:"bytes,4,opt,name=block_parts,json=blockParts,proto3" json:"block_parts,omitempty"` + IsCommit bool `protobuf:"varint,5,opt,name=is_commit,json=isCommit,proto3" json:"is_commit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NewValidBlock) Reset() { *m = NewValidBlock{} } +func (m *NewValidBlock) String() string { return proto.CompactTextString(m) } +func (*NewValidBlock) ProtoMessage() {} +func (*NewValidBlock) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{1} +} +func (m *NewValidBlock) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NewValidBlock.Unmarshal(m, b) +} +func (m *NewValidBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NewValidBlock.Marshal(b, m, deterministic) +} +func (m *NewValidBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_NewValidBlock.Merge(m, src) +} +func (m *NewValidBlock) XXX_Size() int { + return xxx_messageInfo_NewValidBlock.Size(m) +} +func (m *NewValidBlock) XXX_DiscardUnknown() { + xxx_messageInfo_NewValidBlock.DiscardUnknown(m) +} + +var xxx_messageInfo_NewValidBlock proto.InternalMessageInfo + +func (m *NewValidBlock) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *NewValidBlock) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *NewValidBlock) GetBlockPartsHeader() types.PartSetHeader { + if m != nil { + return m.BlockPartsHeader + } + return types.PartSetHeader{} +} + +func (m *NewValidBlock) GetBlockParts() *bits.BitArray { + if m != nil { + return m.BlockParts + } + return nil +} + +func (m *NewValidBlock) GetIsCommit() bool { + if m != nil { + return m.IsCommit + } + return false +} + +// ProposalMessage is sent when a new block is proposed. +type Proposal struct { + Proposal types.Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Proposal) Reset() { *m = Proposal{} } +func (m *Proposal) String() string { return proto.CompactTextString(m) } +func (*Proposal) ProtoMessage() {} +func (*Proposal) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{2} +} +func (m *Proposal) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Proposal.Unmarshal(m, b) +} +func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) +} +func (m *Proposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proposal.Merge(m, src) +} +func (m *Proposal) XXX_Size() int { + return xxx_messageInfo_Proposal.Size(m) +} +func (m *Proposal) XXX_DiscardUnknown() { + xxx_messageInfo_Proposal.DiscardUnknown(m) +} + +var xxx_messageInfo_Proposal proto.InternalMessageInfo + +func (m *Proposal) GetProposal() types.Proposal { + if m != nil { + return m.Proposal + } + return types.Proposal{} +} + +// ProposalPOLMessage is sent when a previous proposal is re-proposed. +type ProposalPOL struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + ProposalPolRound int32 `protobuf:"varint,2,opt,name=proposal_pol_round,json=proposalPolRound,proto3" json:"proposal_pol_round,omitempty"` + ProposalPol bits.BitArray `protobuf:"bytes,3,opt,name=proposal_pol,json=proposalPol,proto3" json:"proposal_pol"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProposalPOL) Reset() { *m = ProposalPOL{} } +func (m *ProposalPOL) String() string { return proto.CompactTextString(m) } +func (*ProposalPOL) ProtoMessage() {} +func (*ProposalPOL) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{3} +} +func (m *ProposalPOL) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProposalPOL.Unmarshal(m, b) +} +func (m *ProposalPOL) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProposalPOL.Marshal(b, m, deterministic) +} +func (m *ProposalPOL) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProposalPOL.Merge(m, src) +} +func (m *ProposalPOL) XXX_Size() int { + return xxx_messageInfo_ProposalPOL.Size(m) +} +func (m *ProposalPOL) XXX_DiscardUnknown() { + xxx_messageInfo_ProposalPOL.DiscardUnknown(m) +} + +var xxx_messageInfo_ProposalPOL proto.InternalMessageInfo + +func (m *ProposalPOL) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *ProposalPOL) GetProposalPolRound() int32 { + if m != nil { + return m.ProposalPolRound + } + return 0 +} + +func (m *ProposalPOL) GetProposalPol() bits.BitArray { + if m != nil { + return m.ProposalPol + } + return bits.BitArray{} +} + +// BlockPartMessage is sent when gossipping a piece of the proposed block. +type BlockPart struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Part types.Part `protobuf:"bytes,3,opt,name=part,proto3" json:"part"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockPart) Reset() { *m = BlockPart{} } +func (m *BlockPart) String() string { return proto.CompactTextString(m) } +func (*BlockPart) ProtoMessage() {} +func (*BlockPart) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{4} +} +func (m *BlockPart) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockPart.Unmarshal(m, b) +} +func (m *BlockPart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockPart.Marshal(b, m, deterministic) +} +func (m *BlockPart) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockPart.Merge(m, src) +} +func (m *BlockPart) XXX_Size() int { + return xxx_messageInfo_BlockPart.Size(m) +} +func (m *BlockPart) XXX_DiscardUnknown() { + xxx_messageInfo_BlockPart.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockPart proto.InternalMessageInfo + +func (m *BlockPart) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BlockPart) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *BlockPart) GetPart() types.Part { + if m != nil { + return m.Part + } + return types.Part{} +} + +// VoteMessage is sent when voting for a proposal (or lack thereof). +type Vote struct { + Vote *types.Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (m *Vote) String() string { return proto.CompactTextString(m) } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{5} +} +func (m *Vote) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Vote.Unmarshal(m, b) +} +func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Vote.Marshal(b, m, deterministic) +} +func (m *Vote) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vote.Merge(m, src) +} +func (m *Vote) XXX_Size() int { + return xxx_messageInfo_Vote.Size(m) +} +func (m *Vote) XXX_DiscardUnknown() { + xxx_messageInfo_Vote.DiscardUnknown(m) +} + +var xxx_messageInfo_Vote proto.InternalMessageInfo + +func (m *Vote) GetVote() *types.Vote { + if m != nil { + return m.Vote + } + return nil +} + +// HasVoteMessage is sent to indicate that a particular vote has been received. +type HasVote struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.proto.types.SignedMsgType" json:"type,omitempty"` + Index uint32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HasVote) Reset() { *m = HasVote{} } +func (m *HasVote) String() string { return proto.CompactTextString(m) } +func (*HasVote) ProtoMessage() {} +func (*HasVote) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{6} +} +func (m *HasVote) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HasVote.Unmarshal(m, b) +} +func (m *HasVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HasVote.Marshal(b, m, deterministic) +} +func (m *HasVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_HasVote.Merge(m, src) +} +func (m *HasVote) XXX_Size() int { + return xxx_messageInfo_HasVote.Size(m) +} +func (m *HasVote) XXX_DiscardUnknown() { + xxx_messageInfo_HasVote.DiscardUnknown(m) +} + +var xxx_messageInfo_HasVote proto.InternalMessageInfo + +func (m *HasVote) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *HasVote) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *HasVote) GetType() types.SignedMsgType { + if m != nil { + return m.Type + } + return types.SIGNED_MSG_TYPE_UNKNOWN +} + +func (m *HasVote) GetIndex() uint32 { + if m != nil { + return m.Index + } + return 0 +} + +// VoteSetMaj23Message is sent to indicate that a given BlockID has seen +2/3 votes. +type VoteSetMaj23 struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.proto.types.SignedMsgType" json:"type,omitempty"` + BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VoteSetMaj23) Reset() { *m = VoteSetMaj23{} } +func (m *VoteSetMaj23) String() string { return proto.CompactTextString(m) } +func (*VoteSetMaj23) ProtoMessage() {} +func (*VoteSetMaj23) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{7} +} +func (m *VoteSetMaj23) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VoteSetMaj23.Unmarshal(m, b) +} +func (m *VoteSetMaj23) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VoteSetMaj23.Marshal(b, m, deterministic) +} +func (m *VoteSetMaj23) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoteSetMaj23.Merge(m, src) +} +func (m *VoteSetMaj23) XXX_Size() int { + return xxx_messageInfo_VoteSetMaj23.Size(m) +} +func (m *VoteSetMaj23) XXX_DiscardUnknown() { + xxx_messageInfo_VoteSetMaj23.DiscardUnknown(m) +} + +var xxx_messageInfo_VoteSetMaj23 proto.InternalMessageInfo + +func (m *VoteSetMaj23) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *VoteSetMaj23) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *VoteSetMaj23) GetType() types.SignedMsgType { + if m != nil { + return m.Type + } + return types.SIGNED_MSG_TYPE_UNKNOWN +} + +func (m *VoteSetMaj23) GetBlockID() types.BlockID { + if m != nil { + return m.BlockID + } + return types.BlockID{} +} + +// VoteSetBitsMessage is sent to communicate the bit-array of votes seen for the BlockID. +type VoteSetBits struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.proto.types.SignedMsgType" json:"type,omitempty"` + BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` + Votes bits.BitArray `protobuf:"bytes,5,opt,name=votes,proto3" json:"votes"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VoteSetBits) Reset() { *m = VoteSetBits{} } +func (m *VoteSetBits) String() string { return proto.CompactTextString(m) } +func (*VoteSetBits) ProtoMessage() {} +func (*VoteSetBits) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{8} +} +func (m *VoteSetBits) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VoteSetBits.Unmarshal(m, b) +} +func (m *VoteSetBits) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VoteSetBits.Marshal(b, m, deterministic) +} +func (m *VoteSetBits) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoteSetBits.Merge(m, src) +} +func (m *VoteSetBits) XXX_Size() int { + return xxx_messageInfo_VoteSetBits.Size(m) +} +func (m *VoteSetBits) XXX_DiscardUnknown() { + xxx_messageInfo_VoteSetBits.DiscardUnknown(m) +} + +var xxx_messageInfo_VoteSetBits proto.InternalMessageInfo + +func (m *VoteSetBits) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *VoteSetBits) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *VoteSetBits) GetType() types.SignedMsgType { + if m != nil { + return m.Type + } + return types.SIGNED_MSG_TYPE_UNKNOWN +} + +func (m *VoteSetBits) GetBlockID() types.BlockID { + if m != nil { + return m.BlockID + } + return types.BlockID{} +} + +func (m *VoteSetBits) GetVotes() bits.BitArray { + if m != nil { + return m.Votes + } + return bits.BitArray{} +} + +type Message struct { + // Types that are valid to be assigned to Sum: + // *Message_NewRoundStep + // *Message_NewValidBlock + // *Message_Proposal + // *Message_ProposalPol + // *Message_BlockPart + // *Message_Vote + // *Message_HasVote + // *Message_VoteSetMaj23 + // *Message_VoteSetBits + Sum isMessage_Sum `protobuf_oneof:"sum"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { + return fileDescriptor_9de64017f8b3fc88, []int{9} +} +func (m *Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Message.Unmarshal(m, b) +} +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Message.Marshal(b, m, deterministic) +} +func (m *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(m, src) +} +func (m *Message) XXX_Size() int { + return xxx_messageInfo_Message.Size(m) +} +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_Message proto.InternalMessageInfo + +type isMessage_Sum interface { + isMessage_Sum() +} + +type Message_NewRoundStep struct { + NewRoundStep *NewRoundStep `protobuf:"bytes,1,opt,name=new_round_step,json=newRoundStep,proto3,oneof" json:"new_round_step,omitempty"` +} +type Message_NewValidBlock struct { + NewValidBlock *NewValidBlock `protobuf:"bytes,2,opt,name=new_valid_block,json=newValidBlock,proto3,oneof" json:"new_valid_block,omitempty"` +} +type Message_Proposal struct { + Proposal *Proposal `protobuf:"bytes,3,opt,name=proposal,proto3,oneof" json:"proposal,omitempty"` +} +type Message_ProposalPol struct { + ProposalPol *ProposalPOL `protobuf:"bytes,4,opt,name=proposal_pol,json=proposalPol,proto3,oneof" json:"proposal_pol,omitempty"` +} +type Message_BlockPart struct { + BlockPart *BlockPart `protobuf:"bytes,5,opt,name=block_part,json=blockPart,proto3,oneof" json:"block_part,omitempty"` +} +type Message_Vote struct { + Vote *Vote `protobuf:"bytes,6,opt,name=vote,proto3,oneof" json:"vote,omitempty"` +} +type Message_HasVote struct { + HasVote *HasVote `protobuf:"bytes,7,opt,name=has_vote,json=hasVote,proto3,oneof" json:"has_vote,omitempty"` +} +type Message_VoteSetMaj23 struct { + VoteSetMaj23 *VoteSetMaj23 `protobuf:"bytes,8,opt,name=vote_set_maj23,json=voteSetMaj23,proto3,oneof" json:"vote_set_maj23,omitempty"` +} +type Message_VoteSetBits struct { + VoteSetBits *VoteSetBits `protobuf:"bytes,9,opt,name=vote_set_bits,json=voteSetBits,proto3,oneof" json:"vote_set_bits,omitempty"` +} + +func (*Message_NewRoundStep) isMessage_Sum() {} +func (*Message_NewValidBlock) isMessage_Sum() {} +func (*Message_Proposal) isMessage_Sum() {} +func (*Message_ProposalPol) isMessage_Sum() {} +func (*Message_BlockPart) isMessage_Sum() {} +func (*Message_Vote) isMessage_Sum() {} +func (*Message_HasVote) isMessage_Sum() {} +func (*Message_VoteSetMaj23) isMessage_Sum() {} +func (*Message_VoteSetBits) isMessage_Sum() {} + +func (m *Message) GetSum() isMessage_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *Message) GetNewRoundStep() *NewRoundStep { + if x, ok := m.GetSum().(*Message_NewRoundStep); ok { + return x.NewRoundStep + } + return nil +} + +func (m *Message) GetNewValidBlock() *NewValidBlock { + if x, ok := m.GetSum().(*Message_NewValidBlock); ok { + return x.NewValidBlock + } + return nil +} + +func (m *Message) GetProposal() *Proposal { + if x, ok := m.GetSum().(*Message_Proposal); ok { + return x.Proposal + } + return nil +} + +func (m *Message) GetProposalPol() *ProposalPOL { + if x, ok := m.GetSum().(*Message_ProposalPol); ok { + return x.ProposalPol + } + return nil +} + +func (m *Message) GetBlockPart() *BlockPart { + if x, ok := m.GetSum().(*Message_BlockPart); ok { + return x.BlockPart + } + return nil +} + +func (m *Message) GetVote() *Vote { + if x, ok := m.GetSum().(*Message_Vote); ok { + return x.Vote + } + return nil +} + +func (m *Message) GetHasVote() *HasVote { + if x, ok := m.GetSum().(*Message_HasVote); ok { + return x.HasVote + } + return nil +} + +func (m *Message) GetVoteSetMaj23() *VoteSetMaj23 { + if x, ok := m.GetSum().(*Message_VoteSetMaj23); ok { + return x.VoteSetMaj23 + } + return nil +} + +func (m *Message) GetVoteSetBits() *VoteSetBits { + if x, ok := m.GetSum().(*Message_VoteSetBits); ok { + return x.VoteSetBits + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Message) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Message_NewRoundStep)(nil), + (*Message_NewValidBlock)(nil), + (*Message_Proposal)(nil), + (*Message_ProposalPol)(nil), + (*Message_BlockPart)(nil), + (*Message_Vote)(nil), + (*Message_HasVote)(nil), + (*Message_VoteSetMaj23)(nil), + (*Message_VoteSetBits)(nil), + } +} + +func init() { + proto.RegisterType((*NewRoundStep)(nil), "tendermint.proto.consensus.NewRoundStep") + proto.RegisterType((*NewValidBlock)(nil), "tendermint.proto.consensus.NewValidBlock") + proto.RegisterType((*Proposal)(nil), "tendermint.proto.consensus.Proposal") + proto.RegisterType((*ProposalPOL)(nil), "tendermint.proto.consensus.ProposalPOL") + proto.RegisterType((*BlockPart)(nil), "tendermint.proto.consensus.BlockPart") + proto.RegisterType((*Vote)(nil), "tendermint.proto.consensus.Vote") + proto.RegisterType((*HasVote)(nil), "tendermint.proto.consensus.HasVote") + proto.RegisterType((*VoteSetMaj23)(nil), "tendermint.proto.consensus.VoteSetMaj23") + proto.RegisterType((*VoteSetBits)(nil), "tendermint.proto.consensus.VoteSetBits") + proto.RegisterType((*Message)(nil), "tendermint.proto.consensus.Message") +} + +func init() { proto.RegisterFile("proto/consensus/msgs.proto", fileDescriptor_9de64017f8b3fc88) } + +var fileDescriptor_9de64017f8b3fc88 = []byte{ + // 833 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcd, 0x6e, 0xeb, 0x44, + 0x14, 0x8e, 0x6f, 0x93, 0x26, 0x39, 0x4e, 0xda, 0xcb, 0x88, 0x9f, 0x28, 0x17, 0xa9, 0x91, 0xe1, + 0x42, 0x40, 0xc8, 0xb9, 0x4a, 0x25, 0x7e, 0x76, 0xc5, 0xfc, 0xc8, 0x15, 0x4d, 0x1b, 0x39, 0x55, + 0x25, 0xd8, 0x58, 0x4e, 0x3c, 0x72, 0x06, 0x62, 0x8f, 0xf1, 0x4c, 0x52, 0xf2, 0x00, 0x48, 0x3c, + 0x07, 0x6b, 0xb6, 0xbc, 0x01, 0x0b, 0x9e, 0xa2, 0x0b, 0x9e, 0x83, 0x05, 0x9a, 0x9f, 0xc4, 0x6e, + 0x2b, 0xb7, 0xcd, 0x06, 0xe9, 0x6e, 0xaa, 0x99, 0x39, 0xe7, 0xfb, 0x7c, 0xe6, 0x3b, 0x73, 0xbe, + 0x06, 0xba, 0x69, 0x46, 0x39, 0x1d, 0xcc, 0x68, 0xc2, 0x70, 0xc2, 0x96, 0x6c, 0x10, 0xb3, 0x88, + 0xd9, 0xf2, 0x10, 0x75, 0x39, 0x4e, 0x42, 0x9c, 0xc5, 0x24, 0xe1, 0xea, 0xc4, 0xde, 0xa6, 0x75, + 0x3f, 0xe0, 0x73, 0x92, 0x85, 0x7e, 0x1a, 0x64, 0x7c, 0x3d, 0x50, 0x1c, 0x11, 0x8d, 0x68, 0xbe, + 0x52, 0x88, 0xee, 0x3b, 0xea, 0x84, 0xaf, 0x53, 0xcc, 0xd4, 0x5f, 0x1d, 0x78, 0xa1, 0x02, 0x0b, + 0x32, 0x65, 0x83, 0x29, 0xe1, 0xb7, 0x82, 0xd6, 0x9f, 0x06, 0xb4, 0xce, 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0x0c, 0xfb, 0x65, 0xc6, + 0x9b, 0x33, 0x88, 0xb7, 0xeb, 0x56, 0x94, 0x3d, 0xa0, 0x13, 0x68, 0xcc, 0x03, 0xe6, 0x4b, 0x6c, + 0x5d, 0x62, 0xdf, 0x7b, 0x08, 0xab, 0x9d, 0xc4, 0xad, 0x78, 0xf5, 0xb9, 0x36, 0x95, 0x31, 0x1c, + 0x08, 0xb4, 0xcf, 0x30, 0xf7, 0x63, 0x31, 0xd6, 0x9d, 0xc6, 0xe3, 0xad, 0x2f, 0xda, 0x80, 0x68, + 0xfd, 0xaa, 0x68, 0x0b, 0x23, 0x68, 0x6f, 0x19, 0xc5, 0xfb, 0xeb, 0x34, 0x1f, 0x97, 0xb8, 0x30, + 0x90, 0x42, 0xe2, 0x55, 0xbe, 0x75, 0x6a, 0xb0, 0xc7, 0x96, 0xb1, 0x33, 0xfc, 0xe1, 0x55, 0x44, + 0xf8, 0x7c, 0x39, 0xb5, 0x67, 0x34, 0x1e, 0xe4, 0x54, 0xc5, 0xe5, 0x9d, 0x9f, 0x46, 0xd3, 0x7d, + 0x79, 0x70, 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xae, 0x4b, 0x4c, 0x2a, 0x34, 0x09, 0x00, + 0x00, +} diff --git a/proto/consensus/msgs.proto b/proto/consensus/msgs.proto new file mode 100644 index 000000000..245e0f4c4 --- /dev/null +++ b/proto/consensus/msgs.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; +package tendermint.proto.consensus; + +option go_package = "github.com/tendermint/tendermint/proto/consensus"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "proto/types/types.proto"; +import "proto/libs/bits/types.proto"; + +// NewRoundStepMessage is sent for every step taken in the ConsensusState. +// For every height/round/step transition +message NewRoundStep { + int64 height = 1; + int32 round = 2; + uint32 step = 3; + int64 seconds_since_start_time = 4; + int32 last_commit_round = 5; +} + +// NewValidBlockMessage is sent when a validator observes a valid block B in some round r, +//i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. +// In case the block is also committed, then IsCommit flag is set to true. +message NewValidBlock { + int64 height = 1; + int32 round = 2; + tendermint.proto.types.PartSetHeader block_parts_header = 3 [(gogoproto.nullable) = false]; + tendermint.proto.libs.bits.BitArray block_parts = 4; + bool is_commit = 5; +} + +// ProposalMessage is sent when a new block is proposed. +message Proposal { + tendermint.proto.types.Proposal proposal = 1 [(gogoproto.nullable) = false]; +} + +// ProposalPOLMessage is sent when a previous proposal is re-proposed. +message ProposalPOL { + int64 height = 1; + int32 proposal_pol_round = 2; + tendermint.proto.libs.bits.BitArray proposal_pol = 3 [(gogoproto.nullable) = false]; +} + +// BlockPartMessage is sent when gossipping a piece of the proposed block. +message BlockPart { + int64 height = 1; + int32 round = 2; + tendermint.proto.types.Part part = 3 [(gogoproto.nullable) = false]; +} + +// VoteMessage is sent when voting for a proposal (or lack thereof). +message Vote { + tendermint.proto.types.Vote vote = 1; +} + +// HasVoteMessage is sent to indicate that a particular vote has been received. +message HasVote { + int64 height = 1; + int32 round = 2; + tendermint.proto.types.SignedMsgType type = 3; + uint32 index = 4; +} + +// VoteSetMaj23Message is sent to indicate that a given BlockID has seen +2/3 votes. +message VoteSetMaj23 { + int64 height = 1; + int32 round = 2; + tendermint.proto.types.SignedMsgType type = 3; + tendermint.proto.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; +} + +// VoteSetBitsMessage is sent to communicate the bit-array of votes seen for the BlockID. +message VoteSetBits { + int64 height = 1; + int32 round = 2; + tendermint.proto.types.SignedMsgType type = 3; + tendermint.proto.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; + tendermint.proto.libs.bits.BitArray votes = 5 [(gogoproto.nullable) = false]; +} + +message Message { + oneof sum { + NewRoundStep new_round_step = 1; + NewValidBlock new_valid_block = 2; + Proposal proposal = 3; + ProposalPOL proposal_pol = 4; + BlockPart block_part = 5; + Vote vote = 6; + HasVote has_vote = 7; + VoteSetMaj23 vote_set_maj23 = 8; + VoteSetBits vote_set_bits = 9; + } +} diff --git a/proto/consensus/walmsgs.pb.go b/proto/consensus/walmsgs.pb.go new file mode 100644 index 000000000..5d7fa45f8 --- /dev/null +++ b/proto/consensus/walmsgs.pb.go @@ -0,0 +1,374 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/consensus/walmsgs.proto + +package consensus + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/duration" + _ "github.com/golang/protobuf/ptypes/timestamp" + types "github.com/tendermint/tendermint/proto/types" + math "math" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgInfo are msgs from the reactor which may update the state +type MsgInfo struct { + Msg Message `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg"` + PeerID string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MsgInfo) Reset() { *m = MsgInfo{} } +func (m *MsgInfo) String() string { return proto.CompactTextString(m) } +func (*MsgInfo) ProtoMessage() {} +func (*MsgInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_60ad80fa14e37285, []int{0} +} +func (m *MsgInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgInfo.Unmarshal(m, b) +} +func (m *MsgInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgInfo.Marshal(b, m, deterministic) +} +func (m *MsgInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInfo.Merge(m, src) +} +func (m *MsgInfo) XXX_Size() int { + return xxx_messageInfo_MsgInfo.Size(m) +} +func (m *MsgInfo) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInfo proto.InternalMessageInfo + +func (m *MsgInfo) GetMsg() Message { + if m != nil { + return m.Msg + } + return Message{} +} + +func (m *MsgInfo) GetPeerID() string { + if m != nil { + return m.PeerID + } + return "" +} + +// TimeoutInfo internally generated messages which may update the state +type TimeoutInfo struct { + Duration time.Duration `protobuf:"bytes,1,opt,name=duration,proto3,stdduration" json:"duration"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` + Step uint32 `protobuf:"varint,4,opt,name=step,proto3" json:"step,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TimeoutInfo) Reset() { *m = TimeoutInfo{} } +func (m *TimeoutInfo) String() string { return proto.CompactTextString(m) } +func (*TimeoutInfo) ProtoMessage() {} +func (*TimeoutInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_60ad80fa14e37285, []int{1} +} +func (m *TimeoutInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TimeoutInfo.Unmarshal(m, b) +} +func (m *TimeoutInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TimeoutInfo.Marshal(b, m, deterministic) +} +func (m *TimeoutInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TimeoutInfo.Merge(m, src) +} +func (m *TimeoutInfo) XXX_Size() int { + return xxx_messageInfo_TimeoutInfo.Size(m) +} +func (m *TimeoutInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TimeoutInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TimeoutInfo proto.InternalMessageInfo + +func (m *TimeoutInfo) GetDuration() time.Duration { + if m != nil { + return m.Duration + } + return 0 +} + +func (m *TimeoutInfo) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *TimeoutInfo) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *TimeoutInfo) GetStep() uint32 { + if m != nil { + return m.Step + } + return 0 +} + +// EndHeightMessage marks the end of the given height inside WAL. +// @internal used by scripts/wal2json util. +type EndHeight struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EndHeight) Reset() { *m = EndHeight{} } +func (m *EndHeight) String() string { return proto.CompactTextString(m) } +func (*EndHeight) ProtoMessage() {} +func (*EndHeight) Descriptor() ([]byte, []int) { + return fileDescriptor_60ad80fa14e37285, []int{2} +} +func (m *EndHeight) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EndHeight.Unmarshal(m, b) +} +func (m *EndHeight) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EndHeight.Marshal(b, m, deterministic) +} +func (m *EndHeight) XXX_Merge(src proto.Message) { + xxx_messageInfo_EndHeight.Merge(m, src) +} +func (m *EndHeight) XXX_Size() int { + return xxx_messageInfo_EndHeight.Size(m) +} +func (m *EndHeight) XXX_DiscardUnknown() { + xxx_messageInfo_EndHeight.DiscardUnknown(m) +} + +var xxx_messageInfo_EndHeight proto.InternalMessageInfo + +func (m *EndHeight) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +type WALMessage struct { + // Types that are valid to be assigned to Sum: + // *WALMessage_EventDataRoundState + // *WALMessage_MsgInfo + // *WALMessage_TimeoutInfo + // *WALMessage_EndHeight + Sum isWALMessage_Sum `protobuf_oneof:"sum"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WALMessage) Reset() { *m = WALMessage{} } +func (m *WALMessage) String() string { return proto.CompactTextString(m) } +func (*WALMessage) ProtoMessage() {} +func (*WALMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_60ad80fa14e37285, []int{3} +} +func (m *WALMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_WALMessage.Unmarshal(m, b) +} +func (m *WALMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_WALMessage.Marshal(b, m, deterministic) +} +func (m *WALMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_WALMessage.Merge(m, src) +} +func (m *WALMessage) XXX_Size() int { + return xxx_messageInfo_WALMessage.Size(m) +} +func (m *WALMessage) XXX_DiscardUnknown() { + xxx_messageInfo_WALMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_WALMessage proto.InternalMessageInfo + +type isWALMessage_Sum interface { + isWALMessage_Sum() +} + +type WALMessage_EventDataRoundState struct { + EventDataRoundState *types.EventDataRoundState `protobuf:"bytes,1,opt,name=event_data_round_state,json=eventDataRoundState,proto3,oneof" json:"event_data_round_state,omitempty"` +} +type WALMessage_MsgInfo struct { + MsgInfo *MsgInfo `protobuf:"bytes,2,opt,name=msg_info,json=msgInfo,proto3,oneof" json:"msg_info,omitempty"` +} +type WALMessage_TimeoutInfo struct { + TimeoutInfo *TimeoutInfo `protobuf:"bytes,3,opt,name=timeout_info,json=timeoutInfo,proto3,oneof" json:"timeout_info,omitempty"` +} +type WALMessage_EndHeight struct { + EndHeight *EndHeight `protobuf:"bytes,4,opt,name=end_height,json=endHeight,proto3,oneof" json:"end_height,omitempty"` +} + +func (*WALMessage_EventDataRoundState) isWALMessage_Sum() {} +func (*WALMessage_MsgInfo) isWALMessage_Sum() {} +func (*WALMessage_TimeoutInfo) isWALMessage_Sum() {} +func (*WALMessage_EndHeight) isWALMessage_Sum() {} + +func (m *WALMessage) GetSum() isWALMessage_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *WALMessage) GetEventDataRoundState() *types.EventDataRoundState { + if x, ok := m.GetSum().(*WALMessage_EventDataRoundState); ok { + return x.EventDataRoundState + } + return nil +} + +func (m *WALMessage) GetMsgInfo() *MsgInfo { + if x, ok := m.GetSum().(*WALMessage_MsgInfo); ok { + return x.MsgInfo + } + return nil +} + +func (m *WALMessage) GetTimeoutInfo() *TimeoutInfo { + if x, ok := m.GetSum().(*WALMessage_TimeoutInfo); ok { + return x.TimeoutInfo + } + return nil +} + +func (m *WALMessage) GetEndHeight() *EndHeight { + if x, ok := m.GetSum().(*WALMessage_EndHeight); ok { + return x.EndHeight + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*WALMessage) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*WALMessage_EventDataRoundState)(nil), + (*WALMessage_MsgInfo)(nil), + (*WALMessage_TimeoutInfo)(nil), + (*WALMessage_EndHeight)(nil), + } +} + +// TimedWALMessage wraps WALMessage and adds Time for debugging purposes. +type TimedWALMessage struct { + Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` + Msg *WALMessage `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TimedWALMessage) Reset() { *m = TimedWALMessage{} } +func (m *TimedWALMessage) String() string { return proto.CompactTextString(m) } +func (*TimedWALMessage) ProtoMessage() {} +func (*TimedWALMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_60ad80fa14e37285, []int{4} +} +func (m *TimedWALMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TimedWALMessage.Unmarshal(m, b) +} +func (m *TimedWALMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TimedWALMessage.Marshal(b, m, deterministic) +} +func (m *TimedWALMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_TimedWALMessage.Merge(m, src) +} +func (m *TimedWALMessage) XXX_Size() int { + return xxx_messageInfo_TimedWALMessage.Size(m) +} +func (m *TimedWALMessage) XXX_DiscardUnknown() { + xxx_messageInfo_TimedWALMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_TimedWALMessage proto.InternalMessageInfo + +func (m *TimedWALMessage) GetTime() time.Time { + if m != nil { + return m.Time + } + return time.Time{} +} + +func (m *TimedWALMessage) GetMsg() *WALMessage { + if m != nil { + return m.Msg + } + return nil +} + +func init() { + proto.RegisterType((*MsgInfo)(nil), "tendermint.proto.consensus.MsgInfo") + proto.RegisterType((*TimeoutInfo)(nil), "tendermint.proto.consensus.TimeoutInfo") + proto.RegisterType((*EndHeight)(nil), "tendermint.proto.consensus.EndHeight") + proto.RegisterType((*WALMessage)(nil), "tendermint.proto.consensus.WALMessage") + proto.RegisterType((*TimedWALMessage)(nil), "tendermint.proto.consensus.TimedWALMessage") +} + +func init() { proto.RegisterFile("proto/consensus/walmsgs.proto", fileDescriptor_60ad80fa14e37285) } + +var fileDescriptor_60ad80fa14e37285 = []byte{ + // 528 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xcd, 0x8a, 0x13, 0x41, + 0x10, 0xce, 0x6c, 0xb2, 0xf9, 0xa9, 0x28, 0xc2, 0x28, 0x4b, 0x1c, 0xd0, 0x84, 0x04, 0xd7, 0x80, + 0x30, 0x23, 0xeb, 0x65, 0xc1, 0x83, 0x1a, 0xb2, 0x92, 0xc0, 0x2e, 0x48, 0xbb, 0x20, 0x78, 0x19, + 0x26, 0x3b, 0x95, 0xce, 0xe0, 0x76, 0xf7, 0x30, 0x5d, 0xa3, 0xec, 0x03, 0x78, 0xdf, 0xa3, 0x8f, + 0xe4, 0xcd, 0x37, 0x58, 0xc1, 0x27, 0x91, 0xe9, 0x9e, 0xfc, 0x90, 0x60, 0xbc, 0x75, 0x57, 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 0x1d, 0x42, 0x55, 0xe7, + 0xa2, 0xff, 0xdd, 0x81, 0x07, 0x85, 0x5a, 0xbc, 0x31, 0xd6, 0x53, 0xa8, 0x15, 0x8a, 0xe5, 0x10, + 0xbd, 0x9d, 0x4d, 0xb8, 0x5c, 0xae, 0xae, 0x5d, 0x85, 0xdb, 0x62, 0x15, 0x0c, 0xc2, 0x3d, 0xb5, + 0x9b, 0x6b, 0xe7, 0x74, 0xbc, 0xaf, 0xaa, 0xb5, 0x9c, 0x59, 0xdb, 0xd1, 0xc9, 0xe7, 0x97, 0x3c, + 0xa1, 0x45, 0x3e, 0xf3, 0xaf, 0x94, 0x08, 0xd6, 0xc0, 0xcd, 0xe3, 0xd6, 0xc7, 0x9c, 0xd5, 0x4d, + 0xe0, 0xd5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x55, 0x7e, 0x02, 0x98, 0x15, 0x04, 0x00, 0x00, +} diff --git a/proto/consensus/walmsgs.proto b/proto/consensus/walmsgs.proto new file mode 100644 index 000000000..4dfe73ead --- /dev/null +++ b/proto/consensus/walmsgs.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; +package tendermint.proto.consensus; + +option go_package = "github.com/tendermint/tendermint/proto/consensus"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "proto/consensus/msgs.proto"; +import "proto/types/events.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +// MsgInfo are msgs from the reactor which may update the state +message MsgInfo { + Message msg = 1 [(gogoproto.nullable) = false]; + string peer_id = 2 [(gogoproto.customname) = "PeerID"]; +} + +// TimeoutInfo internally generated messages which may update the state +message TimeoutInfo { + google.protobuf.Duration duration = 1 + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + int64 height = 2; + int32 round = 3; + uint32 step = 4; +} + +// EndHeightMessage marks the end of the given height inside WAL. +// @internal used by scripts/wal2json util. +message EndHeight { + int64 height = 1; +} + +message WALMessage { + oneof sum { + tendermint.proto.types.EventDataRoundState event_data_round_state = 1; + MsgInfo msg_info = 2; + TimeoutInfo timeout_info = 3; + EndHeight end_height = 4; + } +} + +// TimedWALMessage wraps WALMessage and adds Time for debugging purposes. +message TimedWALMessage { + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + WALMessage msg = 2; +} diff --git a/proto/crypto/keys/types.pb.go b/proto/crypto/keys/types.pb.go index 38a46f1ff..717e875c1 100644 --- a/proto/crypto/keys/types.pb.go +++ b/proto/crypto/keys/types.pb.go @@ -22,6 +22,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// PublicKey defines the keys available for use with Tendermint Validators type PublicKey struct { // Types that are valid to be assigned to Sum: // *PublicKey_Ed25519 @@ -88,6 +89,7 @@ func (*PublicKey) XXX_OneofWrappers() []interface{} { } } +// PrivateKey defines the keys available for use with Tendermint Validators // WARNING PrivateKey is used for internal purposes only type PrivateKey struct { // Types that are valid to be assigned to Sum: @@ -124,8 +126,6 @@ var xxx_messageInfo_PrivateKey proto.InternalMessageInfo type isPrivateKey_Sum interface { isPrivateKey_Sum() - Equal(interface{}) bool - Compare(interface{}) int } type PrivateKey_Ed25519 struct { @@ -169,13 +169,13 @@ var fileDescriptor_943d79b57ec0188f = []byte{ 0x2c, 0x48, 0x2d, 0xd6, 0x03, 0x8b, 0x0b, 0xc9, 0x94, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, 0xe5, 0x66, 0xe6, 0x95, 0x40, 0x44, 0xf4, 0x20, 0x2a, 0xf5, 0x40, 0x2a, 0xa5, 0xd4, 0x4a, 0x32, 0x32, 0x8b, 0x52, 0xe2, 0x0b, 0x12, 0x8b, 0x4a, 0x2a, 0xf5, 0x21, 0x06, 0xa5, 0xe7, 0xa7, 0xe7, 0x23, 0x58, - 0x10, 0x3d, 0x4a, 0x7a, 0x5c, 0x9c, 0x01, 0xa5, 0x49, 0x39, 0x99, 0xc9, 0xde, 0xa9, 0x95, 0x42, + 0x10, 0x3d, 0x4a, 0x16, 0x5c, 0x9c, 0x01, 0xa5, 0x49, 0x39, 0x99, 0xc9, 0xde, 0xa9, 0x95, 0x42, 0x52, 0x5c, 0xec, 0xa9, 0x29, 0x46, 0xa6, 0xa6, 0x86, 0x96, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, - 0x1e, 0x0c, 0x41, 0x30, 0x01, 0x27, 0x56, 0x2e, 0xe6, 0xe2, 0xd2, 0x5c, 0x25, 0x7d, 0x2e, 0xae, - 0x80, 0xa2, 0xcc, 0xb2, 0xc4, 0x92, 0x54, 0xe2, 0x34, 0x38, 0x39, 0xfc, 0x78, 0x28, 0xc7, 0xb8, - 0xe2, 0x91, 0x1c, 0xe3, 0x8a, 0xc7, 0x72, 0x8c, 0x51, 0x46, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, - 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x08, 0xf7, 0x23, 0x33, 0x31, 0x3c, 0x9d, 0xc4, 0x06, 0x16, 0x32, - 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x99, 0x5e, 0xad, 0xbd, 0x10, 0x01, 0x00, 0x00, + 0x1e, 0x0c, 0x41, 0x30, 0x01, 0x2b, 0x8e, 0x17, 0x0b, 0xe4, 0x19, 0x5f, 0x2c, 0x94, 0x67, 0x74, + 0x62, 0xe5, 0x62, 0x2e, 0x2e, 0xcd, 0x55, 0xd2, 0xe7, 0xe2, 0x0a, 0x28, 0xca, 0x2c, 0x4b, 0x2c, + 0x49, 0x25, 0xa0, 0x15, 0xaa, 0xc1, 0xc9, 0x24, 0xca, 0x28, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, + 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xe1, 0x7a, 0x64, 0x26, 0x86, 0x97, 0x93, 0xd8, 0xc0, 0x42, 0xc6, + 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x51, 0xcf, 0x02, 0x32, 0x0e, 0x01, 0x00, 0x00, } func (this *PublicKey) Compare(that interface{}) int { @@ -269,97 +269,6 @@ func (this *PublicKey_Ed25519) Compare(that interface{}) int { } return 0 } -func (this *PrivateKey) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*PrivateKey) - if !ok { - that2, ok := that.(PrivateKey) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if that1.Sum == nil { - if this.Sum != nil { - return 1 - } - } else if this.Sum == nil { - return -1 - } else { - thisType := -1 - switch this.Sum.(type) { - case *PrivateKey_Ed25519: - thisType = 0 - default: - panic(fmt.Sprintf("compare: unexpected type %T in oneof", this.Sum)) - } - that1Type := -1 - switch that1.Sum.(type) { - case *PrivateKey_Ed25519: - that1Type = 0 - default: - panic(fmt.Sprintf("compare: unexpected type %T in oneof", that1.Sum)) - } - if thisType == that1Type { - if c := this.Sum.Compare(that1.Sum); c != 0 { - return c - } - } else if thisType < that1Type { - return -1 - } else if thisType > that1Type { - return 1 - } - } - if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { - return c - } - return 0 -} -func (this *PrivateKey_Ed25519) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*PrivateKey_Ed25519) - if !ok { - that2, ok := that.(PrivateKey_Ed25519) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if c := bytes.Compare(this.Ed25519, that1.Ed25519); c != 0 { - return c - } - return 0 -} func (this *PublicKey) Equal(that interface{}) bool { if that == nil { return this == nil @@ -417,177 +326,3 @@ func (this *PublicKey_Ed25519) Equal(that interface{}) bool { } return true } -func (this *PrivateKey) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PrivateKey) - if !ok { - that2, ok := that.(PrivateKey) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if that1.Sum == nil { - if this.Sum != nil { - return false - } - } else if this.Sum == nil { - return false - } else if !this.Sum.Equal(that1.Sum) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *PrivateKey_Ed25519) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PrivateKey_Ed25519) - if !ok { - that2, ok := that.(PrivateKey_Ed25519) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Ed25519, that1.Ed25519) { - return false - } - return true -} -func NewPopulatedPublicKey(r randyTypes, easy bool) *PublicKey { - this := &PublicKey{} - oneofNumber_Sum := []int32{1}[r.Intn(1)] - switch oneofNumber_Sum { - case 1: - this.Sum = NewPopulatedPublicKey_Ed25519(r, easy) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedTypes(r, 2) - } - return this -} - -func NewPopulatedPublicKey_Ed25519(r randyTypes, easy bool) *PublicKey_Ed25519 { - this := &PublicKey_Ed25519{} - v1 := r.Intn(100) - this.Ed25519 = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Ed25519[i] = byte(r.Intn(256)) - } - return this -} -func NewPopulatedPrivateKey(r randyTypes, easy bool) *PrivateKey { - this := &PrivateKey{} - oneofNumber_Sum := []int32{1}[r.Intn(1)] - switch oneofNumber_Sum { - case 1: - this.Sum = NewPopulatedPrivateKey_Ed25519(r, easy) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedTypes(r, 2) - } - return this -} - -func NewPopulatedPrivateKey_Ed25519(r randyTypes, easy bool) *PrivateKey_Ed25519 { - this := &PrivateKey_Ed25519{} - v2 := r.Intn(100) - this.Ed25519 = make([]byte, v2) - for i := 0; i < v2; i++ { - this.Ed25519[i] = byte(r.Intn(256)) - } - return this -} - -type randyTypes interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneTypes(r randyTypes) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringTypes(r randyTypes) string { - v3 := r.Intn(100) - tmps := make([]rune, v3) - for i := 0; i < v3; i++ { - tmps[i] = randUTF8RuneTypes(r) - } - return string(tmps) -} -func randUnrecognizedTypes(r randyTypes, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldTypes(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldTypes(dAtA []byte, r randyTypes, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateTypes(dAtA, uint64(key)) - v4 := r.Int63() - if r.Intn(2) == 0 { - v4 *= -1 - } - dAtA = encodeVarintPopulateTypes(dAtA, uint64(v4)) - case 1: - dAtA = encodeVarintPopulateTypes(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateTypes(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateTypes(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateTypes(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateTypes(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} diff --git a/proto/crypto/keys/types.proto b/proto/crypto/keys/types.proto index b8f2d1d7f..be4abd609 100644 --- a/proto/crypto/keys/types.proto +++ b/proto/crypto/keys/types.proto @@ -5,16 +5,17 @@ option go_package = "github.com/tendermint/tendermint/proto/crypto/keys"; import "third_party/proto/gogoproto/gogo.proto"; -option (gogoproto.equal_all) = true; -option (gogoproto.compare_all) = true; -option (gogoproto.populate_all) = true; - +// PublicKey defines the keys available for use with Tendermint Validators message PublicKey { + option (gogoproto.compare) = true; + option (gogoproto.equal) = true; + oneof sum { bytes ed25519 = 1; } } +// PrivateKey defines the keys available for use with Tendermint Validators // WARNING PrivateKey is used for internal purposes only message PrivateKey { oneof sum { diff --git a/proto/crypto/merkle/types.pb.go b/proto/crypto/merkle/types.pb.go new file mode 100644 index 000000000..69397ff86 --- /dev/null +++ b/proto/crypto/merkle/types.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/crypto/merkle/types.proto + +package merkle + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type SimpleProof struct { + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + Index int64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + LeafHash []byte `protobuf:"bytes,3,opt,name=leaf_hash,json=leafHash,proto3" json:"leaf_hash,omitempty"` + Aunts [][]byte `protobuf:"bytes,4,rep,name=aunts,proto3" json:"aunts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleProof) Reset() { *m = SimpleProof{} } +func (m *SimpleProof) String() string { return proto.CompactTextString(m) } +func (*SimpleProof) ProtoMessage() {} +func (*SimpleProof) Descriptor() ([]byte, []int) { + return fileDescriptor_57e39eefdaf7ae96, []int{0} +} +func (m *SimpleProof) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleProof.Unmarshal(m, b) +} +func (m *SimpleProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleProof.Marshal(b, m, deterministic) +} +func (m *SimpleProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleProof.Merge(m, src) +} +func (m *SimpleProof) XXX_Size() int { + return xxx_messageInfo_SimpleProof.Size(m) +} +func (m *SimpleProof) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleProof.DiscardUnknown(m) +} + +var xxx_messageInfo_SimpleProof proto.InternalMessageInfo + +func (m *SimpleProof) GetTotal() int64 { + if m != nil { + return m.Total + } + return 0 +} + +func (m *SimpleProof) GetIndex() int64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *SimpleProof) GetLeafHash() []byte { + if m != nil { + return m.LeafHash + } + return nil +} + +func (m *SimpleProof) GetAunts() [][]byte { + if m != nil { + return m.Aunts + } + return nil +} + +func init() { + proto.RegisterType((*SimpleProof)(nil), "tendermint.proto.crypto.merkle.SimpleProof") +} + +func init() { proto.RegisterFile("proto/crypto/merkle/types.proto", fileDescriptor_57e39eefdaf7ae96) } + +var fileDescriptor_57e39eefdaf7ae96 = []byte{ + // 188 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0x28, 0xca, 0x2f, + 0xc9, 0xd7, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0xd5, + 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x03, 0xcb, 0x08, 0xc9, 0x95, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, + 0xe5, 0x66, 0xe6, 0x95, 0x40, 0x44, 0xf4, 0x20, 0x6a, 0xf5, 0x20, 0x6a, 0x95, 0x72, 0xb8, 0xb8, + 0x83, 0x33, 0x73, 0x0b, 0x72, 0x52, 0x03, 0x8a, 0xf2, 0xf3, 0xd3, 0x84, 0x44, 0xb8, 0x58, 0x4b, + 0xf2, 0x4b, 0x12, 0x73, 0x24, 0x18, 0x15, 0x18, 0x35, 0x98, 0x83, 0x20, 0x1c, 0x90, 0x68, 0x66, + 0x5e, 0x4a, 0x6a, 0x85, 0x04, 0x13, 0x44, 0x14, 0xcc, 0x11, 0x92, 0xe6, 0xe2, 0xcc, 0x49, 0x4d, + 0x4c, 0x8b, 0xcf, 0x48, 0x2c, 0xce, 0x90, 0x60, 0x56, 0x60, 0xd4, 0xe0, 0x09, 0xe2, 0x00, 0x09, + 0x78, 0x24, 0x16, 0x67, 0x80, 0xb4, 0x24, 0x96, 0xe6, 0x95, 0x14, 0x4b, 0xb0, 0x28, 0x30, 0x6b, + 0xf0, 0x04, 0x41, 0x38, 0x4e, 0x66, 0x51, 0x26, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, + 0xf9, 0xb9, 0xfa, 0x08, 0xa7, 0x21, 0x33, 0xb1, 0xf8, 0x28, 0x89, 0x0d, 0x2c, 0x68, 0x0c, 0x08, + 0x00, 0x00, 0xff, 0xff, 0x4f, 0x08, 0x9a, 0xf1, 0xef, 0x00, 0x00, 0x00, +} diff --git a/proto/crypto/merkle/types.proto b/proto/crypto/merkle/types.proto new file mode 100644 index 000000000..c7dc355a5 --- /dev/null +++ b/proto/crypto/merkle/types.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package tendermint.proto.crypto.merkle; + +option go_package = "github.com/tendermint/tendermint/proto/crypto/merkle"; + +message SimpleProof { + int64 total = 1; + int64 index = 2; + bytes leaf_hash = 3; + repeated bytes aunts = 4; +} diff --git a/proto/p2p/conn_msgs.pb.go b/proto/p2p/conn_msgs.pb.go new file mode 100644 index 000000000..47239bacd --- /dev/null +++ b/proto/p2p/conn_msgs.pb.go @@ -0,0 +1,258 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/p2p/conn_msgs.proto + +package p2p + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type PacketPing struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PacketPing) Reset() { *m = PacketPing{} } +func (m *PacketPing) String() string { return proto.CompactTextString(m) } +func (*PacketPing) ProtoMessage() {} +func (*PacketPing) Descriptor() ([]byte, []int) { + return fileDescriptor_8c680f0b24d73fe7, []int{0} +} +func (m *PacketPing) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PacketPing.Unmarshal(m, b) +} +func (m *PacketPing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PacketPing.Marshal(b, m, deterministic) +} +func (m *PacketPing) XXX_Merge(src proto.Message) { + xxx_messageInfo_PacketPing.Merge(m, src) +} +func (m *PacketPing) XXX_Size() int { + return xxx_messageInfo_PacketPing.Size(m) +} +func (m *PacketPing) XXX_DiscardUnknown() { + xxx_messageInfo_PacketPing.DiscardUnknown(m) +} + +var xxx_messageInfo_PacketPing proto.InternalMessageInfo + +type PacketPong struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PacketPong) Reset() { *m = PacketPong{} } +func (m *PacketPong) String() string { return proto.CompactTextString(m) } +func (*PacketPong) ProtoMessage() {} +func (*PacketPong) Descriptor() ([]byte, []int) { + return fileDescriptor_8c680f0b24d73fe7, []int{1} +} +func (m *PacketPong) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PacketPong.Unmarshal(m, b) +} +func (m *PacketPong) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PacketPong.Marshal(b, m, deterministic) +} +func (m *PacketPong) XXX_Merge(src proto.Message) { + xxx_messageInfo_PacketPong.Merge(m, src) +} +func (m *PacketPong) XXX_Size() int { + return xxx_messageInfo_PacketPong.Size(m) +} +func (m *PacketPong) XXX_DiscardUnknown() { + xxx_messageInfo_PacketPong.DiscardUnknown(m) +} + +var xxx_messageInfo_PacketPong proto.InternalMessageInfo + +type PacketMsg struct { + ChannelID int32 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + EOF int32 `protobuf:"varint,2,opt,name=eof,proto3" json:"eof,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PacketMsg) Reset() { *m = PacketMsg{} } +func (m *PacketMsg) String() string { return proto.CompactTextString(m) } +func (*PacketMsg) ProtoMessage() {} +func (*PacketMsg) Descriptor() ([]byte, []int) { + return fileDescriptor_8c680f0b24d73fe7, []int{2} +} +func (m *PacketMsg) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PacketMsg.Unmarshal(m, b) +} +func (m *PacketMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PacketMsg.Marshal(b, m, deterministic) +} +func (m *PacketMsg) XXX_Merge(src proto.Message) { + xxx_messageInfo_PacketMsg.Merge(m, src) +} +func (m *PacketMsg) XXX_Size() int { + return xxx_messageInfo_PacketMsg.Size(m) +} +func (m *PacketMsg) XXX_DiscardUnknown() { + xxx_messageInfo_PacketMsg.DiscardUnknown(m) +} + +var xxx_messageInfo_PacketMsg proto.InternalMessageInfo + +func (m *PacketMsg) GetChannelID() int32 { + if m != nil { + return m.ChannelID + } + return 0 +} + +func (m *PacketMsg) GetEOF() int32 { + if m != nil { + return m.EOF + } + return 0 +} + +func (m *PacketMsg) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +type Packet struct { + // Types that are valid to be assigned to Sum: + // *Packet_PacketPing + // *Packet_PacketPong + // *Packet_PacketMsg + Sum isPacket_Sum `protobuf_oneof:"sum"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Packet) Reset() { *m = Packet{} } +func (m *Packet) String() string { return proto.CompactTextString(m) } +func (*Packet) ProtoMessage() {} +func (*Packet) Descriptor() ([]byte, []int) { + return fileDescriptor_8c680f0b24d73fe7, []int{3} +} +func (m *Packet) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Packet.Unmarshal(m, b) +} +func (m *Packet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Packet.Marshal(b, m, deterministic) +} +func (m *Packet) XXX_Merge(src proto.Message) { + xxx_messageInfo_Packet.Merge(m, src) +} +func (m *Packet) XXX_Size() int { + return xxx_messageInfo_Packet.Size(m) +} +func (m *Packet) XXX_DiscardUnknown() { + xxx_messageInfo_Packet.DiscardUnknown(m) +} + +var xxx_messageInfo_Packet proto.InternalMessageInfo + +type isPacket_Sum interface { + isPacket_Sum() +} + +type Packet_PacketPing struct { + PacketPing *PacketPing `protobuf:"bytes,1,opt,name=packet_ping,json=packetPing,proto3,oneof" json:"packet_ping,omitempty"` +} +type Packet_PacketPong struct { + PacketPong *PacketPong `protobuf:"bytes,2,opt,name=packet_pong,json=packetPong,proto3,oneof" json:"packet_pong,omitempty"` +} +type Packet_PacketMsg struct { + PacketMsg *PacketMsg `protobuf:"bytes,3,opt,name=packet_msg,json=packetMsg,proto3,oneof" json:"packet_msg,omitempty"` +} + +func (*Packet_PacketPing) isPacket_Sum() {} +func (*Packet_PacketPong) isPacket_Sum() {} +func (*Packet_PacketMsg) isPacket_Sum() {} + +func (m *Packet) GetSum() isPacket_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *Packet) GetPacketPing() *PacketPing { + if x, ok := m.GetSum().(*Packet_PacketPing); ok { + return x.PacketPing + } + return nil +} + +func (m *Packet) GetPacketPong() *PacketPong { + if x, ok := m.GetSum().(*Packet_PacketPong); ok { + return x.PacketPong + } + return nil +} + +func (m *Packet) GetPacketMsg() *PacketMsg { + if x, ok := m.GetSum().(*Packet_PacketMsg); ok { + return x.PacketMsg + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Packet) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Packet_PacketPing)(nil), + (*Packet_PacketPong)(nil), + (*Packet_PacketMsg)(nil), + } +} + +func init() { + proto.RegisterType((*PacketPing)(nil), "tendermint.proto.p2p.PacketPing") + proto.RegisterType((*PacketPong)(nil), "tendermint.proto.p2p.PacketPong") + proto.RegisterType((*PacketMsg)(nil), "tendermint.proto.p2p.PacketMsg") + proto.RegisterType((*Packet)(nil), "tendermint.proto.p2p.Packet") +} + +func init() { proto.RegisterFile("proto/p2p/conn_msgs.proto", fileDescriptor_8c680f0b24d73fe7) } + +var fileDescriptor_8c680f0b24d73fe7 = []byte{ + // 295 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xc1, 0x4f, 0x83, 0x30, + 0x14, 0xc6, 0x45, 0xdc, 0x0c, 0x8f, 0x79, 0x69, 0x3c, 0x30, 0x2f, 0x10, 0x0e, 0x66, 0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 0x17, 0xfc, 0x76, 0xc9, 0xa0, 0x6f, 0xfe, 0x74, 0x92, 0x80, 0x38, + 0xba, 0x21, 0x04, 0x39, 0x55, 0x35, 0xfe, 0x83, 0xe0, 0x0f, 0x08, 0x72, 0x4a, 0xee, 0xe0, 0xe0, + 0xba, 0xd7, 0x56, 0x75, 0xed, 0xc8, 0xfd, 0x8b, 0xb1, 0x6a, 0x3b, 0x84, 0x25, 0xbe, 0x4d, 0x3c, + 0x02, 0xb3, 0xdd, 0xd6, 0xf1, 0xfc, 0xe5, 0x86, 0x32, 0x59, 0x6d, 0x37, 0x41, 0x8e, 0x75, 0xd8, + 0x03, 0x86, 0xf2, 0xf8, 0xbf, 0x9b, 0xb1, 0x92, 0xb7, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x87, + 0x8c, 0x0a, 0x5f, 0xf3, 0x01, 0x00, 0x00, +} diff --git a/proto/p2p/conn_msgs.proto b/proto/p2p/conn_msgs.proto new file mode 100644 index 000000000..6c362d7ad --- /dev/null +++ b/proto/p2p/conn_msgs.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package tendermint.proto.p2p; + +option go_package = "github.com/tendermint/tendermint/proto/p2p"; + +import "third_party/proto/gogoproto/gogo.proto"; + +message PacketPing {} + +message PacketPong {} + +message PacketMsg { + int32 channel_id = 1 [(gogoproto.customname) = "ChannelID"]; + int32 eof = 2 [(gogoproto.customname) = "EOF"]; + bytes data = 3; +} + +message Packet { + oneof sum { + PacketPing packet_ping = 1; + PacketPong packet_pong = 2; + PacketMsg packet_msg = 3; + } +} diff --git a/proto/p2p/pex_msgs.pb.go b/proto/p2p/pex_msgs.pb.go new file mode 100644 index 000000000..8e77b399a --- /dev/null +++ b/proto/p2p/pex_msgs.pb.go @@ -0,0 +1,195 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/p2p/pex_msgs.proto + +package p2p + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type PexRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PexRequest) Reset() { *m = PexRequest{} } +func (m *PexRequest) String() string { return proto.CompactTextString(m) } +func (*PexRequest) ProtoMessage() {} +func (*PexRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4d6fe6b009e47d8, []int{0} +} +func (m *PexRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PexRequest.Unmarshal(m, b) +} +func (m *PexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PexRequest.Marshal(b, m, deterministic) +} +func (m *PexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PexRequest.Merge(m, src) +} +func (m *PexRequest) XXX_Size() int { + return xxx_messageInfo_PexRequest.Size(m) +} +func (m *PexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PexRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PexRequest proto.InternalMessageInfo + +type PexAddrs struct { + Addrs []NetAddress `protobuf:"bytes,1,rep,name=addrs,proto3" json:"addrs"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PexAddrs) Reset() { *m = PexAddrs{} } +func (m *PexAddrs) String() string { return proto.CompactTextString(m) } +func (*PexAddrs) ProtoMessage() {} +func (*PexAddrs) Descriptor() ([]byte, []int) { + return fileDescriptor_b4d6fe6b009e47d8, []int{1} +} +func (m *PexAddrs) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PexAddrs.Unmarshal(m, b) +} +func (m *PexAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PexAddrs.Marshal(b, m, deterministic) +} +func (m *PexAddrs) XXX_Merge(src proto.Message) { + xxx_messageInfo_PexAddrs.Merge(m, src) +} +func (m *PexAddrs) XXX_Size() int { + return xxx_messageInfo_PexAddrs.Size(m) +} +func (m *PexAddrs) XXX_DiscardUnknown() { + xxx_messageInfo_PexAddrs.DiscardUnknown(m) +} + +var xxx_messageInfo_PexAddrs proto.InternalMessageInfo + +func (m *PexAddrs) GetAddrs() []NetAddress { + if m != nil { + return m.Addrs + } + return nil +} + +type Message struct { + // Types that are valid to be assigned to Sum: + // *Message_PexRequest + // *Message_PexAddrs + Sum isMessage_Sum `protobuf_oneof:"sum"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { + return fileDescriptor_b4d6fe6b009e47d8, []int{2} +} +func (m *Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Message.Unmarshal(m, b) +} +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Message.Marshal(b, m, deterministic) +} +func (m *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(m, src) +} +func (m *Message) XXX_Size() int { + return xxx_messageInfo_Message.Size(m) +} +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_Message proto.InternalMessageInfo + +type isMessage_Sum interface { + isMessage_Sum() +} + +type Message_PexRequest struct { + PexRequest *PexRequest `protobuf:"bytes,1,opt,name=pex_request,json=pexRequest,proto3,oneof" json:"pex_request,omitempty"` +} +type Message_PexAddrs struct { + PexAddrs *PexAddrs `protobuf:"bytes,2,opt,name=pex_addrs,json=pexAddrs,proto3,oneof" json:"pex_addrs,omitempty"` +} + +func (*Message_PexRequest) isMessage_Sum() {} +func (*Message_PexAddrs) isMessage_Sum() {} + +func (m *Message) GetSum() isMessage_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *Message) GetPexRequest() *PexRequest { + if x, ok := m.GetSum().(*Message_PexRequest); ok { + return x.PexRequest + } + return nil +} + +func (m *Message) GetPexAddrs() *PexAddrs { + if x, ok := m.GetSum().(*Message_PexAddrs); ok { + return x.PexAddrs + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Message) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Message_PexRequest)(nil), + (*Message_PexAddrs)(nil), + } +} + +func init() { + proto.RegisterType((*PexRequest)(nil), "tendermint.proto.p2p.PexRequest") + proto.RegisterType((*PexAddrs)(nil), "tendermint.proto.p2p.PexAddrs") + proto.RegisterType((*Message)(nil), "tendermint.proto.p2p.Message") +} + +func init() { proto.RegisterFile("proto/p2p/pex_msgs.proto", fileDescriptor_b4d6fe6b009e47d8) } + +var fileDescriptor_b4d6fe6b009e47d8 = []byte{ + // 255 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x28, 0xca, 0x2f, + 0xc9, 0xd7, 0x2f, 0x30, 0x2a, 0xd0, 0x2f, 0x48, 0xad, 0x88, 0xcf, 0x2d, 0x4e, 0x2f, 0xd6, 0x03, + 0x0b, 0x09, 0x89, 0x94, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, 0xe5, 0x66, 0xe6, 0x95, 0x40, 0x44, 0xf4, + 0x0a, 0x8c, 0x0a, 0xa4, 0x44, 0x11, 0xea, 0x4b, 0x2a, 0x0b, 0x52, 0xa1, 0x8a, 0xa5, 0xd4, 0x4a, + 0x32, 0x32, 0x8b, 0x52, 0xe2, 0x0b, 0x12, 0x8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diff --git a/proto/p2p/pex_msgs.proto b/proto/p2p/pex_msgs.proto new file mode 100644 index 000000000..eece48aa7 --- /dev/null +++ b/proto/p2p/pex_msgs.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package tendermint.proto.p2p; + +option go_package = "github.com/tendermint/tendermint/proto/p2p"; + +import "proto/p2p/types.proto"; +import "third_party/proto/gogoproto/gogo.proto"; + +message PexRequest {} + +message PexAddrs { + repeated NetAddress addrs = 1 [(gogoproto.nullable) = false]; +} + +message Message { + oneof sum { + PexRequest pex_request = 1; + PexAddrs pex_addrs = 2; + } +} diff --git a/proto/p2p/types.pb.go b/proto/p2p/types.pb.go new file mode 100644 index 000000000..b0e3ffe99 --- /dev/null +++ b/proto/p2p/types.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/p2p/types.proto + +package p2p + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type NetAddress struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + IP string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` + Port uint32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` + Str string `protobuf:"bytes,4,opt,name=str,proto3" json:"str,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetAddress) Reset() { *m = NetAddress{} } +func (m *NetAddress) String() string { return proto.CompactTextString(m) } +func (*NetAddress) ProtoMessage() {} +func (*NetAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_5c4320c1810ca85c, []int{0} +} +func (m *NetAddress) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NetAddress.Unmarshal(m, b) +} +func (m *NetAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NetAddress.Marshal(b, m, deterministic) +} +func (m *NetAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetAddress.Merge(m, src) +} +func (m *NetAddress) XXX_Size() int { + return xxx_messageInfo_NetAddress.Size(m) +} +func (m *NetAddress) XXX_DiscardUnknown() { + xxx_messageInfo_NetAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_NetAddress proto.InternalMessageInfo + +func (m *NetAddress) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *NetAddress) GetIP() string { + if m != nil { + return m.IP + } + return "" +} + +func (m *NetAddress) GetPort() uint32 { + if m != nil { + return m.Port + } + return 0 +} + +func (m *NetAddress) GetStr() string { + if m != nil { + return m.Str + } + return "" +} + +type ProtocolVersion struct { + P2P uint64 `protobuf:"varint,1,opt,name=p2p,proto3" json:"p2p,omitempty"` + Block uint64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"` + App uint64 `protobuf:"varint,3,opt,name=app,proto3" json:"app,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProtocolVersion) Reset() { *m = ProtocolVersion{} } +func (m *ProtocolVersion) String() string { return proto.CompactTextString(m) } +func (*ProtocolVersion) ProtoMessage() {} +func (*ProtocolVersion) Descriptor() ([]byte, []int) { + return fileDescriptor_5c4320c1810ca85c, []int{1} +} +func (m *ProtocolVersion) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProtocolVersion.Unmarshal(m, b) +} +func (m *ProtocolVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProtocolVersion.Marshal(b, m, deterministic) +} +func (m *ProtocolVersion) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProtocolVersion.Merge(m, src) +} +func (m *ProtocolVersion) XXX_Size() int { + return xxx_messageInfo_ProtocolVersion.Size(m) +} +func (m *ProtocolVersion) XXX_DiscardUnknown() { + xxx_messageInfo_ProtocolVersion.DiscardUnknown(m) +} + +var xxx_messageInfo_ProtocolVersion proto.InternalMessageInfo + +func (m *ProtocolVersion) GetP2P() uint64 { + if m != nil { + return m.P2P + } + return 0 +} + +func (m *ProtocolVersion) GetBlock() uint64 { + if m != nil { + return m.Block + } + return 0 +} + +func (m *ProtocolVersion) GetApp() uint64 { + if m != nil { + return m.App + } + return 0 +} + +type DefaultNodeInfo struct { + ProtocolVersion ProtocolVersion `protobuf:"bytes,1,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version"` + DefaultNodeID string `protobuf:"bytes,2,opt,name=default_node_id,json=defaultNodeId,proto3" json:"default_node_id,omitempty"` + ListenAddr string `protobuf:"bytes,3,opt,name=listen_addr,json=listenAddr,proto3" json:"listen_addr,omitempty"` + Network string `protobuf:"bytes,4,opt,name=network,proto3" json:"network,omitempty"` + Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` + Channels []byte `protobuf:"bytes,6,opt,name=channels,proto3" json:"channels,omitempty"` + Moniker string `protobuf:"bytes,7,opt,name=moniker,proto3" json:"moniker,omitempty"` + Other DefaultNodeInfoOther `protobuf:"bytes,8,opt,name=other,proto3" json:"other"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DefaultNodeInfo) Reset() { *m = DefaultNodeInfo{} } +func (m *DefaultNodeInfo) String() string { return proto.CompactTextString(m) } +func (*DefaultNodeInfo) ProtoMessage() {} +func (*DefaultNodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_5c4320c1810ca85c, []int{2} +} +func (m *DefaultNodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DefaultNodeInfo.Unmarshal(m, b) +} +func (m *DefaultNodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DefaultNodeInfo.Marshal(b, m, deterministic) +} +func (m *DefaultNodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_DefaultNodeInfo.Merge(m, src) +} +func (m *DefaultNodeInfo) XXX_Size() int { + return xxx_messageInfo_DefaultNodeInfo.Size(m) +} +func (m *DefaultNodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_DefaultNodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_DefaultNodeInfo proto.InternalMessageInfo + +func (m *DefaultNodeInfo) GetProtocolVersion() ProtocolVersion { + if m != nil { + return m.ProtocolVersion + } + return ProtocolVersion{} +} + +func (m *DefaultNodeInfo) GetDefaultNodeID() string { + if m != nil { + return m.DefaultNodeID + } + return "" +} + +func (m *DefaultNodeInfo) GetListenAddr() string { + if m != nil { + return m.ListenAddr + } + return "" +} + +func (m *DefaultNodeInfo) GetNetwork() string { + if m != nil { + return m.Network + } + return "" +} + +func (m *DefaultNodeInfo) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *DefaultNodeInfo) GetChannels() []byte { + if m != nil { + return m.Channels + } + return nil +} + +func (m *DefaultNodeInfo) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *DefaultNodeInfo) GetOther() DefaultNodeInfoOther { + if m != nil { + return m.Other + } + return DefaultNodeInfoOther{} +} + +type DefaultNodeInfoOther struct { + TxIndex string `protobuf:"bytes,1,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` + RPCAdddress string `protobuf:"bytes,2,opt,name=rpc_address,json=rpcAddress,proto3" json:"rpc_address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DefaultNodeInfoOther) Reset() { *m = DefaultNodeInfoOther{} } +func (m *DefaultNodeInfoOther) String() string { return proto.CompactTextString(m) } +func (*DefaultNodeInfoOther) ProtoMessage() {} +func (*DefaultNodeInfoOther) Descriptor() ([]byte, []int) { + return fileDescriptor_5c4320c1810ca85c, []int{3} +} +func (m *DefaultNodeInfoOther) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DefaultNodeInfoOther.Unmarshal(m, b) +} +func (m *DefaultNodeInfoOther) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DefaultNodeInfoOther.Marshal(b, m, deterministic) +} +func (m *DefaultNodeInfoOther) XXX_Merge(src proto.Message) { + xxx_messageInfo_DefaultNodeInfoOther.Merge(m, src) +} +func (m *DefaultNodeInfoOther) XXX_Size() int { + return xxx_messageInfo_DefaultNodeInfoOther.Size(m) +} +func (m *DefaultNodeInfoOther) XXX_DiscardUnknown() { + xxx_messageInfo_DefaultNodeInfoOther.DiscardUnknown(m) +} + +var xxx_messageInfo_DefaultNodeInfoOther proto.InternalMessageInfo + +func (m *DefaultNodeInfoOther) GetTxIndex() string { + if m != nil { + return m.TxIndex + } + return "" +} + +func (m *DefaultNodeInfoOther) GetRPCAdddress() string { + if m != nil { + return m.RPCAdddress + } + return "" +} + +func init() { + proto.RegisterType((*NetAddress)(nil), "tendermint.proto.p2p.NetAddress") + proto.RegisterType((*ProtocolVersion)(nil), "tendermint.proto.p2p.ProtocolVersion") + proto.RegisterType((*DefaultNodeInfo)(nil), "tendermint.proto.p2p.DefaultNodeInfo") + proto.RegisterType((*DefaultNodeInfoOther)(nil), "tendermint.proto.p2p.DefaultNodeInfoOther") +} + +func init() { proto.RegisterFile("proto/p2p/types.proto", fileDescriptor_5c4320c1810ca85c) } + +var fileDescriptor_5c4320c1810ca85c = []byte{ + // 471 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x53, 0xcf, 0x8a, 0xdb, 0x3e, + 0x18, 0xfc, 0xc5, 0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x8b, 0xb3, 0x4f, 0x0a, 0x18, 0x9d, 0x1b, 0x42, 0x57, 0xd0, 0xd7, 0xfb, 0x8c, 0x71, 0x42, 0xf7, + 0xee, 0x0d, 0xe1, 0x9e, 0xde, 0x2f, 0x0d, 0x45, 0x9f, 0x60, 0xa0, 0x64, 0x61, 0x2b, 0xa0, 0x55, + 0xd5, 0x94, 0x17, 0x1c, 0xea, 0x68, 0x80, 0xd3, 0xaf, 0xb7, 0xc4, 0xc9, 0x18, 0x94, 0x2c, 0x9a, + 0xa7, 0x38, 0xff, 0xf8, 0xf3, 0x66, 0xcd, 0xf4, 0xe6, 0x71, 0x15, 0x17, 0x62, 0x37, 0x7b, 0xdd, + 0xf4, 0x18, 0xbe, 0xfc, 0x10, 0xab, 0xae, 0x85, 0x9f, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xa2, + 0x36, 0x05, 0x66, 0x24, 0x03, 0x00, 0x00, +} diff --git a/proto/p2p/types.proto b/proto/p2p/types.proto new file mode 100644 index 000000000..542fc4f19 --- /dev/null +++ b/proto/p2p/types.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; +package tendermint.proto.p2p; + +option go_package = "github.com/tendermint/tendermint/proto/p2p"; + +import "third_party/proto/gogoproto/gogo.proto"; + +message NetAddress { + string id = 1 [(gogoproto.customname) = "ID"]; + string ip = 2 [(gogoproto.customname) = "IP"]; + uint32 port = 3; + string str = 4; +} + +message ProtocolVersion { + uint64 p2p = 1 [(gogoproto.customname) = "P2P"]; + uint64 block = 2; + uint64 app = 3; +} + +message DefaultNodeInfo { + ProtocolVersion protocol_version = 1 [(gogoproto.nullable) = false]; + string default_node_id = 2 [(gogoproto.customname) = "DefaultNodeID"]; + string listen_addr = 3; + string network = 4; + string version = 5; + bytes channels = 6; + string moniker = 7; + DefaultNodeInfoOther other = 8 [(gogoproto.nullable) = false]; +} + +message DefaultNodeInfoOther { + string tx_index = 1; + string rpc_address = 2 [(gogoproto.customname) = "RPCAdddress"]; +} diff --git a/proto/privval/msgs.pb.go b/proto/privval/msgs.pb.go new file mode 100644 index 000000000..74c0b83fc --- /dev/null +++ b/proto/privval/msgs.pb.go @@ -0,0 +1,426 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/privval/msgs.proto + +package privval + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + keys "github.com/tendermint/tendermint/proto/crypto/keys" + types "github.com/tendermint/tendermint/proto/types" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type RemoteSignerError struct { + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RemoteSignerError) Reset() { *m = RemoteSignerError{} } +func (m *RemoteSignerError) String() string { return proto.CompactTextString(m) } +func (*RemoteSignerError) ProtoMessage() {} +func (*RemoteSignerError) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{0} +} +func (m *RemoteSignerError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RemoteSignerError.Unmarshal(m, b) +} +func (m *RemoteSignerError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RemoteSignerError.Marshal(b, m, deterministic) +} +func (m *RemoteSignerError) XXX_Merge(src proto.Message) { + xxx_messageInfo_RemoteSignerError.Merge(m, src) +} +func (m *RemoteSignerError) XXX_Size() int { + return xxx_messageInfo_RemoteSignerError.Size(m) +} +func (m *RemoteSignerError) XXX_DiscardUnknown() { + xxx_messageInfo_RemoteSignerError.DiscardUnknown(m) +} + +var xxx_messageInfo_RemoteSignerError proto.InternalMessageInfo + +func (m *RemoteSignerError) GetCode() int32 { + if m != nil { + return m.Code + } + return 0 +} + +func (m *RemoteSignerError) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +// PubKeyRequest requests the consensus public key from the remote signer. +type PubKeyRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PubKeyRequest) Reset() { *m = PubKeyRequest{} } +func (m *PubKeyRequest) String() string { return proto.CompactTextString(m) } +func (*PubKeyRequest) ProtoMessage() {} +func (*PubKeyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{1} +} +func (m *PubKeyRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PubKeyRequest.Unmarshal(m, b) +} +func (m *PubKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PubKeyRequest.Marshal(b, m, deterministic) +} +func (m *PubKeyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PubKeyRequest.Merge(m, src) +} +func (m *PubKeyRequest) XXX_Size() int { + return xxx_messageInfo_PubKeyRequest.Size(m) +} +func (m *PubKeyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PubKeyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PubKeyRequest proto.InternalMessageInfo + +// PubKeyResponse is a response message containing the public key. +type PubKeyResponse struct { + PubKey keys.PublicKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` + Error *RemoteSignerError `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PubKeyResponse) Reset() { *m = PubKeyResponse{} } +func (m *PubKeyResponse) String() string { return proto.CompactTextString(m) } +func (*PubKeyResponse) ProtoMessage() {} +func (*PubKeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{2} +} +func (m *PubKeyResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PubKeyResponse.Unmarshal(m, b) +} +func (m *PubKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PubKeyResponse.Marshal(b, m, deterministic) +} +func (m *PubKeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PubKeyResponse.Merge(m, src) +} +func (m *PubKeyResponse) XXX_Size() int { + return xxx_messageInfo_PubKeyResponse.Size(m) +} +func (m *PubKeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PubKeyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PubKeyResponse proto.InternalMessageInfo + +func (m *PubKeyResponse) GetPubKey() keys.PublicKey { + if m != nil { + return m.PubKey + } + return keys.PublicKey{} +} + +func (m *PubKeyResponse) GetError() *RemoteSignerError { + if m != nil { + return m.Error + } + return nil +} + +// SignVoteRequest is a request to sign a vote +type SignVoteRequest struct { + Vote types.Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignVoteRequest) Reset() { *m = SignVoteRequest{} } +func (m *SignVoteRequest) String() string { return proto.CompactTextString(m) } +func (*SignVoteRequest) ProtoMessage() {} +func (*SignVoteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{3} +} +func (m *SignVoteRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SignVoteRequest.Unmarshal(m, b) +} +func (m *SignVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SignVoteRequest.Marshal(b, m, deterministic) +} +func (m *SignVoteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignVoteRequest.Merge(m, src) +} +func (m *SignVoteRequest) XXX_Size() int { + return xxx_messageInfo_SignVoteRequest.Size(m) +} +func (m *SignVoteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SignVoteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SignVoteRequest proto.InternalMessageInfo + +func (m *SignVoteRequest) GetVote() types.Vote { + if m != nil { + return m.Vote + } + return types.Vote{} +} + +// SignedVoteResponse is a response containing a signed vote or an error +type SignVoteResponse struct { + Vote types.Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` + Error *RemoteSignerError `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignVoteResponse) Reset() { *m = SignVoteResponse{} } +func (m *SignVoteResponse) String() string { return proto.CompactTextString(m) } +func (*SignVoteResponse) ProtoMessage() {} +func (*SignVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{4} +} +func (m *SignVoteResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SignVoteResponse.Unmarshal(m, b) +} +func (m *SignVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SignVoteResponse.Marshal(b, m, deterministic) +} +func (m *SignVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignVoteResponse.Merge(m, src) +} +func (m *SignVoteResponse) XXX_Size() int { + return xxx_messageInfo_SignVoteResponse.Size(m) +} +func (m *SignVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SignVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SignVoteResponse proto.InternalMessageInfo + +func (m *SignVoteResponse) GetVote() types.Vote { + if m != nil { + return m.Vote + } + return types.Vote{} +} + +func (m *SignVoteResponse) GetError() *RemoteSignerError { + if m != nil { + return m.Error + } + return nil +} + +// SignProposalRequest is a request to sign a proposal +type SignProposalRequest struct { + Proposal types.Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignProposalRequest) Reset() { *m = SignProposalRequest{} } +func (m *SignProposalRequest) String() string { return proto.CompactTextString(m) } +func (*SignProposalRequest) ProtoMessage() {} +func (*SignProposalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{5} +} +func (m *SignProposalRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SignProposalRequest.Unmarshal(m, b) +} +func (m *SignProposalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SignProposalRequest.Marshal(b, m, deterministic) +} +func (m *SignProposalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignProposalRequest.Merge(m, src) +} +func (m *SignProposalRequest) XXX_Size() int { + return xxx_messageInfo_SignProposalRequest.Size(m) +} +func (m *SignProposalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SignProposalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SignProposalRequest proto.InternalMessageInfo + +func (m *SignProposalRequest) GetProposal() types.Proposal { + if m != nil { + return m.Proposal + } + return types.Proposal{} +} + +// SignedProposalResponse is response containing a signed proposal or an error +type SignedProposalResponse struct { + Proposal types.Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` + Error *RemoteSignerError `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignedProposalResponse) Reset() { *m = SignedProposalResponse{} } +func (m *SignedProposalResponse) String() string { return proto.CompactTextString(m) } +func (*SignedProposalResponse) ProtoMessage() {} +func (*SignedProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{6} +} +func (m *SignedProposalResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SignedProposalResponse.Unmarshal(m, b) +} +func (m *SignedProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SignedProposalResponse.Marshal(b, m, deterministic) +} +func (m *SignedProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignedProposalResponse.Merge(m, src) +} +func (m *SignedProposalResponse) XXX_Size() int { + return xxx_messageInfo_SignedProposalResponse.Size(m) +} +func (m *SignedProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SignedProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SignedProposalResponse proto.InternalMessageInfo + +func (m *SignedProposalResponse) GetProposal() types.Proposal { + if m != nil { + return m.Proposal + } + return types.Proposal{} +} + +func (m *SignedProposalResponse) GetError() *RemoteSignerError { + if m != nil { + return m.Error + } + return nil +} + +// PingRequest is a request to confirm that the connection is alive. +type PingRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PingRequest) Reset() { *m = PingRequest{} } +func (m *PingRequest) String() string { return proto.CompactTextString(m) } +func (*PingRequest) ProtoMessage() {} +func (*PingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{7} +} +func (m *PingRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PingRequest.Unmarshal(m, b) +} +func (m *PingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PingRequest.Marshal(b, m, deterministic) +} +func (m *PingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingRequest.Merge(m, src) +} +func (m *PingRequest) XXX_Size() int { + return xxx_messageInfo_PingRequest.Size(m) +} +func (m *PingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PingRequest proto.InternalMessageInfo + +// PingResponse is a response to confirm that the connection is alive. +type PingResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PingResponse) Reset() { *m = PingResponse{} } +func (m *PingResponse) String() string { return proto.CompactTextString(m) } +func (*PingResponse) ProtoMessage() {} +func (*PingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ec52cc5e378f9a4, []int{8} +} +func (m *PingResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PingResponse.Unmarshal(m, b) +} +func (m *PingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PingResponse.Marshal(b, m, deterministic) +} +func (m *PingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingResponse.Merge(m, src) +} +func (m *PingResponse) XXX_Size() int { + return xxx_messageInfo_PingResponse.Size(m) +} +func (m *PingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PingResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*RemoteSignerError)(nil), "tendermint.proto.privval.RemoteSignerError") + proto.RegisterType((*PubKeyRequest)(nil), "tendermint.proto.privval.PubKeyRequest") + proto.RegisterType((*PubKeyResponse)(nil), "tendermint.proto.privval.PubKeyResponse") + proto.RegisterType((*SignVoteRequest)(nil), "tendermint.proto.privval.SignVoteRequest") + proto.RegisterType((*SignVoteResponse)(nil), "tendermint.proto.privval.SignVoteResponse") + proto.RegisterType((*SignProposalRequest)(nil), "tendermint.proto.privval.SignProposalRequest") + proto.RegisterType((*SignedProposalResponse)(nil), "tendermint.proto.privval.SignedProposalResponse") + proto.RegisterType((*PingRequest)(nil), "tendermint.proto.privval.PingRequest") + proto.RegisterType((*PingResponse)(nil), "tendermint.proto.privval.PingResponse") +} + +func init() { proto.RegisterFile("proto/privval/msgs.proto", fileDescriptor_9ec52cc5e378f9a4) } + +var fileDescriptor_9ec52cc5e378f9a4 = []byte{ + // 401 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xd1, 0xca, 0xd3, 0x30, + 0x1c, 0xc5, 0xad, 0x6c, 0x53, 0xff, 0x75, 0x9b, 0x56, 0xd0, 0x32, 0x14, 0x4b, 0x2f, 0x74, 0x20, + 0xa4, 0x32, 0xc1, 0x7b, 0x07, 0x0a, 0x63, 0x37, 0xa5, 0x82, 0xa0, 0x37, 0x63, 0x6d, 0xff, 0x74, + 0x61, 0x6b, 0x13, 0x93, 0x74, 0xd0, 0x87, 0xf0, 0x09, 0xbc, 0xf0, 0x75, 0x7c, 0x0a, 0x9f, 0x45, + 0x9a, 0xa4, 0x5f, 0xf7, 0x31, 0x76, 0xf3, 0xb1, 0xbb, 0xe4, 0xe4, 0x7f, 0x4e, 0xce, 0x2f, 0xb4, + 0xe0, 0x73, 0xc1, 0x14, 0x8b, 0xb8, 0xa0, 0xc7, 0xe3, 0xf6, 0x10, 0x95, 0xb2, 0x90, 0x44, 0x4b, + 0x9e, 0xaf, 0xb0, 0xca, 0x51, 0x94, 0xb4, 0x52, 0x46, 0x21, 0x76, 0x68, 0xf6, 0x46, 0xed, 0xa8, + 0xc8, 0x37, 0x7c, 0x2b, 0x54, 0x13, 0x19, 0x7f, 0xc1, 0x0a, 0xd6, 0xaf, 0xcc, 0xfc, 0xec, 0x95, + 0x51, 0x32, 0xd1, 0x70, 0xc5, 0xa2, 0x3d, 0x36, 0x32, 0x52, 0x0d, 0x47, 0x7b, 0xc1, 0xec, 0x85, + 0x39, 0xd6, 0xd2, 0xe9, 0x41, 0xb8, 0x82, 0xa7, 0x09, 0x96, 0x4c, 0xe1, 0x57, 0x5a, 0x54, 0x28, + 0x3e, 0x0b, 0xc1, 0x84, 0xe7, 0xc1, 0x20, 0x63, 0x39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xc0, 0x8f, + 0xc1, 0x8d, 0x69, 0x55, 0x74, 0x1f, 0xe1, 0x04, 0x1e, 0x9b, 0xad, 0x69, 0xb9, 0x7c, 0xff, 0x83, + 0x14, 0x54, 0xed, 0xea, 0x94, 0x64, 0xac, 0x8c, 0xfa, 0xf8, 0xd3, 0xe5, 0xad, 0xff, 0x34, 0x1d, + 0xe9, 0xed, 0x87, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x00, 0x13, 0x1c, 0xbf, 0x03, 0x00, + 0x00, +} diff --git a/proto/privval/msgs.proto b/proto/privval/msgs.proto new file mode 100644 index 000000000..a88c01658 --- /dev/null +++ b/proto/privval/msgs.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; +package tendermint.proto.privval; + +option go_package = "github.com/tendermint/tendermint/proto/privval"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "proto/crypto/keys/types.proto"; +import "proto/types/types.proto"; + +message RemoteSignerError { + int32 code = 1; + string description = 2; +} + +// PubKeyRequest requests the consensus public key from the remote signer. +message PubKeyRequest {} + +// PubKeyResponse is a response message containing the public key. +message PubKeyResponse { + tendermint.proto.crypto.keys.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; + RemoteSignerError error = 2; +} + +// SignVoteRequest is a request to sign a vote +message SignVoteRequest { + tendermint.proto.types.Vote vote = 1 [(gogoproto.nullable) = false]; +} + +// SignedVoteResponse is a response containing a signed vote or an error +message SignVoteResponse { + tendermint.proto.types.Vote vote = 1 [(gogoproto.nullable) = false]; + RemoteSignerError error = 2; +} + +// SignProposalRequest is a request to sign a proposal +message SignProposalRequest { + tendermint.proto.types.Proposal proposal = 1 [(gogoproto.nullable) = false]; +} + +// SignedProposalResponse is response containing a signed proposal or an error +message SignedProposalResponse { + tendermint.proto.types.Proposal proposal = 1 [(gogoproto.nullable) = false]; + RemoteSignerError error = 2; +} + +// PingRequest is a request to confirm that the connection is alive. +message PingRequest {} + +// PingResponse is a response to confirm that the connection is alive. +message PingResponse {} diff --git a/proto/privval/types.pb.go b/proto/privval/types.pb.go new file mode 100644 index 000000000..69e87091b --- /dev/null +++ b/proto/privval/types.pb.go @@ -0,0 +1,199 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/privval/types.proto + +package privval + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + keys "github.com/tendermint/tendermint/proto/crypto/keys" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// FilePVKey stores the immutable part of PrivValidator. +type FilePVKey struct { + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + PubKey keys.PublicKey `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` + PrivKey keys.PrivateKey `protobuf:"bytes,3,opt,name=priv_key,json=privKey,proto3" json:"priv_key"` + FilePath string `protobuf:"bytes,4,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FilePVKey) Reset() { *m = FilePVKey{} } +func (m *FilePVKey) String() string { return proto.CompactTextString(m) } +func (*FilePVKey) ProtoMessage() {} +func (*FilePVKey) Descriptor() ([]byte, []int) { + return fileDescriptor_a9d74c406df3ad93, []int{0} +} +func (m *FilePVKey) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FilePVKey.Unmarshal(m, b) +} +func (m *FilePVKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FilePVKey.Marshal(b, m, deterministic) +} +func (m *FilePVKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilePVKey.Merge(m, src) +} +func (m *FilePVKey) XXX_Size() int { + return xxx_messageInfo_FilePVKey.Size(m) +} +func (m *FilePVKey) XXX_DiscardUnknown() { + xxx_messageInfo_FilePVKey.DiscardUnknown(m) +} + +var xxx_messageInfo_FilePVKey proto.InternalMessageInfo + +func (m *FilePVKey) GetAddress() []byte { + if m != nil { + return m.Address + } + return nil +} + +func (m *FilePVKey) GetPubKey() keys.PublicKey { + if m != nil { + return m.PubKey + } + return keys.PublicKey{} +} + +func (m *FilePVKey) GetPrivKey() keys.PrivateKey { + if m != nil { + return m.PrivKey + } + return keys.PrivateKey{} +} + +func (m *FilePVKey) GetFilePath() string { + if m != nil { + return m.FilePath + } + return "" +} + +// FilePVLastSignState stores the mutable part of PrivValidator. +type FilePVLastSignState struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int64 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Step int32 `protobuf:"varint,3,opt,name=step,proto3" json:"step,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` + SignBytes []byte `protobuf:"bytes,5,opt,name=sign_bytes,json=signBytes,proto3" json:"sign_bytes,omitempty"` + FilePath string `protobuf:"bytes,6,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FilePVLastSignState) Reset() { *m = FilePVLastSignState{} } +func (m *FilePVLastSignState) String() string { return proto.CompactTextString(m) } +func (*FilePVLastSignState) ProtoMessage() {} +func (*FilePVLastSignState) Descriptor() ([]byte, []int) { + return fileDescriptor_a9d74c406df3ad93, []int{1} +} +func (m *FilePVLastSignState) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FilePVLastSignState.Unmarshal(m, b) +} +func (m *FilePVLastSignState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FilePVLastSignState.Marshal(b, m, deterministic) +} +func (m *FilePVLastSignState) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilePVLastSignState.Merge(m, src) +} +func (m *FilePVLastSignState) XXX_Size() int { + return xxx_messageInfo_FilePVLastSignState.Size(m) +} +func (m *FilePVLastSignState) XXX_DiscardUnknown() { + xxx_messageInfo_FilePVLastSignState.DiscardUnknown(m) +} + +var xxx_messageInfo_FilePVLastSignState proto.InternalMessageInfo + +func (m *FilePVLastSignState) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *FilePVLastSignState) GetRound() int64 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *FilePVLastSignState) GetStep() int32 { + if m != nil { + return m.Step + } + return 0 +} + +func (m *FilePVLastSignState) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *FilePVLastSignState) GetSignBytes() []byte { + if m != nil { + return m.SignBytes + } + return nil +} + +func (m *FilePVLastSignState) GetFilePath() string { + if m != nil { + return m.FilePath + } + return "" +} + +func init() { + proto.RegisterType((*FilePVKey)(nil), "tendermint.proto.privval.FilePVKey") + proto.RegisterType((*FilePVLastSignState)(nil), "tendermint.proto.privval.FilePVLastSignState") +} + +func init() { proto.RegisterFile("proto/privval/types.proto", fileDescriptor_a9d74c406df3ad93) } + +var fileDescriptor_a9d74c406df3ad93 = []byte{ + // 357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x4d, 0x6e, 0xe2, 0x30, + 0x14, 0x9e, 0x0c, 0x10, 0x88, 0x87, 0x95, 0x67, 0x34, 0xca, 0x30, 0x45, 0x45, 0x2c, 0xda, 0xac, + 0x92, 0xaa, 0xbd, 0x01, 0x0b, 0xa4, 0x8a, 0x2e, 0x50, 0x90, 0xba, 0xe8, 0x26, 0x72, 0xc8, 0x6b, + 0x62, 0x11, 0x12, 0xcb, 0x7e, 0x41, 0xf2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x32, 0xc4, 0x9a, 0x61, + 0x31, 0x7f, 0x71, 0xc8, 0xef, 0xb6, 0xd7, 0x03, 0x53, 0xb8, 0xe1, 0x79, 0xb5, 0x41, 0x86, 0x40, + 0xff, 0x12, 0xb7, 0x00, 0x9e, 0x17, 0x68, 0x0b, 0xf6, 0xe2, 0x23, 0xa2, 0x7f, 0xc8, 0x40, 0xd6, + 0x4d, 0x95, 0xd9, 0x76, 0xbd, 0xb8, 0x05, 0x94, 0x92, 0xbe, 0x42, 0x10, 0x36, 0xe9, 0x20, 0xb6, + 0x33, 0xbd, 0x20, 0x9e, 0xe2, 0x79, 0xc5, 0xb0, 0x91, 0x60, 0x6d, 0xc7, 0x71, 0x47, 0xd0, 0x29, + 0x21, 0x06, 0x24, 0xa9, 0x46, 0x50, 0xfe, 0xa0, 0x3b, 0x5e, 0x18, 0xe2, 0x3c, 0xb3, 0x7b, 0x9e, + 0x79, 0x71, 0xf3, 0x14, 0xe6, 0x1c, 0x8b, 0x26, 0x0d, 0xb7, 0xf5, 0x3e, 0xea, 0x5e, 0xe5, 0x74, + 0x3c, 0xfb, 0x2a, 0xa9, 0x6b, 0xe1, 0xdd, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xa3, 0x78, + 0xe9, 0x42, 0x02, 0x00, 0x00, +} diff --git a/proto/privval/types.proto b/proto/privval/types.proto new file mode 100644 index 000000000..80b613a7c --- /dev/null +++ b/proto/privval/types.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package tendermint.proto.privval; + +option go_package = "github.com/tendermint/tendermint/proto/privval"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "proto/crypto/keys/types.proto"; + +// FilePVKey stores the immutable part of PrivValidator. +message FilePVKey { + bytes address = 1; + tendermint.proto.crypto.keys.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; + tendermint.proto.crypto.keys.PrivateKey priv_key = 3 [(gogoproto.nullable) = false]; + + string file_path = 4; +} + +// FilePVLastSignState stores the mutable part of PrivValidator. +message FilePVLastSignState { + int64 height = 1; + int64 round = 2; + int32 step = 3; + bytes signature = 4; + bytes sign_bytes = 5; + + string file_path = 6; +} diff --git a/proto/state/types.pb.go b/proto/state/types.pb.go index 82472a355..fd897f734 100644 --- a/proto/state/types.pb.go +++ b/proto/state/types.pb.go @@ -227,7 +227,7 @@ func (m *Version) GetSoftware() string { type State struct { Version Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version"` // immutable - ChainID string `protobuf:"bytes,2,opt,name=chain_Id,json=chainId,proto3" json:"chain_Id,omitempty"` + ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` LastBlockID types1.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` @@ -247,9 +247,9 @@ type State struct { ConsensusParams types1.ConsensusParams `protobuf:"bytes,10,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` LastHeightConsensusParamsChanged int64 `protobuf:"varint,11,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"` // Merkle root of the results from executing prev block - LastResultsHash []byte `protobuf:"bytes,12,opt,name=LastResultsHash,proto3" json:"LastResultsHash,omitempty"` + LastResultsHash []byte `protobuf:"bytes,12,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` // the latest AppHash we've received from calling abci.Commit() - AppHash []byte `protobuf:"bytes,13,opt,name=AppHash,proto3" json:"AppHash,omitempty"` + AppHash []byte `protobuf:"bytes,13,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -381,51 +381,51 @@ func init() { func init() { proto.RegisterFile("proto/state/types.proto", fileDescriptor_00e69fef8162ea9b) } var fileDescriptor_00e69fef8162ea9b = []byte{ - // 722 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x5d, 0x6a, 0xdb, 0x40, - 0x10, 0xae, 0xea, 0x24, 0xb6, 0x47, 0x71, 0xdc, 0x6e, 0x20, 0x15, 0x0e, 0xd4, 0xc6, 0x0d, 0x89, - 0x5b, 0x8a, 0x0c, 0xe9, 0x01, 0x4a, 0x64, 0x97, 0x46, 0x25, 0x2d, 0x45, 0x09, 0x21, 0xf4, 0x45, - 0xc8, 0xd6, 0x46, 0x12, 0xb5, 0x25, 0xa1, 0x5d, 0xbb, 0xc9, 0x19, 0xfa, 0xd2, 0x1b, 0xf4, 0x3a, - 0xbd, 0x43, 0x21, 0x85, 0x3c, 0xf7, 0x10, 0x65, 0x7f, 0x24, 0x6d, 0x9c, 0x84, 0x60, 0xe8, 0x93, - 0x57, 0x33, 0xf3, 0x7d, 0xf3, 0xcd, 0xee, 0x37, 0x18, 0x9e, 0xa5, 0x59, 0x42, 0x93, 0x3e, 0xa1, - 0x1e, 0xc5, 0x7d, 0x7a, 0x99, 0x62, 0x62, 0xf2, 0x08, 0xda, 0xa2, 0x38, 0xf6, 0x71, 0x36, 0x8d, - 0x62, 0x2a, 0x22, 0x26, 0xaf, 0x69, 0xed, 0xd2, 0x30, 0xca, 0x7c, 0x37, 0xf5, 0x32, 0x7a, 0xd9, - 0x17, 0xe0, 0x20, 0x09, 0x92, 0xf2, 0x24, 0xaa, 0x5b, 0x5b, 0xde, 0x68, 0x1c, 0x09, 0x46, 0x95, - 0xb7, 0x25, 0x1b, 0xde, 0x4e, 0x6c, 0xab, 0x89, 0xb9, 0x37, 0x89, 0x7c, 0x8f, 0x26, 0x99, 0x4c, - 0x1a, 0x6a, 0x32, 0xf5, 0x32, 0x6f, 0xba, 0x00, 0x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0xd0, 0xd1, 0x0b, 0x76, 0xdb, 0x47, 0x47, 0xd0, 0x54, 0x98, 0xd9, 0x96, - 0x1a, 0xab, 0x9c, 0xbb, 0x65, 0x8a, 0x15, 0x36, 0xf3, 0x15, 0x36, 0x4f, 0xf2, 0x15, 0xb6, 0x6a, - 0x8c, 0xf6, 0xc7, 0x9f, 0xb6, 0xe6, 0x34, 0x0a, 0x2e, 0x96, 0x45, 0x1f, 0xa1, 0x19, 0xe3, 0x0b, - 0xea, 0x16, 0xee, 0x24, 0xc6, 0xda, 0x12, 0xae, 0xde, 0x60, 0xe0, 0x72, 0x4d, 0xd0, 0x10, 0x40, - 0x61, 0xaa, 0x2e, 0xc1, 0xa4, 0xe0, 0x98, 0x28, 0x3e, 0xa2, 0x42, 0x55, 0x5b, 0x46, 0x14, 0x03, - 0x2b, 0xa2, 0x06, 0xf0, 0x5c, 0xb5, 0x72, 0xc9, 0x5a, 0xb8, 0xba, 0xce, 0x1f, 0x71, 0xbb, 0x74, - 0x75, 0x89, 0x96, 0xfe, 0xbe, 0x73, 0xd3, 0xe0, 0xbf, 0x6c, 0xda, 0x27, 0xd8, 0xb9, 0xb1, 0x69, - 0x0b, 0x5d, 0x0a, 0x91, 0x3a, 0x17, 0xd9, 0x51, 0x56, 0xef, 0x26, 0x51, 0xae, 0xb4, 0x07, 0x4d, - 0x66, 0x1e, 0x07, 0x93, 0xd9, 0x84, 0x92, 0x43, 0x8f, 0x84, 0xc6, 0x7a, 0x47, 0xeb, 0xad, 0x3b, - 0x8b, 0x61, 0x64, 0x40, 0xf5, 0x20, 0x4d, 0x79, 0x45, 0x83, 0x57, 0xe4, 0x9f, 0x96, 0xf9, 0xe5, - 0x75, 0x10, 0xd1, 0x70, 0x36, 0x32, 0xc7, 0xc9, 0xb4, 0x5f, 0xce, 0xa7, 0x1e, 0x95, 0xbf, 0xc3, - 0xd1, 0x1a, 0xff, 0x78, 0xf3, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x78, 0x53, 0xd2, 0x08, 0x24, 0x07, - 0x00, 0x00, + // 729 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x5d, 0x6a, 0xdb, 0x4a, + 0x18, 0xbd, 0xba, 0x4e, 0x62, 0xfb, 0x53, 0x1c, 0xdf, 0x3b, 0x81, 0x5c, 0x5d, 0x07, 0x6a, 0xe3, + 0x86, 0xc4, 0x2d, 0x45, 0x86, 0x74, 0x01, 0xa5, 0xb2, 0x4b, 0xa3, 0x92, 0x96, 0xa2, 0x84, 0x10, + 0xfa, 0x22, 0xc6, 0xd6, 0x44, 0x12, 0xb5, 0x25, 0xa1, 0x19, 0xbb, 0xc9, 0x1a, 0xfa, 0xd2, 0x1d, + 0x74, 0x3b, 0x5d, 0x85, 0x0b, 0x79, 0xee, 0x22, 0xca, 0xfc, 0x48, 0x9e, 0xfc, 0x11, 0x0c, 0x7d, + 0xf2, 0x68, 0xce, 0x77, 0xce, 0x77, 0x66, 0xe6, 0x7c, 0x18, 0xfe, 0xcb, 0xf2, 0x94, 0xa5, 0x7d, + 0xca, 0x30, 0x23, 0x7d, 0x76, 0x95, 0x11, 0x6a, 0x8b, 0x1d, 0xb4, 0xc3, 0x48, 0x12, 0x90, 0x7c, + 0x1a, 0x27, 0x4c, 0xee, 0xd8, 0xa2, 0xa6, 0xb5, 0xcf, 0xa2, 0x38, 0x0f, 0xfc, 0x0c, 0xe7, 0xec, + 0xaa, 0x2f, 0xc9, 0x61, 0x1a, 0xa6, 0xcb, 0x95, 0xac, 0x6e, 0xed, 0xe0, 0xd1, 0x38, 0x96, 0x8a, + 0xba, 0x6e, 0x4b, 0x35, 0xbc, 0x0b, 0xec, 0xea, 0xc0, 0x1c, 0x4f, 0xe2, 0x00, 0xb3, 0x34, 0x57, + 0xa0, 0xa5, 0x83, 0x19, 0xce, 0xf1, 0xf4, 0x16, 0x6d, 0x4e, 0x72, 0x1a, 0xa7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ff, 0x93, 0x33, 0x0f, 0xa0, 0x27, 0x07, 0x00, 0x00, } diff --git a/proto/state/types.proto b/proto/state/types.proto index 210bc4266..9db1b153c 100644 --- a/proto/state/types.proto +++ b/proto/state/types.proto @@ -41,7 +41,7 @@ message State { Version version = 1 [(gogoproto.nullable) = false]; // immutable - string chain_Id = 2 [(gogoproto.customname) = "ChainID"]; + string chain_id = 2 [(gogoproto.customname) = "ChainID"]; // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) int64 last_block_height = 3; @@ -63,12 +63,12 @@ message State { // Consensus parameters used for validating blocks. // Changes returned by EndBlock and updated after Commit. - tendermint.proto.types.ConsensusParams consensus_params = 10 [(gogoproto.nullable) = false]; + tendermint.proto.types.ConsensusParams consensus_params = 10 [(gogoproto.nullable) = false]; int64 last_height_consensus_params_changed = 11; // Merkle root of the results from executing prev block - bytes LastResultsHash = 12; + bytes last_results_hash = 12; // the latest AppHash we've received from calling abci.Commit() - bytes AppHash = 13; + bytes app_hash = 13; } diff --git a/proto/statesync/types.pb.go b/proto/statesync/types.pb.go new file mode 100644 index 000000000..2176e090f --- /dev/null +++ b/proto/statesync/types.pb.go @@ -0,0 +1,385 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/statesync/types.proto + +package statesync + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Message struct { + // Types that are valid to be assigned to Sum: + // *Message_SnapshotsRequest + // *Message_SnapshotsResponse + // *Message_ChunkRequest + // *Message_ChunkResponse + Sum isMessage_Sum `protobuf_oneof:"sum"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { + return fileDescriptor_bef273312884335b, []int{0} +} +func (m *Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Message.Unmarshal(m, b) +} +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Message.Marshal(b, m, deterministic) +} +func (m *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(m, src) +} +func (m *Message) XXX_Size() int { + return xxx_messageInfo_Message.Size(m) +} +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_Message proto.InternalMessageInfo + +type isMessage_Sum interface { + isMessage_Sum() +} + +type Message_SnapshotsRequest struct { + SnapshotsRequest *SnapshotsRequest `protobuf:"bytes,1,opt,name=snapshots_request,json=snapshotsRequest,proto3,oneof" json:"snapshots_request,omitempty"` +} +type Message_SnapshotsResponse struct { + SnapshotsResponse *SnapshotsResponse `protobuf:"bytes,2,opt,name=snapshots_response,json=snapshotsResponse,proto3,oneof" json:"snapshots_response,omitempty"` +} +type Message_ChunkRequest struct { + ChunkRequest *ChunkRequest `protobuf:"bytes,3,opt,name=chunk_request,json=chunkRequest,proto3,oneof" json:"chunk_request,omitempty"` +} +type Message_ChunkResponse struct { + ChunkResponse *ChunkResponse `protobuf:"bytes,4,opt,name=chunk_response,json=chunkResponse,proto3,oneof" json:"chunk_response,omitempty"` +} + +func (*Message_SnapshotsRequest) isMessage_Sum() {} +func (*Message_SnapshotsResponse) isMessage_Sum() {} +func (*Message_ChunkRequest) isMessage_Sum() {} +func (*Message_ChunkResponse) isMessage_Sum() {} + +func (m *Message) GetSum() isMessage_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *Message) GetSnapshotsRequest() *SnapshotsRequest { + if x, ok := m.GetSum().(*Message_SnapshotsRequest); ok { + return x.SnapshotsRequest + } + return nil +} + +func (m *Message) GetSnapshotsResponse() *SnapshotsResponse { + if x, ok := m.GetSum().(*Message_SnapshotsResponse); ok { + return x.SnapshotsResponse + } + return nil +} + +func (m *Message) GetChunkRequest() *ChunkRequest { + if x, ok := m.GetSum().(*Message_ChunkRequest); ok { + return x.ChunkRequest + } + return nil +} + +func (m *Message) GetChunkResponse() *ChunkResponse { + if x, ok := m.GetSum().(*Message_ChunkResponse); ok { + return x.ChunkResponse + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Message) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Message_SnapshotsRequest)(nil), + (*Message_SnapshotsResponse)(nil), + (*Message_ChunkRequest)(nil), + (*Message_ChunkResponse)(nil), + } +} + +type SnapshotsRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SnapshotsRequest) Reset() { *m = SnapshotsRequest{} } +func (m *SnapshotsRequest) String() string { return proto.CompactTextString(m) } +func (*SnapshotsRequest) ProtoMessage() {} +func (*SnapshotsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_bef273312884335b, []int{1} +} +func (m *SnapshotsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SnapshotsRequest.Unmarshal(m, b) +} +func (m *SnapshotsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SnapshotsRequest.Marshal(b, m, deterministic) +} +func (m *SnapshotsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SnapshotsRequest.Merge(m, src) +} +func (m *SnapshotsRequest) XXX_Size() int { + return xxx_messageInfo_SnapshotsRequest.Size(m) +} +func (m *SnapshotsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SnapshotsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SnapshotsRequest proto.InternalMessageInfo + +type SnapshotsResponse struct { + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Format uint32 `protobuf:"varint,2,opt,name=format,proto3" json:"format,omitempty"` + Chunks uint32 `protobuf:"varint,3,opt,name=chunks,proto3" json:"chunks,omitempty"` + Hash []byte `protobuf:"bytes,4,opt,name=hash,proto3" json:"hash,omitempty"` + Metadata []byte `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SnapshotsResponse) Reset() { *m = SnapshotsResponse{} } +func (m *SnapshotsResponse) String() string { return proto.CompactTextString(m) } +func (*SnapshotsResponse) ProtoMessage() {} +func (*SnapshotsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bef273312884335b, []int{2} +} +func (m *SnapshotsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SnapshotsResponse.Unmarshal(m, b) +} +func (m *SnapshotsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SnapshotsResponse.Marshal(b, m, deterministic) +} +func (m *SnapshotsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SnapshotsResponse.Merge(m, src) +} +func (m *SnapshotsResponse) XXX_Size() int { + return xxx_messageInfo_SnapshotsResponse.Size(m) +} +func (m *SnapshotsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SnapshotsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SnapshotsResponse proto.InternalMessageInfo + +func (m *SnapshotsResponse) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *SnapshotsResponse) GetFormat() uint32 { + if m != nil { + return m.Format + } + return 0 +} + +func (m *SnapshotsResponse) GetChunks() uint32 { + if m != nil { + return m.Chunks + } + return 0 +} + +func (m *SnapshotsResponse) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func (m *SnapshotsResponse) GetMetadata() []byte { + if m != nil { + return m.Metadata + } + return nil +} + +type ChunkRequest struct { + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Format uint32 `protobuf:"varint,2,opt,name=format,proto3" json:"format,omitempty"` + Index uint32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChunkRequest) Reset() { *m = ChunkRequest{} } +func (m *ChunkRequest) String() string { return proto.CompactTextString(m) } +func (*ChunkRequest) ProtoMessage() {} +func (*ChunkRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_bef273312884335b, []int{3} +} +func (m *ChunkRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChunkRequest.Unmarshal(m, b) +} +func (m *ChunkRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChunkRequest.Marshal(b, m, deterministic) +} +func (m *ChunkRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChunkRequest.Merge(m, src) +} +func (m *ChunkRequest) XXX_Size() int { + return xxx_messageInfo_ChunkRequest.Size(m) +} +func (m *ChunkRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ChunkRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ChunkRequest proto.InternalMessageInfo + +func (m *ChunkRequest) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *ChunkRequest) GetFormat() uint32 { + if m != nil { + return m.Format + } + return 0 +} + +func (m *ChunkRequest) GetIndex() uint32 { + if m != nil { + return m.Index + } + return 0 +} + +type ChunkResponse struct { + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Format uint32 `protobuf:"varint,2,opt,name=format,proto3" json:"format,omitempty"` + Index uint32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` + Chunk []byte `protobuf:"bytes,4,opt,name=chunk,proto3" json:"chunk,omitempty"` + Missing bool `protobuf:"varint,5,opt,name=missing,proto3" json:"missing,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChunkResponse) Reset() { *m = ChunkResponse{} } +func (m *ChunkResponse) String() string { return proto.CompactTextString(m) } +func (*ChunkResponse) ProtoMessage() {} +func (*ChunkResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bef273312884335b, []int{4} +} +func (m *ChunkResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChunkResponse.Unmarshal(m, b) +} +func (m *ChunkResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChunkResponse.Marshal(b, m, deterministic) +} +func (m *ChunkResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChunkResponse.Merge(m, src) +} +func (m *ChunkResponse) XXX_Size() int { + return xxx_messageInfo_ChunkResponse.Size(m) +} +func (m *ChunkResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ChunkResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ChunkResponse proto.InternalMessageInfo + +func (m *ChunkResponse) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *ChunkResponse) GetFormat() uint32 { + if m != nil { + return m.Format + } + return 0 +} + +func (m *ChunkResponse) GetIndex() uint32 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *ChunkResponse) GetChunk() []byte { + if m != nil { + return m.Chunk + } + return nil +} + +func (m *ChunkResponse) GetMissing() bool { + if m != nil { + return m.Missing + } + return false +} + +func init() { + proto.RegisterType((*Message)(nil), "tendermint.proto.statesync.Message") + proto.RegisterType((*SnapshotsRequest)(nil), "tendermint.proto.statesync.SnapshotsRequest") + proto.RegisterType((*SnapshotsResponse)(nil), "tendermint.proto.statesync.SnapshotsResponse") + proto.RegisterType((*ChunkRequest)(nil), "tendermint.proto.statesync.ChunkRequest") + proto.RegisterType((*ChunkResponse)(nil), "tendermint.proto.statesync.ChunkResponse") +} + +func init() { proto.RegisterFile("proto/statesync/types.proto", fileDescriptor_bef273312884335b) } + +var fileDescriptor_bef273312884335b = []byte{ + // 357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xcd, 0x4a, 0xc3, 0x40, + 0x14, 0x85, 0x9b, 0xfe, 0x73, 0x6d, 0xa4, 0x1d, 0x44, 0x42, 0xdd, 0x48, 0x56, 0x15, 0x34, 0x95, + 0xfa, 0x06, 0x75, 0xd3, 0x8d, 0x08, 0xa3, 0x2b, 0x05, 0x65, 0x9a, 0x8e, 0x49, 0x90, 0x4c, 0x62, + 0xee, 0x04, 0xec, 0x03, 0xb8, 0xf2, 0x6d, 0x7d, 0x02, 0xc9, 0x4d, 0x9a, 0xc6, 0x88, 0x52, 0xc1, + 0xdd, 0x9c, 0x43, 0xee, 0x97, 0x73, 0xee, 0x30, 0x70, 0x14, 0x27, 0x91, 0x8e, 0xa6, 0xa8, 0x85, + 0x96, 0xb8, 0x56, 0xee, 0x54, 0xaf, 0x63, 0x89, 0x0e, 0xb9, 0x6c, 0xac, 0xa5, 0x5a, 0xc9, 0x24, + 0x0c, 0x94, 0xce, 0x1d, 0xa7, 0xfc, 0xce, 0xfe, 0x68, 0x42, 0xef, 0x4a, 0x22, 0x0a, 0x4f, 0xb2, + 0x7b, 0x18, 0xa1, 0x12, 0x31, 0xfa, 0x91, 0xc6, 0xc7, 0x44, 0xbe, 0xa4, 0x12, 0xb5, 0x65, 0x1c, + 0x1b, 0x93, 0xbd, 0xd9, 0xa9, 0xf3, 0x33, 0xc3, 0xb9, 0xd9, 0x0c, 0xf1, 0x7c, 0x66, 0xd1, 0xe0, + 0x43, 0xac, 0x79, 0xec, 0x01, 0x58, 0x15, 0x8e, 0x71, 0xa4, 0x50, 0x5a, 0x4d, 0xa2, 0x9f, 0xed, + 0x48, 0xcf, 0x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 0x06, 0x00, 0x00, 0xff, 0xff, 0x79, 0xd0, 0x53, + 0x2f, 0x6a, 0x03, 0x00, 0x00, +} diff --git a/proto/statesync/types.proto b/proto/statesync/types.proto new file mode 100644 index 000000000..d59e03ebf --- /dev/null +++ b/proto/statesync/types.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package tendermint.proto.statesync; + +option go_package = "github.com/tendermint/tendermint/proto/statesync"; + +message Message { + oneof sum { + SnapshotsRequest snapshots_request = 1; + SnapshotsResponse snapshots_response = 2; + ChunkRequest chunk_request = 3; + ChunkResponse chunk_response = 4; + } +} + +message SnapshotsRequest {} + +message SnapshotsResponse { + uint64 height = 1; + uint32 format = 2; + uint32 chunks = 3; + bytes hash = 4; + bytes metadata = 5; +} + +message ChunkRequest { + uint64 height = 1; + uint32 format = 2; + uint32 index = 3; +} + +message ChunkResponse { + uint64 height = 1; + uint32 format = 2; + uint32 index = 3; + bytes chunk = 4; + bool missing = 5; +} diff --git a/proto/store/types.pb.go b/proto/store/types.pb.go new file mode 100644 index 000000000..54f13f7a5 --- /dev/null +++ b/proto/store/types.pb.go @@ -0,0 +1,86 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/store/types.proto + +package store + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type BlockStoreState struct { + Base int64 `protobuf:"varint,1,opt,name=base,proto3" json:"base,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockStoreState) Reset() { *m = BlockStoreState{} } +func (m *BlockStoreState) String() string { return proto.CompactTextString(m) } +func (*BlockStoreState) ProtoMessage() {} +func (*BlockStoreState) Descriptor() ([]byte, []int) { + return fileDescriptor_45a8553e38baf31c, []int{0} +} +func (m *BlockStoreState) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockStoreState.Unmarshal(m, b) +} +func (m *BlockStoreState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockStoreState.Marshal(b, m, deterministic) +} +func (m *BlockStoreState) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockStoreState.Merge(m, src) +} +func (m *BlockStoreState) XXX_Size() int { + return xxx_messageInfo_BlockStoreState.Size(m) +} +func (m *BlockStoreState) XXX_DiscardUnknown() { + xxx_messageInfo_BlockStoreState.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockStoreState proto.InternalMessageInfo + +func (m *BlockStoreState) GetBase() int64 { + if m != nil { + return m.Base + } + return 0 +} + +func (m *BlockStoreState) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func init() { + proto.RegisterType((*BlockStoreState)(nil), "tendermint.proto.store.BlockStoreState") +} + +func init() { proto.RegisterFile("proto/store/types.proto", fileDescriptor_45a8553e38baf31c) } + +var fileDescriptor_45a8553e38baf31c = []byte{ + // 138 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x28, 0xca, 0x2f, + 0xc9, 0xd7, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x03, 0x8b, + 0x08, 0x89, 0x95, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, 0xe5, 0x66, 0xe6, 0x95, 0x40, 0x44, 0xf4, 0xc0, + 0x6a, 0x94, 0x6c, 0xb9, 0xf8, 0x9d, 0x72, 0xf2, 0x93, 0xb3, 0x83, 0x41, 0xbc, 0xe0, 0x92, 0xc4, + 0x92, 0x54, 0x21, 0x21, 0x2e, 0x96, 0xa4, 0xc4, 0xe2, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xe6, + 0x20, 0x30, 0x5b, 0x48, 0x8c, 0x8b, 0x2d, 0x23, 0x35, 0x33, 0x3d, 0xa3, 0x44, 0x82, 0x09, 0x2c, + 0x0a, 0xe5, 0x39, 0xe9, 0x45, 0xe9, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, + 0xea, 0x23, 0xec, 0x40, 0x66, 0x22, 0x39, 0x29, 0x89, 0x0d, 0xcc, 0x31, 0x06, 0x04, 0x00, 0x00, + 0xff, 0xff, 0xb2, 0x6b, 0x69, 0x83, 0xa8, 0x00, 0x00, 0x00, +} diff --git a/proto/store/types.proto b/proto/store/types.proto new file mode 100644 index 000000000..b0b3e2d76 --- /dev/null +++ b/proto/store/types.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package tendermint.proto.store; + +option go_package = "github.com/tendermint/tendermint/proto/store"; + +message BlockStoreState { + int64 base = 1; + int64 height = 2; +} diff --git a/proto/types/events.pb.go b/proto/types/events.pb.go new file mode 100644 index 000000000..e76beebda --- /dev/null +++ b/proto/types/events.pb.go @@ -0,0 +1,96 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/types/events.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type EventDataRoundState struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Step string `protobuf:"bytes,3,opt,name=step,proto3" json:"step,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EventDataRoundState) Reset() { *m = EventDataRoundState{} } +func (m *EventDataRoundState) String() string { return proto.CompactTextString(m) } +func (*EventDataRoundState) ProtoMessage() {} +func (*EventDataRoundState) Descriptor() ([]byte, []int) { + return fileDescriptor_1bb9bdae76a076d6, []int{0} +} +func (m *EventDataRoundState) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EventDataRoundState.Unmarshal(m, b) +} +func (m *EventDataRoundState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EventDataRoundState.Marshal(b, m, deterministic) +} +func (m *EventDataRoundState) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventDataRoundState.Merge(m, src) +} +func (m *EventDataRoundState) XXX_Size() int { + return xxx_messageInfo_EventDataRoundState.Size(m) +} +func (m *EventDataRoundState) XXX_DiscardUnknown() { + xxx_messageInfo_EventDataRoundState.DiscardUnknown(m) +} + +var xxx_messageInfo_EventDataRoundState proto.InternalMessageInfo + +func (m *EventDataRoundState) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *EventDataRoundState) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *EventDataRoundState) GetStep() string { + if m != nil { + return m.Step + } + return "" +} + +func init() { + proto.RegisterType((*EventDataRoundState)(nil), "tendermint.proto.types.EventDataRoundState") +} + +func init() { proto.RegisterFile("proto/types/events.proto", fileDescriptor_1bb9bdae76a076d6) } + +var fileDescriptor_1bb9bdae76a076d6 = []byte{ + // 162 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x28, 0xca, 0x2f, + 0xc9, 0xd7, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x03, + 0x0b, 0x09, 0x89, 0x95, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, 0xe5, 0x66, 0xe6, 0x95, 0x40, 0x44, 0xf4, + 0xc0, 0x8a, 0x94, 0xc2, 0xb9, 0x84, 0x5d, 0x41, 0xea, 0x5c, 0x12, 0x4b, 0x12, 0x83, 0xf2, 0x4b, + 0xf3, 0x52, 0x82, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0xc4, 0xb8, 0xd8, 0x32, 0x52, 0x33, 0xd3, 0x33, + 0x4a, 0x24, 0x18, 0x15, 0x18, 0x35, 0x98, 0x83, 0xa0, 0x3c, 0x21, 0x11, 0x2e, 0xd6, 0x22, 0x90, + 0x2a, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xd6, 0x20, 0x08, 0x47, 0x48, 0x88, 0x8b, 0xa5, 0xb8, 0x24, + 0xb5, 0x40, 0x82, 0x59, 0x81, 0x51, 0x83, 0x33, 0x08, 0xcc, 0x76, 0xd2, 0x8b, 0xd2, 0x49, 0xcf, + 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x47, 0xd8, 0x8e, 0xcc, 0x44, 0x72, 0x6d, + 0x12, 0x1b, 0x98, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x3c, 0x7d, 0xad, 0xc3, 0x00, + 0x00, 0x00, +} diff --git a/proto/types/events.proto b/proto/types/events.proto new file mode 100644 index 000000000..1f601986f --- /dev/null +++ b/proto/types/events.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package tendermint.proto.types; + +option go_package = "github.com/tendermint/tendermint/proto/types"; + +message EventDataRoundState { + int64 height = 1; + int32 round = 2; + string step = 3; +} diff --git a/proto/types/evidence.pb.go b/proto/types/evidence.pb.go index 93a461db3..62d790ec9 100644 --- a/proto/types/evidence.pb.go +++ b/proto/types/evidence.pb.go @@ -8,6 +8,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/golang/protobuf/ptypes/timestamp" + keys "github.com/tendermint/tendermint/proto/crypto/keys" math "math" time "time" ) @@ -72,6 +73,52 @@ func (m *DuplicateVoteEvidence) GetVoteB() *Vote { return nil } +type PotentialAmnesiaEvidence struct { + VoteA *Vote `protobuf:"bytes,1,opt,name=vote_a,json=voteA,proto3" json:"vote_a,omitempty"` + VoteB *Vote `protobuf:"bytes,2,opt,name=vote_b,json=voteB,proto3" json:"vote_b,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PotentialAmnesiaEvidence) Reset() { *m = PotentialAmnesiaEvidence{} } +func (m *PotentialAmnesiaEvidence) String() string { return proto.CompactTextString(m) } +func (*PotentialAmnesiaEvidence) ProtoMessage() {} +func (*PotentialAmnesiaEvidence) Descriptor() ([]byte, []int) { + return fileDescriptor_86495eef24aeacc0, []int{1} +} +func (m *PotentialAmnesiaEvidence) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PotentialAmnesiaEvidence.Unmarshal(m, b) +} +func (m *PotentialAmnesiaEvidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PotentialAmnesiaEvidence.Marshal(b, m, deterministic) +} +func (m *PotentialAmnesiaEvidence) XXX_Merge(src proto.Message) { + xxx_messageInfo_PotentialAmnesiaEvidence.Merge(m, src) +} +func (m *PotentialAmnesiaEvidence) XXX_Size() int { + return xxx_messageInfo_PotentialAmnesiaEvidence.Size(m) +} +func (m *PotentialAmnesiaEvidence) XXX_DiscardUnknown() { + xxx_messageInfo_PotentialAmnesiaEvidence.DiscardUnknown(m) +} + +var xxx_messageInfo_PotentialAmnesiaEvidence proto.InternalMessageInfo + +func (m *PotentialAmnesiaEvidence) GetVoteA() *Vote { + if m != nil { + return m.VoteA + } + return nil +} + +func (m *PotentialAmnesiaEvidence) GetVoteB() *Vote { + if m != nil { + return m.VoteB + } + return nil +} + // MockEvidence is used for testing pruposes type MockEvidence struct { EvidenceHeight int64 `protobuf:"varint,1,opt,name=evidence_height,json=evidenceHeight,proto3" json:"evidence_height,omitempty"` @@ -86,7 +133,7 @@ func (m *MockEvidence) Reset() { *m = MockEvidence{} } func (m *MockEvidence) String() string { return proto.CompactTextString(m) } func (*MockEvidence) ProtoMessage() {} func (*MockEvidence) Descriptor() ([]byte, []int) { - return fileDescriptor_86495eef24aeacc0, []int{1} + return fileDescriptor_86495eef24aeacc0, []int{2} } func (m *MockEvidence) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MockEvidence.Unmarshal(m, b) @@ -127,10 +174,176 @@ func (m *MockEvidence) GetEvidenceAddress() []byte { return nil } +type MockRandomEvidence struct { + EvidenceHeight int64 `protobuf:"varint,1,opt,name=evidence_height,json=evidenceHeight,proto3" json:"evidence_height,omitempty"` + EvidenceTime time.Time `protobuf:"bytes,2,opt,name=evidence_time,json=evidenceTime,proto3,stdtime" json:"evidence_time"` + EvidenceAddress []byte `protobuf:"bytes,3,opt,name=evidence_address,json=evidenceAddress,proto3" json:"evidence_address,omitempty"` + RandBytes []byte `protobuf:"bytes,4,opt,name=rand_bytes,json=randBytes,proto3" json:"rand_bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MockRandomEvidence) Reset() { *m = MockRandomEvidence{} } +func (m *MockRandomEvidence) String() string { return proto.CompactTextString(m) } +func (*MockRandomEvidence) ProtoMessage() {} +func (*MockRandomEvidence) Descriptor() ([]byte, []int) { + return fileDescriptor_86495eef24aeacc0, []int{3} +} +func (m *MockRandomEvidence) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MockRandomEvidence.Unmarshal(m, b) +} +func (m *MockRandomEvidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MockRandomEvidence.Marshal(b, m, deterministic) +} +func (m *MockRandomEvidence) XXX_Merge(src proto.Message) { + xxx_messageInfo_MockRandomEvidence.Merge(m, src) +} +func (m *MockRandomEvidence) XXX_Size() int { + return xxx_messageInfo_MockRandomEvidence.Size(m) +} +func (m *MockRandomEvidence) XXX_DiscardUnknown() { + xxx_messageInfo_MockRandomEvidence.DiscardUnknown(m) +} + +var xxx_messageInfo_MockRandomEvidence proto.InternalMessageInfo + +func (m *MockRandomEvidence) GetEvidenceHeight() int64 { + if m != nil { + return m.EvidenceHeight + } + return 0 +} + +func (m *MockRandomEvidence) GetEvidenceTime() time.Time { + if m != nil { + return m.EvidenceTime + } + return time.Time{} +} + +func (m *MockRandomEvidence) GetEvidenceAddress() []byte { + if m != nil { + return m.EvidenceAddress + } + return nil +} + +func (m *MockRandomEvidence) GetRandBytes() []byte { + if m != nil { + return m.RandBytes + } + return nil +} + +type ConflictingHeadersEvidence struct { + H1 *SignedHeader `protobuf:"bytes,1,opt,name=h1,proto3" json:"h1,omitempty"` + H2 *SignedHeader `protobuf:"bytes,2,opt,name=h2,proto3" json:"h2,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConflictingHeadersEvidence) Reset() { *m = ConflictingHeadersEvidence{} } +func (m *ConflictingHeadersEvidence) String() string { return proto.CompactTextString(m) } +func (*ConflictingHeadersEvidence) ProtoMessage() {} +func (*ConflictingHeadersEvidence) Descriptor() ([]byte, []int) { + return fileDescriptor_86495eef24aeacc0, []int{4} +} +func (m *ConflictingHeadersEvidence) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConflictingHeadersEvidence.Unmarshal(m, b) +} +func (m *ConflictingHeadersEvidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConflictingHeadersEvidence.Marshal(b, m, deterministic) +} +func (m *ConflictingHeadersEvidence) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConflictingHeadersEvidence.Merge(m, src) +} +func (m *ConflictingHeadersEvidence) XXX_Size() int { + return xxx_messageInfo_ConflictingHeadersEvidence.Size(m) +} +func (m *ConflictingHeadersEvidence) XXX_DiscardUnknown() { + xxx_messageInfo_ConflictingHeadersEvidence.DiscardUnknown(m) +} + +var xxx_messageInfo_ConflictingHeadersEvidence proto.InternalMessageInfo + +func (m *ConflictingHeadersEvidence) GetH1() *SignedHeader { + if m != nil { + return m.H1 + } + return nil +} + +func (m *ConflictingHeadersEvidence) GetH2() *SignedHeader { + if m != nil { + return m.H2 + } + return nil +} + +type LunaticValidatorEvidence struct { + Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Vote *Vote `protobuf:"bytes,2,opt,name=vote,proto3" json:"vote,omitempty"` + InvalidHeaderField string `protobuf:"bytes,3,opt,name=invalid_header_field,json=invalidHeaderField,proto3" json:"invalid_header_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LunaticValidatorEvidence) Reset() { *m = LunaticValidatorEvidence{} } +func (m *LunaticValidatorEvidence) String() string { return proto.CompactTextString(m) } +func (*LunaticValidatorEvidence) ProtoMessage() {} +func (*LunaticValidatorEvidence) Descriptor() ([]byte, []int) { + return fileDescriptor_86495eef24aeacc0, []int{5} +} +func (m *LunaticValidatorEvidence) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LunaticValidatorEvidence.Unmarshal(m, b) +} +func (m *LunaticValidatorEvidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LunaticValidatorEvidence.Marshal(b, m, deterministic) +} +func (m *LunaticValidatorEvidence) XXX_Merge(src proto.Message) { + xxx_messageInfo_LunaticValidatorEvidence.Merge(m, src) +} +func (m *LunaticValidatorEvidence) XXX_Size() int { + return xxx_messageInfo_LunaticValidatorEvidence.Size(m) +} +func (m *LunaticValidatorEvidence) XXX_DiscardUnknown() { + xxx_messageInfo_LunaticValidatorEvidence.DiscardUnknown(m) +} + +var xxx_messageInfo_LunaticValidatorEvidence proto.InternalMessageInfo + +func (m *LunaticValidatorEvidence) GetHeader() *Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *LunaticValidatorEvidence) GetVote() *Vote { + if m != nil { + return m.Vote + } + return nil +} + +func (m *LunaticValidatorEvidence) GetInvalidHeaderField() string { + if m != nil { + return m.InvalidHeaderField + } + return "" +} + type Evidence struct { // Types that are valid to be assigned to Sum: // *Evidence_DuplicateVoteEvidence + // *Evidence_ConflictingHeadersEvidence + // *Evidence_LunaticValidatorEvidence + // *Evidence_PotentialAmnesiaEvidence // *Evidence_MockEvidence + // *Evidence_MockRandomEvidence Sum isEvidence_Sum `protobuf_oneof:"sum"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -141,7 +354,7 @@ func (m *Evidence) Reset() { *m = Evidence{} } func (m *Evidence) String() string { return proto.CompactTextString(m) } func (*Evidence) ProtoMessage() {} func (*Evidence) Descriptor() ([]byte, []int) { - return fileDescriptor_86495eef24aeacc0, []int{2} + return fileDescriptor_86495eef24aeacc0, []int{6} } func (m *Evidence) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Evidence.Unmarshal(m, b) @@ -168,12 +381,28 @@ type isEvidence_Sum interface { type Evidence_DuplicateVoteEvidence struct { DuplicateVoteEvidence *DuplicateVoteEvidence `protobuf:"bytes,1,opt,name=duplicate_vote_evidence,json=duplicateVoteEvidence,proto3,oneof" json:"duplicate_vote_evidence,omitempty"` } +type Evidence_ConflictingHeadersEvidence struct { + ConflictingHeadersEvidence *ConflictingHeadersEvidence `protobuf:"bytes,2,opt,name=conflicting_headers_evidence,json=conflictingHeadersEvidence,proto3,oneof" json:"conflicting_headers_evidence,omitempty"` +} +type Evidence_LunaticValidatorEvidence struct { + LunaticValidatorEvidence *LunaticValidatorEvidence `protobuf:"bytes,3,opt,name=lunatic_validator_evidence,json=lunaticValidatorEvidence,proto3,oneof" json:"lunatic_validator_evidence,omitempty"` +} +type Evidence_PotentialAmnesiaEvidence struct { + PotentialAmnesiaEvidence *PotentialAmnesiaEvidence `protobuf:"bytes,4,opt,name=potential_amnesia_evidence,json=potentialAmnesiaEvidence,proto3,oneof" json:"potential_amnesia_evidence,omitempty"` +} type Evidence_MockEvidence struct { - MockEvidence *MockEvidence `protobuf:"bytes,2,opt,name=mock_evidence,json=mockEvidence,proto3,oneof" json:"mock_evidence,omitempty"` + MockEvidence *MockEvidence `protobuf:"bytes,5,opt,name=mock_evidence,json=mockEvidence,proto3,oneof" json:"mock_evidence,omitempty"` +} +type Evidence_MockRandomEvidence struct { + MockRandomEvidence *MockRandomEvidence `protobuf:"bytes,6,opt,name=mock_random_evidence,json=mockRandomEvidence,proto3,oneof" json:"mock_random_evidence,omitempty"` } -func (*Evidence_DuplicateVoteEvidence) isEvidence_Sum() {} -func (*Evidence_MockEvidence) isEvidence_Sum() {} +func (*Evidence_DuplicateVoteEvidence) isEvidence_Sum() {} +func (*Evidence_ConflictingHeadersEvidence) isEvidence_Sum() {} +func (*Evidence_LunaticValidatorEvidence) isEvidence_Sum() {} +func (*Evidence_PotentialAmnesiaEvidence) isEvidence_Sum() {} +func (*Evidence_MockEvidence) isEvidence_Sum() {} +func (*Evidence_MockRandomEvidence) isEvidence_Sum() {} func (m *Evidence) GetSum() isEvidence_Sum { if m != nil { @@ -189,6 +418,27 @@ func (m *Evidence) GetDuplicateVoteEvidence() *DuplicateVoteEvidence { return nil } +func (m *Evidence) GetConflictingHeadersEvidence() *ConflictingHeadersEvidence { + if x, ok := m.GetSum().(*Evidence_ConflictingHeadersEvidence); ok { + return x.ConflictingHeadersEvidence + } + return nil +} + +func (m *Evidence) GetLunaticValidatorEvidence() *LunaticValidatorEvidence { + if x, ok := m.GetSum().(*Evidence_LunaticValidatorEvidence); ok { + return x.LunaticValidatorEvidence + } + return nil +} + +func (m *Evidence) GetPotentialAmnesiaEvidence() *PotentialAmnesiaEvidence { + if x, ok := m.GetSum().(*Evidence_PotentialAmnesiaEvidence); ok { + return x.PotentialAmnesiaEvidence + } + return nil +} + func (m *Evidence) GetMockEvidence() *MockEvidence { if x, ok := m.GetSum().(*Evidence_MockEvidence); ok { return x.MockEvidence @@ -196,11 +446,22 @@ func (m *Evidence) GetMockEvidence() *MockEvidence { return nil } +func (m *Evidence) GetMockRandomEvidence() *MockRandomEvidence { + if x, ok := m.GetSum().(*Evidence_MockRandomEvidence); ok { + return x.MockRandomEvidence + } + return nil +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*Evidence) XXX_OneofWrappers() []interface{} { return []interface{}{ (*Evidence_DuplicateVoteEvidence)(nil), + (*Evidence_ConflictingHeadersEvidence)(nil), + (*Evidence_LunaticValidatorEvidence)(nil), + (*Evidence_PotentialAmnesiaEvidence)(nil), (*Evidence_MockEvidence)(nil), + (*Evidence_MockRandomEvidence)(nil), } } @@ -217,7 +478,7 @@ func (m *EvidenceData) Reset() { *m = EvidenceData{} } func (m *EvidenceData) String() string { return proto.CompactTextString(m) } func (*EvidenceData) ProtoMessage() {} func (*EvidenceData) Descriptor() ([]byte, []int) { - return fileDescriptor_86495eef24aeacc0, []int{3} + return fileDescriptor_86495eef24aeacc0, []int{7} } func (m *EvidenceData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EvidenceData.Unmarshal(m, b) @@ -251,41 +512,114 @@ func (m *EvidenceData) GetHash() []byte { return nil } +type ProofOfLockChange struct { + Votes []Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"` + PubKey keys.PublicKey `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProofOfLockChange) Reset() { *m = ProofOfLockChange{} } +func (m *ProofOfLockChange) String() string { return proto.CompactTextString(m) } +func (*ProofOfLockChange) ProtoMessage() {} +func (*ProofOfLockChange) Descriptor() ([]byte, []int) { + return fileDescriptor_86495eef24aeacc0, []int{8} +} +func (m *ProofOfLockChange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProofOfLockChange.Unmarshal(m, b) +} +func (m *ProofOfLockChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProofOfLockChange.Marshal(b, m, deterministic) +} +func (m *ProofOfLockChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProofOfLockChange.Merge(m, src) +} +func (m *ProofOfLockChange) XXX_Size() int { + return xxx_messageInfo_ProofOfLockChange.Size(m) +} +func (m *ProofOfLockChange) XXX_DiscardUnknown() { + xxx_messageInfo_ProofOfLockChange.DiscardUnknown(m) +} + +var xxx_messageInfo_ProofOfLockChange proto.InternalMessageInfo + +func (m *ProofOfLockChange) GetVotes() []Vote { + if m != nil { + return m.Votes + } + return nil +} + +func (m *ProofOfLockChange) GetPubKey() keys.PublicKey { + if m != nil { + return m.PubKey + } + return keys.PublicKey{} +} + func init() { proto.RegisterType((*DuplicateVoteEvidence)(nil), "tendermint.proto.types.DuplicateVoteEvidence") + proto.RegisterType((*PotentialAmnesiaEvidence)(nil), "tendermint.proto.types.PotentialAmnesiaEvidence") proto.RegisterType((*MockEvidence)(nil), "tendermint.proto.types.MockEvidence") + proto.RegisterType((*MockRandomEvidence)(nil), "tendermint.proto.types.MockRandomEvidence") + proto.RegisterType((*ConflictingHeadersEvidence)(nil), "tendermint.proto.types.ConflictingHeadersEvidence") + proto.RegisterType((*LunaticValidatorEvidence)(nil), "tendermint.proto.types.LunaticValidatorEvidence") proto.RegisterType((*Evidence)(nil), "tendermint.proto.types.Evidence") proto.RegisterType((*EvidenceData)(nil), "tendermint.proto.types.EvidenceData") + proto.RegisterType((*ProofOfLockChange)(nil), "tendermint.proto.types.ProofOfLockChange") } func init() { proto.RegisterFile("proto/types/evidence.proto", fileDescriptor_86495eef24aeacc0) } var fileDescriptor_86495eef24aeacc0 = []byte{ - // 404 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xd1, 0x6a, 0xe2, 0x40, - 0x14, 0x35, 0x1b, 0x15, 0x19, 0xe3, 0xee, 0x12, 0x70, 0x95, 0xb0, 0xa0, 0x84, 0x65, 0xd7, 0x85, - 0xdd, 0x09, 0xe8, 0x17, 0x18, 0x2c, 0x58, 0x4a, 0x5f, 0x86, 0xd2, 0x87, 0xbe, 0x84, 0x49, 0x32, - 0x26, 0x41, 0xe3, 0x84, 0x64, 0x22, 0xf8, 0xd8, 0x3f, 0xe8, 0x8f, 0xf4, 0x3b, 0xda, 0xaf, 0x68, - 0x7f, 0xa5, 0x64, 0x26, 0x33, 0xe6, 0x41, 0xa1, 0x2f, 0x72, 0xe7, 0xce, 0x39, 0x67, 0xce, 0x39, - 0x06, 0x58, 0x59, 0x4e, 0x19, 0x75, 0xd8, 0x31, 0x23, 0x85, 0x43, 0x0e, 0x49, 0x48, 0xf6, 0x01, - 0x81, 0x7c, 0x69, 0xfe, 0x60, 0x64, 0x1f, 0x92, 0x3c, 0x4d, 0xf6, 0x4c, 0x6c, 0x20, 0x87, 0x59, - 0xbf, 0x59, 0x9c, 0xe4, 0xa1, 0x97, 0xe1, 0x9c, 0x1d, 0x1d, 0xc1, 0x8f, 0x68, 0x44, 0x4f, 0x93, - 0x40, 0x5b, 0xa3, 0xa6, 0x36, 0xff, 0xad, 0x2f, 0x26, 0x11, 0xa5, 0xd1, 0x8e, 0x08, 0xae, 0x5f, - 0x6e, 0x1c, 0x96, 0xa4, 0xa4, 0x60, 0x38, 0xcd, 0x04, 0xc0, 0x7e, 0xd4, 0xc0, 0x70, 0x55, 0x66, - 0xbb, 0x24, 0xc0, 0x8c, 0xdc, 0x53, 0x46, 0xae, 0x6a, 0x67, 0xe6, 0x02, 0x74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0xae, 0x0a, 0x45, 0x8a, 0x67, 0x9a, 0xa0, 0x1d, 0xe3, 0x22, 0xe6, 0xf6, 0x0c, 0xc4, - 0x67, 0x17, 0x3e, 0xfc, 0x8b, 0x12, 0x16, 0x97, 0x3e, 0x0c, 0x68, 0xea, 0x9c, 0x14, 0x9b, 0x63, - 0xe3, 0x13, 0xf6, 0xbb, 0xfc, 0xb0, 0xf8, 0x08, 0x00, 0x00, 0xff, 0xff, 0x08, 0xfc, 0xe8, 0x04, - 0x34, 0x03, 0x00, 0x00, + // 762 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, + 0x14, 0x8e, 0x9b, 0x9f, 0xdb, 0x9e, 0xa6, 0xf7, 0xc7, 0x6a, 0x6f, 0x23, 0xab, 0xbd, 0xad, 0xac, + 0xab, 0xdb, 0x5e, 0x04, 0x4e, 0x9b, 0x22, 0xc4, 0xb6, 0x69, 0xa9, 0x82, 0x5a, 0x44, 0x65, 0x50, + 0x17, 0x2c, 0xb0, 0xc6, 0xf6, 0xc4, 0x1e, 0xc5, 0xf6, 0x58, 0xf6, 0x38, 0x52, 0x96, 0x08, 0x16, + 0x2c, 0xd9, 0xf0, 0x18, 0x6c, 0x79, 0x06, 0xd6, 0x3c, 0x00, 0xbc, 0x0a, 0xf2, 0xcc, 0xd8, 0x4e, + 0xd5, 0x3a, 0xea, 0x0e, 0xb1, 0x89, 0x26, 0x67, 0xce, 0x77, 0xbe, 0x6f, 0x7c, 0xce, 0x7c, 0x03, + 0x5a, 0x9c, 0x50, 0x46, 0xfb, 0x6c, 0x16, 0xe3, 0xb4, 0x8f, 0xa7, 0xc4, 0xc5, 0x91, 0x83, 0x0d, + 0x1e, 0x54, 0xff, 0x66, 0x38, 0x72, 0x71, 0x12, 0x92, 0x88, 0x89, 0x88, 0xc1, 0xd3, 0xb4, 0xff, + 0x98,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x9c, 0xf8, 0x28, 0xf2, 0xb0, 0xfa, 0x18, 0xb8, 0xab, 0xa7, 0x92, 0x6a, 0xe1, 0x45, + 0x93, 0x34, 0x02, 0xa0, 0x9e, 0xc1, 0x6f, 0x71, 0x66, 0x5b, 0x13, 0x3c, 0x93, 0x23, 0xbb, 0x77, + 0x13, 0x2b, 0x5e, 0x53, 0x23, 0x7f, 0x4d, 0x8d, 0xcb, 0xcc, 0x0e, 0x88, 0x73, 0x8e, 0x67, 0xb2, + 0x4c, 0x27, 0xce, 0xec, 0xfc, 0x9f, 0xf1, 0xea, 0xbe, 0x47, 0x98, 0x9f, 0xd9, 0x86, 0x43, 0xc3, + 0x7e, 0x55, 0x62, 0x7e, 0x39, 0xf7, 0xaa, 0xdb, 0x1d, 0xfe, 0xe7, 0xe8, 0x47, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x4a, 0x3f, 0xf4, 0x74, 0x47, 0x08, 0x00, 0x00, } diff --git a/proto/types/evidence.proto b/proto/types/evidence.proto index 7634c9266..3a8ff126c 100644 --- a/proto/types/evidence.proto +++ b/proto/types/evidence.proto @@ -6,6 +6,7 @@ option go_package = "github.com/tendermint/tendermint/proto/types"; import "third_party/proto/gogoproto/gogo.proto"; import "proto/types/types.proto"; import "google/protobuf/timestamp.proto"; +import "proto/crypto/keys/types.proto"; // DuplicateVoteEvidence contains evidence a validator signed two conflicting // votes. @@ -14,6 +15,11 @@ message DuplicateVoteEvidence { Vote vote_b = 2; } +message PotentialAmnesiaEvidence { + Vote vote_a = 1; + Vote vote_b = 2; +} + // MockEvidence is used for testing pruposes message MockEvidence { int64 evidence_height = 1; @@ -21,11 +27,34 @@ message MockEvidence { [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; bytes evidence_address = 3; } +message MockRandomEvidence { + int64 evidence_height = 1; + google.protobuf.Timestamp evidence_time = 2 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes evidence_address = 3; + bytes rand_bytes = 4; +} + +message ConflictingHeadersEvidence { + SignedHeader h1 = 1; + SignedHeader h2 = 2; +} + +message LunaticValidatorEvidence { + Header header = 1; + Vote vote = 2; + string invalid_header_field = 3; +} message Evidence { oneof sum { - DuplicateVoteEvidence duplicate_vote_evidence = 1; - MockEvidence mock_evidence = 2; + DuplicateVoteEvidence duplicate_vote_evidence = 1; + ConflictingHeadersEvidence conflicting_headers_evidence = 2; + LunaticValidatorEvidence lunatic_validator_evidence = 3; + PotentialAmnesiaEvidence potential_amnesia_evidence = 4; + + MockEvidence mock_evidence = 5; + MockRandomEvidence mock_random_evidence = 6; } } @@ -34,3 +63,8 @@ message EvidenceData { repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; bytes hash = 2; } + +message ProofOfLockChange { + repeated Vote votes = 1 [(gogoproto.nullable) = false]; + tendermint.proto.crypto.keys.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; +} diff --git a/proto/types/params.pb.go b/proto/types/params.pb.go index 63052dac8..86a21daa2 100644 --- a/proto/types/params.pb.go +++ b/proto/types/params.pb.go @@ -8,7 +8,6 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/golang/protobuf/ptypes/duration" math "math" time "time" @@ -143,13 +142,25 @@ func (m *BlockParams) GetTimeIotaMs() int64 { // EvidenceParams determine how we handle evidence of malfeasance. type EvidenceParams struct { - // Note: must be greater than 0 - MaxAgeNumBlocks int64 `protobuf:"varint,1,opt,name=max_age_num_blocks,json=maxAgeNumBlocks,proto3" json:"max_age_num_blocks,omitempty"` - MaxAgeDuration time.Duration `protobuf:"bytes,2,opt,name=max_age_duration,json=maxAgeDuration,proto3,stdduration" json:"max_age_duration"` - MaxNum uint32 `protobuf:"varint,3,opt,name=max_num,json=maxNum,proto3" json:"max_num,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Max age of evidence, in blocks. + // + // The basic formula for calculating this is: MaxAgeDuration / {average block + // time}. + MaxAgeNumBlocks int64 `protobuf:"varint,1,opt,name=max_age_num_blocks,json=maxAgeNumBlocks,proto3" json:"max_age_num_blocks,omitempty"` + // Max age of evidence, in time. + // + // It should correspond with an app's "unbonding period" or other similar + // mechanism for handling [Nothing-At-Stake + // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + MaxAgeDuration time.Duration `protobuf:"bytes,2,opt,name=max_age_duration,json=maxAgeDuration,proto3,stdduration" json:"max_age_duration"` + // This sets the maximum number of evidence that can be committed in a single block. + // and should fall comfortably under the max block bytes when we consider the size of + // each evidence (See MaxEvidenceBytes). The maximum number is MaxEvidencePerBlock. + // Default is 50 + MaxNum uint32 `protobuf:"varint,3,opt,name=max_num,json=maxNum,proto3" json:"max_num,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *EvidenceParams) Reset() { *m = EvidenceParams{} } @@ -297,39 +308,105 @@ func init() { func init() { proto.RegisterFile("proto/types/params.proto", fileDescriptor_95a9f934fa6f056c) } var fileDescriptor_95a9f934fa6f056c = []byte{ - // 476 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xd1, 0x6e, 0xd3, 0x30, - 0x14, 0x25, 0x04, 0x46, 0x7b, 0xbb, 0xae, 0xc8, 0x0f, 0x10, 0x86, 0x44, 0xab, 0x20, 0x95, 0x49, - 0x20, 0x47, 0x82, 0x37, 0x5e, 0x26, 0x02, 0x68, 0x43, 0x53, 0x27, 0x14, 0x21, 0x1e, 0xf6, 0x62, - 0x39, 0x8d, 0x49, 0xa3, 0xd5, 0x71, 0x14, 0xdb, 0x53, 0xf3, 0x27, 0x3c, 0xee, 0x0f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0x34, 0xe5, 0x99, 0x4b, 0x39, 0x84, 0x61, - 0x87, 0xeb, 0xb2, 0x1e, 0x38, 0xd4, 0x09, 0x95, 0x31, 0xbe, 0x78, 0x91, 0x17, 0x6a, 0xa1, 0x53, - 0x3c, 0x17, 0x3c, 0xea, 0x76, 0xbf, 0x79, 0xdc, 0xf8, 0x3e, 0xe9, 0x9e, 0xb9, 0xbc, 0xfa, 0x1b, - 0x00, 0x00, 0xff, 0xff, 0x96, 0x83, 0x7c, 0xa0, 0x54, 0x03, 0x00, 0x00, + // 469 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xd1, 0x6a, 0xd4, 0x40, + 0x14, 0x35, 0xae, 0xd6, 0xdd, 0xbb, 0xdd, 0xae, 0xcc, 0x83, 0xc6, 0x0a, 0xed, 0x12, 0x61, 0x2d, + 0x28, 0x09, 0x54, 0x7c, 0x16, 0xa3, 0xd2, 0x4a, 0xd9, 0x22, 0x41, 0x7c, 0xe8, 0xcb, 0x70, 0xb3, + 0x19, 0xb3, 0xa1, 0x3b, 0x99, 0x90, 0x99, 0x29, 0x9b, 0x3f, 0xf1, 0x07, 0x04, 0x3f, 0xc5, 0xaf, + 0x50, 0xf0, 0xcd, 0xbf, 0x90, 0xcc, 0xec, 0x98, 0xdd, 0xd2, 0xbe, 0xcd, 0xdc, 0x7b, 0xce, 0x99, + 0x7b, 0xce, 0x65, 0xc0, 0xaf, 0x6a, 0xa1, 0x44, 0xa4, 0x9a, 0x8a, 0xc9, 0xa8, 0xc2, 0x1a, 0xb9, + 0x0c, 0x4d, 0x89, 0x3c, 0x52, 0xac, 0xcc, 0x58, 0xcd, 0x8b, 0x52, 0xd9, 0x4a, 0x68, 0x40, 0xfb, + 0x53, 0xb5, 0x28, 0xea, 0x8c, 0x56, 0x58, 0xab, 0x26, 0xb2, 0xec, 0x5c, 0xe4, 0xa2, 0x3b, 0x59, + 0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6a, 0x52, 0x72, 0x6f, 0x8e, 0x39, 0xae, 0xde, 0xe6, 0xec, + 0x5c, 0x73, 0x33, 0x9c, 0x24, 0x33, 0x78, 0xe8, 0xc0, 0x6e, 0x59, 0xeb, 0x14, 0x9f, 0x84, 0x76, + 0x9b, 0xa1, 0xdb, 0x66, 0xf8, 0x7e, 0x0d, 0x88, 0xfb, 0xad, 0xd9, 0x6f, 0xbf, 0x0f, 0xbd, 0x64, + 0xcf, 0xea, 0xb9, 0x8e, 0x73, 0x52, 0x6a, 0x6e, 0x66, 0x1d, 0x19, 0x27, 0xe7, 0x9a, 0x07, 0xaf, + 0x61, 0x7c, 0x2d, 0x32, 0x12, 0xc0, 0xa8, 0xd2, 0x29, 0xbd, 0x64, 0x0d, 0x35, 0x99, 0xfa, 0xde, + 0xa4, 0x77, 0x34, 0x48, 0x86, 0x95, 0x4e, 0xcf, 0x58, 0xf3, 0xb9, 0x2d, 0x05, 0x17, 0xb0, 0x7b, + 0x8a, 0x72, 0xc1, 0xb2, 0x35, 0x67, 0x0a, 0x63, 0xe3, 0x87, 0x5e, 0x0f, 0x73, 0x64, 0xca, 0x33, + 0x97, 0x68, 0x00, 0xa3, 0x0e, 0xd7, 0xe5, 0x3a, 0x74, 0xa8, 0x13, 0x94, 0xf1, 0xf1, 0x8f, 0x3f, + 0x07, 0xde, 0xc5, 0xcb, 0xbc, 0x50, 0x0b, 0x9d, 0x86, 0x73, 0xc1, 0xa3, 0x6e, 0xd7, 0x9b, 0xc7, + 0x8d, 0xef, 0x92, 0xee, 0x98, 0xcb, 0xab, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x3c, 0x66, + 0x44, 0x44, 0x03, 0x00, 0x00, } +func (this *ConsensusParams) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ConsensusParams) + if !ok { + that2, ok := that.(ConsensusParams) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Block.Equal(&that1.Block) { + return false + } + if !this.Evidence.Equal(&that1.Evidence) { + return false + } + if !this.Validator.Equal(&that1.Validator) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *BlockParams) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BlockParams) + if !ok { + that2, ok := that.(BlockParams) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.MaxBytes != that1.MaxBytes { + return false + } + if this.MaxGas != that1.MaxGas { + return false + } + if this.TimeIotaMs != that1.TimeIotaMs { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} func (this *EvidenceParams) Equal(that interface{}) bool { if that == nil { return this == nil @@ -395,103 +472,33 @@ func (this *ValidatorParams) Equal(that interface{}) bool { } return true } -func NewPopulatedEvidenceParams(r randyParams, easy bool) *EvidenceParams { - this := &EvidenceParams{} - this.MaxAgeNumBlocks = int64(r.Int63()) - if r.Intn(2) == 0 { - this.MaxAgeNumBlocks *= -1 +func (this *HashedParams) Equal(that interface{}) bool { + if that == nil { + return this == nil } - v1 := github_com_gogo_protobuf_types.NewPopulatedStdDuration(r, easy) - this.MaxAgeDuration = *v1 - this.MaxNum = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedParams(r, 4) - } - return this -} -func NewPopulatedValidatorParams(r randyParams, easy bool) *ValidatorParams { - this := &ValidatorParams{} - v2 := r.Intn(10) - this.PubKeyTypes = make([]string, v2) - for i := 0; i < v2; i++ { - this.PubKeyTypes[i] = string(randStringParams(r)) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedParams(r, 2) - } - return this -} - -type randyParams interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneParams(r randyParams) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringParams(r randyParams) string { - v3 := r.Intn(100) - tmps := make([]rune, v3) - for i := 0; i < v3; i++ { - tmps[i] = randUTF8RuneParams(r) - } - return string(tmps) -} -func randUnrecognizedParams(r randyParams, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 + that1, ok := that.(*HashedParams) + if !ok { + that2, ok := that.(HashedParams) + if ok { + that1 = &that2 + } else { + return false } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldParams(dAtA, r, fieldNumber, wire) } - return dAtA -} -func randFieldParams(dAtA []byte, r randyParams, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateParams(dAtA, uint64(key)) - v4 := r.Int63() - if r.Intn(2) == 0 { - v4 *= -1 - } - dAtA = encodeVarintPopulateParams(dAtA, uint64(v4)) - case 1: - dAtA = encodeVarintPopulateParams(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateParams(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateParams(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateParams(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return dAtA -} -func encodeVarintPopulateParams(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 + if this.BlockMaxBytes != that1.BlockMaxBytes { + return false } - dAtA = append(dAtA, uint8(v)) - return dAtA + if this.BlockMaxGas != that1.BlockMaxGas { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true } diff --git a/proto/types/params.proto b/proto/types/params.proto index 4e1b1f972..6aad02031 100644 --- a/proto/types/params.proto +++ b/proto/types/params.proto @@ -6,6 +6,8 @@ option go_package = "github.com/tendermint/tendermint/proto/types"; import "third_party/proto/gogoproto/gogo.proto"; import "google/protobuf/duration.proto"; +option (gogoproto.equal_all) = true; + // ConsensusParams contains consensus critical parameters that determine the // validity of blocks. message ConsensusParams { @@ -27,21 +29,30 @@ message BlockParams { // EvidenceParams determine how we handle evidence of malfeasance. message EvidenceParams { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; - // Note: must be greater than 0 - int64 max_age_num_blocks = 1; - google.protobuf.Duration max_age_duration = 2 + // Max age of evidence, in blocks. + // + // The basic formula for calculating this is: MaxAgeDuration / {average block + // time}. + int64 max_age_num_blocks = 1; + + // Max age of evidence, in time. + // + // It should correspond with an app's "unbonding period" or other similar + // mechanism for handling [Nothing-At-Stake + // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + google.protobuf.Duration max_age_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - uint32 max_num = 3; + + // This sets the maximum number of evidence that can be committed in a single block. + // and should fall comfortably under the max block bytes when we consider the size of + // each evidence (See MaxEvidenceBytes). The maximum number is MaxEvidencePerBlock. + // Default is 50 + uint32 max_num = 3; } // ValidatorParams restrict the public key types validators can use. // NOTE: uses ABCI pubkey naming, not Amino names. message ValidatorParams { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; - repeated string pub_key_types = 1; } diff --git a/proto/types/types.pb.go b/proto/types/types.pb.go index 8a4dd72ea..4f8fc0e5d 100644 --- a/proto/types/types.pb.go +++ b/proto/types/types.pb.go @@ -4,12 +4,11 @@ package types import ( - bytes "bytes" fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/golang/protobuf/ptypes/timestamp" + merkle "github.com/tendermint/tendermint/proto/crypto/merkle" bits "github.com/tendermint/tendermint/proto/libs/bits" version "github.com/tendermint/tendermint/proto/version" math "math" @@ -86,7 +85,7 @@ func (SignedMsgType) EnumDescriptor() ([]byte, []int) { // PartsetHeader type PartSetHeader struct { - Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -117,7 +116,7 @@ func (m *PartSetHeader) XXX_DiscardUnknown() { var xxx_messageInfo_PartSetHeader proto.InternalMessageInfo -func (m *PartSetHeader) GetTotal() uint32 { +func (m *PartSetHeader) GetTotal() int64 { if m != nil { return m.Total } @@ -131,6 +130,60 @@ func (m *PartSetHeader) GetHash() []byte { return nil } +type Part struct { + Index uint32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` + Proof merkle.SimpleProof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Part) Reset() { *m = Part{} } +func (m *Part) String() string { return proto.CompactTextString(m) } +func (*Part) ProtoMessage() {} +func (*Part) Descriptor() ([]byte, []int) { + return fileDescriptor_ff06f8095857fb18, []int{1} +} +func (m *Part) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Part.Unmarshal(m, b) +} +func (m *Part) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Part.Marshal(b, m, deterministic) +} +func (m *Part) XXX_Merge(src proto.Message) { + xxx_messageInfo_Part.Merge(m, src) +} +func (m *Part) XXX_Size() int { + return xxx_messageInfo_Part.Size(m) +} +func (m *Part) XXX_DiscardUnknown() { + xxx_messageInfo_Part.DiscardUnknown(m) +} + +var xxx_messageInfo_Part proto.InternalMessageInfo + +func (m *Part) GetIndex() uint32 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *Part) GetBytes() []byte { + if m != nil { + return m.Bytes + } + return nil +} + +func (m *Part) GetProof() merkle.SimpleProof { + if m != nil { + return m.Proof + } + return merkle.SimpleProof{} +} + // BlockID type BlockID struct { Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` @@ -144,7 +197,7 @@ func (m *BlockID) Reset() { *m = BlockID{} } func (m *BlockID) String() string { return proto.CompactTextString(m) } func (*BlockID) ProtoMessage() {} func (*BlockID) Descriptor() ([]byte, []int) { - return fileDescriptor_ff06f8095857fb18, []int{1} + return fileDescriptor_ff06f8095857fb18, []int{2} } func (m *BlockID) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockID.Unmarshal(m, b) @@ -208,7 +261,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_ff06f8095857fb18, []int{2} + return fileDescriptor_ff06f8095857fb18, []int{3} } func (m *Header) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Header.Unmarshal(m, b) @@ -343,7 +396,7 @@ func (m *Data) Reset() { *m = Data{} } func (m *Data) String() string { return proto.CompactTextString(m) } func (*Data) ProtoMessage() {} func (*Data) Descriptor() ([]byte, []int) { - return fileDescriptor_ff06f8095857fb18, []int{3} + return fileDescriptor_ff06f8095857fb18, []int{4} } func (m *Data) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Data.Unmarshal(m, b) @@ -382,11 +435,11 @@ func (m *Data) GetHash() []byte { type Vote struct { Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.proto.types.SignedMsgType" json:"type,omitempty"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` + Round int64 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` BlockID BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` ValidatorAddress []byte `protobuf:"bytes,6,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - ValidatorIndex uint32 `protobuf:"varint,7,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` + ValidatorIndex int64 `protobuf:"varint,7,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` Signature []byte `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -397,7 +450,7 @@ func (m *Vote) Reset() { *m = Vote{} } func (m *Vote) String() string { return proto.CompactTextString(m) } func (*Vote) ProtoMessage() {} func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_ff06f8095857fb18, []int{4} + return fileDescriptor_ff06f8095857fb18, []int{5} } func (m *Vote) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Vote.Unmarshal(m, b) @@ -431,7 +484,7 @@ func (m *Vote) GetHeight() int64 { return 0 } -func (m *Vote) GetRound() int32 { +func (m *Vote) GetRound() int64 { if m != nil { return m.Round } @@ -459,7 +512,7 @@ func (m *Vote) GetValidatorAddress() []byte { return nil } -func (m *Vote) GetValidatorIndex() uint32 { +func (m *Vote) GetValidatorIndex() int64 { if m != nil { return m.ValidatorIndex } @@ -490,7 +543,7 @@ func (m *Commit) Reset() { *m = Commit{} } func (m *Commit) String() string { return proto.CompactTextString(m) } func (*Commit) ProtoMessage() {} func (*Commit) Descriptor() ([]byte, []int) { - return fileDescriptor_ff06f8095857fb18, []int{5} + return fileDescriptor_ff06f8095857fb18, []int{6} } func (m *Commit) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Commit.Unmarshal(m, b) @@ -567,7 +620,7 @@ func (m *CommitSig) Reset() { *m = CommitSig{} } func (m *CommitSig) String() string { return proto.CompactTextString(m) } func (*CommitSig) ProtoMessage() {} func (*CommitSig) Descriptor() ([]byte, []int) { - return fileDescriptor_ff06f8095857fb18, []int{6} + return fileDescriptor_ff06f8095857fb18, []int{7} } func (m *CommitSig) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommitSig.Unmarshal(m, b) @@ -632,7 +685,7 @@ func (m *Proposal) Reset() { *m = Proposal{} } func (m *Proposal) String() string { return proto.CompactTextString(m) } func (*Proposal) ProtoMessage() {} func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff06f8095857fb18, []int{7} + return fileDescriptor_ff06f8095857fb18, []int{8} } func (m *Proposal) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Proposal.Unmarshal(m, b) @@ -713,7 +766,7 @@ func (m *SignedHeader) Reset() { *m = SignedHeader{} } func (m *SignedHeader) String() string { return proto.CompactTextString(m) } func (*SignedHeader) ProtoMessage() {} func (*SignedHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_ff06f8095857fb18, []int{8} + return fileDescriptor_ff06f8095857fb18, []int{9} } func (m *SignedHeader) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignedHeader.Unmarshal(m, b) @@ -747,10 +800,73 @@ func (m *SignedHeader) GetCommit() *Commit { return nil } +type BlockMeta struct { + BlockID BlockID `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id"` + BlockSize int64 `protobuf:"varint,2,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"` + Header Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header"` + NumTxs int64 `protobuf:"varint,4,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockMeta) Reset() { *m = BlockMeta{} } +func (m *BlockMeta) String() string { return proto.CompactTextString(m) } +func (*BlockMeta) ProtoMessage() {} +func (*BlockMeta) Descriptor() ([]byte, []int) { + return fileDescriptor_ff06f8095857fb18, []int{10} +} +func (m *BlockMeta) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockMeta.Unmarshal(m, b) +} +func (m *BlockMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockMeta.Marshal(b, m, deterministic) +} +func (m *BlockMeta) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockMeta.Merge(m, src) +} +func (m *BlockMeta) XXX_Size() int { + return xxx_messageInfo_BlockMeta.Size(m) +} +func (m *BlockMeta) XXX_DiscardUnknown() { + xxx_messageInfo_BlockMeta.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockMeta proto.InternalMessageInfo + +func (m *BlockMeta) GetBlockID() BlockID { + if m != nil { + return m.BlockID + } + return BlockID{} +} + +func (m *BlockMeta) GetBlockSize() int64 { + if m != nil { + return m.BlockSize + } + return 0 +} + +func (m *BlockMeta) GetHeader() Header { + if m != nil { + return m.Header + } + return Header{} +} + +func (m *BlockMeta) GetNumTxs() int64 { + if m != nil { + return m.NumTxs + } + return 0 +} + func init() { proto.RegisterEnum("tendermint.proto.types.BlockIDFlag", BlockIDFlag_name, BlockIDFlag_value) proto.RegisterEnum("tendermint.proto.types.SignedMsgType", SignedMsgType_name, SignedMsgType_value) proto.RegisterType((*PartSetHeader)(nil), "tendermint.proto.types.PartSetHeader") + proto.RegisterType((*Part)(nil), "tendermint.proto.types.Part") proto.RegisterType((*BlockID)(nil), "tendermint.proto.types.BlockID") proto.RegisterType((*Header)(nil), "tendermint.proto.types.Header") proto.RegisterType((*Data)(nil), "tendermint.proto.types.Data") @@ -759,375 +875,91 @@ func init() { proto.RegisterType((*CommitSig)(nil), "tendermint.proto.types.CommitSig") proto.RegisterType((*Proposal)(nil), "tendermint.proto.types.Proposal") proto.RegisterType((*SignedHeader)(nil), "tendermint.proto.types.SignedHeader") + proto.RegisterType((*BlockMeta)(nil), "tendermint.proto.types.BlockMeta") } func init() { proto.RegisterFile("proto/types/types.proto", fileDescriptor_ff06f8095857fb18) } var fileDescriptor_ff06f8095857fb18 = []byte{ - // 1154 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdd, 0x6e, 0xe3, 0xc4, - 0x17, 0xaf, 0xf3, 0x9d, 0xe3, 0x24, 0x4d, 0xfd, 0xef, 0x7f, 0x37, 0xa4, 0xa8, 0xc9, 0xb6, 0x74, - 0xc9, 0x96, 0x95, 0x83, 0x8a, 0x84, 0x80, 0xbb, 0x7c, 0x6d, 0x37, 0x6a, 0x9b, 0x44, 0x4e, 0x28, - 0x1f, 0x37, 0xd6, 0x24, 0x9e, 0x75, 0x2c, 0x1c, 0xdb, 0xb2, 0x27, 0xa5, 0xbd, 0xe1, 0x1a, 0x95, - 0x1b, 0x5e, 0xa0, 0xd2, 0x4a, 0x0b, 0x12, 0x8f, 0xc0, 0x1d, 0x5c, 0xf2, 0x14, 0x45, 0x5a, 0x6e, - 0x78, 0x00, 0x1e, 0x00, 0x79, 0x66, 0xec, 0x38, 0x6d, 0x03, 0x2b, 0x58, 0x71, 0xd3, 0xce, 0x9c, - 0xf3, 0x3b, 0x67, 0xce, 0xfc, 0xce, 0xef, 0x78, 0x02, 0xf7, 0x1d, 0xd7, 0x26, 0x76, 0x9d, 0x5c, - 0x38, 0xd8, 0x63, 0x7f, 0x65, 0x6a, 0x91, 0xee, 0x11, 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x0f, 0xbb, 0x87, 0xbd, 0x4e, 0x5b, 0x3d, 0x19, - 0x1e, 0xaa, 0xa3, 0xcf, 0x06, 0x9d, 0xc8, 0x2d, 0x1e, 0x40, 0x6e, 0xa0, 0x74, 0x4e, 0xfb, 0xa3, - 0x0e, 0xf5, 0x14, 0x85, 0xf2, 0xfa, 0xe5, 0x55, 0x55, 0x1c, 0xb8, 0xf8, 0xcc, 0x26, 0x98, 0xc6, - 0xef, 0x41, 0x61, 0xa0, 0x74, 0x58, 0xb1, 0x0c, 0x14, 0x2b, 0x6f, 0x5c, 0x5e, 0x55, 0xf3, 0x03, - 0x17, 0x33, 0xde, 0x28, 0x6c, 0x17, 0xf2, 0x03, 0xa5, 0x3f, 0xe8, 0x0f, 0x1b, 0xc7, 0x0c, 0x15, - 0x2f, 0x17, 0x2f, 0xaf, 0xaa, 0xb9, 0x60, 0x22, 0x7c, 0xd0, 0xa2, 0xce, 0xa6, 0xfc, 0xf9, 0x63, - 0xdd, 0x20, 0xd3, 0xf9, 0x58, 0x9e, 0xd8, 0xb3, 0xfa, 0xa2, 0x3d, 0xd1, 0x65, 0xe4, 0x07, 0xf0, - 0x38, 0x45, 0x37, 0xef, 0xfd, 0x19, 0x00, 0x00, 0xff, 0xff, 0x58, 0xa5, 0x4c, 0x86, 0x16, 0x0b, - 0x00, 0x00, -} - -func (this *PartSetHeader) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PartSetHeader) - if !ok { - that2, ok := that.(PartSetHeader) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Total != that1.Total { - return false - } - if !bytes.Equal(this.Hash, that1.Hash) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *BlockID) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*BlockID) - if !ok { - that2, ok := that.(BlockID) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Hash, that1.Hash) { - return false - } - if !this.PartsHeader.Equal(&that1.PartsHeader) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Header) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Header) - if !ok { - that2, ok := that.(Header) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Version.Equal(&that1.Version) { - return false - } - if this.ChainID != that1.ChainID { - return false - } - if this.Height != that1.Height { - return false - } - if !this.Time.Equal(that1.Time) { - return false - } - if !this.LastBlockID.Equal(&that1.LastBlockID) { - return false - } - if !bytes.Equal(this.LastCommitHash, that1.LastCommitHash) { - return false - } - if !bytes.Equal(this.DataHash, that1.DataHash) { - return false - } - if !bytes.Equal(this.ValidatorsHash, that1.ValidatorsHash) { - return false - } - if !bytes.Equal(this.NextValidatorsHash, that1.NextValidatorsHash) { - return false - } - if !bytes.Equal(this.ConsensusHash, that1.ConsensusHash) { - return false - } - if !bytes.Equal(this.AppHash, that1.AppHash) { - return false - } - if !bytes.Equal(this.LastResultsHash, that1.LastResultsHash) { - return false - } - if !bytes.Equal(this.EvidenceHash, that1.EvidenceHash) { - return false - } - if !bytes.Equal(this.ProposerAddress, that1.ProposerAddress) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func NewPopulatedPartSetHeader(r randyTypes, easy bool) *PartSetHeader { - this := &PartSetHeader{} - this.Total = uint32(r.Uint32()) - v1 := r.Intn(100) - this.Hash = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Hash[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedTypes(r, 3) - } - return this -} - -func NewPopulatedBlockID(r randyTypes, easy bool) *BlockID { - this := &BlockID{} - v2 := r.Intn(100) - this.Hash = make([]byte, v2) - for i := 0; i < v2; i++ { - this.Hash[i] = byte(r.Intn(256)) - } - v3 := NewPopulatedPartSetHeader(r, easy) - this.PartsHeader = *v3 - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedTypes(r, 3) - } - return this -} - -func NewPopulatedHeader(r randyTypes, easy bool) *Header { - this := &Header{} - v4 := version.NewPopulatedConsensus(r, easy) - this.Version = *v4 - this.ChainID = string(randStringTypes(r)) - this.Height = int64(r.Int63()) - if r.Intn(2) == 0 { - this.Height *= -1 - } - v5 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Time = *v5 - v6 := NewPopulatedBlockID(r, easy) - this.LastBlockID = *v6 - v7 := r.Intn(100) - this.LastCommitHash = make([]byte, v7) - for i := 0; i < v7; i++ { - this.LastCommitHash[i] = byte(r.Intn(256)) - } - v8 := r.Intn(100) - this.DataHash = make([]byte, v8) - for i := 0; i < v8; i++ { - this.DataHash[i] = byte(r.Intn(256)) - } - v9 := r.Intn(100) - this.ValidatorsHash = make([]byte, v9) - for i := 0; i < v9; i++ { - this.ValidatorsHash[i] = byte(r.Intn(256)) - } - v10 := r.Intn(100) - this.NextValidatorsHash = make([]byte, v10) - for i := 0; i < v10; i++ { - this.NextValidatorsHash[i] = byte(r.Intn(256)) - } - v11 := r.Intn(100) - this.ConsensusHash = make([]byte, v11) - for i := 0; i < v11; i++ { - this.ConsensusHash[i] = byte(r.Intn(256)) - } - v12 := r.Intn(100) - this.AppHash = make([]byte, v12) - for i := 0; i < v12; i++ { - this.AppHash[i] = byte(r.Intn(256)) - } - v13 := r.Intn(100) - this.LastResultsHash = make([]byte, v13) - for i := 0; i < v13; i++ { - this.LastResultsHash[i] = byte(r.Intn(256)) - } - v14 := r.Intn(100) - this.EvidenceHash = make([]byte, v14) - for i := 0; i < v14; i++ { - this.EvidenceHash[i] = byte(r.Intn(256)) - } - v15 := r.Intn(100) - this.ProposerAddress = make([]byte, v15) - for i := 0; i < v15; i++ { - this.ProposerAddress[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedTypes(r, 15) - } - return this -} - -type randyTypes interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneTypes(r randyTypes) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringTypes(r randyTypes) string { - v16 := r.Intn(100) - tmps := make([]rune, v16) - for i := 0; i < v16; i++ { - tmps[i] = randUTF8RuneTypes(r) - } - return string(tmps) -} -func randUnrecognizedTypes(r randyTypes, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldTypes(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldTypes(dAtA []byte, r randyTypes, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateTypes(dAtA, uint64(key)) - v17 := r.Int63() - if r.Intn(2) == 0 { - v17 *= -1 - } - dAtA = encodeVarintPopulateTypes(dAtA, uint64(v17)) - case 1: - dAtA = encodeVarintPopulateTypes(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateTypes(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateTypes(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateTypes(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateTypes(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA + // 1274 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcd, 0x6e, 0xdb, 0xc6, + 0x13, 0x37, 0x25, 0xca, 0x92, 0x86, 0x92, 0x2d, 0xf3, 0xef, 0x7f, 0xa2, 0xca, 0xad, 0xa5, 0xc8, + 0x4d, 0xea, 0x7c, 0x80, 0x2a, 0x5c, 0xa0, 0x68, 0x80, 0x5e, 0x24, 0xdb, 0x71, 0x84, 0xd8, 0xb2, + 0x40, 0xa9, 0xe9, 0xc7, 0x85, 0x58, 0x89, 0x1b, 0x8a, 0x08, 0x45, 0x12, 0xdc, 0x95, 0x61, 0xa7, + 0x40, 0x81, 0xde, 0x0a, 0x9f, 0xfa, 0x02, 0x3e, 0xa5, 0x05, 0xfa, 0x16, 0xed, 0xb1, 0xa7, 0x3e, + 0x42, 0x0a, 0xa4, 0xaf, 0xd0, 0x07, 0x28, 0xf6, 0x83, 0x94, 0x14, 0xd9, 0x6d, 0xd0, 0xa4, 0x17, + 0x9b, 0x3b, 0xf3, 0x9b, 0xd9, 0x9d, 0xdf, 0xfc, 0x66, 0xd7, 0x86, 0xeb, 0x61, 0x14, 0xd0, 0xa0, + 0x41, 0xcf, 0x42, 0x4c, 0xc4, 0x4f, 0x83, 0x5b, 0xf4, 0x6b, 0x14, 0xfb, 0x36, 0x8e, 0xc6, 0xae, + 0x4f, 0x85, 0xc5, 0xe0, 0xde, 0xca, 0x2d, 0x3a, 0x72, 0x23, 0xdb, 0x0a, 0x51, 0x44, 0xcf, 0x1a, + 0x22, 0xd8, 0x09, 0x9c, 0x60, 0xfa, 0x25, 0xd0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 0x0c, 0xdc, 0xf9, 0x01, 0xac, 0x9e, 0x20, 0xcf, 0xb5, + 0x11, 0x0d, 0x22, 0x22, 0x20, 0x39, 0x91, 0x65, 0x6a, 0xe6, 0xc0, 0x0f, 0x61, 0xdd, 0xc7, 0xa7, + 0xd4, 0x7a, 0x15, 0x9d, 0xe7, 0x68, 0x9d, 0xf9, 0x1e, 0xcf, 0x47, 0xdc, 0x84, 0x95, 0x61, 0xdc, + 0x11, 0x81, 0x05, 0x8e, 0x2d, 0x26, 0x56, 0x0e, 0x7b, 0x07, 0x72, 0x28, 0x0c, 0x05, 0x40, 0xe3, + 0x80, 0x2c, 0x0a, 0x43, 0xee, 0xba, 0x03, 0x6b, 0xbc, 0xc6, 0x08, 0x93, 0x89, 0x47, 0x65, 0x92, + 0x02, 0xc7, 0xac, 0x32, 0x87, 0x29, 0xec, 0x1c, 0xbb, 0x05, 0x45, 0x7c, 0xe2, 0xda, 0xd8, 0x1f, + 0x62, 0x81, 0x2b, 0x72, 0x5c, 0x21, 0x36, 0x72, 0xd0, 0x6d, 0x28, 0x85, 0x51, 0x10, 0x06, 0x04, + 0x47, 0x16, 0xb2, 0xed, 0x08, 0x13, 0x52, 0x5e, 0x11, 0xf9, 0x62, 0x7b, 0x53, 0x98, 0xeb, 0xf7, + 0x40, 0xdd, 0x43, 0x14, 0xe9, 0x25, 0x48, 0xd3, 0x53, 0x52, 0x56, 0x6a, 0xe9, 0xed, 0x82, 0xc9, + 0x3e, 0x2f, 0x9d, 0xce, 0x3f, 0x53, 0xa0, 0x3e, 0x0e, 0x28, 0xd6, 0xef, 0x83, 0xca, 0x3a, 0xc9, + 0xc5, 0xba, 0x72, 0xf5, 0x08, 0xf4, 0x5c, 0xc7, 0xc7, 0xf6, 0x11, 0x71, 0xfa, 0x67, 0x21, 0x36, + 0x79, 0xc8, 0x8c, 0xfa, 0x52, 0x73, 0xea, 0x5b, 0x87, 0x4c, 0x14, 0x4c, 0x7c, 0x5b, 0x8a, 0x52, + 0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, + 0x76, 0x6f, 0xf6, 0x73, 0xe6, 0x3f, 0x8a, 0xc1, 0x32, 0x5f, 0x7c, 0xf4, 0x57, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xfb, 0xb3, 0xf9, 0x43, 0x67, 0x0c, 0x00, 0x00, } diff --git a/proto/types/types.proto b/proto/types/types.proto index 9403ce777..0bce095a0 100644 --- a/proto/types/types.proto +++ b/proto/types/types.proto @@ -6,6 +6,7 @@ option go_package = "github.com/tendermint/tendermint/proto/types"; import "third_party/proto/gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; import "proto/libs/bits/types.proto"; +import "proto/crypto/merkle/types.proto"; import "proto/version/version.proto"; // BlockIdFlag indicates which BlcokID the signature is for @@ -32,18 +33,18 @@ enum SignedMsgType { // PartsetHeader message PartSetHeader { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; + int64 total = 1; + bytes hash = 2; +} - uint32 total = 1; - bytes hash = 2; +message Part { + uint32 index = 1; + bytes bytes = 2; + tendermint.proto.crypto.merkle.SimpleProof proof = 3 [(gogoproto.nullable) = false]; } // BlockID message BlockID { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; - bytes hash = 1; PartSetHeader parts_header = 2 [(gogoproto.nullable) = false]; } @@ -52,8 +53,6 @@ message BlockID { // Header defines the structure of a Tendermint block header. message Header { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; // basic block info tendermint.proto.version.Consensus version = 1 [(gogoproto.nullable) = false]; string chain_id = 2 [(gogoproto.customname) = "ChainID"]; @@ -94,14 +93,14 @@ message Data { message Vote { SignedMsgType type = 1; int64 height = 2; - int32 round = 3; + int64 round = 3; BlockID block_id = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes validator_address = 6; - uint32 validator_index = 7; - bytes signature = 8; + bytes validator_address = 6; + int64 validator_index = 7; + bytes signature = 8; } // Commit contains the evidence that a block was committed by a set of validators. @@ -138,3 +137,10 @@ message SignedHeader { Header header = 1; Commit commit = 2; } + +message BlockMeta { + BlockID block_id = 1 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; + int64 block_size = 2; + Header header = 3 [(gogoproto.nullable) = false]; + int64 num_txs = 4; +} diff --git a/proto/version/version.pb.go b/proto/version/version.pb.go index 0fa819463..ef217c88d 100644 --- a/proto/version/version.pb.go +++ b/proto/version/version.pb.go @@ -128,7 +128,7 @@ func init() { func init() { proto.RegisterFile("proto/version/version.proto", fileDescriptor_14aa2353622f11e1) } var fileDescriptor_14aa2353622f11e1 = []byte{ - // 203 bytes of a gzipped FileDescriptorProto + // 198 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x4b, 0x2d, 0x2a, 0xce, 0xcc, 0xcf, 0x83, 0xd1, 0x7a, 0x60, 0x51, 0x21, 0x89, 0x92, 0xd4, 0xbc, 0x94, 0xd4, 0xa2, 0xdc, 0xcc, 0xbc, 0x12, 0x88, 0x88, 0x1e, 0x54, 0x5e, 0x4a, @@ -136,12 +136,12 @@ var fileDescriptor_14aa2353622f11e1 = []byte{ 0x7e, 0x7a, 0x3e, 0x82, 0x05, 0x51, 0xaf, 0x64, 0xcb, 0xc5, 0xec, 0x58, 0x50, 0x20, 0x24, 0xc5, 0xc5, 0x01, 0xe6, 0x27, 0xe7, 0xe7, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x04, 0xc1, 0xf9, 0x20, 0xb9, 0xe2, 0xfc, 0xb4, 0x92, 0xf2, 0xc4, 0xa2, 0x54, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xce, 0x20, - 0x38, 0x5f, 0xc9, 0x96, 0x8b, 0xd3, 0x39, 0x3f, 0xaf, 0x38, 0x35, 0xaf, 0xb8, 0xb4, 0x58, 0x48, + 0x38, 0x5f, 0xc9, 0x92, 0x8b, 0xd3, 0x39, 0x3f, 0xaf, 0x38, 0x35, 0xaf, 0xb8, 0xb4, 0x58, 0x48, 0x84, 0x8b, 0x35, 0x29, 0x27, 0x3f, 0x39, 0x1b, 0x6a, 0x02, 0x84, 0x23, 0x24, 0xc0, 0xc5, 0x9c, - 0x58, 0x50, 0x00, 0xd6, 0xc9, 0x12, 0x04, 0x62, 0x5a, 0x71, 0xec, 0x58, 0x20, 0xcf, 0xf8, 0x62, - 0x81, 0x3c, 0xa3, 0x93, 0x41, 0x94, 0x5e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, - 0xae, 0x3e, 0xc2, 0x33, 0xc8, 0x4c, 0x14, 0xff, 0x27, 0xb1, 0x81, 0xb9, 0xc6, 0x80, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x20, 0x9f, 0x49, 0xf1, 0x17, 0x01, 0x00, 0x00, + 0x58, 0x50, 0x00, 0xd6, 0xc9, 0x12, 0x04, 0x62, 0x5a, 0xb1, 0xbc, 0x58, 0x20, 0xcf, 0xe8, 0x64, + 0x10, 0xa5, 0x97, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f, 0xf0, 0x08, + 0x32, 0x13, 0xc5, 0xef, 0x49, 0x6c, 0x60, 0xae, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xa6, 0xd3, + 0x5b, 0xf2, 0x13, 0x01, 0x00, 0x00, } func (this *Consensus) Equal(that interface{}) bool { @@ -174,85 +174,3 @@ func (this *Consensus) Equal(that interface{}) bool { } return true } -func NewPopulatedConsensus(r randyVersion, easy bool) *Consensus { - this := &Consensus{} - this.Block = uint64(uint64(r.Uint32())) - this.App = uint64(uint64(r.Uint32())) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedVersion(r, 3) - } - return this -} - -type randyVersion interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneVersion(r randyVersion) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringVersion(r randyVersion) string { - v1 := r.Intn(100) - tmps := make([]rune, v1) - for i := 0; i < v1; i++ { - tmps[i] = randUTF8RuneVersion(r) - } - return string(tmps) -} -func randUnrecognizedVersion(r randyVersion, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldVersion(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldVersion(dAtA []byte, r randyVersion, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateVersion(dAtA, uint64(key)) - v2 := r.Int63() - if r.Intn(2) == 0 { - v2 *= -1 - } - dAtA = encodeVarintPopulateVersion(dAtA, uint64(v2)) - case 1: - dAtA = encodeVarintPopulateVersion(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateVersion(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateVersion(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateVersion(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateVersion(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} diff --git a/proto/version/version.proto b/proto/version/version.proto index dcfa16938..9d501572f 100644 --- a/proto/version/version.proto +++ b/proto/version/version.proto @@ -17,8 +17,7 @@ message App { // including all blockchain data structures and the rules of the application's // state transition machine. message Consensus { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; uint64 block = 1; uint64 app = 2; diff --git a/types/block.go b/types/block.go index 568fa4a40..6bdc4bdf1 100644 --- a/types/block.go +++ b/types/block.go @@ -14,6 +14,8 @@ import ( "github.com/tendermint/tendermint/libs/bits" tmbytes "github.com/tendermint/tendermint/libs/bytes" tmmath "github.com/tendermint/tendermint/libs/math" + tmproto "github.com/tendermint/tendermint/proto/types" + tmversion "github.com/tendermint/tendermint/proto/version" "github.com/tendermint/tendermint/version" ) @@ -449,6 +451,62 @@ func (h *Header) StringIndented(indent string) string { indent, h.Hash()) } +// ToProto converts Header to protobuf +func (h *Header) ToProto() *tmproto.Header { + if h == nil { + return nil + } + return &tmproto.Header{ + Version: tmversion.Consensus{Block: h.Version.App.Uint64(), App: h.Version.App.Uint64()}, + ChainID: h.ChainID, + Height: h.Height, + Time: h.Time, + LastBlockID: h.LastBlockID.ToProto(), + ValidatorsHash: h.ValidatorsHash, + NextValidatorsHash: h.NextValidatorsHash, + ConsensusHash: h.ConsensusHash, + AppHash: h.AppHash, + DataHash: h.DataHash, + EvidenceHash: h.EvidenceHash, + LastResultsHash: h.LastResultsHash, + LastCommitHash: h.LastCommitHash, + ProposerAddress: h.ProposerAddress, + } +} + +// FromProto sets a protobuf Header to the given pointer. +// It returns an error if the header is invalid. +func HeaderFromProto(ph *tmproto.Header) (Header, error) { + if ph == nil { + return Header{}, errors.New("nil Header") + } + + h := new(Header) + + bi, err := BlockIDFromProto(&ph.LastBlockID) + if err != nil { + return Header{}, err + } + + h.Version = version.Consensus{Block: version.Protocol(ph.Version.Block), App: version.Protocol(ph.Version.App)} + h.ChainID = ph.ChainID + h.Height = ph.Height + h.Time = ph.Time + h.Height = ph.Height + h.LastBlockID = *bi + h.ValidatorsHash = ph.ValidatorsHash + h.NextValidatorsHash = ph.NextValidatorsHash + h.ConsensusHash = ph.ConsensusHash + h.AppHash = ph.AppHash + h.DataHash = ph.DataHash + h.EvidenceHash = ph.EvidenceHash + h.LastResultsHash = ph.LastResultsHash + h.LastCommitHash = ph.LastCommitHash + h.ProposerAddress = ph.ProposerAddress + + return *h, h.ValidateBasic() +} + //------------------------------------- // BlockIDFlag indicates which BlockID the signature is for. @@ -564,6 +622,32 @@ func (cs CommitSig) ValidateBasic() error { return nil } +// ToProto converts CommitSig to protobuf +func (cs *CommitSig) ToProto() *tmproto.CommitSig { + if cs == nil { + return nil + } + + return &tmproto.CommitSig{ + BlockIdFlag: tmproto.BlockIDFlag(cs.BlockIDFlag), + ValidatorAddress: cs.ValidatorAddress, + Timestamp: cs.Timestamp, + Signature: cs.Signature, + } +} + +// FromProto sets a protobuf CommitSig to the given pointer. +// It returns an error if the CommitSig is invalid. +func (cs *CommitSig) FromProto(csp tmproto.CommitSig) error { + + cs.BlockIDFlag = BlockIDFlag(csp.BlockIdFlag) + cs.ValidatorAddress = csp.ValidatorAddress + cs.Timestamp = csp.Timestamp + cs.Signature = csp.Signature + + return cs.ValidateBasic() +} + //------------------------------------- // Commit contains the evidence that a block was committed by a set of validators. @@ -700,17 +784,18 @@ func (commit *Commit) ValidateBasic() error { if commit.Round < 0 { return errors.New("negative Round") } + if commit.Height >= 1 { + if commit.BlockID.IsZero() { + return errors.New("commit cannot be for nil block") + } - if commit.BlockID.IsZero() { - return errors.New("commit cannot be for nil block") - } - - if len(commit.Signatures) == 0 { - return errors.New("no signatures in commit") - } - for i, commitSig := range commit.Signatures { - if err := commitSig.ValidateBasic(); err != nil { - return fmt.Errorf("wrong CommitSig #%d: %v", i, err) + if len(commit.Signatures) == 0 { + return errors.New("no signatures in commit") + } + for i, commitSig := range commit.Signatures { + if err := commitSig.ValidateBasic(); err != nil { + return fmt.Errorf("wrong CommitSig #%d: %v", i, err) + } } } @@ -756,6 +841,65 @@ func (commit *Commit) StringIndented(indent string) string { indent, commit.hash) } +// ToProto converts Commit to protobuf +func (commit *Commit) ToProto() *tmproto.Commit { + if commit == nil { + return nil + } + + c := new(tmproto.Commit) + sigs := make([]tmproto.CommitSig, len(commit.Signatures)) + for i := range commit.Signatures { + sigs[i] = *commit.Signatures[i].ToProto() + } + c.Signatures = sigs + + c.Height = commit.Height + c.Round = int32(commit.Round) + c.BlockID = commit.BlockID.ToProto() + if commit.hash != nil { + c.Hash = commit.hash + } + c.BitArray = commit.bitArray.ToProto() + return c +} + +// FromProto sets a protobuf Commit to the given pointer. +// It returns an error if the commit is invalid. +func CommitFromProto(cp *tmproto.Commit) (*Commit, error) { + if cp == nil { + return nil, errors.New("nil Commit") + } + + var ( + commit = new(Commit) + bitArray *bits.BitArray + ) + + bi, err := BlockIDFromProto(&cp.BlockID) + if err != nil { + return nil, err + } + + bitArray.FromProto(cp.BitArray) + + sigs := make([]CommitSig, len(cp.Signatures)) + for i := range cp.Signatures { + if err := sigs[i].FromProto(cp.Signatures[i]); err != nil { + return nil, err + } + } + commit.Signatures = sigs + + commit.Height = cp.Height + commit.Round = int(cp.Round) + commit.BlockID = *bi + commit.hash = cp.Hash + commit.bitArray = bitArray + + return commit, commit.ValidateBasic() +} + //----------------------------------------------------------------------------- // SignedHeader is a header along with the commits that prove it. @@ -817,6 +961,51 @@ func (sh SignedHeader) StringIndented(indent string) string { indent) } +// ToProto converts SignedHeader to protobuf +func (sh *SignedHeader) ToProto() *tmproto.SignedHeader { + if sh == nil { + return nil + } + + psh := new(tmproto.SignedHeader) + if sh.Header != nil { + psh.Header = sh.Header.ToProto() + } + if sh.Commit != nil { + psh.Commit = sh.Commit.ToProto() + } + + return psh +} + +// FromProto sets a protobuf SignedHeader to the given pointer. +// It returns an error if the hader or the commit is invalid. +func SignedHeaderFromProto(shp *tmproto.SignedHeader) (*SignedHeader, error) { + if shp == nil { + return nil, errors.New("nil SignedHeader") + } + + sh := new(SignedHeader) + + if shp.Header != nil { + h, err := HeaderFromProto(shp.Header) + if err != nil { + return nil, err + } + sh.Header = &h + } + + if shp.Commit != nil { + c, err := CommitFromProto(shp.Commit) + if err != nil { + return nil, err + } + sh.Commit = c + } + + return sh, nil +} + //----------------------------------------------------------------------------- // Data contains the set of transactions included in the block @@ -952,3 +1141,33 @@ func (blockID BlockID) IsComplete() bool { func (blockID BlockID) String() string { return fmt.Sprintf(`%v:%v`, blockID.Hash, blockID.PartsHeader) } + +// ToProto converts BlockID to protobuf +func (blockID *BlockID) ToProto() tmproto.BlockID { + if blockID == nil { + return tmproto.BlockID{} + } + + return tmproto.BlockID{ + Hash: blockID.Hash, + PartsHeader: blockID.PartsHeader.ToProto(), + } +} + +// FromProto sets a protobuf BlockID to the given pointer. +// It returns an error if the block id is invalid. +func BlockIDFromProto(bID *tmproto.BlockID) (*BlockID, error) { + if bID == nil { + return nil, errors.New("nil BlockID") + } + blockID := new(BlockID) + ph, err := PartSetHeaderFromProto(&bID.PartsHeader) + if err != nil { + return nil, err + } + + blockID.PartsHeader = *ph + blockID.Hash = bID.Hash + + return blockID, blockID.ValidateBasic() +} diff --git a/types/block_test.go b/types/block_test.go index 00cca535e..5d7091f31 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -600,3 +600,139 @@ func TestBlockIDValidateBasic(t *testing.T) { }) } } + +func makeRandHeader() Header { + chainID := "test" + t := time.Now() + height := tmrand.Int63() + randBytes := tmrand.Bytes(tmhash.Size) + randAddress := tmrand.Bytes(crypto.AddressSize) + h := Header{ + Version: version.Consensus{Block: 1, App: 1}, + ChainID: chainID, + Height: height, + Time: t, + LastBlockID: BlockID{}, + LastCommitHash: randBytes, + DataHash: randBytes, + ValidatorsHash: randBytes, + NextValidatorsHash: randBytes, + ConsensusHash: randBytes, + AppHash: randBytes, + + LastResultsHash: randBytes, + + EvidenceHash: randBytes, + ProposerAddress: randAddress, + } + + return h +} + +func TestHeaderProto(t *testing.T) { + h1 := makeRandHeader() + tc := []struct { + msg string + h1 *Header + expPass bool + }{ + {"success", &h1, true}, + {"failure empty Header", &Header{}, false}, + } + + for _, tt := range tc { + tt := tt + t.Run(tt.msg, func(t *testing.T) { + pb := tt.h1.ToProto() + h, err := HeaderFromProto(pb) + if tt.expPass { + require.NoError(t, err, tt.msg) + require.Equal(t, tt.h1, &h, tt.msg) + } else { + require.Error(t, err, tt.msg) + } + + }) + } +} + +func TestBlockIDProtoBuf(t *testing.T) { + blockID := makeBlockID([]byte("hash"), 2, []byte("part_set_hash")) + testCases := []struct { + msg string + bid1 *BlockID + expPass bool + }{ + {"success", &blockID, true}, + {"success empty", &BlockID{}, true}, + {"failure BlockID nil", nil, false}, + } + for _, tc := range testCases { + protoBlockID := tc.bid1.ToProto() + + bi, err := BlockIDFromProto(&protoBlockID) + if tc.expPass { + require.NoError(t, err) + require.Equal(t, tc.bid1, bi, tc.msg) + } else { + require.NotEqual(t, tc.bid1, bi, tc.msg) + } + } +} + +func TestSignedHeaderProtoBuf(t *testing.T) { + commit := randCommit(time.Now()) + h := makeRandHeader() + + sh := SignedHeader{Header: &h, Commit: commit} + + testCases := []struct { + msg string + sh1 *SignedHeader + expPass bool + }{ + {"empty SignedHeader 2", &SignedHeader{}, true}, + {"success", &sh, true}, + {"failure nil", nil, false}, + } + for _, tc := range testCases { + protoSignedHeader := tc.sh1.ToProto() + + sh, err := SignedHeaderFromProto(protoSignedHeader) + + if tc.expPass { + require.NoError(t, err, tc.msg) + require.Equal(t, tc.sh1, sh, tc.msg) + } else { + require.Error(t, err, tc.msg) + } + } +} + +func TestCommitProtoBuf(t *testing.T) { + commit := randCommit(time.Now()) + + testCases := []struct { + msg string + c1 *Commit + expPass bool + }{ + {"success", commit, true}, + // Empty value sets signatures to nil, signatures should not be nillable + {"empty commit", &Commit{Signatures: []CommitSig{}}, true}, + {"fail Commit nil", nil, false}, + } + for _, tc := range testCases { + tc := tc + protoCommit := tc.c1.ToProto() + + c, err := CommitFromProto(protoCommit) + + if tc.expPass { + require.NoError(t, err, tc.msg) + require.Equal(t, tc.c1, c, tc.msg) + } else { + require.Error(t, err, tc.msg) + } + } +} diff --git a/types/evidence.go b/types/evidence.go index 461ff4fba..38c04ecff 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -7,13 +7,13 @@ import ( "strings" "time" - "github.com/tendermint/tendermint/crypto/tmhash" - tmmath "github.com/tendermint/tendermint/libs/math" - amino "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/merkle" + "github.com/tendermint/tendermint/crypto/tmhash" + tmmath "github.com/tendermint/tendermint/libs/math" + tmproto "github.com/tendermint/tendermint/proto/types" ) const ( @@ -82,6 +82,241 @@ type CompositeEvidence interface { Split(committedHeader *Header, valSet *ValidatorSet, valToLastHeight map[string]int64) []Evidence } +func EvidenceToProto(evidence Evidence) (*tmproto.Evidence, error) { + if evidence == nil { + return nil, errors.New("nil evidence") + } + + switch evi := evidence.(type) { + case *DuplicateVoteEvidence: + voteB := evi.VoteB.ToProto() + voteA := evi.VoteA.ToProto() + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_DuplicateVoteEvidence{ + DuplicateVoteEvidence: &tmproto.DuplicateVoteEvidence{ + VoteA: voteA, + VoteB: voteB, + }, + }, + } + return tp, nil + case ConflictingHeadersEvidence: + pbh1 := evi.H1.ToProto() + pbh2 := evi.H2.ToProto() + + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_ConflictingHeadersEvidence{ + ConflictingHeadersEvidence: &tmproto.ConflictingHeadersEvidence{ + H1: pbh1, + H2: pbh2, + }, + }, + } + + return tp, nil + case *ConflictingHeadersEvidence: + pbh1 := evi.H1.ToProto() + pbh2 := evi.H2.ToProto() + + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_ConflictingHeadersEvidence{ + ConflictingHeadersEvidence: &tmproto.ConflictingHeadersEvidence{ + H1: pbh1, + H2: pbh2, + }, + }, + } + + return tp, nil + case *LunaticValidatorEvidence: + h := evi.Header.ToProto() + v := evi.Vote.ToProto() + + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_LunaticValidatorEvidence{ + LunaticValidatorEvidence: &tmproto.LunaticValidatorEvidence{ + Header: h, + Vote: v, + InvalidHeaderField: evi.InvalidHeaderField, + }, + }, + } + return tp, nil + case LunaticValidatorEvidence: + h := evi.Header.ToProto() + v := evi.Vote.ToProto() + + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_LunaticValidatorEvidence{ + LunaticValidatorEvidence: &tmproto.LunaticValidatorEvidence{ + Header: h, + Vote: v, + InvalidHeaderField: evi.InvalidHeaderField, + }, + }, + } + return tp, nil + case *PotentialAmnesiaEvidence: + voteB := evi.VoteB.ToProto() + voteA := evi.VoteA.ToProto() + + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_PotentialAmnesiaEvidence{ + PotentialAmnesiaEvidence: &tmproto.PotentialAmnesiaEvidence{ + VoteA: voteA, + VoteB: voteB, + }, + }, + } + + return tp, nil + case PotentialAmnesiaEvidence: + voteB := evi.VoteB.ToProto() + voteA := evi.VoteA.ToProto() + + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_PotentialAmnesiaEvidence{ + PotentialAmnesiaEvidence: &tmproto.PotentialAmnesiaEvidence{ + VoteA: voteA, + VoteB: voteB, + }, + }, + } + + return tp, nil + case MockEvidence: + if err := evi.ValidateBasic(); err != nil { + return nil, err + } + + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_MockEvidence{ + MockEvidence: &tmproto.MockEvidence{ + EvidenceHeight: evi.Height(), + EvidenceTime: evi.Time(), + EvidenceAddress: evi.Address(), + }, + }, + } + + return tp, nil + case MockRandomEvidence: + if err := evi.ValidateBasic(); err != nil { + return nil, err + } + + tp := &tmproto.Evidence{ + Sum: &tmproto.Evidence_MockRandomEvidence{ + MockRandomEvidence: &tmproto.MockRandomEvidence{ + EvidenceHeight: evi.Height(), + EvidenceTime: evi.Time(), + EvidenceAddress: evi.Address(), + RandBytes: evi.randBytes, + }, + }, + } + return tp, nil + default: + return nil, fmt.Errorf("toproto: evidence is not recognized: %T", evi) + } +} + +func EvidenceFromProto(evidence *tmproto.Evidence) (Evidence, error) { + if evidence == nil { + return nil, errors.New("nil evidence") + } + + switch evi := evidence.Sum.(type) { + case *tmproto.Evidence_DuplicateVoteEvidence: + + vA, err := VoteFromProto(evi.DuplicateVoteEvidence.VoteA) + if err != nil { + return nil, err + } + + vB, err := VoteFromProto(evi.DuplicateVoteEvidence.VoteB) + if err != nil { + return nil, err + } + + dve := DuplicateVoteEvidence{ + VoteA: vA, + VoteB: vB, + } + + return &dve, dve.ValidateBasic() + case *tmproto.Evidence_ConflictingHeadersEvidence: + h1, err := SignedHeaderFromProto(evi.ConflictingHeadersEvidence.H1) + if err != nil { + return nil, fmt.Errorf("from proto err: %w", err) + } + h2, err := SignedHeaderFromProto(evi.ConflictingHeadersEvidence.H2) + if err != nil { + return nil, fmt.Errorf("from proto err: %w", err) + } + + tp := ConflictingHeadersEvidence{ + H1: h1, + H2: h2, + } + + return tp, tp.ValidateBasic() + case *tmproto.Evidence_LunaticValidatorEvidence: + h, err := HeaderFromProto(evi.LunaticValidatorEvidence.GetHeader()) + if err != nil { + return nil, err + } + + v, err := VoteFromProto(evi.LunaticValidatorEvidence.GetVote()) + if err != nil { + return nil, err + } + + tp := LunaticValidatorEvidence{ + Header: &h, + Vote: v, + InvalidHeaderField: evi.LunaticValidatorEvidence.InvalidHeaderField, + } + + return &tp, tp.ValidateBasic() + case *tmproto.Evidence_PotentialAmnesiaEvidence: + voteA, err := VoteFromProto(evi.PotentialAmnesiaEvidence.GetVoteA()) + if err != nil { + return nil, err + } + + voteB, err := VoteFromProto(evi.PotentialAmnesiaEvidence.GetVoteB()) + if err != nil { + return nil, err + } + tp := PotentialAmnesiaEvidence{ + VoteA: voteA, + VoteB: voteB, + } + + return &tp, tp.ValidateBasic() + case *tmproto.Evidence_MockEvidence: + me := MockEvidence{ + EvidenceHeight: evi.MockEvidence.GetEvidenceHeight(), + EvidenceAddress: evi.MockEvidence.GetEvidenceAddress(), + EvidenceTime: evi.MockEvidence.GetEvidenceTime(), + } + return me, me.ValidateBasic() + case *tmproto.Evidence_MockRandomEvidence: + mre := MockRandomEvidence{ + MockEvidence: MockEvidence{ + EvidenceHeight: evi.MockRandomEvidence.GetEvidenceHeight(), + EvidenceAddress: evi.MockRandomEvidence.GetEvidenceAddress(), + EvidenceTime: evi.MockRandomEvidence.GetEvidenceTime(), + }, + randBytes: evi.MockRandomEvidence.RandBytes, + } + return mre, mre.ValidateBasic() + default: + return nil, errors.New("evidence is not recognized") + } +} + func RegisterEvidences(cdc *amino.Codec) { cdc.RegisterInterface((*Evidence)(nil), nil) cdc.RegisterConcrete(&DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence", nil) @@ -224,6 +459,7 @@ func (dve *DuplicateVoteEvidence) Equal(ev Evidence) bool { // just check their hashes dveHash := tmhash.Sum(cdcEncode(dve)) evHash := tmhash.Sum(cdcEncode(ev)) + fmt.Println(dveHash, evHash) return bytes.Equal(dveHash, evHash) } diff --git a/types/evidence_test.go b/types/evidence_test.go index 566564056..39f4edc1c 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/tmhash" @@ -460,3 +459,113 @@ func makeHeaderRandom() *Header { ProposerAddress: crypto.CRandBytes(crypto.AddressSize), } } + +func TestEvidenceProto(t *testing.T) { + // -------- Votes -------- + val := NewMockPV() + blockID := makeBlockID(tmhash.Sum([]byte("blockhash")), math.MaxInt64, tmhash.Sum([]byte("partshash"))) + blockID2 := makeBlockID(tmhash.Sum([]byte("blockhash2")), math.MaxInt64, tmhash.Sum([]byte("partshash"))) + const chainID = "mychain" + v := makeVote(t, val, chainID, math.MaxInt64, math.MaxInt64, 1, 0x01, blockID) + v2 := makeVote(t, val, chainID, math.MaxInt64, math.MaxInt64, 2, 0x01, blockID2) + + // -------- SignedHeaders -------- + const height int64 = 37 + + var ( + header1 = makeHeaderRandom() + header2 = makeHeaderRandom() + ) + + header1.Height = height + header1.LastBlockID = blockID + header1.ChainID = chainID + + header2.Height = height + header2.LastBlockID = blockID + header2.ChainID = chainID + + voteSet1, valSet, vals := randVoteSet(height, 1, PrecommitType, 10, 1) + voteSet2 := NewVoteSet(chainID, height, 1, PrecommitType, valSet) + + commit1, err := MakeCommit(BlockID{ + Hash: header1.Hash(), + PartsHeader: PartSetHeader{ + Total: 100, + Hash: crypto.CRandBytes(tmhash.Size), + }, + }, height, 1, voteSet1, vals, time.Now()) + require.NoError(t, err) + commit2, err := MakeCommit(BlockID{ + Hash: header2.Hash(), + PartsHeader: PartSetHeader{ + Total: 100, + Hash: crypto.CRandBytes(tmhash.Size), + }, + }, height, 1, voteSet2, vals, time.Now()) + require.NoError(t, err) + + h1 := &SignedHeader{ + Header: header1, + Commit: commit1, + } + h2 := &SignedHeader{ + Header: header2, + Commit: commit2, + } + + tests := []struct { + testName string + evidence Evidence + wantErr bool + wantErr2 bool + }{ + {"&DuplicateVoteEvidence empty fail", &DuplicateVoteEvidence{}, false, true}, + {"&DuplicateVoteEvidence nil voteB", &DuplicateVoteEvidence{VoteA: v, VoteB: nil}, false, true}, + {"&DuplicateVoteEvidence nil voteA", &DuplicateVoteEvidence{VoteA: nil, VoteB: v}, false, true}, + {"&DuplicateVoteEvidence success", &DuplicateVoteEvidence{VoteA: v2, VoteB: v}, false, false}, + {"&ConflictingHeadersEvidence empty fail", &ConflictingHeadersEvidence{}, false, true}, + {"&ConflictingHeadersEvidence nil H2", &ConflictingHeadersEvidence{H1: h1, H2: nil}, false, true}, + {"&ConflictingHeadersEvidence nil H1", &ConflictingHeadersEvidence{H1: nil, H2: h2}, false, true}, + {"ConflictingHeadersEvidence empty fail", ConflictingHeadersEvidence{}, false, true}, + {"ConflictingHeadersEvidence nil H2", ConflictingHeadersEvidence{H1: h1, H2: nil}, false, true}, + {"ConflictingHeadersEvidence nil H1", ConflictingHeadersEvidence{H1: nil, H2: h2}, false, true}, + {"ConflictingHeadersEvidence success", ConflictingHeadersEvidence{H1: h1, H2: h2}, false, false}, + {"LunaticValidatorEvidence empty fail", LunaticValidatorEvidence{}, false, true}, + {"LunaticValidatorEvidence only header fail", LunaticValidatorEvidence{Header: header1}, false, true}, + {"LunaticValidatorEvidence only vote fail", LunaticValidatorEvidence{Vote: v}, false, true}, + {"LunaticValidatorEvidence header & vote fail", LunaticValidatorEvidence{Header: header1, Vote: v}, false, true}, + {"LunaticValidatorEvidence success", LunaticValidatorEvidence{Header: header1, + Vote: v, InvalidHeaderField: "ValidatorsHash"}, false, true}, + {"&LunaticValidatorEvidence empty fail", &LunaticValidatorEvidence{}, false, true}, + {"LunaticValidatorEvidence only header fail", &LunaticValidatorEvidence{Header: header1}, false, true}, + {"LunaticValidatorEvidence only vote fail", &LunaticValidatorEvidence{Vote: v}, false, true}, + {"LunaticValidatorEvidence header & vote fail", &LunaticValidatorEvidence{Header: header1, Vote: v}, false, true}, + {"&LunaticValidatorEvidence empty fail", &LunaticValidatorEvidence{}, false, true}, + {"PotentialAmnesiaEvidence empty fail", PotentialAmnesiaEvidence{}, false, true}, + {"PotentialAmnesiaEvidence nil VoteB", PotentialAmnesiaEvidence{VoteA: v, VoteB: nil}, false, true}, + {"PotentialAmnesiaEvidence nil VoteA", PotentialAmnesiaEvidence{VoteA: nil, VoteB: v2}, false, true}, + {"&PotentialAmnesiaEvidence empty fail", &PotentialAmnesiaEvidence{}, false, true}, + {"&PotentialAmnesiaEvidence nil VoteB", &PotentialAmnesiaEvidence{VoteA: v, VoteB: nil}, false, true}, + {"&PotentialAmnesiaEvidence nil VoteA", &PotentialAmnesiaEvidence{VoteA: nil, VoteB: v2}, false, true}, + {"&PotentialAmnesiaEvidence success", &PotentialAmnesiaEvidence{VoteA: v2, VoteB: v}, false, false}, + } + for _, tt := range tests { + tt := tt + t.Run(tt.testName, func(t *testing.T) { + pb, err := EvidenceToProto(tt.evidence) + if tt.wantErr { + assert.Error(t, err, tt.testName) + return + } + assert.NoError(t, err, tt.testName) + + evi, err := EvidenceFromProto(pb) + if tt.wantErr2 { + assert.Error(t, err, tt.testName) + return + } + require.Equal(t, tt.evidence, evi, tt.testName) + }) + } +} diff --git a/types/part_set.go b/types/part_set.go index f153849e2..fa3c8738d 100644 --- a/types/part_set.go +++ b/types/part_set.go @@ -11,6 +11,7 @@ import ( "github.com/tendermint/tendermint/libs/bits" tmbytes "github.com/tendermint/tendermint/libs/bytes" tmmath "github.com/tendermint/tendermint/libs/math" + tmproto "github.com/tendermint/tendermint/proto/types" ) var ( @@ -84,6 +85,30 @@ func (psh PartSetHeader) ValidateBasic() error { return nil } +// ToProto converts BloPartSetHeaderckID to protobuf +func (psh *PartSetHeader) ToProto() tmproto.PartSetHeader { + if psh == nil { + return tmproto.PartSetHeader{} + } + + return tmproto.PartSetHeader{ + Total: int64(psh.Total), + Hash: psh.Hash, + } +} + +// FromProto sets a protobuf PartSetHeader to the given pointer +func PartSetHeaderFromProto(ppsh *tmproto.PartSetHeader) (*PartSetHeader, error) { + if ppsh == nil { + return nil, errors.New("nil PartSetHeader") + } + psh := new(PartSetHeader) + psh.Total = int(ppsh.Total) + psh.Hash = ppsh.Hash + + return psh, psh.ValidateBasic() +} + //------------------------------------- type PartSet struct { diff --git a/types/part_set_test.go b/types/part_set_test.go index 854848a44..7520feda3 100644 --- a/types/part_set_test.go +++ b/types/part_set_test.go @@ -136,3 +136,26 @@ func TestPartValidateBasic(t *testing.T) { }) } } + +func TestParSetHeaderProtoBuf(t *testing.T) { + testCases := []struct { + msg string + ps1 *PartSetHeader + expPass bool + }{ + {"success empty", &PartSetHeader{}, true}, + {"success", + &PartSetHeader{Total: 1, Hash: []byte("hash")}, true}, + } + + for _, tc := range testCases { + protoBlockID := tc.ps1.ToProto() + + psh, err := PartSetHeaderFromProto(&protoBlockID) + if tc.expPass { + require.Equal(t, tc.ps1, psh, tc.msg) + } else { + require.Error(t, err, tc.msg) + } + } +} diff --git a/types/proposal.go b/types/proposal.go index 8175c8a1f..065dfbbbd 100644 --- a/types/proposal.go +++ b/types/proposal.go @@ -6,6 +6,7 @@ import ( "time" "github.com/tendermint/tendermint/libs/bytes" + tmproto "github.com/tendermint/tendermint/proto/types" tmtime "github.com/tendermint/tendermint/types/time" ) @@ -95,3 +96,46 @@ func (p *Proposal) SignBytes(chainID string) []byte { } return bz } + +// ToProto converts Proposal to protobuf +func (p *Proposal) ToProto() *tmproto.Proposal { + if p == nil { + return nil + } + pb := new(tmproto.Proposal) + + pb.BlockID = p.BlockID.ToProto() + pb.Type = tmproto.SignedMsgType(p.Type) + pb.Height = p.Height + pb.Round = int32(p.Round) + pb.PolRound = int32(p.POLRound) + pb.Timestamp = p.Timestamp + pb.Signature = p.Signature + + return pb +} + +// FromProto sets a protobuf Proposal to the given pointer. +// It returns an error if the proposal is invalid. +func ProposalFromProto(pp *tmproto.Proposal) (*Proposal, error) { + if pp == nil { + return nil, errors.New("nil proposal") + } + + p := new(Proposal) + + blockID, err := BlockIDFromProto(&pp.BlockID) + if err != nil { + return nil, err + } + + p.BlockID = *blockID + p.Type = SignedMsgType(pp.Type) + p.Height = pp.Height + p.Round = int(pp.Round) + p.POLRound = int(pp.PolRound) + p.Timestamp = pp.Timestamp + p.Signature = pp.Signature + + return p, p.ValidateBasic() +} diff --git a/types/proposal_test.go b/types/proposal_test.go index e4ea19183..b4ab14b69 100644 --- a/types/proposal_test.go +++ b/types/proposal_test.go @@ -142,3 +142,31 @@ func TestProposalValidateBasic(t *testing.T) { }) } } + +func TestProposalProtoBuf(t *testing.T) { + proposal := NewProposal(1, 2, 3, makeBlockID([]byte("hash"), 2, []byte("part_set_hash"))) + proposal.Signature = []byte("sig") + proposal2 := NewProposal(1, 2, 3, BlockID{}) + + testCases := []struct { + msg string + p1 *Proposal + expPass bool + }{ + {"success", proposal, true}, + {"success", proposal2, false}, // blcokID cannot be empty + {"empty proposal failure validatebasic", &Proposal{}, false}, + {"nil proposal", nil, false}, + } + for _, tc := range testCases { + protoProposal := tc.p1.ToProto() + + p, err := ProposalFromProto(protoProposal) + if tc.expPass { + require.NoError(t, err) + require.Equal(t, tc.p1, p, tc.msg) + } else { + require.Error(t, err) + } + } +} diff --git a/types/validator.go b/types/validator.go index 359a19114..cdc5f6bf9 100644 --- a/types/validator.go +++ b/types/validator.go @@ -2,11 +2,14 @@ package types import ( "bytes" + "errors" "fmt" "strings" "github.com/tendermint/tendermint/crypto" + ce "github.com/tendermint/tendermint/crypto/encoding" tmrand "github.com/tendermint/tendermint/libs/rand" + tmproto "github.com/tendermint/tendermint/proto/types" ) // Volatile state for each Validator @@ -94,6 +97,47 @@ func (v *Validator) Bytes() []byte { }) } +// ToProto converts Valiator to protobuf +func (v *Validator) ToProto() (*tmproto.Validator, error) { + if v == nil { + return nil, errors.New("nil validator") + } + + pk, err := ce.PubKeyToProto(v.PubKey) + if err != nil { + return nil, err + } + + vp := tmproto.Validator{ + Address: v.Address, + PubKey: pk, + VotingPower: v.VotingPower, + ProposerPriority: v.ProposerPriority, + } + + return &vp, nil +} + +// FromProto sets a protobuf Validator to the given pointer. +// It returns an error if the public key is invalid. +func ValidatorFromProto(vp *tmproto.Validator) (*Validator, error) { + if vp == nil { + return nil, errors.New("nil validator") + } + + pk, err := ce.PubKeyFromProto(vp.PubKey) + if err != nil { + return nil, err + } + v := new(Validator) + v.Address = vp.GetAddress() + v.PubKey = pk + v.VotingPower = vp.GetVotingPower() + v.ProposerPriority = vp.GetProposerPriority() + + return v, nil +} + //---------------------------------------- // RandValidator diff --git a/types/validator_set.go b/types/validator_set.go index 3cf4ee056..46e1cde75 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -11,6 +11,7 @@ import ( "github.com/tendermint/tendermint/crypto/merkle" tmmath "github.com/tendermint/tendermint/libs/math" + tmproto "github.com/tendermint/tendermint/proto/types" ) const ( @@ -915,6 +916,64 @@ func (valz ValidatorsByAddress) Swap(i, j int) { valz[i], valz[j] = valz[j], valz[i] } +// ToProto converts ValidatorSet to protobuf +func (vals *ValidatorSet) ToProto() (*tmproto.ValidatorSet, error) { + if vals == nil { + return nil, errors.New("nil validator set") // validator set should never be nil + } + vp := new(tmproto.ValidatorSet) + valsProto := make([]*tmproto.Validator, len(vals.Validators)) + for i := 0; i < len(vals.Validators); i++ { + valp, err := vals.Validators[i].ToProto() + if err != nil { + return nil, err + } + valsProto[i] = valp + } + vp.Validators = valsProto + + valProposer, err := vals.Proposer.ToProto() + if err != nil { + return nil, fmt.Errorf("toProto: validatorSet proposer error: %w", err) + } + vp.Proposer = valProposer + + vp.TotalVotingPower = vals.totalVotingPower + + return vp, nil +} + +// ValidatorSetFromProto sets a protobuf ValidatorSet to the given pointer. +// It returns an error if any of the validators from the set or the proposer +// is invalid +func ValidatorSetFromProto(vp *tmproto.ValidatorSet) (*ValidatorSet, error) { + if vp == nil { + return nil, errors.New("nil validator set") // validator set should never be nil, bigger issues are at play if empty + } + vals := new(ValidatorSet) + + valsProto := make([]*Validator, len(vp.Validators)) + for i := 0; i < len(vp.Validators); i++ { + v, err := ValidatorFromProto(vp.Validators[i]) + if err != nil { + return nil, err + } + valsProto[i] = v + } + vals.Validators = valsProto + + p, err := ValidatorFromProto(vp.GetProposer()) + if err != nil { + return nil, fmt.Errorf("fromProto: validatorSet proposer error: %w", err) + } + + vals.Proposer = p + + vals.totalVotingPower = vp.GetTotalVotingPower() + + return vals, nil +} + //---------------------------------------- // RandValidatorSet returns a randomized validator set (size: +numValidators+), diff --git a/types/validator_set_test.go b/types/validator_set_test.go index fcfac10e3..15c33930e 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -1412,6 +1412,48 @@ func TestSafeMul(t *testing.T) { } } +func TestValidatorSetProtoBuf(t *testing.T) { + valset, _ := RandValidatorSet(10, 100) + valset2, _ := RandValidatorSet(10, 100) + valset2.Validators[0] = &Validator{} + + valset3, _ := RandValidatorSet(10, 100) + valset3.Proposer = nil + + valset4, _ := RandValidatorSet(10, 100) + valset4.Proposer = &Validator{} + + testCases := []struct { + msg string + v1 *ValidatorSet + expPass1 bool + expPass2 bool + }{ + {"success", valset, true, true}, + {"fail valSet2, pubkey empty", valset2, false, false}, + {"fail nil Proposer", valset3, false, false}, + {"fail empty Proposer", valset4, false, false}, + {"fail empty valSet", &ValidatorSet{}, false, false}, + {"false nil", nil, false, false}, + } + for _, tc := range testCases { + protoValSet, err := tc.v1.ToProto() + if tc.expPass1 { + require.NoError(t, err, tc.msg) + } else { + require.Error(t, err, tc.msg) + } + + valSet, err := ValidatorSetFromProto(protoValSet) + if tc.expPass2 { + require.NoError(t, err, tc.msg) + require.EqualValues(t, tc.v1, valSet, tc.msg) + } else { + require.Error(t, err, tc.msg) + } + } +} + //--------------------- // Sort validators by priority and address type validatorsByPriority []*Validator diff --git a/types/validator_test.go b/types/validator_test.go new file mode 100644 index 000000000..edf877baf --- /dev/null +++ b/types/validator_test.go @@ -0,0 +1,38 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestValidatorProtoBuf(t *testing.T) { + val, _ := RandValidator(true, 100) + testCases := []struct { + msg string + v1 *Validator + expPass1 bool + expPass2 bool + }{ + {"success validator", val, true, true}, + {"failure empty", &Validator{}, false, false}, + {"failure nil", nil, false, false}, + } + for _, tc := range testCases { + protoVal, err := tc.v1.ToProto() + + if tc.expPass1 { + require.NoError(t, err, tc.msg) + } else { + require.Error(t, err, tc.msg) + } + + val, err := ValidatorFromProto(protoVal) + if tc.expPass2 { + require.NoError(t, err, tc.msg) + require.Equal(t, tc.v1, val, tc.msg) + } else { + require.Error(t, err, tc.msg) + } + } +} diff --git a/types/vote.go b/types/vote.go index 807519518..ca83084d7 100644 --- a/types/vote.go +++ b/types/vote.go @@ -8,6 +8,7 @@ import ( "github.com/tendermint/tendermint/crypto" tmbytes "github.com/tendermint/tendermint/libs/bytes" + tmproto "github.com/tendermint/tendermint/proto/types" ) const ( @@ -171,3 +172,47 @@ func (vote *Vote) ValidateBasic() error { } return nil } + +// ToProto converts the handwritten type to proto generated type +// return type, nil if everything converts safely, otherwise nil, error +func (vote *Vote) ToProto() *tmproto.Vote { + if vote == nil { + return nil + } + + return &tmproto.Vote{ + Type: tmproto.SignedMsgType(vote.Type), + Height: vote.Height, + Round: int64(vote.Round), + BlockID: vote.BlockID.ToProto(), + Timestamp: vote.Timestamp, + ValidatorAddress: vote.ValidatorAddress, + ValidatorIndex: int64(vote.ValidatorIndex), + Signature: vote.Signature, + } +} + +//FromProto converts a proto generetad type to a handwritten type +// return type, nil if everything converts safely, otherwise nil, error +func VoteFromProto(pv *tmproto.Vote) (*Vote, error) { + if pv == nil { + return nil, errors.New("nil vote") + } + + blockID, err := BlockIDFromProto(&pv.BlockID) + if err != nil { + return nil, err + } + + vote := new(Vote) + vote.Type = SignedMsgType(pv.Type) + vote.Height = pv.Height + vote.Round = int(pv.Round) + vote.BlockID = *blockID + vote.Timestamp = pv.Timestamp + vote.ValidatorAddress = pv.ValidatorAddress + vote.ValidatorIndex = int(pv.ValidatorIndex) + vote.Signature = pv.Signature + + return vote, vote.ValidateBasic() +} diff --git a/types/vote_test.go b/types/vote_test.go index eb4f6a955..c3bd7a16f 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -286,3 +286,31 @@ func TestVoteValidateBasic(t *testing.T) { }) } } + +func TestVoteProtobuf(t *testing.T) { + privVal := NewMockPV() + vote := examplePrecommit() + err := privVal.SignVote("test_chain_id", vote) + require.NoError(t, err) + + testCases := []struct { + msg string + v1 *Vote + expPass bool + }{ + {"success", vote, true}, + {"fail vote validate basic", &Vote{}, false}, + {"failure nil", nil, false}, + } + for _, tc := range testCases { + protoProposal := tc.v1.ToProto() + + v, err := VoteFromProto(protoProposal) + if tc.expPass { + require.NoError(t, err) + require.Equal(t, tc.v1, v, tc.msg) + } else { + require.Error(t, err) + } + } +}