Protos and stubs for validator API endpoints (#9174)

* match proto definitions with spec

* stubs for grpc server's functions
This commit is contained in:
Radosław Kapka
2021-07-12 17:38:55 +02:00
committed by GitHub
parent a9ee3ee06a
commit 4ebb008bc9
6 changed files with 494 additions and 391 deletions

View File

@@ -0,0 +1,16 @@
load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"server.go",
"validator.go",
],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/rpc/eth/v1/validator",
visibility = ["//beacon-chain:__subpackages__"],
deps = [
"//proto/eth/v1:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
],
)

View File

@@ -0,0 +1,6 @@
package validator
// Server defines a server implementation of the gRPC Validator service,
// providing RPC endpoints intended for validator clients.
type Server struct {
}

View File

@@ -0,0 +1,47 @@
package validator
import (
"context"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1"
)
// GetAttesterDuties requests the beacon node to provide a set of attestation duties,
// which should be performed by validators, for a particular epoch.
func (vs *Server) GetAttesterDuties(ctx context.Context, req *ethpb.AttesterDutiesRequest) (*ethpb.AttesterDutiesResponse, error) {
return nil, errors.New("Unimplemented")
}
// GetProposerDuties requests beacon node to provide all validators that are scheduled to propose a block in the given epoch.
func (vs *Server) GetProposerDuties(ctx context.Context, req *ethpb.ProposerDutiesRequest) (*ethpb.ProposerDutiesResponse, error) {
return nil, errors.New("Unimplemented")
}
// ProduceBlock requests the beacon node to produce a valid unsigned beacon block, which can then be signed by a proposer and submitted.
func (vs *Server) ProduceBlock(ctx context.Context, req *ethpb.ProduceBlockRequest) (*ethpb.ProduceBlockResponse, error) {
return nil, errors.New("Unimplemented")
}
// ProduceAttestationData requests that the beacon node produces attestation data for
// the requested committee index and slot based on the nodes current head.
func (vs *Server) ProduceAttestationData(ctx context.Context, req *ethpb.ProduceAttestationDataRequest) (*ethpb.ProduceAttestationDataResponse, error) {
return nil, errors.New("Unimplemented")
}
// GetAggregateAttestation aggregates all attestations matching the given attestation data root and slot, returning the aggregated result.
func (vs *Server) GetAggregateAttestation(ctx context.Context, req *ethpb.AggregateAttestationRequest) (*ethpb.AggregateAttestationResponse, error) {
return nil, errors.New("Unimplemented")
}
// SubmitAggregateAndProofs verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
func (vs *Server) SubmitAggregateAndProofs(ctx context.Context, req *ethpb.SubmitAggregateAndProofsRequest) (*emptypb.Empty, error) {
return nil, errors.New("Unimplemented")
}
// SubmitBeaconCommitteeSubscription searches using discv5 for peers related to the provided subnet information
// and replaces current peers with those ones if necessary.
func (vs *Server) SubmitBeaconCommitteeSubscription(ctx context.Context, req *ethpb.SubmitBeaconCommitteeSubscriptionsRequest) (*emptypb.Empty, error) {
return nil, errors.New("Unimplemented")
}

File diff suppressed because it is too large Load Diff

View File

@@ -37,14 +37,18 @@ var _ = github_com_prysmaticlabs_eth2_types.Epoch(0)
var _ = emptypb.Empty{}
var _ = empty.Empty{}
var (
filter_BeaconValidator_GetAttesterDuties_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_BeaconValidator_GetAttesterDuties_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AttesterDutiesRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
@@ -63,13 +67,6 @@ func request_BeaconValidator_GetAttesterDuties_0(ctx context.Context, marshaler
}
protoReq.Epoch = github_com_prysmaticlabs_eth2_types.Epoch(epoch)
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_GetAttesterDuties_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetAttesterDuties(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
@@ -79,6 +76,14 @@ func local_request_BeaconValidator_GetAttesterDuties_0(ctx context.Context, mars
var protoReq AttesterDutiesRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
@@ -97,13 +102,6 @@ func local_request_BeaconValidator_GetAttesterDuties_0(ctx context.Context, mars
}
protoReq.Epoch = github_com_prysmaticlabs_eth2_types.Epoch(epoch)
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_GetAttesterDuties_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetAttesterDuties(ctx, &protoReq)
return msg, metadata, err
@@ -164,11 +162,11 @@ func local_request_BeaconValidator_GetProposerDuties_0(ctx context.Context, mars
}
var (
filter_BeaconValidator_GetBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{"slot": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
filter_BeaconValidator_ProduceBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{"slot": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_BeaconValidator_GetBlock_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ProposerBlockRequest
func request_BeaconValidator_ProduceBlock_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ProduceBlockRequest
var metadata runtime.ServerMetadata
var (
@@ -192,17 +190,17 @@ func request_BeaconValidator_GetBlock_0(ctx context.Context, marshaler runtime.M
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_GetBlock_0); err != nil {
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_ProduceBlock_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
msg, err := client.ProduceBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_BeaconValidator_GetBlock_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ProposerBlockRequest
func local_request_BeaconValidator_ProduceBlock_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ProduceBlockRequest
var metadata runtime.ServerMetadata
var (
@@ -226,47 +224,47 @@ func local_request_BeaconValidator_GetBlock_0(ctx context.Context, marshaler run
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_GetBlock_0); err != nil {
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_ProduceBlock_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetBlock(ctx, &protoReq)
msg, err := server.ProduceBlock(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_BeaconValidator_GetAttestationData_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
filter_BeaconValidator_ProduceAttestationData_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_BeaconValidator_GetAttestationData_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AttestationDataRequest
func request_BeaconValidator_ProduceAttestationData_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ProduceAttestationDataRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_GetAttestationData_0); err != nil {
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_ProduceAttestationData_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetAttestationData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
msg, err := client.ProduceAttestationData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_BeaconValidator_GetAttestationData_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AttestationDataRequest
func local_request_BeaconValidator_ProduceAttestationData_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ProduceAttestationDataRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_GetAttestationData_0); err != nil {
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_ProduceAttestationData_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetAttestationData(ctx, &protoReq)
msg, err := server.ProduceAttestationData(ctx, &protoReq)
return msg, metadata, err
}
@@ -308,14 +306,14 @@ func local_request_BeaconValidator_GetAggregateAttestation_0(ctx context.Context
}
func request_BeaconValidator_SubmitAggregateAndProofs_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AggregateAndProofsSubmit
var protoReq SubmitAggregateAndProofsRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Data); err != nil && err != io.EOF {
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -325,14 +323,14 @@ func request_BeaconValidator_SubmitAggregateAndProofs_0(ctx context.Context, mar
}
func local_request_BeaconValidator_SubmitAggregateAndProofs_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AggregateAndProofsSubmit
var protoReq SubmitAggregateAndProofsRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Data); err != nil && err != io.EOF {
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -342,14 +340,14 @@ func local_request_BeaconValidator_SubmitAggregateAndProofs_0(ctx context.Contex
}
func request_BeaconValidator_SubmitBeaconCommitteeSubscription_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BeaconCommitteeSubscribeSubmit
var protoReq SubmitBeaconCommitteeSubscriptionsRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Data); err != nil && err != io.EOF {
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -359,14 +357,14 @@ func request_BeaconValidator_SubmitBeaconCommitteeSubscription_0(ctx context.Con
}
func local_request_BeaconValidator_SubmitBeaconCommitteeSubscription_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BeaconCommitteeSubscribeSubmit
var protoReq SubmitBeaconCommitteeSubscriptionsRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Data); err != nil && err != io.EOF {
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -381,7 +379,7 @@ func local_request_BeaconValidator_SubmitBeaconCommitteeSubscription_0(ctx conte
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBeaconValidatorHandlerFromEndpoint instead.
func RegisterBeaconValidatorHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BeaconValidatorServer) error {
mux.Handle("GET", pattern_BeaconValidator_GetAttesterDuties_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("POST", pattern_BeaconValidator_GetAttesterDuties_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
@@ -427,18 +425,18 @@ func RegisterBeaconValidatorHandlerServer(ctx context.Context, mux *runtime.Serv
})
mux.Handle("GET", pattern_BeaconValidator_GetBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", pattern_BeaconValidator_ProduceBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1.BeaconValidator/GetBlock")
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1.BeaconValidator/ProduceBlock")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_BeaconValidator_GetBlock_0(rctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_BeaconValidator_ProduceBlock_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
@@ -446,22 +444,22 @@ func RegisterBeaconValidatorHandlerServer(ctx context.Context, mux *runtime.Serv
return
}
forward_BeaconValidator_GetBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_BeaconValidator_ProduceBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_BeaconValidator_GetAttestationData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", pattern_BeaconValidator_ProduceAttestationData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1.BeaconValidator/GetAttestationData")
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1.BeaconValidator/ProduceAttestationData")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_BeaconValidator_GetAttestationData_0(rctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_BeaconValidator_ProduceAttestationData_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
@@ -469,7 +467,7 @@ func RegisterBeaconValidatorHandlerServer(ctx context.Context, mux *runtime.Serv
return
}
forward_BeaconValidator_GetAttestationData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_BeaconValidator_ProduceAttestationData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -583,7 +581,7 @@ func RegisterBeaconValidatorHandler(ctx context.Context, mux *runtime.ServeMux,
// "BeaconValidatorClient" to call the correct interceptors.
func RegisterBeaconValidatorHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BeaconValidatorClient) error {
mux.Handle("GET", pattern_BeaconValidator_GetAttesterDuties_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("POST", pattern_BeaconValidator_GetAttesterDuties_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@@ -623,43 +621,43 @@ func RegisterBeaconValidatorHandlerClient(ctx context.Context, mux *runtime.Serv
})
mux.Handle("GET", pattern_BeaconValidator_GetBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", pattern_BeaconValidator_ProduceBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1.BeaconValidator/GetBlock")
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1.BeaconValidator/ProduceBlock")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_BeaconValidator_GetBlock_0(rctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_BeaconValidator_ProduceBlock_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_BeaconValidator_GetBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_BeaconValidator_ProduceBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_BeaconValidator_GetAttestationData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", pattern_BeaconValidator_ProduceAttestationData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1.BeaconValidator/GetAttestationData")
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1.BeaconValidator/ProduceAttestationData")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_BeaconValidator_GetAttestationData_0(rctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_BeaconValidator_ProduceAttestationData_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_BeaconValidator_GetAttestationData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_BeaconValidator_ProduceAttestationData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -731,9 +729,9 @@ var (
pattern_BeaconValidator_GetProposerDuties_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"eth", "v1", "validator", "duties", "proposer", "epoch"}, ""))
pattern_BeaconValidator_GetBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"eth", "v1", "validator", "blocks", "slot"}, ""))
pattern_BeaconValidator_ProduceBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"eth", "v1", "validator", "blocks", "slot"}, ""))
pattern_BeaconValidator_GetAttestationData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"eth", "v1", "validator", "attestation_data"}, ""))
pattern_BeaconValidator_ProduceAttestationData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"eth", "v1", "validator", "attestation_data"}, ""))
pattern_BeaconValidator_GetAggregateAttestation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"eth", "v1", "validator", "aggregate_attestation"}, ""))
@@ -747,9 +745,9 @@ var (
forward_BeaconValidator_GetProposerDuties_0 = runtime.ForwardResponseMessage
forward_BeaconValidator_GetBlock_0 = runtime.ForwardResponseMessage
forward_BeaconValidator_ProduceBlock_0 = runtime.ForwardResponseMessage
forward_BeaconValidator_GetAttestationData_0 = runtime.ForwardResponseMessage
forward_BeaconValidator_ProduceAttestationData_0 = runtime.ForwardResponseMessage
forward_BeaconValidator_GetAggregateAttestation_0 = runtime.ForwardResponseMessage

View File

@@ -40,31 +40,63 @@ service BeaconValidator {
// by validators, for a particular epoch. Duties should only need to be checked once per epoch, however
// a chain reorganization (of > MIN_SEED_LOOKAHEAD epochs) could occur, resulting in a change of duties.
// For full safety, you should monitor chain reorganization events.
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid epoch or index
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc GetAttesterDuties(AttesterDutiesRequest) returns (AttesterDutiesResponse) {
option (google.api.http) = { get: "/eth/v1/validator/duties/attester/{epoch}" };
option (google.api.http) = {
post: "/eth/v1/validator/duties/attester/{epoch}"
body: "*"
};
}
// GetProposerDuties requests beacon node to provide all validators that are scheduled to
// propose a block in the given epoch
// propose a block in the given epoch.
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid epoch
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc GetProposerDuties(ProposerDutiesRequest) returns (ProposerDutiesResponse) {
option (google.api.http) = { get: "/eth/v1/validator/duties/proposer/{epoch}" };
}
// GetBlock requests the beacon node to produce a valid unsigned beacon block,
// ProduceBlock requests the beacon node to produce a valid unsigned beacon block,
// which can then be signed by a proposer and submitted.
rpc GetBlock(ProposerBlockRequest) returns (ProposerBlockResponse) {
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid block production request
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc ProduceBlock(ProduceBlockRequest) returns (ProduceBlockResponse) {
option (google.api.http) = { get: "/eth/v1/validator/blocks/{slot}" };
}
// GetAttestationData requests that the beacon node provides the attestation data for
// ProduceAttestationData requests that the beacon node produces attestation data for
// the requested committee index and slot based on the nodes current head.
rpc GetAttestationData(AttestationDataRequest) returns (AttestationDataResponse) {
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid request syntax
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc ProduceAttestationData(ProduceAttestationDataRequest) returns (ProduceAttestationDataResponse) {
option (google.api.http) = { get: "/eth/v1/validator/attestation_data" };
}
// GetAggregateAttestation aggregates all attestations matching the given attestation data root and slot,
// returning the aggregated result.
rpc GetAggregateAttestation(AggregateAttestationRequest) returns (AttestationResponse) {
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid request syntax
// - 500: Beacon node internal error
rpc GetAggregateAttestation(AggregateAttestationRequest) returns (AggregateAttestationResponse) {
option (google.api.http) = { get: "/eth/v1/validator/aggregate_attestation" };
}
@@ -72,18 +104,16 @@ service BeaconValidator {
//
// Response usage:
// - 200: Successful response
//
// - 400: Invalid request syntax.
//
// - 500: Beacon node internal error.
rpc SubmitAggregateAndProofs(AggregateAndProofsSubmit) returns (google.protobuf.Empty) {
// - 400: Invalid request syntax
// - 500: Beacon node internal error
rpc SubmitAggregateAndProofs(SubmitAggregateAndProofsRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/validator/aggregate_and_proofs"
body: "data"
body: "*"
};
}
// SubmitBeaconCommitteeSubscription requests the beacon node to search using discv5 for peers related to
// SubmitBeaconCommitteeSubscription searches using discv5 for peers related to
// the provided subnet information and replaces current peers with those ones if necessary.
//
// If validator is_aggregator, beacon node must:
@@ -91,16 +121,15 @@ service BeaconValidator {
// - aggregate attestations received on that subnet.
//
// Response usage:
// - 200: Slot signature is valid and beacon node has prepared the attestation subnet.
// Note that, we cannot be certain Beacon node will find peers for that subnet for various reasons.
//
// - 500: Beacon node internal error.
//
// - 503: Beacon node is currently syncing, try again later.
rpc SubmitBeaconCommitteeSubscription(BeaconCommitteeSubscribeSubmit) returns (google.protobuf.Empty) {
// - 200: Slot signature is valid and beacon node has prepared the attestation subnet
// Note that we cannot be certain Beacon node will find peers for that subnet for various reasons
// - 400: Invalid request syntax
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc SubmitBeaconCommitteeSubscription(SubmitBeaconCommitteeSubscriptionsRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/validator/beacon_committee_subscriptions"
body: "data"
body: "*"
};
}
}
@@ -162,7 +191,7 @@ message ProposerDuty {
uint64 slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
}
message ProposerBlockRequest {
message ProduceBlockRequest {
// The slot to request a block for.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
@@ -171,14 +200,14 @@ message ProposerBlockRequest {
// 32 byte field of arbitrary data. This field may contain any data and
// is not used for anything other than a fun message.
bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
optional bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
}
message ProposerBlockResponse {
message ProduceBlockResponse {
BeaconBlock data = 1;
}
message AttestationDataRequest {
message ProduceAttestationDataRequest {
// Slot for which the attestation data should be retrieved for.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
@@ -186,7 +215,7 @@ message AttestationDataRequest {
uint64 committee_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.CommitteeIndex"];
}
message AttestationDataResponse {
message ProduceAttestationDataResponse {
AttestationData data = 1;
}
@@ -198,15 +227,15 @@ message AggregateAttestationRequest {
uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
}
message AttestationResponse {
message AggregateAttestationResponse {
Attestation data = 1;
}
message AggregateAndProofsSubmit {
message SubmitAggregateAndProofsRequest {
repeated SignedAggregateAttestationAndProof data = 1;
}
message BeaconCommitteeSubscribeSubmit {
message SubmitBeaconCommitteeSubscriptionsRequest {
repeated BeaconCommitteeSubscribe data = 1;
}