Use gogo protobuf as the protoc compiler (#1165)

* first commit, remote att types

* no more agg attestation proto

* regen mock

* only attestations

* proto

* att process

* fix att references

* more tests passing

* use att protos

* complete

* change visibility

* use gogoprotobu
This commit is contained in:
Preston Van Loon 2018-12-23 15:34:59 -05:00 committed by GitHub
parent b9a233da7d
commit 10f45744d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 12475 additions and 771 deletions

View File

@ -13,6 +13,20 @@ gazelle(
prefix = prefix,
)
# Protobuf compiler (non-gRPC)
alias(
name = "proto_compiler",
actual = "@io_bazel_rules_go//proto:gogofast_proto",
visibility = ["//proto:__subpackages__"],
)
# Protobuf compiler (gRPC)
alias(
name = "grpc_proto_compiler",
actual = "@io_bazel_rules_go//proto:gogofast_grpc",
visibility = ["//proto:__subpackages__"],
)
gometalinter(
name = "gometalinter",
config = "//:.gometalinter.json",

View File

@ -10,7 +10,7 @@ go_library(
"//proto/beacon/p2p/v1:go_default_library",
"//shared/event:go_default_library",
"//shared/hashutil:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)

View File

@ -4,7 +4,7 @@ package attestation
import (
"context"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
"github.com/prysmaticlabs/prysm/beacon-chain/db"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/event"

View File

@ -19,8 +19,8 @@ go_library(
"//shared/slices:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//core/types:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
],
)
@ -39,7 +39,7 @@ go_test(
"//shared/params:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//core/types:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)

View File

@ -4,7 +4,7 @@ import (
"fmt"
"time"
"github.com/golang/protobuf/ptypes"
ptypes "github.com/gogo/protobuf/types"
"github.com/prysmaticlabs/prysm/beacon-chain/utils"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/hashutil"

View File

@ -6,7 +6,7 @@ import (
"fmt"
"reflect"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
"github.com/prysmaticlabs/prysm/beacon-chain/core/types"
v "github.com/prysmaticlabs/prysm/beacon-chain/core/validators"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"

View File

@ -5,7 +5,7 @@ import (
"reflect"
"testing"
"github.com/golang/protobuf/ptypes"
ptypes "github.com/gogo/protobuf/types"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/params"
)
@ -48,8 +48,8 @@ func TestGenesisBlock(t *testing.T) {
gt1 := b1.GetTimestamp()
gt2 := b2.GetTimestamp()
t1, _ := ptypes.Timestamp(gt1)
t2, _ := ptypes.Timestamp(gt2)
t1, _ := ptypes.TimestampFromProto(gt1)
t2, _ := ptypes.TimestampFromProto(gt2)
if t1 != t2 {
t.Error("different timestamp")
}

View File

@ -23,7 +23,7 @@ go_library(
"//shared/bytes:go_default_library",
"@com_github_boltdb_bolt//:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_gogo_protobuf//types:go_default_library",
],
)

View File

@ -7,7 +7,7 @@ import (
"github.com/boltdb/bolt"
"github.com/gogo/protobuf/proto"
"github.com/golang/protobuf/ptypes"
ptypes "github.com/gogo/protobuf/types"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/beacon-chain/core/types"
@ -184,7 +184,7 @@ func (db *BeaconDB) GetGenesisTime() (time.Time, error) {
return time.Time{}, fmt.Errorf("genesis block not found: %v", err)
}
genesisTime, err := ptypes.Timestamp(genesis.GetTimestamp())
genesisTime, err := ptypes.TimestampFromProto(genesis.GetTimestamp())
if err != nil {
return time.Time{}, fmt.Errorf("could not get genesis timestamp: %v", err)
}

View File

@ -30,7 +30,7 @@ go_library(
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//ethclient:go_default_library",
"@com_github_ethereum_go_ethereum//rpc:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_urfave_cli//:go_default_library",
],

View File

@ -1,7 +1,7 @@
package node
import (
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/p2p"

View File

@ -17,8 +17,8 @@ go_library(
"//shared/params:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//credentials:go_default_library",
],
@ -37,10 +37,9 @@ go_test(
"//shared/event:go_default_library",
"//shared/testutil:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
],
)

View File

@ -11,7 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/gogo/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty"
ptypes "github.com/gogo/protobuf/types"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/beacon-chain/core/types"
v "github.com/prysmaticlabs/prysm/beacon-chain/core/validators"
@ -150,7 +150,7 @@ func (s *Service) Stop() error {
// CanonicalHead of the current beacon chain. This method is requested on-demand
// by a validator when it is their time to propose or attest.
func (s *Service) CanonicalHead(ctx context.Context, req *empty.Empty) (*pbp2p.BeaconBlock, error) {
func (s *Service) CanonicalHead(ctx context.Context, req *ptypes.Empty) (*pbp2p.BeaconBlock, error) {
block, err := s.beaconDB.GetChainHead()
if err != nil {
return nil, fmt.Errorf("could not get canonical head block: %v", err)
@ -264,7 +264,7 @@ func (s *Service) AttestHead(ctx context.Context, req *pb.AttestRequest) (*pb.At
}
// LatestAttestation streams the latest processed attestations to the rpc clients.
func (s *Service) LatestAttestation(req *empty.Empty, stream pb.BeaconService_LatestAttestationServer) error {
func (s *Service) LatestAttestation(req *ptypes.Empty, stream pb.BeaconService_LatestAttestationServer) error {
sub := s.attestationService.IncomingAttestationFeed().Subscribe(s.incomingAttestation)
defer sub.Unsubscribe()
for {

View File

@ -8,9 +8,8 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
ptypes "github.com/gogo/protobuf/types"
"github.com/golang/mock/gomock"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/empty"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/beacon-chain/core/types"
"github.com/prysmaticlabs/prysm/beacon-chain/internal"
@ -229,7 +228,7 @@ func TestLatestAttestationContextClosed(t *testing.T) {
defer ctrl.Finish()
mockStream := internal.NewMockBeaconService_LatestAttestationServer(ctrl)
go func(tt *testing.T) {
if err := rpcService.LatestAttestation(&empty.Empty{}, mockStream); err != nil {
if err := rpcService.LatestAttestation(&ptypes.Empty{}, mockStream); err != nil {
tt.Errorf("Could not call RPC method: %v", err)
}
<-exitRoutine
@ -256,7 +255,7 @@ func TestLatestAttestationFaulty(t *testing.T) {
mockStream.EXPECT().Send(attestation).Return(errors.New("something wrong"))
// Tests a faulty stream.
go func(tt *testing.T) {
if err := rpcService.LatestAttestation(&empty.Empty{}, mockStream); err.Error() != "something wrong" {
if err := rpcService.LatestAttestation(&ptypes.Empty{}, mockStream); err.Error() != "something wrong" {
tt.Errorf("Faulty stream should throw correct error, wanted 'something wrong', got %v", err)
}
<-exitRoutine
@ -284,7 +283,7 @@ func TestLatestAttestation(t *testing.T) {
mockStream.EXPECT().Send(attestation).Return(nil)
// Tests a good stream.
go func(tt *testing.T) {
if err := rpcService.LatestAttestation(&empty.Empty{}, mockStream); err != nil {
if err := rpcService.LatestAttestation(&ptypes.Empty{}, mockStream); err != nil {
tt.Errorf("Could not call RPC method: %v", err)
}
<-exitRoutine

View File

@ -16,8 +16,8 @@ go_library(
"//shared/params:go_default_library",
"//shared/slotticker:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)
@ -34,7 +34,7 @@ go_test(
"//shared/p2p:go_default_library",
"//shared/testutil:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
],

View File

@ -7,8 +7,8 @@ import (
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/gogo/protobuf/proto"
ptypes "github.com/gogo/protobuf/types"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
v "github.com/prysmaticlabs/prysm/beacon-chain/core/validators"
"github.com/prysmaticlabs/prysm/beacon-chain/db"

View File

@ -6,7 +6,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
"github.com/prysmaticlabs/prysm/beacon-chain/db"
"github.com/prysmaticlabs/prysm/beacon-chain/internal"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"

View File

@ -18,7 +18,7 @@ go_library(
"//proto/beacon/p2p/v1:go_default_library",
"//shared/event:go_default_library",
"//shared/p2p:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_opencensus_go//trace:go_default_library",
],
@ -40,7 +40,7 @@ go_test(
"//shared/hashutil:go_default_library",
"//shared/p2p:go_default_library",
"//shared/testutil:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
],

View File

@ -13,7 +13,7 @@ go_library(
"//shared/event:go_default_library",
"//shared/p2p:go_default_library",
"//shared/params:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)
@ -30,7 +30,7 @@ go_test(
"//shared/event:go_default_library",
"//shared/p2p:go_default_library",
"//shared/testutil:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
],
)

View File

@ -16,7 +16,7 @@ import (
"fmt"
"time"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/beacon-chain/core/types"
"github.com/prysmaticlabs/prysm/beacon-chain/db"

View File

@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/beacon-chain/core/types"
"github.com/prysmaticlabs/prysm/beacon-chain/internal"

View File

@ -5,7 +5,7 @@ import (
"context"
"fmt"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
att "github.com/prysmaticlabs/prysm/beacon-chain/core/attestations"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
v "github.com/prysmaticlabs/prysm/beacon-chain/core/validators"

View File

@ -5,7 +5,7 @@ import (
"io/ioutil"
"testing"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/beacon-chain/db"
"github.com/prysmaticlabs/prysm/beacon-chain/internal"

View File

@ -16,7 +16,7 @@ go_library(
"//shared/hashutil:go_default_library",
"//shared/params:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_golang_protobuf//jsonpb:go_default_library_gen",
"@com_github_gogo_protobuf//jsonpb:go_default_library",
"@com_github_urfave_cli//:go_default_library",
],
)

View File

@ -4,7 +4,7 @@ import (
"fmt"
"os"
"github.com/golang/protobuf/jsonpb"
"github.com/gogo/protobuf/jsonpb"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
)

View File

@ -10,6 +10,7 @@ go_proto_library(
deps = [
"//proto/common:common_go_proto",
],
compiler = "//:proto_compiler",
)
go_library(

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
go_proto_library(
name = "v1_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1",
proto = ":v1_proto",
visibility = ["//visibility:public"],
@ -12,6 +11,7 @@ go_proto_library(
"//proto/beacon/p2p/v1:go_default_library",
"//proto/sharding/p2p/v1:go_default_library",
],
compiler = "//:grpc_proto_compiler",
)
go_library(

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ go_proto_library(
importpath = "github.com/prysmaticlabs/prysm/proto/common",
proto = ":common_proto",
visibility = ["//visibility:public"],
compiler = "//:proto_compiler",
)
go_library(

View File

@ -1,12 +1,14 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: proto/common/messages.proto
package common
import proto "github.com/golang/protobuf/proto"
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
@ -16,10 +18,10 @@ var _ = math.Inf
// 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.ProtoPackageIsVersion2 // please upgrade the proto package
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type Uint32List struct {
List []uint32 `protobuf:"varint,1,rep,packed,name=list,proto3" json:"list,omitempty"`
List []uint32 `protobuf:"varint,1,rep,packed,name=list" json:"list,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -29,19 +31,28 @@ func (m *Uint32List) Reset() { *m = Uint32List{} }
func (m *Uint32List) String() string { return proto.CompactTextString(m) }
func (*Uint32List) ProtoMessage() {}
func (*Uint32List) Descriptor() ([]byte, []int) {
return fileDescriptor_messages_b5bf9291ad2f880e, []int{0}
return fileDescriptor_messages_ae0f39d901774850, []int{0}
}
func (m *Uint32List) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Uint32List.Unmarshal(m, b)
return m.Unmarshal(b)
}
func (m *Uint32List) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Uint32List.Marshal(b, m, deterministic)
if deterministic {
return xxx_messageInfo_Uint32List.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *Uint32List) XXX_Merge(src proto.Message) {
xxx_messageInfo_Uint32List.Merge(dst, src)
}
func (m *Uint32List) XXX_Size() int {
return xxx_messageInfo_Uint32List.Size(m)
return m.Size()
}
func (m *Uint32List) XXX_DiscardUnknown() {
xxx_messageInfo_Uint32List.DiscardUnknown(m)
@ -59,18 +70,312 @@ func (m *Uint32List) GetList() []uint32 {
func init() {
proto.RegisterType((*Uint32List)(nil), "ethereum.common.Uint32List")
}
func init() {
proto.RegisterFile("proto/common/messages.proto", fileDescriptor_messages_b5bf9291ad2f880e)
func (m *Uint32List) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
var fileDescriptor_messages_b5bf9291ad2f880e = []byte{
// 99 bytes of a gzipped FileDescriptorProto
func (m *Uint32List) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.List) > 0 {
dAtA2 := make([]byte, len(m.List)*10)
var j1 int
for _, num := range m.List {
for num >= 1<<7 {
dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j1++
}
dAtA2[j1] = uint8(num)
j1++
}
dAtA[i] = 0xa
i++
i = encodeVarintMessages(dAtA, i, uint64(j1))
i += copy(dAtA[i:], dAtA2[:j1])
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func encodeVarintMessages(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *Uint32List) Size() (n int) {
var l int
_ = l
if len(m.List) > 0 {
l = 0
for _, e := range m.List {
l += sovMessages(uint64(e))
}
n += 1 + sovMessages(uint64(l)) + l
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovMessages(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozMessages(x uint64) (n int) {
return sovMessages(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Uint32List) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Uint32List: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Uint32List: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType == 0 {
var v uint32
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.List = append(m.List, v)
} else if wireType == 2 {
var packedLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
packedLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if packedLen < 0 {
return ErrInvalidLengthMessages
}
postIndex := iNdEx + packedLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
for iNdEx < postIndex {
var v uint32
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.List = append(m.List, v)
}
} else {
return fmt.Errorf("proto: wrong wireType = %d for field List", wireType)
}
default:
iNdEx = preIndex
skippy, err := skipMessages(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthMessages
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipMessages(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMessages
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMessages
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMessages
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthMessages
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMessages
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipMessages(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthMessages = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowMessages = fmt.Errorf("proto: integer overflow")
)
func init() {
proto.RegisterFile("proto/common/messages.proto", fileDescriptor_messages_ae0f39d901774850)
}
var fileDescriptor_messages_ae0f39d901774850 = []byte{
// 113 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x28, 0xca, 0x2f,
0xc9, 0xd7, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0xd3, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f,
0x2d, 0xd6, 0x03, 0x8b, 0x0a, 0xf1, 0xa7, 0x96, 0x64, 0xa4, 0x16, 0xa5, 0x96, 0xe6, 0xea, 0x41,
0xe4, 0x95, 0x14, 0xb8, 0xb8, 0x42, 0x33, 0xf3, 0x4a, 0x8c, 0x8d, 0x7c, 0x32, 0x8b, 0x4b, 0x84,
0x84, 0xb8, 0x58, 0x72, 0x32, 0x8b, 0x4b, 0x24, 0x18, 0x15, 0x98, 0x35, 0x78, 0x83, 0xc0, 0xec,
0x24, 0x36, 0xb0, 0x4e, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x78, 0x72, 0x32, 0x68, 0x58,
0x00, 0x00, 0x00,
0x84, 0xb8, 0x58, 0x72, 0x32, 0x8b, 0x4b, 0x24, 0x18, 0x15, 0x98, 0x35, 0x78, 0x83, 0xc0, 0x6c,
0x27, 0x9e, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x31, 0x89,
0x0d, 0x6c, 0x8e, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x6f, 0xc7, 0x49, 0x9d, 0x66, 0x00, 0x00,
0x00,
}

View File

@ -8,6 +8,7 @@ go_proto_library(
proto = ":v1_proto",
visibility = ["//visibility:public"],
deps = ["//proto/beacon/p2p/v1:go_default_library"],
compiler = "//:proto_compiler",
)
go_library(

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,7 @@ proto_library(
go_proto_library(
name = "ethereum_testing_go_proto",
compiler = "//:proto_compiler",
importpath = "github.com/prysmaticlabs/prysm/proto/testing",
proto = ":ethereum_testing_proto",
visibility = ["//visibility:public"],

View File

@ -1,12 +1,14 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: proto/testing/test.proto
package testing
import proto "github.com/golang/protobuf/proto"
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
@ -16,10 +18,10 @@ var _ = math.Inf
// 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.ProtoPackageIsVersion2 // please upgrade the proto package
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type TestMessage struct {
Foo string `protobuf:"bytes,1,opt,name=foo" json:"foo,omitempty"`
Foo string `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -29,19 +31,28 @@ func (m *TestMessage) Reset() { *m = TestMessage{} }
func (m *TestMessage) String() string { return proto.CompactTextString(m) }
func (*TestMessage) ProtoMessage() {}
func (*TestMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_test_efe8e22469748e36, []int{0}
return fileDescriptor_test_49400e164d60488b, []int{0}
}
func (m *TestMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TestMessage.Unmarshal(m, b)
return m.Unmarshal(b)
}
func (m *TestMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TestMessage.Marshal(b, m, deterministic)
if deterministic {
return xxx_messageInfo_TestMessage.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *TestMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_TestMessage.Merge(dst, src)
}
func (m *TestMessage) XXX_Size() int {
return xxx_messageInfo_TestMessage.Size(m)
return m.Size()
}
func (m *TestMessage) XXX_DiscardUnknown() {
xxx_messageInfo_TestMessage.DiscardUnknown(m)
@ -57,8 +68,8 @@ func (m *TestMessage) GetFoo() string {
}
type Puzzle struct {
Challenge string `protobuf:"bytes,1,opt,name=challenge" json:"challenge,omitempty"`
Answer string `protobuf:"bytes,2,opt,name=answer" json:"answer,omitempty"`
Challenge string `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"`
Answer string `protobuf:"bytes,2,opt,name=answer,proto3" json:"answer,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -68,19 +79,28 @@ func (m *Puzzle) Reset() { *m = Puzzle{} }
func (m *Puzzle) String() string { return proto.CompactTextString(m) }
func (*Puzzle) ProtoMessage() {}
func (*Puzzle) Descriptor() ([]byte, []int) {
return fileDescriptor_test_efe8e22469748e36, []int{1}
return fileDescriptor_test_49400e164d60488b, []int{1}
}
func (m *Puzzle) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Puzzle.Unmarshal(m, b)
return m.Unmarshal(b)
}
func (m *Puzzle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Puzzle.Marshal(b, m, deterministic)
if deterministic {
return xxx_messageInfo_Puzzle.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *Puzzle) XXX_Merge(src proto.Message) {
xxx_messageInfo_Puzzle.Merge(dst, src)
}
func (m *Puzzle) XXX_Size() int {
return xxx_messageInfo_Puzzle.Size(m)
return m.Size()
}
func (m *Puzzle) XXX_DiscardUnknown() {
xxx_messageInfo_Puzzle.DiscardUnknown(m)
@ -106,11 +126,416 @@ func init() {
proto.RegisterType((*TestMessage)(nil), "ethereum.testing.TestMessage")
proto.RegisterType((*Puzzle)(nil), "ethereum.testing.Puzzle")
}
func (m *TestMessage) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func init() { proto.RegisterFile("proto/testing/test.proto", fileDescriptor_test_efe8e22469748e36) }
func (m *TestMessage) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Foo) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintTest(dAtA, i, uint64(len(m.Foo)))
i += copy(dAtA[i:], m.Foo)
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
var fileDescriptor_test_efe8e22469748e36 = []byte{
// 135 bytes of a gzipped FileDescriptorProto
func (m *Puzzle) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Puzzle) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Challenge) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintTest(dAtA, i, uint64(len(m.Challenge)))
i += copy(dAtA[i:], m.Challenge)
}
if len(m.Answer) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintTest(dAtA, i, uint64(len(m.Answer)))
i += copy(dAtA[i:], m.Answer)
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func encodeVarintTest(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *TestMessage) Size() (n int) {
var l int
_ = l
l = len(m.Foo)
if l > 0 {
n += 1 + l + sovTest(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *Puzzle) Size() (n int) {
var l int
_ = l
l = len(m.Challenge)
if l > 0 {
n += 1 + l + sovTest(uint64(l))
}
l = len(m.Answer)
if l > 0 {
n += 1 + l + sovTest(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovTest(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozTest(x uint64) (n int) {
return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *TestMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: TestMessage: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: TestMessage: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Foo", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTest
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Foo = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTest(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTest
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Puzzle) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Puzzle: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Puzzle: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Challenge", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTest
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Challenge = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Answer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTest
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Answer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTest(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTest
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTest(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTest
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTest
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTest
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthTest
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTest
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipTest(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTest = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("proto/testing/test.proto", fileDescriptor_test_49400e164d60488b) }
var fileDescriptor_test_49400e164d60488b = []byte{
// 150 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x28, 0xca, 0x2f,
0xc9, 0xd7, 0x2f, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 0x4b, 0x07, 0xd3, 0x7a, 0x60, 0x21, 0x21, 0x81,
0xd4, 0x92, 0x8c, 0xd4, 0xa2, 0xd4, 0xd2, 0x5c, 0x3d, 0xa8, 0xa4, 0x92, 0x3c, 0x17, 0x77, 0x48,
@ -118,6 +543,7 @@ var fileDescriptor_test_efe8e22469748e36 = []byte{
0xbe, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x88, 0xa9, 0x64, 0xc7, 0xc5, 0x16, 0x50, 0x5a,
0x55, 0x95, 0x93, 0x2a, 0x24, 0xc3, 0xc5, 0x99, 0x9c, 0x91, 0x98, 0x93, 0x93, 0x9a, 0x97, 0x9e,
0x0a, 0x55, 0x81, 0x10, 0x10, 0x12, 0xe3, 0x62, 0x4b, 0xcc, 0x2b, 0x2e, 0x4f, 0x2d, 0x92, 0x60,
0x02, 0x4b, 0x41, 0x79, 0x49, 0x6c, 0x60, 0x9b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7f,
0xb3, 0xa3, 0x6b, 0x95, 0x00, 0x00, 0x00,
0x02, 0x4b, 0x41, 0x79, 0x4e, 0x3c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0,
0x91, 0x1c, 0x63, 0x12, 0x1b, 0xd8, 0x1d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xa8,
0x6d, 0x56, 0xa3, 0x00, 0x00, 0x00,
}

View File

@ -19,7 +19,7 @@ go_library(
deps = [
"//shared/event:go_default_library",
"//shared/iputils:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_ipfs_go_datastore//:go_default_library",
"@com_github_ipfs_go_datastore//sync:go_default_library",
"@com_github_ipfs_go_ipfs_addr//:go_default_library",
@ -55,8 +55,8 @@ go_test(
"//proto/sharding/p2p/v1:go_default_library",
"//proto/testing:go_default_library",
"//shared/p2p/mock:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_ipfs_go_log//:go_default_library",
"@com_github_libp2p_go_libp2p_blankhost//:go_default_library",
"@com_github_libp2p_go_libp2p_pubsub//:go_default_library",

View File

@ -7,7 +7,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//shared/p2p:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
],

View File

@ -5,7 +5,7 @@ import (
"fmt"
"time"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prysmaticlabs/prysm/shared/p2p"

View File

@ -1,7 +1,7 @@
package p2p
import (
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
"github.com/prysmaticlabs/prysm/shared/event"
)

View File

@ -5,7 +5,7 @@ import (
"sync"
"testing"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
testpb "github.com/prysmaticlabs/prysm/proto/testing"
)

View File

@ -4,7 +4,7 @@ import (
"context"
"reflect"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
)
// Message represents a message received from an external peer.

View File

@ -5,7 +5,7 @@ import (
"reflect"
"testing"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
testpb "github.com/prysmaticlabs/prysm/proto/testing"
)

View File

@ -3,7 +3,7 @@ package p2p_test
import (
"fmt"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
"github.com/prysmaticlabs/prysm/shared/p2p"
)

View File

@ -7,7 +7,7 @@ import (
"reflect"
"sync"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
libp2p "github.com/libp2p/go-libp2p"

View File

@ -10,7 +10,7 @@ import (
"time"
"github.com/golang/mock/gomock"
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
ipfslog "github.com/ipfs/go-log"
bhost "github.com/libp2p/go-libp2p-blankhost"
pubsub "github.com/libp2p/go-libp2p-pubsub"

View File

@ -88,6 +88,10 @@ func (a *Attester) run(attester pb.AttesterServiceClient, validator pb.Validator
case latestBeaconBlock := <-a.assignmentChan:
log.Info("Performing attester responsibility")
if latestBeaconBlock == nil {
log.Errorf("could not marshal nil latest beacon block")
continue
}
data, err := proto.Marshal(latestBeaconBlock)
if err != nil {
log.Errorf("could not marshal latest beacon block: %v", err)

View File

@ -132,7 +132,7 @@ func TestAttesterMarshalError(t *testing.T) {
att.cancel()
exitRoutine <- true
testutil.AssertLogsContain(t, hook, "could not marshal latest beacon block")
testutil.AssertLogsContain(t, hook, "could not marshal nil latest beacon block")
testutil.AssertLogsContain(t, hook, "Attester context closed")
}

View File

@ -10,9 +10,8 @@ go_library(
"//shared/event:go_default_library",
"//shared/params:go_default_library",
"//shared/slotticker:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
],
)
@ -25,10 +24,9 @@ go_test(
"//proto/beacon/rpc/v1:go_default_library",
"//shared/testutil:go_default_library",
"//validator/internal:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
],
)

View File

@ -7,8 +7,7 @@ import (
"io"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/empty"
ptypes "github.com/gogo/protobuf/types"
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
"github.com/prysmaticlabs/prysm/shared/event"
"github.com/prysmaticlabs/prysm/shared/params"
@ -120,11 +119,10 @@ func (s *Service) fetchCurrentAssignmentsAndGenesisTime(client pb.BeaconServiceC
// Determine what slot the beacon node is in by checking the number of seconds
// since the genesis block.
genesisTimestamp, err := ptypes.Timestamp(res.GetGenesisTimestamp())
genesisTimestamp, err := ptypes.TimestampFromProto(res.GetGenesisTimestamp())
if err != nil {
return fmt.Errorf("could not compute genesis timestamp: %v", err)
}
s.genesisTimestamp = genesisTimestamp
startSlot := s.startSlot()
@ -185,7 +183,7 @@ func (s *Service) waitForAssignment(ticker <-chan uint64, client pb.BeaconServic
continue
}
block, err := client.CanonicalHead(s.ctx, &empty.Empty{})
block, err := client.CanonicalHead(s.ctx, &ptypes.Empty{})
if err != nil {
log.Errorf("Could not fetch canonical head via gRPC from beacon node: %v", err)
continue
@ -207,7 +205,7 @@ func (s *Service) waitForAssignment(ticker <-chan uint64, client pb.BeaconServic
// listenForProcessedAttestations receives processed attestations from the
// the beacon node's RPC server via gRPC streams.
func (s *Service) listenForProcessedAttestations(client pb.BeaconServiceClient) {
stream, err := client.LatestAttestation(s.ctx, &empty.Empty{})
stream, err := client.LatestAttestation(s.ctx, &ptypes.Empty{})
if err != nil {
log.Errorf("Could not setup beacon chain attestation streaming client: %v", err)
return

View File

@ -8,9 +8,8 @@ import (
"testing"
"time"
ptypes "github.com/gogo/protobuf/types"
"github.com/golang/mock/gomock"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/empty"
pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
"github.com/prysmaticlabs/prysm/shared/testutil"
@ -36,7 +35,7 @@ func (fc *mockClient) BeaconServiceClient() pb.BeaconServiceClient {
mockServiceClient.EXPECT().LatestAttestation(
gomock.Any(),
&empty.Empty{},
&ptypes.Empty{},
).Return(attesterStream, nil)
return mockServiceClient
@ -68,7 +67,7 @@ func (fc *mockLifecycleClient) BeaconServiceClient() pb.BeaconServiceClient {
attesterStream := internal.NewMockBeaconService_LatestAttestationClient(fc.ctrl)
mockServiceClient.EXPECT().LatestAttestation(
gomock.Any(),
&empty.Empty{},
&ptypes.Empty{},
).Return(attesterStream, nil)
attesterStream.EXPECT().Recv().Return(&pbp2p.Attestation{}, io.EOF)

View File

@ -14,8 +14,8 @@ go_library(
deps = [
"//proto/beacon/p2p/v1:go_default_library",
"//proto/beacon/rpc/v1:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//metadata:go_default_library",
],

View File

@ -1,19 +1,18 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1 (interfaces: BeaconServiceClient,BeaconService_LatestAttestationClient,BeaconService_ValidatorAssignmentsClient)
// Package mock_v1 is a generated GoMock package.
// Package internal is a generated GoMock package.
package internal
import (
context "context"
reflect "reflect"
types "github.com/gogo/protobuf/types"
gomock "github.com/golang/mock/gomock"
empty "github.com/golang/protobuf/ptypes/empty"
v1 "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
v10 "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
grpc "google.golang.org/grpc"
metadata "google.golang.org/grpc/metadata"
reflect "reflect"
)
// MockBeaconServiceClient is a mock of BeaconServiceClient interface
@ -40,7 +39,7 @@ func (m *MockBeaconServiceClient) EXPECT() *MockBeaconServiceClientMockRecorder
}
// CanonicalHead mocks base method
func (m *MockBeaconServiceClient) CanonicalHead(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (*v1.BeaconBlock, error) {
func (m *MockBeaconServiceClient) CanonicalHead(arg0 context.Context, arg1 *types.Empty, arg2 ...grpc.CallOption) (*v1.BeaconBlock, error) {
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
@ -63,7 +62,6 @@ func (m *MockBeaconServiceClient) CurrentAssignmentsAndGenesisTime(arg0 context.
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "CurrentAssignmentsAndGenesisTime", varargs...)
ret0, _ := ret[0].(*v10.CurrentAssignmentsResponse)
ret1, _ := ret[1].(error)
@ -77,7 +75,7 @@ func (mr *MockBeaconServiceClientMockRecorder) CurrentAssignmentsAndGenesisTime(
}
// LatestAttestation mocks base method
func (m *MockBeaconServiceClient) LatestAttestation(arg0 context.Context, arg1 *empty.Empty, arg2 ...grpc.CallOption) (v10.BeaconService_LatestAttestationClient, error) {
func (m *MockBeaconServiceClient) LatestAttestation(arg0 context.Context, arg1 *types.Empty, arg2 ...grpc.CallOption) (v10.BeaconService_LatestAttestationClient, error) {
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)

View File

@ -30,7 +30,7 @@ go_library(
"//validator/rpcclient:go_default_library",
"//validator/txpool:go_default_library",
"//validator/types:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_urfave_cli//:go_default_library",
],

View File

@ -1,7 +1,7 @@
package node
import (
"github.com/golang/protobuf/proto"
"github.com/gogo/protobuf/proto"
pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/p2p"

View File

@ -10,8 +10,8 @@ go_library(
"//proto/beacon/rpc/v1:go_default_library",
"//shared/event:go_default_library",
"//shared/hashutil:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)

View File

@ -7,8 +7,8 @@ import (
"context"
"sync"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/gogo/protobuf/proto"
ptypes "github.com/gogo/protobuf/types"
pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
"github.com/prysmaticlabs/prysm/shared/event"
@ -156,6 +156,10 @@ func (p *Proposer) run(done <-chan struct{}, client pb.ProposerServiceClient) {
// Extract the hash of the latest beacon block to use as parent hash in
// the proposal.
if latestBeaconBlock == nil {
log.Errorf("Could not marshal nil latest beacon block")
continue
}
data, err := proto.Marshal(latestBeaconBlock)
if err != nil {
log.Errorf("Could not marshal latest beacon block: %v", err)

View File

@ -272,7 +272,7 @@ func TestProposerServiceErrors(t *testing.T) {
exitRoutine <- true
testutil.AssertLogsContain(t, hook, "Performing proposer responsibility")
testutil.AssertLogsContain(t, hook, "Could not marshal latest beacon block")
testutil.AssertLogsContain(t, hook, "Could not marshal nil latest beacon block")
testutil.AssertLogsContain(t, hook, "Proposer context closed")
testutil.AssertLogsContain(t, hook, "Could not propose block: bad block proposed")
}