mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
HTTP Beacon API: /eth/v1/validator/attestation_data (#12634)
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
@@ -64,7 +64,6 @@ func (_ *BeaconEndpointFactory) Paths() []string {
|
||||
"/eth/v1/validator/blocks/{slot}",
|
||||
"/eth/v2/validator/blocks/{slot}",
|
||||
"/eth/v1/validator/blinded_blocks/{slot}",
|
||||
"/eth/v1/validator/attestation_data",
|
||||
"/eth/v1/validator/sync_committee_contribution",
|
||||
"/eth/v1/validator/prepare_beacon_proposer",
|
||||
"/eth/v1/validator/register_validator",
|
||||
@@ -252,9 +251,6 @@ func (_ *BeaconEndpointFactory) Create(path string) (*apimiddleware.Endpoint, er
|
||||
OnPreSerializeMiddlewareResponseIntoJson: serializeProducedBlindedBlock,
|
||||
}
|
||||
endpoint.CustomHandlers = []apimiddleware.CustomHandler{handleProduceBlindedBlockSSZ}
|
||||
case "/eth/v1/validator/attestation_data":
|
||||
endpoint.GetResponse = &ProduceAttestationDataResponseJson{}
|
||||
endpoint.RequestQueryParams = []apimiddleware.QueryParam{{Name: "slot"}, {Name: "committee_index"}}
|
||||
case "/eth/v1/validator/sync_committee_contribution":
|
||||
endpoint.GetResponse = &ProduceSyncCommitteeContributionResponseJson{}
|
||||
endpoint.RequestQueryParams = []apimiddleware.QueryParam{{Name: "slot"}, {Name: "subcommittee_index"}, {Name: "beacon_block_root", Hex: true}}
|
||||
|
||||
@@ -268,10 +268,6 @@ type ProduceBlindedBlockResponseJson struct {
|
||||
Data *BlindedBeaconBlockContainerJson `json:"data"`
|
||||
}
|
||||
|
||||
type ProduceAttestationDataResponseJson struct {
|
||||
Data *AttestationDataJson `json:"data"`
|
||||
}
|
||||
|
||||
type AggregateAttestationResponseJson struct {
|
||||
Data *AttestationJson `json:"data"`
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ go_library(
|
||||
"//beacon-chain/core/transition:go_default_library",
|
||||
"//beacon-chain/operations/synccommittee:go_default_library",
|
||||
"//beacon-chain/p2p:go_default_library",
|
||||
"//beacon-chain/state/stategen:go_default_library",
|
||||
"//beacon-chain/sync:go_default_library",
|
||||
"//config/fieldparams:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
@@ -32,6 +33,7 @@ go_library(
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"//time:go_default_library",
|
||||
"//time/slots:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
|
||||
@@ -2,9 +2,11 @@ package core
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/cache"
|
||||
opfeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/synccommittee"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/stategen"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/sync"
|
||||
)
|
||||
|
||||
@@ -15,4 +17,6 @@ type Service struct {
|
||||
Broadcaster p2p.Broadcaster
|
||||
SyncCommitteePool synccommittee.Pool
|
||||
OperationNotifier opfeed.Notifier
|
||||
AttestationCache *cache.AttestationCache
|
||||
StateGen stategen.StateManager
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/runtime/version"
|
||||
prysmTime "github.com/prysmaticlabs/prysm/v4/time"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
@@ -309,3 +310,111 @@ func assignValidatorToSubnet(pubkey []byte) {
|
||||
totalDuration := epochDuration * time.Duration(assignedDuration)
|
||||
cache.SubnetIDs.AddPersistentCommittee(pubkey, assignedIdxs, totalDuration*time.Second)
|
||||
}
|
||||
|
||||
// GetAttestationData requests that the beacon node produces attestation data for
|
||||
// the requested committee index and slot based on the nodes current head.
|
||||
func (s *Service) GetAttestationData(
|
||||
ctx context.Context, req *ethpb.AttestationDataRequest,
|
||||
) (*ethpb.AttestationData, *RpcError) {
|
||||
if err := helpers.ValidateAttestationTime(
|
||||
req.Slot,
|
||||
s.GenesisTimeFetcher.GenesisTime(),
|
||||
params.BeaconNetworkConfig().MaximumGossipClockDisparity,
|
||||
); err != nil {
|
||||
return nil, &RpcError{Reason: BadRequest, Err: errors.Errorf("invalid request: %v", err)}
|
||||
}
|
||||
|
||||
res, err := s.AttestationCache.Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not retrieve data from attestation cache: %v", err)}
|
||||
}
|
||||
if res != nil {
|
||||
res.CommitteeIndex = req.CommitteeIndex
|
||||
return res, nil
|
||||
}
|
||||
|
||||
if err := s.AttestationCache.MarkInProgress(req); err != nil {
|
||||
if errors.Is(err, cache.ErrAlreadyInProgress) {
|
||||
res, err := s.AttestationCache.Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not retrieve data from attestation cache: %v", err)}
|
||||
}
|
||||
if res == nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.New("a request was in progress and resolved to nil")}
|
||||
}
|
||||
res.CommitteeIndex = req.CommitteeIndex
|
||||
return res, nil
|
||||
}
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not mark attestation as in-progress: %v", err)}
|
||||
}
|
||||
defer func() {
|
||||
if err := s.AttestationCache.MarkNotInProgress(req); err != nil {
|
||||
log.WithError(err).Error("could not mark attestation as not-in-progress")
|
||||
}
|
||||
}()
|
||||
|
||||
headState, err := s.HeadFetcher.HeadState(ctx)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not retrieve head state: %v", err)}
|
||||
}
|
||||
headRoot, err := s.HeadFetcher.HeadRoot(ctx)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not retrieve head root: %v", err)}
|
||||
}
|
||||
|
||||
// In the case that we receive an attestation request after a newer state/block has been processed.
|
||||
if headState.Slot() > req.Slot {
|
||||
headRoot, err = helpers.BlockRootAtSlot(headState, req.Slot)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not get historical head root: %v", err)}
|
||||
}
|
||||
headState, err = s.StateGen.StateByRoot(ctx, bytesutil.ToBytes32(headRoot))
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not get historical head state: %v", err)}
|
||||
}
|
||||
}
|
||||
if headState == nil || headState.IsNil() {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.New("could not lookup parent state from head")}
|
||||
}
|
||||
|
||||
if coreTime.CurrentEpoch(headState) < slots.ToEpoch(req.Slot) {
|
||||
headState, err = transition.ProcessSlotsUsingNextSlotCache(ctx, headState, headRoot, req.Slot)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not process slots up to %d: %v", req.Slot, err)}
|
||||
}
|
||||
}
|
||||
|
||||
targetEpoch := coreTime.CurrentEpoch(headState)
|
||||
epochStartSlot, err := slots.EpochStart(targetEpoch)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not calculate epoch start: %v", err)}
|
||||
}
|
||||
var targetRoot []byte
|
||||
if epochStartSlot == headState.Slot() {
|
||||
targetRoot = headRoot
|
||||
} else {
|
||||
targetRoot, err = helpers.BlockRootAtSlot(headState, epochStartSlot)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Reason: Internal, Err: errors.Errorf("could not get target block for slot %d: %v", epochStartSlot, err)}
|
||||
}
|
||||
if bytesutil.ToBytes32(targetRoot) == params.BeaconConfig().ZeroHash {
|
||||
targetRoot = headRoot
|
||||
}
|
||||
}
|
||||
|
||||
res = ðpb.AttestationData{
|
||||
Slot: req.Slot,
|
||||
CommitteeIndex: req.CommitteeIndex,
|
||||
BeaconBlockRoot: headRoot,
|
||||
Source: headState.CurrentJustifiedCheckpoint(),
|
||||
Target: ðpb.Checkpoint{
|
||||
Epoch: targetEpoch,
|
||||
Root: targetRoot,
|
||||
},
|
||||
}
|
||||
|
||||
if err := s.AttestationCache.Put(ctx, req, res); err != nil {
|
||||
log.WithError(err).Error("could not store attestation data in cache")
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@@ -96,3 +96,29 @@ func IsSyncing(
|
||||
http2.WriteError(w, errJson)
|
||||
return true
|
||||
}
|
||||
|
||||
// IsOptimistic checks whether the beacon node is currently optimistic and writes it to the response.
|
||||
func IsOptimistic(
|
||||
ctx context.Context,
|
||||
w http.ResponseWriter,
|
||||
optimisticModeFetcher blockchain.OptimisticModeFetcher,
|
||||
) (bool, error) {
|
||||
isOptimistic, err := optimisticModeFetcher.IsOptimistic(ctx)
|
||||
if err != nil {
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not check optimistic status: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
http2.WriteError(w, errJson)
|
||||
return true, err
|
||||
}
|
||||
if !isOptimistic {
|
||||
return false, nil
|
||||
}
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Code: http.StatusServiceUnavailable,
|
||||
Message: "Beacon node is currently optimistic and not serving validators",
|
||||
}
|
||||
http2.WriteError(w, errJson)
|
||||
return true, nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ go_library(
|
||||
"validator.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator",
|
||||
visibility = ["//beacon-chain:__subpackages__"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//beacon-chain/blockchain:go_default_library",
|
||||
"//beacon-chain/builder:go_default_library",
|
||||
@@ -66,13 +66,17 @@ go_test(
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/core/transition:go_default_library",
|
||||
"//beacon-chain/db/testing:go_default_library",
|
||||
"//beacon-chain/forkchoice/doubly-linked-tree:go_default_library",
|
||||
"//beacon-chain/operations/attestations:go_default_library",
|
||||
"//beacon-chain/operations/synccommittee:go_default_library",
|
||||
"//beacon-chain/p2p/testing:go_default_library",
|
||||
"//beacon-chain/rpc/core:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//beacon-chain/rpc/prysm/v1alpha1/validator:go_default_library",
|
||||
"//beacon-chain/rpc/testutil:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//beacon-chain/state/stategen:go_default_library",
|
||||
"//beacon-chain/sync/initial-sync/testing:go_default_library",
|
||||
"//config/fieldparams:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
@@ -92,6 +96,5 @@ go_test(
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_golang_mock//gomock:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -398,3 +398,56 @@ func (s *Server) SubmitBeaconCommitteeSubscription(w http.ResponseWriter, r *htt
|
||||
core.AssignValidatorToSubnet(pubkey[:], valStatus)
|
||||
}
|
||||
}
|
||||
|
||||
// GetAttestationData requests that the beacon node produces attestation data for
|
||||
// the requested committee index and slot based on the nodes current head.
|
||||
func (s *Server) GetAttestationData(w http.ResponseWriter, r *http.Request) {
|
||||
ctx, span := trace.StartSpan(r.Context(), "validator.GetAttestationData")
|
||||
defer span.End()
|
||||
|
||||
if shared.IsSyncing(ctx, w, s.SyncChecker, s.HeadFetcher, s.TimeFetcher, s.OptimisticModeFetcher) {
|
||||
return
|
||||
}
|
||||
|
||||
if isOptimistic, err := shared.IsOptimistic(ctx, w, s.OptimisticModeFetcher); isOptimistic || err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
rawSlot := r.URL.Query().Get("slot")
|
||||
slot, valid := shared.ValidateUint(w, "Slot", rawSlot)
|
||||
if !valid {
|
||||
return
|
||||
}
|
||||
rawCommitteeIndex := r.URL.Query().Get("committee_index")
|
||||
committeeIndex, valid := shared.ValidateUint(w, "Committee Index", rawCommitteeIndex)
|
||||
if !valid {
|
||||
return
|
||||
}
|
||||
|
||||
attestationData, rpcError := s.CoreService.GetAttestationData(ctx, ðpbalpha.AttestationDataRequest{
|
||||
Slot: primitives.Slot(slot),
|
||||
CommitteeIndex: primitives.CommitteeIndex(committeeIndex),
|
||||
})
|
||||
|
||||
if rpcError != nil {
|
||||
http2.HandleError(w, rpcError.Err.Error(), core.ErrorReasonToHTTP(rpcError.Reason))
|
||||
return
|
||||
}
|
||||
|
||||
response := &GetAttestationDataResponse{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(uint64(attestationData.Slot), 10),
|
||||
CommitteeIndex: strconv.FormatUint(uint64(attestationData.CommitteeIndex), 10),
|
||||
BeaconBlockRoot: hexutil.Encode(attestationData.BeaconBlockRoot),
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(uint64(attestationData.Source.Epoch), 10),
|
||||
Root: hexutil.Encode(attestationData.Source.Root),
|
||||
},
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(uint64(attestationData.Target.Epoch), 10),
|
||||
Root: hexutil.Encode(attestationData.Target.Root),
|
||||
},
|
||||
},
|
||||
}
|
||||
http2.WriteJson(w, response)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,18 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
dbutil "github.com/prysmaticlabs/prysm/v4/beacon-chain/db/testing"
|
||||
doublylinkedtree "github.com/prysmaticlabs/prysm/v4/beacon-chain/forkchoice/doubly-linked-tree"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
state_native "github.com/prysmaticlabs/prysm/v4/beacon-chain/state/state-native"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/stategen"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
mockChain "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing"
|
||||
@@ -819,6 +829,550 @@ func TestSubmitBeaconCommitteeSubscription(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetAttestationData(t *testing.T) {
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
block := util.NewBeaconBlock()
|
||||
block.Block.Slot = 3*params.BeaconConfig().SlotsPerEpoch + 1
|
||||
targetBlock := util.NewBeaconBlock()
|
||||
targetBlock.Block.Slot = 1 * params.BeaconConfig().SlotsPerEpoch
|
||||
justifiedBlock := util.NewBeaconBlock()
|
||||
justifiedBlock.Block.Slot = 2 * params.BeaconConfig().SlotsPerEpoch
|
||||
blockRoot, err := block.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not hash beacon block")
|
||||
justifiedRoot, err := justifiedBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not get signing root for justified block")
|
||||
targetRoot, err := targetBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not get signing root for target block")
|
||||
slot := 3*params.BeaconConfig().SlotsPerEpoch + 1
|
||||
beaconState, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, beaconState.SetSlot(slot))
|
||||
err = beaconState.SetCurrentJustifiedCheckpoint(ðpbalpha.Checkpoint{
|
||||
Epoch: 2,
|
||||
Root: justifiedRoot[:],
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
blockRoots := beaconState.BlockRoots()
|
||||
blockRoots[1] = blockRoot[:]
|
||||
blockRoots[1*params.BeaconConfig().SlotsPerEpoch] = targetRoot[:]
|
||||
blockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedRoot[:]
|
||||
require.NoError(t, beaconState.SetBlockRoots(blockRoots))
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
chain := &mockChain.ChainService{
|
||||
Optimistic: false,
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
State: beaconState,
|
||||
Root: blockRoot[:],
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
HeadFetcher: chain,
|
||||
TimeFetcher: chain,
|
||||
OptimisticModeFetcher: chain,
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: chain,
|
||||
GenesisTimeFetcher: chain,
|
||||
},
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://example.com?slot=%d&committee_index=%d", slot, 0)
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
expectedResponse := &GetAttestationDataResponse{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(uint64(slot), 10),
|
||||
BeaconBlockRoot: hexutil.Encode(blockRoot[:]),
|
||||
CommitteeIndex: strconv.FormatUint(0, 10),
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(2, 10),
|
||||
Root: hexutil.Encode(justifiedRoot[:]),
|
||||
},
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(3, 10),
|
||||
Root: hexutil.Encode(blockRoot[:]),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
resp := &GetAttestationDataResponse{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
|
||||
require.NotNil(t, resp)
|
||||
assert.DeepEqual(t, expectedResponse, resp)
|
||||
})
|
||||
|
||||
t.Run("syncing", func(t *testing.T) {
|
||||
beaconState, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
chain := &mockChain.ChainService{
|
||||
Optimistic: false,
|
||||
State: beaconState,
|
||||
Genesis: time.Now(),
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: true},
|
||||
HeadFetcher: chain,
|
||||
TimeFetcher: chain,
|
||||
OptimisticModeFetcher: chain,
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://example.com?slot=%d&committee_index=%d", 1, 2)
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
assert.Equal(t, http.StatusServiceUnavailable, writer.Code)
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusServiceUnavailable, e.Code)
|
||||
assert.Equal(t, true, strings.Contains(e.Message, "syncing"))
|
||||
})
|
||||
|
||||
t.Run("optimistic", func(t *testing.T) {
|
||||
beaconState, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
chain := &mockChain.ChainService{
|
||||
Optimistic: true,
|
||||
State: beaconState,
|
||||
Genesis: time.Now(),
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
HeadFetcher: chain,
|
||||
TimeFetcher: chain,
|
||||
OptimisticModeFetcher: chain,
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
GenesisTimeFetcher: chain,
|
||||
HeadFetcher: chain,
|
||||
},
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://example.com?slot=%d&committee_index=%d", 0, 0)
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
assert.Equal(t, http.StatusServiceUnavailable, writer.Code)
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusServiceUnavailable, e.Code)
|
||||
assert.Equal(t, true, strings.Contains(e.Message, "optimistic"))
|
||||
|
||||
chain.Optimistic = false
|
||||
|
||||
writer = httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
})
|
||||
|
||||
t.Run("handles in progress request", func(t *testing.T) {
|
||||
state, err := state_native.InitializeFromProtoPhase0(ðpbalpha.BeaconState{Slot: 100})
|
||||
require.NoError(t, err)
|
||||
ctx := context.Background()
|
||||
slot := primitives.Slot(2)
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
chain := &mockChain.ChainService{
|
||||
Optimistic: false,
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
State: state,
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
HeadFetcher: chain,
|
||||
TimeFetcher: chain,
|
||||
OptimisticModeFetcher: chain,
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: chain,
|
||||
GenesisTimeFetcher: chain,
|
||||
},
|
||||
}
|
||||
|
||||
expectedResponse := &GetAttestationDataResponse{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(uint64(slot), 10),
|
||||
CommitteeIndex: strconv.FormatUint(1, 10),
|
||||
BeaconBlockRoot: hexutil.Encode(make([]byte, 32)),
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(42, 10),
|
||||
Root: hexutil.Encode(make([]byte, 32)),
|
||||
},
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(55, 10),
|
||||
Root: hexutil.Encode(make([]byte, 32)),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expectedResponsePb := ðpbalpha.AttestationData{
|
||||
Slot: slot,
|
||||
CommitteeIndex: 1,
|
||||
BeaconBlockRoot: make([]byte, 32),
|
||||
Source: ðpbalpha.Checkpoint{Epoch: 42, Root: make([]byte, 32)},
|
||||
Target: ðpbalpha.Checkpoint{Epoch: 55, Root: make([]byte, 32)},
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://example.com?slot=%d&committee_index=%d", slot, 1)
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
requestPb := ðpbalpha.AttestationDataRequest{
|
||||
CommitteeIndex: 1,
|
||||
Slot: slot,
|
||||
}
|
||||
|
||||
require.NoError(t, s.CoreService.AttestationCache.MarkInProgress(requestPb))
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
resp := &GetAttestationDataResponse{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
|
||||
require.NotNil(t, resp)
|
||||
assert.DeepEqual(t, expectedResponse, resp)
|
||||
}()
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
assert.NoError(t, s.CoreService.AttestationCache.Put(ctx, requestPb, expectedResponsePb))
|
||||
assert.NoError(t, s.CoreService.AttestationCache.MarkNotInProgress(requestPb))
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
})
|
||||
|
||||
t.Run("invalid slot", func(t *testing.T) {
|
||||
slot := 3*params.BeaconConfig().SlotsPerEpoch + 1
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
chain := &mockChain.ChainService{
|
||||
Optimistic: false,
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
HeadFetcher: chain,
|
||||
TimeFetcher: chain,
|
||||
OptimisticModeFetcher: chain,
|
||||
CoreService: &core.Service{
|
||||
GenesisTimeFetcher: chain,
|
||||
},
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://example.com?slot=%d&committee_index=%d", 1000000000000, 2)
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, true, strings.Contains(e.Message, "invalid request"))
|
||||
})
|
||||
|
||||
t.Run("head state slot greater than request slot", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
db := dbutil.SetupDB(t)
|
||||
|
||||
slot := 3*params.BeaconConfig().SlotsPerEpoch + 1
|
||||
block := util.NewBeaconBlock()
|
||||
block.Block.Slot = slot
|
||||
block2 := util.NewBeaconBlock()
|
||||
block2.Block.Slot = slot - 1
|
||||
targetBlock := util.NewBeaconBlock()
|
||||
targetBlock.Block.Slot = 1 * params.BeaconConfig().SlotsPerEpoch
|
||||
justifiedBlock := util.NewBeaconBlock()
|
||||
justifiedBlock.Block.Slot = 2 * params.BeaconConfig().SlotsPerEpoch
|
||||
blockRoot, err := block.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not hash beacon block")
|
||||
blockRoot2, err := block2.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
util.SaveBlock(t, ctx, db, block2)
|
||||
justifiedRoot, err := justifiedBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not get signing root for justified block")
|
||||
targetRoot, err := targetBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not get signing root for target block")
|
||||
|
||||
beaconState, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, beaconState.SetSlot(slot))
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
require.NoError(t, beaconState.SetGenesisTime(uint64(time.Now().Unix()-offset)))
|
||||
err = beaconState.SetLatestBlockHeader(util.HydrateBeaconHeader(ðpbalpha.BeaconBlockHeader{
|
||||
ParentRoot: blockRoot2[:],
|
||||
}))
|
||||
require.NoError(t, err)
|
||||
err = beaconState.SetCurrentJustifiedCheckpoint(ðpbalpha.Checkpoint{
|
||||
Epoch: 2,
|
||||
Root: justifiedRoot[:],
|
||||
})
|
||||
require.NoError(t, err)
|
||||
blockRoots := beaconState.BlockRoots()
|
||||
blockRoots[1] = blockRoot[:]
|
||||
blockRoots[1*params.BeaconConfig().SlotsPerEpoch] = targetRoot[:]
|
||||
blockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedRoot[:]
|
||||
blockRoots[3*params.BeaconConfig().SlotsPerEpoch] = blockRoot2[:]
|
||||
require.NoError(t, beaconState.SetBlockRoots(blockRoots))
|
||||
|
||||
beaconstate := beaconState.Copy()
|
||||
require.NoError(t, beaconstate.SetSlot(beaconstate.Slot()-1))
|
||||
require.NoError(t, db.SaveState(ctx, beaconstate, blockRoot2))
|
||||
chain := &mockChain.ChainService{
|
||||
State: beaconState,
|
||||
Root: blockRoot[:],
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
HeadFetcher: chain,
|
||||
TimeFetcher: chain,
|
||||
OptimisticModeFetcher: chain,
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: chain,
|
||||
GenesisTimeFetcher: chain,
|
||||
StateGen: stategen.New(db, doublylinkedtree.New()),
|
||||
},
|
||||
}
|
||||
|
||||
require.NoError(t, db.SaveState(ctx, beaconState, blockRoot))
|
||||
util.SaveBlock(t, ctx, db, block)
|
||||
require.NoError(t, db.SaveHeadBlockRoot(ctx, blockRoot))
|
||||
|
||||
url := fmt.Sprintf("http://example.com?slot=%d&committee_index=%d", slot-1, 0)
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
expectedResponse := &GetAttestationDataResponse{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(uint64(slot-1), 10),
|
||||
CommitteeIndex: strconv.FormatUint(0, 10),
|
||||
BeaconBlockRoot: hexutil.Encode(blockRoot2[:]),
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(2, 10),
|
||||
Root: hexutil.Encode(justifiedRoot[:]),
|
||||
},
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(3, 10),
|
||||
Root: hexutil.Encode(blockRoot2[:]),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
resp := &GetAttestationDataResponse{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
|
||||
require.NotNil(t, resp)
|
||||
assert.DeepEqual(t, expectedResponse, resp)
|
||||
})
|
||||
|
||||
t.Run("succeeds in first epoch", func(t *testing.T) {
|
||||
slot := primitives.Slot(5)
|
||||
block := util.NewBeaconBlock()
|
||||
block.Block.Slot = slot
|
||||
targetBlock := util.NewBeaconBlock()
|
||||
targetBlock.Block.Slot = 0
|
||||
justifiedBlock := util.NewBeaconBlock()
|
||||
justifiedBlock.Block.Slot = 0
|
||||
blockRoot, err := block.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not hash beacon block")
|
||||
justifiedRoot, err := justifiedBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not get signing root for justified block")
|
||||
targetRoot, err := targetBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not get signing root for target block")
|
||||
|
||||
beaconState, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, beaconState.SetSlot(slot))
|
||||
err = beaconState.SetCurrentJustifiedCheckpoint(ðpbalpha.Checkpoint{
|
||||
Epoch: 0,
|
||||
Root: justifiedRoot[:],
|
||||
})
|
||||
require.NoError(t, err)
|
||||
blockRoots := beaconState.BlockRoots()
|
||||
blockRoots[1] = blockRoot[:]
|
||||
blockRoots[1*params.BeaconConfig().SlotsPerEpoch] = targetRoot[:]
|
||||
blockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedRoot[:]
|
||||
require.NoError(t, beaconState.SetBlockRoots(blockRoots))
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
chain := &mockChain.ChainService{
|
||||
State: beaconState,
|
||||
Root: blockRoot[:],
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
HeadFetcher: chain,
|
||||
TimeFetcher: chain,
|
||||
OptimisticModeFetcher: chain,
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: chain,
|
||||
GenesisTimeFetcher: chain,
|
||||
},
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://example.com?slot=%d&committee_index=%d", slot, 0)
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
expectedResponse := &GetAttestationDataResponse{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(uint64(slot), 10),
|
||||
BeaconBlockRoot: hexutil.Encode(blockRoot[:]),
|
||||
CommitteeIndex: strconv.FormatUint(0, 10),
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(0, 10),
|
||||
Root: hexutil.Encode(justifiedRoot[:]),
|
||||
},
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(0, 10),
|
||||
Root: hexutil.Encode(blockRoot[:]),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
resp := &GetAttestationDataResponse{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
|
||||
require.NotNil(t, resp)
|
||||
assert.DeepEqual(t, expectedResponse, resp)
|
||||
})
|
||||
|
||||
t.Run("handles far away justified epoch", func(t *testing.T) {
|
||||
// Scenario:
|
||||
//
|
||||
// State slot = 10000
|
||||
// Last justified slot = epoch start of 1500
|
||||
// HistoricalRootsLimit = 8192
|
||||
//
|
||||
// More background: https://github.com/prysmaticlabs/prysm/issues/2153
|
||||
// This test breaks if it doesn't use mainnet config
|
||||
|
||||
// Ensure HistoricalRootsLimit matches scenario
|
||||
params.SetupTestConfigCleanup(t)
|
||||
cfg := params.MainnetConfig().Copy()
|
||||
cfg.HistoricalRootsLimit = 8192
|
||||
params.OverrideBeaconConfig(cfg)
|
||||
|
||||
block := util.NewBeaconBlock()
|
||||
block.Block.Slot = 10000
|
||||
epochBoundaryBlock := util.NewBeaconBlock()
|
||||
var err error
|
||||
epochBoundaryBlock.Block.Slot, err = slots.EpochStart(slots.ToEpoch(10000))
|
||||
require.NoError(t, err)
|
||||
justifiedBlock := util.NewBeaconBlock()
|
||||
justifiedBlock.Block.Slot, err = slots.EpochStart(slots.ToEpoch(1500))
|
||||
require.NoError(t, err)
|
||||
justifiedBlock.Block.Slot -= 2 // Imagine two skip block
|
||||
blockRoot, err := block.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not hash beacon block")
|
||||
justifiedBlockRoot, err := justifiedBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not hash justified block")
|
||||
epochBoundaryRoot, err := epochBoundaryBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not hash justified block")
|
||||
slot := primitives.Slot(10000)
|
||||
|
||||
beaconState, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, beaconState.SetSlot(slot))
|
||||
err = beaconState.SetCurrentJustifiedCheckpoint(ðpbalpha.Checkpoint{
|
||||
Epoch: slots.ToEpoch(1500),
|
||||
Root: justifiedBlockRoot[:],
|
||||
})
|
||||
require.NoError(t, err)
|
||||
blockRoots := beaconState.BlockRoots()
|
||||
blockRoots[1] = blockRoot[:]
|
||||
blockRoots[1*params.BeaconConfig().SlotsPerEpoch] = epochBoundaryRoot[:]
|
||||
blockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedBlockRoot[:]
|
||||
require.NoError(t, beaconState.SetBlockRoots(blockRoots))
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
chain := &mockChain.ChainService{
|
||||
State: beaconState,
|
||||
Root: blockRoot[:],
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
HeadFetcher: chain,
|
||||
TimeFetcher: chain,
|
||||
OptimisticModeFetcher: chain,
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: chain,
|
||||
GenesisTimeFetcher: chain,
|
||||
},
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://example.com?slot=%d&committee_index=%d", slot, 0)
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAttestationData(writer, request)
|
||||
|
||||
expectedResponse := &GetAttestationDataResponse{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(uint64(slot), 10),
|
||||
BeaconBlockRoot: hexutil.Encode(blockRoot[:]),
|
||||
CommitteeIndex: strconv.FormatUint(0, 10),
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(uint64(slots.ToEpoch(1500)), 10),
|
||||
Root: hexutil.Encode(justifiedBlockRoot[:]),
|
||||
},
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(312, 10),
|
||||
Root: hexutil.Encode(blockRoot[:]),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
resp := &GetAttestationDataResponse{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
|
||||
require.NotNil(t, resp)
|
||||
assert.DeepEqual(t, expectedResponse, resp)
|
||||
})
|
||||
}
|
||||
|
||||
var (
|
||||
singleContribution = `[
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ package validator
|
||||
import "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
|
||||
type AggregateAttestationResponse struct {
|
||||
Data *shared.Attestation `json:"data" validate:"required"`
|
||||
Data *shared.Attestation `json:"data"`
|
||||
}
|
||||
|
||||
type SubmitContributionAndProofsRequest struct {
|
||||
@@ -21,3 +21,7 @@ type SubmitSyncCommitteeSubscriptionsRequest struct {
|
||||
type SubmitBeaconCommitteeSubscriptionsRequest struct {
|
||||
Data []*shared.BeaconCommitteeSubscription `json:"data" validate:"required,dive"`
|
||||
}
|
||||
|
||||
type GetAttestationDataResponse struct {
|
||||
Data *shared.AttestationData `json:"data"`
|
||||
}
|
||||
|
||||
@@ -780,26 +780,6 @@ func (vs *Server) SubmitValidatorRegistration(ctx context.Context, reg *ethpbv1.
|
||||
return &empty.Empty{}, nil
|
||||
}
|
||||
|
||||
// ProduceAttestationData requests that the beacon node produces attestation data for
|
||||
// the requested committee index and slot based on the nodes current head.
|
||||
func (vs *Server) ProduceAttestationData(ctx context.Context, req *ethpbv1.ProduceAttestationDataRequest) (*ethpbv1.ProduceAttestationDataResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "validator.ProduceAttestationData")
|
||||
defer span.End()
|
||||
|
||||
v1alpha1req := ðpbalpha.AttestationDataRequest{
|
||||
Slot: req.Slot,
|
||||
CommitteeIndex: req.CommitteeIndex,
|
||||
}
|
||||
v1alpha1resp, err := vs.V1Alpha1Server.GetAttestationData(ctx, v1alpha1req)
|
||||
if err != nil {
|
||||
// We simply return err because it's already of a gRPC error type.
|
||||
return nil, err
|
||||
}
|
||||
attData := migration.V1Alpha1AttDataToV1(v1alpha1resp)
|
||||
|
||||
return ðpbv1.ProduceAttestationDataResponse{Data: attData}, nil
|
||||
}
|
||||
|
||||
// ProduceSyncCommitteeContribution requests that the beacon node produce a sync committee contribution.
|
||||
func (vs *Server) ProduceSyncCommitteeContribution(
|
||||
ctx context.Context,
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/transition"
|
||||
dbutil "github.com/prysmaticlabs/prysm/v4/beacon-chain/db/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/synccommittee"
|
||||
p2pmock "github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/testing"
|
||||
v1alpha1validator "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/prysm/v1alpha1/validator"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/testutil"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
||||
@@ -34,7 +33,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/util"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestGetAttesterDuties(t *testing.T) {
|
||||
@@ -1242,82 +1240,6 @@ func TestProduceBlindedBlockSSZ(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestProduceAttestationData(t *testing.T) {
|
||||
block := util.NewBeaconBlock()
|
||||
block.Block.Slot = 3*params.BeaconConfig().SlotsPerEpoch + 1
|
||||
targetBlock := util.NewBeaconBlock()
|
||||
targetBlock.Block.Slot = 1 * params.BeaconConfig().SlotsPerEpoch
|
||||
justifiedBlock := util.NewBeaconBlock()
|
||||
justifiedBlock.Block.Slot = 2 * params.BeaconConfig().SlotsPerEpoch
|
||||
blockRoot, err := block.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not hash beacon block")
|
||||
justifiedRoot, err := justifiedBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not get signing root for justified block")
|
||||
targetRoot, err := targetBlock.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not get signing root for target block")
|
||||
slot := 3*params.BeaconConfig().SlotsPerEpoch + 1
|
||||
beaconState, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, beaconState.SetSlot(slot))
|
||||
err = beaconState.SetCurrentJustifiedCheckpoint(ðpbalpha.Checkpoint{
|
||||
Epoch: 2,
|
||||
Root: justifiedRoot[:],
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
blockRoots := beaconState.BlockRoots()
|
||||
blockRoots[1] = blockRoot[:]
|
||||
blockRoots[1*params.BeaconConfig().SlotsPerEpoch] = targetRoot[:]
|
||||
blockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedRoot[:]
|
||||
require.NoError(t, beaconState.SetBlockRoots(blockRoots))
|
||||
chainService := &mockChain.ChainService{
|
||||
Genesis: time.Now(),
|
||||
}
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
v1Alpha1Server := &v1alpha1validator.Server{
|
||||
P2P: &p2pmock.MockBroadcaster{},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mockChain.ChainService{
|
||||
State: beaconState, Root: blockRoot[:],
|
||||
},
|
||||
FinalizationFetcher: &mockChain.ChainService{
|
||||
CurrentJustifiedCheckPoint: beaconState.CurrentJustifiedCheckpoint(),
|
||||
},
|
||||
TimeFetcher: &mockChain.ChainService{
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
},
|
||||
StateNotifier: chainService.StateNotifier(),
|
||||
}
|
||||
v1Server := &Server{
|
||||
V1Alpha1Server: v1Alpha1Server,
|
||||
}
|
||||
|
||||
req := ðpbv1.ProduceAttestationDataRequest{
|
||||
CommitteeIndex: 0,
|
||||
Slot: 3*params.BeaconConfig().SlotsPerEpoch + 1,
|
||||
}
|
||||
res, err := v1Server.ProduceAttestationData(context.Background(), req)
|
||||
require.NoError(t, err, "Could not get attestation info at slot")
|
||||
|
||||
expectedInfo := ðpbv1.AttestationData{
|
||||
Slot: 3*params.BeaconConfig().SlotsPerEpoch + 1,
|
||||
BeaconBlockRoot: blockRoot[:],
|
||||
Source: ðpbv1.Checkpoint{
|
||||
Epoch: 2,
|
||||
Root: justifiedRoot[:],
|
||||
},
|
||||
Target: ðpbv1.Checkpoint{
|
||||
Epoch: 3,
|
||||
Root: blockRoot[:],
|
||||
},
|
||||
}
|
||||
|
||||
if !proto.Equal(res.Data, expectedInfo) {
|
||||
t.Errorf("Expected attestation info to match, received %v, wanted %v", res, expectedInfo)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProduceSyncCommitteeContribution(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
root := bytesutil.PadTo([]byte("root"), 32)
|
||||
|
||||
@@ -2,19 +2,14 @@ package validator
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/cache"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/time"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/transition"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
"go.opencensus.io/trace"
|
||||
@@ -42,102 +37,9 @@ func (vs *Server) GetAttestationData(ctx context.Context, req *ethpb.Attestation
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := helpers.ValidateAttestationTime(req.Slot, vs.TimeFetcher.GenesisTime(),
|
||||
params.BeaconNetworkConfig().MaximumGossipClockDisparity); err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid request: %v", err))
|
||||
}
|
||||
|
||||
res, err := vs.AttestationCache.Get(ctx, req)
|
||||
res, err := vs.CoreService.GetAttestationData(ctx, req)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not retrieve data from attestation cache: %v", err)
|
||||
}
|
||||
if res != nil {
|
||||
res.CommitteeIndex = req.CommitteeIndex
|
||||
return res, nil
|
||||
}
|
||||
|
||||
if err := vs.AttestationCache.MarkInProgress(req); err != nil {
|
||||
if errors.Is(err, cache.ErrAlreadyInProgress) {
|
||||
res, err := vs.AttestationCache.Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not retrieve data from attestation cache: %v", err)
|
||||
}
|
||||
if res == nil {
|
||||
return nil, status.Error(codes.DataLoss, "A request was in progress and resolved to nil")
|
||||
}
|
||||
res.CommitteeIndex = req.CommitteeIndex
|
||||
return res, nil
|
||||
}
|
||||
return nil, status.Errorf(codes.Internal, "Could not mark attestation as in-progress: %v", err)
|
||||
}
|
||||
defer func() {
|
||||
if err := vs.AttestationCache.MarkNotInProgress(req); err != nil {
|
||||
log.WithError(err).Error("Could not mark cache not in progress")
|
||||
}
|
||||
}()
|
||||
|
||||
headState, err := vs.HeadFetcher.HeadState(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not retrieve head state: %v", err)
|
||||
}
|
||||
headRoot, err := vs.HeadFetcher.HeadRoot(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not retrieve head root: %v", err)
|
||||
}
|
||||
|
||||
// In the case that we receive an attestation request after a newer state/block has been processed.
|
||||
if headState.Slot() > req.Slot {
|
||||
headRoot, err = helpers.BlockRootAtSlot(headState, req.Slot)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get historical head root: %v", err)
|
||||
}
|
||||
headState, err = vs.StateGen.StateByRoot(ctx, bytesutil.ToBytes32(headRoot))
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get historical head state: %v", err)
|
||||
}
|
||||
}
|
||||
if headState == nil || headState.IsNil() {
|
||||
return nil, status.Error(codes.Internal, "Could not lookup parent state from head.")
|
||||
}
|
||||
|
||||
if time.CurrentEpoch(headState) < slots.ToEpoch(req.Slot) {
|
||||
headState, err = transition.ProcessSlotsUsingNextSlotCache(ctx, headState, headRoot, req.Slot)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not process slots up to %d: %v", req.Slot, err)
|
||||
}
|
||||
}
|
||||
|
||||
targetEpoch := time.CurrentEpoch(headState)
|
||||
epochStartSlot, err := slots.EpochStart(targetEpoch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var targetRoot []byte
|
||||
if epochStartSlot == headState.Slot() {
|
||||
targetRoot = headRoot
|
||||
} else {
|
||||
targetRoot, err = helpers.BlockRootAtSlot(headState, epochStartSlot)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get target block for slot %d: %v", epochStartSlot, err)
|
||||
}
|
||||
if bytesutil.ToBytes32(targetRoot) == params.BeaconConfig().ZeroHash {
|
||||
targetRoot = headRoot
|
||||
}
|
||||
}
|
||||
|
||||
res = ðpb.AttestationData{
|
||||
Slot: req.Slot,
|
||||
CommitteeIndex: req.CommitteeIndex,
|
||||
BeaconBlockRoot: headRoot,
|
||||
Source: headState.CurrentJustifiedCheckpoint(),
|
||||
Target: ðpb.Checkpoint{
|
||||
Epoch: targetEpoch,
|
||||
Root: targetRoot,
|
||||
},
|
||||
}
|
||||
|
||||
if err := vs.AttestationCache.Put(ctx, req, res); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not store attestation data in cache: %v", err)
|
||||
return nil, status.Errorf(core.ErrorReasonToGRPC(err.Reason), "Could not get attestation data: %v", err.Err)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
mock "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/cache"
|
||||
mockp2p "github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
mockSync "github.com/prysmaticlabs/prysm/v4/beacon-chain/sync/initial-sync/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
@@ -65,20 +65,16 @@ func TestAttestationDataAtSlot_HandlesFarAwayJustifiedEpoch(t *testing.T) {
|
||||
blockRoots[1*params.BeaconConfig().SlotsPerEpoch] = epochBoundaryRoot[:]
|
||||
blockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedBlockRoot[:]
|
||||
require.NoError(t, beaconState.SetBlockRoots(blockRoots))
|
||||
chainService := &mock.ChainService{
|
||||
Genesis: time.Now(),
|
||||
}
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
attesterServer := &Server{
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{State: beaconState, Root: blockRoot[:]},
|
||||
FinalizationFetcher: &mock.ChainService{
|
||||
CurrentJustifiedCheckPoint: beaconState.CurrentJustifiedCheckpoint(),
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
OptimisticModeFetcher: &mock.ChainService{Optimistic: false},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{State: beaconState, Root: blockRoot[:]},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
StateNotifier: chainService.StateNotifier(),
|
||||
}
|
||||
|
||||
req := ðpb.AttestationDataRequest{
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
doublylinkedtree "github.com/prysmaticlabs/prysm/v4/beacon-chain/forkchoice/doubly-linked-tree"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/attestations"
|
||||
mockp2p "github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
state_native "github.com/prysmaticlabs/prysm/v4/beacon-chain/state/state-native"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/stategen"
|
||||
mockSync "github.com/prysmaticlabs/prysm/v4/beacon-chain/sync/initial-sync/testing"
|
||||
@@ -34,7 +35,6 @@ func TestProposeAttestation_OK(t *testing.T) {
|
||||
attesterServer := &Server{
|
||||
HeadFetcher: &mock.ChainService{},
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
AttPool: attestations.NewPool(),
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
}
|
||||
@@ -78,7 +78,6 @@ func TestProposeAttestation_IncorrectSignature(t *testing.T) {
|
||||
attesterServer := &Server{
|
||||
HeadFetcher: &mock.ChainService{},
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
AttPool: attestations.NewPool(),
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
}
|
||||
@@ -117,24 +116,20 @@ func TestGetAttestationData_OK(t *testing.T) {
|
||||
blockRoots[1*params.BeaconConfig().SlotsPerEpoch] = targetRoot[:]
|
||||
blockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedRoot[:]
|
||||
require.NoError(t, beaconState.SetBlockRoots(blockRoots))
|
||||
chainService := &mock.ChainService{
|
||||
Genesis: time.Now(),
|
||||
}
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
attesterServer := &Server{
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: beaconState, Root: blockRoot[:],
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
OptimisticModeFetcher: &mock.ChainService{Optimistic: false},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: beaconState, Root: blockRoot[:],
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
},
|
||||
},
|
||||
FinalizationFetcher: &mock.ChainService{
|
||||
CurrentJustifiedCheckPoint: beaconState.CurrentJustifiedCheckpoint(),
|
||||
},
|
||||
TimeFetcher: &mock.ChainService{
|
||||
Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second),
|
||||
},
|
||||
StateNotifier: chainService.StateNotifier(),
|
||||
}
|
||||
|
||||
req := ðpb.AttestationDataRequest{
|
||||
@@ -163,7 +158,7 @@ func TestGetAttestationData_OK(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAttestationData_SyncNotReady(t *testing.T) {
|
||||
as := &Server{
|
||||
as := Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: true},
|
||||
}
|
||||
_, err := as.GetAttestationData(context.Background(), ðpb.AttestationDataRequest{})
|
||||
@@ -178,9 +173,12 @@ func TestGetAttestationData_Optimistic(t *testing.T) {
|
||||
|
||||
as := &Server{
|
||||
SyncChecker: &mockSync.Sync{},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now()},
|
||||
HeadFetcher: &mock.ChainService{},
|
||||
OptimisticModeFetcher: &mock.ChainService{Optimistic: true},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now()},
|
||||
CoreService: &core.Service{
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now()},
|
||||
HeadFetcher: &mock.ChainService{},
|
||||
},
|
||||
}
|
||||
_, err := as.GetAttestationData(context.Background(), ðpb.AttestationDataRequest{})
|
||||
s, ok := status.FromError(err)
|
||||
@@ -192,10 +190,13 @@ func TestGetAttestationData_Optimistic(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
as = &Server{
|
||||
SyncChecker: &mockSync.Sync{},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now()},
|
||||
HeadFetcher: &mock.ChainService{Optimistic: false, State: beaconState},
|
||||
OptimisticModeFetcher: &mock.ChainService{Optimistic: false},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now()},
|
||||
CoreService: &core.Service{
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now()},
|
||||
HeadFetcher: &mock.ChainService{Optimistic: false, State: beaconState},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
},
|
||||
}
|
||||
_, err = as.GetAttestationData(context.Background(), ðpb.AttestationDataRequest{})
|
||||
require.NoError(t, err)
|
||||
@@ -206,17 +207,17 @@ func TestAttestationDataSlot_handlesInProgressRequest(t *testing.T) {
|
||||
state, err := state_native.InitializeFromProtoPhase0(s)
|
||||
require.NoError(t, err)
|
||||
ctx := context.Background()
|
||||
chainService := &mock.ChainService{
|
||||
Genesis: time.Now(),
|
||||
}
|
||||
slot := primitives.Slot(2)
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
server := &Server{
|
||||
HeadFetcher: &mock.ChainService{State: state},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
StateNotifier: chainService.StateNotifier(),
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
OptimisticModeFetcher: &mock.ChainService{Optimistic: false},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{State: state},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
},
|
||||
}
|
||||
|
||||
req := ðpb.AttestationDataRequest{
|
||||
@@ -229,7 +230,7 @@ func TestAttestationDataSlot_handlesInProgressRequest(t *testing.T) {
|
||||
Target: ðpb.Checkpoint{Epoch: 55, Root: make([]byte, 32)},
|
||||
}
|
||||
|
||||
require.NoError(t, server.AttestationCache.MarkInProgress(req))
|
||||
require.NoError(t, server.CoreService.AttestationCache.MarkInProgress(req))
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
||||
@@ -247,8 +248,8 @@ func TestAttestationDataSlot_handlesInProgressRequest(t *testing.T) {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
assert.NoError(t, server.AttestationCache.Put(ctx, req, res))
|
||||
assert.NoError(t, server.AttestationCache.MarkNotInProgress(req))
|
||||
assert.NoError(t, server.CoreService.AttestationCache.Put(ctx, req, res))
|
||||
assert.NoError(t, server.CoreService.AttestationCache.MarkNotInProgress(req))
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
@@ -260,9 +261,12 @@ func TestServer_GetAttestationData_InvalidRequestSlot(t *testing.T) {
|
||||
slot := 3*params.BeaconConfig().SlotsPerEpoch + 1
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
attesterServer := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
HeadFetcher: &mock.ChainService{},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
OptimisticModeFetcher: &mock.ChainService{Optimistic: false},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
CoreService: &core.Service{
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
},
|
||||
}
|
||||
|
||||
req := ðpb.AttestationDataRequest{
|
||||
@@ -323,19 +327,17 @@ func TestServer_GetAttestationData_HeadStateSlotGreaterThanRequestSlot(t *testin
|
||||
beaconstate := beaconState.Copy()
|
||||
require.NoError(t, beaconstate.SetSlot(beaconstate.Slot()-1))
|
||||
require.NoError(t, db.SaveState(ctx, beaconstate, blockRoot2))
|
||||
chainService := &mock.ChainService{
|
||||
Genesis: time.Now(),
|
||||
}
|
||||
offset = int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
attesterServer := &Server{
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{State: beaconState, Root: blockRoot[:]},
|
||||
FinalizationFetcher: &mock.ChainService{CurrentJustifiedCheckPoint: beaconState.CurrentJustifiedCheckpoint()},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
StateNotifier: chainService.StateNotifier(),
|
||||
StateGen: stategen.New(db, doublylinkedtree.New()),
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
OptimisticModeFetcher: &mock.ChainService{Optimistic: false},
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{State: beaconState, Root: blockRoot[:]},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
StateGen: stategen.New(db, doublylinkedtree.New()),
|
||||
},
|
||||
}
|
||||
require.NoError(t, db.SaveState(ctx, beaconState, blockRoot))
|
||||
util.SaveBlock(t, ctx, db, block)
|
||||
@@ -394,22 +396,18 @@ func TestGetAttestationData_SucceedsInFirstEpoch(t *testing.T) {
|
||||
blockRoots[1*params.BeaconConfig().SlotsPerEpoch] = targetRoot[:]
|
||||
blockRoots[2*params.BeaconConfig().SlotsPerEpoch] = justifiedRoot[:]
|
||||
require.NoError(t, beaconState.SetBlockRoots(blockRoots))
|
||||
chainService := &mock.ChainService{
|
||||
Genesis: time.Now(),
|
||||
}
|
||||
offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
attesterServer := &Server{
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: beaconState, Root: blockRoot[:],
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
OptimisticModeFetcher: &mock.ChainService{Optimistic: false},
|
||||
TimeFetcher: &mock.ChainService{Genesis: prysmTime.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
CoreService: &core.Service{
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: beaconState, Root: blockRoot[:],
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: prysmTime.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
},
|
||||
FinalizationFetcher: &mock.ChainService{
|
||||
CurrentJustifiedCheckPoint: beaconState.CurrentJustifiedCheckpoint(),
|
||||
},
|
||||
TimeFetcher: &mock.ChainService{Genesis: prysmTime.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
StateNotifier: chainService.StateNotifier(),
|
||||
}
|
||||
|
||||
req := ðpb.AttestationDataRequest{
|
||||
@@ -441,7 +439,6 @@ func TestServer_SubscribeCommitteeSubnets_NoSlots(t *testing.T) {
|
||||
attesterServer := &Server{
|
||||
HeadFetcher: &mock.ChainService{},
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
AttPool: attestations.NewPool(),
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
}
|
||||
@@ -462,7 +459,6 @@ func TestServer_SubscribeCommitteeSubnets_DifferentLengthSlots(t *testing.T) {
|
||||
attesterServer := &Server{
|
||||
HeadFetcher: &mock.ChainService{},
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
AttPool: attestations.NewPool(),
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
}
|
||||
@@ -508,7 +504,6 @@ func TestServer_SubscribeCommitteeSubnets_MultipleSlots(t *testing.T) {
|
||||
attesterServer := &Server{
|
||||
HeadFetcher: &mock.ChainService{State: state},
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
AttPool: attestations.NewPool(),
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ import (
|
||||
// and more.
|
||||
type Server struct {
|
||||
Ctx context.Context
|
||||
AttestationCache *cache.AttestationCache
|
||||
ProposerSlotIndexCache *cache.ProposerPayloadIDsCache
|
||||
HeadFetcher blockchain.HeadFetcher
|
||||
ForkFetcher blockchain.ForkFetcher
|
||||
|
||||
@@ -239,11 +239,12 @@ func (s *Service) Start() {
|
||||
Broadcaster: s.cfg.Broadcaster,
|
||||
SyncCommitteePool: s.cfg.SyncCommitteeObjectPool,
|
||||
OperationNotifier: s.cfg.OperationNotifier,
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
StateGen: s.cfg.StateGen,
|
||||
}
|
||||
|
||||
validatorServer := &validatorv1alpha1.Server{
|
||||
Ctx: s.ctx,
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
AttPool: s.cfg.AttestationsPool,
|
||||
ExitPool: s.cfg.ExitPool,
|
||||
HeadFetcher: s.cfg.HeadFetcher,
|
||||
@@ -302,6 +303,7 @@ func (s *Service) Start() {
|
||||
s.cfg.Router.HandleFunc("/eth/v1/validator/aggregate_and_proofs", validatorServerV1.SubmitAggregateAndProofs).Methods(http.MethodPost)
|
||||
s.cfg.Router.HandleFunc("/eth/v1/validator/sync_committee_subscriptions", validatorServerV1.SubmitSyncCommitteeSubscription).Methods(http.MethodPost)
|
||||
s.cfg.Router.HandleFunc("/eth/v1/validator/beacon_committee_subscriptions", validatorServerV1.SubmitBeaconCommitteeSubscription).Methods(http.MethodPost)
|
||||
s.cfg.Router.HandleFunc("/eth/v1/validator/attestation_data", validatorServerV1.GetAttestationData).Methods(http.MethodGet)
|
||||
|
||||
nodeServer := &nodev1alpha1.Server{
|
||||
LogsStreamer: logs.NewStreamServer(),
|
||||
|
||||
171
proto/eth/service/validator_service.pb.go
generated
171
proto/eth/service/validator_service.pb.go
generated
@@ -47,7 +47,7 @@ var file_proto_eth_service_validator_service_proto_rawDesc = []byte{
|
||||
0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x73, 0x7a, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f,
|
||||
0x76, 0x32, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x32, 0xda, 0x0f, 0x0a, 0x0f, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x56, 0x61, 0x6c,
|
||||
0x74, 0x6f, 0x32, 0xa9, 0x0e, 0x0a, 0x0f, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x56, 0x61, 0x6c,
|
||||
0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0xa3, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x74,
|
||||
0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x44, 0x75, 0x74, 0x69, 0x65, 0x73, 0x12, 0x26, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41,
|
||||
@@ -139,50 +139,39 @@ var file_proto_eth_service_validator_service_proto_rawDesc = []byte{
|
||||
0x01, 0x2a, 0x22, 0x2d, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74,
|
||||
0x68, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x72,
|
||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f,
|
||||
0x72, 0x12, 0xae, 0x01, 0x0a, 0x16, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x41, 0x74, 0x74,
|
||||
0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x50,
|
||||
0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x50,
|
||||
0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x82,
|
||||
0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f,
|
||||
0x72, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61,
|
||||
0x74, 0x61, 0x12, 0xd7, 0x01, 0x0a, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x53, 0x79,
|
||||
0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
|
||||
0x65, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x43, 0x6f,
|
||||
0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x39, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x43,
|
||||
0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75,
|
||||
0x74, 0x69, 0x6f, 0x6e, 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, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72,
|
||||
0x2f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f,
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x90, 0x01, 0x0a,
|
||||
0x0b, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x23, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x3a,
|
||||
0x01, 0x2a, 0x22, 0x2b, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74,
|
||||
0x68, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x6c,
|
||||
0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x7b, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x7d, 0x42,
|
||||
0x96, 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, 0x15, 0x56, 0x61,
|
||||
0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 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,
|
||||
0x72, 0x12, 0xd7, 0x01, 0x0a, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x53, 0x79, 0x6e,
|
||||
0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69,
|
||||
0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65,
|
||||
0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x39, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e,
|
||||
0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f,
|
||||
0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
|
||||
0x69, 0x6f, 0x6e, 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, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2f,
|
||||
0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x90, 0x01, 0x0a, 0x0b,
|
||||
0x47, 0x65, 0x74, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x23, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e,
|
||||
0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x3a, 0x01,
|
||||
0x2a, 0x22, 0x2b, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68,
|
||||
0x2f, 0x76, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x6c, 0x69,
|
||||
0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x7b, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x7d, 0x42, 0x96,
|
||||
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, 0x15, 0x56, 0x61, 0x6c,
|
||||
0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 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_validator_service_proto_goTypes = []interface{}{
|
||||
@@ -192,19 +181,17 @@ var file_proto_eth_service_validator_service_proto_goTypes = []interface{}{
|
||||
(*v1.ProduceBlockRequest)(nil), // 3: ethereum.eth.v1.ProduceBlockRequest
|
||||
(*v1.PrepareBeaconProposerRequest)(nil), // 4: ethereum.eth.v1.PrepareBeaconProposerRequest
|
||||
(*v1.SubmitValidatorRegistrationsRequest)(nil), // 5: ethereum.eth.v1.SubmitValidatorRegistrationsRequest
|
||||
(*v1.ProduceAttestationDataRequest)(nil), // 6: ethereum.eth.v1.ProduceAttestationDataRequest
|
||||
(*v2.ProduceSyncCommitteeContributionRequest)(nil), // 7: ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
(*v2.GetLivenessRequest)(nil), // 8: ethereum.eth.v2.GetLivenessRequest
|
||||
(*v1.AttesterDutiesResponse)(nil), // 9: ethereum.eth.v1.AttesterDutiesResponse
|
||||
(*v1.ProposerDutiesResponse)(nil), // 10: ethereum.eth.v1.ProposerDutiesResponse
|
||||
(*v2.SyncCommitteeDutiesResponse)(nil), // 11: ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
(*v2.ProduceBlockResponseV2)(nil), // 12: ethereum.eth.v2.ProduceBlockResponseV2
|
||||
(*v2.SSZContainer)(nil), // 13: ethereum.eth.v2.SSZContainer
|
||||
(*v2.ProduceBlindedBlockResponse)(nil), // 14: ethereum.eth.v2.ProduceBlindedBlockResponse
|
||||
(*empty.Empty)(nil), // 15: google.protobuf.Empty
|
||||
(*v1.ProduceAttestationDataResponse)(nil), // 16: ethereum.eth.v1.ProduceAttestationDataResponse
|
||||
(*v2.ProduceSyncCommitteeContributionResponse)(nil), // 17: ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
(*v2.GetLivenessResponse)(nil), // 18: ethereum.eth.v2.GetLivenessResponse
|
||||
(*v2.ProduceSyncCommitteeContributionRequest)(nil), // 6: ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
(*v2.GetLivenessRequest)(nil), // 7: ethereum.eth.v2.GetLivenessRequest
|
||||
(*v1.AttesterDutiesResponse)(nil), // 8: ethereum.eth.v1.AttesterDutiesResponse
|
||||
(*v1.ProposerDutiesResponse)(nil), // 9: ethereum.eth.v1.ProposerDutiesResponse
|
||||
(*v2.SyncCommitteeDutiesResponse)(nil), // 10: ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
(*v2.ProduceBlockResponseV2)(nil), // 11: ethereum.eth.v2.ProduceBlockResponseV2
|
||||
(*v2.SSZContainer)(nil), // 12: ethereum.eth.v2.SSZContainer
|
||||
(*v2.ProduceBlindedBlockResponse)(nil), // 13: ethereum.eth.v2.ProduceBlindedBlockResponse
|
||||
(*empty.Empty)(nil), // 14: google.protobuf.Empty
|
||||
(*v2.ProduceSyncCommitteeContributionResponse)(nil), // 15: ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
(*v2.GetLivenessResponse)(nil), // 16: ethereum.eth.v2.GetLivenessResponse
|
||||
}
|
||||
var file_proto_eth_service_validator_service_proto_depIdxs = []int32{
|
||||
0, // 0: ethereum.eth.service.BeaconValidator.GetAttesterDuties:input_type -> ethereum.eth.v1.AttesterDutiesRequest
|
||||
@@ -216,23 +203,21 @@ var file_proto_eth_service_validator_service_proto_depIdxs = []int32{
|
||||
3, // 6: ethereum.eth.service.BeaconValidator.ProduceBlindedBlockSSZ:input_type -> ethereum.eth.v1.ProduceBlockRequest
|
||||
4, // 7: ethereum.eth.service.BeaconValidator.PrepareBeaconProposer:input_type -> ethereum.eth.v1.PrepareBeaconProposerRequest
|
||||
5, // 8: ethereum.eth.service.BeaconValidator.SubmitValidatorRegistration:input_type -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest
|
||||
6, // 9: ethereum.eth.service.BeaconValidator.ProduceAttestationData:input_type -> ethereum.eth.v1.ProduceAttestationDataRequest
|
||||
7, // 10: ethereum.eth.service.BeaconValidator.ProduceSyncCommitteeContribution:input_type -> ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
8, // 11: ethereum.eth.service.BeaconValidator.GetLiveness:input_type -> ethereum.eth.v2.GetLivenessRequest
|
||||
9, // 12: ethereum.eth.service.BeaconValidator.GetAttesterDuties:output_type -> ethereum.eth.v1.AttesterDutiesResponse
|
||||
10, // 13: ethereum.eth.service.BeaconValidator.GetProposerDuties:output_type -> ethereum.eth.v1.ProposerDutiesResponse
|
||||
11, // 14: ethereum.eth.service.BeaconValidator.GetSyncCommitteeDuties:output_type -> ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
12, // 15: ethereum.eth.service.BeaconValidator.ProduceBlockV2:output_type -> ethereum.eth.v2.ProduceBlockResponseV2
|
||||
13, // 16: ethereum.eth.service.BeaconValidator.ProduceBlockV2SSZ:output_type -> ethereum.eth.v2.SSZContainer
|
||||
14, // 17: ethereum.eth.service.BeaconValidator.ProduceBlindedBlock:output_type -> ethereum.eth.v2.ProduceBlindedBlockResponse
|
||||
13, // 18: ethereum.eth.service.BeaconValidator.ProduceBlindedBlockSSZ:output_type -> ethereum.eth.v2.SSZContainer
|
||||
15, // 19: ethereum.eth.service.BeaconValidator.PrepareBeaconProposer:output_type -> google.protobuf.Empty
|
||||
15, // 20: ethereum.eth.service.BeaconValidator.SubmitValidatorRegistration:output_type -> google.protobuf.Empty
|
||||
16, // 21: ethereum.eth.service.BeaconValidator.ProduceAttestationData:output_type -> ethereum.eth.v1.ProduceAttestationDataResponse
|
||||
17, // 22: ethereum.eth.service.BeaconValidator.ProduceSyncCommitteeContribution:output_type -> ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
18, // 23: ethereum.eth.service.BeaconValidator.GetLiveness:output_type -> ethereum.eth.v2.GetLivenessResponse
|
||||
12, // [12:24] is the sub-list for method output_type
|
||||
0, // [0:12] is the sub-list for method input_type
|
||||
6, // 9: ethereum.eth.service.BeaconValidator.ProduceSyncCommitteeContribution:input_type -> ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
7, // 10: ethereum.eth.service.BeaconValidator.GetLiveness:input_type -> ethereum.eth.v2.GetLivenessRequest
|
||||
8, // 11: ethereum.eth.service.BeaconValidator.GetAttesterDuties:output_type -> ethereum.eth.v1.AttesterDutiesResponse
|
||||
9, // 12: ethereum.eth.service.BeaconValidator.GetProposerDuties:output_type -> ethereum.eth.v1.ProposerDutiesResponse
|
||||
10, // 13: ethereum.eth.service.BeaconValidator.GetSyncCommitteeDuties:output_type -> ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
11, // 14: ethereum.eth.service.BeaconValidator.ProduceBlockV2:output_type -> ethereum.eth.v2.ProduceBlockResponseV2
|
||||
12, // 15: ethereum.eth.service.BeaconValidator.ProduceBlockV2SSZ:output_type -> ethereum.eth.v2.SSZContainer
|
||||
13, // 16: ethereum.eth.service.BeaconValidator.ProduceBlindedBlock:output_type -> ethereum.eth.v2.ProduceBlindedBlockResponse
|
||||
12, // 17: ethereum.eth.service.BeaconValidator.ProduceBlindedBlockSSZ:output_type -> ethereum.eth.v2.SSZContainer
|
||||
14, // 18: ethereum.eth.service.BeaconValidator.PrepareBeaconProposer:output_type -> google.protobuf.Empty
|
||||
14, // 19: ethereum.eth.service.BeaconValidator.SubmitValidatorRegistration:output_type -> google.protobuf.Empty
|
||||
15, // 20: ethereum.eth.service.BeaconValidator.ProduceSyncCommitteeContribution:output_type -> ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
16, // 21: ethereum.eth.service.BeaconValidator.GetLiveness:output_type -> ethereum.eth.v2.GetLivenessResponse
|
||||
11, // [11:22] is the sub-list for method output_type
|
||||
0, // [0:11] 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
|
||||
@@ -283,7 +268,6 @@ type BeaconValidatorClient interface {
|
||||
ProduceBlindedBlockSSZ(ctx context.Context, in *v1.ProduceBlockRequest, opts ...grpc.CallOption) (*v2.SSZContainer, error)
|
||||
PrepareBeaconProposer(ctx context.Context, in *v1.PrepareBeaconProposerRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
SubmitValidatorRegistration(ctx context.Context, in *v1.SubmitValidatorRegistrationsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
ProduceAttestationData(ctx context.Context, in *v1.ProduceAttestationDataRequest, opts ...grpc.CallOption) (*v1.ProduceAttestationDataResponse, error)
|
||||
ProduceSyncCommitteeContribution(ctx context.Context, in *v2.ProduceSyncCommitteeContributionRequest, opts ...grpc.CallOption) (*v2.ProduceSyncCommitteeContributionResponse, error)
|
||||
GetLiveness(ctx context.Context, in *v2.GetLivenessRequest, opts ...grpc.CallOption) (*v2.GetLivenessResponse, error)
|
||||
}
|
||||
@@ -377,15 +361,6 @@ func (c *beaconValidatorClient) SubmitValidatorRegistration(ctx context.Context,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *beaconValidatorClient) ProduceAttestationData(ctx context.Context, in *v1.ProduceAttestationDataRequest, opts ...grpc.CallOption) (*v1.ProduceAttestationDataResponse, error) {
|
||||
out := new(v1.ProduceAttestationDataResponse)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconValidator/ProduceAttestationData", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *beaconValidatorClient) ProduceSyncCommitteeContribution(ctx context.Context, in *v2.ProduceSyncCommitteeContributionRequest, opts ...grpc.CallOption) (*v2.ProduceSyncCommitteeContributionResponse, error) {
|
||||
out := new(v2.ProduceSyncCommitteeContributionResponse)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconValidator/ProduceSyncCommitteeContribution", in, out, opts...)
|
||||
@@ -415,7 +390,6 @@ type BeaconValidatorServer interface {
|
||||
ProduceBlindedBlockSSZ(context.Context, *v1.ProduceBlockRequest) (*v2.SSZContainer, error)
|
||||
PrepareBeaconProposer(context.Context, *v1.PrepareBeaconProposerRequest) (*empty.Empty, error)
|
||||
SubmitValidatorRegistration(context.Context, *v1.SubmitValidatorRegistrationsRequest) (*empty.Empty, error)
|
||||
ProduceAttestationData(context.Context, *v1.ProduceAttestationDataRequest) (*v1.ProduceAttestationDataResponse, error)
|
||||
ProduceSyncCommitteeContribution(context.Context, *v2.ProduceSyncCommitteeContributionRequest) (*v2.ProduceSyncCommitteeContributionResponse, error)
|
||||
GetLiveness(context.Context, *v2.GetLivenessRequest) (*v2.GetLivenessResponse, error)
|
||||
}
|
||||
@@ -451,9 +425,6 @@ func (*UnimplementedBeaconValidatorServer) PrepareBeaconProposer(context.Context
|
||||
func (*UnimplementedBeaconValidatorServer) SubmitValidatorRegistration(context.Context, *v1.SubmitValidatorRegistrationsRequest) (*empty.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SubmitValidatorRegistration not implemented")
|
||||
}
|
||||
func (*UnimplementedBeaconValidatorServer) ProduceAttestationData(context.Context, *v1.ProduceAttestationDataRequest) (*v1.ProduceAttestationDataResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ProduceAttestationData not implemented")
|
||||
}
|
||||
func (*UnimplementedBeaconValidatorServer) ProduceSyncCommitteeContribution(context.Context, *v2.ProduceSyncCommitteeContributionRequest) (*v2.ProduceSyncCommitteeContributionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ProduceSyncCommitteeContribution not implemented")
|
||||
}
|
||||
@@ -627,24 +598,6 @@ func _BeaconValidator_SubmitValidatorRegistration_Handler(srv interface{}, ctx c
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BeaconValidator_ProduceAttestationData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(v1.ProduceAttestationDataRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(BeaconValidatorServer).ProduceAttestationData(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ethereum.eth.service.BeaconValidator/ProduceAttestationData",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BeaconValidatorServer).ProduceAttestationData(ctx, req.(*v1.ProduceAttestationDataRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BeaconValidator_ProduceSyncCommitteeContribution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(v2.ProduceSyncCommitteeContributionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -721,10 +674,6 @@ var _BeaconValidator_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "SubmitValidatorRegistration",
|
||||
Handler: _BeaconValidator_SubmitValidatorRegistration_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ProduceAttestationData",
|
||||
Handler: _BeaconValidator_ProduceAttestationData_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ProduceSyncCommitteeContribution",
|
||||
Handler: _BeaconValidator_ProduceSyncCommitteeContribution_Handler,
|
||||
|
||||
@@ -589,42 +589,6 @@ func local_request_BeaconValidator_SubmitValidatorRegistration_0(ctx context.Con
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_BeaconValidator_ProduceAttestationData_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_BeaconValidator_ProduceAttestationData_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1.ProduceAttestationDataRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_ProduceAttestationData_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ProduceAttestationData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_BeaconValidator_ProduceAttestationData_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1.ProduceAttestationDataRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BeaconValidator_ProduceAttestationData_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ProduceAttestationData(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_BeaconValidator_ProduceSyncCommitteeContribution_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
@@ -944,29 +908,6 @@ func RegisterBeaconValidatorHandlerServer(ctx context.Context, mux *runtime.Serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_BeaconValidator_ProduceAttestationData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.service.BeaconValidator/ProduceAttestationData")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_BeaconValidator_ProduceAttestationData_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_BeaconValidator_ProduceAttestationData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_BeaconValidator_ProduceSyncCommitteeContribution_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -1234,26 +1175,6 @@ func RegisterBeaconValidatorHandlerClient(ctx context.Context, mux *runtime.Serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_BeaconValidator_ProduceAttestationData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.service.BeaconValidator/ProduceAttestationData")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_BeaconValidator_ProduceAttestationData_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_BeaconValidator_ProduceAttestationData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_BeaconValidator_ProduceSyncCommitteeContribution_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -1316,8 +1237,6 @@ var (
|
||||
|
||||
pattern_BeaconValidator_SubmitValidatorRegistration_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "validator", "register_validator"}, ""))
|
||||
|
||||
pattern_BeaconValidator_ProduceAttestationData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "validator", "attestation_data"}, ""))
|
||||
|
||||
pattern_BeaconValidator_ProduceSyncCommitteeContribution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "validator", "sync_committee_contribution"}, ""))
|
||||
|
||||
pattern_BeaconValidator_GetLiveness_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", "validator", "liveness", "epoch"}, ""))
|
||||
@@ -1342,8 +1261,6 @@ var (
|
||||
|
||||
forward_BeaconValidator_SubmitValidatorRegistration_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_ProduceAttestationData_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_ProduceSyncCommitteeContribution_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_GetLiveness_0 = runtime.ForwardResponseMessage
|
||||
|
||||
@@ -186,20 +186,6 @@ service BeaconValidator {
|
||||
};
|
||||
}
|
||||
|
||||
// ProduceAttestationData requests that the beacon node produces attestation data for
|
||||
// the requested committee index and slot based on the nodes current head.
|
||||
//
|
||||
// HTTP response usage:
|
||||
// - 200: Successful response
|
||||
// - 400: Invalid request syntax
|
||||
// - 500: Beacon node internal error
|
||||
// - 503: Beacon node is currently syncing, try again later
|
||||
//
|
||||
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Validator/produceAttestationData
|
||||
rpc ProduceAttestationData(v1.ProduceAttestationDataRequest) returns (v1.ProduceAttestationDataResponse) {
|
||||
option (google.api.http) = { get: "/internal/eth/v1/validator/attestation_data" };
|
||||
}
|
||||
|
||||
// ProduceSyncCommitteeContribution requests that the beacon node produces a sync committee contribution.
|
||||
//
|
||||
// HTTP response usage:
|
||||
|
||||
367
proto/eth/v1/validator.pb.go
generated
367
proto/eth/v1/validator.pb.go
generated
@@ -773,108 +773,6 @@ func (x *ProduceBlockResponse) GetData() *BeaconBlock {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ProduceAttestationDataRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Slot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"`
|
||||
CommitteeIndex github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.CommitteeIndex `protobuf:"varint,2,opt,name=committee_index,json=committeeIndex,proto3" json:"committee_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.CommitteeIndex"`
|
||||
}
|
||||
|
||||
func (x *ProduceAttestationDataRequest) Reset() {
|
||||
*x = ProduceAttestationDataRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ProduceAttestationDataRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ProduceAttestationDataRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ProduceAttestationDataRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[10]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ProduceAttestationDataRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ProduceAttestationDataRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *ProduceAttestationDataRequest) GetSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot {
|
||||
if x != nil {
|
||||
return x.Slot
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot(0)
|
||||
}
|
||||
|
||||
func (x *ProduceAttestationDataRequest) GetCommitteeIndex() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.CommitteeIndex {
|
||||
if x != nil {
|
||||
return x.CommitteeIndex
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.CommitteeIndex(0)
|
||||
}
|
||||
|
||||
type ProduceAttestationDataResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data *AttestationData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ProduceAttestationDataResponse) Reset() {
|
||||
*x = ProduceAttestationDataResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ProduceAttestationDataResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ProduceAttestationDataResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ProduceAttestationDataResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[11]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ProduceAttestationDataResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ProduceAttestationDataResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *ProduceAttestationDataResponse) GetData() *AttestationData {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PrepareBeaconProposerRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -886,7 +784,7 @@ type PrepareBeaconProposerRequest struct {
|
||||
func (x *PrepareBeaconProposerRequest) Reset() {
|
||||
*x = PrepareBeaconProposerRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[12]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -899,7 +797,7 @@ func (x *PrepareBeaconProposerRequest) String() string {
|
||||
func (*PrepareBeaconProposerRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PrepareBeaconProposerRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[12]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[10]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -912,7 +810,7 @@ func (x *PrepareBeaconProposerRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PrepareBeaconProposerRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PrepareBeaconProposerRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{12}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *PrepareBeaconProposerRequest) GetRecipients() []*PrepareBeaconProposerRequest_FeeRecipientContainer {
|
||||
@@ -933,7 +831,7 @@ type SubmitValidatorRegistrationsRequest struct {
|
||||
func (x *SubmitValidatorRegistrationsRequest) Reset() {
|
||||
*x = SubmitValidatorRegistrationsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[13]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -946,7 +844,7 @@ func (x *SubmitValidatorRegistrationsRequest) String() string {
|
||||
func (*SubmitValidatorRegistrationsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[13]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[11]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -959,7 +857,7 @@ func (x *SubmitValidatorRegistrationsRequest) ProtoReflect() protoreflect.Messag
|
||||
|
||||
// Deprecated: Use SubmitValidatorRegistrationsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SubmitValidatorRegistrationsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{13}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest) GetRegistrations() []*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration {
|
||||
@@ -981,7 +879,7 @@ type PrepareBeaconProposerRequest_FeeRecipientContainer struct {
|
||||
func (x *PrepareBeaconProposerRequest_FeeRecipientContainer) Reset() {
|
||||
*x = PrepareBeaconProposerRequest_FeeRecipientContainer{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[14]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -994,7 +892,7 @@ func (x *PrepareBeaconProposerRequest_FeeRecipientContainer) String() string {
|
||||
func (*PrepareBeaconProposerRequest_FeeRecipientContainer) ProtoMessage() {}
|
||||
|
||||
func (x *PrepareBeaconProposerRequest_FeeRecipientContainer) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[14]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[12]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1007,7 +905,7 @@ func (x *PrepareBeaconProposerRequest_FeeRecipientContainer) ProtoReflect() prot
|
||||
|
||||
// Deprecated: Use PrepareBeaconProposerRequest_FeeRecipientContainer.ProtoReflect.Descriptor instead.
|
||||
func (*PrepareBeaconProposerRequest_FeeRecipientContainer) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{12, 0}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{10, 0}
|
||||
}
|
||||
|
||||
func (x *PrepareBeaconProposerRequest_FeeRecipientContainer) GetFeeRecipient() []byte {
|
||||
@@ -1038,7 +936,7 @@ type SubmitValidatorRegistrationsRequest_ValidatorRegistration struct {
|
||||
func (x *SubmitValidatorRegistrationsRequest_ValidatorRegistration) Reset() {
|
||||
*x = SubmitValidatorRegistrationsRequest_ValidatorRegistration{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[15]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1051,7 +949,7 @@ func (x *SubmitValidatorRegistrationsRequest_ValidatorRegistration) String() str
|
||||
func (*SubmitValidatorRegistrationsRequest_ValidatorRegistration) ProtoMessage() {}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest_ValidatorRegistration) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[15]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[13]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1064,7 +962,7 @@ func (x *SubmitValidatorRegistrationsRequest_ValidatorRegistration) ProtoReflect
|
||||
|
||||
// Deprecated: Use SubmitValidatorRegistrationsRequest_ValidatorRegistration.ProtoReflect.Descriptor instead.
|
||||
func (*SubmitValidatorRegistrationsRequest_ValidatorRegistration) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{13, 0}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{11, 0}
|
||||
}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest_ValidatorRegistration) GetFeeRecipient() []byte {
|
||||
@@ -1107,7 +1005,7 @@ type SubmitValidatorRegistrationsRequest_SignedValidatorRegistration struct {
|
||||
func (x *SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) Reset() {
|
||||
*x = SubmitValidatorRegistrationsRequest_SignedValidatorRegistration{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[16]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1120,7 +1018,7 @@ func (x *SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) String
|
||||
func (*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) ProtoMessage() {}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[16]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[14]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1133,7 +1031,7 @@ func (x *SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) ProtoR
|
||||
|
||||
// Deprecated: Use SubmitValidatorRegistrationsRequest_SignedValidatorRegistration.ProtoReflect.Descriptor instead.
|
||||
func (*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{13, 1}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{11, 1}
|
||||
}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) GetMessage() *SubmitValidatorRegistrationsRequest_ValidatorRegistration {
|
||||
@@ -1338,104 +1236,83 @@ var file_proto_eth_v1_validator_proto_rawDesc = []byte{
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e,
|
||||
0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xf4, 0x01, 0x0a, 0x1d, 0x50, 0x72, 0x6f,
|
||||
0x64, 0x75, 0x63, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44,
|
||||
0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c,
|
||||
0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 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,
|
||||
0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f,
|
||||
0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52,
|
||||
0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x78, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74,
|
||||
0x65, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f,
|
||||
0x63, 0x6b, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xc4, 0x02, 0x0a, 0x1c, 0x50, 0x72, 0x65,
|
||||
0x70, 0x61, 0x72, 0x65, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73,
|
||||
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x63, 0x0a, 0x0a, 0x72, 0x65, 0x63,
|
||||
0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e,
|
||||
0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x50, 0x72, 0x6f,
|
||||
0x70, 0x6f, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x46, 0x65, 0x65,
|
||||
0x52, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
|
||||
0x65, 0x72, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0xbe,
|
||||
0x01, 0x0a, 0x15, 0x46, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x43,
|
||||
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x0d, 0x66, 0x65, 0x65, 0x5f,
|
||||
0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42,
|
||||
0x06, 0x8a, 0xb5, 0x18, 0x02, 0x32, 0x30, 0x52, 0x0c, 0x66, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69,
|
||||
0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x78, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f,
|
||||
0x82, 0xb5, 0x18, 0x4b, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d,
|
||||
0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73,
|
||||
0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52,
|
||||
0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22,
|
||||
0x56, 0x0a, 0x1e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x34, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x20, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74,
|
||||
0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xc4, 0x02, 0x0a, 0x1c, 0x50, 0x72, 0x65, 0x70,
|
||||
0x61, 0x72, 0x65, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65,
|
||||
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x63, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x69,
|
||||
0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x50,
|
||||
0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x70,
|
||||
0x6f, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x46, 0x65, 0x65, 0x52,
|
||||
0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
|
||||
0x72, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0xbe, 0x01,
|
||||
0x0a, 0x15, 0x46, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x6f,
|
||||
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x0d, 0x66, 0x65, 0x65, 0x5f, 0x72,
|
||||
0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06,
|
||||
0x8a, 0xb5, 0x18, 0x02, 0x32, 0x30, 0x52, 0x0c, 0x66, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69, 0x70,
|
||||
0x69, 0x65, 0x6e, 0x74, 0x12, 0x78, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f,
|
||||
0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82,
|
||||
0xb5, 0x18, 0x4b, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74,
|
||||
0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e,
|
||||
0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0e,
|
||||
0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xeb,
|
||||
0x03, 0x0a, 0x23, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x76, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x50, 0x2e,
|
||||
0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52,
|
||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
||||
0x0d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x9f,
|
||||
0x01, 0x0a, 0x15, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x67, 0x69,
|
||||
0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x0d, 0x66, 0x65, 0x65, 0x5f,
|
||||
0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42,
|
||||
0x06, 0x8a, 0xb5, 0x18, 0x02, 0x32, 0x30, 0x52, 0x0c, 0x66, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69,
|
||||
0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x6d,
|
||||
0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d,
|
||||
0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x12, 0x1e, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x34, 0x38, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79,
|
||||
0x1a, 0xa9, 0x01, 0x0a, 0x1b, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x64, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x4a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52,
|
||||
0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22,
|
||||
0xeb, 0x03, 0x0a, 0x23, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f,
|
||||
0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
|
||||
0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39,
|
||||
0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2a, 0x87, 0x02, 0x0a,
|
||||
0x0f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x12, 0x17, 0x0a, 0x13, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x49, 0x4e, 0x49, 0x54,
|
||||
0x49, 0x41, 0x4c, 0x49, 0x5a, 0x45, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x45, 0x4e,
|
||||
0x44, 0x49, 0x4e, 0x47, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12, 0x0a,
|
||||
0x0e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x4f, 0x4e, 0x47, 0x4f, 0x49, 0x4e, 0x47, 0x10,
|
||||
0x02, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x45, 0x58, 0x49, 0x54,
|
||||
0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f,
|
||||
0x53, 0x4c, 0x41, 0x53, 0x48, 0x45, 0x44, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x58, 0x49,
|
||||
0x54, 0x45, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x4c, 0x41, 0x53, 0x48, 0x45, 0x44, 0x10, 0x05, 0x12,
|
||||
0x12, 0x0a, 0x0e, 0x45, 0x58, 0x49, 0x54, 0x45, 0x44, 0x5f, 0x53, 0x4c, 0x41, 0x53, 0x48, 0x45,
|
||||
0x44, 0x10, 0x06, 0x12, 0x17, 0x0a, 0x13, 0x57, 0x49, 0x54, 0x48, 0x44, 0x52, 0x41, 0x57, 0x41,
|
||||
0x4c, 0x5f, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x4c, 0x45, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f,
|
||||
0x57, 0x49, 0x54, 0x48, 0x44, 0x52, 0x41, 0x57, 0x41, 0x4c, 0x5f, 0x44, 0x4f, 0x4e, 0x45, 0x10,
|
||||
0x08, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x09, 0x12, 0x0b, 0x0a,
|
||||
0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x0a, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x58,
|
||||
0x49, 0x54, 0x45, 0x44, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x57, 0x49, 0x54, 0x48, 0x44, 0x52,
|
||||
0x41, 0x57, 0x41, 0x4c, 0x10, 0x0c, 0x42, 0x7b, 0x0a, 0x13, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x42, 0x0e, 0x56,
|
||||
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
|
||||
0x2e, 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, 0x76, 0x31, 0xaa,
|
||||
0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56,
|
||||
0x31, 0xca, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68,
|
||||
0x5c, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x76, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x73,
|
||||
0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x50,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72,
|
||||
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a,
|
||||
0x9f, 0x01, 0x0a, 0x15, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x67,
|
||||
0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x0d, 0x66, 0x65, 0x65,
|
||||
0x5f, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x32, 0x30, 0x52, 0x0c, 0x66, 0x65, 0x65, 0x52, 0x65, 0x63,
|
||||
0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, 0x69,
|
||||
0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69,
|
||||
0x6d, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
||||
0x70, 0x12, 0x1e, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x34, 0x38, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65,
|
||||
0x79, 0x1a, 0xa9, 0x01, 0x0a, 0x1b, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x69,
|
||||
0x64, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x64, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x4a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07,
|
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02,
|
||||
0x39, 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2a, 0x87, 0x02,
|
||||
0x0a, 0x0f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x49, 0x4e, 0x49,
|
||||
0x54, 0x49, 0x41, 0x4c, 0x49, 0x5a, 0x45, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x45,
|
||||
0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12,
|
||||
0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x4f, 0x4e, 0x47, 0x4f, 0x49, 0x4e, 0x47,
|
||||
0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x45, 0x58, 0x49,
|
||||
0x54, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45,
|
||||
0x5f, 0x53, 0x4c, 0x41, 0x53, 0x48, 0x45, 0x44, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x58,
|
||||
0x49, 0x54, 0x45, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x4c, 0x41, 0x53, 0x48, 0x45, 0x44, 0x10, 0x05,
|
||||
0x12, 0x12, 0x0a, 0x0e, 0x45, 0x58, 0x49, 0x54, 0x45, 0x44, 0x5f, 0x53, 0x4c, 0x41, 0x53, 0x48,
|
||||
0x45, 0x44, 0x10, 0x06, 0x12, 0x17, 0x0a, 0x13, 0x57, 0x49, 0x54, 0x48, 0x44, 0x52, 0x41, 0x57,
|
||||
0x41, 0x4c, 0x5f, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x4c, 0x45, 0x10, 0x07, 0x12, 0x13, 0x0a,
|
||||
0x0f, 0x57, 0x49, 0x54, 0x48, 0x44, 0x52, 0x41, 0x57, 0x41, 0x4c, 0x5f, 0x44, 0x4f, 0x4e, 0x45,
|
||||
0x10, 0x08, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x09, 0x12, 0x0b,
|
||||
0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x0a, 0x12, 0x0a, 0x0a, 0x06, 0x45,
|
||||
0x58, 0x49, 0x54, 0x45, 0x44, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x57, 0x49, 0x54, 0x48, 0x44,
|
||||
0x52, 0x41, 0x57, 0x41, 0x4c, 0x10, 0x0c, 0x42, 0x7b, 0x0a, 0x13, 0x6f, 0x72, 0x67, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x42, 0x0e,
|
||||
0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||
0x5a, 0x2e, 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, 0x76, 0x31,
|
||||
0xaa, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e,
|
||||
0x56, 0x31, 0xca, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74,
|
||||
0x68, 0x5c, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -1451,7 +1328,7 @@ func file_proto_eth_v1_validator_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_proto_eth_v1_validator_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_proto_eth_v1_validator_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
|
||||
var file_proto_eth_v1_validator_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||
var file_proto_eth_v1_validator_proto_goTypes = []interface{}{
|
||||
(ValidatorStatus)(0), // 0: ethereum.eth.v1.ValidatorStatus
|
||||
(*ValidatorContainer)(nil), // 1: ethereum.eth.v1.ValidatorContainer
|
||||
@@ -1464,31 +1341,27 @@ var file_proto_eth_v1_validator_proto_goTypes = []interface{}{
|
||||
(*ProposerDuty)(nil), // 8: ethereum.eth.v1.ProposerDuty
|
||||
(*ProduceBlockRequest)(nil), // 9: ethereum.eth.v1.ProduceBlockRequest
|
||||
(*ProduceBlockResponse)(nil), // 10: ethereum.eth.v1.ProduceBlockResponse
|
||||
(*ProduceAttestationDataRequest)(nil), // 11: ethereum.eth.v1.ProduceAttestationDataRequest
|
||||
(*ProduceAttestationDataResponse)(nil), // 12: ethereum.eth.v1.ProduceAttestationDataResponse
|
||||
(*PrepareBeaconProposerRequest)(nil), // 13: ethereum.eth.v1.PrepareBeaconProposerRequest
|
||||
(*SubmitValidatorRegistrationsRequest)(nil), // 14: ethereum.eth.v1.SubmitValidatorRegistrationsRequest
|
||||
(*PrepareBeaconProposerRequest_FeeRecipientContainer)(nil), // 15: ethereum.eth.v1.PrepareBeaconProposerRequest.FeeRecipientContainer
|
||||
(*SubmitValidatorRegistrationsRequest_ValidatorRegistration)(nil), // 16: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.ValidatorRegistration
|
||||
(*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration)(nil), // 17: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration
|
||||
(*BeaconBlock)(nil), // 18: ethereum.eth.v1.BeaconBlock
|
||||
(*AttestationData)(nil), // 19: ethereum.eth.v1.AttestationData
|
||||
(*PrepareBeaconProposerRequest)(nil), // 11: ethereum.eth.v1.PrepareBeaconProposerRequest
|
||||
(*SubmitValidatorRegistrationsRequest)(nil), // 12: ethereum.eth.v1.SubmitValidatorRegistrationsRequest
|
||||
(*PrepareBeaconProposerRequest_FeeRecipientContainer)(nil), // 13: ethereum.eth.v1.PrepareBeaconProposerRequest.FeeRecipientContainer
|
||||
(*SubmitValidatorRegistrationsRequest_ValidatorRegistration)(nil), // 14: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.ValidatorRegistration
|
||||
(*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration)(nil), // 15: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration
|
||||
(*BeaconBlock)(nil), // 16: ethereum.eth.v1.BeaconBlock
|
||||
}
|
||||
var file_proto_eth_v1_validator_proto_depIdxs = []int32{
|
||||
0, // 0: ethereum.eth.v1.ValidatorContainer.status:type_name -> ethereum.eth.v1.ValidatorStatus
|
||||
2, // 1: ethereum.eth.v1.ValidatorContainer.validator:type_name -> ethereum.eth.v1.Validator
|
||||
5, // 2: ethereum.eth.v1.AttesterDutiesResponse.data:type_name -> ethereum.eth.v1.AttesterDuty
|
||||
8, // 3: ethereum.eth.v1.ProposerDutiesResponse.data:type_name -> ethereum.eth.v1.ProposerDuty
|
||||
18, // 4: ethereum.eth.v1.ProduceBlockResponse.data:type_name -> ethereum.eth.v1.BeaconBlock
|
||||
19, // 5: ethereum.eth.v1.ProduceAttestationDataResponse.data:type_name -> ethereum.eth.v1.AttestationData
|
||||
15, // 6: ethereum.eth.v1.PrepareBeaconProposerRequest.recipients:type_name -> ethereum.eth.v1.PrepareBeaconProposerRequest.FeeRecipientContainer
|
||||
17, // 7: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.registrations:type_name -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration
|
||||
16, // 8: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration.message:type_name -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest.ValidatorRegistration
|
||||
9, // [9:9] is the sub-list for method output_type
|
||||
9, // [9:9] is the sub-list for method input_type
|
||||
9, // [9:9] is the sub-list for extension type_name
|
||||
9, // [9:9] is the sub-list for extension extendee
|
||||
0, // [0:9] is the sub-list for field type_name
|
||||
16, // 4: ethereum.eth.v1.ProduceBlockResponse.data:type_name -> ethereum.eth.v1.BeaconBlock
|
||||
13, // 5: ethereum.eth.v1.PrepareBeaconProposerRequest.recipients:type_name -> ethereum.eth.v1.PrepareBeaconProposerRequest.FeeRecipientContainer
|
||||
15, // 6: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.registrations:type_name -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration
|
||||
14, // 7: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration.message:type_name -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest.ValidatorRegistration
|
||||
8, // [8:8] is the sub-list for method output_type
|
||||
8, // [8:8] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_eth_v1_validator_proto_init() }
|
||||
@@ -1620,30 +1493,6 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ProduceAttestationDataRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ProduceAttestationDataResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PrepareBeaconProposerRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1655,7 +1504,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v1_validator_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitValidatorRegistrationsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1667,7 +1516,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v1_validator_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PrepareBeaconProposerRequest_FeeRecipientContainer); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1679,7 +1528,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v1_validator_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitValidatorRegistrationsRequest_ValidatorRegistration); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1691,7 +1540,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v1_validator_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1711,7 +1560,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_eth_v1_validator_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 17,
|
||||
NumMessages: 15,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -163,18 +163,6 @@ message ProduceBlockResponse {
|
||||
BeaconBlock data = 1;
|
||||
}
|
||||
|
||||
message ProduceAttestationDataRequest {
|
||||
// Slot for which the attestation data should be retrieved for.
|
||||
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"];
|
||||
|
||||
// Committee index for which the attestation data should be retrieved for.
|
||||
uint64 committee_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.CommitteeIndex"];
|
||||
}
|
||||
|
||||
message ProduceAttestationDataResponse {
|
||||
AttestationData data = 1;
|
||||
}
|
||||
|
||||
message PrepareBeaconProposerRequest {
|
||||
message FeeRecipientContainer {
|
||||
// The address of the fee recipient.
|
||||
@@ -205,4 +193,4 @@ message SubmitValidatorRegistrationsRequest {
|
||||
}
|
||||
|
||||
repeated SignedValidatorRegistration registrations = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ go_library(
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/core/signing:go_default_library",
|
||||
"//beacon-chain/rpc/apimiddleware:go_default_library",
|
||||
"//beacon-chain/rpc/eth/validator:go_default_library",
|
||||
"//beacon-chain/rpc/prysm/validator:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
@@ -107,6 +108,7 @@ go_test(
|
||||
"//api/gateway/apimiddleware:go_default_library",
|
||||
"//beacon-chain/rpc/apimiddleware:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//beacon-chain/rpc/eth/validator:go_default_library",
|
||||
"//beacon-chain/rpc/prysm/validator:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
rpcmiddleware "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
@@ -22,7 +22,7 @@ func (c beaconApiValidatorClient) getAttestationData(
|
||||
params.Add("committee_index", strconv.FormatUint(uint64(reqCommitteeIndex), 10))
|
||||
|
||||
query := buildURL("/eth/v1/validator/attestation_data", params)
|
||||
produceAttestationDataResponseJson := rpcmiddleware.ProduceAttestationDataResponseJson{}
|
||||
produceAttestationDataResponseJson := validator.GetAttestationDataResponse{}
|
||||
|
||||
if _, err := c.jsonRestHandler.GetRestJsonResponse(ctx, query, &produceAttestationDataResponseJson); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get json response")
|
||||
|
||||
@@ -9,7 +9,8 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
rpcmiddleware "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@@ -30,7 +31,7 @@ func TestGetAttestationData_ValidAttestation(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := mock.NewMockjsonRestHandler(ctrl)
|
||||
produceAttestationDataResponseJson := rpcmiddleware.ProduceAttestationDataResponseJson{}
|
||||
produceAttestationDataResponseJson := validator.GetAttestationDataResponse{}
|
||||
|
||||
jsonRestHandler.EXPECT().GetRestJsonResponse(
|
||||
ctx,
|
||||
@@ -41,16 +42,16 @@ func TestGetAttestationData_ValidAttestation(t *testing.T) {
|
||||
nil,
|
||||
).SetArg(
|
||||
2,
|
||||
rpcmiddleware.ProduceAttestationDataResponseJson{
|
||||
Data: &rpcmiddleware.AttestationDataJson{
|
||||
validator.GetAttestationDataResponse{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(expectedSlot, 10),
|
||||
CommitteeIndex: strconv.FormatUint(expectedCommitteeIndex, 10),
|
||||
BeaconBlockRoot: expectedBeaconBlockRoot,
|
||||
Source: &rpcmiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(expectedSourceEpoch, 10),
|
||||
Root: expectedSourceRoot,
|
||||
},
|
||||
Target: &rpcmiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(expectedTargetEpoch, 10),
|
||||
Root: expectedTargetRoot,
|
||||
},
|
||||
@@ -81,13 +82,13 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateData func() rpcmiddleware.ProduceAttestationDataResponseJson
|
||||
generateData func() validator.GetAttestationDataResponse
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil attestation data",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
return rpcmiddleware.ProduceAttestationDataResponseJson{
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
return validator.GetAttestationDataResponse{
|
||||
Data: nil,
|
||||
}
|
||||
},
|
||||
@@ -95,7 +96,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid committee index",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.CommitteeIndex = "foo"
|
||||
return attestation
|
||||
@@ -104,7 +105,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid block root",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.BeaconBlockRoot = "foo"
|
||||
return attestation
|
||||
@@ -113,7 +114,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid slot",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.Slot = "foo"
|
||||
return attestation
|
||||
@@ -122,7 +123,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "nil source",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.Source = nil
|
||||
return attestation
|
||||
@@ -131,7 +132,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid source epoch",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.Source.Epoch = "foo"
|
||||
return attestation
|
||||
@@ -140,7 +141,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid source root",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.Source.Root = "foo"
|
||||
return attestation
|
||||
@@ -149,7 +150,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "nil target",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.Target = nil
|
||||
return attestation
|
||||
@@ -158,7 +159,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid target epoch",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.Target.Epoch = "foo"
|
||||
return attestation
|
||||
@@ -167,7 +168,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid target root",
|
||||
generateData: func() rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
generateData: func() validator.GetAttestationDataResponse {
|
||||
attestation := generateValidAttestation(1, 2)
|
||||
attestation.Data.Target.Root = "foo"
|
||||
return attestation
|
||||
@@ -181,7 +182,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
produceAttestationDataResponseJson := rpcmiddleware.ProduceAttestationDataResponseJson{}
|
||||
produceAttestationDataResponseJson := validator.GetAttestationDataResponse{}
|
||||
jsonRestHandler := mock.NewMockjsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().GetRestJsonResponse(
|
||||
ctx,
|
||||
@@ -212,7 +213,7 @@ func TestGetAttestationData_JsonResponseError(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := mock.NewMockjsonRestHandler(ctrl)
|
||||
produceAttestationDataResponseJson := rpcmiddleware.ProduceAttestationDataResponseJson{}
|
||||
produceAttestationDataResponseJson := validator.GetAttestationDataResponse{}
|
||||
jsonRestHandler.EXPECT().GetRestJsonResponse(
|
||||
ctx,
|
||||
fmt.Sprintf("/eth/v1/validator/attestation_data?committee_index=%d&slot=%d", committeeIndex, slot),
|
||||
@@ -228,17 +229,17 @@ func TestGetAttestationData_JsonResponseError(t *testing.T) {
|
||||
assert.ErrorContains(t, "some specific json response error", err)
|
||||
}
|
||||
|
||||
func generateValidAttestation(slot uint64, committeeIndex uint64) rpcmiddleware.ProduceAttestationDataResponseJson {
|
||||
return rpcmiddleware.ProduceAttestationDataResponseJson{
|
||||
Data: &rpcmiddleware.AttestationDataJson{
|
||||
func generateValidAttestation(slot uint64, committeeIndex uint64) validator.GetAttestationDataResponse {
|
||||
return validator.GetAttestationDataResponse{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(slot, 10),
|
||||
CommitteeIndex: strconv.FormatUint(committeeIndex, 10),
|
||||
BeaconBlockRoot: "0x5ecf3bff35e39d5f75476d42950d549f81fa93038c46b6652ae89ae1f7ad834f",
|
||||
Source: &rpcmiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "3",
|
||||
Root: "0x9023c9e64f23c1d451d5073c641f5f69597c2ad7d82f6f16e67d703e0ce5db8b",
|
||||
},
|
||||
Target: &rpcmiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "4",
|
||||
Root: "0xb154d46803b15b458ca822466547b054bc124338c6ee1d9c433dcde8c4457cca",
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -30,7 +31,7 @@ func TestBeaconApiValidatorClient_GetAttestationDataValid(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock.NewMockjsonRestHandler(ctrl)
|
||||
produceAttestationDataResponseJson := rpcmiddleware.ProduceAttestationDataResponseJson{}
|
||||
produceAttestationDataResponseJson := validator.GetAttestationDataResponse{}
|
||||
jsonRestHandler.EXPECT().GetRestJsonResponse(
|
||||
ctx,
|
||||
fmt.Sprintf("/eth/v1/validator/attestation_data?committee_index=%d&slot=%d", committeeIndex, slot),
|
||||
@@ -71,7 +72,7 @@ func TestBeaconApiValidatorClient_GetAttestationDataError(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock.NewMockjsonRestHandler(ctrl)
|
||||
produceAttestationDataResponseJson := rpcmiddleware.ProduceAttestationDataResponseJson{}
|
||||
produceAttestationDataResponseJson := validator.GetAttestationDataResponse{}
|
||||
jsonRestHandler.EXPECT().GetRestJsonResponse(
|
||||
ctx,
|
||||
fmt.Sprintf("/eth/v1/validator/attestation_data?committee_index=%d&slot=%d", committeeIndex, slot),
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
@@ -46,7 +47,7 @@ func TestSubmitAggregateSelectionProof(t *testing.T) {
|
||||
}
|
||||
|
||||
attestationDataResponse := generateValidAttestation(uint64(slot), uint64(committeeIndex))
|
||||
attestationDataProto, err := convertAttestationDataToProto(attestationDataResponse.Data)
|
||||
attestationDataProto, err := attestationDataResponse.Data.ToConsensus()
|
||||
require.NoError(t, err)
|
||||
attestationDataRootBytes, err := attestationDataProto.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
@@ -218,7 +219,7 @@ func TestSubmitAggregateSelectionProof(t *testing.T) {
|
||||
jsonRestHandler.EXPECT().GetRestJsonResponse(
|
||||
ctx,
|
||||
fmt.Sprintf("%s?committee_index=%d&slot=%d", attestationDataEndpoint, committeeIndex, slot),
|
||||
&apimiddleware.ProduceAttestationDataResponseJson{},
|
||||
&validator.GetAttestationDataResponse{},
|
||||
).SetArg(
|
||||
2,
|
||||
attestationDataResponse,
|
||||
|
||||
Reference in New Issue
Block a user