diff --git a/.travis.yml b/.travis.yml index ad6682c5d..89acb7cbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,8 @@ matrix: env: - lint script: - - - go get github.com/alecthomas/gometalinter && gometalinter --install && gometalinter ./... - email: false + - go get github.com/alecthomas/gometalinter && gometalinter --install && gometalinter ./... + email: false after_success: - wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh - chmod +x send.sh diff --git a/beacon-chain/db/state_test.go b/beacon-chain/db/state_test.go index cc8260925..905fb34df 100644 --- a/beacon-chain/db/state_test.go +++ b/beacon-chain/db/state_test.go @@ -2,10 +2,11 @@ package db import ( "bytes" - "github.com/prysmaticlabs/prysm/shared/params" "testing" "time" + "github.com/prysmaticlabs/prysm/shared/params" + "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" "github.com/prysmaticlabs/prysm/beacon-chain/core/validators" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" diff --git a/beacon-chain/dbcleanup/service_test.go b/beacon-chain/dbcleanup/service_test.go index 970b57094..2df2d74cf 100644 --- a/beacon-chain/dbcleanup/service_test.go +++ b/beacon-chain/dbcleanup/service_test.go @@ -2,10 +2,11 @@ package dbcleanup import ( "context" - "github.com/prysmaticlabs/prysm/shared/params" "testing" "time" + "github.com/prysmaticlabs/prysm/shared/params" + "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" "github.com/prysmaticlabs/prysm/beacon-chain/core/validators" diff --git a/beacon-chain/sync/regular_sync_test.go b/beacon-chain/sync/regular_sync_test.go index f847a45ce..126c8aec0 100644 --- a/beacon-chain/sync/regular_sync_test.go +++ b/beacon-chain/sync/regular_sync_test.go @@ -2,13 +2,14 @@ package sync import ( "context" - "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" - "github.com/prysmaticlabs/prysm/beacon-chain/core/validators" "io/ioutil" "strconv" "testing" "time" + "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" + "github.com/prysmaticlabs/prysm/beacon-chain/core/validators" + "github.com/gogo/protobuf/proto" "github.com/prysmaticlabs/prysm/beacon-chain/db" "github.com/prysmaticlabs/prysm/beacon-chain/internal" diff --git a/shared/p2p/mock/broadcaster_mock.go b/shared/p2p/mock/broadcaster_mock.go index 2957105e0..929e5f0be 100644 --- a/shared/p2p/mock/broadcaster_mock.go +++ b/shared/p2p/mock/broadcaster_mock.go @@ -5,9 +5,10 @@ package mock_p2p import ( + reflect "reflect" + proto "github.com/gogo/protobuf/proto" gomock "github.com/golang/mock/gomock" - reflect "reflect" ) // MockBroadcaster is a mock of Broadcaster interface diff --git a/validator/client/validator_propose_test.go b/validator/client/validator_propose_test.go index d8bd5d306..4eaa3a242 100644 --- a/validator/client/validator_propose_test.go +++ b/validator/client/validator_propose_test.go @@ -204,13 +204,10 @@ func TestProposeBlock_ComputeStateFailure(t *testing.T) { gomock.Eq(&ptypes.Empty{}), ).Return(&pb.Eth1DataResponse{}, nil /*err*/) - var broadcastedBlock *pbp2p.BeaconBlock m.proposerClient.EXPECT().ProposeBlock( gomock.Any(), // ctx gomock.AssignableToTypeOf(&pbp2p.BeaconBlock{}), - ).Do(func(_ context.Context, blk *pbp2p.BeaconBlock) { - broadcastedBlock = blk - }).Return(&pb.ProposeResponse{}, nil /*error*/) + ).Return(&pb.ProposeResponse{}, nil /*error*/) m.proposerClient.EXPECT().ComputeStateRoot( gomock.Any(), // context diff --git a/validator/internal/attester_service_mock.go b/validator/internal/attester_service_mock.go index 167250b60..2c1a1ee9e 100644 --- a/validator/internal/attester_service_mock.go +++ b/validator/internal/attester_service_mock.go @@ -6,10 +6,11 @@ package internal import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" v1 "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1" grpc "google.golang.org/grpc" - reflect "reflect" ) // MockAttesterServiceClient is a mock of AttesterServiceClient interface diff --git a/validator/internal/beacon_service_mock.go b/validator/internal/beacon_service_mock.go index 73518e647..a15215c53 100644 --- a/validator/internal/beacon_service_mock.go +++ b/validator/internal/beacon_service_mock.go @@ -6,13 +6,14 @@ package internal import ( context "context" + reflect "reflect" + types "github.com/gogo/protobuf/types" gomock "github.com/golang/mock/gomock" 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 diff --git a/validator/internal/proposer_service_mock.go b/validator/internal/proposer_service_mock.go index a0607fcfd..90e8f77c2 100644 --- a/validator/internal/proposer_service_mock.go +++ b/validator/internal/proposer_service_mock.go @@ -6,11 +6,12 @@ package internal import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" v1 "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" v10 "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1" grpc "google.golang.org/grpc" - reflect "reflect" ) // MockProposerServiceClient is a mock of ProposerServiceClient interface diff --git a/validator/internal/validator_service_mock.go b/validator/internal/validator_service_mock.go index 3c5a841d5..70738fb2e 100644 --- a/validator/internal/validator_service_mock.go +++ b/validator/internal/validator_service_mock.go @@ -6,10 +6,11 @@ package internal import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" v1 "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1" grpc "google.golang.org/grpc" - reflect "reflect" ) // MockValidatorServiceClient is a mock of ValidatorServiceClient interface diff --git a/validator/node/BUILD.bazel b/validator/node/BUILD.bazel index a3909b2c5..630b9d139 100644 --- a/validator/node/BUILD.bazel +++ b/validator/node/BUILD.bazel @@ -9,24 +9,17 @@ go_test( go_library( name = "go_default_library", - srcs = [ - "node.go", - "p2p_config.go", - ], + srcs = ["node.go"], importpath = "github.com/prysmaticlabs/prysm/validator/node", visibility = ["//validator:__subpackages__"], deps = [ - "//proto/beacon/p2p/v1:go_default_library", "//shared:go_default_library", "//shared/cmd:go_default_library", "//shared/debug:go_default_library", - "//shared/p2p:go_default_library", - "//shared/p2p/adapter/tracer:go_default_library", "//shared/prometheus:go_default_library", "//shared/version:go_default_library", "//validator/client:go_default_library", "//validator/types: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", ], diff --git a/validator/node/p2p_config.go b/validator/node/p2p_config.go deleted file mode 100644 index a42613331..000000000 --- a/validator/node/p2p_config.go +++ /dev/null @@ -1,51 +0,0 @@ -package node - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - beaconpb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" - "github.com/prysmaticlabs/prysm/shared/cmd" - "github.com/prysmaticlabs/prysm/shared/p2p" - "github.com/prysmaticlabs/prysm/shared/p2p/adapter/tracer" - "github.com/urfave/cli" -) - -var topicMappings = map[fmt.Stringer]proto.Message{ - // Beacon chain topics - beaconpb.Topic_BEACON_BLOCK_ANNOUNCE: &beaconpb.BeaconBlockAnnounce{}, - beaconpb.Topic_BEACON_BLOCK_REQUEST: &beaconpb.BeaconBlockRequest{}, - beaconpb.Topic_BEACON_BLOCK_RESPONSE: &beaconpb.BeaconBlockResponse{}, - beaconpb.Topic_ATTESTATION_ANNOUNCE: &beaconpb.AttestationAnnounce{}, - beaconpb.Topic_ATTESTATION_REQUEST: &beaconpb.AttestationRequest{}, - beaconpb.Topic_ATTESTATION_RESPONSE: &beaconpb.AttestationResponse{}, - - // Shard chain topics -} - -func configureP2P(ctx *cli.Context) (*p2p.Server, error) { - s, err := p2p.NewServer(&p2p.ServerConfig{ - BootstrapNodeAddr: ctx.GlobalString(cmd.BootstrapNode.Name), - RelayNodeAddr: ctx.GlobalString(cmd.RelayNode.Name), - Port: ctx.GlobalInt(cmd.P2PPort.Name), - }) - if err != nil { - return nil, err - } - - traceAdapter, err := tracer.New("validator", - ctx.GlobalString(cmd.TracingEndpointFlag.Name), - ctx.GlobalFloat64(cmd.TraceSampleFractionFlag.Name), - ctx.GlobalBool(cmd.EnableTracingFlag.Name)) - if err != nil { - return nil, err - } - - // TODO(437): Define default adapters for logging, monitoring, etc. - adapters := []p2p.Adapter{traceAdapter} - for k, v := range topicMappings { - s.RegisterTopic(k.String(), v, adapters...) - } - - return s, nil -}