-
Notifications
You must be signed in to change notification settings - Fork 1.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
payload attribute computations in event handler #14963
base: develop
Are you sure you want to change the base?
Conversation
…py path unit test for code coverage
// all of the checked fields empty, so the logical short circuit should hit immediately. | ||
func needsFill(ev payloadattribute.EventData) bool { | ||
return ev.HeadState == nil || ev.HeadState.IsNil() || | ||
ev.HeadState.LatestBlockHeader() == nil || ev.HeadState.LatestBlockHeader() == nil || |
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.
ev.HeadState.LatestBlockHeader() == nil
is checked twice
// the fcu args have differing amounts of completeness based on the code path, | ||
// and there is work we only want to do if a client is actually listening to the events beacon api endpoint. | ||
// temporary solution: just fire a blank event and fill in the details in the api handler. |
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.
Removing the cfg
parameter means that in case of firing from notifyForkchoiceUpdate
you have to do extra work in the handler, since you need to recompute what you already have available. What about leaving the parameter and filling event data only when cfg != nil
? You can then pass nil as the value in lateBlockTasks
.
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.
Doing it this way sidesteps several issues:
- these code paths are already complex and error prone. let's minimize the amount of edge cases that could be coming in from callers that this function needs to anticipate.
- timing concerns that could arise from the node passing into the next slot while the event waits in queue
- concerns around head state being mutated / needing to make a copy
- doing needless work when nothing is actually listening to the event. we have learned that most nodes in the wild are not subscribed to events, so it makes sense to defer all processing until we know the feed has a listener (in the event handler).
Radek's PR suggestion to fix error/log capitalization. Co-authored-by: Radosław Kapka <[email protected]>
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
This fixes the payload attribute event bugs referenced here:
#14644 (comment)
Other notes for review
Further testing is required, particularly if head is far behind, process_slots can timeout and trigger errors in the event stream response, which may need additional handling.
Acknowledgements