fix test cases

updated protoc version

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3347/head
Leo Chen 4 years ago
parent 7dcdbe7d2b
commit 79d43c2ce8
  1. 1391
      api/proto/message/message.pb.go
  2. 432
      api/service/syncing/downloader/proto/downloader.pb.go
  3. 10
      consensus/consensus_service_test.go
  4. 4
      consensus/consensus_test.go
  5. 2
      consensus/consensus_v2.go
  6. 4
      consensus/construct_test.go
  7. 3
      consensus/view_change.go
  8. 14
      consensus/view_change_test.go
  9. 2
      go.mod
  10. 2
      scripts/install_build_tools.sh
  11. 1
      scripts/install_protoc.sh

File diff suppressed because it is too large Load Diff

@ -1,29 +1,33 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.23.0
// protoc v3.12.3
// source: downloader.proto
package downloader
import (
context "context"
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 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.ProtoPackageIsVersion3 // please upgrade the proto package
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type DownloaderRequest_RequestType int32
@ -38,7 +42,9 @@ const (
DownloaderRequest_BLOCKHEADER DownloaderRequest_RequestType = 7
)
var DownloaderRequest_RequestType_name = map[int32]string{
// Enum value maps for DownloaderRequest_RequestType.
var (
DownloaderRequest_RequestType_name = map[int32]string{
0: "BLOCKHASH",
1: "BLOCK",
2: "NEWBLOCK",
@ -47,9 +53,8 @@ var DownloaderRequest_RequestType_name = map[int32]string{
5: "REGISTERTIMEOUT",
6: "UNKNOWN",
7: "BLOCKHEADER",
}
var DownloaderRequest_RequestType_value = map[string]int32{
}
DownloaderRequest_RequestType_value = map[string]int32{
"BLOCKHASH": 0,
"BLOCK": 1,
"NEWBLOCK": 2,
@ -58,14 +63,34 @@ var DownloaderRequest_RequestType_value = map[string]int32{
"REGISTERTIMEOUT": 5,
"UNKNOWN": 6,
"BLOCKHEADER": 7,
}
)
func (x DownloaderRequest_RequestType) Enum() *DownloaderRequest_RequestType {
p := new(DownloaderRequest_RequestType)
*p = x
return p
}
func (x DownloaderRequest_RequestType) String() string {
return proto.EnumName(DownloaderRequest_RequestType_name, int32(x))
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (DownloaderRequest_RequestType) Descriptor() protoreflect.EnumDescriptor {
return file_downloader_proto_enumTypes[0].Descriptor()
}
func (DownloaderRequest_RequestType) Type() protoreflect.EnumType {
return &file_downloader_proto_enumTypes[0]
}
func (x DownloaderRequest_RequestType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use DownloaderRequest_RequestType.Descriptor instead.
func (DownloaderRequest_RequestType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_6a99ec95c7ab1ff1, []int{0, 0}
return file_downloader_proto_rawDescGZIP(), []int{0, 0}
}
type DownloaderResponse_RegisterResponseType int32
@ -73,31 +98,56 @@ type DownloaderResponse_RegisterResponseType int32
const (
DownloaderResponse_SUCCESS DownloaderResponse_RegisterResponseType = 0
DownloaderResponse_FAIL DownloaderResponse_RegisterResponseType = 1
DownloaderResponse_INSYNC DownloaderResponse_RegisterResponseType = 2
DownloaderResponse_INSYNC DownloaderResponse_RegisterResponseType = 2 // node is now in sync, remove it from the broadcast list
)
var DownloaderResponse_RegisterResponseType_name = map[int32]string{
// Enum value maps for DownloaderResponse_RegisterResponseType.
var (
DownloaderResponse_RegisterResponseType_name = map[int32]string{
0: "SUCCESS",
1: "FAIL",
2: "INSYNC",
}
var DownloaderResponse_RegisterResponseType_value = map[string]int32{
}
DownloaderResponse_RegisterResponseType_value = map[string]int32{
"SUCCESS": 0,
"FAIL": 1,
"INSYNC": 2,
}
)
func (x DownloaderResponse_RegisterResponseType) Enum() *DownloaderResponse_RegisterResponseType {
p := new(DownloaderResponse_RegisterResponseType)
*p = x
return p
}
func (x DownloaderResponse_RegisterResponseType) String() string {
return proto.EnumName(DownloaderResponse_RegisterResponseType_name, int32(x))
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (DownloaderResponse_RegisterResponseType) Descriptor() protoreflect.EnumDescriptor {
return file_downloader_proto_enumTypes[1].Descriptor()
}
func (DownloaderResponse_RegisterResponseType) Type() protoreflect.EnumType {
return &file_downloader_proto_enumTypes[1]
}
func (x DownloaderResponse_RegisterResponseType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use DownloaderResponse_RegisterResponseType.Descriptor instead.
func (DownloaderResponse_RegisterResponseType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_6a99ec95c7ab1ff1, []int{1, 0}
return file_downloader_proto_rawDescGZIP(), []int{1, 0}
}
// DownloaderRequest is the generic download request.
type DownloaderRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Request type.
Type DownloaderRequest_RequestType `protobuf:"varint,1,opt,name=type,proto3,enum=downloader.DownloaderRequest_RequestType" json:"type,omitempty"`
// The hashes of the blocks we want to download.
@ -107,182 +157,286 @@ type DownloaderRequest struct {
Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"`
Port string `protobuf:"bytes,6,opt,name=port,proto3" json:"port,omitempty"`
Size uint32 `protobuf:"varint,7,opt,name=size,proto3" json:"size,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DownloaderRequest) Reset() { *m = DownloaderRequest{} }
func (m *DownloaderRequest) String() string { return proto.CompactTextString(m) }
func (*DownloaderRequest) ProtoMessage() {}
func (*DownloaderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_6a99ec95c7ab1ff1, []int{0}
func (x *DownloaderRequest) Reset() {
*x = DownloaderRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_downloader_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (m *DownloaderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DownloaderRequest.Unmarshal(m, b)
}
func (m *DownloaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DownloaderRequest.Marshal(b, m, deterministic)
func (x *DownloaderRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (m *DownloaderRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DownloaderRequest.Merge(m, src)
}
func (m *DownloaderRequest) XXX_Size() int {
return xxx_messageInfo_DownloaderRequest.Size(m)
}
func (m *DownloaderRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DownloaderRequest.DiscardUnknown(m)
func (*DownloaderRequest) ProtoMessage() {}
func (x *DownloaderRequest) ProtoReflect() protoreflect.Message {
mi := &file_downloader_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var xxx_messageInfo_DownloaderRequest proto.InternalMessageInfo
// Deprecated: Use DownloaderRequest.ProtoReflect.Descriptor instead.
func (*DownloaderRequest) Descriptor() ([]byte, []int) {
return file_downloader_proto_rawDescGZIP(), []int{0}
}
func (m *DownloaderRequest) GetType() DownloaderRequest_RequestType {
if m != nil {
return m.Type
func (x *DownloaderRequest) GetType() DownloaderRequest_RequestType {
if x != nil {
return x.Type
}
return DownloaderRequest_BLOCKHASH
}
func (m *DownloaderRequest) GetHashes() [][]byte {
if m != nil {
return m.Hashes
func (x *DownloaderRequest) GetHashes() [][]byte {
if x != nil {
return x.Hashes
}
return nil
}
func (m *DownloaderRequest) GetPeerHash() []byte {
if m != nil {
return m.PeerHash
func (x *DownloaderRequest) GetPeerHash() []byte {
if x != nil {
return x.PeerHash
}
return nil
}
func (m *DownloaderRequest) GetBlockHash() []byte {
if m != nil {
return m.BlockHash
func (x *DownloaderRequest) GetBlockHash() []byte {
if x != nil {
return x.BlockHash
}
return nil
}
func (m *DownloaderRequest) GetIp() string {
if m != nil {
return m.Ip
func (x *DownloaderRequest) GetIp() string {
if x != nil {
return x.Ip
}
return ""
}
func (m *DownloaderRequest) GetPort() string {
if m != nil {
return m.Port
func (x *DownloaderRequest) GetPort() string {
if x != nil {
return x.Port
}
return ""
}
func (m *DownloaderRequest) GetSize() uint32 {
if m != nil {
return m.Size
func (x *DownloaderRequest) GetSize() uint32 {
if x != nil {
return x.Size
}
return 0
}
// DownloaderResponse is the generic response of DownloaderRequest.
type DownloaderResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// payload of Block.
Payload [][]byte `protobuf:"bytes,1,rep,name=payload,proto3" json:"payload,omitempty"`
// response of registration request
Type DownloaderResponse_RegisterResponseType `protobuf:"varint,2,opt,name=type,proto3,enum=downloader.DownloaderResponse_RegisterResponseType" json:"type,omitempty"`
BlockHeight uint64 `protobuf:"varint,3,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DownloaderResponse) Reset() { *m = DownloaderResponse{} }
func (m *DownloaderResponse) String() string { return proto.CompactTextString(m) }
func (*DownloaderResponse) ProtoMessage() {}
func (*DownloaderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_6a99ec95c7ab1ff1, []int{1}
func (x *DownloaderResponse) Reset() {
*x = DownloaderResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_downloader_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (m *DownloaderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DownloaderResponse.Unmarshal(m, b)
func (x *DownloaderResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (m *DownloaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DownloaderResponse.Marshal(b, m, deterministic)
}
func (m *DownloaderResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_DownloaderResponse.Merge(m, src)
}
func (m *DownloaderResponse) XXX_Size() int {
return xxx_messageInfo_DownloaderResponse.Size(m)
}
func (m *DownloaderResponse) XXX_DiscardUnknown() {
xxx_messageInfo_DownloaderResponse.DiscardUnknown(m)
func (*DownloaderResponse) ProtoMessage() {}
func (x *DownloaderResponse) ProtoReflect() protoreflect.Message {
mi := &file_downloader_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var xxx_messageInfo_DownloaderResponse proto.InternalMessageInfo
// Deprecated: Use DownloaderResponse.ProtoReflect.Descriptor instead.
func (*DownloaderResponse) Descriptor() ([]byte, []int) {
return file_downloader_proto_rawDescGZIP(), []int{1}
}
func (m *DownloaderResponse) GetPayload() [][]byte {
if m != nil {
return m.Payload
func (x *DownloaderResponse) GetPayload() [][]byte {
if x != nil {
return x.Payload
}
return nil
}
func (m *DownloaderResponse) GetType() DownloaderResponse_RegisterResponseType {
if m != nil {
return m.Type
func (x *DownloaderResponse) GetType() DownloaderResponse_RegisterResponseType {
if x != nil {
return x.Type
}
return DownloaderResponse_SUCCESS
}
func (m *DownloaderResponse) GetBlockHeight() uint64 {
if m != nil {
return m.BlockHeight
func (x *DownloaderResponse) GetBlockHeight() uint64 {
if x != nil {
return x.BlockHeight
}
return 0
}
func init() {
proto.RegisterEnum("downloader.DownloaderRequest_RequestType", DownloaderRequest_RequestType_name, DownloaderRequest_RequestType_value)
proto.RegisterEnum("downloader.DownloaderResponse_RegisterResponseType", DownloaderResponse_RegisterResponseType_name, DownloaderResponse_RegisterResponseType_value)
proto.RegisterType((*DownloaderRequest)(nil), "downloader.DownloaderRequest")
proto.RegisterType((*DownloaderResponse)(nil), "downloader.DownloaderResponse")
}
func init() {
proto.RegisterFile("downloader.proto", fileDescriptor_6a99ec95c7ab1ff1)
}
var fileDescriptor_6a99ec95c7ab1ff1 = []byte{
// 410 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0xce, 0x3a, 0x8e, 0x93, 0x4c, 0xd2, 0x76, 0x19, 0x10, 0x5a, 0x55, 0x80, 0x2c, 0x9f, 0xcc,
0xc5, 0x87, 0xf6, 0xc4, 0x81, 0x43, 0x70, 0x4d, 0x6c, 0xb5, 0x38, 0x62, 0xed, 0x50, 0x71, 0x74,
0xe9, 0xaa, 0xb6, 0xa8, 0xea, 0xc5, 0xeb, 0x0a, 0x99, 0x17, 0xe0, 0x05, 0x79, 0x06, 0x9e, 0x03,
0x79, 0x9d, 0xd6, 0x96, 0x80, 0x9c, 0x76, 0xbf, 0x6f, 0x7e, 0x34, 0xf3, 0x7d, 0x03, 0xf4, 0xba,
0xfc, 0x7e, 0x77, 0x5b, 0x66, 0xd7, 0xa2, 0xf2, 0x64, 0x55, 0xd6, 0x25, 0x42, 0xcf, 0x38, 0xbf,
0x0d, 0x78, 0x72, 0xf6, 0x08, 0xb9, 0xf8, 0x76, 0x2f, 0x54, 0x8d, 0x6f, 0xc1, 0xac, 0x1b, 0x29,
0x18, 0xb1, 0x89, 0x7b, 0x78, 0xf2, 0xda, 0x1b, 0xb4, 0xf8, 0x2b, 0xd9, 0xdb, 0xbd, 0x69, 0x23,
0x05, 0xd7, 0x65, 0xf8, 0x1c, 0xac, 0x3c, 0x53, 0xb9, 0x50, 0xcc, 0xb0, 0xc7, 0xee, 0x92, 0xef,
0x10, 0x1e, 0xc3, 0x4c, 0x0a, 0x51, 0x85, 0x99, 0xca, 0xd9, 0xd8, 0x26, 0xee, 0x92, 0x3f, 0x62,
0x7c, 0x01, 0xf3, 0xab, 0xdb, 0xf2, 0xcb, 0x57, 0x1d, 0x34, 0x75, 0xb0, 0x27, 0xf0, 0x10, 0x8c,
0x42, 0xb2, 0x89, 0x4d, 0xdc, 0x39, 0x37, 0x0a, 0x89, 0x08, 0xa6, 0x2c, 0xab, 0x9a, 0x59, 0x9a,
0xd1, 0xff, 0x96, 0x53, 0xc5, 0x0f, 0xc1, 0xa6, 0x36, 0x71, 0x0f, 0xb8, 0xfe, 0x3b, 0x3f, 0x09,
0x2c, 0x06, 0xf3, 0xe1, 0x01, 0xcc, 0xdf, 0x5d, 0x6c, 0xfc, 0xf3, 0x70, 0x95, 0x84, 0x74, 0x84,
0x73, 0x98, 0x68, 0x48, 0x09, 0x2e, 0x61, 0x16, 0x07, 0x97, 0x1d, 0x32, 0xf0, 0x08, 0x16, 0x5d,
0x5e, 0x10, 0xad, 0xc3, 0x94, 0x8e, 0xdb, 0x30, 0x0f, 0xd6, 0x51, 0x92, 0x06, 0x9c, 0x9a, 0xf8,
0x14, 0x8e, 0x1e, 0x50, 0x1a, 0x7d, 0x08, 0x36, 0xdb, 0x94, 0x4e, 0x70, 0x01, 0xd3, 0x6d, 0x7c,
0x1e, 0x6f, 0x2e, 0x63, 0x6a, 0x0d, 0x1a, 0xac, 0xce, 0x02, 0x4e, 0xa7, 0xce, 0x2f, 0x02, 0x38,
0xd4, 0x4e, 0xc9, 0xf2, 0x4e, 0x09, 0x64, 0x30, 0x95, 0x59, 0xd3, 0x92, 0x8c, 0x68, 0xad, 0x1e,
0x20, 0xae, 0x77, 0x1e, 0x18, 0xda, 0x83, 0xd3, 0xff, 0x79, 0xd0, 0xf5, 0xf1, 0xb8, 0xb8, 0x29,
0x54, 0xdd, 0x13, 0x03, 0x37, 0x6c, 0x58, 0x74, 0x42, 0x8a, 0xe2, 0x26, 0xaf, 0xb5, 0xf0, 0x26,
0x1f, 0x52, 0xce, 0x1b, 0x78, 0xf6, 0xaf, 0xfa, 0x76, 0xa3, 0x64, 0xeb, 0xfb, 0x41, 0x92, 0xd0,
0x11, 0xce, 0xc0, 0x7c, 0xbf, 0x8a, 0x2e, 0x28, 0x41, 0x00, 0x2b, 0x8a, 0x93, 0xcf, 0xb1, 0x4f,
0x8d, 0x93, 0x4f, 0x00, 0xfd, 0x34, 0x18, 0xc2, 0xe4, 0xe3, 0xbd, 0xa8, 0x1a, 0x7c, 0xb9, 0xf7,
0x64, 0x8e, 0x5f, 0xed, 0xdf, 0xc6, 0x19, 0x5d, 0x59, 0xfa, 0x54, 0x4f, 0xff, 0x04, 0x00, 0x00,
0xff, 0xff, 0x00, 0xaf, 0x33, 0x33, 0xbe, 0x02, 0x00, 0x00,
var File_downloader_proto protoreflect.FileDescriptor
var file_downloader_proto_rawDesc = []byte{
0x0a, 0x10, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x0a, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x22, 0xe6,
0x02, 0x0a, 0x11, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x29, 0x2e, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x2e,
0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74,
0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70,
0x65, 0x65, 0x72, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x70,
0x65, 0x65, 0x72, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
0x48, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28,
0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x06, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a,
0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x87, 0x01,
0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a,
0x09, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x48, 0x41, 0x53, 0x48, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05,
0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x45, 0x57, 0x42, 0x4c,
0x4f, 0x43, 0x4b, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x48, 0x45,
0x49, 0x47, 0x48, 0x54, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54,
0x45, 0x52, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x45, 0x52,
0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x05, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b,
0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x06, 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x48,
0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x07, 0x22, 0xd4, 0x01, 0x0a, 0x12, 0x44, 0x6f, 0x77, 0x6e,
0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52,
0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x47, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61,
0x64, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70,
0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69,
0x67, 0x68, 0x74, 0x22, 0x39, 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53,
0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x41, 0x49, 0x4c,
0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x49, 0x4e, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x02, 0x32, 0x56,
0x0a, 0x0a, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x05,
0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1d, 0x2e, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64,
0x65, 0x72, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65,
0x72, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_downloader_proto_rawDescOnce sync.Once
file_downloader_proto_rawDescData = file_downloader_proto_rawDesc
)
func file_downloader_proto_rawDescGZIP() []byte {
file_downloader_proto_rawDescOnce.Do(func() {
file_downloader_proto_rawDescData = protoimpl.X.CompressGZIP(file_downloader_proto_rawDescData)
})
return file_downloader_proto_rawDescData
}
var file_downloader_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_downloader_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_downloader_proto_goTypes = []interface{}{
(DownloaderRequest_RequestType)(0), // 0: downloader.DownloaderRequest.RequestType
(DownloaderResponse_RegisterResponseType)(0), // 1: downloader.DownloaderResponse.RegisterResponseType
(*DownloaderRequest)(nil), // 2: downloader.DownloaderRequest
(*DownloaderResponse)(nil), // 3: downloader.DownloaderResponse
}
var file_downloader_proto_depIdxs = []int32{
0, // 0: downloader.DownloaderRequest.type:type_name -> downloader.DownloaderRequest.RequestType
1, // 1: downloader.DownloaderResponse.type:type_name -> downloader.DownloaderResponse.RegisterResponseType
2, // 2: downloader.Downloader.Query:input_type -> downloader.DownloaderRequest
3, // 3: downloader.Downloader.Query:output_type -> downloader.DownloaderResponse
3, // [3:4] is the sub-list for method output_type
2, // [2:3] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_downloader_proto_init() }
func file_downloader_proto_init() {
if File_downloader_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_downloader_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloaderRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_downloader_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloaderResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_downloader_proto_rawDesc,
NumEnums: 2,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_downloader_proto_goTypes,
DependencyIndexes: file_downloader_proto_depIdxs,
EnumInfos: file_downloader_proto_enumTypes,
MessageInfos: file_downloader_proto_msgTypes,
}.Build()
File_downloader_proto = out.File
file_downloader_proto_rawDesc = nil
file_downloader_proto_goTypes = nil
file_downloader_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
@ -326,7 +480,7 @@ type DownloaderServer interface {
type UnimplementedDownloaderServer struct {
}
func (*UnimplementedDownloaderServer) Query(ctx context.Context, req *DownloaderRequest) (*DownloaderResponse, error) {
func (*UnimplementedDownloaderServer) Query(context.Context, *DownloaderRequest) (*DownloaderResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Query not implemented")
}

@ -31,7 +31,7 @@ func TestPopulateMessageFields(t *testing.T) {
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
consensus.viewID = 2
consensus.SetCurViewID(2)
blockHash := [32]byte{}
consensus.blockHash = blockHash
@ -72,7 +72,7 @@ func TestSignAndMarshalConsensusMessage(t *testing.T) {
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
consensus.viewID = 2
consensus.SetCurViewID(2)
consensus.blockHash = [32]byte{}
msg := &msg_pb.Message{}
@ -105,8 +105,8 @@ func TestSetViewID(t *testing.T) {
}
height := uint64(1000)
consensus.SetViewID(height)
if consensus.viewID != height {
t.Errorf("Cannot set consensus ID. Got: %v, Expected: %v", consensus.viewID, height)
consensus.SetViewIDs(height)
if consensus.GetCurViewID() != height {
t.Errorf("Cannot set consensus ID. Got: %v, Expected: %v", consensus.GetCurViewID(), height)
}
}

@ -43,7 +43,7 @@ func TestConsensusInitialization(t *testing.T) {
// State / consensus.current
assert.Equal(t, state.mode, consensus.current.mode)
assert.Equal(t, state.viewID, consensus.current.viewID)
assert.Equal(t, state.GetViewChangingID(), consensus.current.GetViewChangingID())
// FBFT timeout
assert.IsType(t, make(map[TimeoutType]*utils.Timeout), consensus.consensusTimeout)
@ -58,7 +58,7 @@ func TestConsensusInitialization(t *testing.T) {
assert.Equal(t, multiBLSPrivateKey.GetPublicKeys(), consensus.GetPublicKeys())
// Misc
assert.Equal(t, uint64(0), consensus.viewID)
assert.Equal(t, uint64(0), consensus.GetViewChangingID())
assert.Equal(t, uint32(shard.BeaconChainShardID), consensus.ShardID)
assert.IsType(t, make(chan struct{}), consensus.syncReadyChan)

@ -355,7 +355,7 @@ func (consensus *Consensus) Start(
case <-toStart:
start = true
case <-ticker.C:
consensus.getLogger().Info().Msg("[ConsensusMainLoop] Ticker")
consensus.getLogger().Debug().Msg("[ConsensusMainLoop] Ticker")
if !start && isInitialLeader {
continue
}

@ -77,7 +77,7 @@ func TestConstructPreparedMessage(test *testing.T) {
leaderPriKey.Sign(message),
common.BytesToHash(consensus.blockHash[:]),
consensus.blockNum,
consensus.viewID,
consensus.GetCurViewID(),
)
if _, err := consensus.Decider.SubmitVote(
quorum.Prepare,
@ -85,7 +85,7 @@ func TestConstructPreparedMessage(test *testing.T) {
validatorPriKey.Sign(message),
common.BytesToHash(consensus.blockHash[:]),
consensus.blockNum,
consensus.viewID,
consensus.GetCurViewID(),
); err != nil {
test.Log(err)
}

@ -186,9 +186,6 @@ func (consensus *Consensus) startViewChange(viewID uint64) {
consensus.consensusTimeout[timeoutViewChange].SetDuration(duration)
consensus.consensusTimeout[timeoutViewChange].Start()
consensus.getLogger().Info().
Uint64("viewChangingID", consensus.GetViewChangingID()).
Msg("[startViewChange] start view change timer")
}
func (consensus *Consensus) onViewChange(msg *msg_pb.Message) {

@ -25,15 +25,11 @@ func TestBasicViewChanging(t *testing.T) {
assert.Equal(t, ViewChanging, consensus.current.Mode())
// Change ViewID
assert.Equal(t, state.viewID, consensus.current.viewID)
assert.Equal(t, state.ViewID(), consensus.current.ViewID())
assert.Equal(t, state.GetViewID(), consensus.GetViewID()) // Why are there two methods to retrieve the ViewID?
newViewID := consensus.current.ViewID() + 1
consensus.current.SetViewID(newViewID)
assert.Equal(t, newViewID, consensus.current.viewID)
assert.Equal(t, newViewID, consensus.current.ViewID())
assert.Equal(t, newViewID, consensus.GetViewID())
assert.Equal(t, state.GetViewChangingID(), consensus.current.GetViewChangingID())
newViewID := consensus.current.GetViewChangingID() + 1
consensus.SetViewIDs(newViewID)
assert.Equal(t, newViewID, consensus.current.GetViewChangingID())
}
func TestPhaseSwitching(t *testing.T) {

@ -19,7 +19,7 @@ require (
github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a // indirect
github.com/garslo/gogen v0.0.0-20170307003452-d6ebae628c7c // indirect
github.com/golang/mock v1.4.0
github.com/golang/protobuf v1.4.0
github.com/golang/protobuf v1.4.2
github.com/golangci/golangci-lint v1.22.2
github.com/gorilla/mux v1.7.4
github.com/gorilla/websocket v1.4.2 // indirect

@ -12,4 +12,4 @@ esac
sed -n 's/^ _ "\([^"]*\)"$/\1/p' "${progdir}/../tools/tools.go" | \
xargs "${progdir}/goget.sh"
"${progdir}/install_protoc.sh" -V 3.6.1
"${progdir}/install_protoc.sh" -V 3.12.3

@ -58,4 +58,5 @@ curl -s -S -L -o "${filename}" "${url}"
echo "Downloaded as ${filename}; unzipping into ${destdir}..."
sudo unzip -o -d "${destdir}" "${filename}"
echo "protoc v${version} has been installed in ${destdir}."
sudo chmod +x "${destdir}/bin/protoc"
exit 0

Loading…
Cancel
Save