mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Trigger payload attribute event on early blocks (#15541)
Currently the payload attribute events is triggered on `forkchoiceUpodateWithExecution`. However when we import an early block, we do not call this function, we make two calls to FCU, the first one is on a locked path at the end of `postBlockProcess` and this call is made without any payload attributes to avoid updating the shuffling caches. The second call is made on `handleSecondFCUCall` which calls directly `notifyForkchoiceUpdate` bypassing the call to `forkchoiceUpdateWithExecution`, but this call is the one that actually computes the payload attributes. So the event handler is never called with the new attributes. This PR moves the event trigger to the same place where we actually call FCU with the computed payload attributes. Some considerations with forkchoice locking logic: since the calls are always in a go routine, anyway the routine will wait to forkchoice to be unlocked to proceed. Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This commit is contained in:
@@ -174,6 +174,7 @@ func (s *Service) notifyForkchoiceUpdate(ctx context.Context, arg *fcuConfig) (*
|
||||
"payloadID": fmt.Sprintf("%#x", bytesutil.Trunc(payloadID[:])),
|
||||
}).Info("Forkchoice updated with payload attributes for proposal")
|
||||
s.cfg.PayloadIDCache.Set(nextSlot, arg.headRoot, pId)
|
||||
go s.firePayloadAttributesEvent(s.cfg.StateNotifier.StateFeed(), arg.headBlock, arg.headRoot, nextSlot)
|
||||
} else if hasAttr && payloadID == nil && !features.Get().PrepareAllPayloads {
|
||||
log.WithFields(logrus.Fields{
|
||||
"blockHash": fmt.Sprintf("%#x", headPayload.BlockHash()),
|
||||
|
||||
@@ -102,8 +102,6 @@ func (s *Service) forkchoiceUpdateWithExecution(ctx context.Context, args *fcuCo
|
||||
log.WithError(err).Error("Could not save head")
|
||||
}
|
||||
|
||||
go s.firePayloadAttributesEvent(s.cfg.StateNotifier.StateFeed(), args.headBlock, args.headRoot, s.CurrentSlot()+1)
|
||||
|
||||
// Only need to prune attestations from pool if the head has changed.
|
||||
s.pruneAttsFromPool(s.ctx, args.headState, args.headBlock)
|
||||
return nil
|
||||
|
||||
2
changelog/potuz_event_happy_path.md
Normal file
2
changelog/potuz_event_happy_path.md
Normal file
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Trigger payload attribute event as soon as an early block is processed.
|
||||
Reference in New Issue
Block a user