Skip to content

Commit

Permalink
add log message if in da check at slot end
Browse files Browse the repository at this point in the history
  • Loading branch information
kasey committed Mar 20, 2024
1 parent 27ecf44 commit 4749b18
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions beacon-chain/blockchain/process_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"

"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/blocks"
Expand Down Expand Up @@ -558,6 +559,17 @@ func (s *Service) isDataAvailable(ctx context.Context, root [32]byte, signed int
// The gossip handler for blobs writes the index of each verified blob referencing the given
// root to the channel returned by blobNotifiers.forRoot.
nc := s.blobNotifiers.forRoot(root)
nextSlot := slots.BeginsAt(signed.Block().Slot()+1, s.genesisTime)
// Avoid underflow if Now is somehow after the next slot start.
nextSlotDur := time.Duration(0)
if nextSlot.After(time.Now()) {
nextSlotDur = time.Until(nextSlot)
} else {
log.WithFields(daCheckLogFields(root, signed, expected, len(missing))).
Error("DA check started after slot end")
}
slotEnd := time.NewTimer(nextSlotDur)
defer slotEnd.Stop()
for {
select {
case idx := <-nc:
Expand All @@ -570,12 +582,25 @@ func (s *Service) isDataAvailable(ctx context.Context, root [32]byte, signed int
// Once all sidecars have been observed, clean up the notification channel.
s.blobNotifiers.delete(root)
return nil
case <-slotEnd.C:
log.WithFields(daCheckLogFields(root, signed, expected, len(missing))).
Error("Still waiting for DA check at slot end.")
continue
case <-ctx.Done():
return errors.Wrap(ctx.Err(), "context deadline waiting for blob sidecars")
}
}
}

func daCheckLogFields(root [32]byte, signed interfaces.ReadOnlySignedBeaconBlock, expected, missing int) logrus.Fields {
return logrus.Fields{
"slot": signed.Block().Slot(),
"root": root,
"blobsExpected": expected,
"blobsWaiting": missing,
}
}

// 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
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/blockchain/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type Service struct {
blockBeingSynced *currentlySyncingBlock
blobStorage *filesystem.BlobStorage
lastPublishedLightClientEpoch primitives.Epoch
clock *startup.Clock

Check failure on line 71 in beacon-chain/blockchain/service.go

View workflow job for this annotation

GitHub Actions / Lint

field `clock` is unused (unused)
}

// config options for the service.
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/sync/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ type config struct {
stateGen *stategen.State
slasherAttestationsFeed *event.Feed
slasherBlockHeadersFeed *event.Feed
clock *startup.Clock
stateNotifier statefeed.Notifier
blobStorage *filesystem.BlobStorage
}
Expand Down

0 comments on commit 4749b18

Please sign in to comment.