From b0b4e4243629e51897a657613254c6cbb7fd47da Mon Sep 17 00:00:00 2001 From: Sammy Rosso <15244892+saolyn@users.noreply.github.com> Date: Wed, 27 Sep 2023 14:51:37 +0200 Subject: [PATCH] HTTP Beacon API: `/eth/v1/beacon/blocks` and `/eth/v1/beacon/blinded_blocks` (#12827) * Add PublishBlock * Add endpoints * Cleanup * Modify publishBlock to work for v1 and v2 * Remove v2 + add server receiver * Cleanup remaining endpoints * Remove error from SszRequested * Remove unused functions --- .../rpc/apimiddleware/custom_handlers.go | 79 +-- .../rpc/apimiddleware/endpoint_factory.go | 13 - beacon-chain/rpc/eth/beacon/BUILD.bazel | 3 - beacon-chain/rpc/eth/beacon/blinded_blocks.go | 291 --------- .../rpc/eth/beacon/blinded_blocks_test.go | 277 -------- beacon-chain/rpc/eth/beacon/blocks.go | 313 --------- beacon-chain/rpc/eth/beacon/blocks_test.go | 277 -------- beacon-chain/rpc/eth/beacon/handlers.go | 162 +++-- beacon-chain/rpc/eth/beacon/handlers_test.go | 512 +++++++++++++++ beacon-chain/rpc/eth/blob/handlers.go | 7 +- .../rpc/eth/validator/handlers_block.go | 7 +- beacon-chain/rpc/service.go | 2 + network/http/BUILD.bazel | 5 +- network/http/reader.go | 8 +- network/http/reader_test.go | 34 +- proto/eth/service/beacon_chain_service.pb.go | 599 ++++++------------ .../eth/service/beacon_chain_service.pb.gw.go | 324 ---------- proto/eth/service/beacon_chain_service.proto | 66 -- 18 files changed, 844 insertions(+), 2135 deletions(-) diff --git a/beacon-chain/rpc/apimiddleware/custom_handlers.go b/beacon-chain/rpc/apimiddleware/custom_handlers.go index cdc96ccaab..3b68c6c94d 100644 --- a/beacon-chain/rpc/apimiddleware/custom_handlers.go +++ b/beacon-chain/rpc/apimiddleware/custom_handlers.go @@ -70,19 +70,6 @@ func handleGetBlindedBeaconBlockSSZ( return handleGetSSZ(m, endpoint, w, req, config) } -func handleSubmitBlockSSZ(m *apimiddleware.ApiProxyMiddleware, endpoint apimiddleware.Endpoint, w http.ResponseWriter, req *http.Request) (handled bool) { - return handlePostSSZ(m, endpoint, w, req) -} - -func handleSubmitBlindedBlockSSZ( - m *apimiddleware.ApiProxyMiddleware, - endpoint apimiddleware.Endpoint, - w http.ResponseWriter, - req *http.Request, -) (handled bool) { - return handlePostSSZ(m, endpoint, w, req) -} - func handleProduceBlockSSZ(m *apimiddleware.ApiProxyMiddleware, endpoint apimiddleware.Endpoint, w http.ResponseWriter, req *http.Request) (handled bool) { config := sszConfig{ fileName: "produce_beacon_block.ssz", @@ -111,11 +98,7 @@ func handleGetSSZ( req *http.Request, config sszConfig, ) (handled bool) { - ssz, err := http2.SszRequested(req) - if err != nil { - apimiddleware.WriteError(w, apimiddleware.InternalServerError(err), nil) - return true - } + ssz := http2.SszRequested(req) if !ssz { return false } @@ -163,58 +146,6 @@ func handleGetSSZ( return true } -func handlePostSSZ(m *apimiddleware.ApiProxyMiddleware, endpoint apimiddleware.Endpoint, w http.ResponseWriter, req *http.Request) (handled bool) { - if !sszPosted(req) { - return false - } - - if errJson := prepareSSZRequestForProxying(m, endpoint, req); errJson != nil { - apimiddleware.WriteError(w, errJson, nil) - return true - } - prepareCustomHeaders(req) - if errJson := preparePostedSSZData(req); errJson != nil { - apimiddleware.WriteError(w, errJson, nil) - return true - } - - grpcResponse, errJson := m.ProxyRequest(req) - if errJson != nil { - apimiddleware.WriteError(w, errJson, nil) - return true - } - grpcResponseBody, errJson := apimiddleware.ReadGrpcResponseBody(grpcResponse.Body) - if errJson != nil { - apimiddleware.WriteError(w, errJson, nil) - return true - } - respHasError, errJson := apimiddleware.HandleGrpcResponseError(endpoint.Err, grpcResponse, grpcResponseBody, w) - if errJson != nil { - apimiddleware.WriteError(w, errJson, nil) - return true - } - if respHasError { - return true - } - if errJson := apimiddleware.Cleanup(grpcResponse.Body); errJson != nil { - apimiddleware.WriteError(w, errJson, nil) - return true - } - - return true -} - -func sszPosted(req *http.Request) bool { - ct, ok := req.Header["Content-Type"] - if !ok { - return false - } - if len(ct) != 1 { - return false - } - return ct[0] == api.OctetStreamMediaType -} - func prepareSSZRequestForProxying(m *apimiddleware.ApiProxyMiddleware, endpoint apimiddleware.Endpoint, req *http.Request) apimiddleware.ErrorJson { req.URL.Scheme = "http" req.URL.Host = m.GatewayAddress @@ -230,14 +161,6 @@ func prepareSSZRequestForProxying(m *apimiddleware.ApiProxyMiddleware, endpoint return nil } -func prepareCustomHeaders(req *http.Request) { - ver := req.Header.Get(api.VersionHeader) - if ver != "" { - req.Header.Del(api.VersionHeader) - req.Header.Add(grpc.WithPrefix(api.VersionHeader), ver) - } -} - func preparePostedSSZData(req *http.Request) apimiddleware.ErrorJson { buf, err := io.ReadAll(req.Body) if err != nil { diff --git a/beacon-chain/rpc/apimiddleware/endpoint_factory.go b/beacon-chain/rpc/apimiddleware/endpoint_factory.go index 74725318a5..6a95507a39 100644 --- a/beacon-chain/rpc/apimiddleware/endpoint_factory.go +++ b/beacon-chain/rpc/apimiddleware/endpoint_factory.go @@ -19,7 +19,6 @@ func (_ *BeaconEndpointFactory) Paths() []string { "/eth/v1/beacon/states/{state_id}/root", "/eth/v1/beacon/states/{state_id}/sync_committees", "/eth/v1/beacon/states/{state_id}/randao", - "/eth/v1/beacon/blocks", "/eth/v1/beacon/blinded_blocks", "/eth/v1/beacon/blocks/{block_id}", "/eth/v2/beacon/blocks/{block_id}", @@ -65,18 +64,6 @@ func (_ *BeaconEndpointFactory) Create(path string) (*apimiddleware.Endpoint, er case "/eth/v1/beacon/states/{state_id}/randao": endpoint.RequestQueryParams = []apimiddleware.QueryParam{{Name: "epoch"}} endpoint.GetResponse = &RandaoResponseJson{} - case "/eth/v1/beacon/blocks": - endpoint.Hooks = apimiddleware.HookCollection{ - OnPreDeserializeRequestBodyIntoContainer: setInitialPublishBlockPostRequest, - OnPostDeserializeRequestBodyIntoContainer: preparePublishedBlock, - } - endpoint.CustomHandlers = []apimiddleware.CustomHandler{handleSubmitBlockSSZ} - case "/eth/v1/beacon/blinded_blocks": - endpoint.Hooks = apimiddleware.HookCollection{ - OnPreDeserializeRequestBodyIntoContainer: setInitialPublishBlindedBlockPostRequest, - OnPostDeserializeRequestBodyIntoContainer: preparePublishedBlindedBlock, - } - endpoint.CustomHandlers = []apimiddleware.CustomHandler{handleSubmitBlindedBlockSSZ} case "/eth/v1/beacon/blocks/{block_id}": endpoint.GetResponse = &BlockResponseJson{} endpoint.CustomHandlers = []apimiddleware.CustomHandler{handleGetBeaconBlockSSZ} diff --git a/beacon-chain/rpc/eth/beacon/BUILD.bazel b/beacon-chain/rpc/eth/beacon/BUILD.bazel index a7cae65fd4..256196f00d 100644 --- a/beacon-chain/rpc/eth/beacon/BUILD.bazel +++ b/beacon-chain/rpc/eth/beacon/BUILD.bazel @@ -41,7 +41,6 @@ go_library( "//beacon-chain/rpc/eth/helpers:go_default_library", "//beacon-chain/rpc/eth/shared:go_default_library", "//beacon-chain/rpc/lookup:go_default_library", - "//beacon-chain/rpc/prysm/v1alpha1/validator:go_default_library", "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", "//beacon-chain/state/stategen:go_default_library", @@ -56,7 +55,6 @@ go_library( "//consensus-types/validator:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", - "//encoding/ssz/detect:go_default_library", "//network/forks:go_default_library", "//network/http:go_default_library", "//proto/eth/v1:go_default_library", @@ -154,7 +152,6 @@ go_test( "@com_github_stretchr_testify//mock:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", - "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_grpc//status:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", ], diff --git a/beacon-chain/rpc/eth/beacon/blinded_blocks.go b/beacon-chain/rpc/eth/beacon/blinded_blocks.go index 456f06d64b..69dfbb54c7 100644 --- a/beacon-chain/rpc/eth/beacon/blinded_blocks.go +++ b/beacon-chain/rpc/eth/beacon/blinded_blocks.go @@ -2,30 +2,20 @@ package beacon import ( "context" - "strings" "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/v4/api" - rpchelpers "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/helpers" - "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/prysm/v1alpha1/validator" - "github.com/prysmaticlabs/prysm/v4/config/params" consensus_types "github.com/prysmaticlabs/prysm/v4/consensus-types" - "github.com/prysmaticlabs/prysm/v4/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces" - "github.com/prysmaticlabs/prysm/v4/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/v4/encoding/ssz/detect" - "github.com/prysmaticlabs/prysm/v4/network/forks" ethpbv1 "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" ethpbv2 "github.com/prysmaticlabs/prysm/v4/proto/eth/v2" "github.com/prysmaticlabs/prysm/v4/proto/migration" - eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v4/runtime/version" "go.opencensus.io/trace" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/emptypb" ) // GetBlindedBlock retrieves blinded block for given block id. @@ -158,217 +148,6 @@ func (bs *Server) GetBlindedBlockSSZ(ctx context.Context, req *ethpbv1.BlockRequ return nil, status.Errorf(codes.Internal, "Unknown block type %T", blk) } -// SubmitBlindedBlock instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct -// and publish a `ReadOnlySignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions`. -// The beacon node should broadcast a newly constructed `ReadOnlySignedBeaconBlock` to the beacon network, -// to be included in the beacon chain. The beacon node is not required to validate the signed -// `ReadOnlyBeaconBlock`, and a successful response (20X) only indicates that the broadcast has been -// successful. The beacon node is expected to integrate the new block into its state, and -// therefore validate the block internally, however blocks which fail the validation are still -// broadcast but a different status code is returned (202). -func (bs *Server) SubmitBlindedBlock(ctx context.Context, req *ethpbv2.SignedBlindedBeaconBlockContentsContainer) (*emptypb.Empty, error) { - ctx, span := trace.StartSpan(ctx, "beacon.SubmitBlindedBlock") - defer span.End() - - if err := rpchelpers.ValidateSyncGRPC(ctx, bs.SyncChecker, bs.HeadFetcher, bs.TimeFetcher, bs.OptimisticModeFetcher); err != nil { - // We simply return the error because it's already a gRPC error. - return nil, err - } - - switch blkContainer := req.Message.(type) { - case *ethpbv2.SignedBlindedBeaconBlockContentsContainer_DenebContents: - if err := bs.submitBlindedDenebContents(ctx, blkContainer.DenebContents); err != nil { - return nil, err - } - case *ethpbv2.SignedBlindedBeaconBlockContentsContainer_CapellaBlock: - if err := bs.submitBlindedCapellaBlock(ctx, blkContainer.CapellaBlock.Message, blkContainer.CapellaBlock.Signature); err != nil { - return nil, err - } - case *ethpbv2.SignedBlindedBeaconBlockContentsContainer_BellatrixBlock: - if err := bs.submitBlindedBellatrixBlock(ctx, blkContainer.BellatrixBlock.Message, blkContainer.BellatrixBlock.Signature); err != nil { - return nil, err - } - case *ethpbv2.SignedBlindedBeaconBlockContentsContainer_Phase0Block: - if err := bs.submitPhase0Block(ctx, blkContainer.Phase0Block.Block, blkContainer.Phase0Block.Signature); err != nil { - return nil, err - } - case *ethpbv2.SignedBlindedBeaconBlockContentsContainer_AltairBlock: - if err := bs.submitAltairBlock(ctx, blkContainer.AltairBlock.Message, blkContainer.AltairBlock.Signature); err != nil { - return nil, err - } - default: - return nil, status.Errorf(codes.InvalidArgument, "Unsupported block container type %T", blkContainer) - } - - return &emptypb.Empty{}, nil -} - -// SubmitBlindedBlockSSZ instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct -// and publish a `ReadOnlySignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions`. -// The beacon node should broadcast a newly constructed `ReadOnlySignedBeaconBlock` to the beacon network, -// to be included in the beacon chain. The beacon node is not required to validate the signed -// `ReadOnlyBeaconBlock`, and a successful response (20X) only indicates that the broadcast has been -// successful. The beacon node is expected to integrate the new block into its state, and -// therefore validate the block internally, however blocks which fail the validation are still -// broadcast but a different status code is returned (202). -// -// The provided block must be SSZ-serialized. -func (bs *Server) SubmitBlindedBlockSSZ(ctx context.Context, req *ethpbv2.SSZContainer) (*emptypb.Empty, error) { - ctx, span := trace.StartSpan(ctx, "beacon.SubmitBlindedBlockSSZ") - defer span.End() - - if err := rpchelpers.ValidateSyncGRPC(ctx, bs.SyncChecker, bs.HeadFetcher, bs.TimeFetcher, bs.OptimisticModeFetcher); err != nil { - // We simply return the error because it's already a gRPC error. - return nil, err - } - - md, ok := metadata.FromIncomingContext(ctx) - if !ok { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not read"+api.VersionHeader+" header") - } - ver := md.Get(api.VersionHeader) - if len(ver) == 0 { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not read"+api.VersionHeader+" header") - } - schedule := forks.NewOrderedSchedule(params.BeaconConfig()) - forkVer, err := schedule.VersionForName(ver[0]) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not determine fork version: %v", err) - } - unmarshaler, err := detect.FromForkVersion(forkVer) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not create unmarshaler: %v", err) - } - - switch forkVer { - case bytesutil.ToBytes4(params.BeaconConfig().DenebForkVersion): - blkContent := ðpbv2.SignedBlindedBeaconBlockContentsDeneb{} - if err := blkContent.UnmarshalSSZ(req.Data); err != nil { - return &emptypb.Empty{}, status.Errorf(codes.InvalidArgument, "Could not unmarshal ssz signed blinded block contents: %v", err) - } - blindedBlock, err := migration.BlindedDenebToV1Alpha1SignedBlock(blkContent.SignedBlindedBlock) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "Could not convert signed blinded block to v1alpha1: %v", err) - } - block, err := blocks.NewSignedBeaconBlock(blindedBlock) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not init block: %v", err) - } - b, err := block.PbBlindedDenebBlock() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_BlindedDeneb{ - BlindedDeneb: ð.SignedBlindedBeaconBlockAndBlobsDeneb{ - SignedBlindedBlock: b, - SignedBlindedBlobSidecars: migration.SignedBlindedBlobsToV1Alpha1SignedBlindedBlobs(blkContent.SignedBlindedBlobSidecars), - }, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - - case bytesutil.ToBytes4(params.BeaconConfig().CapellaForkVersion): - block, err := unmarshaler.UnmarshalBlindedBeaconBlock(req.Data) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal request data into block: %v", err) - } - if !block.IsBlinded() { - return nil, status.Error(codes.InvalidArgument, "Submitted block is not blinded") - } - b, err := block.PbBlindedCapellaBlock() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_BlindedCapella{ - BlindedCapella: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - case bytesutil.ToBytes4(params.BeaconConfig().BellatrixForkVersion): - block, err := unmarshaler.UnmarshalBlindedBeaconBlock(req.Data) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal request data into block: %v", err) - } - if !block.IsBlinded() { - return nil, status.Error(codes.InvalidArgument, "Submitted block is not blinded") - } - b, err := block.PbBlindedBellatrixBlock() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_BlindedBellatrix{ - BlindedBellatrix: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - case bytesutil.ToBytes4(params.BeaconConfig().AltairForkVersion): - block, err := unmarshaler.UnmarshalBlindedBeaconBlock(req.Data) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal request data into block: %v", err) - } - b, err := block.PbAltairBlock() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Altair{ - Altair: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - case bytesutil.ToBytes4(params.BeaconConfig().GenesisForkVersion): - block, err := unmarshaler.UnmarshalBlindedBeaconBlock(req.Data) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal request data into block: %v", err) - } - b, err := block.PbPhase0Block() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Phase0{ - Phase0: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - default: - return &emptypb.Empty{}, status.Errorf(codes.InvalidArgument, "Unsupported fork %s", string(forkVer[:])) - } -} - func getBlindedBlockPhase0(blk interfaces.ReadOnlySignedBeaconBlock) (*ethpbv2.BlindedBlockResponse, error) { phase0Blk, err := blk.PbPhase0Block() if err != nil { @@ -848,73 +627,3 @@ func (bs *Server) getBlindedSSZBlockDeneb(ctx context.Context, blk interfaces.Re } return ðpbv2.SSZContainer{Version: ethpbv2.Version_DENEB, ExecutionOptimistic: isOptimistic, Data: sszData}, nil } - -func (bs *Server) submitBlindedBellatrixBlock(ctx context.Context, blindedBellatrixBlk *ethpbv2.BlindedBeaconBlockBellatrix, sig []byte) error { - b, err := migration.BlindedBellatrixToV1Alpha1SignedBlock(ðpbv2.SignedBlindedBeaconBlockBellatrix{ - Message: blindedBellatrixBlk, - Signature: sig, - }) - if err != nil { - return status.Errorf(codes.Internal, "Could not convert block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_BlindedBellatrix{ - BlindedBellatrix: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return status.Error(codes.InvalidArgument, err.Error()) - } - return status.Errorf(codes.Internal, "Could not propose blinded block: %v", err) - } - return nil -} - -func (bs *Server) submitBlindedCapellaBlock(ctx context.Context, blindedCapellaBlk *ethpbv2.BlindedBeaconBlockCapella, sig []byte) error { - b, err := migration.BlindedCapellaToV1Alpha1SignedBlock(ðpbv2.SignedBlindedBeaconBlockCapella{ - Message: blindedCapellaBlk, - Signature: sig, - }) - if err != nil { - return status.Errorf(codes.Internal, "Could not convert block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_BlindedCapella{ - BlindedCapella: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return status.Error(codes.InvalidArgument, err.Error()) - } - return status.Errorf(codes.Internal, "Could not propose blinded block: %v", err) - } - return nil -} - -func (bs *Server) submitBlindedDenebContents(ctx context.Context, blindedDenebContents *ethpbv2.SignedBlindedBeaconBlockContentsDeneb) error { - blk, err := migration.BlindedDenebToV1Alpha1SignedBlock(ðpbv2.SignedBlindedBeaconBlockDeneb{ - Message: blindedDenebContents.SignedBlindedBlock.Message, - Signature: blindedDenebContents.SignedBlindedBlock.Signature, - }) - if err != nil { - return status.Errorf(codes.Internal, "Could not get blinded block: %v", err) - } - blobs := migration.SignedBlindedBlobsToV1Alpha1SignedBlindedBlobs(blindedDenebContents.SignedBlindedBlobSidecars) - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_BlindedDeneb{ - BlindedDeneb: ð.SignedBlindedBeaconBlockAndBlobsDeneb{ - SignedBlindedBlock: blk, - SignedBlindedBlobSidecars: blobs, - }, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return status.Error(codes.InvalidArgument, err.Error()) - } - return status.Errorf(codes.Internal, "Could not propose blinded block: %v", err) - } - return nil -} diff --git a/beacon-chain/rpc/eth/beacon/blinded_blocks_test.go b/beacon-chain/rpc/eth/beacon/blinded_blocks_test.go index c60f2b8452..94acd9a026 100644 --- a/beacon-chain/rpc/eth/beacon/blinded_blocks_test.go +++ b/beacon-chain/rpc/eth/beacon/blinded_blocks_test.go @@ -4,24 +4,17 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/prysmaticlabs/prysm/v4/api" mock "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/testutil" - mockSync "github.com/prysmaticlabs/prysm/v4/beacon-chain/sync/initial-sync/testing" - fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams" - "github.com/prysmaticlabs/prysm/v4/config/params" "github.com/prysmaticlabs/prysm/v4/consensus-types/blocks" ethpbv1 "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" ethpbv2 "github.com/prysmaticlabs/prysm/v4/proto/eth/v2" "github.com/prysmaticlabs/prysm/v4/proto/migration" "github.com/prysmaticlabs/prysm/v4/testing/assert" - mock2 "github.com/prysmaticlabs/prysm/v4/testing/mock" "github.com/prysmaticlabs/prysm/v4/testing/require" "github.com/prysmaticlabs/prysm/v4/testing/util" "google.golang.org/grpc" - "google.golang.org/grpc/metadata" ) func TestServer_GetBlindedBlock(t *testing.T) { @@ -347,273 +340,3 @@ func TestServer_GetBlindedBlockSSZ(t *testing.T) { assert.Equal(t, false, resp.Finalized) }) } - -func TestServer_SubmitBlindedBlockSSZ(t *testing.T) { - ctrl := gomock.NewController(t) - ctx := context.Background() - - t.Run("Phase 0", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBeaconBlock() - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "phase0") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlindedBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Altair", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBeaconBlockAltair() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().AltairForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "altair") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlindedBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Bellatrix", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBlindedBeaconBlockBellatrix() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().BellatrixForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "bellatrix") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlindedBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Bellatrix full", func(t *testing.T) { - server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBeaconBlockBellatrix() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().BellatrixForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "bellatrix") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlindedBlockSSZ(sszCtx, blockReq) - assert.NotNil(t, err) - }) - t.Run("Capella", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBlindedBeaconBlockCapella() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().CapellaForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "capella") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlindedBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Capella full", func(t *testing.T) { - server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBeaconBlockCapella() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().CapellaForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "capella") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlindedBlockSSZ(sszCtx, blockReq) - assert.NotNil(t, err) - }) - t.Run("Deneb", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b, err := util.NewBlindedBeaconBlockContentsDeneb(fieldparams.MaxBlobsPerBlock) - require.NoError(t, err) - // TODO: replace when deneb fork epoch is known - b.SignedBlindedBlock.Message.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().CapellaForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "deneb") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlindedBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Deneb full", func(t *testing.T) { - server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b, err := util.NewBeaconBlockContentsDeneb(fieldparams.MaxBlobsPerBlock) - require.NoError(t, err) - // TODO: replace when deneb fork epoch is known - b.SignedBlock.Message.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().CapellaForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "deneb") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlindedBlockSSZ(sszCtx, blockReq) - assert.NotNil(t, err) - }) - t.Run("sync not ready", func(t *testing.T) { - chainService := &mock.ChainService{} - v1Server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: true}, - HeadFetcher: chainService, - TimeFetcher: chainService, - OptimisticModeFetcher: chainService, - } - _, err := v1Server.SubmitBlindedBlockSSZ(context.Background(), nil) - require.ErrorContains(t, "Syncing to latest head", err) - }) -} - -func TestSubmitBlindedBlock(t *testing.T) { - ctrl := gomock.NewController(t) - - t.Run("Phase 0", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBlindedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBlindedBeaconBlockContentsContainer_Phase0Block{Phase0Block: ðpbv1.SignedBeaconBlock{}}, - } - _, err := server.SubmitBlindedBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("Altair", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBlindedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBlindedBeaconBlockContentsContainer_AltairBlock{AltairBlock: ðpbv2.SignedBeaconBlockAltair{}}, - } - _, err := server.SubmitBlindedBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("Bellatrix", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBlindedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBlindedBeaconBlockContentsContainer_BellatrixBlock{BellatrixBlock: ðpbv2.SignedBlindedBeaconBlockBellatrix{}}, - } - _, err := server.SubmitBlindedBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("Capella", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBlindedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBlindedBeaconBlockContentsContainer_CapellaBlock{CapellaBlock: ðpbv2.SignedBlindedBeaconBlockCapella{}}, - } - _, err := server.SubmitBlindedBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("Deneb", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBlindedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBlindedBeaconBlockContentsContainer_DenebContents{ - DenebContents: ðpbv2.SignedBlindedBeaconBlockContentsDeneb{ - SignedBlindedBlock: ðpbv2.SignedBlindedBeaconBlockDeneb{}, - SignedBlindedBlobSidecars: []*ethpbv2.SignedBlindedBlobSidecar{}, - }, - }, - } - _, err := server.SubmitBlindedBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("sync not ready", func(t *testing.T) { - chainService := &mock.ChainService{} - v1Server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: true}, - HeadFetcher: chainService, - TimeFetcher: chainService, - OptimisticModeFetcher: chainService, - } - _, err := v1Server.SubmitBlindedBlock(context.Background(), nil) - require.ErrorContains(t, "Syncing to latest head", err) - }) -} diff --git a/beacon-chain/rpc/eth/beacon/blocks.go b/beacon-chain/rpc/eth/beacon/blocks.go index 2d5e8e502d..39003a29ea 100644 --- a/beacon-chain/rpc/eth/beacon/blocks.go +++ b/beacon-chain/rpc/eth/beacon/blocks.go @@ -3,7 +3,6 @@ package beacon import ( "context" "fmt" - "strings" "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" @@ -11,18 +10,13 @@ import ( "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers" rpchelpers "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/helpers" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/lookup" - "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/prysm/v1alpha1/validator" "github.com/prysmaticlabs/prysm/v4/config/params" consensus_types "github.com/prysmaticlabs/prysm/v4/consensus-types" "github.com/prysmaticlabs/prysm/v4/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces" - "github.com/prysmaticlabs/prysm/v4/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/v4/encoding/ssz/detect" - "github.com/prysmaticlabs/prysm/v4/network/forks" ethpbv1 "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" ethpbv2 "github.com/prysmaticlabs/prysm/v4/proto/eth/v2" "github.com/prysmaticlabs/prysm/v4/proto/migration" - eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v4/runtime/version" "github.com/prysmaticlabs/prysm/v4/time/slots" "go.opencensus.io/trace" @@ -30,7 +24,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/emptypb" ) var ( @@ -79,210 +72,6 @@ func (bs *Server) GetWeakSubjectivity(ctx context.Context, _ *empty.Empty) (*eth }, nil } -// SubmitBlock instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be -// included in the beacon chain. The beacon node is not required to validate the signed ReadOnlyBeaconBlock, and a successful -// response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the -// new block into its state, and therefore validate the block internally, however blocks which fail the validation are -// still broadcast but a different status code is returned (202). -func (bs *Server) SubmitBlock(ctx context.Context, req *ethpbv2.SignedBeaconBlockContentsContainer) (*emptypb.Empty, error) { - ctx, span := trace.StartSpan(ctx, "beacon.SubmitBlock") - defer span.End() - - if err := rpchelpers.ValidateSyncGRPC(ctx, bs.SyncChecker, bs.HeadFetcher, bs.TimeFetcher, bs.OptimisticModeFetcher); err != nil { - // We simply return the error because it's already a gRPC error. - return nil, err - } - - switch blkContainer := req.Message.(type) { - case *ethpbv2.SignedBeaconBlockContentsContainer_Phase0Block: - if err := bs.submitPhase0Block(ctx, blkContainer.Phase0Block.Block, blkContainer.Phase0Block.Signature); err != nil { - return nil, err - } - case *ethpbv2.SignedBeaconBlockContentsContainer_AltairBlock: - if err := bs.submitAltairBlock(ctx, blkContainer.AltairBlock.Message, blkContainer.AltairBlock.Signature); err != nil { - return nil, err - } - case *ethpbv2.SignedBeaconBlockContentsContainer_BellatrixBlock: - if err := bs.submitBellatrixBlock(ctx, blkContainer.BellatrixBlock.Message, blkContainer.BellatrixBlock.Signature); err != nil { - return nil, err - } - case *ethpbv2.SignedBeaconBlockContentsContainer_CapellaBlock: - if err := bs.submitCapellaBlock(ctx, blkContainer.CapellaBlock.Message, blkContainer.CapellaBlock.Signature); err != nil { - return nil, err - } - case *ethpbv2.SignedBeaconBlockContentsContainer_DenebContents: - if err := bs.submitDenebContents(ctx, blkContainer.DenebContents); err != nil { - return nil, err - } - default: - return nil, status.Errorf(codes.InvalidArgument, "Unsupported block container type %T", blkContainer) - } - - return &emptypb.Empty{}, nil -} - -// SubmitBlockSSZ instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be -// included in the beacon chain. The beacon node is not required to validate the signed ReadOnlyBeaconBlock, and a successful -// response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the -// new block into its state, and therefore validate the block internally, however blocks which fail the validation are -// still broadcast but a different status code is returned (202). -// -// The provided block must be SSZ-serialized. -func (bs *Server) SubmitBlockSSZ(ctx context.Context, req *ethpbv2.SSZContainer) (*emptypb.Empty, error) { - ctx, span := trace.StartSpan(ctx, "beacon.SubmitBlockSSZ") - defer span.End() - - if err := rpchelpers.ValidateSyncGRPC(ctx, bs.SyncChecker, bs.HeadFetcher, bs.TimeFetcher, bs.OptimisticModeFetcher); err != nil { - // We simply return the error because it's already a gRPC error. - return nil, err - } - - md, ok := metadata.FromIncomingContext(ctx) - if !ok { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not read "+api.VersionHeader+" header") - } - ver := md.Get(api.VersionHeader) - if len(ver) == 0 { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not read "+api.VersionHeader+" header") - } - schedule := forks.NewOrderedSchedule(params.BeaconConfig()) - forkVer, err := schedule.VersionForName(ver[0]) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not determine fork version: %v", err) - } - unmarshaler, err := detect.FromForkVersion(forkVer) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not create unmarshaler: %v", err) - } - - switch forkVer { - case bytesutil.ToBytes4(params.BeaconConfig().DenebForkVersion): - blkContent := ðpbv2.SignedBeaconBlockContentsDeneb{} - if err := blkContent.UnmarshalSSZ(req.Data); err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal ssz block contents: %v", err) - } - v1block, err := migration.DenebToV1Alpha1SignedBlock(blkContent.SignedBlock) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "Submitted block is not valid: %v", err) - } - block, err := blocks.NewSignedBeaconBlock(v1block) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not init block: %v", err) - } - b, err := block.PbDenebBlock() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Deneb{ - Deneb: ð.SignedBeaconBlockAndBlobsDeneb{ - Block: b, - Blobs: migration.SignedBlobsToV1Alpha1SignedBlobs(blkContent.SignedBlobSidecars), - }, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - case bytesutil.ToBytes4(params.BeaconConfig().CapellaForkVersion): - block, err := unmarshaler.UnmarshalBeaconBlock(req.Data) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal request data into block: %v", err) - } - if block.IsBlinded() { - return nil, status.Error(codes.InvalidArgument, "Submitted block is blinded") - } - b, err := block.PbCapellaBlock() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Capella{ - Capella: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - case bytesutil.ToBytes4(params.BeaconConfig().BellatrixForkVersion): - block, err := unmarshaler.UnmarshalBeaconBlock(req.Data) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal request data into block: %v", err) - } - if block.IsBlinded() { - return nil, status.Error(codes.InvalidArgument, "Submitted block is blinded") - } - b, err := block.PbBellatrixBlock() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Bellatrix{ - Bellatrix: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - case bytesutil.ToBytes4(params.BeaconConfig().AltairForkVersion): - block, err := unmarshaler.UnmarshalBeaconBlock(req.Data) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal request data into block: %v", err) - } - b, err := block.PbAltairBlock() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Altair{ - Altair: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - case bytesutil.ToBytes4(params.BeaconConfig().GenesisForkVersion): - block, err := unmarshaler.UnmarshalBeaconBlock(req.Data) - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not unmarshal request data into block: %v", err) - } - b, err := block.PbPhase0Block() - if err != nil { - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Phase0{ - Phase0: b, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return &emptypb.Empty{}, status.Error(codes.InvalidArgument, err.Error()) - } - return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return &emptypb.Empty{}, nil - default: - return &emptypb.Empty{}, status.Errorf(codes.InvalidArgument, "Unsupported fork %s", string(forkVer[:])) - } -} - // GetBlock retrieves block details for given block ID. // DEPRECATED: please use GetBlockV2 instead func (bs *Server) GetBlock(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv1.BlockResponse, error) { @@ -1033,105 +822,3 @@ func (bs *Server) getSSZBlockDeneb(ctx context.Context, blk interfaces.ReadOnlyS } return ðpbv2.SSZContainer{Version: ethpbv2.Version_DENEB, ExecutionOptimistic: isOptimistic, Data: sszData}, nil } - -func (bs *Server) submitPhase0Block(ctx context.Context, phase0Blk *ethpbv1.BeaconBlock, sig []byte) error { - v1alpha1Blk, err := migration.V1ToV1Alpha1SignedBlock(ðpbv1.SignedBeaconBlock{Block: phase0Blk, Signature: sig}) - if err != nil { - return status.Errorf(codes.InvalidArgument, "Could not convert block: %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Phase0{ - Phase0: v1alpha1Blk, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return status.Error(codes.InvalidArgument, err.Error()) - } - return status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return nil -} - -func (bs *Server) submitAltairBlock(ctx context.Context, altairBlk *ethpbv2.BeaconBlockAltair, sig []byte) error { - v1alpha1Blk, err := migration.AltairToV1Alpha1SignedBlock(ðpbv2.SignedBeaconBlockAltair{Message: altairBlk, Signature: sig}) - if err != nil { - return status.Errorf(codes.InvalidArgument, "Could not convert block %v", err) - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Altair{ - Altair: v1alpha1Blk, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return status.Error(codes.InvalidArgument, err.Error()) - } - return status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return nil -} - -func (bs *Server) submitBellatrixBlock(ctx context.Context, bellatrixBlk *ethpbv2.BeaconBlockBellatrix, sig []byte) error { - v1alpha1Blk, err := migration.BellatrixToV1Alpha1SignedBlock(ðpbv2.SignedBeaconBlockBellatrix{Message: bellatrixBlk, Signature: sig}) - if err != nil { - return status.Errorf(codes.InvalidArgument, "Could not convert block to v1 block") - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Bellatrix{ - Bellatrix: v1alpha1Blk, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return status.Error(codes.InvalidArgument, err.Error()) - } - return status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return nil -} - -func (bs *Server) submitCapellaBlock(ctx context.Context, capellaBlk *ethpbv2.BeaconBlockCapella, sig []byte) error { - v1alpha1Blk, err := migration.CapellaToV1Alpha1SignedBlock(ðpbv2.SignedBeaconBlockCapella{Message: capellaBlk, Signature: sig}) - if err != nil { - return status.Errorf(codes.InvalidArgument, "Could not convert block to v1 block") - } - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Capella{ - Capella: v1alpha1Blk, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return status.Error(codes.InvalidArgument, err.Error()) - } - return status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return nil -} - -func (bs *Server) submitDenebContents(ctx context.Context, denebContents *ethpbv2.SignedBeaconBlockContentsDeneb) error { - blk, err := migration.DenebToV1Alpha1SignedBlock(ðpbv2.SignedBeaconBlockDeneb{ - Message: denebContents.SignedBlock.Message, - Signature: denebContents.SignedBlock.Signature, - }) - if err != nil { - return status.Errorf(codes.Internal, "Could not get block: %v", err) - } - blobs := migration.SignedBlobsToV1Alpha1SignedBlobs(denebContents.SignedBlobSidecars) - _, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ - Block: ð.GenericSignedBeaconBlock_Deneb{ - Deneb: ð.SignedBeaconBlockAndBlobsDeneb{ - Block: blk, - Blobs: blobs, - }, - }, - }) - if err != nil { - if strings.Contains(err.Error(), validator.CouldNotDecodeBlock) { - return status.Error(codes.InvalidArgument, err.Error()) - } - return status.Errorf(codes.Internal, "Could not propose block: %v", err) - } - return nil -} diff --git a/beacon-chain/rpc/eth/beacon/blocks_test.go b/beacon-chain/rpc/eth/beacon/blocks_test.go index 0b6087fda5..cceaf82b64 100644 --- a/beacon-chain/rpc/eth/beacon/blocks_test.go +++ b/beacon-chain/rpc/eth/beacon/blocks_test.go @@ -4,16 +4,11 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/prysmaticlabs/go-bitfield" - "github.com/prysmaticlabs/prysm/v4/api" mock "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing" "github.com/prysmaticlabs/prysm/v4/beacon-chain/db" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/testutil" - mockSync "github.com/prysmaticlabs/prysm/v4/beacon-chain/sync/initial-sync/testing" - fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams" - "github.com/prysmaticlabs/prysm/v4/config/params" "github.com/prysmaticlabs/prysm/v4/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces" "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" @@ -23,11 +18,9 @@ import ( "github.com/prysmaticlabs/prysm/v4/proto/migration" ethpbalpha "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v4/testing/assert" - mock2 "github.com/prysmaticlabs/prysm/v4/testing/mock" "github.com/prysmaticlabs/prysm/v4/testing/require" "github.com/prysmaticlabs/prysm/v4/testing/util" "google.golang.org/grpc" - "google.golang.org/grpc/metadata" ) func fillDBTestBlocks(ctx context.Context, t *testing.T, beaconDB db.Database) (*ethpbalpha.SignedBeaconBlock, []*ethpbalpha.BeaconBlockContainer) { @@ -66,276 +59,6 @@ func fillDBTestBlocks(ctx context.Context, t *testing.T, beaconDB db.Database) ( return genBlk, blkContainers } -func TestServer_SubmitBlock(t *testing.T) { - ctrl := gomock.NewController(t) - - t.Run("Phase 0", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBeaconBlockContentsContainer_Phase0Block{Phase0Block: ðpbv1.SignedBeaconBlock{}}, - } - _, err := server.SubmitBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("Altair", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBeaconBlockContentsContainer_AltairBlock{AltairBlock: ðpbv2.SignedBeaconBlockAltair{}}, - } - _, err := server.SubmitBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("Bellatrix", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBeaconBlockContentsContainer_BellatrixBlock{BellatrixBlock: ðpbv2.SignedBeaconBlockBellatrix{}}, - } - _, err := server.SubmitBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("Capella", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBeaconBlockContentsContainer_CapellaBlock{CapellaBlock: ðpbv2.SignedBeaconBlockCapella{}}, - } - _, err := server.SubmitBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("Deneb", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - blockReq := ðpbv2.SignedBeaconBlockContentsContainer{ - Message: ðpbv2.SignedBeaconBlockContentsContainer_DenebContents{ - DenebContents: ðpbv2.SignedBeaconBlockContentsDeneb{ - SignedBlock: ðpbv2.SignedBeaconBlockDeneb{}, - SignedBlobSidecars: []*ethpbv2.SignedBlobSidecar{}, - }, - }, - } - _, err := server.SubmitBlock(context.Background(), blockReq) - assert.NoError(t, err) - }) - t.Run("sync not ready", func(t *testing.T) { - chainService := &mock.ChainService{} - v1Server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: true}, - HeadFetcher: chainService, - TimeFetcher: chainService, - OptimisticModeFetcher: chainService, - } - _, err := v1Server.SubmitBlock(context.Background(), nil) - require.ErrorContains(t, "Syncing to latest head", err) - }) -} - -func TestServer_SubmitBlockSSZ(t *testing.T) { - ctrl := gomock.NewController(t) - ctx := context.Background() - - t.Run("Phase 0", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBeaconBlock() - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "phase0") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Altair", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBeaconBlockAltair() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().AltairForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "altair") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Bellatrix", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBeaconBlockBellatrix() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().BellatrixForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "bellatrix") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Bellatrix blinded", func(t *testing.T) { - server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBlindedBeaconBlockBellatrix() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().BellatrixForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "bellatrix") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlockSSZ(sszCtx, blockReq) - assert.NotNil(t, err) - }) - t.Run("Capella", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBeaconBlockCapella() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().CapellaForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "capella") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Capella blinded", func(t *testing.T) { - server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b := util.NewBlindedBeaconBlockCapella() - b.Block.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().CapellaForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "capella") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlockSSZ(sszCtx, blockReq) - assert.NotNil(t, err) - }) - t.Run("Deneb", func(t *testing.T) { - v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) - v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), gomock.Any()) - server := &Server{ - V1Alpha1ValidatorServer: v1alpha1Server, - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b, err := util.NewBeaconBlockContentsDeneb(fieldparams.MaxBlobsPerBlock) - require.NoError(t, err) - // TODO: update to deneb fork epoch - b.SignedBlock.Message.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().CapellaForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "deneb") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlockSSZ(sszCtx, blockReq) - assert.NoError(t, err) - }) - t.Run("Deneb blinded", func(t *testing.T) { - server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: false}, - } - - b, err := util.NewBlindedBeaconBlockContentsDeneb(fieldparams.MaxBlobsPerBlock) - require.NoError(t, err) - // TODO: update to deneb fork epoch - b.SignedBlindedBlock.Message.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().CapellaForkEpoch)) - ssz, err := b.MarshalSSZ() - require.NoError(t, err) - blockReq := ðpbv2.SSZContainer{ - Data: ssz, - } - md := metadata.MD{} - md.Set(api.VersionHeader, "deneb") - sszCtx := metadata.NewIncomingContext(ctx, md) - _, err = server.SubmitBlockSSZ(sszCtx, blockReq) - assert.NotNil(t, err) - }) - t.Run("sync not ready", func(t *testing.T) { - chainService := &mock.ChainService{} - v1Server := &Server{ - SyncChecker: &mockSync.Sync{IsSyncing: true}, - HeadFetcher: chainService, - TimeFetcher: chainService, - OptimisticModeFetcher: chainService, - } - _, err := v1Server.SubmitBlockSSZ(context.Background(), nil) - require.ErrorContains(t, "Syncing to latest head", err) - }) -} - func TestServer_GetBlock(t *testing.T) { ctx := context.Background() b := util.NewBeaconBlock() diff --git a/beacon-chain/rpc/eth/beacon/handlers.go b/beacon-chain/rpc/eth/beacon/handlers.go index 375f8d6be0..4f0b10f2c0 100644 --- a/beacon-chain/rpc/eth/beacon/handlers.go +++ b/beacon-chain/rpc/eth/beacon/handlers.go @@ -38,6 +38,28 @@ const ( broadcastValidationConsensusAndEquivocation = "consensus_and_equivocation" ) +// PublishBlindedBlock instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct +// and publish a SignedBeaconBlock by swapping out the transactions_root for the corresponding full list of `transactions`. +// The beacon node should broadcast a newly constructed SignedBeaconBlock to the beacon network, to be included in the +// beacon chain. The beacon node is not required to validate the signed BeaconBlock, and a successful response (20X) +// only indicates that the broadcast has been successful. The beacon node is expected to integrate the new block into +// its state, and therefore validate the block internally, however blocks which fail the validation are still broadcast +// but a different status code is returned (202). Pre-Bellatrix, this endpoint will accept a SignedBeaconBlock. After +// Deneb, this additionally instructs the beacon node to broadcast all given signed blobs. +func (s *Server) PublishBlindedBlock(w http.ResponseWriter, r *http.Request) { + ctx, span := trace.StartSpan(r.Context(), "beacon.PublishBlindedBlock") + defer span.End() + if shared.IsSyncing(r.Context(), w, s.SyncChecker, s.HeadFetcher, s.TimeFetcher, s.OptimisticModeFetcher) { + return + } + isSSZ := http2.SszRequested(r) + if isSSZ { + s.publishBlindedBlockSSZ(ctx, w, r) + } else { + s.publishBlindedBlock(ctx, w, r) + } +} + // PublishBlindedBlockV2 instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct and publish a // `SignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions`. // The beacon node should broadcast a newly constructed `SignedBeaconBlock` to the beacon network, @@ -46,23 +68,24 @@ const ( // successful. The beacon node is expected to integrate the new block into its state, and // therefore validate the block internally, however blocks which fail the validation are still // broadcast but a different status code is returned (202). Pre-Bellatrix, this endpoint will accept -// a `SignedBeaconBlock`. The broadcast behaviour may be adjusted via the `broadcast_validation` +// a `SignedBeaconBlock`. After Deneb, this additionally instructs the beacon node to broadcast all given signed blobs. +// The broadcast behaviour may be adjusted via the `broadcast_validation` // query parameter. -func (bs *Server) PublishBlindedBlockV2(w http.ResponseWriter, r *http.Request) { +func (s *Server) PublishBlindedBlockV2(w http.ResponseWriter, r *http.Request) { ctx, span := trace.StartSpan(r.Context(), "beacon.PublishBlindedBlockV2") defer span.End() - if shared.IsSyncing(r.Context(), w, bs.SyncChecker, bs.HeadFetcher, bs.TimeFetcher, bs.OptimisticModeFetcher) { + if shared.IsSyncing(r.Context(), w, s.SyncChecker, s.HeadFetcher, s.TimeFetcher, s.OptimisticModeFetcher) { return } - isSSZ, err := http2.SszRequested(r) - if isSSZ && err == nil { - publishBlindedBlockV2SSZ(ctx, bs, w, r) + isSSZ := http2.SszRequested(r) + if isSSZ { + s.publishBlindedBlockSSZ(ctx, w, r) } else { - publishBlindedBlockV2(ctx, bs, w, r) + s.publishBlindedBlock(ctx, w, r) } } -func publishBlindedBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWriter, r *http.Request) { +func (s *Server) publishBlindedBlockSSZ(ctx context.Context, w http.ResponseWriter, r *http.Request) { body, err := io.ReadAll(r.Body) if err != nil { http2.HandleError(w, "Could not read request body: "+err.Error(), http.StatusInternalServerError) @@ -75,11 +98,11 @@ func publishBlindedBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWr BlindedDeneb: denebBlockContents, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } capellaBlock := ð.SignedBlindedBeaconBlockCapella{} @@ -89,11 +112,11 @@ func publishBlindedBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWr BlindedCapella: capellaBlock, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } bellatrixBlock := ð.SignedBlindedBeaconBlockBellatrix{} @@ -103,11 +126,11 @@ func publishBlindedBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWr BlindedBellatrix: bellatrixBlock, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } @@ -119,11 +142,11 @@ func publishBlindedBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWr Altair: altairBlock, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } phase0Block := ð.SignedBeaconBlock{} @@ -133,17 +156,17 @@ func publishBlindedBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWr Phase0: phase0Block, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } http2.HandleError(w, "Body does not represent a valid block type", http.StatusBadRequest) } -func publishBlindedBlockV2(ctx context.Context, bs *Server, w http.ResponseWriter, r *http.Request) { +func (s *Server) publishBlindedBlock(ctx context.Context, w http.ResponseWriter, r *http.Request) { body, err := io.ReadAll(r.Body) if err != nil { http2.HandleError(w, "Could not read request body", http.StatusInternalServerError) @@ -155,11 +178,11 @@ func publishBlindedBlockV2(ctx context.Context, bs *Server, w http.ResponseWrite if err = unmarshalStrict(body, &denebBlockContents); err == nil { consensusBlock, err := denebBlockContents.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Deneb) { @@ -171,11 +194,11 @@ func publishBlindedBlockV2(ctx context.Context, bs *Server, w http.ResponseWrite if err = unmarshalStrict(body, &capellaBlock); err == nil { consensusBlock, err := capellaBlock.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Capella) { @@ -187,11 +210,11 @@ func publishBlindedBlockV2(ctx context.Context, bs *Server, w http.ResponseWrite if err = unmarshalStrict(body, &bellatrixBlock); err == nil { consensusBlock, err := bellatrixBlock.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Bellatrix) { @@ -202,11 +225,11 @@ func publishBlindedBlockV2(ctx context.Context, bs *Server, w http.ResponseWrite if err = unmarshalStrict(body, &altairBlock); err == nil { consensusBlock, err := altairBlock.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Altair) { @@ -217,11 +240,11 @@ func publishBlindedBlockV2(ctx context.Context, bs *Server, w http.ResponseWrite if err = unmarshalStrict(body, &phase0Block); err == nil { consensusBlock, err := phase0Block.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Phase0) { @@ -234,29 +257,52 @@ func publishBlindedBlockV2(ctx context.Context, bs *Server, w http.ResponseWrite http2.HandleError(w, "Body does not represent a valid block type: "+blockVersionError, http.StatusBadRequest) } +// PublishBlock instructs the beacon node to broadcast a newly signed beacon block to the beacon network, +// to be included in the beacon chain. A success response (20x) indicates that the block +// passed gossip validation and was successfully broadcast onto the network. +// The beacon node is also expected to integrate the block into state, but may broadcast it +// before doing so, so as to aid timely delivery of the block. Should the block fail full +// validation, a separate success response code (202) is used to indicate that the block was +// successfully broadcast but failed integration. After Deneb, this additionally instructs the +// beacon node to broadcast all given signed blobs. +func (s *Server) PublishBlock(w http.ResponseWriter, r *http.Request) { + ctx, span := trace.StartSpan(r.Context(), "beacon.PublishBlock") + defer span.End() + if shared.IsSyncing(r.Context(), w, s.SyncChecker, s.HeadFetcher, s.TimeFetcher, s.OptimisticModeFetcher) { + return + } + isSSZ := http2.SszRequested(r) + if isSSZ { + s.publishBlockSSZ(ctx, w, r) + } else { + s.publishBlock(ctx, w, r) + } +} + // PublishBlockV2 instructs the beacon node to broadcast a newly signed beacon block to the beacon network, // to be included in the beacon chain. A success response (20x) indicates that the block // passed gossip validation and was successfully broadcast onto the network. // The beacon node is also expected to integrate the block into the state, but may broadcast it // before doing so, so as to aid timely delivery of the block. Should the block fail full // validation, a separate success response code (202) is used to indicate that the block was -// successfully broadcast but failed integration. The broadcast behaviour may be adjusted via the +// successfully broadcast but failed integration. After Deneb, this additionally instructs the beacon node to +// broadcast all given signed blobs. The broadcast behaviour may be adjusted via the // `broadcast_validation` query parameter. -func (bs *Server) PublishBlockV2(w http.ResponseWriter, r *http.Request) { +func (s *Server) PublishBlockV2(w http.ResponseWriter, r *http.Request) { ctx, span := trace.StartSpan(r.Context(), "beacon.PublishBlockV2") defer span.End() - if shared.IsSyncing(r.Context(), w, bs.SyncChecker, bs.HeadFetcher, bs.TimeFetcher, bs.OptimisticModeFetcher) { + if shared.IsSyncing(r.Context(), w, s.SyncChecker, s.HeadFetcher, s.TimeFetcher, s.OptimisticModeFetcher) { return } - isSSZ, err := http2.SszRequested(r) - if isSSZ && err == nil { - publishBlockV2SSZ(ctx, bs, w, r) + isSSZ := http2.SszRequested(r) + if isSSZ { + s.publishBlockSSZ(ctx, w, r) } else { - publishBlockV2(ctx, bs, w, r) + s.publishBlock(ctx, w, r) } } -func publishBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWriter, r *http.Request) { +func (s *Server) publishBlockSSZ(ctx context.Context, w http.ResponseWriter, r *http.Request) { body, err := io.ReadAll(r.Body) if err != nil { http2.HandleError(w, "Could not read request body", http.StatusInternalServerError) @@ -269,11 +315,11 @@ func publishBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWriter, r Deneb: denebBlockContents, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } capellaBlock := ð.SignedBeaconBlockCapella{} @@ -283,11 +329,11 @@ func publishBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWriter, r Capella: capellaBlock, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } bellatrixBlock := ð.SignedBeaconBlockBellatrix{} @@ -297,11 +343,11 @@ func publishBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWriter, r Bellatrix: bellatrixBlock, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } altairBlock := ð.SignedBeaconBlockAltair{} @@ -311,11 +357,11 @@ func publishBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWriter, r Altair: altairBlock, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } phase0Block := ð.SignedBeaconBlock{} @@ -325,17 +371,17 @@ func publishBlockV2SSZ(ctx context.Context, bs *Server, w http.ResponseWriter, r Phase0: phase0Block, }, } - if err = bs.validateBroadcast(ctx, r, genericBlock); err != nil { + if err = s.validateBroadcast(ctx, r, genericBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, genericBlock) + s.proposeBlock(ctx, w, genericBlock) return } http2.HandleError(w, "Body does not represent a valid block type", http.StatusBadRequest) } -func publishBlockV2(ctx context.Context, bs *Server, w http.ResponseWriter, r *http.Request) { +func (s *Server) publishBlock(ctx context.Context, w http.ResponseWriter, r *http.Request) { body, err := io.ReadAll(r.Body) if err != nil { http2.HandleError(w, "Could not read request body", http.StatusInternalServerError) @@ -347,11 +393,11 @@ func publishBlockV2(ctx context.Context, bs *Server, w http.ResponseWriter, r *h if err = unmarshalStrict(body, &denebBlockContents); err == nil { consensusBlock, err := denebBlockContents.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Deneb) { @@ -362,11 +408,11 @@ func publishBlockV2(ctx context.Context, bs *Server, w http.ResponseWriter, r *h if err = unmarshalStrict(body, &capellaBlock); err == nil { consensusBlock, err := capellaBlock.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Capella) { @@ -377,11 +423,11 @@ func publishBlockV2(ctx context.Context, bs *Server, w http.ResponseWriter, r *h if err = unmarshalStrict(body, &bellatrixBlock); err == nil { consensusBlock, err := bellatrixBlock.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Bellatrix) { @@ -392,11 +438,11 @@ func publishBlockV2(ctx context.Context, bs *Server, w http.ResponseWriter, r *h if err = unmarshalStrict(body, &altairBlock); err == nil { consensusBlock, err := altairBlock.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Altair) { @@ -407,11 +453,11 @@ func publishBlockV2(ctx context.Context, bs *Server, w http.ResponseWriter, r *h if err = unmarshalStrict(body, &phase0Block); err == nil { consensusBlock, err := phase0Block.ToGeneric() if err == nil { - if err = bs.validateBroadcast(ctx, r, consensusBlock); err != nil { + if err = s.validateBroadcast(ctx, r, consensusBlock); err != nil { http2.HandleError(w, err.Error(), http.StatusBadRequest) return } - bs.proposeBlock(ctx, w, consensusBlock) + s.proposeBlock(ctx, w, consensusBlock) return } if versionHeader == version.String(version.Phase0) { diff --git a/beacon-chain/rpc/eth/beacon/handlers_test.go b/beacon-chain/rpc/eth/beacon/handlers_test.go index 412761bd15..55b65fe58a 100644 --- a/beacon-chain/rpc/eth/beacon/handlers_test.go +++ b/beacon-chain/rpc/eth/beacon/handlers_test.go @@ -43,6 +43,518 @@ import ( "github.com/stretchr/testify/mock" ) +func TestPublishBlock(t *testing.T) { + ctrl := gomock.NewController(t) + + t.Run("Phase 0", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_Phase0) + converted, err := shared.BeaconBlockFromConsensus(block.Phase0.Block) + require.NoError(t, err) + var signedblock *shared.SignedBeaconBlock + err = json.Unmarshal([]byte(rpctesting.Phase0Block), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.Phase0Block))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Altair", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_Altair) + converted, err := shared.BeaconBlockAltairFromConsensus(block.Altair.Block) + require.NoError(t, err) + var signedblock *shared.SignedBeaconBlockAltair + err = json.Unmarshal([]byte(rpctesting.AltairBlock), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.AltairBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Bellatrix", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_Bellatrix) + converted, err := shared.BeaconBlockBellatrixFromConsensus(block.Bellatrix.Block) + require.NoError(t, err) + var signedblock *shared.SignedBeaconBlockBellatrix + err = json.Unmarshal([]byte(rpctesting.BellatrixBlock), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BellatrixBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Capella", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_Capella) + converted, err := shared.BeaconBlockCapellaFromConsensus(block.Capella.Block) + require.NoError(t, err) + var signedblock *shared.SignedBeaconBlockCapella + err = json.Unmarshal([]byte(rpctesting.CapellaBlock), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.CapellaBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Deneb", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_Deneb) + converted, err := shared.BeaconBlockDenebFromConsensus(block.Deneb.Block.Block) + require.NoError(t, err) + var signedblock *shared.SignedBeaconBlockContentsDeneb + err = json.Unmarshal([]byte(rpctesting.DenebBlockContents), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.SignedBlock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.DenebBlockContents))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("invalid block", func(t *testing.T) { + server := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BlindedBellatrixBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusBadRequest, writer.Code) + assert.Equal(t, true, strings.Contains(writer.Body.String(), "please add the api header")) + assert.Equal(t, true, strings.Contains(writer.Body.String(), "Body does not represent a valid block type")) + }) + t.Run("invalid block with version header", func(t *testing.T) { + server := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BadCapellaBlock))) + request.Header.Set(api.VersionHeader, version.String(version.Capella)) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusBadRequest, writer.Code) + body := writer.Body.String() + assert.Equal(t, true, strings.Contains(body, "Body does not represent a valid block type")) + assert.Equal(t, true, strings.Contains(body, fmt.Sprintf("could not decode %s request body into consensus block:", version.String(version.Capella)))) + }) + t.Run("syncing", func(t *testing.T) { + chainService := &chainMock.ChainService{} + server := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: true}, + HeadFetcher: chainService, + TimeFetcher: chainService, + OptimisticModeFetcher: chainService, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte("foo"))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusServiceUnavailable, writer.Code) + assert.Equal(t, true, strings.Contains(writer.Body.String(), "Beacon node is currently syncing and not serving request on that endpoint")) + }) +} + +func TestPublishBlockSSZ(t *testing.T) { + ctrl := gomock.NewController(t) + t.Run("Bellatrix", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + _, ok := req.Block.(*eth.GenericSignedBeaconBlock_Bellatrix) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + var bellablock shared.SignedBeaconBlockBellatrix + err := json.Unmarshal([]byte(rpctesting.BellatrixBlock), &bellablock) + require.NoError(t, err) + genericBlock, err := bellablock.ToGeneric() + require.NoError(t, err) + sszvalue, err := genericBlock.GetBellatrix().MarshalSSZ() + require.NoError(t, err) + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader(sszvalue)) + request.Header.Set("Accept", "application/octet-stream") + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Capella", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + _, ok := req.Block.(*eth.GenericSignedBeaconBlock_Capella) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + var cblock shared.SignedBeaconBlockCapella + err := json.Unmarshal([]byte(rpctesting.CapellaBlock), &cblock) + require.NoError(t, err) + genericBlock, err := cblock.ToGeneric() + require.NoError(t, err) + sszvalue, err := genericBlock.GetCapella().MarshalSSZ() + require.NoError(t, err) + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader(sszvalue)) + request.Header.Set("Accept", "application/octet-stream") + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Deneb", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + _, ok := req.Block.(*eth.GenericSignedBeaconBlock_Deneb) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + var dblock shared.SignedBeaconBlockContentsDeneb + err := json.Unmarshal([]byte(rpctesting.DenebBlockContents), &dblock) + require.NoError(t, err) + genericBlock, err := dblock.ToGeneric() + require.NoError(t, err) + v2block, err := migration.V1Alpha1SignedBeaconBlockDenebAndBlobsToV2(genericBlock.GetDeneb()) + require.NoError(t, err) + sszvalue, err := v2block.MarshalSSZ() + require.NoError(t, err) + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader(sszvalue)) + request.Header.Set("Accept", "application/octet-stream") + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("invalid block", func(t *testing.T) { + server := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BlindedBellatrixBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlock(writer, request) + assert.Equal(t, http.StatusBadRequest, writer.Code) + assert.Equal(t, true, strings.Contains(writer.Body.String(), "Body does not represent a valid block type")) + }) +} + +func TestPublishBlindedBlock(t *testing.T) { + ctrl := gomock.NewController(t) + t.Run("Phase 0", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_Phase0) + converted, err := shared.BeaconBlockFromConsensus(block.Phase0.Block) + require.NoError(t, err) + var signedblock *shared.SignedBeaconBlock + err = json.Unmarshal([]byte(rpctesting.Phase0Block), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.Phase0Block))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Altair", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_Altair) + converted, err := shared.BeaconBlockAltairFromConsensus(block.Altair.Block) + require.NoError(t, err) + var signedblock *shared.SignedBeaconBlockAltair + err = json.Unmarshal([]byte(rpctesting.AltairBlock), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.AltairBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Blinded Bellatrix", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_BlindedBellatrix) + converted, err := shared.BlindedBeaconBlockBellatrixFromConsensus(block.BlindedBellatrix.Block) + require.NoError(t, err) + var signedblock *shared.SignedBlindedBeaconBlockBellatrix + err = json.Unmarshal([]byte(rpctesting.BlindedBellatrixBlock), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BlindedBellatrixBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Blinded Capella", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_BlindedCapella) + converted, err := shared.BlindedBeaconBlockCapellaFromConsensus(block.BlindedCapella.Block) + require.NoError(t, err) + var signedblock *shared.SignedBlindedBeaconBlockCapella + err = json.Unmarshal([]byte(rpctesting.BlindedCapellaBlock), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BlindedCapellaBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Blinded Deneb", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + block, ok := req.Block.(*eth.GenericSignedBeaconBlock_BlindedDeneb) + converted, err := shared.BlindedBeaconBlockDenebFromConsensus(block.BlindedDeneb.SignedBlindedBlock.Message) + require.NoError(t, err) + var signedblock *shared.SignedBlindedBeaconBlockContentsDeneb + err = json.Unmarshal([]byte(rpctesting.BlindedDenebBlockContents), &signedblock) + require.NoError(t, err) + require.DeepEqual(t, converted, signedblock.SignedBlindedBlock.Message) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BlindedDenebBlockContents))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("invalid block", func(t *testing.T) { + server := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BellatrixBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusBadRequest, writer.Code) + assert.Equal(t, true, strings.Contains(writer.Body.String(), "please add the api header")) + assert.Equal(t, true, strings.Contains(writer.Body.String(), "Body does not represent a valid block type")) + }) + t.Run("invalid block with version header", func(t *testing.T) { + server := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BadBlindedBellatrixBlock))) + request.Header.Set(api.VersionHeader, version.String(version.Bellatrix)) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusBadRequest, writer.Code) + body := writer.Body.String() + assert.Equal(t, true, strings.Contains(body, "Body does not represent a valid block type")) + assert.Equal(t, true, strings.Contains(body, fmt.Sprintf("could not decode %s request body into consensus block:", version.String(version.Bellatrix)))) + }) + t.Run("syncing", func(t *testing.T) { + chainService := &chainMock.ChainService{} + server := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: true}, + HeadFetcher: chainService, + TimeFetcher: chainService, + OptimisticModeFetcher: chainService, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte("foo"))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusServiceUnavailable, writer.Code) + assert.Equal(t, true, strings.Contains(writer.Body.String(), "Beacon node is currently syncing and not serving request on that endpoint")) + }) +} + +func TestPublishBlindedBlockSSZ(t *testing.T) { + ctrl := gomock.NewController(t) + t.Run("Bellatrix", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + _, ok := req.Block.(*eth.GenericSignedBeaconBlock_BlindedBellatrix) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + var bellablock shared.SignedBlindedBeaconBlockBellatrix + err := json.Unmarshal([]byte(rpctesting.BlindedBellatrixBlock), &bellablock) + require.NoError(t, err) + genericBlock, err := bellablock.ToGeneric() + require.NoError(t, err) + sszvalue, err := genericBlock.GetBlindedBellatrix().MarshalSSZ() + require.NoError(t, err) + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader(sszvalue)) + request.Header.Set("Accept", "application/octet-stream") + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Capella", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + _, ok := req.Block.(*eth.GenericSignedBeaconBlock_BlindedCapella) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + var cblock shared.SignedBlindedBeaconBlockCapella + err := json.Unmarshal([]byte(rpctesting.BlindedCapellaBlock), &cblock) + require.NoError(t, err) + genericBlock, err := cblock.ToGeneric() + require.NoError(t, err) + sszvalue, err := genericBlock.GetBlindedCapella().MarshalSSZ() + require.NoError(t, err) + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader(sszvalue)) + request.Header.Set("Accept", "application/octet-stream") + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("Deneb", func(t *testing.T) { + v1alpha1Server := mock2.NewMockBeaconNodeValidatorServer(ctrl) + v1alpha1Server.EXPECT().ProposeBeaconBlock(gomock.Any(), mock.MatchedBy(func(req *eth.GenericSignedBeaconBlock) bool { + _, ok := req.Block.(*eth.GenericSignedBeaconBlock_BlindedDeneb) + return ok + })) + server := &Server{ + V1Alpha1ValidatorServer: v1alpha1Server, + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + var cblock shared.SignedBlindedBeaconBlockContentsDeneb + err := json.Unmarshal([]byte(rpctesting.BlindedDenebBlockContents), &cblock) + require.NoError(t, err) + genericBlock, err := cblock.ToGeneric() + require.NoError(t, err) + v1block, err := migration.V1Alpha1SignedBlindedBlockAndBlobsDenebToV2Blinded(genericBlock.GetBlindedDeneb()) + require.NoError(t, err) + sszvalue, err := v1block.MarshalSSZ() + require.NoError(t, err) + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader(sszvalue)) + request.Header.Set("Accept", "application/octet-stream") + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusOK, writer.Code) + }) + t.Run("invalid block", func(t *testing.T) { + server := &Server{ + SyncChecker: &mockSync.Sync{IsSyncing: false}, + } + + request := httptest.NewRequest(http.MethodPost, "http://foo.example", bytes.NewReader([]byte(rpctesting.BellatrixBlock))) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + server.PublishBlindedBlock(writer, request) + assert.Equal(t, http.StatusBadRequest, writer.Code) + assert.Equal(t, true, strings.Contains(writer.Body.String(), "Body does not represent a valid block type")) + }) +} + func TestPublishBlockV2(t *testing.T) { ctrl := gomock.NewController(t) diff --git a/beacon-chain/rpc/eth/blob/handlers.go b/beacon-chain/rpc/eth/blob/handlers.go index 0e0418f0f2..9c9285878e 100644 --- a/beacon-chain/rpc/eth/blob/handlers.go +++ b/beacon-chain/rpc/eth/blob/handlers.go @@ -98,12 +98,7 @@ func (s *Server) Blobs(w http.ResponseWriter, r *http.Request) { return } - ssz, err := http2.SszRequested(r) - if err != nil { - http2.HandleError(w, err.Error(), http.StatusInternalServerError) - return - } - + ssz := http2.SszRequested(r) if ssz { v2sidecars, err := migration.V1Alpha1BlobSidecarsToV2(sidecars) if err != nil { diff --git a/beacon-chain/rpc/eth/validator/handlers_block.go b/beacon-chain/rpc/eth/validator/handlers_block.go index 65d79035d4..3fdc2c1029 100644 --- a/beacon-chain/rpc/eth/validator/handlers_block.go +++ b/beacon-chain/rpc/eth/validator/handlers_block.go @@ -74,10 +74,9 @@ func (s *Server) ProduceBlockV3(w http.ResponseWriter, r *http.Request) { } func (s *Server) produceBlockV3(ctx context.Context, w http.ResponseWriter, r *http.Request, v1alpha1req *eth.BlockRequest) { - isSSZ, err := http2.SszRequested(r) - if err != nil { - log.WithError(err).Error("Checking for SSZ failed, defaulting to JSON") - isSSZ = false + isSSZ := http2.SszRequested(r) + if !isSSZ { + log.Error("Checking for SSZ failed, defaulting to JSON") } v1alpha1resp, err := s.V1Alpha1Server.GetBeaconBlock(ctx, v1alpha1req) if err != nil { diff --git a/beacon-chain/rpc/service.go b/beacon-chain/rpc/service.go index 3f5e6a1e8e..73f076c61d 100644 --- a/beacon-chain/rpc/service.go +++ b/beacon-chain/rpc/service.go @@ -432,6 +432,8 @@ func (s *Service) Start() { s.cfg.Router.HandleFunc("/eth/v1/beacon/states/{state_id}/validator_count", httpServer.GetValidatorCount).Methods(http.MethodGet) s.cfg.Router.HandleFunc("/eth/v1/beacon/states/{state_id}/committees", beaconChainServerV1.GetCommittees).Methods(http.MethodGet) s.cfg.Router.HandleFunc("/eth/v1/beacon/states/{state_id}/fork", beaconChainServerV1.GetStateFork).Methods(http.MethodGet) + s.cfg.Router.HandleFunc("/eth/v1/beacon/blocks", beaconChainServerV1.PublishBlock).Methods(http.MethodPost) + s.cfg.Router.HandleFunc("/eth/v1/beacon/blinded_blocks", beaconChainServerV1.PublishBlindedBlock).Methods(http.MethodPost) s.cfg.Router.HandleFunc("/eth/v2/beacon/blocks", beaconChainServerV1.PublishBlockV2).Methods(http.MethodPost) s.cfg.Router.HandleFunc("/eth/v2/beacon/blinded_blocks", beaconChainServerV1.PublishBlindedBlockV2).Methods(http.MethodPost) s.cfg.Router.HandleFunc("/eth/v1/beacon/blocks/{block_id}/root", beaconChainServerV1.GetBlockRoot).Methods(http.MethodGet) diff --git a/network/http/BUILD.bazel b/network/http/BUILD.bazel index 921b32880a..5e53f2f480 100644 --- a/network/http/BUILD.bazel +++ b/network/http/BUILD.bazel @@ -19,8 +19,5 @@ go_test( name = "go_default_test", srcs = ["reader_test.go"], embed = [":go_default_library"], - deps = [ - "//testing/assert:go_default_library", - "//testing/require:go_default_library", - ], + deps = ["//testing/assert:go_default_library"], ) diff --git a/network/http/reader.go b/network/http/reader.go index 241e0b7622..d1e9040160 100644 --- a/network/http/reader.go +++ b/network/http/reader.go @@ -13,10 +13,10 @@ import ( var priorityRegex = regexp.MustCompile(`q=(\d+(?:\.\d+)?)`) // SszRequested takes a http request and checks to see if it should be requesting a ssz response. -func SszRequested(req *http.Request) (bool, error) { +func SszRequested(req *http.Request) bool { accept := req.Header.Values("Accept") if len(accept) == 0 { - return false, nil + return false } types := strings.Split(accept[0], ",") currentType, currentPriority := "", 0.0 @@ -42,12 +42,12 @@ func SszRequested(req *http.Request) (bool, error) { } priority, err := strconv.ParseFloat(match[0][1], 32) if err != nil { - return false, err + return false } if priority > currentPriority { currentType, currentPriority = name, priority } } - return currentType == api.OctetStreamMediaType, nil + return currentType == api.OctetStreamMediaType } diff --git a/network/http/reader_test.go b/network/http/reader_test.go index d156e9856c..d0c16f2d38 100644 --- a/network/http/reader_test.go +++ b/network/http/reader_test.go @@ -6,94 +6,82 @@ import ( "testing" "github.com/prysmaticlabs/prysm/v4/testing/assert" - "github.com/prysmaticlabs/prysm/v4/testing/require" ) func TestSSZRequested(t *testing.T) { t.Run("ssz_requested", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{octetStreamMediaType} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, true, result) }) t.Run("ssz_content_type_first", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{fmt.Sprintf("%s,%s", octetStreamMediaType, jsonMediaType)} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, true, result) }) t.Run("ssz_content_type_preferred_1", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{fmt.Sprintf("%s;q=0.9,%s", jsonMediaType, octetStreamMediaType)} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, true, result) }) t.Run("ssz_content_type_preferred_2", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{fmt.Sprintf("%s;q=0.95,%s;q=0.9", octetStreamMediaType, jsonMediaType)} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, true, result) }) t.Run("other_content_type_preferred", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{fmt.Sprintf("%s,%s;q=0.9", jsonMediaType, octetStreamMediaType)} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, false, result) }) t.Run("other_params", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{fmt.Sprintf("%s,%s;q=0.9,otherparam=xyz", jsonMediaType, octetStreamMediaType)} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, false, result) }) t.Run("no_header", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, false, result) }) t.Run("empty_header", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, false, result) }) t.Run("empty_header_value", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{""} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, false, result) }) t.Run("other_content_type", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{"application/other"} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, false, result) }) t.Run("garbage", func(t *testing.T) { request := httptest.NewRequest("GET", "http://foo.example", nil) request.Header["Accept"] = []string{"This is Sparta!!!"} - result, err := SszRequested(request) - require.NoError(t, err) + result := SszRequested(request) assert.Equal(t, false, result) }) } diff --git a/proto/eth/service/beacon_chain_service.pb.go b/proto/eth/service/beacon_chain_service.pb.go index 1fda3ee805..b5dcd00e0d 100755 --- a/proto/eth/service/beacon_chain_service.pb.go +++ b/proto/eth/service/beacon_chain_service.pb.go @@ -58,7 +58,7 @@ var file_proto_eth_service_beacon_chain_service_proto_rawDesc = []byte{ 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x32, 0x2f, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x32, 0x9f, 0x1a, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, + 0x6f, 0x32, 0xf9, 0x15, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x8e, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x57, 0x65, 0x61, 0x6b, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, @@ -96,268 +96,223 @@ var file_proto_eth_service_beacon_chain_service_proto_rawDesc = []byte{ 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x72, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x12, 0x85, 0x01, 0x0a, - 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x33, 0x2e, 0x65, - 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x23, 0x3a, 0x01, 0x2a, 0x22, 0x1e, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, - 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, - 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x76, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x53, 0x53, 0x5a, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x53, 0x5a, 0x43, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2d, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, - 0x6e, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x73, 0x73, 0x7a, 0x12, 0x9b, 0x01, 0x0a, - 0x12, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x12, 0x3a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, - 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x6c, 0x69, 0x6e, - 0x64, 0x65, 0x64, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, - 0x01, 0x2a, 0x22, 0x26, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, - 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x69, 0x6e, - 0x64, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x85, 0x01, 0x0a, 0x15, 0x53, - 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x53, 0x53, 0x5a, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, - 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x53, 0x5a, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x35, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x2f, 0x3a, 0x01, 0x2a, 0x22, 0x2a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, - 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x73, - 0x73, 0x7a, 0x12, 0x7f, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1d, - 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, - 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, + 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x72, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x12, 0x7f, 0x0a, 0x08, + 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, + 0x29, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, + 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, + 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, 0x88, 0x02, 0x01, 0x12, 0x89, 0x01, + 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x53, 0x5a, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, - 0x88, 0x02, 0x01, 0x12, 0x89, 0x01, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x53, 0x53, 0x5a, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, - 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, - 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x53, 0x5a, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x12, 0x2d, 0x2f, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x65, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x53, 0x5a, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x12, 0x2d, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, + 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, + 0x64, 0x7d, 0x2f, 0x73, 0x73, 0x7a, 0x88, 0x02, 0x01, 0x12, 0x82, 0x01, 0x0a, 0x0a, 0x47, 0x65, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x32, 0x12, 0x1f, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x32, 0x1a, 0x20, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x32, 0x22, 0x31, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, + 0x74, 0x68, 0x2f, 0x76, 0x32, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x92, + 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, + 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, + 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x39, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, + 0x12, 0x31, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, + 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, + 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x69, 0x64, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x69, 0x6e, 0x64, + 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x53, 0x5a, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x53, 0x5a, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, + 0x12, 0x35, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, + 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, + 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x73, 0x7a, 0x12, 0x86, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x53, 0x5a, 0x56, 0x32, 0x12, 0x1f, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x32, 0x1a, 0x1d, 0x2e, 0x65, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x53, 0x5a, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x2f, 0x12, 0x2d, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, + 0x2f, 0x76, 0x32, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x73, 0x7a, + 0x12, 0xa2, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x41, 0x74, + 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x12, 0x36, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x73, 0x7a, 0x88, 0x02, 0x01, 0x12, - 0x82, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x32, 0x12, 0x1f, - 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, - 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x32, 0x1a, - 0x20, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, - 0x32, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, - 0x32, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x32, 0x2f, 0x62, 0x65, 0x61, 0x63, - 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x92, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x69, 0x6e, - 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, - 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, - 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x65, - 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x39, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x12, 0x31, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, - 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x12, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x53, 0x5a, - 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, - 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, - 0x32, 0x2e, 0x53, 0x53, 0x5a, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0x3d, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x12, 0x35, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, - 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x73, 0x7a, 0x12, 0x86, 0x01, - 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x53, 0x5a, 0x56, 0x32, 0x12, - 0x1f, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, - 0x32, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x32, - 0x1a, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, - 0x76, 0x32, 0x2e, 0x53, 0x53, 0x5a, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, - 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x12, 0x2d, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x32, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, - 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, - 0x64, 0x7d, 0x2f, 0x73, 0x73, 0x7a, 0x12, 0xa2, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, - 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, - 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x38, 0x12, 0x36, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, - 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x61, - 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x9c, 0x01, 0x0a, 0x19, - 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, - 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x1a, 0x2e, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, - 0x68, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x37, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x12, 0x2f, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, - 0x6f, 0x6e, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, - 0x5f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x8f, 0x01, 0x0a, 0x16, 0x53, - 0x75, 0x62, 0x6d, 0x69, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, - 0x73, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, - 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x3a, 0x01, 0x2a, 0x22, 0x2f, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, - 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, - 0x65, 0x72, 0x5f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x9b, 0x01, 0x0a, - 0x19, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, - 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, - 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, - 0x73, 0x68, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x37, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x12, 0x2f, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, - 0x6f, 0x6e, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, - 0x5f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x8f, 0x01, 0x0a, 0x16, 0x53, - 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, - 0x73, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, - 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x3a, 0x01, 0x2a, 0x22, 0x2f, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, - 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x65, 0x72, 0x5f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xb2, 0x01, 0x0a, - 0x21, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x4c, 0x53, - 0x54, 0x6f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, - 0x65, 0x73, 0x12, 0x33, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, - 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x4c, 0x53, 0x54, 0x6f, - 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, - 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3a, 0x3a, 0x01, 0x2a, 0x22, 0x35, 0x2f, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, - 0x63, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x62, 0x6c, 0x73, 0x5f, 0x74, 0x6f, 0x5f, - 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x73, 0x12, 0xa6, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x4c, 0x53, 0x54, 0x6f, 0x45, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x32, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, - 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x4c, 0x53, 0x54, 0x6f, 0x45, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x50, - 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3d, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x37, 0x12, 0x35, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, + 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x9c, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, + 0x6f, 0x6c, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, + 0x6e, 0x67, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2e, 0x2e, 0x65, 0x74, + 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x74, + 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x50, + 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x31, 0x12, 0x2f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, 0x6f, - 0x6c, 0x2f, 0x62, 0x6c, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x7f, 0x0a, 0x0f, 0x47, 0x65, - 0x74, 0x46, 0x6f, 0x72, 0x6b, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x53, 0x63, 0x68, 0x65, - 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, - 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x66, 0x6f, - 0x72, 0x6b, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x66, 0x0a, 0x07, 0x47, - 0x65, 0x74, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, - 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x70, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x73, - 0x70, 0x65, 0x63, 0x42, 0x98, 0x01, 0x0a, 0x18, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, - 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x42, 0x17, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, - 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0xaa, 0x02, 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, - 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x69, 0x6e, 0x67, 0x73, 0x12, 0x8f, 0x01, 0x0a, 0x16, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x41, + 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x12, + 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, + 0x31, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, + 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x34, 0x3a, 0x01, 0x2a, 0x22, 0x2f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x70, + 0x6f, 0x6f, 0x6c, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x6c, 0x61, + 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x9b, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x50, + 0x6f, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, + 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2d, 0x2e, 0x65, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x50, + 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x31, 0x12, 0x2f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, + 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, 0x6f, + 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x69, 0x6e, 0x67, 0x73, 0x12, 0x8f, 0x01, 0x0a, 0x16, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x12, + 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, + 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, + 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x34, 0x3a, 0x01, 0x2a, 0x22, 0x2f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x70, + 0x6f, 0x6f, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6c, 0x61, + 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xb2, 0x01, 0x0a, 0x21, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x4c, 0x53, 0x54, 0x6f, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x33, 0x2e, 0x65, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, + 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x4c, 0x53, 0x54, 0x6f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x3a, 0x3a, 0x01, 0x2a, 0x22, 0x35, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, + 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, + 0x6f, 0x6c, 0x2f, 0x62, 0x6c, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0xa6, 0x01, 0x0a, 0x19, + 0x4c, 0x69, 0x73, 0x74, 0x42, 0x4c, 0x53, 0x54, 0x6f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x32, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, + 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x4c, 0x53, 0x54, 0x6f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x12, 0x35, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, + 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x62, 0x6c, 0x73, 0x5f, + 0x74, 0x6f, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x73, 0x12, 0x7f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x6b, 0x53, + 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, + 0x31, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, + 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, + 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x66, 0x6f, 0x72, 0x6b, 0x5f, 0x73, 0x63, 0x68, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x66, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x53, 0x70, 0x65, 0x63, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, + 0x1c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, + 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x73, 0x70, 0x65, 0x63, 0x42, 0x98, 0x01, + 0x0a, 0x18, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, + 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x17, 0x42, 0x65, 0x61, 0x63, + 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, + 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, + 0x74, 0x68, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xaa, 0x02, 0x14, 0x45, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0xca, 0x02, 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, + 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_proto_eth_service_beacon_chain_service_proto_goTypes = []interface{}{ - (*empty.Empty)(nil), // 0: google.protobuf.Empty - (*v1.StateRequest)(nil), // 1: ethereum.eth.v1.StateRequest - (*v2.StateSyncCommitteesRequest)(nil), // 2: ethereum.eth.v2.StateSyncCommitteesRequest - (*v2.RandaoRequest)(nil), // 3: ethereum.eth.v2.RandaoRequest - (*v2.SignedBeaconBlockContentsContainer)(nil), // 4: ethereum.eth.v2.SignedBeaconBlockContentsContainer - (*v2.SSZContainer)(nil), // 5: ethereum.eth.v2.SSZContainer - (*v2.SignedBlindedBeaconBlockContentsContainer)(nil), // 6: ethereum.eth.v2.SignedBlindedBeaconBlockContentsContainer - (*v1.BlockRequest)(nil), // 7: ethereum.eth.v1.BlockRequest - (*v2.BlockRequestV2)(nil), // 8: ethereum.eth.v2.BlockRequestV2 - (*v1.AttesterSlashing)(nil), // 9: ethereum.eth.v1.AttesterSlashing - (*v1.ProposerSlashing)(nil), // 10: ethereum.eth.v1.ProposerSlashing - (*v2.SubmitBLSToExecutionChangesRequest)(nil), // 11: ethereum.eth.v2.SubmitBLSToExecutionChangesRequest - (*v1.WeakSubjectivityResponse)(nil), // 12: ethereum.eth.v1.WeakSubjectivityResponse - (*v1.StateRootResponse)(nil), // 13: ethereum.eth.v1.StateRootResponse - (*v2.StateSyncCommitteesResponse)(nil), // 14: ethereum.eth.v2.StateSyncCommitteesResponse - (*v2.RandaoResponse)(nil), // 15: ethereum.eth.v2.RandaoResponse - (*v1.BlockResponse)(nil), // 16: ethereum.eth.v1.BlockResponse - (*v1.BlockSSZResponse)(nil), // 17: ethereum.eth.v1.BlockSSZResponse - (*v2.BlockResponseV2)(nil), // 18: ethereum.eth.v2.BlockResponseV2 - (*v2.BlindedBlockResponse)(nil), // 19: ethereum.eth.v2.BlindedBlockResponse - (*v1.BlockAttestationsResponse)(nil), // 20: ethereum.eth.v1.BlockAttestationsResponse - (*v1.AttesterSlashingsPoolResponse)(nil), // 21: ethereum.eth.v1.AttesterSlashingsPoolResponse - (*v1.ProposerSlashingPoolResponse)(nil), // 22: ethereum.eth.v1.ProposerSlashingPoolResponse - (*v2.BLSToExecutionChangesPoolResponse)(nil), // 23: ethereum.eth.v2.BLSToExecutionChangesPoolResponse - (*v1.ForkScheduleResponse)(nil), // 24: ethereum.eth.v1.ForkScheduleResponse - (*v1.SpecResponse)(nil), // 25: ethereum.eth.v1.SpecResponse + (*empty.Empty)(nil), // 0: google.protobuf.Empty + (*v1.StateRequest)(nil), // 1: ethereum.eth.v1.StateRequest + (*v2.StateSyncCommitteesRequest)(nil), // 2: ethereum.eth.v2.StateSyncCommitteesRequest + (*v2.RandaoRequest)(nil), // 3: ethereum.eth.v2.RandaoRequest + (*v1.BlockRequest)(nil), // 4: ethereum.eth.v1.BlockRequest + (*v2.BlockRequestV2)(nil), // 5: ethereum.eth.v2.BlockRequestV2 + (*v1.AttesterSlashing)(nil), // 6: ethereum.eth.v1.AttesterSlashing + (*v1.ProposerSlashing)(nil), // 7: ethereum.eth.v1.ProposerSlashing + (*v2.SubmitBLSToExecutionChangesRequest)(nil), // 8: ethereum.eth.v2.SubmitBLSToExecutionChangesRequest + (*v1.WeakSubjectivityResponse)(nil), // 9: ethereum.eth.v1.WeakSubjectivityResponse + (*v1.StateRootResponse)(nil), // 10: ethereum.eth.v1.StateRootResponse + (*v2.StateSyncCommitteesResponse)(nil), // 11: ethereum.eth.v2.StateSyncCommitteesResponse + (*v2.RandaoResponse)(nil), // 12: ethereum.eth.v2.RandaoResponse + (*v1.BlockResponse)(nil), // 13: ethereum.eth.v1.BlockResponse + (*v1.BlockSSZResponse)(nil), // 14: ethereum.eth.v1.BlockSSZResponse + (*v2.BlockResponseV2)(nil), // 15: ethereum.eth.v2.BlockResponseV2 + (*v2.BlindedBlockResponse)(nil), // 16: ethereum.eth.v2.BlindedBlockResponse + (*v2.SSZContainer)(nil), // 17: ethereum.eth.v2.SSZContainer + (*v1.BlockAttestationsResponse)(nil), // 18: ethereum.eth.v1.BlockAttestationsResponse + (*v1.AttesterSlashingsPoolResponse)(nil), // 19: ethereum.eth.v1.AttesterSlashingsPoolResponse + (*v1.ProposerSlashingPoolResponse)(nil), // 20: ethereum.eth.v1.ProposerSlashingPoolResponse + (*v2.BLSToExecutionChangesPoolResponse)(nil), // 21: ethereum.eth.v2.BLSToExecutionChangesPoolResponse + (*v1.ForkScheduleResponse)(nil), // 22: ethereum.eth.v1.ForkScheduleResponse + (*v1.SpecResponse)(nil), // 23: ethereum.eth.v1.SpecResponse } var file_proto_eth_service_beacon_chain_service_proto_depIdxs = []int32{ 0, // 0: ethereum.eth.service.BeaconChain.GetWeakSubjectivity:input_type -> google.protobuf.Empty 1, // 1: ethereum.eth.service.BeaconChain.GetStateRoot:input_type -> ethereum.eth.v1.StateRequest 2, // 2: ethereum.eth.service.BeaconChain.ListSyncCommittees:input_type -> ethereum.eth.v2.StateSyncCommitteesRequest 3, // 3: ethereum.eth.service.BeaconChain.GetRandao:input_type -> ethereum.eth.v2.RandaoRequest - 4, // 4: ethereum.eth.service.BeaconChain.SubmitBlock:input_type -> ethereum.eth.v2.SignedBeaconBlockContentsContainer - 5, // 5: ethereum.eth.service.BeaconChain.SubmitBlockSSZ:input_type -> ethereum.eth.v2.SSZContainer - 6, // 6: ethereum.eth.service.BeaconChain.SubmitBlindedBlock:input_type -> ethereum.eth.v2.SignedBlindedBeaconBlockContentsContainer - 5, // 7: ethereum.eth.service.BeaconChain.SubmitBlindedBlockSSZ:input_type -> ethereum.eth.v2.SSZContainer - 7, // 8: ethereum.eth.service.BeaconChain.GetBlock:input_type -> ethereum.eth.v1.BlockRequest - 7, // 9: ethereum.eth.service.BeaconChain.GetBlockSSZ:input_type -> ethereum.eth.v1.BlockRequest - 8, // 10: ethereum.eth.service.BeaconChain.GetBlockV2:input_type -> ethereum.eth.v2.BlockRequestV2 - 7, // 11: ethereum.eth.service.BeaconChain.GetBlindedBlock:input_type -> ethereum.eth.v1.BlockRequest - 7, // 12: ethereum.eth.service.BeaconChain.GetBlindedBlockSSZ:input_type -> ethereum.eth.v1.BlockRequest - 8, // 13: ethereum.eth.service.BeaconChain.GetBlockSSZV2:input_type -> ethereum.eth.v2.BlockRequestV2 - 7, // 14: ethereum.eth.service.BeaconChain.ListBlockAttestations:input_type -> ethereum.eth.v1.BlockRequest - 0, // 15: ethereum.eth.service.BeaconChain.ListPoolAttesterSlashings:input_type -> google.protobuf.Empty - 9, // 16: ethereum.eth.service.BeaconChain.SubmitAttesterSlashing:input_type -> ethereum.eth.v1.AttesterSlashing - 0, // 17: ethereum.eth.service.BeaconChain.ListPoolProposerSlashings:input_type -> google.protobuf.Empty - 10, // 18: ethereum.eth.service.BeaconChain.SubmitProposerSlashing:input_type -> ethereum.eth.v1.ProposerSlashing - 11, // 19: ethereum.eth.service.BeaconChain.SubmitSignedBLSToExecutionChanges:input_type -> ethereum.eth.v2.SubmitBLSToExecutionChangesRequest - 0, // 20: ethereum.eth.service.BeaconChain.ListBLSToExecutionChanges:input_type -> google.protobuf.Empty - 0, // 21: ethereum.eth.service.BeaconChain.GetForkSchedule:input_type -> google.protobuf.Empty - 0, // 22: ethereum.eth.service.BeaconChain.GetSpec:input_type -> google.protobuf.Empty - 12, // 23: ethereum.eth.service.BeaconChain.GetWeakSubjectivity:output_type -> ethereum.eth.v1.WeakSubjectivityResponse - 13, // 24: ethereum.eth.service.BeaconChain.GetStateRoot:output_type -> ethereum.eth.v1.StateRootResponse - 14, // 25: ethereum.eth.service.BeaconChain.ListSyncCommittees:output_type -> ethereum.eth.v2.StateSyncCommitteesResponse - 15, // 26: ethereum.eth.service.BeaconChain.GetRandao:output_type -> ethereum.eth.v2.RandaoResponse - 0, // 27: ethereum.eth.service.BeaconChain.SubmitBlock:output_type -> google.protobuf.Empty - 0, // 28: ethereum.eth.service.BeaconChain.SubmitBlockSSZ:output_type -> google.protobuf.Empty - 0, // 29: ethereum.eth.service.BeaconChain.SubmitBlindedBlock:output_type -> google.protobuf.Empty - 0, // 30: ethereum.eth.service.BeaconChain.SubmitBlindedBlockSSZ:output_type -> google.protobuf.Empty - 16, // 31: ethereum.eth.service.BeaconChain.GetBlock:output_type -> ethereum.eth.v1.BlockResponse - 17, // 32: ethereum.eth.service.BeaconChain.GetBlockSSZ:output_type -> ethereum.eth.v1.BlockSSZResponse - 18, // 33: ethereum.eth.service.BeaconChain.GetBlockV2:output_type -> ethereum.eth.v2.BlockResponseV2 - 19, // 34: ethereum.eth.service.BeaconChain.GetBlindedBlock:output_type -> ethereum.eth.v2.BlindedBlockResponse - 5, // 35: ethereum.eth.service.BeaconChain.GetBlindedBlockSSZ:output_type -> ethereum.eth.v2.SSZContainer - 5, // 36: ethereum.eth.service.BeaconChain.GetBlockSSZV2:output_type -> ethereum.eth.v2.SSZContainer - 20, // 37: ethereum.eth.service.BeaconChain.ListBlockAttestations:output_type -> ethereum.eth.v1.BlockAttestationsResponse - 21, // 38: ethereum.eth.service.BeaconChain.ListPoolAttesterSlashings:output_type -> ethereum.eth.v1.AttesterSlashingsPoolResponse - 0, // 39: ethereum.eth.service.BeaconChain.SubmitAttesterSlashing:output_type -> google.protobuf.Empty - 22, // 40: ethereum.eth.service.BeaconChain.ListPoolProposerSlashings:output_type -> ethereum.eth.v1.ProposerSlashingPoolResponse - 0, // 41: ethereum.eth.service.BeaconChain.SubmitProposerSlashing:output_type -> google.protobuf.Empty - 0, // 42: ethereum.eth.service.BeaconChain.SubmitSignedBLSToExecutionChanges:output_type -> google.protobuf.Empty - 23, // 43: ethereum.eth.service.BeaconChain.ListBLSToExecutionChanges:output_type -> ethereum.eth.v2.BLSToExecutionChangesPoolResponse - 24, // 44: ethereum.eth.service.BeaconChain.GetForkSchedule:output_type -> ethereum.eth.v1.ForkScheduleResponse - 25, // 45: ethereum.eth.service.BeaconChain.GetSpec:output_type -> ethereum.eth.v1.SpecResponse - 23, // [23:46] is the sub-list for method output_type - 0, // [0:23] is the sub-list for method input_type + 4, // 4: ethereum.eth.service.BeaconChain.GetBlock:input_type -> ethereum.eth.v1.BlockRequest + 4, // 5: ethereum.eth.service.BeaconChain.GetBlockSSZ:input_type -> ethereum.eth.v1.BlockRequest + 5, // 6: ethereum.eth.service.BeaconChain.GetBlockV2:input_type -> ethereum.eth.v2.BlockRequestV2 + 4, // 7: ethereum.eth.service.BeaconChain.GetBlindedBlock:input_type -> ethereum.eth.v1.BlockRequest + 4, // 8: ethereum.eth.service.BeaconChain.GetBlindedBlockSSZ:input_type -> ethereum.eth.v1.BlockRequest + 5, // 9: ethereum.eth.service.BeaconChain.GetBlockSSZV2:input_type -> ethereum.eth.v2.BlockRequestV2 + 4, // 10: ethereum.eth.service.BeaconChain.ListBlockAttestations:input_type -> ethereum.eth.v1.BlockRequest + 0, // 11: ethereum.eth.service.BeaconChain.ListPoolAttesterSlashings:input_type -> google.protobuf.Empty + 6, // 12: ethereum.eth.service.BeaconChain.SubmitAttesterSlashing:input_type -> ethereum.eth.v1.AttesterSlashing + 0, // 13: ethereum.eth.service.BeaconChain.ListPoolProposerSlashings:input_type -> google.protobuf.Empty + 7, // 14: ethereum.eth.service.BeaconChain.SubmitProposerSlashing:input_type -> ethereum.eth.v1.ProposerSlashing + 8, // 15: ethereum.eth.service.BeaconChain.SubmitSignedBLSToExecutionChanges:input_type -> ethereum.eth.v2.SubmitBLSToExecutionChangesRequest + 0, // 16: ethereum.eth.service.BeaconChain.ListBLSToExecutionChanges:input_type -> google.protobuf.Empty + 0, // 17: ethereum.eth.service.BeaconChain.GetForkSchedule:input_type -> google.protobuf.Empty + 0, // 18: ethereum.eth.service.BeaconChain.GetSpec:input_type -> google.protobuf.Empty + 9, // 19: ethereum.eth.service.BeaconChain.GetWeakSubjectivity:output_type -> ethereum.eth.v1.WeakSubjectivityResponse + 10, // 20: ethereum.eth.service.BeaconChain.GetStateRoot:output_type -> ethereum.eth.v1.StateRootResponse + 11, // 21: ethereum.eth.service.BeaconChain.ListSyncCommittees:output_type -> ethereum.eth.v2.StateSyncCommitteesResponse + 12, // 22: ethereum.eth.service.BeaconChain.GetRandao:output_type -> ethereum.eth.v2.RandaoResponse + 13, // 23: ethereum.eth.service.BeaconChain.GetBlock:output_type -> ethereum.eth.v1.BlockResponse + 14, // 24: ethereum.eth.service.BeaconChain.GetBlockSSZ:output_type -> ethereum.eth.v1.BlockSSZResponse + 15, // 25: ethereum.eth.service.BeaconChain.GetBlockV2:output_type -> ethereum.eth.v2.BlockResponseV2 + 16, // 26: ethereum.eth.service.BeaconChain.GetBlindedBlock:output_type -> ethereum.eth.v2.BlindedBlockResponse + 17, // 27: ethereum.eth.service.BeaconChain.GetBlindedBlockSSZ:output_type -> ethereum.eth.v2.SSZContainer + 17, // 28: ethereum.eth.service.BeaconChain.GetBlockSSZV2:output_type -> ethereum.eth.v2.SSZContainer + 18, // 29: ethereum.eth.service.BeaconChain.ListBlockAttestations:output_type -> ethereum.eth.v1.BlockAttestationsResponse + 19, // 30: ethereum.eth.service.BeaconChain.ListPoolAttesterSlashings:output_type -> ethereum.eth.v1.AttesterSlashingsPoolResponse + 0, // 31: ethereum.eth.service.BeaconChain.SubmitAttesterSlashing:output_type -> google.protobuf.Empty + 20, // 32: ethereum.eth.service.BeaconChain.ListPoolProposerSlashings:output_type -> ethereum.eth.v1.ProposerSlashingPoolResponse + 0, // 33: ethereum.eth.service.BeaconChain.SubmitProposerSlashing:output_type -> google.protobuf.Empty + 0, // 34: ethereum.eth.service.BeaconChain.SubmitSignedBLSToExecutionChanges:output_type -> google.protobuf.Empty + 21, // 35: ethereum.eth.service.BeaconChain.ListBLSToExecutionChanges:output_type -> ethereum.eth.v2.BLSToExecutionChangesPoolResponse + 22, // 36: ethereum.eth.service.BeaconChain.GetForkSchedule:output_type -> ethereum.eth.v1.ForkScheduleResponse + 23, // 37: ethereum.eth.service.BeaconChain.GetSpec:output_type -> ethereum.eth.v1.SpecResponse + 19, // [19:38] is the sub-list for method output_type + 0, // [0:19] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -404,10 +359,6 @@ type BeaconChainClient interface { GetStateRoot(ctx context.Context, in *v1.StateRequest, opts ...grpc.CallOption) (*v1.StateRootResponse, error) ListSyncCommittees(ctx context.Context, in *v2.StateSyncCommitteesRequest, opts ...grpc.CallOption) (*v2.StateSyncCommitteesResponse, error) GetRandao(ctx context.Context, in *v2.RandaoRequest, opts ...grpc.CallOption) (*v2.RandaoResponse, error) - SubmitBlock(ctx context.Context, in *v2.SignedBeaconBlockContentsContainer, opts ...grpc.CallOption) (*empty.Empty, error) - SubmitBlockSSZ(ctx context.Context, in *v2.SSZContainer, opts ...grpc.CallOption) (*empty.Empty, error) - SubmitBlindedBlock(ctx context.Context, in *v2.SignedBlindedBeaconBlockContentsContainer, opts ...grpc.CallOption) (*empty.Empty, error) - SubmitBlindedBlockSSZ(ctx context.Context, in *v2.SSZContainer, opts ...grpc.CallOption) (*empty.Empty, error) // Deprecated: Do not use. GetBlock(ctx context.Context, in *v1.BlockRequest, opts ...grpc.CallOption) (*v1.BlockResponse, error) // Deprecated: Do not use. @@ -472,42 +423,6 @@ func (c *beaconChainClient) GetRandao(ctx context.Context, in *v2.RandaoRequest, return out, nil } -func (c *beaconChainClient) SubmitBlock(ctx context.Context, in *v2.SignedBeaconBlockContentsContainer, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconChain/SubmitBlock", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *beaconChainClient) SubmitBlockSSZ(ctx context.Context, in *v2.SSZContainer, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconChain/SubmitBlockSSZ", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *beaconChainClient) SubmitBlindedBlock(ctx context.Context, in *v2.SignedBlindedBeaconBlockContentsContainer, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconChain/SubmitBlindedBlock", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *beaconChainClient) SubmitBlindedBlockSSZ(ctx context.Context, in *v2.SSZContainer, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconChain/SubmitBlindedBlockSSZ", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // Deprecated: Do not use. func (c *beaconChainClient) GetBlock(ctx context.Context, in *v1.BlockRequest, opts ...grpc.CallOption) (*v1.BlockResponse, error) { out := new(v1.BlockResponse) @@ -652,10 +567,6 @@ type BeaconChainServer interface { GetStateRoot(context.Context, *v1.StateRequest) (*v1.StateRootResponse, error) ListSyncCommittees(context.Context, *v2.StateSyncCommitteesRequest) (*v2.StateSyncCommitteesResponse, error) GetRandao(context.Context, *v2.RandaoRequest) (*v2.RandaoResponse, error) - SubmitBlock(context.Context, *v2.SignedBeaconBlockContentsContainer) (*empty.Empty, error) - SubmitBlockSSZ(context.Context, *v2.SSZContainer) (*empty.Empty, error) - SubmitBlindedBlock(context.Context, *v2.SignedBlindedBeaconBlockContentsContainer) (*empty.Empty, error) - SubmitBlindedBlockSSZ(context.Context, *v2.SSZContainer) (*empty.Empty, error) // Deprecated: Do not use. GetBlock(context.Context, *v1.BlockRequest) (*v1.BlockResponse, error) // Deprecated: Do not use. @@ -691,18 +602,6 @@ func (*UnimplementedBeaconChainServer) ListSyncCommittees(context.Context, *v2.S func (*UnimplementedBeaconChainServer) GetRandao(context.Context, *v2.RandaoRequest) (*v2.RandaoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRandao not implemented") } -func (*UnimplementedBeaconChainServer) SubmitBlock(context.Context, *v2.SignedBeaconBlockContentsContainer) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SubmitBlock not implemented") -} -func (*UnimplementedBeaconChainServer) SubmitBlockSSZ(context.Context, *v2.SSZContainer) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SubmitBlockSSZ not implemented") -} -func (*UnimplementedBeaconChainServer) SubmitBlindedBlock(context.Context, *v2.SignedBlindedBeaconBlockContentsContainer) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SubmitBlindedBlock not implemented") -} -func (*UnimplementedBeaconChainServer) SubmitBlindedBlockSSZ(context.Context, *v2.SSZContainer) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SubmitBlindedBlockSSZ not implemented") -} func (*UnimplementedBeaconChainServer) GetBlock(context.Context, *v1.BlockRequest) (*v1.BlockResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBlock not implemented") } @@ -825,78 +724,6 @@ func _BeaconChain_GetRandao_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _BeaconChain_SubmitBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v2.SignedBeaconBlockContentsContainer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BeaconChainServer).SubmitBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.BeaconChain/SubmitBlock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BeaconChainServer).SubmitBlock(ctx, req.(*v2.SignedBeaconBlockContentsContainer)) - } - return interceptor(ctx, in, info, handler) -} - -func _BeaconChain_SubmitBlockSSZ_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v2.SSZContainer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BeaconChainServer).SubmitBlockSSZ(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.BeaconChain/SubmitBlockSSZ", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BeaconChainServer).SubmitBlockSSZ(ctx, req.(*v2.SSZContainer)) - } - return interceptor(ctx, in, info, handler) -} - -func _BeaconChain_SubmitBlindedBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v2.SignedBlindedBeaconBlockContentsContainer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BeaconChainServer).SubmitBlindedBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.BeaconChain/SubmitBlindedBlock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BeaconChainServer).SubmitBlindedBlock(ctx, req.(*v2.SignedBlindedBeaconBlockContentsContainer)) - } - return interceptor(ctx, in, info, handler) -} - -func _BeaconChain_SubmitBlindedBlockSSZ_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v2.SSZContainer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BeaconChainServer).SubmitBlindedBlockSSZ(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.BeaconChain/SubmitBlindedBlockSSZ", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BeaconChainServer).SubmitBlindedBlockSSZ(ctx, req.(*v2.SSZContainer)) - } - return interceptor(ctx, in, info, handler) -} - func _BeaconChain_GetBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(v1.BlockRequest) if err := dec(in); err != nil { @@ -1187,22 +1014,6 @@ var _BeaconChain_serviceDesc = grpc.ServiceDesc{ MethodName: "GetRandao", Handler: _BeaconChain_GetRandao_Handler, }, - { - MethodName: "SubmitBlock", - Handler: _BeaconChain_SubmitBlock_Handler, - }, - { - MethodName: "SubmitBlockSSZ", - Handler: _BeaconChain_SubmitBlockSSZ_Handler, - }, - { - MethodName: "SubmitBlindedBlock", - Handler: _BeaconChain_SubmitBlindedBlock_Handler, - }, - { - MethodName: "SubmitBlindedBlockSSZ", - Handler: _BeaconChain_SubmitBlindedBlockSSZ_Handler, - }, { MethodName: "GetBlock", Handler: _BeaconChain_GetBlock_Handler, diff --git a/proto/eth/service/beacon_chain_service.pb.gw.go b/proto/eth/service/beacon_chain_service.pb.gw.go index 3582ff69be..6c7b9f8c97 100755 --- a/proto/eth/service/beacon_chain_service.pb.gw.go +++ b/proto/eth/service/beacon_chain_service.pb.gw.go @@ -255,142 +255,6 @@ func local_request_BeaconChain_GetRandao_0(ctx context.Context, marshaler runtim } -func request_BeaconChain_SubmitBlock_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconChainClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq eth.SignedBeaconBlockContentsContainer - 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) - } - - msg, err := client.SubmitBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_BeaconChain_SubmitBlock_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconChainServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq eth.SignedBeaconBlockContentsContainer - 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) - } - - msg, err := server.SubmitBlock(ctx, &protoReq) - return msg, metadata, err - -} - -func request_BeaconChain_SubmitBlockSSZ_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconChainClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq eth.SSZContainer - 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) - } - - msg, err := client.SubmitBlockSSZ(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_BeaconChain_SubmitBlockSSZ_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconChainServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq eth.SSZContainer - 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) - } - - msg, err := server.SubmitBlockSSZ(ctx, &protoReq) - return msg, metadata, err - -} - -func request_BeaconChain_SubmitBlindedBlock_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconChainClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq eth.SignedBlindedBeaconBlockContentsContainer - 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) - } - - msg, err := client.SubmitBlindedBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_BeaconChain_SubmitBlindedBlock_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconChainServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq eth.SignedBlindedBeaconBlockContentsContainer - 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) - } - - msg, err := server.SubmitBlindedBlock(ctx, &protoReq) - return msg, metadata, err - -} - -func request_BeaconChain_SubmitBlindedBlockSSZ_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconChainClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq eth.SSZContainer - 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) - } - - msg, err := client.SubmitBlindedBlockSSZ(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_BeaconChain_SubmitBlindedBlockSSZ_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconChainServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq eth.SSZContainer - 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) - } - - msg, err := server.SubmitBlindedBlockSSZ(ctx, &protoReq) - return msg, metadata, err - -} - func request_BeaconChain_GetBlock_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconChainClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq v1.BlockRequest var metadata runtime.ServerMetadata @@ -1059,98 +923,6 @@ func RegisterBeaconChainHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("POST", pattern_BeaconChain_SubmitBlock_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.service.BeaconChain/SubmitBlock") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_BeaconChain_SubmitBlock_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 { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_SubmitBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_BeaconChain_SubmitBlockSSZ_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.service.BeaconChain/SubmitBlockSSZ") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_BeaconChain_SubmitBlockSSZ_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 { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_SubmitBlockSSZ_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_BeaconChain_SubmitBlindedBlock_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.service.BeaconChain/SubmitBlindedBlock") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_BeaconChain_SubmitBlindedBlock_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 { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_SubmitBlindedBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_BeaconChain_SubmitBlindedBlockSSZ_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.service.BeaconChain/SubmitBlindedBlockSSZ") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_BeaconChain_SubmitBlindedBlockSSZ_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 { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_SubmitBlindedBlockSSZ_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_BeaconChain_GetBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1617,86 +1389,6 @@ func RegisterBeaconChainHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("POST", pattern_BeaconChain_SubmitBlock_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.service.BeaconChain/SubmitBlock") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_BeaconChain_SubmitBlock_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_SubmitBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_BeaconChain_SubmitBlockSSZ_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.service.BeaconChain/SubmitBlockSSZ") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_BeaconChain_SubmitBlockSSZ_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_SubmitBlockSSZ_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_BeaconChain_SubmitBlindedBlock_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.service.BeaconChain/SubmitBlindedBlock") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_BeaconChain_SubmitBlindedBlock_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_SubmitBlindedBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_BeaconChain_SubmitBlindedBlockSSZ_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.service.BeaconChain/SubmitBlindedBlockSSZ") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_BeaconChain_SubmitBlindedBlockSSZ_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_SubmitBlindedBlockSSZ_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_BeaconChain_GetBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2009,14 +1701,6 @@ var ( pattern_BeaconChain_GetRandao_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"internal", "eth", "v1", "beacon", "states", "state_id", "randao"}, "")) - pattern_BeaconChain_SubmitBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "beacon", "blocks"}, "")) - - pattern_BeaconChain_SubmitBlockSSZ_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5}, []string{"internal", "eth", "v1", "beacon", "blocks", "ssz"}, "")) - - pattern_BeaconChain_SubmitBlindedBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "beacon", "blinded_blocks"}, "")) - - pattern_BeaconChain_SubmitBlindedBlockSSZ_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5}, []string{"internal", "eth", "v1", "beacon", "blinded_blocks", "ssz"}, "")) - pattern_BeaconChain_GetBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"internal", "eth", "v1", "beacon", "blocks", "block_id"}, "")) pattern_BeaconChain_GetBlockSSZ_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"internal", "eth", "v1", "beacon", "blocks", "block_id", "ssz"}, "")) @@ -2057,14 +1741,6 @@ var ( forward_BeaconChain_GetRandao_0 = runtime.ForwardResponseMessage - forward_BeaconChain_SubmitBlock_0 = runtime.ForwardResponseMessage - - forward_BeaconChain_SubmitBlockSSZ_0 = runtime.ForwardResponseMessage - - forward_BeaconChain_SubmitBlindedBlock_0 = runtime.ForwardResponseMessage - - forward_BeaconChain_SubmitBlindedBlockSSZ_0 = runtime.ForwardResponseMessage - forward_BeaconChain_GetBlock_0 = runtime.ForwardResponseMessage forward_BeaconChain_GetBlockSSZ_0 = runtime.ForwardResponseMessage diff --git a/proto/eth/service/beacon_chain_service.proto b/proto/eth/service/beacon_chain_service.proto index c7aaa5ecd2..252d46457e 100644 --- a/proto/eth/service/beacon_chain_service.proto +++ b/proto/eth/service/beacon_chain_service.proto @@ -82,72 +82,6 @@ service BeaconChain { }; } - // SubmitBlock instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be - // included in the beacon chain. The beacon node is not required to validate the signed BeaconBlock, and a successful - // response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the - // new block into its state, and therefore validate the block internally, however blocks which fail the validation are - // still broadcast but a different status code is returned (202). - // - // Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Beacon/publishBlock - rpc SubmitBlock(v2.SignedBeaconBlockContentsContainer) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/internal/eth/v1/beacon/blocks" - body: "*" - }; - } - - // SubmitBlock instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be - // included in the beacon chain. The beacon node is not required to validate the signed BeaconBlock, and a successful - // response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the - // new block into its state, and therefore validate the block internally, however blocks which fail the validation are - // still broadcast but a different status code is returned (202). - // - // The provided block must be SSZ-serialized. - // - // Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Beacon/publishBlock - rpc SubmitBlockSSZ(v2.SSZContainer) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/internal/eth/v1/beacon/blocks/ssz" - body: "*" - }; - } - - // SubmitBlindedBlock instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct - // and publish a `SignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions`. - // The beacon node should broadcast a newly constructed `SignedBeaconBlock` to the beacon network, - // to be included in the beacon chain. The beacon node is not required to validate the signed - // `BeaconBlock`, and a successful response (20X) only indicates that the broadcast has been - // successful. The beacon node is expected to integrate the new block into its state, and - // therefore validate the block internally, however blocks which fail the validation are still - // broadcast but a different status code is returned (202). - // - // Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Beacon/publishBlindedBlock - rpc SubmitBlindedBlock(v2.SignedBlindedBeaconBlockContentsContainer) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/internal/eth/v1/beacon/blinded_blocks" - body: "*" - }; - } - - // SubmitBlindedBlock instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct - // and publish a `SignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions`. - // The beacon node should broadcast a newly constructed `SignedBeaconBlock` to the beacon network, - // to be included in the beacon chain. The beacon node is not required to validate the signed - // `BeaconBlock`, and a successful response (20X) only indicates that the broadcast has been - // successful. The beacon node is expected to integrate the new block into its state, and - // therefore validate the block internally, however blocks which fail the validation are still - // broadcast but a different status code is returned (202). - // - // The provided block must be SSZ-serialized. - // - // Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Beacon/publishBlindedBlock - rpc SubmitBlindedBlockSSZ(v2.SSZContainer) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/internal/eth/v1/beacon/blinded_blocks/ssz" - body: "*" - }; - } - // GetBlock retrieves block details for given block id. // // Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Beacon/getBlock