mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Change gogoproto compiler to protoc-gen-go-cast (#8697)
* Remove gogoproto compiler * Remove more gogoproto * Improvements * Fix gengo * More scripts * Gazelle, fix deps * Fix version and errors * Fix gocast for arrays * Fix ethapis * Fixes * Fix compile errors * fix go.mod * //proto/... builds * Update for protov2 * temp fix compilation to move on * Change everything to emptypb.empty * Add grpc to proto/slashings * Fix almost all build failures * Oher build problems * FIX THIS FUCKING THING * gaz literally every .bazel * Final touches * Final final touches * Fix proto * Begin moving proto.Marshal to native * Fix site_data * Fixes * Fix duplicate gateway * Fix gateway target * Fix ethapis * Fixes from review * Update * Fix * Fix status test * Fix fuzz * Add isprotoslice to fun * Change DeepEqual to DeepSSZEqual for proto arrays * Fix build * Fix gaz * Update go * Fixes * Fixes * Add case for nil validators after copy * Fix cast * Fix test * Fix imports * Go mod * Only use extension where needed * Fixes * Split gateway from gengo * gaz * go mod * Add back hydrated state * fix hydrate * Fix proto.clone * Fies * Revert "Split gateway from gengo" This reverts commit7298bb2054. * Revert "gaz" This reverts commitca95256570. * Merge all gateway into one target * go mod * Gaz * Add generate v1_gateway files * run pb again * goimports * gaz * Fix comments * Fix protos * Fix PR * Fix protos * Update grpc-gateway and ethapis * Update ethapis and gen-go-cast * Go tidy * Reorder * Fix ethapis * fix spec tests * Fix script * Remove unused import * Fix fuzz * Fix gomod * Update version * Error if the cloned result is nil * Handle optional slots * ADd more empty checks to clone * Undo fuzz changes * Fix build.bazel * Gaz * Redo fuzz changes * Undo some eth1data changes * Update go.mod Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Undo clone beacon state * Remove gogo proto more and unused v1_gateway * Add manual fix for nil vals * Fix gaz * tidy * Tidy again * Add detailed error * Revert "Add detailed error" This reverts commit59bc053dcd. * Undo varint changes * Fix nil validators in deposit test * Commit * Undo Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
@@ -43,7 +43,6 @@ go_library(
|
||||
"//validator/keymanager/imported:go_default_library",
|
||||
"//validator/slashing-protection/local/standard-protection-format:go_default_library",
|
||||
"@com_github_dgrijalva_jwt_go//:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_grpc_ecosystem_go_grpc_middleware//:go_default_library",
|
||||
"@com_github_grpc_ecosystem_go_grpc_middleware//recovery:go_default_library",
|
||||
"@com_github_grpc_ecosystem_go_grpc_middleware//retry:go_default_library",
|
||||
@@ -104,7 +103,6 @@ go_test(
|
||||
"//validator/slashing-protection/local/standard-protection-format/format:go_default_library",
|
||||
"//validator/testing:go_default_library",
|
||||
"@com_github_dgrijalva_jwt_go//:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_golang_mock//gomock:go_default_library",
|
||||
"@com_github_google_uuid//:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
@@ -113,5 +111,6 @@ go_test(
|
||||
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
"@org_golang_google_grpc//metadata:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/cmd/validator/flags"
|
||||
@@ -26,6 +25,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/validator/keymanager"
|
||||
"github.com/prysmaticlabs/prysm/validator/keymanager/derived"
|
||||
constant "github.com/prysmaticlabs/prysm/validator/testing"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -255,7 +255,7 @@ func TestServer_VoluntaryExit(t *testing.T) {
|
||||
Return(ðpb.ValidatorIndexResponse{Index: 1}, nil)
|
||||
|
||||
// Any time in the past will suffice
|
||||
genesisTime := &types.Timestamp{
|
||||
genesisTime := ×tamppb.Timestamp{
|
||||
Seconds: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC).Unix(),
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
|
||||
@@ -17,6 +16,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/grpcutils"
|
||||
"github.com/prysmaticlabs/prysm/validator/client"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// Initialize a client connect to a beacon node gRPC endpoint.
|
||||
@@ -57,7 +57,7 @@ func (s *Server) registerBeaconClient() error {
|
||||
// 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) {
|
||||
syncStatus, err := s.beaconNodeClient.GetSyncStatus(ctx, &ptypes.Empty{})
|
||||
syncStatus, err := s.beaconNodeClient.GetSyncStatus(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return &pb.BeaconStatusResponse{
|
||||
BeaconNodeEndpoint: s.nodeGatewayEndpoint,
|
||||
@@ -65,13 +65,13 @@ func (s *Server) GetBeaconStatus(ctx context.Context, _ *empty.Empty) (*pb.Beaco
|
||||
Syncing: false,
|
||||
}, nil
|
||||
}
|
||||
genesis, err := s.beaconNodeClient.GetGenesis(ctx, &ptypes.Empty{})
|
||||
genesis, err := s.beaconNodeClient.GetGenesis(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
genesisTime := uint64(time.Unix(genesis.GenesisTime.Seconds, 0).Unix())
|
||||
address := genesis.DepositContractAddress
|
||||
chainHead, err := s.beaconChainClient.GetChainHead(ctx, &ptypes.Empty{})
|
||||
chainHead, err := s.beaconChainClient.GetChainHead(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -117,12 +117,12 @@ func (s *Server) GetValidators(
|
||||
func (s *Server) GetValidatorQueue(
|
||||
ctx context.Context, _ *empty.Empty,
|
||||
) (*ethpb.ValidatorQueue, error) {
|
||||
return s.beaconChainClient.GetValidatorQueue(ctx, &ptypes.Empty{})
|
||||
return s.beaconChainClient.GetValidatorQueue(ctx, &emptypb.Empty{})
|
||||
}
|
||||
|
||||
// GetPeers is a wrapper around the /eth/v1alpha1 endpoint of the same name.
|
||||
func (s *Server) GetPeers(
|
||||
ctx context.Context, _ *empty.Empty,
|
||||
) (*ethpb.Peers, error) {
|
||||
return s.beaconNodeClient.ListPeers(ctx, &ptypes.Empty{})
|
||||
return s.beaconNodeClient.ListPeers(ctx, &emptypb.Empty{})
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
@@ -15,6 +14,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
func TestGetBeaconStatus_NotConnected(t *testing.T) {
|
||||
@@ -46,8 +46,7 @@ func TestGetBeaconStatus_OK(t *testing.T) {
|
||||
gomock.Any(), // ctx
|
||||
gomock.Any(),
|
||||
).Return(ðpb.SyncStatus{Syncing: true}, nil)
|
||||
timeStamp, err := ptypes.TimestampProto(time.Unix(0, 0))
|
||||
require.NoError(t, err)
|
||||
timeStamp := timestamppb.New(time.Unix(0, 0))
|
||||
nodeClient.EXPECT().GetGenesis(
|
||||
gomock.Any(), // ctx
|
||||
gomock.Any(),
|
||||
|
||||
@@ -4,18 +4,17 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/validator/accounts/v2"
|
||||
"github.com/prysmaticlabs/prysm/shared/version"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// GetBeaconNodeConnection retrieves the current beacon node connection
|
||||
// information, as well as its sync status.
|
||||
func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *empty.Empty) (*pb.NodeConnectionResponse, error) {
|
||||
func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *emptypb.Empty) (*pb.NodeConnectionResponse, error) {
|
||||
syncStatus, err := s.syncChecker.Syncing(ctx)
|
||||
if err != nil || s.validatorService.Status() != nil {
|
||||
return &pb.NodeConnectionResponse{
|
||||
@@ -39,13 +38,13 @@ func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *empty.Empty) (*
|
||||
}
|
||||
|
||||
// GetLogsEndpoints for the beacon and validator client.
|
||||
func (s *Server) GetLogsEndpoints(ctx context.Context, _ *empty.Empty) (*pb.LogsEndpointResponse, error) {
|
||||
func (s *Server) GetLogsEndpoints(ctx context.Context, _ *emptypb.Empty) (*pb.LogsEndpointResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "unimplemented")
|
||||
}
|
||||
|
||||
// GetVersion --
|
||||
func (s *Server) GetVersion(ctx context.Context, _ *empty.Empty) (*pb.VersionResponse, error) {
|
||||
beacon, err := s.beaconNodeClient.GetVersion(ctx, &ptypes.Empty{})
|
||||
func (s *Server) GetVersion(ctx context.Context, _ *emptypb.Empty) (*pb.VersionResponse, error) {
|
||||
beacon, err := s.beaconNodeClient.GetVersion(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -57,7 +56,7 @@ func (s *Server) GetVersion(ctx context.Context, _ *empty.Empty) (*pb.VersionRes
|
||||
}
|
||||
|
||||
// StreamBeaconLogs from the beacon node via a gRPC server-side stream.
|
||||
func (s *Server) StreamBeaconLogs(req *empty.Empty, stream pb.Health_StreamBeaconLogsServer) error {
|
||||
func (s *Server) StreamBeaconLogs(req *emptypb.Empty, stream pb.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)
|
||||
@@ -88,7 +87,7 @@ func (s *Server) StreamBeaconLogs(req *empty.Empty, stream pb.Health_StreamBeaco
|
||||
}
|
||||
|
||||
// StreamValidatorLogs from the validator client via a gRPC server-side stream.
|
||||
func (s *Server) StreamValidatorLogs(_ *empty.Empty, stream pb.Health_StreamValidatorLogsServer) error {
|
||||
func (s *Server) StreamValidatorLogs(_ *emptypb.Empty, stream pb.Health_StreamValidatorLogsServer) error {
|
||||
ch := make(chan []byte, s.streamLogsBufferSize)
|
||||
sub := s.logsStreamer.LogsFeed().Subscribe(ch)
|
||||
defer func() {
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/validator/accounts/v2"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/validator/client"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
type mockSyncChecker struct {
|
||||
@@ -24,11 +24,7 @@ func (m *mockSyncChecker) Syncing(_ context.Context) (bool, error) {
|
||||
type mockGenesisFetcher struct{}
|
||||
|
||||
func (m *mockGenesisFetcher) GenesisInfo(_ context.Context) (*ethpb.Genesis, error) {
|
||||
genesis, err := ptypes.TimestampProto(time.Unix(0, 0))
|
||||
if err != nil {
|
||||
log.Info(err)
|
||||
return nil, err
|
||||
}
|
||||
genesis := timestamppb.New(time.Unix(0, 0))
|
||||
return ðpb.Genesis{
|
||||
GenesisTime: genesis,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user