Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated everything related with the gRPC API #14944

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/grpc/grpcutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"google.golang.org/grpc/metadata"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// LogRequests logs the gRPC backend as well as request duration when the log level is set to debug
// or higher.
func LogRequests(
Expand Down Expand Up @@ -38,6 +40,8 @@ func LogRequests(
return err
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// LogStream prints the method at DEBUG level at the start of the stream.
func LogStream(
ctx context.Context,
Expand All @@ -64,6 +68,8 @@ func LogStream(
return strm, err
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// AppendHeaders parses the provided GRPC headers
// and attaches them to the provided context.
func AppendHeaders(parent context.Context, headers []string) context.Context {
Expand Down
8 changes: 8 additions & 0 deletions api/grpc/parameters.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
package grpc

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// CustomErrorMetadataKey is the name of the metadata key storing additional error information.
// Metadata value is expected to be a byte-encoded JSON object.
const CustomErrorMetadataKey = "Custom-Error"

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// HttpCodeMetadataKey is the key to use when setting custom HTTP status codes in gRPC metadata.
const HttpCodeMetadataKey = "X-Http-Code"

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// MetadataPrefix is the prefix for grpc headers on metadata
const MetadataPrefix = "Grpc-Metadata"

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// WithPrefix creates a new string with grpc metadata prefix
func WithPrefix(value string) string {
return MetadataPrefix + "-" + value
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/rpc/core/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type RpcError struct {
Reason ErrorReason
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
func ErrorReasonToGRPC(reason ErrorReason) codes.Code {
switch reason {
case Internal:
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/rpc/eth/helpers/error_handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"google.golang.org/grpc/status"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// PrepareStateFetchGRPCError returns an appropriate gRPC error based on the supplied argument.
// The argument error should be a result of fetching state.
func PrepareStateFetchGRPCError(err error) error {
Expand Down
5 changes: 3 additions & 2 deletions beacon-chain/rpc/eth/node/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import (
// providing RPC endpoints for verifying a beacon node's sync status, genesis and
// version information.
type Server struct {
SyncChecker sync.Checker
OptimisticModeFetcher blockchain.OptimisticModeFetcher
SyncChecker sync.Checker
OptimisticModeFetcher blockchain.OptimisticModeFetcher
// Deprecated: gRPC API is being deprecated in favour of REST API.
Server *grpc.Server
BeaconDB db.ReadOnlyDatabase
PeersFetcher p2p.PeersProvider
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/beacon/assignments.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (

const errEpoch = "cannot retrieve information about an epoch in the future, current epoch %d, requesting %d"

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListValidatorAssignments retrieves the validator assignments for a given epoch,
// optional validator indices or public keys may be included to filter validator assignments.
func (bs *Server) ListValidatorAssignments(
Expand Down
11 changes: 11 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/beacon/attestations.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ func mapAttestationsByTargetRoot(atts []ethpb.Att) map[[32]byte][]ethpb.Att {
return attsMap
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListAttestations retrieves attestations by block root, slot, or epoch.
// Attestations are sorted by data slot by default.
//
Expand Down Expand Up @@ -113,6 +115,8 @@ func (bs *Server) ListAttestations(
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListAttestationsElectra retrieves attestations by block root, slot, or epoch.
// Attestations are sorted by data slot by default.
//
Expand Down Expand Up @@ -176,6 +180,8 @@ func (bs *Server) ListAttestationsElectra(ctx context.Context, req *ethpb.ListAt
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListIndexedAttestations retrieves indexed attestations by block root.
// IndexedAttestationsForEpoch are sorted by data slot by default. Start-end epoch
// filter is used to retrieve blocks with.
Expand Down Expand Up @@ -236,6 +242,8 @@ func (bs *Server) ListIndexedAttestations(
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListIndexedAttestationsElectra retrieves indexed attestations by block root.
// IndexedAttestationsForEpoch are sorted by data slot by default. Start-end epoch
// filter is used to retrieve blocks with.
Expand Down Expand Up @@ -297,6 +305,8 @@ func (bs *Server) ListIndexedAttestationsElectra(
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// AttestationPool retrieves pending attestations.
//
// The server returns a list of attestations that have been seen but not
Expand Down Expand Up @@ -340,6 +350,7 @@ func (bs *Server) AttestationPool(_ context.Context, req *ethpb.AttestationPoolR
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
func (bs *Server) AttestationPoolElectra(_ context.Context, req *ethpb.AttestationPoolRequest) (*ethpb.AttestationPoolElectraResponse, error) {
var atts []*ethpb.AttestationElectra
var err error
Expand Down
5 changes: 4 additions & 1 deletion beacon-chain/rpc/prysm/v1alpha1/beacon/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type blockContainer struct {
isCanonical bool
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListBeaconBlocks retrieves blocks by root, slot, or epoch.
//
// The server may return multiple blocks in the case that a slot or epoch is
Expand Down Expand Up @@ -244,12 +246,13 @@ func (bs *Server) listBlocksForGenesis(ctx context.Context, _ *ethpb.ListBlocksR
}}, 1, strconv.Itoa(0), nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetChainHead retrieves information about the head of the beacon chain from
// the view of the beacon chain node.
//
// This includes the head block slot and root as well as information about
// the most recent finalized and justified slots.
// DEPRECATED: This endpoint is superseded by the /eth/v1/beacon API endpoint
func (bs *Server) GetChainHead(ctx context.Context, _ *emptypb.Empty) (*ethpb.ChainHead, error) {
ch, err := bs.CoreService.ChainHead(ctx)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/beacon/committees.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"google.golang.org/grpc/status"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListBeaconCommittees for a given epoch.
//
// If no filter criteria is specified, the response returns
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/beacon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetBeaconConfig retrieves the current configuration parameters of the beacon chain.
func (_ *Server) GetBeaconConfig(_ context.Context, _ *emptypb.Empty) (*ethpb.BeaconConfig, error) {
conf := params.BeaconConfig()
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/beacon/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// Server defines a server implementation of the gRPC Beacon Chain service,
// providing RPC endpoints to access data relevant to the Ethereum beacon chain.
type Server struct {
Expand Down
5 changes: 5 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/beacon/slashings.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"google.golang.org/grpc/status"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// SubmitProposerSlashing receives a proposer slashing object via
// RPC and injects it into the beacon node's operations pool.
// Submission into this pool does not guarantee inclusion into a beacon block.
Expand All @@ -36,10 +38,13 @@ func (bs *Server) SubmitProposerSlashing(
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *ethpb.AttesterSlashing) (*ethpb.SubmitSlashingResponse, error) {
return bs.submitAttesterSlashing(ctx, req)
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// SubmitAttesterSlashingElectra receives an attester slashing object via
// RPC and injects it into the beacon node's operations pool.
// Submission into this pool does not guarantee inclusion into a beacon block.
Expand Down
16 changes: 16 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/beacon/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListValidatorBalances retrieves the validator balances for a given set of public keys.
// An optional Epoch parameter is provided to request historical validator balances from
// archived, persistent data.
Expand Down Expand Up @@ -180,6 +182,8 @@ func (bs *Server) ListValidatorBalances(
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListValidators retrieves the current list of active validators with an optional historical epoch flag to
// retrieve validator set in time.
func (bs *Server) ListValidators(
Expand Down Expand Up @@ -338,6 +342,8 @@ func (bs *Server) ListValidators(
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetValidator information from any validator in the registry by index or public key.
func (bs *Server) GetValidator(
ctx context.Context, req *ethpb.GetValidatorRequest,
Expand Down Expand Up @@ -382,6 +388,8 @@ func (bs *Server) GetValidator(
return nil, status.Error(codes.NotFound, "No validator matched filter criteria")
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetValidatorActiveSetChanges retrieves the active set changes for a given epoch.
//
// This data includes any activations, voluntary exits, and involuntary
Expand All @@ -408,6 +416,8 @@ func (bs *Server) GetValidatorActiveSetChanges(
return as, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetValidatorParticipation retrieves the validator participation information for a given epoch,
// it returns the information about validator's participation rate in voting on the proof of stake
// rules based on their balance compared to the total active validator balance.
Expand All @@ -433,6 +443,8 @@ func (bs *Server) GetValidatorParticipation(
return vp, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetValidatorQueue retrieves the current validator queue information.
func (bs *Server) GetValidatorQueue(
ctx context.Context, _ *emptypb.Empty,
Expand Down Expand Up @@ -524,6 +536,8 @@ func (bs *Server) GetValidatorQueue(
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetValidatorPerformance reports the validator's latest balance along with other important metrics on
// rewards and penalties throughout its lifecycle in the beacon chain.
func (bs *Server) GetValidatorPerformance(
Expand All @@ -536,6 +550,8 @@ func (bs *Server) GetValidatorPerformance(
return response, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetIndividualVotes retrieves individual voting status of validators.
func (bs *Server) GetIndividualVotes(
ctx context.Context,
Expand Down
4 changes: 4 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/debug/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"google.golang.org/grpc/status"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetBlock in an ssz-encoded format by block root.
func (ds *Server) GetBlock(
ctx context.Context,
Expand All @@ -39,6 +41,8 @@ func (ds *Server) GetBlock(
}, nil
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetInclusionSlot of an attestation in block.
func (ds *Server) GetInclusionSlot(ctx context.Context, req *pbrpc.InclusionSlotRequest) (*pbrpc.InclusionSlotResponse, error) {
ds.GenesisTimeFetcher.CurrentSlot()
Expand Down
4 changes: 4 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/debug/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"google.golang.org/grpc/status"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetPeer returns the data known about the peer defined by the provided peer id.
func (ds *Server) GetPeer(_ context.Context, peerReq *ethpb.PeerRequest) (*ethpb.DebugPeerResponse, error) {
pid, err := peer.Decode(peerReq.PeerId)
Expand All @@ -22,6 +24,8 @@ func (ds *Server) GetPeer(_ context.Context, peerReq *ethpb.PeerRequest) (*ethpb
return ds.getPeer(pid)
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// ListPeers returns all peers known to the host node, regardless of if they are connected/
// disconnected.
func (ds *Server) ListPeers(_ context.Context, _ *empty.Empty) (*ethpb.DebugPeerResponses, error) {
Expand Down
4 changes: 4 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"google.golang.org/grpc/status"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// Server defines a server implementation of the gRPC Debug service,
// providing RPC endpoints for runtime debugging of a node, this server is
// gated behind the feature flag --enable-debug-rpc-endpoints.
Expand All @@ -33,6 +35,8 @@ type Server struct {
ReplayerBuilder stategen.ReplayerBuilder
}

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// SetLoggingLevel of a beacon node according to a request type,
// either INFO, DEBUG, or TRACE.
func (_ *Server) SetLoggingLevel(_ context.Context, req *pbrpc.LoggingLevelRequest) (*empty.Empty, error) {
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/rpc/prysm/v1alpha1/debug/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"google.golang.org/grpc/status"
)

// Deprecated: gRPC API is being deprecated in favour of REST API.
//
// GetBeaconState retrieves an ssz-encoded beacon state
// from the beacon node by either a slot or block root.
func (ds *Server) GetBeaconState(
Expand Down
Loading
Loading