From 02abb3e3c0db5abff6c197a087a8cefafe1b41bb Mon Sep 17 00:00:00 2001 From: kasey <489222+kasey@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:31:09 -0500 Subject: [PATCH] add log message if in da check at slot end (#13776) * add log message if in da check at slot end * don't bother logging late da check start * break up defer with a var, too dense all together * pass slot instead of block ref --------- Co-authored-by: Kasey Kirkham --- beacon-chain/blockchain/process_block.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/beacon-chain/blockchain/process_block.go b/beacon-chain/blockchain/process_block.go index ffa2138bcc0a..7325935ce11b 100644 --- a/beacon-chain/blockchain/process_block.go +++ b/beacon-chain/blockchain/process_block.go @@ -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" @@ -558,6 +559,20 @@ 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) + + // Log for DA checks that cross over into the next slot; helpful for debugging. + nextSlot := slots.BeginsAt(signed.Block().Slot()+1, s.genesisTime) + // Avoid logging if DA check is called after next slot start. + if nextSlot.After(time.Now()) { + nst := time.AfterFunc(time.Until(nextSlot), func() { + if len(missing) == 0 { + return + } + log.WithFields(daCheckLogFields(root, signed.Block().Slot(), expected, len(missing))). + Error("Still waiting for DA check at slot end.") + }) + defer nst.Stop() + } for { select { case idx := <-nc: @@ -576,6 +591,15 @@ func (s *Service) isDataAvailable(ctx context.Context, root [32]byte, signed int } } +func daCheckLogFields(root [32]byte, slot primitives.Slot, expected, missing int) logrus.Fields { + return logrus.Fields{ + "slot": 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