mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-30 07:38:09 -05:00
Compare commits
22 Commits
debug-stat
...
fcTesting2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ffccc9c98 | ||
|
|
1b915b51b0 | ||
|
|
d35461affd | ||
|
|
ee159f3380 | ||
|
|
6b3d18cb77 | ||
|
|
07955c891b | ||
|
|
cf0505b8db | ||
|
|
3a9764d3af | ||
|
|
d1d3edc7fe | ||
|
|
bd0d7478b3 | ||
|
|
b6a1da21f4 | ||
|
|
180058ed48 | ||
|
|
f7a567d1d3 | ||
|
|
6d02c9ae12 | ||
|
|
6c2e6ca855 | ||
|
|
fbdccf8055 | ||
|
|
83cfe11ca0 | ||
|
|
135e9f51ec | ||
|
|
d33c1974da | ||
|
|
88a2e3d953 | ||
|
|
cea42a4b7d | ||
|
|
9971d71bc5 |
@@ -71,7 +71,6 @@ func (s *Service) notifyForkchoiceUpdate(ctx context.Context, arg *notifyForkcho
|
|||||||
|
|
||||||
nextSlot := s.CurrentSlot() + 1 // Cache payload ID for next slot proposer.
|
nextSlot := s.CurrentSlot() + 1 // Cache payload ID for next slot proposer.
|
||||||
hasAttr, attr, proposerId := s.getPayloadAttribute(ctx, arg.headState, nextSlot, arg.headRoot[:])
|
hasAttr, attr, proposerId := s.getPayloadAttribute(ctx, arg.headState, nextSlot, arg.headRoot[:])
|
||||||
|
|
||||||
payloadID, lastValidHash, err := s.cfg.ExecutionEngineCaller.ForkchoiceUpdated(ctx, fcs, attr)
|
payloadID, lastValidHash, err := s.cfg.ExecutionEngineCaller.ForkchoiceUpdated(ctx, fcs, attr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
|
|||||||
@@ -501,7 +501,28 @@ func (s *Service) handleEpochBoundary(ctx context.Context, postState state.Beaco
|
|||||||
if err := helpers.UpdateProposerIndicesInCache(ctx, copied); err != nil {
|
if err := helpers.UpdateProposerIndicesInCache(ctx, copied); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if s.nextEpochBoundarySlot != 0 {
|
||||||
|
ep := slots.ToEpoch(s.nextEpochBoundarySlot)
|
||||||
|
_, nextProposerIndexToSlots, err := helpers.CommitteeAssignments(ctx, copied, ep)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for k, v := range nextProposerIndexToSlots {
|
||||||
|
s.cfg.ProposerSlotIndexCache.SetProposerAndPayloadIDs(v[0], k, [8]byte{}, [32]byte{})
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if postState.Slot() >= s.nextEpochBoundarySlot {
|
} else if postState.Slot() >= s.nextEpochBoundarySlot {
|
||||||
|
postState = postState.Copy()
|
||||||
|
if s.nextEpochBoundarySlot != 0 {
|
||||||
|
ep := slots.ToEpoch(s.nextEpochBoundarySlot)
|
||||||
|
_, nextProposerIndexToSlots, err := helpers.CommitteeAssignments(ctx, postState, ep)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for k, v := range nextProposerIndexToSlots {
|
||||||
|
s.cfg.ProposerSlotIndexCache.SetProposerAndPayloadIDs(v[0], k, [8]byte{}, [32]byte{})
|
||||||
|
}
|
||||||
|
}
|
||||||
s.nextEpochBoundarySlot, err = slots.EpochStart(coreTime.NextEpoch(postState))
|
s.nextEpochBoundarySlot, err = slots.EpochStart(coreTime.NextEpoch(postState))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -94,8 +94,10 @@ func (s *Service) spawnProcessAttestationsRoutine() {
|
|||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
return
|
return
|
||||||
case <-pat.C():
|
case <-pat.C():
|
||||||
|
log.Infof("proposer_mocker: calling updated head via offset ticker")
|
||||||
s.UpdateHead(s.ctx, s.CurrentSlot()+1)
|
s.UpdateHead(s.ctx, s.CurrentSlot()+1)
|
||||||
case <-st.C():
|
case <-st.C():
|
||||||
|
log.Infof("proposer_mocker: calling updated head via normal slot ticker in spawn atts")
|
||||||
s.cfg.ForkChoiceStore.Lock()
|
s.cfg.ForkChoiceStore.Lock()
|
||||||
if err := s.cfg.ForkChoiceStore.NewSlot(s.ctx, s.CurrentSlot()); err != nil {
|
if err := s.cfg.ForkChoiceStore.NewSlot(s.ctx, s.CurrentSlot()); err != nil {
|
||||||
log.WithError(err).Error("could not process new slot")
|
log.WithError(err).Error("could not process new slot")
|
||||||
@@ -124,6 +126,8 @@ func (s *Service) UpdateHead(ctx context.Context, proposingSlot primitives.Slot)
|
|||||||
}
|
}
|
||||||
s.processAttestations(ctx, disparity)
|
s.processAttestations(ctx, disparity)
|
||||||
|
|
||||||
|
log.Infof("proposer_mocker: process attestations in fc took %s", time.Since(start).String())
|
||||||
|
|
||||||
processAttsElapsedTime.Observe(float64(time.Since(start).Milliseconds()))
|
processAttsElapsedTime.Observe(float64(time.Since(start).Milliseconds()))
|
||||||
|
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
@@ -136,11 +140,14 @@ func (s *Service) UpdateHead(ctx context.Context, proposingSlot primitives.Slot)
|
|||||||
s.headLock.RUnlock()
|
s.headLock.RUnlock()
|
||||||
}
|
}
|
||||||
newAttHeadElapsedTime.Observe(float64(time.Since(start).Milliseconds()))
|
newAttHeadElapsedTime.Observe(float64(time.Since(start).Milliseconds()))
|
||||||
|
log.Infof("proposer_mocker: head root in fc took %s", time.Since(start).String())
|
||||||
|
|
||||||
changed, err := s.forkchoiceUpdateWithExecution(s.ctx, newHeadRoot, proposingSlot)
|
changed, err := s.forkchoiceUpdateWithExecution(s.ctx, newHeadRoot, proposingSlot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Error("could not update forkchoice")
|
log.WithError(err).Error("could not update forkchoice")
|
||||||
}
|
}
|
||||||
|
log.Infof("proposer_mocker: fcu call in fc took %s", time.Since(start).String())
|
||||||
|
|
||||||
if changed {
|
if changed {
|
||||||
s.headLock.RLock()
|
s.headLock.RLock()
|
||||||
log.WithFields(logrus.Fields{
|
log.WithFields(logrus.Fields{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func New() *ForkChoice {
|
|||||||
|
|
||||||
b := make([]uint64, 0)
|
b := make([]uint64, 0)
|
||||||
v := make([]Vote, 0)
|
v := make([]Vote, 0)
|
||||||
return &ForkChoice{store: s, balances: b, votes: v}
|
return &ForkChoice{store: s, balances: b, votes: v, fcLock: new(fcLock)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeCount returns the current number of nodes in the Store.
|
// NodeCount returns the current number of nodes in the Store.
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package doublylinkedtree
|
package doublylinkedtree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"runtime/debug"
|
||||||
|
"runtime/pprof"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/forkchoice"
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/forkchoice"
|
||||||
forkchoicetypes "github.com/prysmaticlabs/prysm/v4/beacon-chain/forkchoice/types"
|
forkchoicetypes "github.com/prysmaticlabs/prysm/v4/beacon-chain/forkchoice/types"
|
||||||
@@ -11,7 +15,7 @@ import (
|
|||||||
|
|
||||||
// ForkChoice defines the overall fork choice store which includes all block nodes, validator's latest votes and balances.
|
// ForkChoice defines the overall fork choice store which includes all block nodes, validator's latest votes and balances.
|
||||||
type ForkChoice struct {
|
type ForkChoice struct {
|
||||||
sync.RWMutex
|
*fcLock
|
||||||
store *Store
|
store *Store
|
||||||
votes []Vote // tracks individual validator's last vote.
|
votes []Vote // tracks individual validator's last vote.
|
||||||
balances []uint64 // tracks individual validator's balances last accounted in votes.
|
balances []uint64 // tracks individual validator's balances last accounted in votes.
|
||||||
@@ -68,3 +72,52 @@ type Vote struct {
|
|||||||
nextRoot [fieldparams.RootLength]byte // next voting root.
|
nextRoot [fieldparams.RootLength]byte // next voting root.
|
||||||
nextEpoch primitives.Epoch // epoch of next voting period.
|
nextEpoch primitives.Epoch // epoch of next voting period.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type fcLock struct {
|
||||||
|
lk sync.RWMutex
|
||||||
|
t time.Time
|
||||||
|
currChan chan int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *fcLock) Lock() {
|
||||||
|
f.lk.Lock()
|
||||||
|
f.t = time.Now()
|
||||||
|
f.currChan = make(chan int)
|
||||||
|
go func(t time.Time, c chan int) {
|
||||||
|
tim := time.NewTimer(3 * time.Second)
|
||||||
|
select {
|
||||||
|
case <-c:
|
||||||
|
tim.Stop()
|
||||||
|
case <-tim.C:
|
||||||
|
tim.Stop()
|
||||||
|
pfile := pprof.Lookup("goroutine")
|
||||||
|
bf := bytes.NewBuffer([]byte{})
|
||||||
|
err := pfile.WriteTo(bf, 1)
|
||||||
|
_ = err
|
||||||
|
log.Warnf("FC lock is taking longer than 3 seconds with the complete stack of %s", bf.String())
|
||||||
|
}
|
||||||
|
}(time.Now(), f.currChan)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *fcLock) Unlock() {
|
||||||
|
t := time.Since(f.t)
|
||||||
|
f.t = time.Time{}
|
||||||
|
close(f.currChan)
|
||||||
|
f.lk.Unlock()
|
||||||
|
if t > time.Second {
|
||||||
|
log.Warnf("FC lock is taking longer than 1 second: %s with the complete stack of %s", t.String(), string(debug.Stack()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *fcLock) RLock() {
|
||||||
|
t := time.Now()
|
||||||
|
f.lk.RLock()
|
||||||
|
dt := time.Since(t)
|
||||||
|
if dt > time.Second {
|
||||||
|
log.Warnf("FC Rlock is taking longer than 1 second: %s with stack %s", dt.String(), string(debug.Stack()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *fcLock) RUnlock() {
|
||||||
|
f.lk.RUnlock()
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,13 +63,16 @@ func (vs *Server) GetBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (
|
|||||||
return nil, status.Error(codes.Unavailable, "Syncing to latest head, not ready to respond")
|
return nil, status.Error(codes.Unavailable, "Syncing to latest head, not ready to respond")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curr := time.Now()
|
||||||
// process attestations and update head in forkchoice
|
// process attestations and update head in forkchoice
|
||||||
vs.ForkchoiceFetcher.UpdateHead(ctx, vs.TimeFetcher.CurrentSlot())
|
vs.ForkchoiceFetcher.UpdateHead(ctx, vs.TimeFetcher.CurrentSlot())
|
||||||
|
log.Infof("proposer_mocker: update head in rpc took %s", time.Since(curr).String())
|
||||||
headRoot := vs.ForkchoiceFetcher.CachedHeadRoot()
|
headRoot := vs.ForkchoiceFetcher.CachedHeadRoot()
|
||||||
parentRoot := vs.ForkchoiceFetcher.GetProposerHead()
|
parentRoot := vs.ForkchoiceFetcher.GetProposerHead()
|
||||||
if parentRoot != headRoot {
|
if parentRoot != headRoot {
|
||||||
blockchain.LateBlockAttemptedReorgCount.Inc()
|
blockchain.LateBlockAttemptedReorgCount.Inc()
|
||||||
}
|
}
|
||||||
|
log.Infof("proposer_mocker: fetching head root in rpc took %s", time.Since(curr).String())
|
||||||
|
|
||||||
// An optimistic validator MUST NOT produce a block (i.e., sign across the DOMAIN_BEACON_PROPOSER domain).
|
// An optimistic validator MUST NOT produce a block (i.e., sign across the DOMAIN_BEACON_PROPOSER domain).
|
||||||
if slots.ToEpoch(req.Slot) >= params.BeaconConfig().BellatrixForkEpoch {
|
if slots.ToEpoch(req.Slot) >= params.BeaconConfig().BellatrixForkEpoch {
|
||||||
@@ -90,6 +93,7 @@ func (vs *Server) GetBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "Could not process slots up to %d: %v", req.Slot, err)
|
return nil, status.Errorf(codes.Internal, "Could not process slots up to %d: %v", req.Slot, err)
|
||||||
}
|
}
|
||||||
|
log.Infof("proposer_mocker: fetching head state rpc took %s", time.Since(curr).String())
|
||||||
|
|
||||||
// Set slot, graffiti, randao reveal, and parent root.
|
// Set slot, graffiti, randao reveal, and parent root.
|
||||||
sBlk.SetSlot(req.Slot)
|
sBlk.SetSlot(req.Slot)
|
||||||
@@ -103,9 +107,10 @@ func (vs *Server) GetBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (
|
|||||||
return nil, fmt.Errorf("could not calculate proposer index %v", err)
|
return nil, fmt.Errorf("could not calculate proposer index %v", err)
|
||||||
}
|
}
|
||||||
sBlk.SetProposerIndex(idx)
|
sBlk.SetProposerIndex(idx)
|
||||||
|
log.Infof("proposer_mocker: setting proposer index took %s", time.Since(curr).String())
|
||||||
|
|
||||||
if features.Get().BuildBlockParallel {
|
if features.Get().BuildBlockParallel {
|
||||||
if err := vs.BuildBlockParallel(ctx, sBlk, head); err != nil {
|
if err := vs.BuildBlockParallel(ctx, sBlk, head, curr); err != nil {
|
||||||
return nil, errors.Wrap(err, "could not build block in parallel")
|
return nil, errors.Wrap(err, "could not build block in parallel")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -191,7 +196,7 @@ func (vs *Server) GetBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (
|
|||||||
return ðpb.GenericBeaconBlock{Block: ðpb.GenericBeaconBlock_Phase0{Phase0: pb.(*ethpb.BeaconBlock)}}, nil
|
return ðpb.GenericBeaconBlock{Block: ðpb.GenericBeaconBlock_Phase0{Phase0: pb.(*ethpb.BeaconBlock)}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (vs *Server) BuildBlockParallel(ctx context.Context, sBlk interfaces.SignedBeaconBlock, head state.BeaconState) error {
|
func (vs *Server) BuildBlockParallel(ctx context.Context, sBlk interfaces.SignedBeaconBlock, head state.BeaconState, curr time.Time) error {
|
||||||
// Build consensus fields in background
|
// Build consensus fields in background
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
@@ -205,6 +210,7 @@ func (vs *Server) BuildBlockParallel(ctx context.Context, sBlk interfaces.Signed
|
|||||||
log.WithError(err).Error("Could not get eth1data")
|
log.WithError(err).Error("Could not get eth1data")
|
||||||
}
|
}
|
||||||
sBlk.SetEth1Data(eth1Data)
|
sBlk.SetEth1Data(eth1Data)
|
||||||
|
log.Infof("proposer_mocker: setting eth1data took %s", time.Since(curr).String())
|
||||||
|
|
||||||
// Set deposit and attestation.
|
// Set deposit and attestation.
|
||||||
deposits, atts, err := vs.packDepositsAndAttestations(ctx, head, eth1Data) // TODO: split attestations and deposits
|
deposits, atts, err := vs.packDepositsAndAttestations(ctx, head, eth1Data) // TODO: split attestations and deposits
|
||||||
@@ -216,20 +222,26 @@ func (vs *Server) BuildBlockParallel(ctx context.Context, sBlk interfaces.Signed
|
|||||||
sBlk.SetDeposits(deposits)
|
sBlk.SetDeposits(deposits)
|
||||||
sBlk.SetAttestations(atts)
|
sBlk.SetAttestations(atts)
|
||||||
}
|
}
|
||||||
|
log.Infof("proposer_mocker: setting deposits and atts took %s", time.Since(curr).String())
|
||||||
|
|
||||||
// Set slashings.
|
// Set slashings.
|
||||||
validProposerSlashings, validAttSlashings := vs.getSlashings(ctx, head)
|
validProposerSlashings, validAttSlashings := vs.getSlashings(ctx, head)
|
||||||
sBlk.SetProposerSlashings(validProposerSlashings)
|
sBlk.SetProposerSlashings(validProposerSlashings)
|
||||||
sBlk.SetAttesterSlashings(validAttSlashings)
|
sBlk.SetAttesterSlashings(validAttSlashings)
|
||||||
|
log.Infof("proposer_mocker: setting slashings took %s", time.Since(curr).String())
|
||||||
|
|
||||||
// Set exits.
|
// Set exits.
|
||||||
sBlk.SetVoluntaryExits(vs.getExits(head, sBlk.Block().Slot()))
|
sBlk.SetVoluntaryExits(vs.getExits(head, sBlk.Block().Slot()))
|
||||||
|
log.Infof("proposer_mocker: setting exits took %s", time.Since(curr).String())
|
||||||
|
|
||||||
// Set sync aggregate. New in Altair.
|
// Set sync aggregate. New in Altair.
|
||||||
vs.setSyncAggregate(ctx, sBlk)
|
vs.setSyncAggregate(ctx, sBlk)
|
||||||
|
log.Infof("proposer_mocker: setting sync aggs took %s", time.Since(curr).String())
|
||||||
|
|
||||||
// Set bls to execution change. New in Capella.
|
// Set bls to execution change. New in Capella.
|
||||||
vs.setBlsToExecData(sBlk, head)
|
vs.setBlsToExecData(sBlk, head)
|
||||||
|
log.Infof("proposer_mocker: setting bls data took %s", time.Since(curr).String())
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
localPayload, err := vs.getLocalPayload(ctx, sBlk.Block(), head)
|
localPayload, err := vs.getLocalPayload(ctx, sBlk.Block(), head)
|
||||||
@@ -246,6 +258,7 @@ func (vs *Server) BuildBlockParallel(ctx context.Context, sBlk interfaces.Signed
|
|||||||
if err := setExecutionData(ctx, sBlk, localPayload, builderPayload); err != nil {
|
if err := setExecutionData(ctx, sBlk, localPayload, builderPayload); err != nil {
|
||||||
return status.Errorf(codes.Internal, "Could not set execution data: %v", err)
|
return status.Errorf(codes.Internal, "Could not set execution data: %v", err)
|
||||||
}
|
}
|
||||||
|
log.Infof("proposer_mocker: setting execution data took %s", time.Since(curr).String())
|
||||||
|
|
||||||
wg.Wait() // Wait until block is built via consensus and execution fields.
|
wg.Wait() // Wait until block is built via consensus and execution fields.
|
||||||
|
|
||||||
@@ -392,10 +405,12 @@ func (vs *Server) proposeGenericBeaconBlock(ctx context.Context, blk interfaces.
|
|||||||
// computeStateRoot computes the state root after a block has been processed through a state transition and
|
// computeStateRoot computes the state root after a block has been processed through a state transition and
|
||||||
// returns it to the validator client.
|
// returns it to the validator client.
|
||||||
func (vs *Server) computeStateRoot(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
func (vs *Server) computeStateRoot(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||||
|
curr := time.Now()
|
||||||
beaconState, err := vs.StateGen.StateByRoot(ctx, block.Block().ParentRoot())
|
beaconState, err := vs.StateGen.StateByRoot(ctx, block.Block().ParentRoot())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "could not retrieve beacon state")
|
return nil, errors.Wrap(err, "could not retrieve beacon state")
|
||||||
}
|
}
|
||||||
|
log.Infof("proposer_mocker: fetching parent state took %s", time.Since(curr).String())
|
||||||
root, err := transition.CalculateStateRoot(
|
root, err := transition.CalculateStateRoot(
|
||||||
ctx,
|
ctx,
|
||||||
beaconState,
|
beaconState,
|
||||||
@@ -404,6 +419,7 @@ func (vs *Server) computeStateRoot(ctx context.Context, block interfaces.ReadOnl
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "could not calculate state root at slot %d", beaconState.Slot())
|
return nil, errors.Wrapf(err, "could not calculate state root at slot %d", beaconState.Slot())
|
||||||
}
|
}
|
||||||
|
log.Infof("proposer_mocker: calculating state root took %s", time.Since(curr).String())
|
||||||
|
|
||||||
log.WithField("beaconStateRoot", fmt.Sprintf("%#x", root)).Debugf("Computed state root")
|
log.WithField("beaconStateRoot", fmt.Sprintf("%#x", root)).Debugf("Computed state root")
|
||||||
return root[:], nil
|
return root[:], nil
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import (
|
|||||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||||
"github.com/prysmaticlabs/prysm/v4/network/forks"
|
"github.com/prysmaticlabs/prysm/v4/network/forks"
|
||||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||||
|
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
"google.golang.org/protobuf/types/known/emptypb"
|
"google.golang.org/protobuf/types/known/emptypb"
|
||||||
@@ -184,3 +185,32 @@ func (vs *Server) WaitForChainStart(_ *emptypb.Empty, stream ethpb.BeaconNodeVal
|
|||||||
}
|
}
|
||||||
return stream.Send(res)
|
return stream.Send(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (vs *Server) RandomStuff() {
|
||||||
|
for vs.TimeFetcher.GenesisTime().IsZero() {
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
}
|
||||||
|
genTime := vs.TimeFetcher.GenesisTime()
|
||||||
|
|
||||||
|
ticker := slots.NewSlotTicker(genTime, params.BeaconConfig().SecondsPerSlot)
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-vs.Ctx.Done():
|
||||||
|
ticker.Done()
|
||||||
|
return
|
||||||
|
case slot := <-ticker.C():
|
||||||
|
curr := time.Now()
|
||||||
|
_, err := vs.GetBeaconBlock(context.Background(), ðpb.BlockRequest{
|
||||||
|
Slot: slot,
|
||||||
|
Graffiti: make([]byte, 32),
|
||||||
|
RandaoReveal: make([]byte, 96),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Infof("proposer_mocker: successfully produced block %d in %s", slot, time.Since(curr).String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ func (s *Service) Start() {
|
|||||||
BLSChangesPool: s.cfg.BLSChangesPool,
|
BLSChangesPool: s.cfg.BLSChangesPool,
|
||||||
ClockWaiter: s.cfg.ClockWaiter,
|
ClockWaiter: s.cfg.ClockWaiter,
|
||||||
}
|
}
|
||||||
|
go validatorServer.RandomStuff()
|
||||||
validatorServerV1 := &validator.Server{
|
validatorServerV1 := &validator.Server{
|
||||||
HeadFetcher: s.cfg.HeadFetcher,
|
HeadFetcher: s.cfg.HeadFetcher,
|
||||||
TimeFetcher: s.cfg.GenesisTimeFetcher,
|
TimeFetcher: s.cfg.GenesisTimeFetcher,
|
||||||
|
|||||||
@@ -65,10 +65,7 @@ container_image(
|
|||||||
container_bundle(
|
container_bundle(
|
||||||
name = "image_bundle",
|
name = "image_bundle",
|
||||||
images = {
|
images = {
|
||||||
"gcr.io/prysmaticlabs/prysm/beacon-chain:latest": ":image_with_creation_time",
|
"gcr.io/prysmaticlabs/prysm/beacon-chain:fcTesting": ":image_with_creation_time",
|
||||||
"gcr.io/prysmaticlabs/prysm/beacon-chain:{DOCKER_TAG}": ":image_with_creation_time",
|
|
||||||
"index.docker.io/prysmaticlabs/prysm-beacon-chain:latest": ":image_with_creation_time",
|
|
||||||
"index.docker.io/prysmaticlabs/prysm-beacon-chain:{DOCKER_TAG}": ":image_with_creation_time",
|
|
||||||
},
|
},
|
||||||
tags = ["manual"],
|
tags = ["manual"],
|
||||||
visibility = ["//beacon-chain:__pkg__"],
|
visibility = ["//beacon-chain:__pkg__"],
|
||||||
@@ -119,20 +116,6 @@ docker_push(
|
|||||||
visibility = ["//beacon-chain:__pkg__"],
|
visibility = ["//beacon-chain:__pkg__"],
|
||||||
)
|
)
|
||||||
|
|
||||||
docker_push(
|
|
||||||
name = "push_images_debug",
|
|
||||||
bundle = ":image_bundle_debug",
|
|
||||||
tags = ["manual"],
|
|
||||||
visibility = ["//beacon-chain:__pkg__"],
|
|
||||||
)
|
|
||||||
|
|
||||||
docker_push(
|
|
||||||
name = "push_images_alpine",
|
|
||||||
bundle = ":image_bundle_alpine",
|
|
||||||
tags = ["manual"],
|
|
||||||
visibility = ["//beacon-chain:__pkg__"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_binary(
|
go_binary(
|
||||||
name = "beacon-chain",
|
name = "beacon-chain",
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
|
|||||||
Reference in New Issue
Block a user