-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
defer payload attribute computation #14644
Changes from 6 commits
d518182
d2dfd75
517c71a
9e02bcd
262ed05
97dcbd4
8c22fbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ import ( | |
|
||
"github.com/pkg/errors" | ||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/blocks" | ||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed" | ||
statefeed "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed/state" | ||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers" | ||
coreTime "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/time" | ||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/transition" | ||
|
@@ -620,9 +618,6 @@ func (s *Service) lateBlockTasks(ctx context.Context) { | |
if !s.inRegularSync() { | ||
return | ||
} | ||
s.cfg.StateNotifier.StateFeed().Send(&feed.Event{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't we still need this? Missed slot feed. #12153 based on this it needs to send when it's late. I know you mentioned
but wouldn't it still need to be there? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the proposer is a tracked validator, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the meantime I'll add it back in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it's still needed for untracked ( this was opened a while back, I updated to reflect the same as lighthouse #14204) but it's related to the untracked and submitting it, the builder should only use the registered info though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I can't quite make sense of your comment. Right now the code fires events for head updates and missed slots, whether or not the upcoming proposer is tracked. If it is tracked, the fee recipient for the tracked validator will be used. Is that the correct behavior? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's the correct behavior, just meant that regardless the builder should use the data from the validator registrations and not from the proposer attributes event |
||
Type: statefeed.MissedSlot, | ||
}) | ||
s.headLock.RLock() | ||
headRoot := s.headRoot() | ||
headState := s.headState(ctx) | ||
|
@@ -648,10 +643,6 @@ func (s *Service) lateBlockTasks(ctx context.Context) { | |
} | ||
|
||
attribute := s.getPayloadAttribute(ctx, headState, s.CurrentSlot()+1, headRoot[:]) | ||
// return early if we are not proposing next slot | ||
if attribute.IsEmpty() { | ||
return | ||
} | ||
|
||
s.headLock.RLock() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes an invariant: previously, we didn’t need to call the head block if we weren’t proposing the next block, as calling the head block isn’t free. Now, we must call the head block even if we’re not proposing the next block when a late block is triggered. This might be fine, but if we want to be precise about it, we could move the head block call inside the goroutine There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've changed the event firing code and the handler to accommodate the head block being nil, looking up the block in the handler if it is nil, and making sure the root matches the head root in the event. If the head root in the event is different, we just drop the event. In this circumstance we know the mismatched event was fired by |
||
headBlock, err := s.headBlock() | ||
|
@@ -668,6 +659,11 @@ func (s *Service) lateBlockTasks(ctx context.Context) { | |
headBlock: headBlock, | ||
attributes: attribute, | ||
} | ||
// return early if we are not proposing next slot | ||
if attribute.IsEmpty() { | ||
go firePayloadAttributesEvent(ctx, s.cfg.StateNotifier.StateFeed(), fcuArgs) | ||
return | ||
} | ||
_, err = s.notifyForkchoiceUpdate(ctx, fcuArgs) | ||
if err != nil { | ||
log.WithError(err).Debug("could not perform late block tasks: failed to update forkchoice with engine") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to make it a method with the receiver
(s *Service)
, allowing access toevent.SubscriberSender
directly instead of passing it as an extra parameter. A function is probably a better choice than a method in this case