mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 05:47:59 -05:00
Compare commits
34 Commits
prestonvan
...
v4.0.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ca3644057 | ||
|
|
344c14154f | ||
|
|
dd48af4ebb | ||
|
|
d2ff995eb2 | ||
|
|
56a0315dde | ||
|
|
634133fedc | ||
|
|
c1c1b7ecfa | ||
|
|
9a4670ec64 | ||
|
|
a664a07303 | ||
|
|
dd14d5cef0 | ||
|
|
3a09405bb7 | ||
|
|
cb59081887 | ||
|
|
a820d4dcc8 | ||
|
|
dbc17cf2ca | ||
|
|
d38762772a | ||
|
|
e5d1eb885d | ||
|
|
a9d7701081 | ||
|
|
33abe6eb90 | ||
|
|
c342c9a14e | ||
|
|
a9b003e1fe | ||
|
|
955175b7eb | ||
|
|
c17682940e | ||
|
|
db450f53a4 | ||
|
|
493905ee9e | ||
|
|
e449724034 | ||
|
|
a44c209be0 | ||
|
|
183e72b194 | ||
|
|
337c254161 | ||
|
|
ec60cab2bf | ||
|
|
ded00495e7 | ||
|
|
113172d8aa | ||
|
|
2b40c44879 | ||
|
|
fc193b09bf | ||
|
|
a0d53f5155 |
@@ -88,6 +88,7 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_x_sync//errgroup:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ func (s *Service) saveHead(ctx context.Context, newHeadRoot [32]byte, headBlock
|
||||
// This gets called to update canonical root mapping. It does not save head block
|
||||
// root in DB. With the inception of initial-sync-cache-state flag, it uses finalized
|
||||
// check point as anchors to resume sync therefore head is no longer needed to be saved on per slot basis.
|
||||
func (s *Service) saveHeadNoDB(ctx context.Context, b interfaces.ReadOnlySignedBeaconBlock, r [32]byte, hs state.BeaconState) error {
|
||||
func (s *Service) saveHeadNoDB(ctx context.Context, b interfaces.ReadOnlySignedBeaconBlock, r [32]byte, hs state.BeaconState, optimistic bool) error {
|
||||
if err := blocks.BeaconBlockIsNil(b); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -198,7 +198,7 @@ func (s *Service) saveHeadNoDB(ctx context.Context, b interfaces.ReadOnlySignedB
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.setHeadInitialSync(r, bCp, hs); err != nil {
|
||||
if err := s.setHeadInitialSync(r, bCp, hs, optimistic); err != nil {
|
||||
return errors.Wrap(err, "could not set head")
|
||||
}
|
||||
return nil
|
||||
@@ -227,7 +227,7 @@ func (s *Service) setHead(newHead *head) error {
|
||||
// This sets head view object which is used to track the head slot, root, block and state. The method
|
||||
// assumes that state being passed into the method will not be modified by any other alternate
|
||||
// caller which holds the state's reference.
|
||||
func (s *Service) setHeadInitialSync(root [32]byte, block interfaces.ReadOnlySignedBeaconBlock, state state.BeaconState) error {
|
||||
func (s *Service) setHeadInitialSync(root [32]byte, block interfaces.ReadOnlySignedBeaconBlock, state state.BeaconState, optimistic bool) error {
|
||||
s.headLock.Lock()
|
||||
defer s.headLock.Unlock()
|
||||
|
||||
@@ -237,9 +237,10 @@ func (s *Service) setHeadInitialSync(root [32]byte, block interfaces.ReadOnlySig
|
||||
return err
|
||||
}
|
||||
s.head = &head{
|
||||
root: root,
|
||||
block: bCp,
|
||||
state: state,
|
||||
root: root,
|
||||
block: bCp,
|
||||
state: state,
|
||||
optimistic: optimistic,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -86,18 +86,6 @@ func (s *Service) postBlockProcess(ctx context.Context, signed interfaces.ReadOn
|
||||
"headRoot": fmt.Sprintf("%#x", headRoot),
|
||||
"headWeight": headWeight,
|
||||
}).Debug("Head block is not the received block")
|
||||
} else {
|
||||
// Updating next slot state cache can happen in the background. It shouldn't block rest of the process.
|
||||
go func() {
|
||||
// Use a custom deadline here, since this method runs asynchronously.
|
||||
// We ignore the parent method's context and instead create a new one
|
||||
// with a custom deadline, therefore using the background context instead.
|
||||
slotCtx, cancel := context.WithTimeout(context.Background(), slotDeadline)
|
||||
defer cancel()
|
||||
if err := transition.UpdateNextSlotCache(slotCtx, blockRoot[:], postState); err != nil {
|
||||
log.WithError(err).Debug("could not update next slot state cache")
|
||||
}
|
||||
}()
|
||||
}
|
||||
newBlockHeadElapsedTime.Observe(float64(time.Since(start).Milliseconds()))
|
||||
|
||||
@@ -109,7 +97,7 @@ func (s *Service) postBlockProcess(ctx context.Context, signed interfaces.ReadOn
|
||||
|
||||
optimistic, err := s.cfg.ForkChoiceStore.IsOptimistic(blockRoot)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("Could not check if block is optimistic")
|
||||
log.WithError(err).Debug("Could not check if block is optimistic")
|
||||
optimistic = true
|
||||
}
|
||||
|
||||
@@ -126,8 +114,29 @@ func (s *Service) postBlockProcess(ctx context.Context, signed interfaces.ReadOn
|
||||
})
|
||||
|
||||
defer reportAttestationInclusion(b)
|
||||
if err := s.handleEpochBoundary(ctx, postState, blockRoot[:]); err != nil {
|
||||
return err
|
||||
if headRoot == blockRoot {
|
||||
// Updating next slot state cache can happen in the background
|
||||
// except in the epoch boundary in which case we lock to handle
|
||||
// the shuffling and proposer caches updates.
|
||||
// We handle these caches only on canonical
|
||||
// blocks, otherwise this will be handled by lateBlockTasks
|
||||
slot := postState.Slot()
|
||||
if slots.IsEpochEnd(slot) {
|
||||
if err := transition.UpdateNextSlotCache(ctx, blockRoot[:], postState); err != nil {
|
||||
return errors.Wrap(err, "could not update next slot state cache")
|
||||
}
|
||||
if err := s.handleEpochBoundary(ctx, slot, postState, blockRoot[:]); err != nil {
|
||||
return errors.Wrap(err, "could not handle epoch boundary")
|
||||
}
|
||||
} else {
|
||||
go func() {
|
||||
slotCtx, cancel := context.WithTimeout(context.Background(), slotDeadline)
|
||||
defer cancel()
|
||||
if err := transition.UpdateNextSlotCache(slotCtx, blockRoot[:], postState); err != nil {
|
||||
log.WithError(err).Error("could not update next slot state cache")
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
onBlockProcessingTime.Observe(float64(time.Since(startTime).Milliseconds()))
|
||||
return nil
|
||||
@@ -320,63 +329,51 @@ func (s *Service) onBlockBatch(ctx context.Context, blks []interfaces.ReadOnlySi
|
||||
if _, err := s.notifyForkchoiceUpdate(ctx, arg); err != nil {
|
||||
return err
|
||||
}
|
||||
return s.saveHeadNoDB(ctx, lastB, lastBR, preState)
|
||||
return s.saveHeadNoDB(ctx, lastB, lastBR, preState, !isValidPayload)
|
||||
}
|
||||
|
||||
// Epoch boundary bookkeeping such as logging epoch summaries.
|
||||
func (s *Service) handleEpochBoundary(ctx context.Context, postState state.BeaconState, blockRoot []byte) error {
|
||||
func (s *Service) updateEpochBoundaryCaches(ctx context.Context, st state.BeaconState) error {
|
||||
e := coreTime.CurrentEpoch(st)
|
||||
if err := helpers.UpdateCommitteeCache(ctx, st, e); err != nil {
|
||||
return errors.Wrap(err, "could not update committee cache")
|
||||
}
|
||||
if err := helpers.UpdateProposerIndicesInCache(ctx, st, e); err != nil {
|
||||
return errors.Wrap(err, "could not update proposer index cache")
|
||||
}
|
||||
go func() {
|
||||
// Use a custom deadline here, since this method runs asynchronously.
|
||||
// We ignore the parent method's context and instead create a new one
|
||||
// with a custom deadline, therefore using the background context instead.
|
||||
slotCtx, cancel := context.WithTimeout(context.Background(), slotDeadline)
|
||||
defer cancel()
|
||||
if err := helpers.UpdateCommitteeCache(slotCtx, st, e+1); err != nil {
|
||||
log.WithError(err).Warn("Could not update committee cache")
|
||||
}
|
||||
if err := helpers.UpdateProposerIndicesInCache(slotCtx, st, e+1); err != nil {
|
||||
log.WithError(err).Warn("Failed to cache next epoch proposers")
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Epoch boundary tasks: it copies the headState and updates the epoch boundary
|
||||
// caches.
|
||||
func (s *Service) handleEpochBoundary(ctx context.Context, slot primitives.Slot, headState state.BeaconState, blockRoot []byte) error {
|
||||
ctx, span := trace.StartSpan(ctx, "blockChain.handleEpochBoundary")
|
||||
defer span.End()
|
||||
|
||||
var err error
|
||||
if postState.Slot()+1 == s.nextEpochBoundarySlot {
|
||||
copied := postState.Copy()
|
||||
copied, err := transition.ProcessSlotsUsingNextSlotCache(ctx, copied, blockRoot, copied.Slot()+1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Update caches for the next epoch at epoch boundary slot - 1.
|
||||
if err := helpers.UpdateCommitteeCache(ctx, copied, coreTime.CurrentEpoch(copied)); err != nil {
|
||||
return err
|
||||
}
|
||||
e := coreTime.CurrentEpoch(copied)
|
||||
if err := helpers.UpdateProposerIndicesInCache(ctx, copied, e); err != nil {
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
// Use a custom deadline here, since this method runs asynchronously.
|
||||
// We ignore the parent method's context and instead create a new one
|
||||
// with a custom deadline, therefore using the background context instead.
|
||||
slotCtx, cancel := context.WithTimeout(context.Background(), slotDeadline)
|
||||
defer cancel()
|
||||
if err := helpers.UpdateProposerIndicesInCache(slotCtx, copied, e+1); err != nil {
|
||||
log.WithError(err).Warn("Failed to cache next epoch proposers")
|
||||
}
|
||||
}()
|
||||
} else if postState.Slot() >= s.nextEpochBoundarySlot {
|
||||
s.nextEpochBoundarySlot, err = slots.EpochStart(coreTime.NextEpoch(postState))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Update caches at epoch boundary slot.
|
||||
// The following updates have shortcut to return nil cheaply if fulfilled during boundary slot - 1.
|
||||
if err := helpers.UpdateCommitteeCache(ctx, postState, coreTime.CurrentEpoch(postState)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := helpers.UpdateProposerIndicesInCache(ctx, postState, coreTime.CurrentEpoch(postState)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
headSt, err := s.HeadState(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := reportEpochMetrics(ctx, postState, headSt); err != nil {
|
||||
return err
|
||||
}
|
||||
// return early if we are advancing to a past epoch
|
||||
if slot < headState.Slot() {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
if !slots.IsEpochEnd(slot) {
|
||||
return nil
|
||||
}
|
||||
copied := headState.Copy()
|
||||
copied, err := transition.ProcessSlotsUsingNextSlotCache(ctx, copied, blockRoot, slot+1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return s.updateEpochBoundaryCaches(ctx, copied)
|
||||
}
|
||||
|
||||
// This feeds in the attestations included in the block to fork choice store. It's allows fork choice store
|
||||
@@ -507,8 +504,9 @@ func (s *Service) runLateBlockTasks() {
|
||||
// lateBlockTasks is called 4 seconds into the slot and performs tasks
|
||||
// related to late blocks. It emits a MissedSlot state feed event.
|
||||
// It calls FCU and sets the right attributes if we are proposing next slot
|
||||
// it also updates the next slot cache to deal with skipped slots.
|
||||
// it also updates the next slot cache and the proposer index cache to deal with skipped slots.
|
||||
func (s *Service) lateBlockTasks(ctx context.Context) {
|
||||
currentSlot := s.CurrentSlot()
|
||||
if s.CurrentSlot() == s.HeadSlot() {
|
||||
return
|
||||
}
|
||||
@@ -516,8 +514,10 @@ func (s *Service) lateBlockTasks(ctx context.Context) {
|
||||
Type: statefeed.MissedSlot,
|
||||
})
|
||||
|
||||
s.headLock.RLock()
|
||||
headRoot := s.headRoot()
|
||||
headState := s.headState(ctx)
|
||||
s.headLock.RUnlock()
|
||||
lastRoot, lastState := transition.LastCachedState()
|
||||
if lastState == nil {
|
||||
lastRoot, lastState = headRoot[:], headState
|
||||
@@ -528,7 +528,9 @@ func (s *Service) lateBlockTasks(ctx context.Context) {
|
||||
if err := transition.UpdateNextSlotCache(ctx, lastRoot, lastState); err != nil {
|
||||
log.WithError(err).Debug("could not update next slot state cache")
|
||||
}
|
||||
|
||||
if err := s.handleEpochBoundary(ctx, currentSlot, headState, headRoot[:]); err != nil {
|
||||
log.WithError(err).Error("lateBlockTasks: could not update epoch boundary caches")
|
||||
}
|
||||
// Head root should be empty when retrieving proposer index for the next slot.
|
||||
_, id, has := s.cfg.ProposerSlotIndexCache.GetProposerPayloadIDs(s.CurrentSlot()+1, [32]byte{} /* head root */)
|
||||
// There exists proposer for next slot, but we haven't called fcu w/ payload attribute yet.
|
||||
|
||||
@@ -539,8 +539,7 @@ func TestHandleEpochBoundary_UpdateFirstSlot(t *testing.T) {
|
||||
s, _ := util.DeterministicGenesisState(t, 1024)
|
||||
service.head = &head{state: s}
|
||||
require.NoError(t, s.SetSlot(2*params.BeaconConfig().SlotsPerEpoch))
|
||||
require.NoError(t, service.handleEpochBoundary(ctx, s, []byte{}))
|
||||
require.Equal(t, 3*params.BeaconConfig().SlotsPerEpoch, service.nextEpochBoundarySlot)
|
||||
require.NoError(t, service.handleEpochBoundary(ctx, s.Slot(), s, []byte{}))
|
||||
}
|
||||
|
||||
func TestOnBlock_CanFinalize_WithOnTick(t *testing.T) {
|
||||
|
||||
@@ -92,22 +92,24 @@ func (s *Service) spawnProcessAttestationsRoutine() {
|
||||
return
|
||||
}
|
||||
|
||||
st := slots.NewSlotTicker(s.genesisTime, params.BeaconConfig().SecondsPerSlot)
|
||||
pat := slots.NewSlotTickerWithOffset(s.genesisTime, -reorgLateBlockCountAttestations, params.BeaconConfig().SecondsPerSlot)
|
||||
reorgInterval := time.Second*time.Duration(params.BeaconConfig().SecondsPerSlot) - reorgLateBlockCountAttestations
|
||||
ticker := slots.NewSlotTickerWithIntervals(s.genesisTime, []time.Duration{0, reorgInterval})
|
||||
for {
|
||||
select {
|
||||
case <-s.ctx.Done():
|
||||
return
|
||||
case <-pat.C():
|
||||
s.UpdateHead(s.ctx, s.CurrentSlot()+1)
|
||||
case <-st.C():
|
||||
s.cfg.ForkChoiceStore.Lock()
|
||||
if err := s.cfg.ForkChoiceStore.NewSlot(s.ctx, s.CurrentSlot()); err != nil {
|
||||
log.WithError(err).Error("could not process new slot")
|
||||
}
|
||||
s.cfg.ForkChoiceStore.Unlock()
|
||||
case slotInterval := <-ticker.C():
|
||||
if slotInterval.Interval > 0 {
|
||||
s.UpdateHead(s.ctx, slotInterval.Slot+1)
|
||||
} else {
|
||||
s.cfg.ForkChoiceStore.Lock()
|
||||
if err := s.cfg.ForkChoiceStore.NewSlot(s.ctx, slotInterval.Slot); err != nil {
|
||||
log.WithError(err).Error("could not process new slot")
|
||||
}
|
||||
s.cfg.ForkChoiceStore.Unlock()
|
||||
|
||||
s.UpdateHead(s.ctx, s.CurrentSlot())
|
||||
s.UpdateHead(s.ctx, slotInterval.Slot)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed"
|
||||
statefeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/state"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers"
|
||||
coreTime "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/time"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/transition"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/features"
|
||||
@@ -22,6 +23,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/time"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
// This defines how many epochs since finality the run time will begin to save hot state on to the DB.
|
||||
@@ -60,19 +62,31 @@ func (s *Service) ReceiveBlock(ctx context.Context, block interfaces.ReadOnlySig
|
||||
// Save current justified and finalized epochs for future use.
|
||||
currStoreJustifiedEpoch := s.CurrentJustifiedCheckpt().Epoch
|
||||
currStoreFinalizedEpoch := s.FinalizedCheckpt().Epoch
|
||||
currentEpoch := coreTime.CurrentEpoch(preState)
|
||||
|
||||
preStateVersion, preStateHeader, err := getStateVersionAndPayload(preState)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
postState, err := s.validateStateTransition(ctx, preState, blockCopy)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to validate consensus state transition function")
|
||||
}
|
||||
isValidPayload, err := s.validateExecutionOnBlock(ctx, preStateVersion, preStateHeader, blockCopy, blockRoot)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not notify the engine of the new payload")
|
||||
eg, _ := errgroup.WithContext(ctx)
|
||||
var postState state.BeaconState
|
||||
eg.Go(func() error {
|
||||
postState, err = s.validateStateTransition(ctx, preState, blockCopy)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to validate consensus state transition function")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
var isValidPayload bool
|
||||
eg.Go(func() error {
|
||||
isValidPayload, err = s.validateExecutionOnBlock(ctx, preStateVersion, preStateHeader, blockCopy, blockRoot)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not notify the engine of the new payload")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err := eg.Wait(); err != nil {
|
||||
return err
|
||||
}
|
||||
// The rest of block processing takes a lock on forkchoice.
|
||||
s.cfg.ForkChoiceStore.Lock()
|
||||
@@ -86,7 +100,15 @@ func (s *Service) ReceiveBlock(ctx context.Context, block interfaces.ReadOnlySig
|
||||
tracing.AnnotateError(span, err)
|
||||
return err
|
||||
}
|
||||
|
||||
if coreTime.CurrentEpoch(postState) > currentEpoch {
|
||||
headSt, err := s.HeadState(ctx)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not get head state")
|
||||
}
|
||||
if err := reportEpochMetrics(ctx, postState, headSt); err != nil {
|
||||
log.WithError(err).Error("could not report epoch metrics")
|
||||
}
|
||||
}
|
||||
if err := s.updateJustificationOnBlock(ctx, preState, postState, currStoreJustifiedEpoch); err != nil {
|
||||
return errors.Wrap(err, "could not update justified checkpoint")
|
||||
}
|
||||
@@ -163,16 +185,18 @@ func (s *Service) ReceiveBlockBatch(ctx context.Context, blocks []interfaces.Rea
|
||||
return err
|
||||
}
|
||||
|
||||
lastBR := blkRoots[len(blkRoots)-1]
|
||||
optimistic, err := s.cfg.ForkChoiceStore.IsOptimistic(lastBR)
|
||||
if err != nil {
|
||||
lastSlot := blocks[len(blocks)-1].Block().Slot()
|
||||
log.WithError(err).Errorf("Could not check if block is optimistic, Root: %#x, Slot: %d", lastBR, lastSlot)
|
||||
optimistic = true
|
||||
}
|
||||
for i, b := range blocks {
|
||||
blockCopy, err := b.Copy()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
optimistic, err := s.cfg.ForkChoiceStore.IsOptimistic(blkRoots[i])
|
||||
if err != nil {
|
||||
log.WithError(err).Error("Could not check if block is optimistic")
|
||||
optimistic = true
|
||||
}
|
||||
// Send notification of the processed block to the state feed.
|
||||
s.cfg.StateNotifier.StateFeed().Send(&feed.Event{
|
||||
Type: statefeed.BlockProcessed,
|
||||
|
||||
@@ -35,7 +35,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/blocks"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
prysmTime "github.com/prysmaticlabs/prysm/v4/time"
|
||||
@@ -46,22 +45,21 @@ import (
|
||||
// Service represents a service that handles the internal
|
||||
// logic of managing the full PoS beacon chain.
|
||||
type Service struct {
|
||||
cfg *config
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
genesisTime time.Time
|
||||
head *head
|
||||
headLock sync.RWMutex
|
||||
originBlockRoot [32]byte // genesis root, or weak subjectivity checkpoint root, depending on how the node is initialized
|
||||
nextEpochBoundarySlot primitives.Slot
|
||||
boundaryRoots [][32]byte
|
||||
checkpointStateCache *cache.CheckpointStateCache
|
||||
initSyncBlocks map[[32]byte]interfaces.ReadOnlySignedBeaconBlock
|
||||
initSyncBlocksLock sync.RWMutex
|
||||
wsVerifier *WeakSubjectivityVerifier
|
||||
clockSetter startup.ClockSetter
|
||||
clockWaiter startup.ClockWaiter
|
||||
syncComplete chan struct{}
|
||||
cfg *config
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
genesisTime time.Time
|
||||
head *head
|
||||
headLock sync.RWMutex
|
||||
originBlockRoot [32]byte // genesis root, or weak subjectivity checkpoint root, depending on how the node is initialized
|
||||
boundaryRoots [][32]byte
|
||||
checkpointStateCache *cache.CheckpointStateCache
|
||||
initSyncBlocks map[[32]byte]interfaces.ReadOnlySignedBeaconBlock
|
||||
initSyncBlocksLock sync.RWMutex
|
||||
wsVerifier *WeakSubjectivityVerifier
|
||||
clockSetter startup.ClockSetter
|
||||
clockWaiter startup.ClockWaiter
|
||||
syncComplete chan struct{}
|
||||
}
|
||||
|
||||
// config options for the service.
|
||||
|
||||
@@ -357,7 +357,7 @@ func TestChainService_SaveHeadNoDB(t *testing.T) {
|
||||
require.NoError(t, s.cfg.StateGen.SaveState(ctx, r, newState))
|
||||
wsb, err := consensusblocks.NewSignedBeaconBlock(blk)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, s.saveHeadNoDB(ctx, wsb, r, newState))
|
||||
require.NoError(t, s.saveHeadNoDB(ctx, wsb, r, newState, false))
|
||||
|
||||
newB, err := s.cfg.BeaconDB.HeadBlock(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -295,43 +295,39 @@ func ShuffledIndices(s state.ReadOnlyBeaconState, epoch primitives.Epoch) ([]pri
|
||||
}
|
||||
|
||||
// UpdateCommitteeCache gets called at the beginning of every epoch to cache the committee shuffled indices
|
||||
// list with committee index and epoch number. It caches the shuffled indices for current epoch and next epoch.
|
||||
func UpdateCommitteeCache(ctx context.Context, state state.ReadOnlyBeaconState, epoch primitives.Epoch) error {
|
||||
for _, e := range []primitives.Epoch{epoch, epoch + 1} {
|
||||
seed, err := Seed(state, e, params.BeaconConfig().DomainBeaconAttester)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if committeeCache.HasEntry(string(seed[:])) {
|
||||
return nil
|
||||
}
|
||||
|
||||
shuffledIndices, err := ShuffledIndices(state, e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
count := SlotCommitteeCount(uint64(len(shuffledIndices)))
|
||||
|
||||
// Store the sorted indices as well as shuffled indices. In current spec,
|
||||
// sorted indices is required to retrieve proposer index. This is also
|
||||
// used for failing verify signature fallback.
|
||||
sortedIndices := make([]primitives.ValidatorIndex, len(shuffledIndices))
|
||||
copy(sortedIndices, shuffledIndices)
|
||||
sort.Slice(sortedIndices, func(i, j int) bool {
|
||||
return sortedIndices[i] < sortedIndices[j]
|
||||
})
|
||||
|
||||
if err := committeeCache.AddCommitteeShuffledList(ctx, &cache.Committees{
|
||||
ShuffledIndices: shuffledIndices,
|
||||
CommitteeCount: uint64(params.BeaconConfig().SlotsPerEpoch.Mul(count)),
|
||||
Seed: seed,
|
||||
SortedIndices: sortedIndices,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
// list with committee index and epoch number. It caches the shuffled indices for the input epoch.
|
||||
func UpdateCommitteeCache(ctx context.Context, state state.ReadOnlyBeaconState, e primitives.Epoch) error {
|
||||
seed, err := Seed(state, e, params.BeaconConfig().DomainBeaconAttester)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if committeeCache.HasEntry(string(seed[:])) {
|
||||
return nil
|
||||
}
|
||||
shuffledIndices, err := ShuffledIndices(state, e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
count := SlotCommitteeCount(uint64(len(shuffledIndices)))
|
||||
|
||||
// Store the sorted indices as well as shuffled indices. In current spec,
|
||||
// sorted indices is required to retrieve proposer index. This is also
|
||||
// used for failing verify signature fallback.
|
||||
sortedIndices := make([]primitives.ValidatorIndex, len(shuffledIndices))
|
||||
copy(sortedIndices, shuffledIndices)
|
||||
sort.Slice(sortedIndices, func(i, j int) bool {
|
||||
return sortedIndices[i] < sortedIndices[j]
|
||||
})
|
||||
|
||||
if err := committeeCache.AddCommitteeShuffledList(ctx, &cache.Committees{
|
||||
ShuffledIndices: shuffledIndices,
|
||||
CommitteeCount: uint64(params.BeaconConfig().SlotsPerEpoch.Mul(count)),
|
||||
Seed: seed,
|
||||
SortedIndices: sortedIndices,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ func TestUpdateCommitteeCache_CanUpdate(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, UpdateCommitteeCache(context.Background(), state, time.CurrentEpoch(state)))
|
||||
|
||||
epoch := primitives.Epoch(1)
|
||||
epoch := primitives.Epoch(0)
|
||||
idx := primitives.CommitteeIndex(1)
|
||||
seed, err := Seed(state, epoch, params.BeaconConfig().DomainBeaconAttester)
|
||||
require.NoError(t, err)
|
||||
@@ -423,6 +423,40 @@ func TestUpdateCommitteeCache_CanUpdate(t *testing.T) {
|
||||
assert.Equal(t, params.BeaconConfig().TargetCommitteeSize, uint64(len(indices)), "Did not save correct indices lengths")
|
||||
}
|
||||
|
||||
func TestUpdateCommitteeCache_CanUpdateAcrossEpochs(t *testing.T) {
|
||||
ClearCache()
|
||||
defer ClearCache()
|
||||
validatorCount := params.BeaconConfig().MinGenesisActiveValidatorCount
|
||||
validators := make([]*ethpb.Validator, validatorCount)
|
||||
indices := make([]primitives.ValidatorIndex, validatorCount)
|
||||
for i := primitives.ValidatorIndex(0); uint64(i) < validatorCount; i++ {
|
||||
validators[i] = ðpb.Validator{
|
||||
ExitEpoch: params.BeaconConfig().FarFutureEpoch,
|
||||
EffectiveBalance: 1,
|
||||
}
|
||||
indices[i] = i
|
||||
}
|
||||
state, err := state_native.InitializeFromProtoPhase0(ðpb.BeaconState{
|
||||
Validators: validators,
|
||||
RandaoMixes: make([][]byte, params.BeaconConfig().EpochsPerHistoricalVector),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
e := time.CurrentEpoch(state)
|
||||
require.NoError(t, UpdateCommitteeCache(context.Background(), state, e))
|
||||
|
||||
seed, err := Seed(state, e, params.BeaconConfig().DomainBeaconAttester)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, committeeCache.HasEntry(string(seed[:])))
|
||||
|
||||
nextSeed, err := Seed(state, e+1, params.BeaconConfig().DomainBeaconAttester)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, false, committeeCache.HasEntry(string(nextSeed[:])))
|
||||
|
||||
require.NoError(t, UpdateCommitteeCache(context.Background(), state, e+1))
|
||||
|
||||
require.Equal(t, true, committeeCache.HasEntry(string(nextSeed[:])))
|
||||
}
|
||||
|
||||
func BenchmarkComputeCommittee300000_WithPreCache(b *testing.B) {
|
||||
validators := make([]*ethpb.Validator, 300000)
|
||||
for i := 0; i < len(validators); i++ {
|
||||
|
||||
@@ -184,7 +184,7 @@ func innerShuffleList(input []primitives.ValidatorIndex, seed [32]byte, shuffle
|
||||
for {
|
||||
buf[seedSize] = r
|
||||
ph := hashfunc(buf[:pivotViewSize])
|
||||
pivot := bytesutil.FromBytes8(ph[:8]) % listSize
|
||||
pivot := binary.LittleEndian.Uint64(ph[:8]) % listSize
|
||||
mirror := (pivot + 1) >> 1
|
||||
binary.LittleEndian.PutUint32(buf[pivotViewSize:], uint32(pivot>>8))
|
||||
source := hashfunc(buf)
|
||||
|
||||
@@ -34,14 +34,17 @@ func (s *Service) prepareForkChoiceAtts() {
|
||||
ticker := slots.NewSlotTickerWithIntervals(time.Unix(int64(s.genesisTime), 0), intervals[:])
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C():
|
||||
case slotInterval := <-ticker.C():
|
||||
t := time.Now()
|
||||
if err := s.batchForkChoiceAtts(s.ctx); err != nil {
|
||||
log.WithError(err).Error("Could not prepare attestations for fork choice")
|
||||
}
|
||||
if slots.TimeIntoSlot(s.genesisTime) < intervals[1] {
|
||||
batchForkChoiceAttsT1.Observe(float64(time.Since(t).Milliseconds()))
|
||||
} else if slots.TimeIntoSlot(s.genesisTime) < intervals[2] {
|
||||
switch slotInterval.Interval {
|
||||
case 0:
|
||||
duration := time.Since(t)
|
||||
log.WithField("Duration", duration).Debug("aggregated unaggregated attestations")
|
||||
batchForkChoiceAttsT1.Observe(float64(duration.Milliseconds()))
|
||||
case 1:
|
||||
batchForkChoiceAttsT2.Observe(float64(time.Since(t).Milliseconds()))
|
||||
}
|
||||
case <-s.ctx.Done():
|
||||
|
||||
@@ -24,6 +24,7 @@ go_library(
|
||||
"//beacon-chain/operations/synccommittee:go_default_library",
|
||||
"//beacon-chain/operations/voluntaryexits:go_default_library",
|
||||
"//beacon-chain/p2p:go_default_library",
|
||||
"//beacon-chain/rpc/core:go_default_library",
|
||||
"//beacon-chain/rpc/eth/beacon:go_default_library",
|
||||
"//beacon-chain/rpc/eth/builder:go_default_library",
|
||||
"//beacon-chain/rpc/eth/debug:go_default_library",
|
||||
|
||||
@@ -23,7 +23,7 @@ go_library(
|
||||
"//runtime/version:go_default_library",
|
||||
"//time/slots:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_r3labs_sse//:go_default_library",
|
||||
"@com_github_r3labs_sse_v2//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -46,6 +46,6 @@ go_test(
|
||||
"//testing/require:go_default_library",
|
||||
"//time/slots:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_r3labs_sse//:go_default_library",
|
||||
"@com_github_r3labs_sse_v2//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/api/grpc"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/events"
|
||||
"github.com/prysmaticlabs/prysm/v4/runtime/version"
|
||||
"github.com/r3labs/sse"
|
||||
"github.com/r3labs/sse/v2"
|
||||
)
|
||||
|
||||
// match a number with optional decimals
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/events"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
"github.com/r3labs/sse"
|
||||
"github.com/r3labs/sse/v2"
|
||||
)
|
||||
|
||||
type testSSZResponseJson struct {
|
||||
|
||||
@@ -130,28 +130,6 @@ func wrapValidatorIndicesArray(
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// https://ethereum.github.io/beacon-apis/#/Validator/publishAggregateAndProofs expects posting a top-level array.
|
||||
// We make it more proto-friendly by wrapping it in a struct with a 'data' field.
|
||||
func wrapSignedAggregateAndProofArray(
|
||||
endpoint *apimiddleware.Endpoint,
|
||||
_ http.ResponseWriter,
|
||||
req *http.Request,
|
||||
) (apimiddleware.RunDefault, apimiddleware.ErrorJson) {
|
||||
if _, ok := endpoint.PostRequest.(*SubmitAggregateAndProofsRequestJson); ok {
|
||||
data := make([]*SignedAggregateAttestationAndProofJson, 0)
|
||||
if err := json.NewDecoder(req.Body).Decode(&data); err != nil {
|
||||
return false, apimiddleware.InternalServerErrorWithMessage(err, "could not decode body")
|
||||
}
|
||||
j := &SubmitAggregateAndProofsRequestJson{Data: data}
|
||||
b, err := json.Marshal(j)
|
||||
if err != nil {
|
||||
return false, apimiddleware.InternalServerErrorWithMessage(err, "could not marshal wrapped body")
|
||||
}
|
||||
req.Body = io.NopCloser(bytes.NewReader(b))
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// https://ethereum.github.io/beacon-apis/#/Validator/prepareBeaconCommitteeSubnet expects posting a top-level array.
|
||||
// We make it more proto-friendly by wrapping it in a struct with a 'data' field.
|
||||
func wrapBeaconCommitteeSubscriptionsArray(
|
||||
@@ -218,28 +196,6 @@ func wrapSyncCommitteeSignaturesArray(
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// https://ethereum.github.io/beacon-APIs/#/Validator/publishContributionAndProofs expects posting a top-level array.
|
||||
// We make it more proto-friendly by wrapping it in a struct with a 'data' field.
|
||||
func wrapSignedContributionAndProofsArray(
|
||||
endpoint *apimiddleware.Endpoint,
|
||||
_ http.ResponseWriter,
|
||||
req *http.Request,
|
||||
) (apimiddleware.RunDefault, apimiddleware.ErrorJson) {
|
||||
if _, ok := endpoint.PostRequest.(*SubmitContributionAndProofsRequestJson); ok {
|
||||
data := make([]*SignedContributionAndProofJson, 0)
|
||||
if err := json.NewDecoder(req.Body).Decode(&data); err != nil {
|
||||
return false, apimiddleware.InternalServerErrorWithMessage(err, "could not decode body")
|
||||
}
|
||||
j := &SubmitContributionAndProofsRequestJson{Data: data}
|
||||
b, err := json.Marshal(j)
|
||||
if err != nil {
|
||||
return false, apimiddleware.InternalServerErrorWithMessage(err, "could not marshal wrapped body")
|
||||
}
|
||||
req.Body = io.NopCloser(bytes.NewReader(b))
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
type phase0PublishBlockRequestJson struct {
|
||||
Phase0Block *BeaconBlockJson `json:"phase0_block"`
|
||||
Signature string `json:"signature" hex:"true"`
|
||||
|
||||
@@ -140,46 +140,6 @@ func TestWrapBLSChangesArray(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestWrapSignedAggregateAndProofArray(t *testing.T) {
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
endpoint := &apimiddleware.Endpoint{
|
||||
PostRequest: &SubmitAggregateAndProofsRequestJson{},
|
||||
}
|
||||
unwrappedAggs := []*SignedAggregateAttestationAndProofJson{{Signature: "sig"}}
|
||||
unwrappedAggsJson, err := json.Marshal(unwrappedAggs)
|
||||
require.NoError(t, err)
|
||||
|
||||
var body bytes.Buffer
|
||||
_, err = body.Write(unwrappedAggsJson)
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest("POST", "http://foo.example", &body)
|
||||
|
||||
runDefault, errJson := wrapSignedAggregateAndProofArray(endpoint, nil, request)
|
||||
require.Equal(t, true, errJson == nil)
|
||||
assert.Equal(t, apimiddleware.RunDefault(true), runDefault)
|
||||
wrappedAggs := &SubmitAggregateAndProofsRequestJson{}
|
||||
require.NoError(t, json.NewDecoder(request.Body).Decode(wrappedAggs))
|
||||
require.Equal(t, 1, len(wrappedAggs.Data), "wrong number of wrapped items")
|
||||
assert.Equal(t, "sig", wrappedAggs.Data[0].Signature)
|
||||
})
|
||||
|
||||
t.Run("invalid_body", func(t *testing.T) {
|
||||
endpoint := &apimiddleware.Endpoint{
|
||||
PostRequest: &SubmitAggregateAndProofsRequestJson{},
|
||||
}
|
||||
var body bytes.Buffer
|
||||
_, err := body.Write([]byte("invalid"))
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest("POST", "http://foo.example", &body)
|
||||
|
||||
runDefault, errJson := wrapSignedAggregateAndProofArray(endpoint, nil, request)
|
||||
require.Equal(t, false, errJson == nil)
|
||||
assert.Equal(t, apimiddleware.RunDefault(false), runDefault)
|
||||
assert.Equal(t, true, strings.Contains(errJson.Msg(), "could not decode body"))
|
||||
assert.Equal(t, http.StatusInternalServerError, errJson.StatusCode())
|
||||
})
|
||||
}
|
||||
|
||||
func TestWrapBeaconCommitteeSubscriptionsArray(t *testing.T) {
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
endpoint := &apimiddleware.Endpoint{
|
||||
@@ -333,75 +293,6 @@ func TestWrapSyncCommitteeSignaturesArray(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestWrapSignedContributionAndProofsArray(t *testing.T) {
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
endpoint := &apimiddleware.Endpoint{
|
||||
PostRequest: &SubmitContributionAndProofsRequestJson{},
|
||||
}
|
||||
unwrapped := []*SignedContributionAndProofJson{
|
||||
{
|
||||
Message: &ContributionAndProofJson{
|
||||
AggregatorIndex: "1",
|
||||
Contribution: &SyncCommitteeContributionJson{
|
||||
Slot: "1",
|
||||
BeaconBlockRoot: "root",
|
||||
SubcommitteeIndex: "1",
|
||||
AggregationBits: "bits",
|
||||
Signature: "sig",
|
||||
},
|
||||
SelectionProof: "proof",
|
||||
},
|
||||
Signature: "sig",
|
||||
},
|
||||
{
|
||||
Message: &ContributionAndProofJson{},
|
||||
Signature: "sig",
|
||||
},
|
||||
}
|
||||
unwrappedJson, err := json.Marshal(unwrapped)
|
||||
require.NoError(t, err)
|
||||
|
||||
var body bytes.Buffer
|
||||
_, err = body.Write(unwrappedJson)
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest("POST", "http://foo.example", &body)
|
||||
|
||||
runDefault, errJson := wrapSignedContributionAndProofsArray(endpoint, nil, request)
|
||||
require.Equal(t, true, errJson == nil)
|
||||
assert.Equal(t, apimiddleware.RunDefault(true), runDefault)
|
||||
wrapped := &SubmitContributionAndProofsRequestJson{}
|
||||
require.NoError(t, json.NewDecoder(request.Body).Decode(wrapped))
|
||||
require.Equal(t, 2, len(wrapped.Data), "wrong number of wrapped items")
|
||||
assert.Equal(t, "sig", wrapped.Data[0].Signature)
|
||||
require.NotNil(t, wrapped.Data[0].Message)
|
||||
msg := wrapped.Data[0].Message
|
||||
assert.Equal(t, "1", msg.AggregatorIndex)
|
||||
assert.Equal(t, "proof", msg.SelectionProof)
|
||||
require.NotNil(t, msg.Contribution)
|
||||
assert.Equal(t, "1", msg.Contribution.Slot)
|
||||
assert.Equal(t, "root", msg.Contribution.BeaconBlockRoot)
|
||||
assert.Equal(t, "1", msg.Contribution.SubcommitteeIndex)
|
||||
assert.Equal(t, "bits", msg.Contribution.AggregationBits)
|
||||
assert.Equal(t, "sig", msg.Contribution.Signature)
|
||||
})
|
||||
|
||||
t.Run("invalid_body", func(t *testing.T) {
|
||||
endpoint := &apimiddleware.Endpoint{
|
||||
PostRequest: &SubmitContributionAndProofsRequestJson{},
|
||||
}
|
||||
var body bytes.Buffer
|
||||
_, err := body.Write([]byte("invalid"))
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest("POST", "http://foo.example", &body)
|
||||
|
||||
runDefault, errJson := wrapSignedContributionAndProofsArray(endpoint, nil, request)
|
||||
require.Equal(t, false, errJson == nil)
|
||||
assert.Equal(t, apimiddleware.RunDefault(false), runDefault)
|
||||
assert.Equal(t, true, strings.Contains(errJson.Msg(), "could not decode body"))
|
||||
assert.Equal(t, http.StatusInternalServerError, errJson.StatusCode())
|
||||
})
|
||||
}
|
||||
|
||||
func TestSetInitialPublishBlockPostRequest(t *testing.T) {
|
||||
params.SetupTestConfigCleanup(t)
|
||||
cfg := params.BeaconConfig().Copy()
|
||||
|
||||
@@ -66,12 +66,9 @@ func (_ *BeaconEndpointFactory) Paths() []string {
|
||||
"/eth/v2/validator/blocks/{slot}",
|
||||
"/eth/v1/validator/blinded_blocks/{slot}",
|
||||
"/eth/v1/validator/attestation_data",
|
||||
"/eth/v1/validator/aggregate_attestation",
|
||||
"/eth/v1/validator/beacon_committee_subscriptions",
|
||||
"/eth/v1/validator/sync_committee_subscriptions",
|
||||
"/eth/v1/validator/aggregate_and_proofs",
|
||||
"/eth/v1/validator/sync_committee_contribution",
|
||||
"/eth/v1/validator/contribution_and_proofs",
|
||||
"/eth/v1/validator/prepare_beacon_proposer",
|
||||
"/eth/v1/validator/register_validator",
|
||||
"/eth/v1/validator/liveness/{epoch}",
|
||||
@@ -263,9 +260,6 @@ func (_ *BeaconEndpointFactory) Create(path string) (*apimiddleware.Endpoint, er
|
||||
case "/eth/v1/validator/attestation_data":
|
||||
endpoint.GetResponse = &ProduceAttestationDataResponseJson{}
|
||||
endpoint.RequestQueryParams = []apimiddleware.QueryParam{{Name: "slot"}, {Name: "committee_index"}}
|
||||
case "/eth/v1/validator/aggregate_attestation":
|
||||
endpoint.GetResponse = &AggregateAttestationResponseJson{}
|
||||
endpoint.RequestQueryParams = []apimiddleware.QueryParam{{Name: "attestation_data_root", Hex: true}, {Name: "slot"}}
|
||||
case "/eth/v1/validator/beacon_committee_subscriptions":
|
||||
endpoint.PostRequest = &SubmitBeaconCommitteeSubscriptionsRequestJson{}
|
||||
endpoint.Err = &NodeSyncDetailsErrorJson{}
|
||||
@@ -278,19 +272,9 @@ func (_ *BeaconEndpointFactory) Create(path string) (*apimiddleware.Endpoint, er
|
||||
endpoint.Hooks = apimiddleware.HookCollection{
|
||||
OnPreDeserializeRequestBodyIntoContainer: wrapSyncCommitteeSubscriptionsArray,
|
||||
}
|
||||
case "/eth/v1/validator/aggregate_and_proofs":
|
||||
endpoint.PostRequest = &SubmitAggregateAndProofsRequestJson{}
|
||||
endpoint.Hooks = apimiddleware.HookCollection{
|
||||
OnPreDeserializeRequestBodyIntoContainer: wrapSignedAggregateAndProofArray,
|
||||
}
|
||||
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}}
|
||||
case "/eth/v1/validator/contribution_and_proofs":
|
||||
endpoint.PostRequest = &SubmitContributionAndProofsRequestJson{}
|
||||
endpoint.Hooks = apimiddleware.HookCollection{
|
||||
OnPreDeserializeRequestBodyIntoContainer: wrapSignedContributionAndProofsArray,
|
||||
}
|
||||
case "/eth/v1/validator/prepare_beacon_proposer":
|
||||
endpoint.PostRequest = &FeeRecipientsRequestJSON{}
|
||||
endpoint.Hooks = apimiddleware.HookCollection{
|
||||
|
||||
@@ -298,18 +298,10 @@ type SyncCommitteeSubscriptionJson struct {
|
||||
UntilEpoch string `json:"until_epoch"`
|
||||
}
|
||||
|
||||
type SubmitAggregateAndProofsRequestJson struct {
|
||||
Data []*SignedAggregateAttestationAndProofJson `json:"data"`
|
||||
}
|
||||
|
||||
type ProduceSyncCommitteeContributionResponseJson struct {
|
||||
Data *SyncCommitteeContributionJson `json:"data"`
|
||||
}
|
||||
|
||||
type SubmitContributionAndProofsRequestJson struct {
|
||||
Data []*SignedContributionAndProofJson `json:"data"`
|
||||
}
|
||||
|
||||
type ForkChoiceNodeResponseJson struct {
|
||||
Slot string `json:"slot"`
|
||||
BlockRoot string `json:"block_root" hex:"true"`
|
||||
|
||||
@@ -4,6 +4,8 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"errors.go",
|
||||
"log.go",
|
||||
"service.go",
|
||||
"validator.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core",
|
||||
@@ -12,14 +14,23 @@ go_library(
|
||||
"//beacon-chain/blockchain:go_default_library",
|
||||
"//beacon-chain/core/altair:go_default_library",
|
||||
"//beacon-chain/core/epoch/precompute:go_default_library",
|
||||
"//beacon-chain/core/feed:go_default_library",
|
||||
"//beacon-chain/core/feed/operation:go_default_library",
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/core/time:go_default_library",
|
||||
"//beacon-chain/core/transition:go_default_library",
|
||||
"//beacon-chain/operations/synccommittee:go_default_library",
|
||||
"//beacon-chain/p2p:go_default_library",
|
||||
"//beacon-chain/sync:go_default_library",
|
||||
"//config/fieldparams:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//runtime/version: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",
|
||||
"@org_golang_x_sync//errgroup:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
5
beacon-chain/rpc/core/log.go
Normal file
5
beacon-chain/rpc/core/log.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package core
|
||||
|
||||
import "github.com/sirupsen/logrus"
|
||||
|
||||
var log = logrus.WithField("prefix", "rpc/core")
|
||||
18
beacon-chain/rpc/core/service.go
Normal file
18
beacon-chain/rpc/core/service.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain"
|
||||
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/sync"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
HeadFetcher blockchain.HeadFetcher
|
||||
GenesisTimeFetcher blockchain.TimeFetcher
|
||||
SyncChecker sync.Checker
|
||||
Broadcaster p2p.Broadcaster
|
||||
SyncCommitteePool synccommittee.Pool
|
||||
OperationNotifier opfeed.Notifier
|
||||
}
|
||||
@@ -1,34 +1,64 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/altair"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/epoch/precompute"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed"
|
||||
opfeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers"
|
||||
coreTime "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/time"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/transition"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/runtime/version"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
func ComputeValidatorPerformance(
|
||||
// AggregateBroadcastFailedError represents an error scenario where
|
||||
// broadcasting an aggregate selection proof failed.
|
||||
type AggregateBroadcastFailedError struct {
|
||||
err error
|
||||
}
|
||||
|
||||
// NewAggregateBroadcastFailedError creates a new error instance.
|
||||
func NewAggregateBroadcastFailedError(err error) AggregateBroadcastFailedError {
|
||||
return AggregateBroadcastFailedError{
|
||||
err: err,
|
||||
}
|
||||
}
|
||||
|
||||
// Error returns the underlying error message.
|
||||
func (e *AggregateBroadcastFailedError) Error() string {
|
||||
return fmt.Sprintf("could not broadcast signed aggregated attestation: %s", e.err.Error())
|
||||
}
|
||||
|
||||
// ComputeValidatorPerformance reports the validator's latest balance along with other important metrics on
|
||||
// rewards and penalties throughout its lifecycle in the beacon chain.
|
||||
func (s *Service) ComputeValidatorPerformance(
|
||||
ctx context.Context,
|
||||
req *ethpb.ValidatorPerformanceRequest,
|
||||
headFetcher blockchain.HeadFetcher,
|
||||
currSlot primitives.Slot,
|
||||
) (*ethpb.ValidatorPerformanceResponse, *RpcError) {
|
||||
headState, err := headFetcher.HeadState(ctx)
|
||||
if s.SyncChecker.Syncing() {
|
||||
return nil, &RpcError{Reason: Unavailable, Err: errors.New("Syncing to latest head, not ready to respond")}
|
||||
}
|
||||
|
||||
headState, err := s.HeadFetcher.HeadState(ctx)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Err: errors.Wrap(err, "could not get head state"), Reason: Internal}
|
||||
}
|
||||
currSlot := s.GenesisTimeFetcher.CurrentSlot()
|
||||
if currSlot > headState.Slot() {
|
||||
headRoot, err := headFetcher.HeadRoot(ctx)
|
||||
headRoot, err := s.HeadFetcher.HeadRoot(ctx)
|
||||
if err != nil {
|
||||
return nil, &RpcError{Err: errors.Wrap(err, "could not get head root"), Reason: Internal}
|
||||
}
|
||||
@@ -166,3 +196,71 @@ func ComputeValidatorPerformance(
|
||||
InactivityScores: inactivityScores, // Only populated in Altair
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SubmitSignedContributionAndProof is called by a sync committee aggregator
|
||||
// to submit signed contribution and proof object.
|
||||
func (s *Service) SubmitSignedContributionAndProof(
|
||||
ctx context.Context,
|
||||
req *ethpb.SignedContributionAndProof,
|
||||
) *RpcError {
|
||||
errs, ctx := errgroup.WithContext(ctx)
|
||||
|
||||
// Broadcasting and saving contribution into the pool in parallel. As one fail should not affect another.
|
||||
errs.Go(func() error {
|
||||
return s.Broadcaster.Broadcast(ctx, req)
|
||||
})
|
||||
|
||||
if err := s.SyncCommitteePool.SaveSyncCommitteeContribution(req.Message.Contribution); err != nil {
|
||||
return &RpcError{Err: err, Reason: Internal}
|
||||
}
|
||||
|
||||
// Wait for p2p broadcast to complete and return the first error (if any)
|
||||
err := errs.Wait()
|
||||
if err != nil {
|
||||
return &RpcError{Err: err, Reason: Internal}
|
||||
}
|
||||
|
||||
s.OperationNotifier.OperationFeed().Send(&feed.Event{
|
||||
Type: opfeed.SyncCommitteeContributionReceived,
|
||||
Data: &opfeed.SyncCommitteeContributionReceivedData{
|
||||
Contribution: req,
|
||||
},
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SubmitSignedAggregateSelectionProof verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
|
||||
func (s *Service) SubmitSignedAggregateSelectionProof(
|
||||
ctx context.Context,
|
||||
req *ethpb.SignedAggregateSubmitRequest,
|
||||
) *RpcError {
|
||||
if req.SignedAggregateAndProof == nil || req.SignedAggregateAndProof.Message == nil ||
|
||||
req.SignedAggregateAndProof.Message.Aggregate == nil || req.SignedAggregateAndProof.Message.Aggregate.Data == nil {
|
||||
return &RpcError{Err: errors.New("signed aggregate request can't be nil"), Reason: BadRequest}
|
||||
}
|
||||
emptySig := make([]byte, fieldparams.BLSSignatureLength)
|
||||
if bytes.Equal(req.SignedAggregateAndProof.Signature, emptySig) ||
|
||||
bytes.Equal(req.SignedAggregateAndProof.Message.SelectionProof, emptySig) {
|
||||
return &RpcError{Err: errors.New("signed signatures can't be zero hashes"), Reason: BadRequest}
|
||||
}
|
||||
|
||||
// As a preventive measure, a beacon node shouldn't broadcast an attestation whose slot is out of range.
|
||||
if err := helpers.ValidateAttestationTime(req.SignedAggregateAndProof.Message.Aggregate.Data.Slot,
|
||||
s.GenesisTimeFetcher.GenesisTime(), params.BeaconNetworkConfig().MaximumGossipClockDisparity); err != nil {
|
||||
return &RpcError{Err: errors.New("attestation slot is no longer valid from current time"), Reason: BadRequest}
|
||||
}
|
||||
|
||||
if err := s.Broadcaster.Broadcast(ctx, req.SignedAggregateAndProof); err != nil {
|
||||
return &RpcError{Err: &AggregateBroadcastFailedError{err: err}, Reason: Internal}
|
||||
}
|
||||
|
||||
log.WithFields(logrus.Fields{
|
||||
"slot": req.SignedAggregateAndProof.Message.Aggregate.Data.Slot,
|
||||
"committeeIndex": req.SignedAggregateAndProof.Message.Aggregate.Data.CommitteeIndex,
|
||||
"validatorIndex": req.SignedAggregateAndProof.Message.AggregatorIndex,
|
||||
"aggregatedCount": req.SignedAggregateAndProof.Message.Aggregate.AggregationBits.Count(),
|
||||
}).Debug("Broadcasting aggregated attestation and proof")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ go_library(
|
||||
"//crypto/bls:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//encoding/ssz/detect:go_default_library",
|
||||
"//network:go_default_library",
|
||||
"//network/forks:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/engine/v1:go_default_library",
|
||||
"//proto/eth/v1:go_default_library",
|
||||
"//proto/eth/v2:go_default_library",
|
||||
@@ -101,6 +101,7 @@ go_test(
|
||||
"//beacon-chain/core/transition:go_default_library",
|
||||
"//beacon-chain/db: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/blstoexec:go_default_library",
|
||||
"//beacon-chain/operations/blstoexec/mock:go_default_library",
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/helpers"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/blocks"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v4/network"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
ethpbv1 "github.com/prysmaticlabs/prysm/v4/proto/eth/v1"
|
||||
ethpbv2 "github.com/prysmaticlabs/prysm/v4/proto/eth/v2"
|
||||
"github.com/prysmaticlabs/prysm/v4/proto/migration"
|
||||
@@ -41,7 +41,7 @@ func (bs *Server) PublishBlindedBlockV2(w http.ResponseWriter, r *http.Request)
|
||||
if ok := bs.checkSync(r.Context(), w); !ok {
|
||||
return
|
||||
}
|
||||
isSSZ, err := network.SszRequested(r)
|
||||
isSSZ, err := http2.SszRequested(r)
|
||||
if isSSZ && err == nil {
|
||||
publishBlindedBlockV2SSZ(bs, w, r)
|
||||
} else {
|
||||
@@ -52,22 +52,22 @@ func (bs *Server) PublishBlindedBlockV2(w http.ResponseWriter, r *http.Request)
|
||||
func publishBlindedBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not read request body: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
capellaBlock := ðpbv2.SignedBlindedBeaconBlockCapella{}
|
||||
if err := capellaBlock.UnmarshalSSZ(body); err == nil {
|
||||
v1block, err := migration.BlindedCapellaToV1Alpha1SignedBlock(capellaBlock)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
genericBlock := ð.GenericSignedBeaconBlock{
|
||||
@@ -76,11 +76,11 @@ func publishBlindedBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request
|
||||
},
|
||||
}
|
||||
if err = bs.validateBroadcast(r, genericBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, genericBlock)
|
||||
@@ -90,11 +90,11 @@ func publishBlindedBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request
|
||||
if err := bellatrixBlock.UnmarshalSSZ(body); err == nil {
|
||||
v1block, err := migration.BlindedBellatrixToV1Alpha1SignedBlock(bellatrixBlock)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
genericBlock := ð.GenericSignedBeaconBlock{
|
||||
@@ -103,11 +103,11 @@ func publishBlindedBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request
|
||||
},
|
||||
}
|
||||
if err = bs.validateBroadcast(r, genericBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, genericBlock)
|
||||
@@ -119,11 +119,11 @@ func publishBlindedBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request
|
||||
if err := altairBlock.UnmarshalSSZ(body); err == nil {
|
||||
v1block, err := migration.AltairToV1Alpha1SignedBlock(altairBlock)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
genericBlock := ð.GenericSignedBeaconBlock{
|
||||
@@ -132,11 +132,11 @@ func publishBlindedBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request
|
||||
},
|
||||
}
|
||||
if err = bs.validateBroadcast(r, genericBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, genericBlock)
|
||||
@@ -146,11 +146,11 @@ func publishBlindedBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request
|
||||
if err := phase0Block.UnmarshalSSZ(body); err == nil {
|
||||
v1block, err := migration.V1ToV1Alpha1SignedBlock(phase0Block)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
genericBlock := ð.GenericSignedBeaconBlock{
|
||||
@@ -159,32 +159,32 @@ func publishBlindedBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request
|
||||
},
|
||||
}
|
||||
if err = bs.validateBroadcast(r, genericBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, genericBlock)
|
||||
return
|
||||
}
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Body does not represent a valid block type",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
}
|
||||
|
||||
func publishBlindedBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
validate := validator.New()
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not read request body",
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -193,19 +193,19 @@ func publishBlindedBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(capellaBlock); err == nil {
|
||||
consensusBlock, err := capellaBlock.ToGeneric()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if err = bs.validateBroadcast(r, consensusBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, consensusBlock)
|
||||
@@ -218,19 +218,19 @@ func publishBlindedBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(bellatrixBlock); err == nil {
|
||||
consensusBlock, err := bellatrixBlock.ToGeneric()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if err = bs.validateBroadcast(r, consensusBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, consensusBlock)
|
||||
@@ -242,19 +242,19 @@ func publishBlindedBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(altairBlock); err == nil {
|
||||
consensusBlock, err := altairBlock.ToGeneric()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if err = bs.validateBroadcast(r, consensusBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, consensusBlock)
|
||||
@@ -266,19 +266,19 @@ func publishBlindedBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(phase0Block); err == nil {
|
||||
consensusBlock, err := phase0Block.ToGeneric()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if err = bs.validateBroadcast(r, consensusBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, consensusBlock)
|
||||
@@ -286,11 +286,11 @@ func publishBlindedBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Body does not represent a valid block type",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
}
|
||||
|
||||
// PublishBlockV2 instructs the beacon node to broadcast a newly signed beacon block to the beacon network,
|
||||
@@ -305,7 +305,7 @@ func (bs *Server) PublishBlockV2(w http.ResponseWriter, r *http.Request) {
|
||||
if ok := bs.checkSync(r.Context(), w); !ok {
|
||||
return
|
||||
}
|
||||
isSSZ, err := network.SszRequested(r)
|
||||
isSSZ, err := http2.SszRequested(r)
|
||||
if isSSZ && err == nil {
|
||||
publishBlockV2SSZ(bs, w, r)
|
||||
} else {
|
||||
@@ -317,11 +317,11 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
validate := validator.New()
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not read request body",
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
capellaBlock := ðpbv2.SignedBeaconBlockCapella{}
|
||||
@@ -329,11 +329,11 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(capellaBlock); err == nil {
|
||||
v1block, err := migration.CapellaToV1Alpha1SignedBlock(capellaBlock)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
genericBlock := ð.GenericSignedBeaconBlock{
|
||||
@@ -342,11 +342,11 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
},
|
||||
}
|
||||
if err = bs.validateBroadcast(r, genericBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, genericBlock)
|
||||
@@ -358,11 +358,11 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(bellatrixBlock); err == nil {
|
||||
v1block, err := migration.BellatrixToV1Alpha1SignedBlock(bellatrixBlock)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
genericBlock := ð.GenericSignedBeaconBlock{
|
||||
@@ -371,11 +371,11 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
},
|
||||
}
|
||||
if err = bs.validateBroadcast(r, genericBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, genericBlock)
|
||||
@@ -387,11 +387,11 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(altairBlock); err == nil {
|
||||
v1block, err := migration.AltairToV1Alpha1SignedBlock(altairBlock)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
genericBlock := ð.GenericSignedBeaconBlock{
|
||||
@@ -400,11 +400,11 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
},
|
||||
}
|
||||
if err = bs.validateBroadcast(r, genericBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, genericBlock)
|
||||
@@ -416,11 +416,11 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(phase0Block); err == nil {
|
||||
v1block, err := migration.V1ToV1Alpha1SignedBlock(phase0Block)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
genericBlock := ð.GenericSignedBeaconBlock{
|
||||
@@ -429,33 +429,33 @@ func publishBlockV2SSZ(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
},
|
||||
}
|
||||
if err = bs.validateBroadcast(r, genericBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, genericBlock)
|
||||
return
|
||||
}
|
||||
}
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Body does not represent a valid block type",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
}
|
||||
|
||||
func publishBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
validate := validator.New()
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not read request body",
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
var capellaBlock *SignedBeaconBlockCapella
|
||||
@@ -463,19 +463,19 @@ func publishBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(capellaBlock); err == nil {
|
||||
consensusBlock, err := capellaBlock.ToGeneric()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if err = bs.validateBroadcast(r, consensusBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, consensusBlock)
|
||||
@@ -487,19 +487,19 @@ func publishBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(bellatrixBlock); err == nil {
|
||||
consensusBlock, err := bellatrixBlock.ToGeneric()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if err = bs.validateBroadcast(r, consensusBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, consensusBlock)
|
||||
@@ -511,19 +511,19 @@ func publishBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(altairBlock); err == nil {
|
||||
consensusBlock, err := altairBlock.ToGeneric()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if err = bs.validateBroadcast(r, consensusBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, consensusBlock)
|
||||
@@ -535,19 +535,19 @@ func publishBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
if err = validate.Struct(phase0Block); err == nil {
|
||||
consensusBlock, err := phase0Block.ToGeneric()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode request body into consensus block: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if err = bs.validateBroadcast(r, consensusBlock); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
bs.proposeBlock(r.Context(), w, consensusBlock)
|
||||
@@ -555,21 +555,21 @@ func publishBlockV2(bs *Server, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Body does not represent a valid block type",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
}
|
||||
|
||||
func (bs *Server) proposeBlock(ctx context.Context, w http.ResponseWriter, blk *eth.GenericSignedBeaconBlock) {
|
||||
_, err := bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, blk)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -608,8 +608,13 @@ func (bs *Server) validateBroadcast(r *http.Request, blk *eth.GenericSignedBeaco
|
||||
}
|
||||
|
||||
func (bs *Server) validateConsensus(ctx context.Context, blk interfaces.ReadOnlySignedBeaconBlock) error {
|
||||
parentRoot := blk.Block().ParentRoot()
|
||||
parentState, err := bs.Stater.State(ctx, parentRoot[:])
|
||||
parentBlockRoot := blk.Block().ParentRoot()
|
||||
parentBlock, err := bs.Blocker.Block(ctx, parentBlockRoot[:])
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not get parent block")
|
||||
}
|
||||
parentStateRoot := parentBlock.Block().StateRoot()
|
||||
parentState, err := bs.Stater.State(ctx, parentStateRoot[:])
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not get parent state")
|
||||
}
|
||||
@@ -630,11 +635,11 @@ func (bs *Server) validateEquivocation(blk interfaces.ReadOnlyBeaconBlock) error
|
||||
func (bs *Server) checkSync(ctx context.Context, w http.ResponseWriter) bool {
|
||||
isSyncing, syncDetails, err := helpers.ValidateSyncHTTP(ctx, bs.SyncChecker, bs.HeadFetcher, bs.TimeFetcher, bs.OptimisticModeFetcher)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not check if node is syncing: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return false
|
||||
}
|
||||
if isSyncing {
|
||||
@@ -643,11 +648,11 @@ func (bs *Server) checkSync(ctx context.Context, w http.ResponseWriter) bool {
|
||||
if err == nil {
|
||||
msg += " Details: " + string(details)
|
||||
}
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: msg,
|
||||
Code: http.StatusServiceUnavailable,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -2,6 +2,7 @@ package beacon
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -10,11 +11,20 @@ import (
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
testing2 "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/transition"
|
||||
doublylinkedtree "github.com/prysmaticlabs/prysm/v4/beacon-chain/forkchoice/doubly-linked-tree"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/testutil"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
||||
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/blocks"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
mock2 "github.com/prysmaticlabs/prysm/v4/testing/mock"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/util"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
@@ -351,6 +361,63 @@ func TestPublishBlindedBlockV2SSZ(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestValidateConsensus(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
parentState, privs := util.DeterministicGenesisState(t, params.MinimalSpecConfig().MinGenesisActiveValidatorCount)
|
||||
parentBlock, err := util.GenerateFullBlock(parentState, privs, util.DefaultBlockGenConfig(), parentState.Slot())
|
||||
require.NoError(t, err)
|
||||
parentSbb, err := blocks.NewSignedBeaconBlock(parentBlock)
|
||||
require.NoError(t, err)
|
||||
st, err := transition.ExecuteStateTransition(ctx, parentState, parentSbb)
|
||||
require.NoError(t, err)
|
||||
block, err := util.GenerateFullBlock(st, privs, util.DefaultBlockGenConfig(), st.Slot())
|
||||
require.NoError(t, err)
|
||||
sbb, err := blocks.NewSignedBeaconBlock(block)
|
||||
require.NoError(t, err)
|
||||
parentRoot, err := parentSbb.Block().HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
server := &Server{
|
||||
Blocker: &testutil.MockBlocker{RootBlockMap: map[[32]byte]interfaces.ReadOnlySignedBeaconBlock{parentRoot: parentSbb}},
|
||||
Stater: &testutil.MockStater{StatesByRoot: map[[32]byte]state.BeaconState{bytesutil.ToBytes32(parentBlock.Block.StateRoot): parentState}},
|
||||
}
|
||||
|
||||
require.NoError(t, server.validateConsensus(ctx, sbb))
|
||||
}
|
||||
|
||||
func TestValidateEquivocation(t *testing.T) {
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
st, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, st.SetSlot(10))
|
||||
fc := doublylinkedtree.New()
|
||||
require.NoError(t, fc.InsertNode(context.Background(), st, bytesutil.ToBytes32([]byte("root"))))
|
||||
server := &Server{
|
||||
ForkchoiceFetcher: &testing2.ChainService{ForkChoiceStore: fc},
|
||||
}
|
||||
blk, err := blocks.NewSignedBeaconBlock(util.NewBeaconBlock())
|
||||
require.NoError(t, err)
|
||||
blk.SetSlot(st.Slot() + 1)
|
||||
|
||||
require.NoError(t, server.validateEquivocation(blk.Block()))
|
||||
})
|
||||
t.Run("block already exists", func(t *testing.T) {
|
||||
st, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, st.SetSlot(10))
|
||||
fc := doublylinkedtree.New()
|
||||
require.NoError(t, fc.InsertNode(context.Background(), st, bytesutil.ToBytes32([]byte("root"))))
|
||||
server := &Server{
|
||||
ForkchoiceFetcher: &testing2.ChainService{ForkChoiceStore: fc},
|
||||
}
|
||||
blk, err := blocks.NewSignedBeaconBlock(util.NewBeaconBlock())
|
||||
require.NoError(t, err)
|
||||
blk.SetSlot(st.Slot())
|
||||
|
||||
assert.ErrorContains(t, "already exists", server.validateEquivocation(blk.Block()))
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
phase0Block = `{
|
||||
"message": {
|
||||
|
||||
@@ -383,6 +383,9 @@ func TestListPoolVoluntaryExits(t *testing.T) {
|
||||
func TestSubmitAttesterSlashing_Ok(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
_, keys, err := util.DeterministicDepositsAndKeys(1)
|
||||
require.NoError(t, err)
|
||||
validator := ðpbv1alpha1.Validator{
|
||||
@@ -460,6 +463,9 @@ func TestSubmitAttesterSlashing_Ok(t *testing.T) {
|
||||
func TestSubmitAttesterSlashing_AcrossFork(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
config := params.BeaconConfig()
|
||||
config.AltairForkEpoch = 1
|
||||
@@ -536,6 +542,10 @@ func TestSubmitAttesterSlashing_AcrossFork(t *testing.T) {
|
||||
|
||||
func TestSubmitAttesterSlashing_InvalidSlashing(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
bs, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -577,6 +587,9 @@ func TestSubmitAttesterSlashing_InvalidSlashing(t *testing.T) {
|
||||
func TestSubmitProposerSlashing_Ok(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
_, keys, err := util.DeterministicDepositsAndKeys(1)
|
||||
require.NoError(t, err)
|
||||
validator := ðpbv1alpha1.Validator{
|
||||
@@ -647,6 +660,9 @@ func TestSubmitProposerSlashing_Ok(t *testing.T) {
|
||||
func TestSubmitProposerSlashing_AcrossFork(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
config := params.BeaconConfig()
|
||||
config.AltairForkEpoch = 1
|
||||
@@ -715,6 +731,10 @@ func TestSubmitProposerSlashing_AcrossFork(t *testing.T) {
|
||||
|
||||
func TestSubmitProposerSlashing_InvalidSlashing(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
bs, err := util.NewBeaconState()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -749,6 +769,9 @@ func TestSubmitProposerSlashing_InvalidSlashing(t *testing.T) {
|
||||
func TestSubmitVoluntaryExit_Ok(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
_, keys, err := util.DeterministicDepositsAndKeys(1)
|
||||
require.NoError(t, err)
|
||||
validator := ðpbv1alpha1.Validator{
|
||||
@@ -796,6 +819,9 @@ func TestSubmitVoluntaryExit_Ok(t *testing.T) {
|
||||
func TestSubmitVoluntaryExit_AcrossFork(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
config := params.BeaconConfig()
|
||||
config.AltairForkEpoch = params.BeaconConfig().ShardCommitteePeriod + 1
|
||||
@@ -837,6 +863,9 @@ func TestSubmitVoluntaryExit_AcrossFork(t *testing.T) {
|
||||
func TestSubmitVoluntaryExit_InvalidValidatorIndex(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
_, keys, err := util.DeterministicDepositsAndKeys(1)
|
||||
require.NoError(t, err)
|
||||
validator := ðpbv1alpha1.Validator{
|
||||
@@ -872,6 +901,9 @@ func TestSubmitVoluntaryExit_InvalidValidatorIndex(t *testing.T) {
|
||||
func TestSubmitVoluntaryExit_InvalidExit(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
_, keys, err := util.DeterministicDepositsAndKeys(1)
|
||||
require.NoError(t, err)
|
||||
validator := ðpbv1alpha1.Validator{
|
||||
@@ -906,6 +938,10 @@ func TestSubmitVoluntaryExit_InvalidExit(t *testing.T) {
|
||||
|
||||
func TestServer_SubmitAttestations_Ok(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
c := params.BeaconConfig().Copy()
|
||||
// Required for correct committee size calculation.
|
||||
@@ -1014,6 +1050,9 @@ func TestServer_SubmitAttestations_Ok(t *testing.T) {
|
||||
func TestServer_SubmitAttestations_ValidAttestationSubmitted(t *testing.T) {
|
||||
ctx := grpc.NewContextWithServerTransportStream(context.Background(), &runtime.ServerTransportStream{})
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
c := params.BeaconConfig().Copy()
|
||||
// Required for correct committee size calculation.
|
||||
@@ -1116,6 +1155,9 @@ func TestServer_SubmitAttestations_ValidAttestationSubmitted(t *testing.T) {
|
||||
func TestServer_SubmitAttestations_InvalidAttestationGRPCHeader(t *testing.T) {
|
||||
ctx := grpc.NewContextWithServerTransportStream(context.Background(), &runtime.ServerTransportStream{})
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
c := params.BeaconConfig().Copy()
|
||||
// Required for correct committee size calculation.
|
||||
@@ -1219,6 +1261,10 @@ func TestListBLSToExecutionChanges(t *testing.T) {
|
||||
|
||||
func TestSubmitSignedBLSToExecutionChanges_Ok(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
c := params.BeaconConfig().Copy()
|
||||
// Required for correct committee size calculation.
|
||||
@@ -1312,6 +1358,10 @@ func TestSubmitSignedBLSToExecutionChanges_Ok(t *testing.T) {
|
||||
|
||||
func TestSubmitSignedBLSToExecutionChanges_Bellatrix(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
c := params.BeaconConfig().Copy()
|
||||
// Required for correct committee size calculation.
|
||||
@@ -1420,6 +1470,10 @@ func TestSubmitSignedBLSToExecutionChanges_Bellatrix(t *testing.T) {
|
||||
|
||||
func TestSubmitSignedBLSToExecutionChanges_Failures(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
transition.SkipSlotCache.Disable()
|
||||
defer transition.SkipSlotCache.Enable()
|
||||
|
||||
params.SetupTestConfigCleanup(t)
|
||||
c := params.BeaconConfig().Copy()
|
||||
// Required for correct committee size calculation.
|
||||
|
||||
@@ -16,7 +16,7 @@ go_library(
|
||||
"//beacon-chain/rpc/lookup:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//network:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/engine/v1:go_default_library",
|
||||
"//time/slots:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
@@ -36,7 +36,7 @@ go_test(
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//crypto/bls:go_default_library",
|
||||
"//network:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/assert:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/transition"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/network"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
)
|
||||
@@ -22,7 +22,7 @@ func (s *Server) ExpectedWithdrawals(w http.ResponseWriter, r *http.Request) {
|
||||
// Retrieve beacon state
|
||||
stateId := mux.Vars(r)["state_id"]
|
||||
if stateId == "" {
|
||||
network.WriteError(w, &network.DefaultErrorJson{
|
||||
http2.WriteError(w, &http2.DefaultErrorJson{
|
||||
Message: "state_id is required in URL params",
|
||||
Code: http.StatusBadRequest,
|
||||
})
|
||||
@@ -30,7 +30,7 @@ func (s *Server) ExpectedWithdrawals(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
st, err := s.Stater.State(r.Context(), []byte(stateId))
|
||||
if err != nil {
|
||||
network.WriteError(w, handleWrapError(err, "could not retrieve state", http.StatusNotFound))
|
||||
http2.WriteError(w, handleWrapError(err, "could not retrieve state", http.StatusNotFound))
|
||||
return
|
||||
}
|
||||
queryParam := r.URL.Query().Get("proposal_slot")
|
||||
@@ -38,7 +38,7 @@ func (s *Server) ExpectedWithdrawals(w http.ResponseWriter, r *http.Request) {
|
||||
if queryParam != "" {
|
||||
pSlot, err := strconv.ParseUint(queryParam, 10, 64)
|
||||
if err != nil {
|
||||
network.WriteError(w, handleWrapError(err, "invalid proposal slot value", http.StatusBadRequest))
|
||||
http2.WriteError(w, handleWrapError(err, "invalid proposal slot value", http.StatusBadRequest))
|
||||
return
|
||||
}
|
||||
proposalSlot = primitives.Slot(pSlot)
|
||||
@@ -48,18 +48,18 @@ func (s *Server) ExpectedWithdrawals(w http.ResponseWriter, r *http.Request) {
|
||||
// Perform sanity checks on proposal slot before computing state
|
||||
capellaStart, err := slots.EpochStart(params.BeaconConfig().CapellaForkEpoch)
|
||||
if err != nil {
|
||||
network.WriteError(w, handleWrapError(err, "could not calculate Capella start slot", http.StatusInternalServerError))
|
||||
http2.WriteError(w, handleWrapError(err, "could not calculate Capella start slot", http.StatusInternalServerError))
|
||||
return
|
||||
}
|
||||
if proposalSlot < capellaStart {
|
||||
network.WriteError(w, &network.DefaultErrorJson{
|
||||
http2.WriteError(w, &http2.DefaultErrorJson{
|
||||
Message: "expected withdrawals are not supported before Capella fork",
|
||||
Code: http.StatusBadRequest,
|
||||
})
|
||||
return
|
||||
}
|
||||
if proposalSlot <= st.Slot() {
|
||||
network.WriteError(w, &network.DefaultErrorJson{
|
||||
http2.WriteError(w, &http2.DefaultErrorJson{
|
||||
Message: fmt.Sprintf("proposal slot must be bigger than state slot. proposal slot: %d, state slot: %d", proposalSlot, st.Slot()),
|
||||
Code: http.StatusBadRequest,
|
||||
})
|
||||
@@ -67,7 +67,7 @@ func (s *Server) ExpectedWithdrawals(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
lookAheadLimit := uint64(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().MaxSeedLookahead)))
|
||||
if st.Slot().Add(lookAheadLimit) <= proposalSlot {
|
||||
network.WriteError(w, &network.DefaultErrorJson{
|
||||
http2.WriteError(w, &http2.DefaultErrorJson{
|
||||
Message: fmt.Sprintf("proposal slot cannot be >= %d slots ahead of state slot", lookAheadLimit),
|
||||
Code: http.StatusBadRequest,
|
||||
})
|
||||
@@ -76,12 +76,12 @@ func (s *Server) ExpectedWithdrawals(w http.ResponseWriter, r *http.Request) {
|
||||
// Get metadata for response
|
||||
isOptimistic, err := s.OptimisticModeFetcher.IsOptimistic(r.Context())
|
||||
if err != nil {
|
||||
network.WriteError(w, handleWrapError(err, "could not get optimistic mode info", http.StatusInternalServerError))
|
||||
http2.WriteError(w, handleWrapError(err, "could not get optimistic mode info", http.StatusInternalServerError))
|
||||
return
|
||||
}
|
||||
root, err := helpers.BlockRootAtSlot(st, st.Slot()-1)
|
||||
if err != nil {
|
||||
network.WriteError(w, handleWrapError(err, "could not get block root", http.StatusInternalServerError))
|
||||
http2.WriteError(w, handleWrapError(err, "could not get block root", http.StatusInternalServerError))
|
||||
return
|
||||
}
|
||||
var blockRoot = [32]byte(root)
|
||||
@@ -89,7 +89,7 @@ func (s *Server) ExpectedWithdrawals(w http.ResponseWriter, r *http.Request) {
|
||||
// Advance state forward to proposal slot
|
||||
st, err = transition.ProcessSlots(r.Context(), st, proposalSlot)
|
||||
if err != nil {
|
||||
network.WriteError(w, &network.DefaultErrorJson{
|
||||
http2.WriteError(w, &http2.DefaultErrorJson{
|
||||
Message: "could not process slots",
|
||||
Code: http.StatusInternalServerError,
|
||||
})
|
||||
@@ -97,13 +97,13 @@ func (s *Server) ExpectedWithdrawals(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
withdrawals, err := st.ExpectedWithdrawals()
|
||||
if err != nil {
|
||||
network.WriteError(w, &network.DefaultErrorJson{
|
||||
http2.WriteError(w, &http2.DefaultErrorJson{
|
||||
Message: "could not get expected withdrawals",
|
||||
Code: http.StatusInternalServerError,
|
||||
})
|
||||
return
|
||||
}
|
||||
network.WriteJson(w, &ExpectedWithdrawalsResponse{
|
||||
http2.WriteJson(w, &ExpectedWithdrawalsResponse{
|
||||
ExecutionOptimistic: isOptimistic,
|
||||
Finalized: isFinalized,
|
||||
Data: buildExpectedWithdrawalsData(withdrawals),
|
||||
@@ -123,8 +123,8 @@ func buildExpectedWithdrawalsData(withdrawals []*enginev1.Withdrawal) []*Expecte
|
||||
return data
|
||||
}
|
||||
|
||||
func handleWrapError(err error, message string, code int) *network.DefaultErrorJson {
|
||||
return &network.DefaultErrorJson{
|
||||
func handleWrapError(err error, message string, code int) *http2.DefaultErrorJson {
|
||||
return &http2.DefaultErrorJson{
|
||||
Message: errors.Wrapf(err, message).Error(),
|
||||
Code: code,
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
|
||||
"github.com/prysmaticlabs/prysm/v4/network"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@@ -96,7 +96,7 @@ func TestExpectedWithdrawals_BadRequest(t *testing.T) {
|
||||
|
||||
s.ExpectedWithdrawals(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.StringContains(t, testCase.errorMessage, e.Message)
|
||||
|
||||
@@ -23,7 +23,7 @@ go_library(
|
||||
"//consensus-types/blocks:go_default_library",
|
||||
"//consensus-types/interfaces:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//network:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"//time/slots:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
@@ -51,7 +51,7 @@ go_test(
|
||||
"//crypto/bls:go_default_library",
|
||||
"//crypto/bls/blst:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//network:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/assert:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/blocks"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/network"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
"github.com/prysmaticlabs/prysm/v4/runtime/version"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
"github.com/wealdtech/go-bytesutil"
|
||||
@@ -32,15 +32,15 @@ func (s *Server) BlockRewards(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
blk, err := s.Blocker.Block(r.Context(), []byte(blockId))
|
||||
if errJson := handleGetBlockError(blk, err); errJson != nil {
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if blk.Version() == version.Phase0 {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Block rewards are not supported for Phase 0 blocks",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -49,114 +49,114 @@ func (s *Server) BlockRewards(w http.ResponseWriter, r *http.Request) {
|
||||
// To do this, we replay the state up to the block's slot, but before processing the block.
|
||||
st, err := s.ReplayerBuilder.ReplayerForSlot(blk.Block().Slot()-1).ReplayToSlot(r.Context(), blk.Block().Slot())
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get state: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
proposerIndex := blk.Block().ProposerIndex()
|
||||
initBalance, err := st.BalanceAtIndex(proposerIndex)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get proposer's balance: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
st, err = altair.ProcessAttestationsNoVerifySignature(r.Context(), st, blk)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get attestation rewards" + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
attBalance, err := st.BalanceAtIndex(proposerIndex)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get proposer's balance: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
st, err = coreblocks.ProcessAttesterSlashings(r.Context(), st, blk.Block().Body().AttesterSlashings(), validators.SlashValidator)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get attester slashing rewards: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
attSlashingsBalance, err := st.BalanceAtIndex(proposerIndex)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get proposer's balance: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
st, err = coreblocks.ProcessProposerSlashings(r.Context(), st, blk.Block().Body().ProposerSlashings(), validators.SlashValidator)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get proposer slashing rewards" + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
proposerSlashingsBalance, err := st.BalanceAtIndex(proposerIndex)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get proposer's balance: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
sa, err := blk.Block().Body().SyncAggregate()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get sync aggregate: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
var syncCommitteeReward uint64
|
||||
_, syncCommitteeReward, err = altair.ProcessSyncAggregate(r.Context(), st, sa)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get sync aggregate rewards: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
optimistic, err := s.OptimisticModeFetcher.IsOptimistic(r.Context())
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get optimistic mode info: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
blkRoot, err := blk.Block().HashTreeRoot()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get block root: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ func (s *Server) BlockRewards(w http.ResponseWriter, r *http.Request) {
|
||||
ExecutionOptimistic: optimistic,
|
||||
Finalized: s.FinalizationFetcher.IsFinalized(r.Context(), blkRoot),
|
||||
}
|
||||
network.WriteJson(w, response)
|
||||
http2.WriteJson(w, response)
|
||||
}
|
||||
|
||||
// AttestationRewards retrieves attestation reward info for validators specified by array of public keys or validator index.
|
||||
@@ -198,20 +198,20 @@ func (s *Server) AttestationRewards(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
optimistic, err := s.OptimisticModeFetcher.IsOptimistic(r.Context())
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get optimistic mode info: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
blkRoot, err := st.LatestBlockHeader().HashTreeRoot()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get block root: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ func (s *Server) AttestationRewards(w http.ResponseWriter, r *http.Request) {
|
||||
ExecutionOptimistic: optimistic,
|
||||
Finalized: s.FinalizationFetcher.IsFinalized(r.Context(), blkRoot),
|
||||
}
|
||||
network.WriteJson(w, resp)
|
||||
http2.WriteJson(w, resp)
|
||||
}
|
||||
|
||||
// SyncCommitteeRewards retrieves rewards info for sync committee members specified by array of public keys or validator index.
|
||||
@@ -234,33 +234,33 @@ func (s *Server) SyncCommitteeRewards(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
blk, err := s.Blocker.Block(r.Context(), []byte(blockId))
|
||||
if errJson := handleGetBlockError(blk, err); errJson != nil {
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
if blk.Version() == version.Phase0 {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Sync committee rewards are not supported for Phase 0",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
st, err := s.ReplayerBuilder.ReplayerForSlot(blk.Block().Slot()-1).ReplayToSlot(r.Context(), blk.Block().Slot())
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get state: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
sa, err := blk.Block().Body().SyncAggregate()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get sync aggregate: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -272,22 +272,22 @@ func (s *Server) SyncCommitteeRewards(w http.ResponseWriter, r *http.Request) {
|
||||
for i, valIdx := range valIndices {
|
||||
preProcessBals[i], err = st.BalanceAtIndex(valIdx)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get validator's balance: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
_, proposerReward, err := altair.ProcessSyncAggregate(r.Context(), st, sa)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get sync aggregate rewards: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -296,11 +296,11 @@ func (s *Server) SyncCommitteeRewards(w http.ResponseWriter, r *http.Request) {
|
||||
for i, valIdx := range valIndices {
|
||||
bal, err := st.BalanceAtIndex(valIdx)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get validator's balance: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
rewards[i] = int(bal - preProcessBals[i]) // lint:ignore uintcast
|
||||
@@ -311,20 +311,20 @@ func (s *Server) SyncCommitteeRewards(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
optimistic, err := s.OptimisticModeFetcher.IsOptimistic(r.Context())
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get optimistic mode info: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
blkRoot, err := blk.Block().HashTreeRoot()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get block root: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -340,53 +340,53 @@ func (s *Server) SyncCommitteeRewards(w http.ResponseWriter, r *http.Request) {
|
||||
ExecutionOptimistic: optimistic,
|
||||
Finalized: s.FinalizationFetcher.IsFinalized(r.Context(), blkRoot),
|
||||
}
|
||||
network.WriteJson(w, response)
|
||||
http2.WriteJson(w, response)
|
||||
}
|
||||
|
||||
func (s *Server) attRewardsState(w http.ResponseWriter, r *http.Request) (state.BeaconState, bool) {
|
||||
segments := strings.Split(r.URL.Path, "/")
|
||||
requestedEpoch, err := strconv.ParseUint(segments[len(segments)-1], 10, 64)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode epoch: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
if primitives.Epoch(requestedEpoch) < params.BeaconConfig().AltairForkEpoch {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Attestation rewards are not supported for Phase 0",
|
||||
Code: http.StatusNotFound,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
currentEpoch := uint64(slots.ToEpoch(s.TimeFetcher.CurrentSlot()))
|
||||
if requestedEpoch+1 >= currentEpoch {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Code: http.StatusNotFound,
|
||||
Message: "Attestation rewards are available after two epoch transitions to ensure all attestations have a chance of inclusion",
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
nextEpochEnd, err := slots.EpochEnd(primitives.Epoch(requestedEpoch + 1))
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get next epoch's ending slot: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
st, err := s.Stater.StateBySlot(r.Context(), nextEpochEnd)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get state for epoch's starting slot: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
return st, true
|
||||
@@ -399,20 +399,20 @@ func attRewardsBalancesAndVals(
|
||||
) (*precompute.Balance, []*precompute.Validator, []primitives.ValidatorIndex, bool) {
|
||||
allVals, bal, err := altair.InitializePrecomputeValidators(r.Context(), st)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not initialize precompute validators: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, nil, nil, false
|
||||
}
|
||||
allVals, bal, err = altair.ProcessEpochParticipation(r.Context(), st, bal, allVals)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not process epoch participation: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, nil, nil, false
|
||||
}
|
||||
valIndices, ok := requestedValIndices(w, r, st, allVals)
|
||||
@@ -463,11 +463,11 @@ func idealAttRewards(
|
||||
}
|
||||
deltas, err := altair.AttestationsDelta(st, bal, idealVals)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get attestations delta: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
for i, d := range deltas {
|
||||
@@ -499,11 +499,11 @@ func totalAttRewards(
|
||||
}
|
||||
deltas, err := altair.AttestationsDelta(st, bal, vals)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get attestations delta: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
for i, d := range deltas {
|
||||
@@ -529,11 +529,11 @@ func syncRewardsVals(
|
||||
) ([]*precompute.Validator, []primitives.ValidatorIndex, bool) {
|
||||
allVals, _, err := altair.InitializePrecomputeValidators(r.Context(), st)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not initialize precompute validators: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, nil, false
|
||||
}
|
||||
valIndices, ok := requestedValIndices(w, r, st, allVals)
|
||||
@@ -543,22 +543,22 @@ func syncRewardsVals(
|
||||
|
||||
sc, err := st.CurrentSyncCommittee()
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not get current sync committee: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, nil, false
|
||||
}
|
||||
allScIndices := make([]primitives.ValidatorIndex, len(sc.Pubkeys))
|
||||
for i, pk := range sc.Pubkeys {
|
||||
valIdx, ok := st.ValidatorIndexByPubkey(bytesutil.ToBytes48(pk))
|
||||
if !ok {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: fmt.Sprintf("No validator index found for pubkey %#x", pk),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, nil, false
|
||||
}
|
||||
allScIndices[i] = valIdx
|
||||
@@ -583,11 +583,11 @@ func requestedValIndices(w http.ResponseWriter, r *http.Request, st state.Beacon
|
||||
var rawValIds []string
|
||||
if r.Body != http.NoBody {
|
||||
if err := json.NewDecoder(r.Body).Decode(&rawValIds); err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: "Could not decode validators: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
@@ -597,30 +597,30 @@ func requestedValIndices(w http.ResponseWriter, r *http.Request, st state.Beacon
|
||||
if err != nil {
|
||||
pubkey, err := bytesutil.FromHexString(v)
|
||||
if err != nil || len(pubkey) != fieldparams.BLSPubkeyLength {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: fmt.Sprintf("%s is not a validator index or pubkey", v),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
var ok bool
|
||||
valIndices[i], ok = st.ValidatorIndexByPubkey(bytesutil.ToBytes48(pubkey))
|
||||
if !ok {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: fmt.Sprintf("No validator index found for pubkey %#x", pubkey),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
} else {
|
||||
if index >= uint64(st.NumValidators()) {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: fmt.Sprintf("Validator index %d is too large. Maximum allowed index is %d", index, st.NumValidators()-1),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return nil, false
|
||||
}
|
||||
valIndices[i] = primitives.ValidatorIndex(index)
|
||||
@@ -636,21 +636,21 @@ func requestedValIndices(w http.ResponseWriter, r *http.Request, st state.Beacon
|
||||
return valIndices, true
|
||||
}
|
||||
|
||||
func handleGetBlockError(blk interfaces.ReadOnlySignedBeaconBlock, err error) *network.DefaultErrorJson {
|
||||
func handleGetBlockError(blk interfaces.ReadOnlySignedBeaconBlock, err error) *http2.DefaultErrorJson {
|
||||
if errors.Is(err, lookup.BlockIdParseError{}) {
|
||||
return &network.DefaultErrorJson{
|
||||
return &http2.DefaultErrorJson{
|
||||
Message: "Invalid block ID: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return &network.DefaultErrorJson{
|
||||
return &http2.DefaultErrorJson{
|
||||
Message: "Could not get block from block ID: " + err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
}
|
||||
if err := blocks.BeaconBlockIsNil(blk); err != nil {
|
||||
return &network.DefaultErrorJson{
|
||||
return &http2.DefaultErrorJson{
|
||||
Message: "Could not find requested block: " + err.Error(),
|
||||
Code: http.StatusNotFound,
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
|
||||
"github.com/prysmaticlabs/prysm/v4/crypto/bls/blst"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/v4/network"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@@ -197,7 +197,7 @@ func TestBlockRewards(t *testing.T) {
|
||||
|
||||
s.BlockRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, "Block rewards are not supported for Phase 0 blocks", e.Message)
|
||||
@@ -399,7 +399,7 @@ func TestAttestationRewards(t *testing.T) {
|
||||
|
||||
s.AttestationRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, "foo is not a validator index or pubkey", e.Message)
|
||||
@@ -420,7 +420,7 @@ func TestAttestationRewards(t *testing.T) {
|
||||
|
||||
s.AttestationRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, "No validator index found for pubkey "+pubkey, e.Message)
|
||||
@@ -438,7 +438,7 @@ func TestAttestationRewards(t *testing.T) {
|
||||
|
||||
s.AttestationRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, "Validator index 999 is too large. Maximum allowed index is 63", e.Message)
|
||||
@@ -451,7 +451,7 @@ func TestAttestationRewards(t *testing.T) {
|
||||
|
||||
s.AttestationRewards(writer, request)
|
||||
assert.Equal(t, http.StatusNotFound, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusNotFound, e.Code)
|
||||
assert.Equal(t, "Attestation rewards are not supported for Phase 0", e.Message)
|
||||
@@ -464,7 +464,7 @@ func TestAttestationRewards(t *testing.T) {
|
||||
|
||||
s.AttestationRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
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, "Could not decode epoch"))
|
||||
@@ -477,7 +477,7 @@ func TestAttestationRewards(t *testing.T) {
|
||||
|
||||
s.AttestationRewards(writer, request)
|
||||
assert.Equal(t, http.StatusNotFound, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusNotFound, e.Code)
|
||||
assert.Equal(t, "Attestation rewards are available after two epoch transitions to ensure all attestations have a chance of inclusion", e.Message)
|
||||
@@ -702,7 +702,7 @@ func TestSyncCommiteeRewards(t *testing.T) {
|
||||
|
||||
s.SyncCommitteeRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, "foo is not a validator index or pubkey", e.Message)
|
||||
@@ -729,7 +729,7 @@ func TestSyncCommiteeRewards(t *testing.T) {
|
||||
|
||||
s.SyncCommitteeRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, "No validator index found for pubkey "+pubkey, e.Message)
|
||||
@@ -753,7 +753,7 @@ func TestSyncCommiteeRewards(t *testing.T) {
|
||||
|
||||
s.SyncCommitteeRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, "Validator index 9999 is too large. Maximum allowed index is 1023", e.Message)
|
||||
@@ -772,7 +772,7 @@ func TestSyncCommiteeRewards(t *testing.T) {
|
||||
|
||||
s.SyncCommitteeRewards(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.Equal(t, "Sync committee rewards are not supported for Phase 0", e.Message)
|
||||
|
||||
29
beacon-chain/rpc/eth/shared/BUILD.bazel
Normal file
29
beacon-chain/rpc/eth/shared/BUILD.bazel
Normal file
@@ -0,0 +1,29 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"errors.go",
|
||||
"request.go",
|
||||
"structs.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["errors_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//testing/assert:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
],
|
||||
)
|
||||
28
beacon-chain/rpc/eth/shared/errors.go
Normal file
28
beacon-chain/rpc/eth/shared/errors.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DecodeError represents an error resulting from trying to decode an HTTP request.
|
||||
// It tracks the full field name for which decoding failed.
|
||||
type DecodeError struct {
|
||||
path []string
|
||||
err error
|
||||
}
|
||||
|
||||
// NewDecodeError wraps an error (either the initial decoding error or another DecodeError).
|
||||
// The current field that failed decoding must be passed in.
|
||||
func NewDecodeError(err error, field string) *DecodeError {
|
||||
de, ok := err.(*DecodeError)
|
||||
if ok {
|
||||
return &DecodeError{path: append([]string{field}, de.path...), err: de.err}
|
||||
}
|
||||
return &DecodeError{path: []string{field}, err: err}
|
||||
}
|
||||
|
||||
// Error returns the formatted error message which contains the full field name and the actual decoding error.
|
||||
func (e *DecodeError) Error() string {
|
||||
return fmt.Sprintf("could not decode %s: %s", strings.Join(e.path, "."), e.err.Error())
|
||||
}
|
||||
16
beacon-chain/rpc/eth/shared/errors_test.go
Normal file
16
beacon-chain/rpc/eth/shared/errors_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
)
|
||||
|
||||
func TestDecodeError(t *testing.T) {
|
||||
e := errors.New("not a number")
|
||||
de := NewDecodeError(e, "Z")
|
||||
de = NewDecodeError(de, "Y")
|
||||
de = NewDecodeError(de, "X")
|
||||
assert.Equal(t, "could not decode X.Y.Z: not a number", de.Error())
|
||||
}
|
||||
50
beacon-chain/rpc/eth/shared/request.go
Normal file
50
beacon-chain/rpc/eth/shared/request.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
)
|
||||
|
||||
func ValidateHex(w http.ResponseWriter, name string, s string) bool {
|
||||
if s == "" {
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: name + " is required",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
http2.WriteError(w, errJson)
|
||||
return false
|
||||
}
|
||||
if !bytesutil.IsHex([]byte(s)) {
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: name + " is invalid",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
http2.WriteError(w, errJson)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func ValidateUint(w http.ResponseWriter, name string, s string) (uint64, bool) {
|
||||
if s == "" {
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: name + " is required",
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
http2.WriteError(w, errJson)
|
||||
return 0, false
|
||||
}
|
||||
v, err := strconv.ParseUint(s, 10, 64)
|
||||
if err != nil {
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: name + " is invalid: " + err.Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
http2.WriteError(w, errJson)
|
||||
return 0, false
|
||||
}
|
||||
return v, true
|
||||
}
|
||||
230
beacon-chain/rpc/eth/shared/structs.go
Normal file
230
beacon-chain/rpc/eth/shared/structs.go
Normal file
@@ -0,0 +1,230 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
type Attestation struct {
|
||||
AggregationBits string `json:"aggregation_bits" validate:"required,hexadecimal"`
|
||||
Data *AttestationData `json:"data" validate:"required"`
|
||||
Signature string `json:"signature" validate:"required,hexadecimal"`
|
||||
}
|
||||
|
||||
type AttestationData struct {
|
||||
Slot string `json:"slot" validate:"required,number,gte=0"`
|
||||
CommitteeIndex string `json:"index" validate:"required,number,gte=0"`
|
||||
BeaconBlockRoot string `json:"beacon_block_root" validate:"required,hexadecimal"`
|
||||
Source *Checkpoint `json:"source" validate:"required"`
|
||||
Target *Checkpoint `json:"target" validate:"required"`
|
||||
}
|
||||
|
||||
type Checkpoint struct {
|
||||
Epoch string `json:"epoch" validate:"required,number,gte=0"`
|
||||
Root string `json:"root" validate:"required,hexadecimal"`
|
||||
}
|
||||
|
||||
type SignedContributionAndProof struct {
|
||||
Message *ContributionAndProof `json:"message" validate:"required"`
|
||||
Signature string `json:"signature" validate:"required,hexadecimal"`
|
||||
}
|
||||
|
||||
type ContributionAndProof struct {
|
||||
AggregatorIndex string `json:"aggregator_index" validate:"required,number,gte=0"`
|
||||
Contribution *SyncCommitteeContribution `json:"contribution" validate:"required"`
|
||||
SelectionProof string `json:"selection_proof" validate:"required,hexadecimal"`
|
||||
}
|
||||
|
||||
type SyncCommitteeContribution struct {
|
||||
Slot string `json:"slot" validate:"required,number,gte=0"`
|
||||
BeaconBlockRoot string `json:"beacon_block_root" hex:"true" validate:"required,hexadecimal"`
|
||||
SubcommitteeIndex string `json:"subcommittee_index" validate:"required,number,gte=0"`
|
||||
AggregationBits string `json:"aggregation_bits" hex:"true" validate:"required,hexadecimal"`
|
||||
Signature string `json:"signature" hex:"true" validate:"required,hexadecimal"`
|
||||
}
|
||||
|
||||
type SignedAggregateAttestationAndProof struct {
|
||||
Message *AggregateAttestationAndProof `json:"message" validate:"required"`
|
||||
Signature string `json:"signature" validate:"required,hexadecimal"`
|
||||
}
|
||||
|
||||
type AggregateAttestationAndProof struct {
|
||||
AggregatorIndex string `json:"aggregator_index" validate:"required,number,gte=0"`
|
||||
Aggregate *Attestation `json:"aggregate" validate:"required"`
|
||||
SelectionProof string `json:"selection_proof" validate:"required,hexadecimal"`
|
||||
}
|
||||
|
||||
func (s *SignedContributionAndProof) ToConsensus() (*eth.SignedContributionAndProof, error) {
|
||||
msg, err := s.Message.ToConsensus()
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Message")
|
||||
}
|
||||
sig, err := hexutil.Decode(s.Signature)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Signature")
|
||||
}
|
||||
|
||||
return ð.SignedContributionAndProof{
|
||||
Message: msg,
|
||||
Signature: sig,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ContributionAndProof) ToConsensus() (*eth.ContributionAndProof, error) {
|
||||
contribution, err := c.Contribution.ToConsensus()
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Contribution")
|
||||
}
|
||||
aggregatorIndex, err := strconv.ParseUint(c.AggregatorIndex, 10, 64)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "AggregatorIndex")
|
||||
}
|
||||
selectionProof, err := hexutil.Decode(c.SelectionProof)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "SelectionProof")
|
||||
}
|
||||
|
||||
return ð.ContributionAndProof{
|
||||
AggregatorIndex: primitives.ValidatorIndex(aggregatorIndex),
|
||||
Contribution: contribution,
|
||||
SelectionProof: selectionProof,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *SyncCommitteeContribution) ToConsensus() (*eth.SyncCommitteeContribution, error) {
|
||||
slot, err := strconv.ParseUint(s.Slot, 10, 64)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Slot")
|
||||
}
|
||||
bbRoot, err := hexutil.Decode(s.BeaconBlockRoot)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "BeaconBlockRoot")
|
||||
}
|
||||
subcommitteeIndex, err := strconv.ParseUint(s.SubcommitteeIndex, 10, 64)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "SubcommitteeIndex")
|
||||
}
|
||||
aggBits, err := hexutil.Decode(s.AggregationBits)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "AggregationBits")
|
||||
}
|
||||
sig, err := hexutil.Decode(s.Signature)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Signature")
|
||||
}
|
||||
|
||||
return ð.SyncCommitteeContribution{
|
||||
Slot: primitives.Slot(slot),
|
||||
BlockRoot: bbRoot,
|
||||
SubcommitteeIndex: subcommitteeIndex,
|
||||
AggregationBits: aggBits,
|
||||
Signature: sig,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *SignedAggregateAttestationAndProof) ToConsensus() (*eth.SignedAggregateAttestationAndProof, error) {
|
||||
msg, err := s.Message.ToConsensus()
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Message")
|
||||
}
|
||||
sig, err := hexutil.Decode(s.Signature)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Signature")
|
||||
}
|
||||
|
||||
return ð.SignedAggregateAttestationAndProof{
|
||||
Message: msg,
|
||||
Signature: sig,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *AggregateAttestationAndProof) ToConsensus() (*eth.AggregateAttestationAndProof, error) {
|
||||
aggIndex, err := strconv.ParseUint(a.AggregatorIndex, 10, 64)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "AggregatorIndex")
|
||||
}
|
||||
agg, err := a.Aggregate.ToConsensus()
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Aggregate")
|
||||
}
|
||||
proof, err := hexutil.Decode(a.SelectionProof)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "SelectionProof")
|
||||
}
|
||||
return ð.AggregateAttestationAndProof{
|
||||
AggregatorIndex: primitives.ValidatorIndex(aggIndex),
|
||||
Aggregate: agg,
|
||||
SelectionProof: proof,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *Attestation) ToConsensus() (*eth.Attestation, error) {
|
||||
aggBits, err := hexutil.Decode(a.AggregationBits)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "AggregationBits")
|
||||
}
|
||||
data, err := a.Data.ToConsensus()
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Data")
|
||||
}
|
||||
sig, err := hexutil.Decode(a.Signature)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Signature")
|
||||
}
|
||||
|
||||
return ð.Attestation{
|
||||
AggregationBits: aggBits,
|
||||
Data: data,
|
||||
Signature: sig,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *AttestationData) ToConsensus() (*eth.AttestationData, error) {
|
||||
slot, err := strconv.ParseUint(a.Slot, 10, 64)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Slot")
|
||||
}
|
||||
committeeIndex, err := strconv.ParseUint(a.CommitteeIndex, 10, 64)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "CommitteeIndex")
|
||||
}
|
||||
bbRoot, err := hexutil.Decode(a.BeaconBlockRoot)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "BeaconBlockRoot")
|
||||
}
|
||||
source, err := a.Source.ToConsensus()
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Source")
|
||||
}
|
||||
target, err := a.Target.ToConsensus()
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Target")
|
||||
}
|
||||
|
||||
return ð.AttestationData{
|
||||
Slot: primitives.Slot(slot),
|
||||
CommitteeIndex: primitives.CommitteeIndex(committeeIndex),
|
||||
BeaconBlockRoot: bbRoot,
|
||||
Source: source,
|
||||
Target: target,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *Checkpoint) ToConsensus() (*eth.Checkpoint, error) {
|
||||
epoch, err := strconv.ParseUint(c.Epoch, 10, 64)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Epoch")
|
||||
}
|
||||
root, err := hexutil.Decode(c.Root)
|
||||
if err != nil {
|
||||
return nil, NewDecodeError(err, "Root")
|
||||
}
|
||||
|
||||
return ð.Checkpoint{
|
||||
Epoch: primitives.Epoch(epoch),
|
||||
Root: root,
|
||||
}, nil
|
||||
}
|
||||
@@ -3,7 +3,9 @@ load("@prysm//tools/go:def.bzl", "go_library", "go_test")
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"handlers.go",
|
||||
"server.go",
|
||||
"structs.go",
|
||||
"validator.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator",
|
||||
@@ -12,13 +14,16 @@ go_library(
|
||||
"//beacon-chain/blockchain:go_default_library",
|
||||
"//beacon-chain/builder:go_default_library",
|
||||
"//beacon-chain/cache:go_default_library",
|
||||
"//beacon-chain/core/feed/operation:go_default_library",
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/db:go_default_library",
|
||||
"//beacon-chain/db/kv:go_default_library",
|
||||
"//beacon-chain/operations/attestations:go_default_library",
|
||||
"//beacon-chain/operations/synccommittee:go_default_library",
|
||||
"//beacon-chain/p2p:go_default_library",
|
||||
"//beacon-chain/rpc/core:go_default_library",
|
||||
"//beacon-chain/rpc/eth/helpers:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//beacon-chain/rpc/lookup:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
@@ -27,6 +32,7 @@ go_library(
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/eth/v1:go_default_library",
|
||||
"//proto/eth/v2:go_default_library",
|
||||
"//proto/migration:go_default_library",
|
||||
@@ -34,6 +40,7 @@ go_library(
|
||||
"//time/slots:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_go_playground_validator_v10//:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
|
||||
@@ -46,7 +53,10 @@ go_library(
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["validator_test.go"],
|
||||
srcs = [
|
||||
"handlers_test.go",
|
||||
"validator_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//beacon-chain/blockchain/testing:go_default_library",
|
||||
@@ -57,6 +67,7 @@ go_test(
|
||||
"//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/prysm/v1alpha1/validator:go_default_library",
|
||||
"//beacon-chain/rpc/testutil:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
@@ -66,6 +77,7 @@ go_test(
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//crypto/bls:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/eth/v1:go_default_library",
|
||||
"//proto/eth/v2:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
@@ -75,8 +87,8 @@ go_test(
|
||||
"//testing/util:go_default_library",
|
||||
"//time/slots:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_golang_mock//gomock:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
|
||||
159
beacon-chain/rpc/eth/validator/handlers.go
Normal file
159
beacon-chain/rpc/eth/validator/handlers.go
Normal file
@@ -0,0 +1,159 @@
|
||||
package validator
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
ethpbalpha "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
// GetAggregateAttestation aggregates all attestations matching the given attestation data root and slot, returning the aggregated result.
|
||||
func (s *Server) GetAggregateAttestation(w http.ResponseWriter, r *http.Request) {
|
||||
attDataRoot := r.URL.Query().Get("attestation_data_root")
|
||||
valid := shared.ValidateHex(w, "Attestation data root", attDataRoot)
|
||||
if !valid {
|
||||
return
|
||||
}
|
||||
rawSlot := r.URL.Query().Get("slot")
|
||||
slot, valid := shared.ValidateUint(w, "Slot", rawSlot)
|
||||
if !valid {
|
||||
return
|
||||
}
|
||||
|
||||
if err := s.AttestationsPool.AggregateUnaggregatedAttestations(r.Context()); err != nil {
|
||||
http2.HandleError(w, "Could not aggregate unaggregated attestations: "+err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
allAtts := s.AttestationsPool.AggregatedAttestations()
|
||||
var bestMatchingAtt *ethpbalpha.Attestation
|
||||
for _, att := range allAtts {
|
||||
if att.Data.Slot == primitives.Slot(slot) {
|
||||
root, err := att.Data.HashTreeRoot()
|
||||
if err != nil {
|
||||
http2.HandleError(w, "Could not get attestation data root: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
attDataRootBytes, err := hexutil.Decode(attDataRoot)
|
||||
if err != nil {
|
||||
http2.HandleError(w, "Could not decode attestation data root into bytes: "+err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if bytes.Equal(root[:], attDataRootBytes) {
|
||||
if bestMatchingAtt == nil || len(att.AggregationBits) > len(bestMatchingAtt.AggregationBits) {
|
||||
bestMatchingAtt = att
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if bestMatchingAtt == nil {
|
||||
http2.HandleError(w, "No matching attestation found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
response := &AggregateAttestationResponse{
|
||||
Data: &shared.Attestation{
|
||||
AggregationBits: hexutil.Encode(bestMatchingAtt.AggregationBits),
|
||||
Data: &shared.AttestationData{
|
||||
Slot: strconv.FormatUint(uint64(bestMatchingAtt.Data.Slot), 10),
|
||||
CommitteeIndex: strconv.FormatUint(uint64(bestMatchingAtt.Data.CommitteeIndex), 10),
|
||||
BeaconBlockRoot: hexutil.Encode(bestMatchingAtt.Data.BeaconBlockRoot),
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(uint64(bestMatchingAtt.Data.Source.Epoch), 10),
|
||||
Root: hexutil.Encode(bestMatchingAtt.Data.Source.Root),
|
||||
},
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: strconv.FormatUint(uint64(bestMatchingAtt.Data.Target.Epoch), 10),
|
||||
Root: hexutil.Encode(bestMatchingAtt.Data.Target.Root),
|
||||
},
|
||||
},
|
||||
Signature: hexutil.Encode(bestMatchingAtt.Signature),
|
||||
}}
|
||||
http2.WriteJson(w, response)
|
||||
}
|
||||
|
||||
// SubmitContributionAndProofs publishes multiple signed sync committee contribution and proofs.
|
||||
func (s *Server) SubmitContributionAndProofs(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Body == http.NoBody {
|
||||
http2.HandleError(w, "No data submitted", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
var req SubmitContributionAndProofsRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req.Data); err != nil {
|
||||
http2.HandleError(w, "Could not decode request body: "+err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
validate := validator.New()
|
||||
if err := validate.Struct(req); err != nil {
|
||||
http2.HandleError(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
for _, item := range req.Data {
|
||||
consensusItem, err := item.ToConsensus()
|
||||
if err != nil {
|
||||
http2.HandleError(w, "Could not convert request contribution to consensus contribution: "+err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
rpcError := s.CoreService.SubmitSignedContributionAndProof(r.Context(), consensusItem)
|
||||
if rpcError != nil {
|
||||
http2.HandleError(w, rpcError.Err.Error(), core.ErrorReasonToHTTP(rpcError.Reason))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SubmitAggregateAndProofs verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
|
||||
func (s *Server) SubmitAggregateAndProofs(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Body == http.NoBody {
|
||||
http2.HandleError(w, "No data submitted", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
var req SubmitAggregateAndProofsRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req.Data); err != nil {
|
||||
http2.HandleError(w, "Could not decode request body: "+err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
validate := validator.New()
|
||||
if err := validate.Struct(req); err != nil {
|
||||
http2.HandleError(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
broadcastFailed := false
|
||||
for _, item := range req.Data {
|
||||
consensusItem, err := item.ToConsensus()
|
||||
if err != nil {
|
||||
http2.HandleError(w, "Could not convert request aggregate to consensus aggregate: "+err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
rpcError := s.CoreService.SubmitSignedAggregateSelectionProof(
|
||||
r.Context(),
|
||||
ðpbalpha.SignedAggregateSubmitRequest{SignedAggregateAndProof: consensusItem},
|
||||
)
|
||||
if rpcError != nil {
|
||||
_, ok := rpcError.Err.(*core.AggregateBroadcastFailedError)
|
||||
if ok {
|
||||
broadcastFailed = true
|
||||
} else {
|
||||
http2.HandleError(w, rpcError.Err.Error(), core.ErrorReasonToHTTP(rpcError.Reason))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if broadcastFailed {
|
||||
http2.HandleError(w, "Could not broadcast one or more signed aggregated attestations", http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
609
beacon-chain/rpc/eth/validator/handlers_test.go
Normal file
609
beacon-chain/rpc/eth/validator/handlers_test.go
Normal file
@@ -0,0 +1,609 @@
|
||||
package validator
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
mockChain "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/attestations"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/synccommittee"
|
||||
p2pmock "github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
ethpbalpha "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
)
|
||||
|
||||
func TestGetAggregateAttestation(t *testing.T) {
|
||||
root1 := bytesutil.PadTo([]byte("root1"), 32)
|
||||
sig1 := bytesutil.PadTo([]byte("sig1"), fieldparams.BLSSignatureLength)
|
||||
attSlot1 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{0, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
BeaconBlockRoot: root1,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root1,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root1,
|
||||
},
|
||||
},
|
||||
Signature: sig1,
|
||||
}
|
||||
root21 := bytesutil.PadTo([]byte("root2_1"), 32)
|
||||
sig21 := bytesutil.PadTo([]byte("sig2_1"), fieldparams.BLSSignatureLength)
|
||||
attslot21 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{0, 1, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 2,
|
||||
CommitteeIndex: 2,
|
||||
BeaconBlockRoot: root21,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root21,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root21,
|
||||
},
|
||||
},
|
||||
Signature: sig21,
|
||||
}
|
||||
root22 := bytesutil.PadTo([]byte("root2_2"), 32)
|
||||
sig22 := bytesutil.PadTo([]byte("sig2_2"), fieldparams.BLSSignatureLength)
|
||||
attslot22 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{0, 1, 1, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 2,
|
||||
CommitteeIndex: 3,
|
||||
BeaconBlockRoot: root22,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root22,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root22,
|
||||
},
|
||||
},
|
||||
Signature: sig22,
|
||||
}
|
||||
root33 := bytesutil.PadTo([]byte("root3_3"), 32)
|
||||
sig33 := bls.NewAggregateSignature().Marshal()
|
||||
attslot33 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{1, 0, 0, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 2,
|
||||
CommitteeIndex: 3,
|
||||
BeaconBlockRoot: root33,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root33,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root33,
|
||||
},
|
||||
},
|
||||
Signature: sig33,
|
||||
}
|
||||
pool := attestations.NewPool()
|
||||
err := pool.SaveAggregatedAttestations([]*ethpbalpha.Attestation{attSlot1, attslot21, attslot22})
|
||||
assert.NoError(t, err)
|
||||
s := &Server{
|
||||
AttestationsPool: pool,
|
||||
}
|
||||
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
reqRoot, err := attslot22.Data.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
attDataRoot := hexutil.Encode(reqRoot[:])
|
||||
url := "http://example.com?attestation_data_root=" + attDataRoot + "&slot=2"
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAggregateAttestation(writer, request)
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
resp := &AggregateAttestationResponse{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
|
||||
require.NotNil(t, resp)
|
||||
require.NotNil(t, resp.Data)
|
||||
assert.DeepEqual(t, "0x00010101", resp.Data.AggregationBits)
|
||||
assert.DeepEqual(t, hexutil.Encode(sig22), resp.Data.Signature)
|
||||
assert.Equal(t, "2", resp.Data.Data.Slot)
|
||||
assert.Equal(t, "3", resp.Data.Data.CommitteeIndex)
|
||||
assert.DeepEqual(t, hexutil.Encode(root22), resp.Data.Data.BeaconBlockRoot)
|
||||
require.NotNil(t, resp.Data.Data.Source)
|
||||
assert.Equal(t, "1", resp.Data.Data.Source.Epoch)
|
||||
assert.DeepEqual(t, hexutil.Encode(root22), resp.Data.Data.Source.Root)
|
||||
require.NotNil(t, resp.Data.Data.Target)
|
||||
assert.Equal(t, "1", resp.Data.Data.Target.Epoch)
|
||||
assert.DeepEqual(t, hexutil.Encode(root22), resp.Data.Data.Target.Root)
|
||||
})
|
||||
|
||||
t.Run("aggregate beforehand", func(t *testing.T) {
|
||||
err = s.AttestationsPool.SaveUnaggregatedAttestation(attslot33)
|
||||
require.NoError(t, err)
|
||||
newAtt := ethpbalpha.CopyAttestation(attslot33)
|
||||
newAtt.AggregationBits = []byte{0, 1, 0, 1}
|
||||
err = s.AttestationsPool.SaveUnaggregatedAttestation(newAtt)
|
||||
require.NoError(t, err)
|
||||
|
||||
reqRoot, err := attslot33.Data.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
attDataRoot := hexutil.Encode(reqRoot[:])
|
||||
url := "http://example.com?attestation_data_root=" + attDataRoot + "&slot=2"
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAggregateAttestation(writer, request)
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
resp := &AggregateAttestationResponse{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
|
||||
require.NotNil(t, resp)
|
||||
assert.DeepEqual(t, "0x01010001", resp.Data.AggregationBits)
|
||||
})
|
||||
t.Run("no matching attestation", func(t *testing.T) {
|
||||
attDataRoot := hexutil.Encode(bytesutil.PadTo([]byte("foo"), 32))
|
||||
url := "http://example.com?attestation_data_root=" + attDataRoot + "&slot=2"
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAggregateAttestation(writer, request)
|
||||
assert.Equal(t, http.StatusNotFound, writer.Code)
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusNotFound, e.Code)
|
||||
assert.Equal(t, true, strings.Contains(e.Message, "No matching attestation found"))
|
||||
})
|
||||
t.Run("no attestation_data_root provided", func(t *testing.T) {
|
||||
url := "http://example.com?slot=2"
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAggregateAttestation(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, "Attestation data root is required"))
|
||||
})
|
||||
t.Run("invalid attestation_data_root provided", func(t *testing.T) {
|
||||
url := "http://example.com?attestation_data_root=foo&slot=2"
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAggregateAttestation(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, "Attestation data root is invalid"))
|
||||
})
|
||||
t.Run("no slot provided", func(t *testing.T) {
|
||||
attDataRoot := hexutil.Encode(bytesutil.PadTo([]byte("foo"), 32))
|
||||
url := "http://example.com?attestation_data_root=" + attDataRoot
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAggregateAttestation(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, "Slot is required"))
|
||||
})
|
||||
t.Run("invalid slot provided", func(t *testing.T) {
|
||||
attDataRoot := hexutil.Encode(bytesutil.PadTo([]byte("foo"), 32))
|
||||
url := "http://example.com?attestation_data_root=" + attDataRoot + "&slot=foo"
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAggregateAttestation(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, "Slot is invalid"))
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetAggregateAttestation_SameSlotAndRoot_ReturnMostAggregationBits(t *testing.T) {
|
||||
root := bytesutil.PadTo([]byte("root"), 32)
|
||||
sig := bytesutil.PadTo([]byte("sig"), fieldparams.BLSSignatureLength)
|
||||
att1 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{3, 0, 0, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
BeaconBlockRoot: root,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
},
|
||||
Signature: sig,
|
||||
}
|
||||
att2 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{0, 3, 0, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
BeaconBlockRoot: root,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
},
|
||||
Signature: sig,
|
||||
}
|
||||
pool := attestations.NewPool()
|
||||
err := pool.SaveAggregatedAttestations([]*ethpbalpha.Attestation{att1, att2})
|
||||
assert.NoError(t, err)
|
||||
s := &Server{
|
||||
AttestationsPool: pool,
|
||||
}
|
||||
reqRoot, err := att1.Data.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
attDataRoot := hexutil.Encode(reqRoot[:])
|
||||
url := "http://example.com?attestation_data_root=" + attDataRoot + "&slot=1"
|
||||
request := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetAggregateAttestation(writer, request)
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
resp := &AggregateAttestationResponse{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
|
||||
require.NotNil(t, resp)
|
||||
assert.DeepEqual(t, "0x03000001", resp.Data.AggregationBits)
|
||||
}
|
||||
|
||||
func TestSubmitContributionAndProofs(t *testing.T) {
|
||||
c := &core.Service{
|
||||
OperationNotifier: (&mockChain.ChainService{}).OperationNotifier(),
|
||||
}
|
||||
|
||||
s := &Server{CoreService: c}
|
||||
|
||||
t.Run("single", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
c.Broadcaster = broadcaster
|
||||
c.SyncCommitteePool = synccommittee.NewStore()
|
||||
|
||||
var body bytes.Buffer
|
||||
_, err := body.WriteString(singleContribution)
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest(http.MethodPost, "http://example.com", &body)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.SubmitContributionAndProofs(writer, request)
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
assert.Equal(t, 1, len(broadcaster.BroadcastMessages))
|
||||
contributions, err := c.SyncCommitteePool.SyncCommitteeContributions(1)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(contributions))
|
||||
})
|
||||
|
||||
t.Run("multiple", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
c.Broadcaster = broadcaster
|
||||
c.SyncCommitteePool = synccommittee.NewStore()
|
||||
|
||||
var body bytes.Buffer
|
||||
_, err := body.WriteString(multipleContributions)
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest(http.MethodPost, "http://example.com", &body)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.SubmitContributionAndProofs(writer, request)
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
assert.Equal(t, 2, len(broadcaster.BroadcastMessages))
|
||||
contributions, err := c.SyncCommitteePool.SyncCommitteeContributions(1)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, len(contributions))
|
||||
})
|
||||
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
c.SyncCommitteePool = synccommittee.NewStore()
|
||||
|
||||
var body bytes.Buffer
|
||||
_, err := body.WriteString(invalidContribution)
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest(http.MethodPost, "http://example.com", &body)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.SubmitContributionAndProofs(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)
|
||||
})
|
||||
|
||||
t.Run("no body", func(t *testing.T) {
|
||||
c.SyncCommitteePool = synccommittee.NewStore()
|
||||
|
||||
request := httptest.NewRequest(http.MethodPost, "http://example.com", nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.SubmitContributionAndProofs(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, "No data submitted"))
|
||||
})
|
||||
}
|
||||
|
||||
func TestSubmitAggregateAndProofs(t *testing.T) {
|
||||
c := &core.Service{
|
||||
GenesisTimeFetcher: &mockChain.ChainService{},
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
CoreService: c,
|
||||
}
|
||||
|
||||
t.Run("single", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
c.Broadcaster = broadcaster
|
||||
|
||||
var body bytes.Buffer
|
||||
_, err := body.WriteString(singleAggregate)
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest(http.MethodPost, "http://example.com", &body)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.SubmitAggregateAndProofs(writer, request)
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
assert.Equal(t, 1, len(broadcaster.BroadcastMessages))
|
||||
})
|
||||
|
||||
t.Run("multiple", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
c.Broadcaster = broadcaster
|
||||
c.SyncCommitteePool = synccommittee.NewStore()
|
||||
|
||||
var body bytes.Buffer
|
||||
_, err := body.WriteString(multipleAggregates)
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest(http.MethodPost, "http://example.com", &body)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.SubmitAggregateAndProofs(writer, request)
|
||||
assert.Equal(t, http.StatusOK, writer.Code)
|
||||
assert.Equal(t, 2, len(broadcaster.BroadcastMessages))
|
||||
})
|
||||
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
var body bytes.Buffer
|
||||
_, err := body.WriteString(invalidAggregate)
|
||||
require.NoError(t, err)
|
||||
request := httptest.NewRequest(http.MethodPost, "http://example.com", &body)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.SubmitAggregateAndProofs(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)
|
||||
})
|
||||
|
||||
t.Run("no body", func(t *testing.T) {
|
||||
request := httptest.NewRequest(http.MethodPost, "http://example.com", nil)
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.SubmitAggregateAndProofs(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, "No data submitted"))
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
singleContribution = `[
|
||||
{
|
||||
"message": {
|
||||
"aggregator_index": "1",
|
||||
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"contribution": {
|
||||
"slot": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"subcommittee_index": "1",
|
||||
"aggregation_bits": "0x01",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
]`
|
||||
multipleContributions = `[
|
||||
{
|
||||
"message": {
|
||||
"aggregator_index": "1",
|
||||
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"contribution": {
|
||||
"slot": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"subcommittee_index": "1",
|
||||
"aggregation_bits": "0x01",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
{
|
||||
"message": {
|
||||
"aggregator_index": "1",
|
||||
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"contribution": {
|
||||
"slot": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"subcommittee_index": "1",
|
||||
"aggregation_bits": "0x01",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
]`
|
||||
// aggregator_index is invalid
|
||||
invalidContribution = `[
|
||||
{
|
||||
"message": {
|
||||
"aggregator_index": "foo",
|
||||
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"contribution": {
|
||||
"slot": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"subcommittee_index": "1",
|
||||
"aggregation_bits": "0x01",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
]`
|
||||
singleAggregate = `[
|
||||
{
|
||||
"message": {
|
||||
"aggregator_index": "1",
|
||||
"aggregate": {
|
||||
"aggregation_bits": "0x01",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
]`
|
||||
multipleAggregates = `[
|
||||
{
|
||||
"message": {
|
||||
"aggregator_index": "1",
|
||||
"aggregate": {
|
||||
"aggregation_bits": "0x01",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
{
|
||||
"message": {
|
||||
"aggregator_index": "1",
|
||||
"aggregate": {
|
||||
"aggregation_bits": "0x01",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
]
|
||||
`
|
||||
// aggregator_index is invalid
|
||||
invalidAggregate = `[
|
||||
{
|
||||
"message": {
|
||||
"aggregator_index": "foo",
|
||||
"aggregate": {
|
||||
"aggregation_bits": "0x01",
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505",
|
||||
"data": {
|
||||
"slot": "1",
|
||||
"index": "1",
|
||||
"beacon_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
|
||||
"source": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
},
|
||||
"target": {
|
||||
"epoch": "1",
|
||||
"root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"selection_proof": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
},
|
||||
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
|
||||
}
|
||||
]`
|
||||
)
|
||||
@@ -4,10 +4,12 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/builder"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/cache"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/db"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/attestations"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/synccommittee"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/lookup"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/sync"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -30,4 +32,6 @@ type Server struct {
|
||||
ChainInfoFetcher blockchain.ChainInfoFetcher
|
||||
BeaconDB db.HeadAccessDatabase
|
||||
BlockBuilder builder.BlockBuilder
|
||||
OperationNotifier operation.Notifier
|
||||
CoreService *core.Service
|
||||
}
|
||||
|
||||
15
beacon-chain/rpc/eth/validator/structs.go
Normal file
15
beacon-chain/rpc/eth/validator/structs.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package validator
|
||||
|
||||
import "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
|
||||
type AggregateAttestationResponse struct {
|
||||
Data *shared.Attestation `json:"data" validate:"required"`
|
||||
}
|
||||
|
||||
type SubmitContributionAndProofsRequest struct {
|
||||
Data []*shared.SignedContributionAndProof `json:"data" validate:"required"`
|
||||
}
|
||||
|
||||
type SubmitAggregateAndProofsRequest struct {
|
||||
Data []*shared.SignedAggregateAttestationAndProof `json:"data" validate:"required"`
|
||||
}
|
||||
@@ -803,88 +803,6 @@ func (vs *Server) ProduceAttestationData(ctx context.Context, req *ethpbv1.Produ
|
||||
return ðpbv1.ProduceAttestationDataResponse{Data: attData}, nil
|
||||
}
|
||||
|
||||
// GetAggregateAttestation aggregates all attestations matching the given attestation data root and slot, returning the aggregated result.
|
||||
func (vs *Server) GetAggregateAttestation(ctx context.Context, req *ethpbv1.AggregateAttestationRequest) (*ethpbv1.AggregateAttestationResponse, error) {
|
||||
_, span := trace.StartSpan(ctx, "validator.GetAggregateAttestation")
|
||||
defer span.End()
|
||||
|
||||
if err := vs.AttestationsPool.AggregateUnaggregatedAttestations(ctx); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not aggregate unaggregated attestations: %v", err)
|
||||
}
|
||||
|
||||
allAtts := vs.AttestationsPool.AggregatedAttestations()
|
||||
var bestMatchingAtt *ethpbalpha.Attestation
|
||||
for _, att := range allAtts {
|
||||
if att.Data.Slot == req.Slot {
|
||||
root, err := att.Data.HashTreeRoot()
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get attestation data root: %v", err)
|
||||
}
|
||||
if bytes.Equal(root[:], req.AttestationDataRoot) {
|
||||
if bestMatchingAtt == nil || len(att.AggregationBits) > len(bestMatchingAtt.AggregationBits) {
|
||||
bestMatchingAtt = att
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if bestMatchingAtt == nil {
|
||||
return nil, status.Error(codes.NotFound, "No matching attestation found")
|
||||
}
|
||||
return ðpbv1.AggregateAttestationResponse{
|
||||
Data: migration.V1Alpha1AttestationToV1(bestMatchingAtt),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SubmitAggregateAndProofs verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
|
||||
func (vs *Server) SubmitAggregateAndProofs(ctx context.Context, req *ethpbv1.SubmitAggregateAndProofsRequest) (*empty.Empty, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "validator.SubmitAggregateAndProofs")
|
||||
defer span.End()
|
||||
|
||||
for _, agg := range req.Data {
|
||||
if agg == nil || agg.Message == nil || agg.Message.Aggregate == nil || agg.Message.Aggregate.Data == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Signed aggregate request can't be nil")
|
||||
}
|
||||
sigLen := fieldparams.BLSSignatureLength
|
||||
emptySig := make([]byte, sigLen)
|
||||
if bytes.Equal(agg.Signature, emptySig) || bytes.Equal(agg.Message.SelectionProof, emptySig) || bytes.Equal(agg.Message.Aggregate.Signature, emptySig) {
|
||||
return nil, status.Error(codes.InvalidArgument, "Signed signatures can't be zero hashes")
|
||||
}
|
||||
if len(agg.Signature) != sigLen || len(agg.Message.Aggregate.Signature) != sigLen {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "Incorrect signature length. Expected %d bytes", sigLen)
|
||||
}
|
||||
|
||||
// As a preventive measure, a beacon node shouldn't broadcast an attestation whose slot is out of range.
|
||||
if err := helpers.ValidateAttestationTime(agg.Message.Aggregate.Data.Slot,
|
||||
vs.TimeFetcher.GenesisTime(), params.BeaconNetworkConfig().MaximumGossipClockDisparity); err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Attestation slot is no longer valid from current time")
|
||||
}
|
||||
}
|
||||
|
||||
broadcastFailed := false
|
||||
for _, agg := range req.Data {
|
||||
v1alpha1Agg := migration.V1SignedAggregateAttAndProofToV1Alpha1(agg)
|
||||
if err := vs.Broadcaster.Broadcast(ctx, v1alpha1Agg); err != nil {
|
||||
broadcastFailed = true
|
||||
} else {
|
||||
log.WithFields(log.Fields{
|
||||
"slot": agg.Message.Aggregate.Data.Slot,
|
||||
"committeeIndex": agg.Message.Aggregate.Data.Index,
|
||||
"validatorIndex": agg.Message.AggregatorIndex,
|
||||
"aggregatedCount": agg.Message.Aggregate.AggregationBits.Count(),
|
||||
}).Debug("Broadcasting aggregated attestation and proof")
|
||||
}
|
||||
}
|
||||
|
||||
if broadcastFailed {
|
||||
return nil, status.Errorf(
|
||||
codes.Internal,
|
||||
"Could not broadcast one or more signed aggregated attestations")
|
||||
}
|
||||
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// SubmitBeaconCommitteeSubscription searches using discv5 for peers related to the provided subnet information
|
||||
// and replaces current peers with those ones if necessary.
|
||||
func (vs *Server) SubmitBeaconCommitteeSubscription(ctx context.Context, req *ethpbv1.SubmitBeaconCommitteeSubscriptionsRequest) (*emptypb.Empty, error) {
|
||||
@@ -1076,36 +994,6 @@ func (vs *Server) ProduceSyncCommitteeContribution(
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SubmitContributionAndProofs publishes multiple signed sync committee contribution and proofs.
|
||||
func (vs *Server) SubmitContributionAndProofs(ctx context.Context, req *ethpbv2.SubmitContributionAndProofsRequest) (*empty.Empty, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "validator.SubmitContributionAndProofs")
|
||||
defer span.End()
|
||||
|
||||
for _, item := range req.Data {
|
||||
v1alpha1Req := ðpbalpha.SignedContributionAndProof{
|
||||
Message: ðpbalpha.ContributionAndProof{
|
||||
AggregatorIndex: item.Message.AggregatorIndex,
|
||||
Contribution: ðpbalpha.SyncCommitteeContribution{
|
||||
Slot: item.Message.Contribution.Slot,
|
||||
BlockRoot: item.Message.Contribution.BeaconBlockRoot,
|
||||
SubcommitteeIndex: item.Message.Contribution.SubcommitteeIndex,
|
||||
AggregationBits: item.Message.Contribution.AggregationBits,
|
||||
Signature: item.Message.Contribution.Signature,
|
||||
},
|
||||
SelectionProof: item.Message.SelectionProof,
|
||||
},
|
||||
Signature: item.Signature,
|
||||
}
|
||||
_, err := vs.V1Alpha1Server.SubmitSignedContributionAndProof(ctx, v1alpha1Req)
|
||||
// We simply return err because it's already of a gRPC error type.
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &empty.Empty{}, nil
|
||||
}
|
||||
|
||||
// GetLiveness requests the beacon node to indicate if a validator has been observed to be live in a given epoch.
|
||||
// The beacon node might detect liveness by observing messages from the validator on the network,
|
||||
// in the beacon chain, from its API or from any other source.
|
||||
|
||||
@@ -3,19 +3,16 @@ package validator
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
mockChain "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing"
|
||||
builderTest "github.com/prysmaticlabs/prysm/v4/beacon-chain/builder/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/cache"
|
||||
"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/attestations"
|
||||
"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"
|
||||
@@ -1306,200 +1303,6 @@ func TestProduceAttestationData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAggregateAttestation(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
root1 := bytesutil.PadTo([]byte("root1"), 32)
|
||||
sig1 := bytesutil.PadTo([]byte("sig1"), fieldparams.BLSSignatureLength)
|
||||
attSlot1 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{0, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
BeaconBlockRoot: root1,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root1,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root1,
|
||||
},
|
||||
},
|
||||
Signature: sig1,
|
||||
}
|
||||
root21 := bytesutil.PadTo([]byte("root2_1"), 32)
|
||||
sig21 := bytesutil.PadTo([]byte("sig2_1"), fieldparams.BLSSignatureLength)
|
||||
attslot21 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{0, 1, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 2,
|
||||
CommitteeIndex: 2,
|
||||
BeaconBlockRoot: root21,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root21,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root21,
|
||||
},
|
||||
},
|
||||
Signature: sig21,
|
||||
}
|
||||
root22 := bytesutil.PadTo([]byte("root2_2"), 32)
|
||||
sig22 := bytesutil.PadTo([]byte("sig2_2"), fieldparams.BLSSignatureLength)
|
||||
attslot22 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{0, 1, 1, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 2,
|
||||
CommitteeIndex: 3,
|
||||
BeaconBlockRoot: root22,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root22,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root22,
|
||||
},
|
||||
},
|
||||
Signature: sig22,
|
||||
}
|
||||
root33 := bytesutil.PadTo([]byte("root3_3"), 32)
|
||||
sig33 := bls.NewAggregateSignature().Marshal()
|
||||
|
||||
attslot33 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{1, 0, 0, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 2,
|
||||
CommitteeIndex: 3,
|
||||
BeaconBlockRoot: root33,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root33,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root33,
|
||||
},
|
||||
},
|
||||
Signature: sig33,
|
||||
}
|
||||
pool := attestations.NewPool()
|
||||
err := pool.SaveAggregatedAttestations([]*ethpbalpha.Attestation{attSlot1, attslot21, attslot22})
|
||||
assert.NoError(t, err)
|
||||
vs := &Server{
|
||||
AttestationsPool: pool,
|
||||
}
|
||||
|
||||
t.Run("OK", func(t *testing.T) {
|
||||
reqRoot, err := attslot22.Data.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
req := ðpbv1.AggregateAttestationRequest{
|
||||
AttestationDataRoot: reqRoot[:],
|
||||
Slot: 2,
|
||||
}
|
||||
att, err := vs.GetAggregateAttestation(ctx, req)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, att)
|
||||
require.NotNil(t, att.Data)
|
||||
assert.DeepEqual(t, bitfield.Bitlist{0, 1, 1, 1}, att.Data.AggregationBits)
|
||||
assert.DeepEqual(t, sig22, att.Data.Signature)
|
||||
assert.Equal(t, primitives.Slot(2), att.Data.Data.Slot)
|
||||
assert.Equal(t, primitives.CommitteeIndex(3), att.Data.Data.Index)
|
||||
assert.DeepEqual(t, root22, att.Data.Data.BeaconBlockRoot)
|
||||
require.NotNil(t, att.Data.Data.Source)
|
||||
assert.Equal(t, primitives.Epoch(1), att.Data.Data.Source.Epoch)
|
||||
assert.DeepEqual(t, root22, att.Data.Data.Source.Root)
|
||||
require.NotNil(t, att.Data.Data.Target)
|
||||
assert.Equal(t, primitives.Epoch(1), att.Data.Data.Target.Epoch)
|
||||
assert.DeepEqual(t, root22, att.Data.Data.Target.Root)
|
||||
})
|
||||
|
||||
t.Run("Aggregate Beforehand", func(t *testing.T) {
|
||||
reqRoot, err := attslot33.Data.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
err = vs.AttestationsPool.SaveUnaggregatedAttestation(attslot33)
|
||||
require.NoError(t, err)
|
||||
newAtt := ethpbalpha.CopyAttestation(attslot33)
|
||||
newAtt.AggregationBits = []byte{0, 1, 0, 1}
|
||||
err = vs.AttestationsPool.SaveUnaggregatedAttestation(newAtt)
|
||||
require.NoError(t, err)
|
||||
req := ðpbv1.AggregateAttestationRequest{
|
||||
AttestationDataRoot: reqRoot[:],
|
||||
Slot: 2,
|
||||
}
|
||||
aggAtt, err := vs.GetAggregateAttestation(ctx, req)
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, bitfield.Bitlist{1, 1, 0, 1}, aggAtt.Data.AggregationBits)
|
||||
})
|
||||
t.Run("No matching attestation", func(t *testing.T) {
|
||||
req := ðpbv1.AggregateAttestationRequest{
|
||||
AttestationDataRoot: bytesutil.PadTo([]byte("foo"), 32),
|
||||
Slot: 2,
|
||||
}
|
||||
_, err := vs.GetAggregateAttestation(ctx, req)
|
||||
assert.ErrorContains(t, "No matching attestation found", err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetAggregateAttestation_SameSlotAndRoot_ReturnMostAggregationBits(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
root := bytesutil.PadTo([]byte("root"), 32)
|
||||
sig := bytesutil.PadTo([]byte("sig"), fieldparams.BLSSignatureLength)
|
||||
att1 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{3, 0, 0, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
BeaconBlockRoot: root,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
},
|
||||
Signature: sig,
|
||||
}
|
||||
att2 := ðpbalpha.Attestation{
|
||||
AggregationBits: []byte{0, 3, 0, 1},
|
||||
Data: ðpbalpha.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
BeaconBlockRoot: root,
|
||||
Source: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
Target: ðpbalpha.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
},
|
||||
Signature: sig,
|
||||
}
|
||||
pool := attestations.NewPool()
|
||||
err := pool.SaveAggregatedAttestations([]*ethpbalpha.Attestation{att1, att2})
|
||||
assert.NoError(t, err)
|
||||
vs := &Server{
|
||||
AttestationsPool: pool,
|
||||
}
|
||||
reqRoot, err := att1.Data.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
req := ðpbv1.AggregateAttestationRequest{
|
||||
AttestationDataRoot: reqRoot[:],
|
||||
Slot: 1,
|
||||
}
|
||||
att, err := vs.GetAggregateAttestation(ctx, req)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, att)
|
||||
require.NotNil(t, att.Data)
|
||||
assert.DeepEqual(t, bitfield.Bitlist{3, 0, 0, 1}, att.Data.AggregationBits)
|
||||
}
|
||||
|
||||
func TestSubmitBeaconCommitteeSubscription(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
genesis := util.NewBeaconBlock()
|
||||
@@ -1806,286 +1609,6 @@ func TestSubmitSyncCommitteeSubscription_SyncNotReady(t *testing.T) {
|
||||
assert.ErrorContains(t, "Syncing to latest head, not ready to respond", err)
|
||||
}
|
||||
|
||||
func TestSubmitAggregateAndProofs(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
params.SetupTestConfigCleanup(t)
|
||||
c := params.BeaconNetworkConfig()
|
||||
c.MaximumGossipClockDisparity = time.Hour
|
||||
params.OverrideBeaconNetworkConfig(c)
|
||||
root := bytesutil.PadTo([]byte("root"), 32)
|
||||
sig := bytesutil.PadTo([]byte("sig"), fieldparams.BLSSignatureLength)
|
||||
proof := bytesutil.PadTo([]byte("proof"), fieldparams.BLSSignatureLength)
|
||||
att := ðpbv1.Attestation{
|
||||
AggregationBits: []byte{0, 1},
|
||||
Data: ðpbv1.AttestationData{
|
||||
Slot: 1,
|
||||
Index: 1,
|
||||
BeaconBlockRoot: root,
|
||||
Source: ðpbv1.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
Target: ðpbv1.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
},
|
||||
Signature: sig,
|
||||
}
|
||||
|
||||
t.Run("OK", func(t *testing.T) {
|
||||
chainSlot := primitives.Slot(0)
|
||||
chain := &mockChain.ChainService{
|
||||
Genesis: time.Now(), Slot: &chainSlot,
|
||||
}
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
vs := Server{
|
||||
TimeFetcher: chain,
|
||||
Broadcaster: broadcaster,
|
||||
}
|
||||
|
||||
req := ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: ðpbv1.AggregateAttestationAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Aggregate: att,
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, true, broadcaster.BroadcastCalled)
|
||||
})
|
||||
|
||||
t.Run("nil aggregate", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
vs := Server{
|
||||
Broadcaster: broadcaster,
|
||||
}
|
||||
|
||||
req := ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
nil,
|
||||
},
|
||||
}
|
||||
_, err := vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Signed aggregate request can't be nil", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
|
||||
req = ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: nil,
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err = vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Signed aggregate request can't be nil", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
|
||||
req = ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: ðpbv1.AggregateAttestationAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Aggregate: ðpbv1.Attestation{
|
||||
AggregationBits: []byte{0, 1},
|
||||
Data: nil,
|
||||
Signature: sig,
|
||||
},
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err = vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Signed aggregate request can't be nil", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
})
|
||||
|
||||
t.Run("zero signature", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
vs := Server{
|
||||
Broadcaster: broadcaster,
|
||||
}
|
||||
req := ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: ðpbv1.AggregateAttestationAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Aggregate: att,
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: make([]byte, 96),
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err := vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Signed signatures can't be zero hashes", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
})
|
||||
|
||||
t.Run("zero proof", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
vs := Server{
|
||||
Broadcaster: broadcaster,
|
||||
}
|
||||
req := ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: ðpbv1.AggregateAttestationAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Aggregate: att,
|
||||
SelectionProof: make([]byte, 96),
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err := vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Signed signatures can't be zero hashes", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
})
|
||||
|
||||
t.Run("zero message signature", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
vs := Server{
|
||||
Broadcaster: broadcaster,
|
||||
}
|
||||
req := ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: ðpbv1.AggregateAttestationAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Aggregate: ðpbv1.Attestation{
|
||||
AggregationBits: []byte{0, 1},
|
||||
Data: ðpbv1.AttestationData{
|
||||
Slot: 1,
|
||||
Index: 1,
|
||||
BeaconBlockRoot: root,
|
||||
Source: ðpbv1.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
Target: ðpbv1.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
},
|
||||
Signature: make([]byte, 96),
|
||||
},
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err := vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Signed signatures can't be zero hashes", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
})
|
||||
|
||||
t.Run("wrong signature length", func(t *testing.T) {
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
vs := Server{
|
||||
Broadcaster: broadcaster,
|
||||
}
|
||||
|
||||
req := ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: ðpbv1.AggregateAttestationAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Aggregate: att,
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: make([]byte, 99),
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err := vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Incorrect signature length. Expected "+strconv.Itoa(96)+" bytes", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
|
||||
req = ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: ðpbv1.AggregateAttestationAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Aggregate: ðpbv1.Attestation{
|
||||
AggregationBits: []byte{0, 1},
|
||||
Data: ðpbv1.AttestationData{
|
||||
Slot: 1,
|
||||
Index: 1,
|
||||
BeaconBlockRoot: root,
|
||||
Source: ðpbv1.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
Target: ðpbv1.Checkpoint{
|
||||
Epoch: 1,
|
||||
Root: root,
|
||||
},
|
||||
},
|
||||
Signature: make([]byte, 99),
|
||||
},
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err = vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Incorrect signature length. Expected "+strconv.Itoa(96)+" bytes", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
})
|
||||
|
||||
t.Run("invalid attestation time", func(t *testing.T) {
|
||||
chainSlot := primitives.Slot(0)
|
||||
chain := &mockChain.ChainService{
|
||||
Genesis: time.Now().Add(time.Hour * 2), Slot: &chainSlot,
|
||||
}
|
||||
broadcaster := &p2pmock.MockBroadcaster{}
|
||||
vs := Server{
|
||||
TimeFetcher: chain,
|
||||
Broadcaster: broadcaster,
|
||||
}
|
||||
|
||||
req := ðpbv1.SubmitAggregateAndProofsRequest{
|
||||
Data: []*ethpbv1.SignedAggregateAttestationAndProof{
|
||||
{
|
||||
Message: ðpbv1.AggregateAttestationAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Aggregate: att,
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := vs.SubmitAggregateAndProofs(ctx, req)
|
||||
require.NotNil(t, err)
|
||||
assert.ErrorContains(t, "Attestation slot is no longer valid from current time", err)
|
||||
assert.Equal(t, false, broadcaster.BroadcastCalled)
|
||||
})
|
||||
}
|
||||
|
||||
func TestProduceSyncCommitteeContribution(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
root := bytesutil.PadTo([]byte("root"), 32)
|
||||
@@ -2143,120 +1666,6 @@ func TestProduceSyncCommitteeContribution(t *testing.T) {
|
||||
assert.ErrorContains(t, "No subcommittee messages found", err)
|
||||
}
|
||||
|
||||
func TestSubmitContributionAndProofs(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
sig := bls.NewAggregateSignature().Marshal()
|
||||
root := bytesutil.PadTo([]byte("root"), 32)
|
||||
proof := bytesutil.PadTo([]byte("proof"), 96)
|
||||
aggBits := bitfield.NewBitvector128()
|
||||
aggBits.SetBitAt(0, true)
|
||||
v1Server := &v1alpha1validator.Server{
|
||||
P2P: &p2pmock.MockBroadcaster{},
|
||||
OperationNotifier: (&mockChain.ChainService{}).OperationNotifier(),
|
||||
}
|
||||
server := &Server{
|
||||
V1Alpha1Server: v1Server,
|
||||
}
|
||||
|
||||
t.Run("Single contribution", func(t *testing.T) {
|
||||
v1Server.SyncCommitteePool = synccommittee.NewStore()
|
||||
req := ðpbv2.SubmitContributionAndProofsRequest{
|
||||
Data: []*ethpbv2.SignedContributionAndProof{
|
||||
{
|
||||
Message: ðpbv2.ContributionAndProof{
|
||||
AggregatorIndex: 0,
|
||||
Contribution: ðpbv2.SyncCommitteeContribution{
|
||||
Slot: 0,
|
||||
BeaconBlockRoot: root,
|
||||
SubcommitteeIndex: 0,
|
||||
AggregationBits: aggBits,
|
||||
Signature: sig,
|
||||
},
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := server.SubmitContributionAndProofs(ctx, req)
|
||||
require.NoError(t, err)
|
||||
savedMsgs, err := v1Server.SyncCommitteePool.SyncCommitteeContributions(0)
|
||||
require.NoError(t, err)
|
||||
expectedContribution := ðpbalpha.SyncCommitteeContribution{
|
||||
Slot: req.Data[0].Message.Contribution.Slot,
|
||||
BlockRoot: req.Data[0].Message.Contribution.BeaconBlockRoot,
|
||||
SubcommitteeIndex: req.Data[0].Message.Contribution.SubcommitteeIndex,
|
||||
AggregationBits: req.Data[0].Message.Contribution.AggregationBits,
|
||||
Signature: req.Data[0].Message.Contribution.Signature,
|
||||
}
|
||||
require.DeepEqual(t, []*ethpbalpha.SyncCommitteeContribution{expectedContribution}, savedMsgs)
|
||||
})
|
||||
|
||||
t.Run("Multiple contributions", func(t *testing.T) {
|
||||
v1Server.SyncCommitteePool = synccommittee.NewStore()
|
||||
req := ðpbv2.SubmitContributionAndProofsRequest{
|
||||
Data: []*ethpbv2.SignedContributionAndProof{
|
||||
{
|
||||
Message: ðpbv2.ContributionAndProof{
|
||||
AggregatorIndex: 0,
|
||||
Contribution: ðpbv2.SyncCommitteeContribution{
|
||||
Slot: 0,
|
||||
BeaconBlockRoot: root,
|
||||
SubcommitteeIndex: 0,
|
||||
AggregationBits: aggBits,
|
||||
Signature: sig,
|
||||
},
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
{
|
||||
Message: ðpbv2.ContributionAndProof{
|
||||
AggregatorIndex: 1,
|
||||
Contribution: ðpbv2.SyncCommitteeContribution{
|
||||
Slot: 1,
|
||||
BeaconBlockRoot: root,
|
||||
SubcommitteeIndex: 1,
|
||||
AggregationBits: aggBits,
|
||||
Signature: sig,
|
||||
},
|
||||
SelectionProof: proof,
|
||||
},
|
||||
Signature: sig,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := server.SubmitContributionAndProofs(ctx, req)
|
||||
require.NoError(t, err)
|
||||
savedMsgs, err := v1Server.SyncCommitteePool.SyncCommitteeContributions(0)
|
||||
require.NoError(t, err)
|
||||
expectedContributions := []*ethpbalpha.SyncCommitteeContribution{
|
||||
{
|
||||
Slot: req.Data[0].Message.Contribution.Slot,
|
||||
BlockRoot: req.Data[0].Message.Contribution.BeaconBlockRoot,
|
||||
SubcommitteeIndex: req.Data[0].Message.Contribution.SubcommitteeIndex,
|
||||
AggregationBits: req.Data[0].Message.Contribution.AggregationBits,
|
||||
Signature: req.Data[0].Message.Contribution.Signature,
|
||||
},
|
||||
}
|
||||
require.DeepEqual(t, expectedContributions, savedMsgs)
|
||||
savedMsgs, err = v1Server.SyncCommitteePool.SyncCommitteeContributions(1)
|
||||
require.NoError(t, err)
|
||||
expectedContributions = []*ethpbalpha.SyncCommitteeContribution{
|
||||
{
|
||||
Slot: req.Data[1].Message.Contribution.Slot,
|
||||
BlockRoot: req.Data[1].Message.Contribution.BeaconBlockRoot,
|
||||
SubcommitteeIndex: req.Data[1].Message.Contribution.SubcommitteeIndex,
|
||||
AggregationBits: req.Data[1].Message.Contribution.AggregationBits,
|
||||
Signature: req.Data[1].Message.Contribution.Signature,
|
||||
},
|
||||
}
|
||||
require.DeepEqual(t, expectedContributions, savedMsgs)
|
||||
})
|
||||
}
|
||||
|
||||
func TestPrepareBeaconProposer(t *testing.T) {
|
||||
type args struct {
|
||||
request *ethpbv1.PrepareBeaconProposerRequest
|
||||
|
||||
@@ -17,7 +17,7 @@ go_library(
|
||||
"//beacon-chain/p2p/peers:go_default_library",
|
||||
"//beacon-chain/p2p/peers/peerdata:go_default_library",
|
||||
"//beacon-chain/sync:go_default_library",
|
||||
"//network:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p//core/network:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p//core/peer:go_default_library",
|
||||
@@ -36,7 +36,7 @@ go_test(
|
||||
"//beacon-chain/p2p:go_default_library",
|
||||
"//beacon-chain/p2p/peers:go_default_library",
|
||||
"//beacon-chain/p2p/testing:go_default_library",
|
||||
"//network:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//testing/assert:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//p2p/enode:go_default_library",
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/peers"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/peers/peerdata"
|
||||
"github.com/prysmaticlabs/prysm/v4/network"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
@@ -24,11 +24,11 @@ func (s *Server) ListTrustedPeer(w http.ResponseWriter, r *http.Request) {
|
||||
for _, id := range allIds {
|
||||
p, err := httpPeerInfo(peerStatus, id)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: errors.Wrapf(err, "Could not get peer info").Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
// peers added into trusted set but never connected should also be listed
|
||||
@@ -44,37 +44,37 @@ func (s *Server) ListTrustedPeer(w http.ResponseWriter, r *http.Request) {
|
||||
allPeers = append(allPeers, p)
|
||||
}
|
||||
response := &PeersResponse{Peers: allPeers}
|
||||
network.WriteJson(w, response)
|
||||
http2.WriteJson(w, response)
|
||||
}
|
||||
|
||||
// AddTrustedPeer adds a new peer into node's trusted peer set by Multiaddr
|
||||
func (s *Server) AddTrustedPeer(w http.ResponseWriter, r *http.Request) {
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: errors.Wrapf(err, "Could not read request body").Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
var addrRequest *AddrRequest
|
||||
err = json.Unmarshal(body, &addrRequest)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: errors.Wrapf(err, "Could not decode request body into peer address").Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
info, err := peer.AddrInfoFromString(addrRequest.Addr)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: errors.Wrapf(err, "Could not derive peer info from multiaddress").Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ func (s *Server) RemoveTrustedPeer(w http.ResponseWriter, r *http.Request) {
|
||||
id := segments[len(segments)-1]
|
||||
peerId, err := peer.Decode(id)
|
||||
if err != nil {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: errors.Wrapf(err, "Could not decode peer id").Error(),
|
||||
Code: http.StatusBadRequest,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/peers"
|
||||
mockp2p "github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/network"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
)
|
||||
@@ -188,7 +188,7 @@ func TestAddTrustedPeer_EmptyBody(t *testing.T) {
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
s.AddTrustedPeer(writer, request)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
assert.Equal(t, "Could not decode request body into peer address: unexpected end of JSON input", e.Message)
|
||||
@@ -213,7 +213,7 @@ func TestAddTrustedPeer_BadAddress(t *testing.T) {
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
s.AddTrustedPeer(writer, request)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
assert.StringContains(t, "Could not derive peer info from multiaddress", e.Message)
|
||||
@@ -243,7 +243,7 @@ func TestRemoveTrustedPeer_EmptyParameter(t *testing.T) {
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
s.RemoveTrustedPeer(writer, request)
|
||||
e := &network.DefaultErrorJson{}
|
||||
e := &http2.DefaultErrorJson{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
assert.Equal(t, "Could not decode peer id: failed to parse peer ID: invalid cid: cid too short", e.Message)
|
||||
|
||||
@@ -103,6 +103,7 @@ go_test(
|
||||
"//beacon-chain/operations/attestations:go_default_library",
|
||||
"//beacon-chain/operations/slashings:go_default_library",
|
||||
"//beacon-chain/p2p/testing:go_default_library",
|
||||
"//beacon-chain/rpc/core:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//beacon-chain/state/stategen:go_default_library",
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/attestations"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/slashings"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/stategen"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/sync"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -47,4 +48,5 @@ type Server struct {
|
||||
SyncChecker sync.Checker
|
||||
ReplayerBuilder stategen.ReplayerBuilder
|
||||
OptimisticModeFetcher blockchain.OptimisticModeFetcher
|
||||
CoreService *core.Service
|
||||
}
|
||||
|
||||
@@ -659,11 +659,7 @@ func (bs *Server) GetValidatorQueue(
|
||||
func (bs *Server) GetValidatorPerformance(
|
||||
ctx context.Context, req *ethpb.ValidatorPerformanceRequest,
|
||||
) (*ethpb.ValidatorPerformanceResponse, error) {
|
||||
if bs.SyncChecker.Syncing() {
|
||||
return nil, status.Error(codes.Unavailable, "Syncing to latest head, not ready to respond")
|
||||
}
|
||||
currSlot := bs.GenesisTimeFetcher.CurrentSlot()
|
||||
response, err := core.ComputeValidatorPerformance(ctx, req, bs.HeadFetcher, currSlot)
|
||||
response, err := bs.CoreService.ComputeValidatorPerformance(ctx, req)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(core.ErrorReasonToGRPC(err.Reason), "Could not compute validator performance: %v", err.Err)
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/db"
|
||||
dbTest "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/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
||||
state_native "github.com/prysmaticlabs/prysm/v4/beacon-chain/state/state-native"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/stategen"
|
||||
@@ -1797,7 +1798,9 @@ func TestGetValidatorPerformance_Syncing(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
bs := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: true},
|
||||
CoreService: &core.Service{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: true},
|
||||
},
|
||||
}
|
||||
|
||||
wanted := "Syncing to latest head, not ready to respond"
|
||||
@@ -1857,11 +1860,13 @@ func TestGetValidatorPerformance_OK(t *testing.T) {
|
||||
require.NoError(t, headState.SetBalances([]uint64{100, 101, 102}))
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
bs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
}
|
||||
want := ðpb.ValidatorPerformanceResponse{
|
||||
PublicKeys: [][]byte{publicKey2[:], publicKey3[:]},
|
||||
@@ -1918,12 +1923,14 @@ func TestGetValidatorPerformance_Indices(t *testing.T) {
|
||||
require.NoError(t, headState.SetValidators(validators))
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
bs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
// 10 epochs into the future.
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
// 10 epochs into the future.
|
||||
State: headState,
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
}
|
||||
c := headState.Copy()
|
||||
vp, bp, err := precompute.New(ctx, c)
|
||||
@@ -1988,12 +1995,14 @@ func TestGetValidatorPerformance_IndicesPubkeys(t *testing.T) {
|
||||
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
bs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
// 10 epochs into the future.
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
// 10 epochs into the future.
|
||||
State: headState,
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
}
|
||||
c := headState.Copy()
|
||||
vp, bp, err := precompute.New(ctx, c)
|
||||
@@ -2064,11 +2073,13 @@ func TestGetValidatorPerformanceAltair_OK(t *testing.T) {
|
||||
require.NoError(t, headState.SetBalances([]uint64{100, 101, 102}))
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
bs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
}
|
||||
want := ðpb.ValidatorPerformanceResponse{
|
||||
PublicKeys: [][]byte{publicKey2[:], publicKey3[:]},
|
||||
@@ -2132,11 +2143,13 @@ func TestGetValidatorPerformanceBellatrix_OK(t *testing.T) {
|
||||
require.NoError(t, headState.SetBalances([]uint64{100, 101, 102}))
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
bs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
}
|
||||
want := ðpb.ValidatorPerformanceResponse{
|
||||
PublicKeys: [][]byte{publicKey2[:], publicKey3[:]},
|
||||
@@ -2200,11 +2213,13 @@ func TestGetValidatorPerformanceCapella_OK(t *testing.T) {
|
||||
require.NoError(t, headState.SetBalances([]uint64{100, 101, 102}))
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
bs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
}
|
||||
want := ðpb.ValidatorPerformanceResponse{
|
||||
PublicKeys: [][]byte{publicKey2[:], publicKey3[:]},
|
||||
|
||||
@@ -56,6 +56,7 @@ go_library(
|
||||
"//beacon-chain/operations/synccommittee:go_default_library",
|
||||
"//beacon-chain/operations/voluntaryexits:go_default_library",
|
||||
"//beacon-chain/p2p:go_default_library",
|
||||
"//beacon-chain/rpc/core:go_default_library",
|
||||
"//beacon-chain/startup:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/state/stategen:go_default_library",
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package validator
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@@ -115,32 +113,8 @@ func (vs *Server) SubmitSignedAggregateSelectionProof(
|
||||
ctx context.Context,
|
||||
req *ethpb.SignedAggregateSubmitRequest,
|
||||
) (*ethpb.SignedAggregateSubmitResponse, error) {
|
||||
if req.SignedAggregateAndProof == nil || req.SignedAggregateAndProof.Message == nil ||
|
||||
req.SignedAggregateAndProof.Message.Aggregate == nil || req.SignedAggregateAndProof.Message.Aggregate.Data == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Signed aggregate request can't be nil")
|
||||
if err := vs.CoreService.SubmitSignedAggregateSelectionProof(ctx, req); err != nil {
|
||||
return nil, status.Errorf(core.ErrorReasonToGRPC(err.Reason), "Could not submit aggregate: %v", err.Err)
|
||||
}
|
||||
emptySig := make([]byte, fieldparams.BLSSignatureLength)
|
||||
if bytes.Equal(req.SignedAggregateAndProof.Signature, emptySig) ||
|
||||
bytes.Equal(req.SignedAggregateAndProof.Message.SelectionProof, emptySig) {
|
||||
return nil, status.Error(codes.InvalidArgument, "Signed signatures can't be zero hashes")
|
||||
}
|
||||
|
||||
// As a preventive measure, a beacon node shouldn't broadcast an attestation whose slot is out of range.
|
||||
if err := helpers.ValidateAttestationTime(req.SignedAggregateAndProof.Message.Aggregate.Data.Slot,
|
||||
vs.TimeFetcher.GenesisTime(), params.BeaconNetworkConfig().MaximumGossipClockDisparity); err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Attestation slot is no longer valid from current time")
|
||||
}
|
||||
|
||||
if err := vs.P2P.Broadcast(ctx, req.SignedAggregateAndProof); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not broadcast signed aggregated attestation: %v", err)
|
||||
}
|
||||
|
||||
log.WithFields(logrus.Fields{
|
||||
"slot": req.SignedAggregateAndProof.Message.Aggregate.Data.Slot,
|
||||
"committeeIndex": req.SignedAggregateAndProof.Message.Aggregate.Data.CommitteeIndex,
|
||||
"validatorIndex": req.SignedAggregateAndProof.Message.AggregatorIndex,
|
||||
"aggregatedCount": req.SignedAggregateAndProof.Message.Aggregate.AggregationBits.Count(),
|
||||
}).Debug("Broadcasting aggregated attestation and proof")
|
||||
|
||||
return ðpb.SignedAggregateSubmitResponse{}, nil
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/signing"
|
||||
"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"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
||||
state_native "github.com/prysmaticlabs/prysm/v4/beacon-chain/state/state-native"
|
||||
mockSync "github.com/prysmaticlabs/prysm/v4/beacon-chain/sync/initial-sync/testing"
|
||||
@@ -398,7 +399,9 @@ func TestSubmitAggregateAndProof_SelectsMostBitsWhenOwnAttestationNotPresent(t *
|
||||
}
|
||||
|
||||
func TestSubmitSignedAggregateSelectionProof_ZeroHashesSignatures(t *testing.T) {
|
||||
aggregatorServer := &Server{}
|
||||
aggregatorServer := &Server{
|
||||
TimeFetcher: &mock.ChainService{Genesis: time.Now()},
|
||||
}
|
||||
req := ðpb.SignedAggregateSubmitRequest{
|
||||
SignedAggregateAndProof: ðpb.SignedAggregateAttestationAndProof{
|
||||
Signature: make([]byte, fieldparams.BLSSignatureLength),
|
||||
@@ -410,7 +413,7 @@ func TestSubmitSignedAggregateSelectionProof_ZeroHashesSignatures(t *testing.T)
|
||||
},
|
||||
}
|
||||
_, err := aggregatorServer.SubmitSignedAggregateSelectionProof(context.Background(), req)
|
||||
require.ErrorContains(t, "Signed signatures can't be zero hashes", err)
|
||||
require.ErrorContains(t, "signed signatures can't be zero hashes", err)
|
||||
|
||||
req = ðpb.SignedAggregateSubmitRequest{
|
||||
SignedAggregateAndProof: ðpb.SignedAggregateAttestationAndProof{
|
||||
@@ -424,12 +427,16 @@ func TestSubmitSignedAggregateSelectionProof_ZeroHashesSignatures(t *testing.T)
|
||||
},
|
||||
}
|
||||
_, err = aggregatorServer.SubmitSignedAggregateSelectionProof(context.Background(), req)
|
||||
require.ErrorContains(t, "Signed signatures can't be zero hashes", err)
|
||||
require.ErrorContains(t, "signed signatures can't be zero hashes", err)
|
||||
}
|
||||
|
||||
func TestSubmitSignedAggregateSelectionProof_InvalidSlot(t *testing.T) {
|
||||
c := &mock.ChainService{Genesis: time.Now()}
|
||||
aggregatorServer := &Server{TimeFetcher: c}
|
||||
aggregatorServer := &Server{
|
||||
CoreService: &core.Service{
|
||||
GenesisTimeFetcher: c,
|
||||
},
|
||||
}
|
||||
req := ðpb.SignedAggregateSubmitRequest{
|
||||
SignedAggregateAndProof: ðpb.SignedAggregateAttestationAndProof{
|
||||
Signature: []byte{'a'},
|
||||
@@ -442,5 +449,5 @@ func TestSubmitSignedAggregateSelectionProof_InvalidSlot(t *testing.T) {
|
||||
},
|
||||
}
|
||||
_, err := aggregatorServer.SubmitSignedAggregateSelectionProof(context.Background(), req)
|
||||
require.ErrorContains(t, "Attestation slot is no longer valid from current time", err)
|
||||
require.ErrorContains(t, "attestation slot is no longer valid from current time", err)
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/synccommittee"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/voluntaryexits"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/startup"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/stategen"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/sync"
|
||||
@@ -74,6 +75,7 @@ type Server struct {
|
||||
BlockBuilder builder.BlockBuilder
|
||||
BLSChangesPool blstoexec.PoolManager
|
||||
ClockWaiter startup.ClockWaiter
|
||||
CoreService *core.Service
|
||||
}
|
||||
|
||||
// WaitForActivation checks if a validator public key exists in the active validator registry of the current
|
||||
|
||||
@@ -5,8 +5,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed"
|
||||
opfeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
|
||||
@@ -121,30 +120,11 @@ func (vs *Server) GetSyncCommitteeContribution(
|
||||
func (vs *Server) SubmitSignedContributionAndProof(
|
||||
ctx context.Context, s *ethpb.SignedContributionAndProof,
|
||||
) (*emptypb.Empty, error) {
|
||||
errs, ctx := errgroup.WithContext(ctx)
|
||||
|
||||
// Broadcasting and saving contribution into the pool in parallel. As one fail should not affect another.
|
||||
errs.Go(func() error {
|
||||
return vs.P2P.Broadcast(ctx, s)
|
||||
})
|
||||
|
||||
if err := vs.SyncCommitteePool.SaveSyncCommitteeContribution(s.Message.Contribution); err != nil {
|
||||
return nil, err
|
||||
err := vs.CoreService.SubmitSignedContributionAndProof(ctx, s)
|
||||
if err != nil {
|
||||
return &emptypb.Empty{}, status.Errorf(core.ErrorReasonToGRPC(err.Reason), err.Err.Error())
|
||||
}
|
||||
|
||||
// Wait for p2p broadcast to complete and return the first error (if any)
|
||||
err := errs.Wait()
|
||||
|
||||
if err == nil {
|
||||
vs.OperationNotifier.OperationFeed().Send(&feed.Event{
|
||||
Type: opfeed.SyncCommitteeContributionReceived,
|
||||
Data: &opfeed.SyncCommitteeContributionReceivedData{
|
||||
Contribution: s,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return &emptypb.Empty{}, err
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// AggregatedSigAndAggregationBits returns the aggregated signature and aggregation bits
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/transition"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/synccommittee"
|
||||
mockp2p "github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
@@ -137,9 +138,11 @@ func TestGetSyncCommitteeContribution_FiltersDuplicates(t *testing.T) {
|
||||
|
||||
func TestSubmitSignedContributionAndProof_OK(t *testing.T) {
|
||||
server := &Server{
|
||||
SyncCommitteePool: synccommittee.NewStore(),
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
CoreService: &core.Service{
|
||||
SyncCommitteePool: synccommittee.NewStore(),
|
||||
Broadcaster: &mockp2p.MockBroadcaster{},
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
},
|
||||
}
|
||||
contribution := ðpb.SignedContributionAndProof{
|
||||
Message: ðpb.ContributionAndProof{
|
||||
@@ -151,21 +154,23 @@ func TestSubmitSignedContributionAndProof_OK(t *testing.T) {
|
||||
}
|
||||
_, err := server.SubmitSignedContributionAndProof(context.Background(), contribution)
|
||||
require.NoError(t, err)
|
||||
savedMsgs, err := server.SyncCommitteePool.SyncCommitteeContributions(1)
|
||||
savedMsgs, err := server.CoreService.SyncCommitteePool.SyncCommitteeContributions(1)
|
||||
require.NoError(t, err)
|
||||
require.DeepEqual(t, []*ethpb.SyncCommitteeContribution{contribution.Message.Contribution}, savedMsgs)
|
||||
}
|
||||
|
||||
func TestSubmitSignedContributionAndProof_Notification(t *testing.T) {
|
||||
server := &Server{
|
||||
SyncCommitteePool: synccommittee.NewStore(),
|
||||
P2P: &mockp2p.MockBroadcaster{},
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
CoreService: &core.Service{
|
||||
SyncCommitteePool: synccommittee.NewStore(),
|
||||
Broadcaster: &mockp2p.MockBroadcaster{},
|
||||
OperationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
||||
},
|
||||
}
|
||||
|
||||
// Subscribe to operation notifications.
|
||||
opChannel := make(chan *feed.Event, 1024)
|
||||
opSub := server.OperationNotifier.OperationFeed().Subscribe(opChannel)
|
||||
opSub := server.CoreService.OperationNotifier.OperationFeed().Subscribe(opChannel)
|
||||
defer opSub.Unsubscribe()
|
||||
|
||||
contribution := ðpb.SignedContributionAndProof{
|
||||
|
||||
@@ -13,7 +13,7 @@ go_library(
|
||||
"//beacon-chain/rpc/core:go_default_library",
|
||||
"//beacon-chain/sync:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//network:go_default_library",
|
||||
"//network/http:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
],
|
||||
)
|
||||
@@ -26,6 +26,7 @@ go_test(
|
||||
"//beacon-chain/blockchain/testing:go_default_library",
|
||||
"//beacon-chain/core/epoch/precompute:go_default_library",
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/rpc/core:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/sync/initial-sync/testing:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
|
||||
@@ -2,6 +2,7 @@ package validator
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/sync"
|
||||
)
|
||||
|
||||
@@ -11,4 +12,5 @@ type Server struct {
|
||||
GenesisTimeFetcher blockchain.TimeFetcher
|
||||
SyncChecker sync.Checker
|
||||
HeadFetcher blockchain.HeadFetcher
|
||||
CoreService *core.Service
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/network"
|
||||
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
@@ -29,12 +29,6 @@ type ValidatorPerformanceResponse struct {
|
||||
|
||||
// GetValidatorPerformance is an HTTP handler for GetValidatorPerformance.
|
||||
func (vs *Server) GetValidatorPerformance(w http.ResponseWriter, r *http.Request) {
|
||||
if vs.SyncChecker.Syncing() {
|
||||
handleHTTPError(w, "Syncing", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
ctx := r.Context()
|
||||
currSlot := vs.GenesisTimeFetcher.CurrentSlot()
|
||||
var req ValidatorPerformanceRequest
|
||||
if r.Body != http.NoBody {
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
@@ -42,14 +36,12 @@ func (vs *Server) GetValidatorPerformance(w http.ResponseWriter, r *http.Request
|
||||
return
|
||||
}
|
||||
}
|
||||
computed, err := core.ComputeValidatorPerformance(
|
||||
ctx,
|
||||
computed, err := vs.CoreService.ComputeValidatorPerformance(
|
||||
r.Context(),
|
||||
ðpb.ValidatorPerformanceRequest{
|
||||
PublicKeys: req.PublicKeys,
|
||||
Indices: req.Indices,
|
||||
},
|
||||
vs.HeadFetcher,
|
||||
currSlot,
|
||||
)
|
||||
if err != nil {
|
||||
handleHTTPError(w, "Could not compute validator performance: "+err.Err.Error(), core.ErrorReasonToHTTP(err.Reason))
|
||||
@@ -66,13 +58,13 @@ func (vs *Server) GetValidatorPerformance(w http.ResponseWriter, r *http.Request
|
||||
MissingValidators: computed.MissingValidators,
|
||||
InactivityScores: computed.InactivityScores, // Only populated in Altair
|
||||
}
|
||||
network.WriteJson(w, response)
|
||||
http2.WriteJson(w, response)
|
||||
}
|
||||
|
||||
func handleHTTPError(w http.ResponseWriter, message string, code int) {
|
||||
errJson := &network.DefaultErrorJson{
|
||||
errJson := &http2.DefaultErrorJson{
|
||||
Message: message,
|
||||
Code: code,
|
||||
}
|
||||
network.WriteError(w, errJson)
|
||||
http2.WriteError(w, errJson)
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
mock "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/epoch/precompute"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
||||
mockSync "github.com/prysmaticlabs/prysm/v4/beacon-chain/sync/initial-sync/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
@@ -28,12 +29,13 @@ import (
|
||||
func TestServer_GetValidatorPerformance(t *testing.T) {
|
||||
t.Run("Syncing", func(t *testing.T) {
|
||||
vs := &Server{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: true},
|
||||
CoreService: &core.Service{
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: true},
|
||||
},
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
srv := httptest.NewServer(http.HandlerFunc(vs.GetValidatorPerformance))
|
||||
req := httptest.NewRequest("POST", "/foo", &buf)
|
||||
req := httptest.NewRequest("POST", "/foo", nil)
|
||||
|
||||
client := &http.Client{}
|
||||
rawResp, err := client.Post(srv.URL, "application/json", req.Body)
|
||||
@@ -57,11 +59,13 @@ func TestServer_GetValidatorPerformance(t *testing.T) {
|
||||
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
vs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
}
|
||||
want := &ValidatorPerformanceResponse{
|
||||
PublicKeys: [][]byte{publicKeys[1][:], publicKeys[2][:]},
|
||||
@@ -111,12 +115,14 @@ func TestServer_GetValidatorPerformance(t *testing.T) {
|
||||
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
vs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
// 10 epochs into the future.
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
// 10 epochs into the future.
|
||||
State: headState,
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
}
|
||||
c := headState.Copy()
|
||||
vp, bp, err := precompute.New(ctx, c)
|
||||
@@ -174,12 +180,14 @@ func TestServer_GetValidatorPerformance(t *testing.T) {
|
||||
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
vs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
// 10 epochs into the future.
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
// 10 epochs into the future.
|
||||
State: headState,
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
}
|
||||
c := headState.Copy()
|
||||
vp, bp, err := precompute.New(ctx, c)
|
||||
@@ -243,11 +251,13 @@ func TestServer_GetValidatorPerformance(t *testing.T) {
|
||||
require.NoError(t, headState.SetBalances([]uint64{100, 101, 102}))
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
vs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
}
|
||||
want := &ValidatorPerformanceResponse{
|
||||
PublicKeys: [][]byte{publicKeys[1][:], publicKeys[2][:]},
|
||||
@@ -303,11 +313,13 @@ func TestServer_GetValidatorPerformance(t *testing.T) {
|
||||
require.NoError(t, headState.SetBalances([]uint64{100, 101, 102}))
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
vs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
}
|
||||
want := &ValidatorPerformanceResponse{
|
||||
PublicKeys: [][]byte{publicKeys[1][:], publicKeys[2][:]},
|
||||
@@ -363,11 +375,13 @@ func TestServer_GetValidatorPerformance(t *testing.T) {
|
||||
require.NoError(t, headState.SetBalances([]uint64{100, 101, 102}))
|
||||
offset := int64(headState.Slot().Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
vs := &Server{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
CoreService: &core.Service{
|
||||
HeadFetcher: &mock.ChainService{
|
||||
State: headState,
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
},
|
||||
GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)},
|
||||
SyncChecker: &mockSync.Sync{IsSyncing: false},
|
||||
}
|
||||
want := &ValidatorPerformanceResponse{
|
||||
PublicKeys: [][]byte{publicKeys[1][:], publicKeys[2][:]},
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/synccommittee"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/operations/voluntaryexits"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/core"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon"
|
||||
rpcBuilder "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/builder"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/debug"
|
||||
@@ -231,6 +232,15 @@ func (s *Service) Start() {
|
||||
}
|
||||
s.cfg.Router.HandleFunc("/eth/v1/builder/states/{state_id}/expected_withdrawals", builderServer.ExpectedWithdrawals).Methods(http.MethodGet)
|
||||
|
||||
coreService := &core.Service{
|
||||
HeadFetcher: s.cfg.HeadFetcher,
|
||||
GenesisTimeFetcher: s.cfg.GenesisTimeFetcher,
|
||||
SyncChecker: s.cfg.SyncService,
|
||||
Broadcaster: s.cfg.Broadcaster,
|
||||
SyncCommitteePool: s.cfg.SyncCommitteeObjectPool,
|
||||
OperationNotifier: s.cfg.OperationNotifier,
|
||||
}
|
||||
|
||||
validatorServer := &validatorv1alpha1.Server{
|
||||
Ctx: s.ctx,
|
||||
AttestationCache: cache.NewAttestationCache(),
|
||||
@@ -266,6 +276,7 @@ func (s *Service) Start() {
|
||||
BlockBuilder: s.cfg.BlockBuilder,
|
||||
BLSChangesPool: s.cfg.BLSChangesPool,
|
||||
ClockWaiter: s.cfg.ClockWaiter,
|
||||
CoreService: coreService,
|
||||
}
|
||||
validatorServerV1 := &validator.Server{
|
||||
HeadFetcher: s.cfg.HeadFetcher,
|
||||
@@ -282,8 +293,14 @@ func (s *Service) Start() {
|
||||
ChainInfoFetcher: s.cfg.ChainInfoFetcher,
|
||||
BeaconDB: s.cfg.BeaconDB,
|
||||
BlockBuilder: s.cfg.BlockBuilder,
|
||||
OperationNotifier: s.cfg.OperationNotifier,
|
||||
CoreService: coreService,
|
||||
}
|
||||
|
||||
s.cfg.Router.HandleFunc("/eth/v1/validator/aggregate_attestation", validatorServerV1.GetAggregateAttestation).Methods(http.MethodGet)
|
||||
s.cfg.Router.HandleFunc("/eth/v1/validator/contribution_and_proofs", validatorServerV1.SubmitContributionAndProofs).Methods(http.MethodPost)
|
||||
s.cfg.Router.HandleFunc("/eth/v1/validator/aggregate_and_proofs", validatorServerV1.SubmitAggregateAndProofs).Methods(http.MethodPost)
|
||||
|
||||
nodeServer := &nodev1alpha1.Server{
|
||||
LogsStreamer: logs.NewStreamServer(),
|
||||
StreamLogsBufferSize: 1000, // Enough to handle bursts of beacon node logs for gRPC streaming.
|
||||
@@ -349,6 +366,7 @@ func (s *Service) Start() {
|
||||
ReceivedAttestationsBuffer: make(chan *ethpbv1alpha1.Attestation, attestationBufferSize),
|
||||
CollectedAttestationsBuffer: make(chan []*ethpbv1alpha1.Attestation, attestationBufferSize),
|
||||
ReplayerBuilder: ch,
|
||||
CoreService: coreService,
|
||||
}
|
||||
beaconChainServerV1 := &beacon.Server{
|
||||
CanonicalHistory: ch,
|
||||
@@ -379,8 +397,9 @@ func (s *Service) Start() {
|
||||
GenesisTimeFetcher: s.cfg.GenesisTimeFetcher,
|
||||
HeadFetcher: s.cfg.HeadFetcher,
|
||||
SyncChecker: s.cfg.SyncService,
|
||||
CoreService: coreService,
|
||||
}
|
||||
s.cfg.Router.HandleFunc("/prysm/validators/performance", httpServer.GetValidatorPerformance).Methods(http.MethodGet)
|
||||
s.cfg.Router.HandleFunc("/prysm/validators/performance", httpServer.GetValidatorPerformance).Methods(http.MethodPost)
|
||||
s.cfg.Router.HandleFunc("/eth/v2/beacon/blocks", beaconChainServerV1.PublishBlockV2).Methods(http.MethodPost)
|
||||
s.cfg.Router.HandleFunc("/eth/v2/beacon/blinded_blocks", beaconChainServerV1.PublishBlindedBlockV2).Methods(http.MethodPost)
|
||||
ethpbv1alpha1.RegisterNodeServer(s.grpcServer, nodeServer)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
)
|
||||
|
||||
// MockBlocker is a fake implementation of lookup.Blocker.
|
||||
@@ -13,6 +14,7 @@ type MockBlocker struct {
|
||||
BlockToReturn interfaces.ReadOnlySignedBeaconBlock
|
||||
ErrorToReturn error
|
||||
SlotBlockMap map[primitives.Slot]interfaces.ReadOnlySignedBeaconBlock
|
||||
RootBlockMap map[[32]byte]interfaces.ReadOnlySignedBeaconBlock
|
||||
}
|
||||
|
||||
// Block --
|
||||
@@ -20,10 +22,13 @@ func (m *MockBlocker) Block(_ context.Context, b []byte) (interfaces.ReadOnlySig
|
||||
if m.ErrorToReturn != nil {
|
||||
return nil, m.ErrorToReturn
|
||||
}
|
||||
if m.BlockToReturn != nil {
|
||||
return m.BlockToReturn, nil
|
||||
}
|
||||
slotNumber, parseErr := strconv.ParseUint(string(b), 10, 64)
|
||||
if parseErr != nil {
|
||||
//nolint:nilerr
|
||||
return m.BlockToReturn, nil
|
||||
return m.RootBlockMap[bytesutil.ToBytes32(b)], nil
|
||||
}
|
||||
return m.SlotBlockMap[primitives.Slot(slotNumber)], nil
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
)
|
||||
|
||||
// MockStater is a fake implementation of lookup.Stater.
|
||||
@@ -12,11 +13,15 @@ type MockStater struct {
|
||||
BeaconState state.BeaconState
|
||||
BeaconStateRoot []byte
|
||||
StatesBySlot map[primitives.Slot]state.BeaconState
|
||||
StatesByRoot map[[32]byte]state.BeaconState
|
||||
}
|
||||
|
||||
// State --
|
||||
func (m *MockStater) State(context.Context, []byte) (state.BeaconState, error) {
|
||||
return m.BeaconState, nil
|
||||
func (m *MockStater) State(_ context.Context, id []byte) (state.BeaconState, error) {
|
||||
if m.BeaconState != nil {
|
||||
return m.BeaconState, nil
|
||||
}
|
||||
return m.StatesByRoot[bytesutil.ToBytes32(id)], nil
|
||||
}
|
||||
|
||||
// StateRoot --
|
||||
|
||||
@@ -23,12 +23,12 @@ var _ = state.ReadOnlyValidator(readOnlyValidator{})
|
||||
|
||||
// NewValidator initializes the read only wrapper for validator.
|
||||
func NewValidator(v *ethpb.Validator) (state.ReadOnlyValidator, error) {
|
||||
if v == nil {
|
||||
return nil, ErrNilWrappedValidator
|
||||
}
|
||||
rov := readOnlyValidator{
|
||||
validator: v,
|
||||
}
|
||||
if rov.IsNil() {
|
||||
return nil, ErrNilWrappedValidator
|
||||
}
|
||||
return rov, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ func (_ *State) replayBlocks(
|
||||
"duration": duration,
|
||||
}).Debug("Replayed state")
|
||||
|
||||
replayBlocksSummary.Observe(float64(duration.Milliseconds()))
|
||||
|
||||
return state, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,12 @@ func (s *Service) Start() {
|
||||
log.Debug("Exiting Initial Sync Service")
|
||||
return
|
||||
}
|
||||
// Exit entering round-robin sync if we require 0 peers to sync.
|
||||
if flags.Get().MinimumSyncPeers == 0 {
|
||||
s.markSynced()
|
||||
log.WithField("genesisTime", gt).Info("Due to number of peers required for sync being set at 0, entering regular sync immediately.")
|
||||
return
|
||||
}
|
||||
if gt.After(prysmTime.Now()) {
|
||||
s.markSynced()
|
||||
log.WithField("genesisTime", gt).Info("Genesis time has not arrived - not syncing")
|
||||
|
||||
@@ -31,6 +31,14 @@ func TestService_Constants(t *testing.T) {
|
||||
|
||||
func TestService_InitStartStop(t *testing.T) {
|
||||
hook := logTest.NewGlobal()
|
||||
resetFlags := flags.Get()
|
||||
flags.Init(&flags.GlobalFlags{
|
||||
MinimumSyncPeers: 1,
|
||||
})
|
||||
defer func() {
|
||||
flags.Init(resetFlags)
|
||||
}()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
assert func()
|
||||
|
||||
@@ -125,6 +125,12 @@ var (
|
||||
Help: "Time to verify gossiped blocks",
|
||||
},
|
||||
)
|
||||
blockArrivalGossipSummary = promauto.NewSummary(
|
||||
prometheus.SummaryOpts{
|
||||
Name: "gossip_block_arrival_milliseconds",
|
||||
Help: "Time for gossiped blocks to arrive",
|
||||
},
|
||||
)
|
||||
|
||||
// Sync committee verification performance.
|
||||
syncMessagesForUnknownBlocks = promauto.NewCounter(
|
||||
|
||||
@@ -200,15 +200,20 @@ func (s *Service) validateBeaconBlockPubSub(ctx context.Context, pid peer.ID, ms
|
||||
return pubsub.ValidationIgnore, err
|
||||
}
|
||||
graffiti := blk.Block().Body().Graffiti()
|
||||
|
||||
sinceSlotStartTime := receivedTime.Sub(startTime)
|
||||
validationTime := prysmTime.Now().Sub(receivedTime)
|
||||
log.WithFields(logrus.Fields{
|
||||
"blockSlot": blk.Block().Slot(),
|
||||
"sinceSlotStartTime": receivedTime.Sub(startTime),
|
||||
"validationTime": prysmTime.Now().Sub(receivedTime),
|
||||
"sinceSlotStartTime": sinceSlotStartTime,
|
||||
"validationTime": validationTime,
|
||||
"proposerIndex": blk.Block().ProposerIndex(),
|
||||
"graffiti": string(graffiti[:]),
|
||||
}).Debug("Received block")
|
||||
|
||||
blockVerificationGossipSummary.Observe(float64(prysmTime.Since(receivedTime).Milliseconds()))
|
||||
blockArrivalGossipSummary.Observe(float64(sinceSlotStartTime))
|
||||
blockVerificationGossipSummary.Observe(float64(validationTime))
|
||||
|
||||
return pubsub.ValidationAccept, nil
|
||||
}
|
||||
|
||||
|
||||
23
cache/nonblocking/lru.go
vendored
23
cache/nonblocking/lru.go
vendored
@@ -18,6 +18,7 @@ type LRU[K comparable, V any] struct {
|
||||
evictList *lruList[K, V]
|
||||
items map[K]*entry[K, V]
|
||||
onEvict EvictCallback[K, V]
|
||||
getChan chan *entry[K, V]
|
||||
}
|
||||
|
||||
// NewLRU constructs an LRU of the given size
|
||||
@@ -25,13 +26,19 @@ func NewLRU[K comparable, V any](size int, onEvict EvictCallback[K, V]) (*LRU[K,
|
||||
if size <= 0 {
|
||||
return nil, errors.New("must provide a positive size")
|
||||
}
|
||||
// Initialize the channel buffer size as being 10% of the cache size.
|
||||
chanSize := size / 10
|
||||
|
||||
c := &LRU[K, V]{
|
||||
size: size,
|
||||
evictList: newList[K, V](),
|
||||
items: make(map[K]*entry[K, V]),
|
||||
onEvict: onEvict,
|
||||
getChan: make(chan *entry[K, V], chanSize),
|
||||
}
|
||||
// Spin off separate go-routine to handle evict list
|
||||
// operations.
|
||||
go c.handleGetRequests()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
@@ -77,12 +84,7 @@ func (c *LRU[K, V]) Get(key K) (value V, ok bool) {
|
||||
c.itemsLock.RUnlock()
|
||||
|
||||
// Make this get function non-blocking for multiple readers.
|
||||
go func() {
|
||||
c.evictListLock.Lock()
|
||||
c.evictList.moveToFront(ent)
|
||||
c.evictListLock.Unlock()
|
||||
}()
|
||||
|
||||
c.getChan <- ent
|
||||
return ent.value, true
|
||||
}
|
||||
c.itemsLock.RUnlock()
|
||||
@@ -133,3 +135,12 @@ func (c *LRU[K, V]) removeElement(e *entry[K, V]) {
|
||||
c.onEvict(e.key, e.value)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *LRU[K, V]) handleGetRequests() {
|
||||
for {
|
||||
entry := <-c.getChan
|
||||
c.evictListLock.Lock()
|
||||
c.evictList.moveToFront(entry)
|
||||
c.evictListLock.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,9 +230,10 @@ func ConfigureBeaconChain(ctx *cli.Context) error {
|
||||
logEnabled(disableBuildBlockParallel)
|
||||
cfg.BuildBlockParallel = false
|
||||
}
|
||||
if ctx.IsSet(aggregateParallel.Name) {
|
||||
logEnabled(aggregateParallel)
|
||||
cfg.AggregateParallel = true
|
||||
cfg.AggregateParallel = true
|
||||
if ctx.IsSet(disableAggregateParallel.Name) {
|
||||
logEnabled(disableAggregateParallel)
|
||||
cfg.AggregateParallel = false
|
||||
}
|
||||
if ctx.IsSet(disableResourceManager.Name) {
|
||||
logEnabled(disableResourceManager)
|
||||
|
||||
@@ -38,6 +38,11 @@ var (
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedAggregateParallel = &cli.BoolFlag{
|
||||
Name: "aggregate-parallel",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
)
|
||||
|
||||
// Deprecated flags for both the beacon node and validator client.
|
||||
@@ -48,6 +53,7 @@ var deprecatedFlags = []cli.Flag{
|
||||
deprecatedDisableGossipBatchAggregation,
|
||||
deprecatedBuildBlockParallel,
|
||||
deprecatedEnableRegistrationCache,
|
||||
deprecatedAggregateParallel,
|
||||
}
|
||||
|
||||
// deprecatedBeaconFlags contains flags that are still used by other components
|
||||
|
||||
@@ -155,9 +155,9 @@ var (
|
||||
Usage: "A temporary flag for disabling the validator registration cache instead of using the db. note: registrations do not clear on restart while using the db",
|
||||
}
|
||||
|
||||
aggregateParallel = &cli.BoolFlag{
|
||||
Name: "aggregate-parallel",
|
||||
Usage: "Enables parallel aggregation of attestations",
|
||||
disableAggregateParallel = &cli.BoolFlag{
|
||||
Name: "disable-aggregate-parallel",
|
||||
Usage: "Disables parallel aggregation of attestations",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -212,7 +212,7 @@ var BeaconChainFlags = append(deprecatedBeaconFlags, append(deprecatedFlags, []c
|
||||
aggregateThirdInterval,
|
||||
disableResourceManager,
|
||||
DisableRegistrationCache,
|
||||
aggregateParallel,
|
||||
disableAggregateParallel,
|
||||
}...)...)
|
||||
|
||||
// E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E.
|
||||
|
||||
23
container/multi-value-slice/BUILD.bazel
Normal file
23
container/multi-value-slice/BUILD.bazel
Normal file
@@ -0,0 +1,23 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["multi_value_slice.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/container/multi-value-slice",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//container/multi-value-slice/interfaces:go_default_library",
|
||||
"@com_github_google_uuid//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["multi_value_slice_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//testing/assert:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"@com_github_google_uuid//:go_default_library",
|
||||
],
|
||||
)
|
||||
9
container/multi-value-slice/interfaces/BUILD.bazel
Normal file
9
container/multi-value-slice/interfaces/BUILD.bazel
Normal file
@@ -0,0 +1,9 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["interfaces.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/container/multi-value-slice/interfaces",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@com_github_google_uuid//:go_default_library"],
|
||||
)
|
||||
9
container/multi-value-slice/interfaces/interfaces.go
Normal file
9
container/multi-value-slice/interfaces/interfaces.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package interfaces
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
// Identifiable represents an object that can be uniquely identified by its Id.
|
||||
type Identifiable interface {
|
||||
Id() uuid.UUID
|
||||
SetId(id uuid.UUID)
|
||||
}
|
||||
488
container/multi-value-slice/multi_value_slice.go
Normal file
488
container/multi-value-slice/multi_value_slice.go
Normal file
@@ -0,0 +1,488 @@
|
||||
// Package mvslice defines a multi value slice container. The purpose of the container is to be a replacement for a slice
|
||||
// in scenarios where many objects of the same type share a copy of an identical or nearly identical slice.
|
||||
// In such case using the multi value slice should result in less memory allocation because many values of the slice can be shared between objects.
|
||||
//
|
||||
// The multi value slice should be initialized by calling the Init function and passing the initial values of the slice.
|
||||
// After initializing the slice, it can be shared between object by using the Copy function.
|
||||
// Note that simply assigning the same multi value slice to several objects is not enough for it to work properly.
|
||||
// Calling Copy is required in most circumstances (an exception is when the source object has only shared values).
|
||||
//
|
||||
// s := &Slice[int, *testObject]{}
|
||||
// s.Init([]int{1, 2, 3})
|
||||
// src := &testObject{id: id1, slice: s} // id1 is some UUID
|
||||
// dst := &testObject{id: id2, slice: s} // id2 is some UUID
|
||||
// s.Copy(src, dst)
|
||||
//
|
||||
// Each Value stores a value of type V along with identifiers to objects that have this value.
|
||||
// A MultiValueItem is a slice of Value elements. A Slice contains shared items, individual items and appended items.
|
||||
//
|
||||
// You can think of a shared value as the original value (i.e. the value at the point in time when the multi value slice was constructed),
|
||||
// and of an individual value as a changed value.
|
||||
// There is no notion of a shared appended value because appended values never have an original value (appended values are empty when the slice is created).
|
||||
//
|
||||
// Whenever any of the slice’s functions (apart from Init) is called, the function needs to know which object it is dealing with.
|
||||
// This is because if an object has an individual/appended value, the function must get/set/change this particular value instead of the shared value
|
||||
// or another individual/appended value.
|
||||
//
|
||||
// The way appended items are stored is as follows. Let’s say appended items were a regular slice that is initially empty,
|
||||
// and we append an item for object0 and then append another item for object1.
|
||||
// Now we have two items in the slice, but object1 only has an item in index 1. This makes things very confusing and hard to deal with.
|
||||
// If we make appended items a []*Value, things don’t become much better.
|
||||
// It is therefore easiest to make appended items a []*MultiValueItem, which allows each object to have its own values starting at index 0
|
||||
// and not having any “gaps”.
|
||||
//
|
||||
// The Detach function should be called when an object gets garbage collected.
|
||||
// Its purpose is to clean up the slice from individual/appended values of the collected object.
|
||||
// Otherwise the slice will get polluted with values for non-existing objects.
|
||||
//
|
||||
// Example diagram illustrating what happens after copying, updating and detaching:
|
||||
//
|
||||
// Create object o1 with value 10. At this point we only have a shared value.
|
||||
//
|
||||
// ===================
|
||||
// shared | individual
|
||||
// ===================
|
||||
// 10 |
|
||||
//
|
||||
// Copy object o1 to object o2. o2 shares the value with o1, no individual value is created.
|
||||
//
|
||||
// ===================
|
||||
// shared | individual
|
||||
// ===================
|
||||
// 10 |
|
||||
//
|
||||
// Update value of object o2 to 20. An individual value is created.
|
||||
//
|
||||
// ===================
|
||||
// shared | individual
|
||||
// ===================
|
||||
// 10 | 20: [o2]
|
||||
//
|
||||
// Copy object o2 to object o3. The individual value's object list is updated.
|
||||
//
|
||||
// ===================
|
||||
// shared | individual
|
||||
// ===================
|
||||
// 10 | 20: [o2,o3]
|
||||
//
|
||||
// Update value of object o3 to 30. There are two individual values now, one for o2 and one for o3.
|
||||
//
|
||||
// ===================
|
||||
// shared | individual
|
||||
// ===================
|
||||
// 10 | 20: [o2]
|
||||
// | 30: [o3]
|
||||
//
|
||||
// Update value of object o2 to 10. o2 no longer has an individual value
|
||||
// because it got "reverted" to the original, shared value,
|
||||
//
|
||||
// ===================
|
||||
// shared | individual
|
||||
// ===================
|
||||
// 10 | 30: [o3]
|
||||
//
|
||||
// Detach object o3. Individual value for o3 is removed.
|
||||
//
|
||||
// ===================
|
||||
// shared | individual
|
||||
// ===================
|
||||
// 10 |
|
||||
package mvslice
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/prysmaticlabs/prysm/v4/container/multi-value-slice/interfaces"
|
||||
)
|
||||
|
||||
// MultiValueSlice defines an abstraction over all concrete implementations of the generic Slice.
|
||||
type MultiValueSlice[O interfaces.Identifiable] interface {
|
||||
Len(obj O) uuid.UUID
|
||||
}
|
||||
|
||||
// Value defines a single value along with one or more IDs that share this value.
|
||||
type Value[V any] struct {
|
||||
val V
|
||||
ids []uuid.UUID
|
||||
}
|
||||
|
||||
// MultiValueItem defines a collection of Value items.
|
||||
type MultiValueItem[V any] struct {
|
||||
Values []*Value[V]
|
||||
}
|
||||
|
||||
// Slice is the main component of the multi-value slice data structure. It has two type parameters:
|
||||
// - V comparable - the type of values stored the slice. The constraint is required
|
||||
// because certain operations (e.g. updating, appending) have to compare values against each other.
|
||||
// - O interfaces.Identifiable - the type of objects sharing the slice. The constraint is required
|
||||
// because we need a way to compare objects against each other in order to know which objects
|
||||
// values should be accessed.
|
||||
type Slice[V comparable, O interfaces.Identifiable] struct {
|
||||
sharedItems []V
|
||||
individualItems map[uint64]*MultiValueItem[V]
|
||||
appendedItems []*MultiValueItem[V]
|
||||
cachedLengths map[uuid.UUID]int
|
||||
lock sync.RWMutex
|
||||
}
|
||||
|
||||
// Init initializes the slice with sensible defaults. Input values are assigned to shared items.
|
||||
func (s *Slice[V, O]) Init(items []V) {
|
||||
s.sharedItems = items
|
||||
s.individualItems = map[uint64]*MultiValueItem[V]{}
|
||||
s.appendedItems = []*MultiValueItem[V]{}
|
||||
s.cachedLengths = map[uuid.UUID]int{}
|
||||
}
|
||||
|
||||
// Len returns the number of items for the input object.
|
||||
func (s *Slice[V, O]) Len(obj O) int {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
|
||||
l, ok := s.cachedLengths[obj.Id()]
|
||||
if !ok {
|
||||
return len(s.sharedItems)
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
// Copy copies items between the source and destination.
|
||||
func (s *Slice[V, O]) Copy(src O, dst O) {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
||||
for _, item := range s.individualItems {
|
||||
for _, v := range item.Values {
|
||||
_, found := containsId(v.ids, src.Id())
|
||||
if found {
|
||||
v.ids = append(v.ids, dst.Id())
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, item := range s.appendedItems {
|
||||
found := false
|
||||
for _, v := range item.Values {
|
||||
_, found = containsId(v.ids, src.Id())
|
||||
if found {
|
||||
v.ids = append(v.ids, dst.Id())
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
// This is an optimization. If we didn't find an appended item at index i,
|
||||
// then all larger indices don't have an appended item for the object either.
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
srcLen, ok := s.cachedLengths[src.Id()]
|
||||
if ok {
|
||||
s.cachedLengths[dst.Id()] = srcLen
|
||||
}
|
||||
}
|
||||
|
||||
// Value returns all items for the input object.
|
||||
func (s *Slice[V, O]) Value(obj O) []V {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
|
||||
l, ok := s.cachedLengths[obj.Id()]
|
||||
if ok {
|
||||
result := make([]V, l)
|
||||
s.fillOriginalItems(obj, &result)
|
||||
|
||||
sharedLen := len(s.sharedItems)
|
||||
for i, item := range s.appendedItems {
|
||||
found := false
|
||||
for _, v := range item.Values {
|
||||
_, found = containsId(v.ids, obj.Id())
|
||||
if found {
|
||||
result[sharedLen+i] = v.val
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
// This is an optimization. If we didn't find an appended item at index i,
|
||||
// then all larger indices don't have an appended item for the object either.
|
||||
return result
|
||||
}
|
||||
}
|
||||
return result
|
||||
} else {
|
||||
result := make([]V, len(s.sharedItems))
|
||||
s.fillOriginalItems(obj, &result)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// At returns the item at the requested index for the input object.
|
||||
// Appended items' indices are always larger than shared/individual items' indices.
|
||||
// We first check if the index is within the length of shared items.
|
||||
// If it is, then we return an individual value at that index - if it exists - or a shared value otherwise.
|
||||
// If the index is beyond the length of shared values, it is an appended item and that's what gets returned.
|
||||
func (s *Slice[V, O]) At(obj O, index uint64) (V, error) {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
|
||||
if index >= uint64(len(s.sharedItems)+len(s.appendedItems)) {
|
||||
var def V
|
||||
return def, fmt.Errorf("index %d out of bounds", index)
|
||||
}
|
||||
|
||||
isOriginal := index < uint64(len(s.sharedItems))
|
||||
if isOriginal {
|
||||
ind, ok := s.individualItems[index]
|
||||
if !ok {
|
||||
return s.sharedItems[index], nil
|
||||
}
|
||||
for _, v := range ind.Values {
|
||||
for _, id := range v.ids {
|
||||
if id == obj.Id() {
|
||||
return v.val, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return s.sharedItems[index], nil
|
||||
} else {
|
||||
item := s.appendedItems[index-uint64(len(s.sharedItems))]
|
||||
for _, v := range item.Values {
|
||||
for _, id := range v.ids {
|
||||
if id == obj.Id() {
|
||||
return v.val, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
var def V
|
||||
return def, fmt.Errorf("index %d out of bounds", index)
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateAt updates the item at the required index for the input object to the passed in value.
|
||||
func (s *Slice[V, O]) UpdateAt(obj O, index uint64, val V) error {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
||||
if index >= uint64(len(s.sharedItems)+len(s.appendedItems)) {
|
||||
return fmt.Errorf("index %d out of bounds", index)
|
||||
}
|
||||
|
||||
isOriginal := index < uint64(len(s.sharedItems))
|
||||
if isOriginal {
|
||||
s.updateOriginalItem(obj, index, val)
|
||||
return nil
|
||||
}
|
||||
return s.updateAppendedItem(obj, index, val)
|
||||
}
|
||||
|
||||
// Append adds a new item to the input object.
|
||||
func (s *Slice[V, O]) Append(obj O, val V) {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
||||
if len(s.appendedItems) == 0 {
|
||||
s.appendedItems = append(s.appendedItems, &MultiValueItem[V]{Values: []*Value[V]{{val: val, ids: []uuid.UUID{obj.Id()}}}})
|
||||
s.cachedLengths[obj.Id()] = len(s.sharedItems) + 1
|
||||
return
|
||||
}
|
||||
|
||||
for _, item := range s.appendedItems {
|
||||
found := false
|
||||
for _, v := range item.Values {
|
||||
_, found = containsId(v.ids, obj.Id())
|
||||
if found {
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
newValue := true
|
||||
for _, v := range item.Values {
|
||||
if v.val == val {
|
||||
v.ids = append(v.ids, obj.Id())
|
||||
newValue = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if newValue {
|
||||
item.Values = append(item.Values, &Value[V]{val: val, ids: []uuid.UUID{obj.Id()}})
|
||||
}
|
||||
|
||||
l, ok := s.cachedLengths[obj.Id()]
|
||||
if ok {
|
||||
s.cachedLengths[obj.Id()] = l + 1
|
||||
} else {
|
||||
s.cachedLengths[obj.Id()] = len(s.sharedItems) + 1
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
s.appendedItems = append(s.appendedItems, &MultiValueItem[V]{Values: []*Value[V]{{val: val, ids: []uuid.UUID{obj.Id()}}}})
|
||||
|
||||
s.cachedLengths[obj.Id()] = s.cachedLengths[obj.Id()] + 1
|
||||
}
|
||||
|
||||
// Detach removes the input object from the multi-value slice.
|
||||
// What this means in practice is that we remove all individual and appended values for that object and clear the cached length.
|
||||
func (s *Slice[V, O]) Detach(obj O) {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
||||
for i, ind := range s.individualItems {
|
||||
for vi, v := range ind.Values {
|
||||
foundIndex, found := containsId(v.ids, obj.Id())
|
||||
if found {
|
||||
if len(v.ids) == 1 {
|
||||
if len(ind.Values) == 1 {
|
||||
delete(s.individualItems, i)
|
||||
} else {
|
||||
ind.Values = deleteElemFromSlice(ind.Values, vi)
|
||||
}
|
||||
} else {
|
||||
v.ids = deleteElemFromSlice(v.ids, foundIndex)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, item := range s.appendedItems {
|
||||
found := false
|
||||
for vi, v := range item.Values {
|
||||
var foundIndex int
|
||||
foundIndex, found = containsId(v.ids, obj.Id())
|
||||
if found {
|
||||
if len(v.ids) == 1 {
|
||||
item.Values = deleteElemFromSlice(item.Values, vi)
|
||||
} else {
|
||||
v.ids = deleteElemFromSlice(v.ids, foundIndex)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
// This is an optimization. If we didn't find an appended item at index i,
|
||||
// then all larger indices don't have an appended item for the object either.
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
delete(s.cachedLengths, obj.Id())
|
||||
}
|
||||
|
||||
func (s *Slice[V, O]) fillOriginalItems(obj O, items *[]V) {
|
||||
for i, item := range s.sharedItems {
|
||||
ind, ok := s.individualItems[uint64(i)]
|
||||
if !ok {
|
||||
(*items)[i] = item
|
||||
} else {
|
||||
found := false
|
||||
for _, v := range ind.Values {
|
||||
_, found = containsId(v.ids, obj.Id())
|
||||
if found {
|
||||
(*items)[i] = v.val
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
(*items)[i] = item
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Slice[V, O]) updateOriginalItem(obj O, index uint64, val V) {
|
||||
ind, ok := s.individualItems[index]
|
||||
if ok {
|
||||
for mvi, v := range ind.Values {
|
||||
// if we find an existing value, we remove it
|
||||
foundIndex, found := containsId(v.ids, obj.Id())
|
||||
if found {
|
||||
if len(v.ids) == 1 {
|
||||
// There is an improvement to be made here. If len(ind.Values) == 1,
|
||||
// then after removing the item from the slice s.individualItems[i]
|
||||
// will be a useless map entry whose value is an empty slice.
|
||||
ind.Values = deleteElemFromSlice(ind.Values, mvi)
|
||||
} else {
|
||||
v.ids = deleteElemFromSlice(v.ids, foundIndex)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if val == s.sharedItems[index] {
|
||||
return
|
||||
}
|
||||
|
||||
if !ok {
|
||||
s.individualItems[index] = &MultiValueItem[V]{Values: []*Value[V]{{val: val, ids: []uuid.UUID{obj.Id()}}}}
|
||||
} else {
|
||||
newValue := true
|
||||
for _, v := range ind.Values {
|
||||
if v.val == val {
|
||||
v.ids = append(v.ids, obj.Id())
|
||||
newValue = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if newValue {
|
||||
ind.Values = append(ind.Values, &Value[V]{val: val, ids: []uuid.UUID{obj.Id()}})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Slice[V, O]) updateAppendedItem(obj O, index uint64, val V) error {
|
||||
item := s.appendedItems[index-uint64(len(s.sharedItems))]
|
||||
found := false
|
||||
for vi, v := range item.Values {
|
||||
var foundIndex int
|
||||
// if we find an existing value, we remove it
|
||||
foundIndex, found = containsId(v.ids, obj.Id())
|
||||
if found {
|
||||
if len(v.ids) == 1 {
|
||||
item.Values = deleteElemFromSlice(item.Values, vi)
|
||||
} else {
|
||||
v.ids = deleteElemFromSlice(v.ids, foundIndex)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return fmt.Errorf("index %d out of bounds", index)
|
||||
}
|
||||
|
||||
newValue := true
|
||||
for _, v := range item.Values {
|
||||
if v.val == val {
|
||||
v.ids = append(v.ids, obj.Id())
|
||||
newValue = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if newValue {
|
||||
item.Values = append(item.Values, &Value[V]{val: val, ids: []uuid.UUID{obj.Id()}})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func containsId(ids []uuid.UUID, wanted uuid.UUID) (int, bool) {
|
||||
for i, id := range ids {
|
||||
if id == wanted {
|
||||
return i, true
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
// deleteElemFromSlice does not relocate the slice, but it also does not preserve the order of items.
|
||||
// This is not a problem here because the order of values in a MultiValueItem and object IDs doesn't matter.
|
||||
func deleteElemFromSlice[T any](s []T, i int) []T {
|
||||
s[i] = s[len(s)-1] // Copy last element to index i.
|
||||
s = s[:len(s)-1] // Truncate slice.
|
||||
return s
|
||||
}
|
||||
664
container/multi-value-slice/multi_value_slice_test.go
Normal file
664
container/multi-value-slice/multi_value_slice_test.go
Normal file
@@ -0,0 +1,664 @@
|
||||
package mvslice
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
)
|
||||
|
||||
var (
|
||||
id1 = uuid.New()
|
||||
id2 = uuid.New()
|
||||
id999 = uuid.New()
|
||||
)
|
||||
|
||||
type testObject struct {
|
||||
id uuid.UUID
|
||||
slice *Slice[int, *testObject]
|
||||
}
|
||||
|
||||
func (o *testObject) Id() uuid.UUID {
|
||||
return o.id
|
||||
}
|
||||
|
||||
func (o *testObject) SetId(id uuid.UUID) {
|
||||
o.id = id
|
||||
}
|
||||
|
||||
func TestLen(t *testing.T) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init([]int{1, 2, 3})
|
||||
id := uuid.New()
|
||||
s.cachedLengths[id] = 123
|
||||
t.Run("cached", func(t *testing.T) {
|
||||
assert.Equal(t, 123, s.Len(&testObject{id: id}))
|
||||
})
|
||||
t.Run("not cached", func(t *testing.T) {
|
||||
assert.Equal(t, 3, s.Len(&testObject{id: uuid.New()}))
|
||||
})
|
||||
}
|
||||
|
||||
func TestCopy(t *testing.T) {
|
||||
// What we want to check:
|
||||
// - shared value is copied
|
||||
// - when the source object has an individual value, it is copied
|
||||
// - when the source object does not have an individual value, the shared value is copied
|
||||
// - when the source object has an appended value, it is copied
|
||||
// - when the source object does not have an appended value, nothing is copied
|
||||
// - length of destination object is cached
|
||||
|
||||
s := setup()
|
||||
src := &testObject{id: id1, slice: s}
|
||||
dst := &testObject{id: id999, slice: s}
|
||||
|
||||
s.Copy(src, dst)
|
||||
|
||||
assert.Equal(t, (*MultiValueItem[int])(nil), dst.slice.individualItems[0])
|
||||
assertIndividualFound(t, s, dst.id, 1, 1)
|
||||
assertIndividualFound(t, s, dst.id, 2, 3)
|
||||
assertIndividualFound(t, s, dst.id, 3, 1)
|
||||
assertIndividualNotFound(t, s, dst.id, 4)
|
||||
assertAppendedFound(t, s, dst.id, 0, 1)
|
||||
assertAppendedFound(t, s, dst.id, 1, 3)
|
||||
assertAppendedNotFound(t, s, dst.id, 2)
|
||||
l, ok := s.cachedLengths[id999]
|
||||
require.Equal(t, true, ok)
|
||||
assert.Equal(t, 7, l)
|
||||
}
|
||||
|
||||
func TestValue(t *testing.T) {
|
||||
// What we want to check:
|
||||
// - correct values are returned for first object
|
||||
// - correct values are returned for second object
|
||||
// - correct values are returned for an object without appended items
|
||||
|
||||
s := setup()
|
||||
first := &testObject{id: id1, slice: s}
|
||||
second := &testObject{id: id2, slice: s}
|
||||
|
||||
v := s.Value(first)
|
||||
|
||||
require.Equal(t, 7, len(v))
|
||||
assert.Equal(t, 123, v[0])
|
||||
assert.Equal(t, 1, v[1])
|
||||
assert.Equal(t, 3, v[2])
|
||||
assert.Equal(t, 1, v[3])
|
||||
assert.Equal(t, 123, v[4])
|
||||
assert.Equal(t, 1, v[5])
|
||||
assert.Equal(t, 3, v[6])
|
||||
|
||||
v = s.Value(second)
|
||||
|
||||
require.Equal(t, 8, len(v))
|
||||
assert.Equal(t, 123, v[0])
|
||||
assert.Equal(t, 2, v[1])
|
||||
assert.Equal(t, 3, v[2])
|
||||
assert.Equal(t, 123, v[3])
|
||||
assert.Equal(t, 2, v[4])
|
||||
assert.Equal(t, 2, v[5])
|
||||
assert.Equal(t, 3, v[6])
|
||||
assert.Equal(t, 2, v[7])
|
||||
|
||||
s = &Slice[int, *testObject]{}
|
||||
s.Init([]int{1, 2, 3})
|
||||
id := uuid.New()
|
||||
|
||||
v = s.Value(&testObject{id: id})
|
||||
|
||||
require.Equal(t, 3, len(v))
|
||||
assert.Equal(t, 1, v[0])
|
||||
assert.Equal(t, 2, v[1])
|
||||
assert.Equal(t, 3, v[2])
|
||||
}
|
||||
|
||||
func TestAt(t *testing.T) {
|
||||
// What we want to check:
|
||||
// - correct values are returned for first object
|
||||
// - correct values are returned for second object
|
||||
// - ERROR when index too large in general
|
||||
// - ERROR when index not too large in general, but too large for an object
|
||||
|
||||
s := setup()
|
||||
first := &testObject{id: id1, slice: s}
|
||||
second := &testObject{id: id2, slice: s}
|
||||
|
||||
v, err := s.At(first, 0)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 123, v)
|
||||
v, err = s.At(first, 1)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, v)
|
||||
v, err = s.At(first, 2)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 3, v)
|
||||
v, err = s.At(first, 3)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, v)
|
||||
v, err = s.At(first, 4)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 123, v)
|
||||
v, err = s.At(first, 5)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, v)
|
||||
v, err = s.At(first, 6)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 3, v)
|
||||
_, err = s.At(first, 7)
|
||||
assert.ErrorContains(t, "index 7 out of bounds", err)
|
||||
|
||||
v, err = s.At(second, 0)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 123, v)
|
||||
v, err = s.At(second, 1)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, v)
|
||||
v, err = s.At(second, 2)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 3, v)
|
||||
v, err = s.At(second, 3)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 123, v)
|
||||
v, err = s.At(second, 4)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, v)
|
||||
v, err = s.At(second, 5)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, v)
|
||||
v, err = s.At(second, 6)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 3, v)
|
||||
v, err = s.At(second, 7)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, v)
|
||||
_, err = s.At(second, 8)
|
||||
assert.ErrorContains(t, "index 8 out of bounds", err)
|
||||
}
|
||||
|
||||
func TestUpdateAt(t *testing.T) {
|
||||
// What we want to check:
|
||||
// - shared value is updated only for the updated object, creating a new individual value (shared value remains the same)
|
||||
// - individual value (different for both objects) is updated to a third value
|
||||
// - individual value (different for both objects) is updated to the other object's value
|
||||
// - individual value (equal for both objects) is updated
|
||||
// - individual value existing only for the updated object is updated
|
||||
// - individual value existing only for the other-object appends an item to the individual value
|
||||
// - individual value updated to the original shared value removes that individual value
|
||||
// - appended value (different for both objects) is updated to a third value
|
||||
// - appended value (different for both objects) is updated to the other object's value
|
||||
// - appended value (equal for both objects) is updated
|
||||
// - appended value existing for one object is updated
|
||||
// - ERROR when index too large in general
|
||||
// - ERROR when index not too large in general, but too large for an object
|
||||
|
||||
s := setup()
|
||||
first := &testObject{id: id1, slice: s}
|
||||
second := &testObject{id: id2, slice: s}
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 0, 999))
|
||||
assert.Equal(t, 123, s.sharedItems[0])
|
||||
assertIndividualFound(t, s, first.id, 0, 999)
|
||||
assertIndividualNotFound(t, s, second.id, 0)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 1, 999))
|
||||
assertIndividualFound(t, s, first.id, 1, 999)
|
||||
assertIndividualFound(t, s, second.id, 1, 2)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 1, 2))
|
||||
assertIndividualFound(t, s, first.id, 1, 2)
|
||||
assertIndividualFound(t, s, second.id, 1, 2)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 2, 999))
|
||||
assertIndividualFound(t, s, first.id, 2, 999)
|
||||
assertIndividualFound(t, s, second.id, 2, 3)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 3, 999))
|
||||
assertIndividualFound(t, s, first.id, 3, 999)
|
||||
assertIndividualNotFound(t, s, second.id, 3)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 4, 999))
|
||||
assertIndividualFound(t, s, first.id, 4, 999)
|
||||
assertIndividualFound(t, s, second.id, 4, 2)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 4, 123))
|
||||
assertIndividualNotFound(t, s, first.id, 4)
|
||||
assertIndividualFound(t, s, second.id, 4, 2)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 5, 999))
|
||||
assertAppendedFound(t, s, first.id, 0, 999)
|
||||
assertAppendedFound(t, s, second.id, 0, 2)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 5, 2))
|
||||
assertAppendedFound(t, s, first.id, 0, 2)
|
||||
assertAppendedFound(t, s, second.id, 0, 2)
|
||||
|
||||
require.NoError(t, s.UpdateAt(first, 6, 999))
|
||||
assertAppendedFound(t, s, first.id, 1, 999)
|
||||
assertAppendedFound(t, s, second.id, 1, 3)
|
||||
|
||||
// we update the second object because there are no more appended items for the first object
|
||||
require.NoError(t, s.UpdateAt(second, 7, 999))
|
||||
assertAppendedNotFound(t, s, first.id, 2)
|
||||
assertAppendedFound(t, s, second.id, 2, 999)
|
||||
|
||||
assert.ErrorContains(t, "index 7 out of bounds", s.UpdateAt(first, 7, 999))
|
||||
assert.ErrorContains(t, "index 8 out of bounds", s.UpdateAt(second, 8, 999))
|
||||
}
|
||||
|
||||
func TestAppend(t *testing.T) {
|
||||
// What we want to check:
|
||||
// - appending first item ever to the slice
|
||||
// - appending an item to an object when there is no corresponding item for the other object
|
||||
// - appending an item to an object when there is a corresponding item with same value for the other object
|
||||
// - appending an item to an object when there is a corresponding item with different value for the other object
|
||||
// - we also want to check that cached length is properly updated after every append
|
||||
|
||||
// we want to start with the simplest slice possible
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init([]int{0})
|
||||
first := &testObject{id: id1, slice: s}
|
||||
second := &testObject{id: id2, slice: s}
|
||||
|
||||
// append first value ever
|
||||
s.Append(first, 1)
|
||||
require.Equal(t, 1, len(s.appendedItems))
|
||||
assertAppendedFound(t, s, first.id, 0, 1)
|
||||
assertAppendedNotFound(t, s, second.id, 0)
|
||||
l, ok := s.cachedLengths[first.id]
|
||||
require.Equal(t, true, ok)
|
||||
assert.Equal(t, 2, l)
|
||||
_, ok = s.cachedLengths[second.id]
|
||||
assert.Equal(t, false, ok)
|
||||
|
||||
// append one more value to the first object, so that we can test two append scenarios for the second object
|
||||
s.Append(first, 1)
|
||||
|
||||
// append the first value to the second object, equal to the value for the first object
|
||||
s.Append(second, 1)
|
||||
require.Equal(t, 2, len(s.appendedItems))
|
||||
assertAppendedFound(t, s, first.id, 0, 1)
|
||||
assertAppendedFound(t, s, second.id, 0, 1)
|
||||
l, ok = s.cachedLengths[first.id]
|
||||
require.Equal(t, true, ok)
|
||||
assert.Equal(t, 3, l)
|
||||
l, ok = s.cachedLengths[second.id]
|
||||
assert.Equal(t, true, ok)
|
||||
assert.Equal(t, 2, l)
|
||||
|
||||
// append the first value to the second object, different than the value for the first object
|
||||
s.Append(second, 2)
|
||||
require.Equal(t, 2, len(s.appendedItems))
|
||||
assertAppendedFound(t, s, first.id, 1, 1)
|
||||
assertAppendedFound(t, s, second.id, 1, 2)
|
||||
l, ok = s.cachedLengths[first.id]
|
||||
require.Equal(t, true, ok)
|
||||
assert.Equal(t, 3, l)
|
||||
l, ok = s.cachedLengths[second.id]
|
||||
assert.Equal(t, true, ok)
|
||||
assert.Equal(t, 3, l)
|
||||
}
|
||||
|
||||
func TestDetach(t *testing.T) {
|
||||
// What we want to check:
|
||||
// - no individual or appended items left after detaching an object
|
||||
// - length removed from cache
|
||||
|
||||
s := setup()
|
||||
obj := &testObject{id: id1, slice: s}
|
||||
|
||||
s.Detach(obj)
|
||||
|
||||
for _, item := range s.individualItems {
|
||||
found := false
|
||||
for _, v := range item.Values {
|
||||
for _, o := range v.ids {
|
||||
if o == obj.id {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.Equal(t, false, found)
|
||||
}
|
||||
for _, item := range s.appendedItems {
|
||||
found := false
|
||||
for _, v := range item.Values {
|
||||
for _, o := range v.ids {
|
||||
if o == obj.id {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.Equal(t, false, found)
|
||||
}
|
||||
_, ok := s.cachedLengths[obj.id]
|
||||
assert.Equal(t, false, ok)
|
||||
}
|
||||
|
||||
// Share the slice between 2 objects.
|
||||
// Index 0: Shared value
|
||||
// Index 1: Different individual value
|
||||
// Index 2: Same individual value
|
||||
// Index 3: Individual value ONLY for the first object
|
||||
// Index 4: Individual value ONLY for the second object
|
||||
// Index 5: Different appended value
|
||||
// Index 6: Same appended value
|
||||
// Index 7: Appended value ONLY for the second object
|
||||
func setup() *Slice[int, *testObject] {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init([]int{123, 123, 123, 123, 123})
|
||||
s.individualItems[1] = &MultiValueItem[int]{
|
||||
Values: []*Value[int]{
|
||||
{
|
||||
val: 1,
|
||||
ids: []uuid.UUID{id1},
|
||||
},
|
||||
{
|
||||
val: 2,
|
||||
ids: []uuid.UUID{id2},
|
||||
},
|
||||
},
|
||||
}
|
||||
s.individualItems[2] = &MultiValueItem[int]{
|
||||
Values: []*Value[int]{
|
||||
{
|
||||
val: 3,
|
||||
ids: []uuid.UUID{id1, id2},
|
||||
},
|
||||
},
|
||||
}
|
||||
s.individualItems[3] = &MultiValueItem[int]{
|
||||
Values: []*Value[int]{
|
||||
{
|
||||
val: 1,
|
||||
ids: []uuid.UUID{id1},
|
||||
},
|
||||
},
|
||||
}
|
||||
s.individualItems[4] = &MultiValueItem[int]{
|
||||
Values: []*Value[int]{
|
||||
{
|
||||
val: 2,
|
||||
ids: []uuid.UUID{id2},
|
||||
},
|
||||
},
|
||||
}
|
||||
s.appendedItems = []*MultiValueItem[int]{
|
||||
{
|
||||
Values: []*Value[int]{
|
||||
{
|
||||
val: 1,
|
||||
ids: []uuid.UUID{id1},
|
||||
},
|
||||
{
|
||||
val: 2,
|
||||
ids: []uuid.UUID{id2},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Values: []*Value[int]{
|
||||
{
|
||||
val: 3,
|
||||
ids: []uuid.UUID{id1, id2},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Values: []*Value[int]{
|
||||
{
|
||||
val: 2,
|
||||
ids: []uuid.UUID{id2},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
s.cachedLengths[id1] = 7
|
||||
s.cachedLengths[id2] = 8
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func assertIndividualFound(t *testing.T, slice *Slice[int, *testObject], id uuid.UUID, itemIndex uint64, expected int) {
|
||||
found := false
|
||||
for _, v := range slice.individualItems[itemIndex].Values {
|
||||
for _, o := range v.ids {
|
||||
if o == id {
|
||||
found = true
|
||||
assert.Equal(t, expected, v.val)
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.Equal(t, true, found)
|
||||
}
|
||||
|
||||
func assertIndividualNotFound(t *testing.T, slice *Slice[int, *testObject], id uuid.UUID, itemIndex uint64) {
|
||||
found := false
|
||||
for _, v := range slice.individualItems[itemIndex].Values {
|
||||
for _, o := range v.ids {
|
||||
if o == id {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.Equal(t, false, found)
|
||||
}
|
||||
|
||||
func assertAppendedFound(t *testing.T, slice *Slice[int, *testObject], id uuid.UUID, itemIndex uint64, expected int) {
|
||||
found := false
|
||||
for _, v := range slice.appendedItems[itemIndex].Values {
|
||||
for _, o := range v.ids {
|
||||
if o == id {
|
||||
found = true
|
||||
assert.Equal(t, expected, v.val)
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.Equal(t, true, found)
|
||||
}
|
||||
|
||||
func assertAppendedNotFound(t *testing.T, slice *Slice[int, *testObject], id uuid.UUID, itemIndex uint64) {
|
||||
found := false
|
||||
for _, v := range slice.appendedItems[itemIndex].Values {
|
||||
for _, o := range v.ids {
|
||||
if o == id {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.Equal(t, false, found)
|
||||
}
|
||||
|
||||
func BenchmarkValue(b *testing.B) {
|
||||
const _100k = 100000
|
||||
const _1m = 1000000
|
||||
const _10m = 10000000
|
||||
|
||||
b.Run("100,000 shared items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _100k))
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(&testObject{})
|
||||
}
|
||||
})
|
||||
b.Run("100,000 equal individual items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _100k))
|
||||
s.individualItems[0] = &MultiValueItem[int]{Values: []*Value[int]{{val: 999, ids: []uuid.UUID{}}}}
|
||||
objs := make([]*testObject, _100k)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.individualItems[0].Values[0].ids = append(s.individualItems[0].Values[0].ids, id)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_100k)])
|
||||
}
|
||||
})
|
||||
b.Run("100,000 different individual items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _100k))
|
||||
objs := make([]*testObject, _100k)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.individualItems[uint64(i)] = &MultiValueItem[int]{Values: []*Value[int]{{val: i, ids: []uuid.UUID{id}}}}
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_100k)])
|
||||
}
|
||||
})
|
||||
b.Run("100,000 shared items and 100,000 equal appended items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _100k))
|
||||
s.appendedItems = []*MultiValueItem[int]{{Values: []*Value[int]{{val: 999, ids: []uuid.UUID{}}}}}
|
||||
objs := make([]*testObject, _100k)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.appendedItems[0].Values[0].ids = append(s.appendedItems[0].Values[0].ids, id)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_100k)])
|
||||
}
|
||||
})
|
||||
b.Run("100,000 shared items and 100,000 different appended items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _100k))
|
||||
s.appendedItems = []*MultiValueItem[int]{}
|
||||
objs := make([]*testObject, _100k)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.appendedItems = append(s.appendedItems, &MultiValueItem[int]{Values: []*Value[int]{{val: i, ids: []uuid.UUID{id}}}})
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_100k)])
|
||||
}
|
||||
})
|
||||
b.Run("1,000,000 shared items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _1m))
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(&testObject{})
|
||||
}
|
||||
})
|
||||
b.Run("1,000,000 equal individual items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _1m))
|
||||
s.individualItems[0] = &MultiValueItem[int]{Values: []*Value[int]{{val: 999, ids: []uuid.UUID{}}}}
|
||||
objs := make([]*testObject, _1m)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.individualItems[0].Values[0].ids = append(s.individualItems[0].Values[0].ids, id)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_1m)])
|
||||
}
|
||||
})
|
||||
b.Run("1,000,000 different individual items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _1m))
|
||||
objs := make([]*testObject, _1m)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.individualItems[uint64(i)] = &MultiValueItem[int]{Values: []*Value[int]{{val: i, ids: []uuid.UUID{id}}}}
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_1m)])
|
||||
}
|
||||
})
|
||||
b.Run("1,000,000 shared items and 1,000,000 equal appended items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _1m))
|
||||
s.appendedItems = []*MultiValueItem[int]{{Values: []*Value[int]{{val: 999, ids: []uuid.UUID{}}}}}
|
||||
objs := make([]*testObject, _1m)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.appendedItems[0].Values[0].ids = append(s.appendedItems[0].Values[0].ids, id)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_1m)])
|
||||
}
|
||||
})
|
||||
b.Run("1,000,000 shared items and 1,000,000 different appended items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _1m))
|
||||
s.appendedItems = []*MultiValueItem[int]{}
|
||||
objs := make([]*testObject, _1m)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.appendedItems = append(s.appendedItems, &MultiValueItem[int]{Values: []*Value[int]{{val: i, ids: []uuid.UUID{id}}}})
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_1m)])
|
||||
}
|
||||
})
|
||||
b.Run("10,000,000 shared items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _10m))
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(&testObject{})
|
||||
}
|
||||
})
|
||||
b.Run("10,000,000 equal individual items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _10m))
|
||||
s.individualItems[0] = &MultiValueItem[int]{Values: []*Value[int]{{val: 999, ids: []uuid.UUID{}}}}
|
||||
objs := make([]*testObject, _10m)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.individualItems[0].Values[0].ids = append(s.individualItems[0].Values[0].ids, id)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_10m)])
|
||||
}
|
||||
})
|
||||
b.Run("10,000,000 different individual items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _10m))
|
||||
objs := make([]*testObject, _10m)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.individualItems[uint64(i)] = &MultiValueItem[int]{Values: []*Value[int]{{val: i, ids: []uuid.UUID{id}}}}
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_10m)])
|
||||
}
|
||||
})
|
||||
b.Run("10,000,000 shared items and 10,000,000 equal appended items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _10m))
|
||||
s.appendedItems = []*MultiValueItem[int]{{Values: []*Value[int]{{val: 999, ids: []uuid.UUID{}}}}}
|
||||
objs := make([]*testObject, _10m)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.appendedItems[0].Values[0].ids = append(s.appendedItems[0].Values[0].ids, id)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_10m)])
|
||||
}
|
||||
})
|
||||
b.Run("10,000,000 shared items and 10,000,000 different appended items", func(b *testing.B) {
|
||||
s := &Slice[int, *testObject]{}
|
||||
s.Init(make([]int, _10m))
|
||||
s.appendedItems = []*MultiValueItem[int]{}
|
||||
objs := make([]*testObject, _10m)
|
||||
for i := 0; i < len(objs); i++ {
|
||||
id := uuid.New()
|
||||
objs[i] = &testObject{id: id, slice: s}
|
||||
s.appendedItems = append(s.appendedItems, &MultiValueItem[int]{Values: []*Value[int]{{val: i, ids: []uuid.UUID{id}}}})
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Value(objs[rand.Intn(_10m)])
|
||||
}
|
||||
})
|
||||
}
|
||||
9
deps.bzl
9
deps.bzl
@@ -3394,12 +3394,11 @@ def prysm_deps():
|
||||
sum = "h1:GA6Bl6oZY+g/flt00Pnu0XtivSD8vukOu3lYhJjnGEk=",
|
||||
version = "v0.5.2",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
name = "com_github_r3labs_sse",
|
||||
importpath = "github.com/r3labs/sse",
|
||||
sum = "h1:zAsgcP8MhzAbhMnB1QQ2O7ZhWYVGYSR2iVcjzQuPV+o=",
|
||||
version = "v0.0.0-20210224172625-26fe804710bc",
|
||||
name = "com_github_r3labs_sse_v2",
|
||||
importpath = "github.com/r3labs/sse/v2",
|
||||
sum = "h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0=",
|
||||
version = "v2.10.0",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
|
||||
2
go.mod
2
go.mod
@@ -62,7 +62,7 @@ require (
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7
|
||||
github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c
|
||||
github.com/prysmaticlabs/protoc-gen-go-cast v0.0.0-20230228205207-28762a7b9294
|
||||
github.com/r3labs/sse v0.0.0-20210224172625-26fe804710bc
|
||||
github.com/r3labs/sse/v2 v2.10.0
|
||||
github.com/rs/cors v1.7.0
|
||||
github.com/schollz/progressbar/v3 v3.3.4
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1085,8 +1085,8 @@ github.com/quic-go/quic-go v0.33.0 h1:ItNoTDN/Fm/zBlq769lLJc8ECe9gYaW40veHCCco7y
|
||||
github.com/quic-go/quic-go v0.33.0/go.mod h1:YMuhaAV9/jIu0XclDXwZPAsP/2Kgr5yMYhe9oxhhOFA=
|
||||
github.com/quic-go/webtransport-go v0.5.2 h1:GA6Bl6oZY+g/flt00Pnu0XtivSD8vukOu3lYhJjnGEk=
|
||||
github.com/quic-go/webtransport-go v0.5.2/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU=
|
||||
github.com/r3labs/sse v0.0.0-20210224172625-26fe804710bc h1:zAsgcP8MhzAbhMnB1QQ2O7ZhWYVGYSR2iVcjzQuPV+o=
|
||||
github.com/r3labs/sse v0.0.0-20210224172625-26fe804710bc/go.mod h1:S8xSOnV3CgpNrWd0GQ/OoQfMtlg2uPRSuTzcSGrzwK8=
|
||||
github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0=
|
||||
github.com/r3labs/sse/v2 v2.10.0/go.mod h1:Igau6Whc+F17QUgML1fYe1VPZzTV6EMCnYktEmkNJ7I=
|
||||
github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk=
|
||||
github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
|
||||
@@ -6,8 +6,6 @@ go_library(
|
||||
"auth.go",
|
||||
"endpoint.go",
|
||||
"external_ip.go",
|
||||
"reader.go",
|
||||
"writer.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/network",
|
||||
visibility = ["//visibility:public"],
|
||||
@@ -26,7 +24,6 @@ go_test(
|
||||
"auth_test.go",
|
||||
"endpoint_test.go",
|
||||
"external_ip_test.go",
|
||||
"reader_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
|
||||
23
network/http/BUILD.bazel
Normal file
23
network/http/BUILD.bazel
Normal file
@@ -0,0 +1,23 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"errors.go",
|
||||
"reader.go",
|
||||
"writer.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/network/http",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@com_github_sirupsen_logrus//:go_default_library"],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["reader_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//testing/assert:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
],
|
||||
)
|
||||
13
network/http/errors.go
Normal file
13
network/http/errors.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func HandleError(w http.ResponseWriter, message string, code int) {
|
||||
errJson := &DefaultErrorJson{
|
||||
Message: message,
|
||||
Code: code,
|
||||
}
|
||||
WriteError(w, errJson)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package network
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
@@ -1,4 +1,4 @@
|
||||
package network
|
||||
package http
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -1,4 +1,4 @@
|
||||
package network
|
||||
package http
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
324
proto/eth/service/validator_service.pb.go
generated
324
proto/eth/service/validator_service.pb.go
generated
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v3.15.8
|
||||
// protoc v4.23.3
|
||||
// source: proto/eth/service/validator_service.proto
|
||||
|
||||
package service
|
||||
@@ -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, 0xd6, 0x16, 0x0a, 0x0f, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x56, 0x61, 0x6c,
|
||||
0x74, 0x6f, 0x32, 0xd4, 0x12, 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,
|
||||
@@ -150,95 +150,63 @@ var file_proto_eth_service_validator_service_proto_rawDesc = []byte{
|
||||
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, 0xb0, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67,
|
||||
0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41,
|
||||
0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4,
|
||||
0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65,
|
||||
0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2f,
|
||||
0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0xa0, 0x01, 0x0a, 0x18, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74,
|
||||
0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f,
|
||||
0x66, 0x73, 0x12, 0x30, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x41, 0x67, 0x67, 0x72, 0x65,
|
||||
0x67, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x52, 0x65, 0x71,
|
||||
0x74, 0x61, 0x12, 0xbd, 0x01, 0x0a, 0x21, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x65, 0x61,
|
||||
0x63, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73,
|
||||
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72,
|
||||
0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69,
|
||||
0x74, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65,
|
||||
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x3a, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x34, 0x3a, 0x01, 0x2a, 0x22, 0x2f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x44, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x3e, 0x3a, 0x01, 0x2a, 0x22, 0x39, 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, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e,
|
||||
0x64, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x12, 0xbd, 0x01, 0x0a, 0x21, 0x53, 0x75, 0x62,
|
||||
0x6d, 0x69, 0x74, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74,
|
||||
0x65, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x6f, 0x6d,
|
||||
0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70,
|
||||
0x74, 0x79, 0x22, 0x44, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3e, 0x3a, 0x01, 0x2a, 0x22, 0x39, 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, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e,
|
||||
0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63,
|
||||
0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xb7, 0x01, 0x0a, 0x1f, 0x53, 0x75, 0x62,
|
||||
0x6d, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65,
|
||||
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53,
|
||||
0x75, 0x62, 0x6d, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74,
|
||||
0x65, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x42,
|
||||
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3c, 0x3a, 0x01, 0x2a, 0x22, 0x37, 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, 0x6f, 0x72, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69,
|
||||
0x74, 0x74, 0x65, 0x65, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 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,
|
||||
0x6e, 0x73, 0x12, 0xb7, 0x01, 0x0a, 0x1f, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x53, 0x79, 0x6e,
|
||||
0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x53,
|
||||
0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73,
|
||||
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x42, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3c,
|
||||
0x3a, 0x01, 0x2a, 0x22, 0x37, 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, 0x73,
|
||||
0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 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, 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, 0xa9, 0x01, 0x0a,
|
||||
0x1b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x12, 0x33, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53,
|
||||
0x75, 0x62, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
||||
0x37, 0x3a, 0x01, 0x2a, 0x22, 0x32, 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, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x6e,
|
||||
0x64, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x73, 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,
|
||||
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, 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,
|
||||
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{}{
|
||||
@@ -249,24 +217,20 @@ var file_proto_eth_service_validator_service_proto_goTypes = []interface{}{
|
||||
(*v1.PrepareBeaconProposerRequest)(nil), // 4: ethereum.eth.v1.PrepareBeaconProposerRequest
|
||||
(*v1.SubmitValidatorRegistrationsRequest)(nil), // 5: ethereum.eth.v1.SubmitValidatorRegistrationsRequest
|
||||
(*v1.ProduceAttestationDataRequest)(nil), // 6: ethereum.eth.v1.ProduceAttestationDataRequest
|
||||
(*v1.AggregateAttestationRequest)(nil), // 7: ethereum.eth.v1.AggregateAttestationRequest
|
||||
(*v1.SubmitAggregateAndProofsRequest)(nil), // 8: ethereum.eth.v1.SubmitAggregateAndProofsRequest
|
||||
(*v1.SubmitBeaconCommitteeSubscriptionsRequest)(nil), // 9: ethereum.eth.v1.SubmitBeaconCommitteeSubscriptionsRequest
|
||||
(*v2.SubmitSyncCommitteeSubscriptionsRequest)(nil), // 10: ethereum.eth.v2.SubmitSyncCommitteeSubscriptionsRequest
|
||||
(*v2.ProduceSyncCommitteeContributionRequest)(nil), // 11: ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
(*v2.SubmitContributionAndProofsRequest)(nil), // 12: ethereum.eth.v2.SubmitContributionAndProofsRequest
|
||||
(*v2.GetLivenessRequest)(nil), // 13: ethereum.eth.v2.GetLivenessRequest
|
||||
(*v1.AttesterDutiesResponse)(nil), // 14: ethereum.eth.v1.AttesterDutiesResponse
|
||||
(*v1.ProposerDutiesResponse)(nil), // 15: ethereum.eth.v1.ProposerDutiesResponse
|
||||
(*v2.SyncCommitteeDutiesResponse)(nil), // 16: ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
(*v2.ProduceBlockResponseV2)(nil), // 17: ethereum.eth.v2.ProduceBlockResponseV2
|
||||
(*v2.SSZContainer)(nil), // 18: ethereum.eth.v2.SSZContainer
|
||||
(*v2.ProduceBlindedBlockResponse)(nil), // 19: ethereum.eth.v2.ProduceBlindedBlockResponse
|
||||
(*empty.Empty)(nil), // 20: google.protobuf.Empty
|
||||
(*v1.ProduceAttestationDataResponse)(nil), // 21: ethereum.eth.v1.ProduceAttestationDataResponse
|
||||
(*v1.AggregateAttestationResponse)(nil), // 22: ethereum.eth.v1.AggregateAttestationResponse
|
||||
(*v2.ProduceSyncCommitteeContributionResponse)(nil), // 23: ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
(*v2.GetLivenessResponse)(nil), // 24: ethereum.eth.v2.GetLivenessResponse
|
||||
(*v1.SubmitBeaconCommitteeSubscriptionsRequest)(nil), // 7: ethereum.eth.v1.SubmitBeaconCommitteeSubscriptionsRequest
|
||||
(*v2.SubmitSyncCommitteeSubscriptionsRequest)(nil), // 8: ethereum.eth.v2.SubmitSyncCommitteeSubscriptionsRequest
|
||||
(*v2.ProduceSyncCommitteeContributionRequest)(nil), // 9: ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
(*v2.GetLivenessRequest)(nil), // 10: ethereum.eth.v2.GetLivenessRequest
|
||||
(*v1.AttesterDutiesResponse)(nil), // 11: ethereum.eth.v1.AttesterDutiesResponse
|
||||
(*v1.ProposerDutiesResponse)(nil), // 12: ethereum.eth.v1.ProposerDutiesResponse
|
||||
(*v2.SyncCommitteeDutiesResponse)(nil), // 13: ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
(*v2.ProduceBlockResponseV2)(nil), // 14: ethereum.eth.v2.ProduceBlockResponseV2
|
||||
(*v2.SSZContainer)(nil), // 15: ethereum.eth.v2.SSZContainer
|
||||
(*v2.ProduceBlindedBlockResponse)(nil), // 16: ethereum.eth.v2.ProduceBlindedBlockResponse
|
||||
(*empty.Empty)(nil), // 17: google.protobuf.Empty
|
||||
(*v1.ProduceAttestationDataResponse)(nil), // 18: ethereum.eth.v1.ProduceAttestationDataResponse
|
||||
(*v2.ProduceSyncCommitteeContributionResponse)(nil), // 19: ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
(*v2.GetLivenessResponse)(nil), // 20: 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
|
||||
@@ -279,32 +243,26 @@ var file_proto_eth_service_validator_service_proto_depIdxs = []int32{
|
||||
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.GetAggregateAttestation:input_type -> ethereum.eth.v1.AggregateAttestationRequest
|
||||
8, // 11: ethereum.eth.service.BeaconValidator.SubmitAggregateAndProofs:input_type -> ethereum.eth.v1.SubmitAggregateAndProofsRequest
|
||||
9, // 12: ethereum.eth.service.BeaconValidator.SubmitBeaconCommitteeSubscription:input_type -> ethereum.eth.v1.SubmitBeaconCommitteeSubscriptionsRequest
|
||||
10, // 13: ethereum.eth.service.BeaconValidator.SubmitSyncCommitteeSubscription:input_type -> ethereum.eth.v2.SubmitSyncCommitteeSubscriptionsRequest
|
||||
11, // 14: ethereum.eth.service.BeaconValidator.ProduceSyncCommitteeContribution:input_type -> ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
12, // 15: ethereum.eth.service.BeaconValidator.SubmitContributionAndProofs:input_type -> ethereum.eth.v2.SubmitContributionAndProofsRequest
|
||||
13, // 16: ethereum.eth.service.BeaconValidator.GetLiveness:input_type -> ethereum.eth.v2.GetLivenessRequest
|
||||
14, // 17: ethereum.eth.service.BeaconValidator.GetAttesterDuties:output_type -> ethereum.eth.v1.AttesterDutiesResponse
|
||||
15, // 18: ethereum.eth.service.BeaconValidator.GetProposerDuties:output_type -> ethereum.eth.v1.ProposerDutiesResponse
|
||||
16, // 19: ethereum.eth.service.BeaconValidator.GetSyncCommitteeDuties:output_type -> ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
17, // 20: ethereum.eth.service.BeaconValidator.ProduceBlockV2:output_type -> ethereum.eth.v2.ProduceBlockResponseV2
|
||||
18, // 21: ethereum.eth.service.BeaconValidator.ProduceBlockV2SSZ:output_type -> ethereum.eth.v2.SSZContainer
|
||||
19, // 22: ethereum.eth.service.BeaconValidator.ProduceBlindedBlock:output_type -> ethereum.eth.v2.ProduceBlindedBlockResponse
|
||||
18, // 23: ethereum.eth.service.BeaconValidator.ProduceBlindedBlockSSZ:output_type -> ethereum.eth.v2.SSZContainer
|
||||
20, // 24: ethereum.eth.service.BeaconValidator.PrepareBeaconProposer:output_type -> google.protobuf.Empty
|
||||
20, // 25: ethereum.eth.service.BeaconValidator.SubmitValidatorRegistration:output_type -> google.protobuf.Empty
|
||||
21, // 26: ethereum.eth.service.BeaconValidator.ProduceAttestationData:output_type -> ethereum.eth.v1.ProduceAttestationDataResponse
|
||||
22, // 27: ethereum.eth.service.BeaconValidator.GetAggregateAttestation:output_type -> ethereum.eth.v1.AggregateAttestationResponse
|
||||
20, // 28: ethereum.eth.service.BeaconValidator.SubmitAggregateAndProofs:output_type -> google.protobuf.Empty
|
||||
20, // 29: ethereum.eth.service.BeaconValidator.SubmitBeaconCommitteeSubscription:output_type -> google.protobuf.Empty
|
||||
20, // 30: ethereum.eth.service.BeaconValidator.SubmitSyncCommitteeSubscription:output_type -> google.protobuf.Empty
|
||||
23, // 31: ethereum.eth.service.BeaconValidator.ProduceSyncCommitteeContribution:output_type -> ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
20, // 32: ethereum.eth.service.BeaconValidator.SubmitContributionAndProofs:output_type -> google.protobuf.Empty
|
||||
24, // 33: ethereum.eth.service.BeaconValidator.GetLiveness:output_type -> ethereum.eth.v2.GetLivenessResponse
|
||||
17, // [17:34] is the sub-list for method output_type
|
||||
0, // [0:17] is the sub-list for method input_type
|
||||
7, // 10: ethereum.eth.service.BeaconValidator.SubmitBeaconCommitteeSubscription:input_type -> ethereum.eth.v1.SubmitBeaconCommitteeSubscriptionsRequest
|
||||
8, // 11: ethereum.eth.service.BeaconValidator.SubmitSyncCommitteeSubscription:input_type -> ethereum.eth.v2.SubmitSyncCommitteeSubscriptionsRequest
|
||||
9, // 12: ethereum.eth.service.BeaconValidator.ProduceSyncCommitteeContribution:input_type -> ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
10, // 13: ethereum.eth.service.BeaconValidator.GetLiveness:input_type -> ethereum.eth.v2.GetLivenessRequest
|
||||
11, // 14: ethereum.eth.service.BeaconValidator.GetAttesterDuties:output_type -> ethereum.eth.v1.AttesterDutiesResponse
|
||||
12, // 15: ethereum.eth.service.BeaconValidator.GetProposerDuties:output_type -> ethereum.eth.v1.ProposerDutiesResponse
|
||||
13, // 16: ethereum.eth.service.BeaconValidator.GetSyncCommitteeDuties:output_type -> ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
14, // 17: ethereum.eth.service.BeaconValidator.ProduceBlockV2:output_type -> ethereum.eth.v2.ProduceBlockResponseV2
|
||||
15, // 18: ethereum.eth.service.BeaconValidator.ProduceBlockV2SSZ:output_type -> ethereum.eth.v2.SSZContainer
|
||||
16, // 19: ethereum.eth.service.BeaconValidator.ProduceBlindedBlock:output_type -> ethereum.eth.v2.ProduceBlindedBlockResponse
|
||||
15, // 20: ethereum.eth.service.BeaconValidator.ProduceBlindedBlockSSZ:output_type -> ethereum.eth.v2.SSZContainer
|
||||
17, // 21: ethereum.eth.service.BeaconValidator.PrepareBeaconProposer:output_type -> google.protobuf.Empty
|
||||
17, // 22: ethereum.eth.service.BeaconValidator.SubmitValidatorRegistration:output_type -> google.protobuf.Empty
|
||||
18, // 23: ethereum.eth.service.BeaconValidator.ProduceAttestationData:output_type -> ethereum.eth.v1.ProduceAttestationDataResponse
|
||||
17, // 24: ethereum.eth.service.BeaconValidator.SubmitBeaconCommitteeSubscription:output_type -> google.protobuf.Empty
|
||||
17, // 25: ethereum.eth.service.BeaconValidator.SubmitSyncCommitteeSubscription:output_type -> google.protobuf.Empty
|
||||
19, // 26: ethereum.eth.service.BeaconValidator.ProduceSyncCommitteeContribution:output_type -> ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
20, // 27: ethereum.eth.service.BeaconValidator.GetLiveness:output_type -> ethereum.eth.v2.GetLivenessResponse
|
||||
14, // [14:28] is the sub-list for method output_type
|
||||
0, // [0:14] 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
|
||||
@@ -356,12 +314,9 @@ type BeaconValidatorClient interface {
|
||||
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)
|
||||
GetAggregateAttestation(ctx context.Context, in *v1.AggregateAttestationRequest, opts ...grpc.CallOption) (*v1.AggregateAttestationResponse, error)
|
||||
SubmitAggregateAndProofs(ctx context.Context, in *v1.SubmitAggregateAndProofsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
SubmitBeaconCommitteeSubscription(ctx context.Context, in *v1.SubmitBeaconCommitteeSubscriptionsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
SubmitSyncCommitteeSubscription(ctx context.Context, in *v2.SubmitSyncCommitteeSubscriptionsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
ProduceSyncCommitteeContribution(ctx context.Context, in *v2.ProduceSyncCommitteeContributionRequest, opts ...grpc.CallOption) (*v2.ProduceSyncCommitteeContributionResponse, error)
|
||||
SubmitContributionAndProofs(ctx context.Context, in *v2.SubmitContributionAndProofsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
GetLiveness(ctx context.Context, in *v2.GetLivenessRequest, opts ...grpc.CallOption) (*v2.GetLivenessResponse, error)
|
||||
}
|
||||
|
||||
@@ -463,24 +418,6 @@ func (c *beaconValidatorClient) ProduceAttestationData(ctx context.Context, in *
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *beaconValidatorClient) GetAggregateAttestation(ctx context.Context, in *v1.AggregateAttestationRequest, opts ...grpc.CallOption) (*v1.AggregateAttestationResponse, error) {
|
||||
out := new(v1.AggregateAttestationResponse)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconValidator/GetAggregateAttestation", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *beaconValidatorClient) SubmitAggregateAndProofs(ctx context.Context, in *v1.SubmitAggregateAndProofsRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconValidator/SubmitAggregateAndProofs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *beaconValidatorClient) SubmitBeaconCommitteeSubscription(ctx context.Context, in *v1.SubmitBeaconCommitteeSubscriptionsRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconValidator/SubmitBeaconCommitteeSubscription", in, out, opts...)
|
||||
@@ -508,15 +445,6 @@ func (c *beaconValidatorClient) ProduceSyncCommitteeContribution(ctx context.Con
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *beaconValidatorClient) SubmitContributionAndProofs(ctx context.Context, in *v2.SubmitContributionAndProofsRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconValidator/SubmitContributionAndProofs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *beaconValidatorClient) GetLiveness(ctx context.Context, in *v2.GetLivenessRequest, opts ...grpc.CallOption) (*v2.GetLivenessResponse, error) {
|
||||
out := new(v2.GetLivenessResponse)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconValidator/GetLiveness", in, out, opts...)
|
||||
@@ -538,12 +466,9 @@ type BeaconValidatorServer interface {
|
||||
PrepareBeaconProposer(context.Context, *v1.PrepareBeaconProposerRequest) (*empty.Empty, error)
|
||||
SubmitValidatorRegistration(context.Context, *v1.SubmitValidatorRegistrationsRequest) (*empty.Empty, error)
|
||||
ProduceAttestationData(context.Context, *v1.ProduceAttestationDataRequest) (*v1.ProduceAttestationDataResponse, error)
|
||||
GetAggregateAttestation(context.Context, *v1.AggregateAttestationRequest) (*v1.AggregateAttestationResponse, error)
|
||||
SubmitAggregateAndProofs(context.Context, *v1.SubmitAggregateAndProofsRequest) (*empty.Empty, error)
|
||||
SubmitBeaconCommitteeSubscription(context.Context, *v1.SubmitBeaconCommitteeSubscriptionsRequest) (*empty.Empty, error)
|
||||
SubmitSyncCommitteeSubscription(context.Context, *v2.SubmitSyncCommitteeSubscriptionsRequest) (*empty.Empty, error)
|
||||
ProduceSyncCommitteeContribution(context.Context, *v2.ProduceSyncCommitteeContributionRequest) (*v2.ProduceSyncCommitteeContributionResponse, error)
|
||||
SubmitContributionAndProofs(context.Context, *v2.SubmitContributionAndProofsRequest) (*empty.Empty, error)
|
||||
GetLiveness(context.Context, *v2.GetLivenessRequest) (*v2.GetLivenessResponse, error)
|
||||
}
|
||||
|
||||
@@ -581,12 +506,6 @@ func (*UnimplementedBeaconValidatorServer) SubmitValidatorRegistration(context.C
|
||||
func (*UnimplementedBeaconValidatorServer) ProduceAttestationData(context.Context, *v1.ProduceAttestationDataRequest) (*v1.ProduceAttestationDataResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ProduceAttestationData not implemented")
|
||||
}
|
||||
func (*UnimplementedBeaconValidatorServer) GetAggregateAttestation(context.Context, *v1.AggregateAttestationRequest) (*v1.AggregateAttestationResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetAggregateAttestation not implemented")
|
||||
}
|
||||
func (*UnimplementedBeaconValidatorServer) SubmitAggregateAndProofs(context.Context, *v1.SubmitAggregateAndProofsRequest) (*empty.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SubmitAggregateAndProofs not implemented")
|
||||
}
|
||||
func (*UnimplementedBeaconValidatorServer) SubmitBeaconCommitteeSubscription(context.Context, *v1.SubmitBeaconCommitteeSubscriptionsRequest) (*empty.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SubmitBeaconCommitteeSubscription not implemented")
|
||||
}
|
||||
@@ -596,9 +515,6 @@ func (*UnimplementedBeaconValidatorServer) SubmitSyncCommitteeSubscription(conte
|
||||
func (*UnimplementedBeaconValidatorServer) ProduceSyncCommitteeContribution(context.Context, *v2.ProduceSyncCommitteeContributionRequest) (*v2.ProduceSyncCommitteeContributionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ProduceSyncCommitteeContribution not implemented")
|
||||
}
|
||||
func (*UnimplementedBeaconValidatorServer) SubmitContributionAndProofs(context.Context, *v2.SubmitContributionAndProofsRequest) (*empty.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SubmitContributionAndProofs not implemented")
|
||||
}
|
||||
func (*UnimplementedBeaconValidatorServer) GetLiveness(context.Context, *v2.GetLivenessRequest) (*v2.GetLivenessResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetLiveness not implemented")
|
||||
}
|
||||
@@ -787,42 +703,6 @@ func _BeaconValidator_ProduceAttestationData_Handler(srv interface{}, ctx contex
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BeaconValidator_GetAggregateAttestation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(v1.AggregateAttestationRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(BeaconValidatorServer).GetAggregateAttestation(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ethereum.eth.service.BeaconValidator/GetAggregateAttestation",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BeaconValidatorServer).GetAggregateAttestation(ctx, req.(*v1.AggregateAttestationRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BeaconValidator_SubmitAggregateAndProofs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(v1.SubmitAggregateAndProofsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(BeaconValidatorServer).SubmitAggregateAndProofs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ethereum.eth.service.BeaconValidator/SubmitAggregateAndProofs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BeaconValidatorServer).SubmitAggregateAndProofs(ctx, req.(*v1.SubmitAggregateAndProofsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BeaconValidator_SubmitBeaconCommitteeSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(v1.SubmitBeaconCommitteeSubscriptionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -877,24 +757,6 @@ func _BeaconValidator_ProduceSyncCommitteeContribution_Handler(srv interface{},
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BeaconValidator_SubmitContributionAndProofs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(v2.SubmitContributionAndProofsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(BeaconValidatorServer).SubmitContributionAndProofs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ethereum.eth.service.BeaconValidator/SubmitContributionAndProofs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BeaconValidatorServer).SubmitContributionAndProofs(ctx, req.(*v2.SubmitContributionAndProofsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BeaconValidator_GetLiveness_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(v2.GetLivenessRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -957,14 +819,6 @@ var _BeaconValidator_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ProduceAttestationData",
|
||||
Handler: _BeaconValidator_ProduceAttestationData_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetAggregateAttestation",
|
||||
Handler: _BeaconValidator_GetAggregateAttestation_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SubmitAggregateAndProofs",
|
||||
Handler: _BeaconValidator_SubmitAggregateAndProofs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SubmitBeaconCommitteeSubscription",
|
||||
Handler: _BeaconValidator_SubmitBeaconCommitteeSubscription_Handler,
|
||||
@@ -977,10 +831,6 @@ var _BeaconValidator_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ProduceSyncCommitteeContribution",
|
||||
Handler: _BeaconValidator_ProduceSyncCommitteeContribution_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SubmitContributionAndProofs",
|
||||
Handler: _BeaconValidator_SubmitContributionAndProofs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetLiveness",
|
||||
Handler: _BeaconValidator_GetLiveness_Handler,
|
||||
|
||||
@@ -625,76 +625,6 @@ func local_request_BeaconValidator_ProduceAttestationData_0(ctx context.Context,
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_BeaconValidator_GetAggregateAttestation_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_BeaconValidator_GetAggregateAttestation_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1.AggregateAttestationRequest
|
||||
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_GetAggregateAttestation_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetAggregateAttestation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_BeaconValidator_GetAggregateAttestation_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1.AggregateAttestationRequest
|
||||
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_GetAggregateAttestation_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.GetAggregateAttestation(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_BeaconValidator_SubmitAggregateAndProofs_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1.SubmitAggregateAndProofsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.SubmitAggregateAndProofs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_BeaconValidator_SubmitAggregateAndProofs_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1.SubmitAggregateAndProofsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.SubmitAggregateAndProofs(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_BeaconValidator_SubmitBeaconCommitteeSubscription_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq v1.SubmitBeaconCommitteeSubscriptionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -799,40 +729,6 @@ func local_request_BeaconValidator_ProduceSyncCommitteeContribution_0(ctx contex
|
||||
|
||||
}
|
||||
|
||||
func request_BeaconValidator_SubmitContributionAndProofs_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq eth.SubmitContributionAndProofsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.SubmitContributionAndProofs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_BeaconValidator_SubmitContributionAndProofs_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconValidatorServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq eth.SubmitContributionAndProofsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.SubmitContributionAndProofs(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_BeaconValidator_GetLiveness_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconValidatorClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq eth.GetLivenessRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -1139,52 +1035,6 @@ func RegisterBeaconValidatorHandlerServer(ctx context.Context, mux *runtime.Serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_BeaconValidator_GetAggregateAttestation_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/GetAggregateAttestation")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_BeaconValidator_GetAggregateAttestation_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_GetAggregateAttestation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_BeaconValidator_SubmitAggregateAndProofs_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/SubmitAggregateAndProofs")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_BeaconValidator_SubmitAggregateAndProofs_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_SubmitAggregateAndProofs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_BeaconValidator_SubmitBeaconCommitteeSubscription_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -1254,29 +1104,6 @@ func RegisterBeaconValidatorHandlerServer(ctx context.Context, mux *runtime.Serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_BeaconValidator_SubmitContributionAndProofs_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/SubmitContributionAndProofs")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_BeaconValidator_SubmitContributionAndProofs_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_SubmitContributionAndProofs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_BeaconValidator_GetLiveness_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -1541,46 +1368,6 @@ func RegisterBeaconValidatorHandlerClient(ctx context.Context, mux *runtime.Serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_BeaconValidator_GetAggregateAttestation_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/GetAggregateAttestation")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_BeaconValidator_GetAggregateAttestation_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_GetAggregateAttestation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_BeaconValidator_SubmitAggregateAndProofs_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/SubmitAggregateAndProofs")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_BeaconValidator_SubmitAggregateAndProofs_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_SubmitAggregateAndProofs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_BeaconValidator_SubmitBeaconCommitteeSubscription_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -1641,26 +1428,6 @@ func RegisterBeaconValidatorHandlerClient(ctx context.Context, mux *runtime.Serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_BeaconValidator_SubmitContributionAndProofs_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/SubmitContributionAndProofs")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_BeaconValidator_SubmitContributionAndProofs_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_SubmitContributionAndProofs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_BeaconValidator_GetLiveness_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -1705,18 +1472,12 @@ var (
|
||||
|
||||
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_GetAggregateAttestation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "validator", "aggregate_attestation"}, ""))
|
||||
|
||||
pattern_BeaconValidator_SubmitAggregateAndProofs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "validator", "aggregate_and_proofs"}, ""))
|
||||
|
||||
pattern_BeaconValidator_SubmitBeaconCommitteeSubscription_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "validator", "beacon_committee_subscriptions"}, ""))
|
||||
|
||||
pattern_BeaconValidator_SubmitSyncCommitteeSubscription_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "validator", "sync_committee_subscriptions"}, ""))
|
||||
|
||||
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_SubmitContributionAndProofs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "validator", "contribution_and_proofs"}, ""))
|
||||
|
||||
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"}, ""))
|
||||
)
|
||||
|
||||
@@ -1741,17 +1502,11 @@ var (
|
||||
|
||||
forward_BeaconValidator_ProduceAttestationData_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_GetAggregateAttestation_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_SubmitAggregateAndProofs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_SubmitBeaconCommitteeSubscription_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_SubmitSyncCommitteeSubscription_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_ProduceSyncCommitteeContribution_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_SubmitContributionAndProofs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_BeaconValidator_GetLiveness_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
||||
@@ -200,34 +200,6 @@ service BeaconValidator {
|
||||
option (google.api.http) = { get: "/internal/eth/v1/validator/attestation_data" };
|
||||
}
|
||||
|
||||
// GetAggregateAttestation aggregates all attestations matching the given attestation data root and slot,
|
||||
// returning the aggregated result.
|
||||
//
|
||||
// HTTP response usage:
|
||||
// - 200: Successful response
|
||||
// - 400: Invalid request syntax
|
||||
// - 500: Beacon node internal error
|
||||
//
|
||||
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Validator/getAggregatedAttestation
|
||||
rpc GetAggregateAttestation(v1.AggregateAttestationRequest) returns (v1.AggregateAttestationResponse) {
|
||||
option (google.api.http) = { get: "/internal/eth/v1/validator/aggregate_attestation" };
|
||||
}
|
||||
|
||||
// SubmitAggregateAndProofs verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
|
||||
//
|
||||
// Response usage:
|
||||
// - 200: Successful response
|
||||
// - 400: Invalid request syntax
|
||||
// - 500: Beacon node internal error
|
||||
//
|
||||
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Validator/publishAggregateAndProofs
|
||||
rpc SubmitAggregateAndProofs(v1.SubmitAggregateAndProofsRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/internal/eth/v1/validator/aggregate_and_proofs"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// SubmitBeaconCommitteeSubscription searches using discv5 for peers related to
|
||||
// the provided subnet information and replaces current peers with those ones if necessary.
|
||||
//
|
||||
@@ -278,21 +250,6 @@ service BeaconValidator {
|
||||
option (google.api.http) = { get: "/internal/eth/v1/validator/sync_committee_contribution" };
|
||||
}
|
||||
|
||||
// SubmitContributionAndProofs publishes multiple signed sync committee contribution and proofs.
|
||||
//
|
||||
// Response usage:
|
||||
// - 200: Successful response
|
||||
// - 400: Invalid request syntax
|
||||
// - 500: Beacon node internal error
|
||||
//
|
||||
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Validator/publishContributionAndProofs
|
||||
rpc SubmitContributionAndProofs(v2.SubmitContributionAndProofsRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/internal/eth/v1/validator/contribution_and_proofs"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// GetLiveness requests the beacon node to indicate if a validator has been observed to be live in a given epoch.
|
||||
// The beacon node might detect liveness by observing messages from the validator on the network,
|
||||
// in the beacon chain, from its API or from any other source.
|
||||
|
||||
531
proto/eth/v1/validator.pb.go
generated
531
proto/eth/v1/validator.pb.go
generated
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v3.15.8
|
||||
// protoc v4.23.3
|
||||
// source: proto/eth/v1/validator.proto
|
||||
|
||||
package v1
|
||||
@@ -875,155 +875,6 @@ func (x *ProduceAttestationDataResponse) GetData() *AttestationData {
|
||||
return nil
|
||||
}
|
||||
|
||||
type AggregateAttestationRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AttestationDataRoot []byte `protobuf:"bytes,1,opt,name=attestation_data_root,json=attestationDataRoot,proto3" json:"attestation_data_root,omitempty" ssz-size:"32"`
|
||||
Slot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,2,opt,name=slot,proto3" json:"slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"`
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationRequest) Reset() {
|
||||
*x = AggregateAttestationRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AggregateAttestationRequest) ProtoMessage() {}
|
||||
|
||||
func (x *AggregateAttestationRequest) ProtoReflect() protoreflect.Message {
|
||||
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 {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AggregateAttestationRequest.ProtoReflect.Descriptor instead.
|
||||
func (*AggregateAttestationRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationRequest) GetAttestationDataRoot() []byte {
|
||||
if x != nil {
|
||||
return x.AttestationDataRoot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationRequest) 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)
|
||||
}
|
||||
|
||||
type AggregateAttestationResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data *Attestation `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationResponse) Reset() {
|
||||
*x = AggregateAttestationResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AggregateAttestationResponse) ProtoMessage() {}
|
||||
|
||||
func (x *AggregateAttestationResponse) ProtoReflect() protoreflect.Message {
|
||||
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 {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AggregateAttestationResponse.ProtoReflect.Descriptor instead.
|
||||
func (*AggregateAttestationResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationResponse) GetData() *Attestation {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SubmitAggregateAndProofsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data []*SignedAggregateAttestationAndProof `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SubmitAggregateAndProofsRequest) Reset() {
|
||||
*x = SubmitAggregateAndProofsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SubmitAggregateAndProofsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SubmitAggregateAndProofsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SubmitAggregateAndProofsRequest) ProtoReflect() protoreflect.Message {
|
||||
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 {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SubmitAggregateAndProofsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SubmitAggregateAndProofsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *SubmitAggregateAndProofsRequest) GetData() []*SignedAggregateAttestationAndProof {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SubmitBeaconCommitteeSubscriptionsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -1035,7 +886,7 @@ type SubmitBeaconCommitteeSubscriptionsRequest struct {
|
||||
func (x *SubmitBeaconCommitteeSubscriptionsRequest) Reset() {
|
||||
*x = SubmitBeaconCommitteeSubscriptionsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[15]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1048,7 +899,7 @@ func (x *SubmitBeaconCommitteeSubscriptionsRequest) String() string {
|
||||
func (*SubmitBeaconCommitteeSubscriptionsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SubmitBeaconCommitteeSubscriptionsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[15]
|
||||
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 {
|
||||
@@ -1061,7 +912,7 @@ func (x *SubmitBeaconCommitteeSubscriptionsRequest) ProtoReflect() protoreflect.
|
||||
|
||||
// Deprecated: Use SubmitBeaconCommitteeSubscriptionsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SubmitBeaconCommitteeSubscriptionsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{15}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *SubmitBeaconCommitteeSubscriptionsRequest) GetData() []*BeaconCommitteeSubscribe {
|
||||
@@ -1086,7 +937,7 @@ type BeaconCommitteeSubscribe struct {
|
||||
func (x *BeaconCommitteeSubscribe) Reset() {
|
||||
*x = BeaconCommitteeSubscribe{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[16]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1099,7 +950,7 @@ func (x *BeaconCommitteeSubscribe) String() string {
|
||||
func (*BeaconCommitteeSubscribe) ProtoMessage() {}
|
||||
|
||||
func (x *BeaconCommitteeSubscribe) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[16]
|
||||
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 {
|
||||
@@ -1112,7 +963,7 @@ func (x *BeaconCommitteeSubscribe) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use BeaconCommitteeSubscribe.ProtoReflect.Descriptor instead.
|
||||
func (*BeaconCommitteeSubscribe) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{16}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *BeaconCommitteeSubscribe) GetValidatorIndex() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex {
|
||||
@@ -1161,7 +1012,7 @@ type PrepareBeaconProposerRequest struct {
|
||||
func (x *PrepareBeaconProposerRequest) Reset() {
|
||||
*x = PrepareBeaconProposerRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[17]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1174,7 +1025,7 @@ func (x *PrepareBeaconProposerRequest) String() string {
|
||||
func (*PrepareBeaconProposerRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PrepareBeaconProposerRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[17]
|
||||
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 {
|
||||
@@ -1187,7 +1038,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{17}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *PrepareBeaconProposerRequest) GetRecipients() []*PrepareBeaconProposerRequest_FeeRecipientContainer {
|
||||
@@ -1208,7 +1059,7 @@ type SubmitValidatorRegistrationsRequest struct {
|
||||
func (x *SubmitValidatorRegistrationsRequest) Reset() {
|
||||
*x = SubmitValidatorRegistrationsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[18]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[15]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1221,7 +1072,7 @@ func (x *SubmitValidatorRegistrationsRequest) String() string {
|
||||
func (*SubmitValidatorRegistrationsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[18]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[15]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1234,7 +1085,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{18}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{15}
|
||||
}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest) GetRegistrations() []*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration {
|
||||
@@ -1256,7 +1107,7 @@ type PrepareBeaconProposerRequest_FeeRecipientContainer struct {
|
||||
func (x *PrepareBeaconProposerRequest_FeeRecipientContainer) Reset() {
|
||||
*x = PrepareBeaconProposerRequest_FeeRecipientContainer{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[19]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[16]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1269,7 +1120,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[19]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[16]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1282,7 +1133,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{17, 0}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{14, 0}
|
||||
}
|
||||
|
||||
func (x *PrepareBeaconProposerRequest_FeeRecipientContainer) GetFeeRecipient() []byte {
|
||||
@@ -1313,7 +1164,7 @@ type SubmitValidatorRegistrationsRequest_ValidatorRegistration struct {
|
||||
func (x *SubmitValidatorRegistrationsRequest_ValidatorRegistration) Reset() {
|
||||
*x = SubmitValidatorRegistrationsRequest_ValidatorRegistration{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[20]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[17]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1326,7 +1177,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[20]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[17]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1339,7 +1190,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{18, 0}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{15, 0}
|
||||
}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest_ValidatorRegistration) GetFeeRecipient() []byte {
|
||||
@@ -1382,7 +1233,7 @@ type SubmitValidatorRegistrationsRequest_SignedValidatorRegistration struct {
|
||||
func (x *SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) Reset() {
|
||||
*x = SubmitValidatorRegistrationsRequest_SignedValidatorRegistration{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[21]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[18]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1395,7 +1246,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[21]
|
||||
mi := &file_proto_eth_v1_validator_proto_msgTypes[18]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1408,7 +1259,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{18, 1}
|
||||
return file_proto_eth_v1_validator_proto_rawDescGZIP(), []int{15, 1}
|
||||
}
|
||||
|
||||
func (x *SubmitValidatorRegistrationsRequest_SignedValidatorRegistration) GetMessage() *SubmitValidatorRegistrationsRequest_ValidatorRegistration {
|
||||
@@ -1634,141 +1485,118 @@ var file_proto_eth_v1_validator_proto_rawDesc = []byte{
|
||||
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, 0xb4, 0x01, 0x0a, 0x1b, 0x41, 0x67, 0x67, 0x72,
|
||||
0x65, 0x67, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x65, 0x73,
|
||||
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x72, 0x6f, 0x6f, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x13,
|
||||
0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52,
|
||||
0x6f, 0x6f, 0x74, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 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, 0x22, 0x50,
|
||||
0x0a, 0x1c, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73,
|
||||
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 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, 0x41,
|
||||
0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
||||
0x22, 0x6a, 0x0a, 0x1f, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67,
|
||||
0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x12, 0x47, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x33, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67,
|
||||
0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e,
|
||||
0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x6a, 0x0a, 0x29,
|
||||
0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d,
|
||||
0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x64, 0x61, 0x74,
|
||||
0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e,
|
||||
0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
|
||||
0x62, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xbc, 0x03, 0x0a, 0x18, 0x42, 0x65, 0x61,
|
||||
0x63, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73,
|
||||
0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x78, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 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, 0x12,
|
||||
0x78, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x69, 0x6e, 0x64,
|
||||
0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x6a, 0x0a, 0x29, 0x53, 0x75, 0x62, 0x6d, 0x69,
|
||||
0x74, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65,
|
||||
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69,
|
||||
0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x04, 0x64,
|
||||
0x61, 0x74, 0x61, 0x22, 0xbc, 0x03, 0x0a, 0x18, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x6f,
|
||||
0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65,
|
||||
0x12, 0x78, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x18, 0x01, 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, 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, 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, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65,
|
||||
0x65, 0x73, 0x5f, 0x61, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04,
|
||||
0x52, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x73, 0x41, 0x74, 0x53, 0x6c,
|
||||
0x6f, 0x74, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x04, 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, 0x23, 0x0a,
|
||||
0x0d, 0x69, 0x73, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74,
|
||||
0x6f, 0x72, 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, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65,
|
||||
0x73, 0x41, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18,
|
||||
0x04, 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, 0x23, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x41, 0x67, 0x67,
|
||||
0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 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,
|
||||
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,
|
||||
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, 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 (
|
||||
@@ -1784,7 +1612,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, 22)
|
||||
var file_proto_eth_v1_validator_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
|
||||
var file_proto_eth_v1_validator_proto_goTypes = []interface{}{
|
||||
(ValidatorStatus)(0), // 0: ethereum.eth.v1.ValidatorStatus
|
||||
(*ValidatorContainer)(nil), // 1: ethereum.eth.v1.ValidatorContainer
|
||||
@@ -1799,39 +1627,32 @@ var file_proto_eth_v1_validator_proto_goTypes = []interface{}{
|
||||
(*ProduceBlockResponse)(nil), // 10: ethereum.eth.v1.ProduceBlockResponse
|
||||
(*ProduceAttestationDataRequest)(nil), // 11: ethereum.eth.v1.ProduceAttestationDataRequest
|
||||
(*ProduceAttestationDataResponse)(nil), // 12: ethereum.eth.v1.ProduceAttestationDataResponse
|
||||
(*AggregateAttestationRequest)(nil), // 13: ethereum.eth.v1.AggregateAttestationRequest
|
||||
(*AggregateAttestationResponse)(nil), // 14: ethereum.eth.v1.AggregateAttestationResponse
|
||||
(*SubmitAggregateAndProofsRequest)(nil), // 15: ethereum.eth.v1.SubmitAggregateAndProofsRequest
|
||||
(*SubmitBeaconCommitteeSubscriptionsRequest)(nil), // 16: ethereum.eth.v1.SubmitBeaconCommitteeSubscriptionsRequest
|
||||
(*BeaconCommitteeSubscribe)(nil), // 17: ethereum.eth.v1.BeaconCommitteeSubscribe
|
||||
(*PrepareBeaconProposerRequest)(nil), // 18: ethereum.eth.v1.PrepareBeaconProposerRequest
|
||||
(*SubmitValidatorRegistrationsRequest)(nil), // 19: ethereum.eth.v1.SubmitValidatorRegistrationsRequest
|
||||
(*PrepareBeaconProposerRequest_FeeRecipientContainer)(nil), // 20: ethereum.eth.v1.PrepareBeaconProposerRequest.FeeRecipientContainer
|
||||
(*SubmitValidatorRegistrationsRequest_ValidatorRegistration)(nil), // 21: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.ValidatorRegistration
|
||||
(*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration)(nil), // 22: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration
|
||||
(*BeaconBlock)(nil), // 23: ethereum.eth.v1.BeaconBlock
|
||||
(*AttestationData)(nil), // 24: ethereum.eth.v1.AttestationData
|
||||
(*Attestation)(nil), // 25: ethereum.eth.v1.Attestation
|
||||
(*SignedAggregateAttestationAndProof)(nil), // 26: ethereum.eth.v1.SignedAggregateAttestationAndProof
|
||||
(*SubmitBeaconCommitteeSubscriptionsRequest)(nil), // 13: ethereum.eth.v1.SubmitBeaconCommitteeSubscriptionsRequest
|
||||
(*BeaconCommitteeSubscribe)(nil), // 14: ethereum.eth.v1.BeaconCommitteeSubscribe
|
||||
(*PrepareBeaconProposerRequest)(nil), // 15: ethereum.eth.v1.PrepareBeaconProposerRequest
|
||||
(*SubmitValidatorRegistrationsRequest)(nil), // 16: ethereum.eth.v1.SubmitValidatorRegistrationsRequest
|
||||
(*PrepareBeaconProposerRequest_FeeRecipientContainer)(nil), // 17: ethereum.eth.v1.PrepareBeaconProposerRequest.FeeRecipientContainer
|
||||
(*SubmitValidatorRegistrationsRequest_ValidatorRegistration)(nil), // 18: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.ValidatorRegistration
|
||||
(*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration)(nil), // 19: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration
|
||||
(*BeaconBlock)(nil), // 20: ethereum.eth.v1.BeaconBlock
|
||||
(*AttestationData)(nil), // 21: ethereum.eth.v1.AttestationData
|
||||
}
|
||||
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
|
||||
23, // 4: ethereum.eth.v1.ProduceBlockResponse.data:type_name -> ethereum.eth.v1.BeaconBlock
|
||||
24, // 5: ethereum.eth.v1.ProduceAttestationDataResponse.data:type_name -> ethereum.eth.v1.AttestationData
|
||||
25, // 6: ethereum.eth.v1.AggregateAttestationResponse.data:type_name -> ethereum.eth.v1.Attestation
|
||||
26, // 7: ethereum.eth.v1.SubmitAggregateAndProofsRequest.data:type_name -> ethereum.eth.v1.SignedAggregateAttestationAndProof
|
||||
17, // 8: ethereum.eth.v1.SubmitBeaconCommitteeSubscriptionsRequest.data:type_name -> ethereum.eth.v1.BeaconCommitteeSubscribe
|
||||
20, // 9: ethereum.eth.v1.PrepareBeaconProposerRequest.recipients:type_name -> ethereum.eth.v1.PrepareBeaconProposerRequest.FeeRecipientContainer
|
||||
22, // 10: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.registrations:type_name -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration
|
||||
21, // 11: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration.message:type_name -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest.ValidatorRegistration
|
||||
12, // [12:12] is the sub-list for method output_type
|
||||
12, // [12:12] is the sub-list for method input_type
|
||||
12, // [12:12] is the sub-list for extension type_name
|
||||
12, // [12:12] is the sub-list for extension extendee
|
||||
0, // [0:12] is the sub-list for field type_name
|
||||
20, // 4: ethereum.eth.v1.ProduceBlockResponse.data:type_name -> ethereum.eth.v1.BeaconBlock
|
||||
21, // 5: ethereum.eth.v1.ProduceAttestationDataResponse.data:type_name -> ethereum.eth.v1.AttestationData
|
||||
14, // 6: ethereum.eth.v1.SubmitBeaconCommitteeSubscriptionsRequest.data:type_name -> ethereum.eth.v1.BeaconCommitteeSubscribe
|
||||
17, // 7: ethereum.eth.v1.PrepareBeaconProposerRequest.recipients:type_name -> ethereum.eth.v1.PrepareBeaconProposerRequest.FeeRecipientContainer
|
||||
19, // 8: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.registrations:type_name -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration
|
||||
18, // 9: ethereum.eth.v1.SubmitValidatorRegistrationsRequest.SignedValidatorRegistration.message:type_name -> ethereum.eth.v1.SubmitValidatorRegistrationsRequest.ValidatorRegistration
|
||||
10, // [10:10] is the sub-list for method output_type
|
||||
10, // [10:10] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_eth_v1_validator_proto_init() }
|
||||
@@ -1987,42 +1808,6 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AggregateAttestationRequest); 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[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AggregateAttestationResponse); 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[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitAggregateAndProofsRequest); 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[15].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitBeaconCommitteeSubscriptionsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -2034,7 +1819,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[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*BeaconCommitteeSubscribe); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -2046,7 +1831,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[17].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.(*PrepareBeaconProposerRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -2058,7 +1843,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v1_validator_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitValidatorRegistrationsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -2070,7 +1855,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v1_validator_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PrepareBeaconProposerRequest_FeeRecipientContainer); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -2082,7 +1867,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v1_validator_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitValidatorRegistrationsRequest_ValidatorRegistration); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -2094,7 +1879,7 @@ func file_proto_eth_v1_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v1_validator_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v1_validator_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitValidatorRegistrationsRequest_SignedValidatorRegistration); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -2114,7 +1899,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: 22,
|
||||
NumMessages: 19,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -175,22 +175,6 @@ message ProduceAttestationDataResponse {
|
||||
AttestationData data = 1;
|
||||
}
|
||||
|
||||
message AggregateAttestationRequest {
|
||||
// The root of the attestation data requesting the aggregate for.
|
||||
bytes attestation_data_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// The slot for the requested aggregate attestation.
|
||||
uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message AggregateAttestationResponse {
|
||||
Attestation data = 1;
|
||||
}
|
||||
|
||||
message SubmitAggregateAndProofsRequest {
|
||||
repeated SignedAggregateAttestationAndProof data = 1;
|
||||
}
|
||||
|
||||
message SubmitBeaconCommitteeSubscriptionsRequest {
|
||||
repeated BeaconCommitteeSubscribe data = 1;
|
||||
}
|
||||
|
||||
278
proto/eth/v2/validator.pb.go
generated
278
proto/eth/v2/validator.pb.go
generated
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v3.15.8
|
||||
// protoc v4.23.3
|
||||
// source: proto/eth/v2/validator.proto
|
||||
|
||||
package eth
|
||||
@@ -606,53 +606,6 @@ func (x *SyncCommitteeContribution) GetSignature() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
type SubmitContributionAndProofsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data []*SignedContributionAndProof `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SubmitContributionAndProofsRequest) Reset() {
|
||||
*x = SubmitContributionAndProofsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SubmitContributionAndProofsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SubmitContributionAndProofsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SubmitContributionAndProofsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v2_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 SubmitContributionAndProofsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SubmitContributionAndProofsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *SubmitContributionAndProofsRequest) GetData() []*SignedContributionAndProof {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ContributionAndProof struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -666,7 +619,7 @@ type ContributionAndProof struct {
|
||||
func (x *ContributionAndProof) Reset() {
|
||||
*x = ContributionAndProof{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[11]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -679,7 +632,7 @@ func (x *ContributionAndProof) String() string {
|
||||
func (*ContributionAndProof) ProtoMessage() {}
|
||||
|
||||
func (x *ContributionAndProof) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[11]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[10]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -692,7 +645,7 @@ func (x *ContributionAndProof) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ContributionAndProof.ProtoReflect.Descriptor instead.
|
||||
func (*ContributionAndProof) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{11}
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *ContributionAndProof) GetAggregatorIndex() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex {
|
||||
@@ -728,7 +681,7 @@ type SignedContributionAndProof struct {
|
||||
func (x *SignedContributionAndProof) Reset() {
|
||||
*x = SignedContributionAndProof{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[12]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -741,7 +694,7 @@ func (x *SignedContributionAndProof) String() string {
|
||||
func (*SignedContributionAndProof) ProtoMessage() {}
|
||||
|
||||
func (x *SignedContributionAndProof) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[12]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[11]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -754,7 +707,7 @@ func (x *SignedContributionAndProof) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SignedContributionAndProof.ProtoReflect.Descriptor instead.
|
||||
func (*SignedContributionAndProof) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{12}
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *SignedContributionAndProof) GetMessage() *ContributionAndProof {
|
||||
@@ -783,7 +736,7 @@ type GetLivenessRequest struct {
|
||||
func (x *GetLivenessRequest) Reset() {
|
||||
*x = GetLivenessRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[13]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -796,7 +749,7 @@ func (x *GetLivenessRequest) String() string {
|
||||
func (*GetLivenessRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetLivenessRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[13]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[12]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -809,7 +762,7 @@ func (x *GetLivenessRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use GetLivenessRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetLivenessRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{13}
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *GetLivenessRequest) GetEpoch() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Epoch {
|
||||
@@ -837,7 +790,7 @@ type GetLivenessResponse struct {
|
||||
func (x *GetLivenessResponse) Reset() {
|
||||
*x = GetLivenessResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[14]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -850,7 +803,7 @@ func (x *GetLivenessResponse) String() string {
|
||||
func (*GetLivenessResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetLivenessResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[14]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[13]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -863,7 +816,7 @@ func (x *GetLivenessResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use GetLivenessResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetLivenessResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{14}
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *GetLivenessResponse) GetData() []*GetLivenessResponse_Liveness {
|
||||
@@ -885,7 +838,7 @@ type GetLivenessResponse_Liveness struct {
|
||||
func (x *GetLivenessResponse_Liveness) Reset() {
|
||||
*x = GetLivenessResponse_Liveness{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[15]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -898,7 +851,7 @@ func (x *GetLivenessResponse_Liveness) String() string {
|
||||
func (*GetLivenessResponse_Liveness) ProtoMessage() {}
|
||||
|
||||
func (x *GetLivenessResponse_Liveness) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[15]
|
||||
mi := &file_proto_eth_v2_validator_proto_msgTypes[14]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -911,7 +864,7 @@ func (x *GetLivenessResponse_Liveness) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use GetLivenessResponse_Liveness.ProtoReflect.Descriptor instead.
|
||||
func (*GetLivenessResponse_Liveness) Descriptor() ([]byte, []int) {
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{14, 0}
|
||||
return file_proto_eth_v2_validator_proto_rawDescGZIP(), []int{13, 0}
|
||||
}
|
||||
|
||||
func (x *GetLivenessResponse_Liveness) GetIndex() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex {
|
||||
@@ -1066,76 +1019,69 @@ var file_proto_eth_v2_validator_proto_rawDesc = []byte{
|
||||
0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x69, 0x74, 0x73, 0x12,
|
||||
0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e,
|
||||
0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x65, 0x0a, 0x22, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x43,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72,
|
||||
0x6f, 0x6f, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x64,
|
||||
0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x74, 0x68, 0x65,
|
||||
0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e,
|
||||
0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x93, 0x02, 0x0a,
|
||||
0x14, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64,
|
||||
0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x7a, 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 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, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65,
|
||||
0x78, 0x12, 0x4e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 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, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x2f, 0x0a, 0x0f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70,
|
||||
0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02,
|
||||
0x39, 0x36, 0x52, 0x0e, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f,
|
||||
0x6f, 0x66, 0x22, 0x83, 0x01, 0x0a, 0x1a, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f,
|
||||
0x66, 0x12, 0x3f, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09, 0x73,
|
||||
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xd9, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74,
|
||||
0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x5c, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46,
|
||||
0x82, 0xb5, 0x18, 0x42, 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, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x65, 0x0a,
|
||||
0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x03, 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, 0x05, 0x69,
|
||||
0x6e, 0x64, 0x65, 0x78, 0x22, 0xe5, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x76, 0x65,
|
||||
0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04,
|
||||
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 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,
|
||||
0x2e, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a,
|
||||
0x8a, 0x01, 0x0a, 0x08, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x65, 0x0a, 0x05,
|
||||
0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 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, 0x05, 0x69, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x4c, 0x69, 0x76, 0x65, 0x42, 0x7f, 0x0a, 0x13,
|
||||
0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x32, 0x42, 0x0e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x50, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 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, 0x32, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65,
|
||||
0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0f, 0x45, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x32, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x93, 0x02, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69,
|
||||
0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x7a,
|
||||
0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x18, 0x01, 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, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65,
|
||||
0x67, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x4e, 0x0a, 0x0c, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e,
|
||||
0x76, 0x32, 0x2e, 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, 0x0c, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x0f, 0x73, 0x65,
|
||||
0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x0e, 0x73, 0x65, 0x6c,
|
||||
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x83, 0x01, 0x0a, 0x1a,
|
||||
0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x3f, 0x0a, 0x07, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f,
|
||||
0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f,
|
||||
0x6f, 0x66, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x73,
|
||||
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06,
|
||||
0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72,
|
||||
0x65, 0x22, 0xd9, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x5c, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63,
|
||||
0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 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, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52,
|
||||
0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x65, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18,
|
||||
0x02, 0x20, 0x03, 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, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xe5, 0x01,
|
||||
0x0a, 0x13, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x2d, 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, 0x2e, 0x4c, 0x69, 0x76, 0x65, 0x6e, 0x65,
|
||||
0x73, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x8a, 0x01, 0x0a, 0x08, 0x4c, 0x69, 0x76,
|
||||
0x65, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x65, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01,
|
||||
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, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x17, 0x0a, 0x07,
|
||||
0x69, 0x73, 0x5f, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69,
|
||||
0x73, 0x4c, 0x69, 0x76, 0x65, 0x42, 0x7f, 0x0a, 0x13, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x32, 0x42, 0x0e, 0x56, 0x61,
|
||||
0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32,
|
||||
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, 0x32, 0x3b, 0x65,
|
||||
0x74, 0x68, 0xaa, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74,
|
||||
0x68, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c,
|
||||
0x45, 0x74, 0x68, 0x5c, 0x76, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -1150,7 +1096,7 @@ func file_proto_eth_v2_validator_proto_rawDescGZIP() []byte {
|
||||
return file_proto_eth_v2_validator_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_eth_v2_validator_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
|
||||
var file_proto_eth_v2_validator_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||
var file_proto_eth_v2_validator_proto_goTypes = []interface{}{
|
||||
(*SyncCommitteeDutiesRequest)(nil), // 0: ethereum.eth.v2.SyncCommitteeDutiesRequest
|
||||
(*SyncCommitteeDutiesResponse)(nil), // 1: ethereum.eth.v2.SyncCommitteeDutiesResponse
|
||||
@@ -1162,33 +1108,31 @@ var file_proto_eth_v2_validator_proto_goTypes = []interface{}{
|
||||
(*ProduceSyncCommitteeContributionRequest)(nil), // 7: ethereum.eth.v2.ProduceSyncCommitteeContributionRequest
|
||||
(*ProduceSyncCommitteeContributionResponse)(nil), // 8: ethereum.eth.v2.ProduceSyncCommitteeContributionResponse
|
||||
(*SyncCommitteeContribution)(nil), // 9: ethereum.eth.v2.SyncCommitteeContribution
|
||||
(*SubmitContributionAndProofsRequest)(nil), // 10: ethereum.eth.v2.SubmitContributionAndProofsRequest
|
||||
(*ContributionAndProof)(nil), // 11: ethereum.eth.v2.ContributionAndProof
|
||||
(*SignedContributionAndProof)(nil), // 12: ethereum.eth.v2.SignedContributionAndProof
|
||||
(*GetLivenessRequest)(nil), // 13: ethereum.eth.v2.GetLivenessRequest
|
||||
(*GetLivenessResponse)(nil), // 14: ethereum.eth.v2.GetLivenessResponse
|
||||
(*GetLivenessResponse_Liveness)(nil), // 15: ethereum.eth.v2.GetLivenessResponse.Liveness
|
||||
(Version)(0), // 16: ethereum.eth.v2.Version
|
||||
(*BeaconBlockContainerV2)(nil), // 17: ethereum.eth.v2.BeaconBlockContainerV2
|
||||
(*BlindedBeaconBlockContainer)(nil), // 18: ethereum.eth.v2.BlindedBeaconBlockContainer
|
||||
(*ContributionAndProof)(nil), // 10: ethereum.eth.v2.ContributionAndProof
|
||||
(*SignedContributionAndProof)(nil), // 11: ethereum.eth.v2.SignedContributionAndProof
|
||||
(*GetLivenessRequest)(nil), // 12: ethereum.eth.v2.GetLivenessRequest
|
||||
(*GetLivenessResponse)(nil), // 13: ethereum.eth.v2.GetLivenessResponse
|
||||
(*GetLivenessResponse_Liveness)(nil), // 14: ethereum.eth.v2.GetLivenessResponse.Liveness
|
||||
(Version)(0), // 15: ethereum.eth.v2.Version
|
||||
(*BeaconBlockContainerV2)(nil), // 16: ethereum.eth.v2.BeaconBlockContainerV2
|
||||
(*BlindedBeaconBlockContainer)(nil), // 17: ethereum.eth.v2.BlindedBeaconBlockContainer
|
||||
}
|
||||
var file_proto_eth_v2_validator_proto_depIdxs = []int32{
|
||||
2, // 0: ethereum.eth.v2.SyncCommitteeDutiesResponse.data:type_name -> ethereum.eth.v2.SyncCommitteeDuty
|
||||
16, // 1: ethereum.eth.v2.ProduceBlockResponseV2.version:type_name -> ethereum.eth.v2.Version
|
||||
17, // 2: ethereum.eth.v2.ProduceBlockResponseV2.data:type_name -> ethereum.eth.v2.BeaconBlockContainerV2
|
||||
16, // 3: ethereum.eth.v2.ProduceBlindedBlockResponse.version:type_name -> ethereum.eth.v2.Version
|
||||
18, // 4: ethereum.eth.v2.ProduceBlindedBlockResponse.data:type_name -> ethereum.eth.v2.BlindedBeaconBlockContainer
|
||||
15, // 1: ethereum.eth.v2.ProduceBlockResponseV2.version:type_name -> ethereum.eth.v2.Version
|
||||
16, // 2: ethereum.eth.v2.ProduceBlockResponseV2.data:type_name -> ethereum.eth.v2.BeaconBlockContainerV2
|
||||
15, // 3: ethereum.eth.v2.ProduceBlindedBlockResponse.version:type_name -> ethereum.eth.v2.Version
|
||||
17, // 4: ethereum.eth.v2.ProduceBlindedBlockResponse.data:type_name -> ethereum.eth.v2.BlindedBeaconBlockContainer
|
||||
6, // 5: ethereum.eth.v2.SubmitSyncCommitteeSubscriptionsRequest.data:type_name -> ethereum.eth.v2.SyncCommitteeSubscription
|
||||
9, // 6: ethereum.eth.v2.ProduceSyncCommitteeContributionResponse.data:type_name -> ethereum.eth.v2.SyncCommitteeContribution
|
||||
12, // 7: ethereum.eth.v2.SubmitContributionAndProofsRequest.data:type_name -> ethereum.eth.v2.SignedContributionAndProof
|
||||
9, // 8: ethereum.eth.v2.ContributionAndProof.contribution:type_name -> ethereum.eth.v2.SyncCommitteeContribution
|
||||
11, // 9: ethereum.eth.v2.SignedContributionAndProof.message:type_name -> ethereum.eth.v2.ContributionAndProof
|
||||
15, // 10: ethereum.eth.v2.GetLivenessResponse.data:type_name -> ethereum.eth.v2.GetLivenessResponse.Liveness
|
||||
11, // [11:11] is the sub-list for method output_type
|
||||
11, // [11:11] is the sub-list for method input_type
|
||||
11, // [11:11] is the sub-list for extension type_name
|
||||
11, // [11:11] is the sub-list for extension extendee
|
||||
0, // [0:11] is the sub-list for field type_name
|
||||
9, // 7: ethereum.eth.v2.ContributionAndProof.contribution:type_name -> ethereum.eth.v2.SyncCommitteeContribution
|
||||
10, // 8: ethereum.eth.v2.SignedContributionAndProof.message:type_name -> ethereum.eth.v2.ContributionAndProof
|
||||
14, // 9: ethereum.eth.v2.GetLivenessResponse.data:type_name -> ethereum.eth.v2.GetLivenessResponse.Liveness
|
||||
10, // [10:10] is the sub-list for method output_type
|
||||
10, // [10:10] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_eth_v2_validator_proto_init() }
|
||||
@@ -1320,18 +1264,6 @@ func file_proto_eth_v2_validator_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_eth_v2_validator_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SubmitContributionAndProofsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v2_validator_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ContributionAndProof); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1343,7 +1275,7 @@ func file_proto_eth_v2_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v2_validator_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v2_validator_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignedContributionAndProof); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1355,7 +1287,7 @@ func file_proto_eth_v2_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v2_validator_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v2_validator_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetLivenessRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1367,7 +1299,7 @@ func file_proto_eth_v2_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v2_validator_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v2_validator_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetLivenessResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1379,7 +1311,7 @@ func file_proto_eth_v2_validator_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_eth_v2_validator_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_proto_eth_v2_validator_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetLivenessResponse_Liveness); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1398,7 +1330,7 @@ func file_proto_eth_v2_validator_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_eth_v2_validator_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 16,
|
||||
NumMessages: 15,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -109,10 +109,6 @@ message SyncCommitteeContribution {
|
||||
bytes signature = 5 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message SubmitContributionAndProofsRequest {
|
||||
repeated SignedContributionAndProof data = 1;
|
||||
}
|
||||
|
||||
// Aggregated sync committee signature object with selection proof to support light client.
|
||||
message ContributionAndProof {
|
||||
// Index of the aggregator that produced this proof.
|
||||
|
||||
@@ -38,9 +38,6 @@ import (
|
||||
// signature=attestation.signature,
|
||||
// )
|
||||
func ConvertToIndexed(ctx context.Context, attestation *ethpb.Attestation, committee []primitives.ValidatorIndex) (*ethpb.IndexedAttestation, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "attestationutil.ConvertToIndexed")
|
||||
defer span.End()
|
||||
|
||||
attIndices, err := AttestingIndices(attestation.AggregationBits, committee)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -8,6 +8,7 @@ go_test(
|
||||
"attester_slashing_test.go",
|
||||
"block_header_test.go",
|
||||
"deposit_test.go",
|
||||
"execution_payload_test.go",
|
||||
"proposer_slashing_test.go",
|
||||
"sync_committee_test.go",
|
||||
"voluntary_exit_test.go",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/spectest/shared/bellatrix/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Bellatrix_Operations_PayloadExecution(t *testing.T) {
|
||||
operations.RunExecutionPayloadTest(t, "mainnet")
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user