mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Move Validator Accounts Protos Into Proper Place (#9416)
* move into proper namespace * package naming * add strict deps * regen protos * add web api * regen * builds * rename * build
This commit is contained in:
@@ -17,6 +17,7 @@ go_library(
|
||||
visibility = ["//validator:__subpackages__"],
|
||||
deps = [
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//proto/prysm/v1alpha1/validator-client:go_default_library",
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/cmd:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
@@ -79,6 +80,7 @@ go_test(
|
||||
deps = [
|
||||
"//cmd/validator/flags:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//proto/prysm/v1alpha1/validator-client:go_default_library",
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/cmd"
|
||||
"github.com/prysmaticlabs/prysm/shared/pagination"
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/cmd/validator/flags"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/mock"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/golang-jwt/jwt"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/promptutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/timeutils"
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/golang-jwt/jwt"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/grpcutils"
|
||||
"github.com/prysmaticlabs/prysm/validator/client"
|
||||
"google.golang.org/grpc"
|
||||
@@ -55,10 +56,10 @@ func (s *Server) registerBeaconClient() error {
|
||||
// GetBeaconStatus retrieves information about the beacon node gRPC connection
|
||||
// and certain chain metadata, such as the genesis time, the chain head, and the
|
||||
// deposit contract address.
|
||||
func (s *Server) GetBeaconStatus(ctx context.Context, _ *empty.Empty) (*pb.BeaconStatusResponse, error) {
|
||||
func (s *Server) GetBeaconStatus(ctx context.Context, _ *empty.Empty) (*validatorpb.BeaconStatusResponse, error) {
|
||||
syncStatus, err := s.beaconNodeClient.GetSyncStatus(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return &pb.BeaconStatusResponse{
|
||||
return &validatorpb.BeaconStatusResponse{
|
||||
BeaconNodeEndpoint: s.nodeGatewayEndpoint,
|
||||
Connected: false,
|
||||
Syncing: false,
|
||||
@@ -74,7 +75,7 @@ func (s *Server) GetBeaconStatus(ctx context.Context, _ *empty.Empty) (*pb.Beaco
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pb.BeaconStatusResponse{
|
||||
return &validatorpb.BeaconStatusResponse{
|
||||
BeaconNodeEndpoint: s.beaconClientEndpoint,
|
||||
Connected: true,
|
||||
Syncing: syncStatus.Syncing,
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/mock"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/version"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@@ -14,10 +15,10 @@ import (
|
||||
|
||||
// GetBeaconNodeConnection retrieves the current beacon node connection
|
||||
// information, as well as its sync status.
|
||||
func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *emptypb.Empty) (*pb.NodeConnectionResponse, error) {
|
||||
func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *emptypb.Empty) (*validatorpb.NodeConnectionResponse, error) {
|
||||
syncStatus, err := s.syncChecker.Syncing(ctx)
|
||||
if err != nil || s.validatorService.Status() != nil {
|
||||
return &pb.NodeConnectionResponse{
|
||||
return &validatorpb.NodeConnectionResponse{
|
||||
GenesisTime: 0,
|
||||
BeaconNodeEndpoint: s.nodeGatewayEndpoint,
|
||||
Connected: false,
|
||||
@@ -28,7 +29,7 @@ func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *emptypb.Empty)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pb.NodeConnectionResponse{
|
||||
return &validatorpb.NodeConnectionResponse{
|
||||
GenesisTime: uint64(time.Unix(genesis.GenesisTime.Seconds, 0).Unix()),
|
||||
DepositContractAddress: genesis.DepositContractAddress,
|
||||
BeaconNodeEndpoint: s.nodeGatewayEndpoint,
|
||||
@@ -38,25 +39,25 @@ func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *emptypb.Empty)
|
||||
}
|
||||
|
||||
// GetLogsEndpoints for the beacon and validator client.
|
||||
func (s *Server) GetLogsEndpoints(ctx context.Context, _ *emptypb.Empty) (*pb.LogsEndpointResponse, error) {
|
||||
func (s *Server) GetLogsEndpoints(ctx context.Context, _ *emptypb.Empty) (*validatorpb.LogsEndpointResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "unimplemented")
|
||||
}
|
||||
|
||||
// GetVersion --
|
||||
func (s *Server) GetVersion(ctx context.Context, _ *emptypb.Empty) (*pb.VersionResponse, error) {
|
||||
func (s *Server) GetVersion(ctx context.Context, _ *emptypb.Empty) (*validatorpb.VersionResponse, error) {
|
||||
beacon, err := s.beaconNodeClient.GetVersion(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.VersionResponse{
|
||||
return &validatorpb.VersionResponse{
|
||||
Beacon: beacon.Version,
|
||||
Validator: version.Version(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// StreamBeaconLogs from the beacon node via a gRPC server-side stream.
|
||||
func (s *Server) StreamBeaconLogs(req *emptypb.Empty, stream pb.ValidatorHealth_StreamBeaconLogsServer) error {
|
||||
func (s *Server) StreamBeaconLogs(req *emptypb.Empty, stream validatorpb.Health_StreamBeaconLogsServer) error {
|
||||
// Wrap service context with a cancel in order to propagate the exiting of
|
||||
// this method properly to the beacon node server.
|
||||
ctx, cancel := context.WithCancel(s.ctx)
|
||||
@@ -87,7 +88,7 @@ func (s *Server) StreamBeaconLogs(req *emptypb.Empty, stream pb.ValidatorHealth_
|
||||
}
|
||||
|
||||
// StreamValidatorLogs from the validator client via a gRPC server-side stream.
|
||||
func (s *Server) StreamValidatorLogs(_ *emptypb.Empty, stream pb.ValidatorHealth_StreamValidatorLogsServer) error {
|
||||
func (s *Server) StreamValidatorLogs(_ *emptypb.Empty, stream validatorpb.Health_StreamValidatorLogsServer) error {
|
||||
ch := make(chan []byte, s.streamLogsBufferSize)
|
||||
sub := s.logsStreamer.LogsFeed().Subscribe(ch)
|
||||
defer func() {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/validator/client"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/logutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/rand"
|
||||
@@ -182,12 +183,12 @@ func (s *Server) Start() {
|
||||
|
||||
// Register services available for the gRPC server.
|
||||
reflection.Register(s.grpcServer)
|
||||
pb.RegisterAuthServer(s.grpcServer, s)
|
||||
pb.RegisterWalletServer(s.grpcServer, s)
|
||||
pb.RegisterValidatorHealthServer(s.grpcServer, s)
|
||||
pb.RegisterBeaconServer(s.grpcServer, s)
|
||||
pb.RegisterAccountsServer(s.grpcServer, s)
|
||||
pb.RegisterSlashingProtectionServer(s.grpcServer, s)
|
||||
validatorpb.RegisterAuthServer(s.grpcServer, s)
|
||||
validatorpb.RegisterWalletServer(s.grpcServer, s)
|
||||
validatorpb.RegisterHealthServer(s.grpcServer, s)
|
||||
validatorpb.RegisterBeaconServer(s.grpcServer, s)
|
||||
validatorpb.RegisterAccountsServer(s.grpcServer, s)
|
||||
validatorpb.RegisterSlashingProtectionServer(s.grpcServer, s)
|
||||
|
||||
go func() {
|
||||
if s.listener != nil {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
)
|
||||
|
||||
var _ pb.AuthServer = (*Server)(nil)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
slashing "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/validator/accounts"
|
||||
"github.com/prysmaticlabs/prysm/validator/accounts/wallet"
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/promptutil"
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/google/uuid"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
|
||||
Reference in New Issue
Block a user