-
Notifications
You must be signed in to change notification settings - Fork 890
Refine delayed head block logging #7705
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
Conversation
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.
Looks great! The code is a bit more simplified, and all changes are good.
No changes required in my opinion
let block_delays = block_times_cache.get_block_delays( | ||
head_block_root, | ||
slot_clock | ||
.start_of(head_block_slot) | ||
.unwrap_or_else(|| Duration::from_secs(0)), | ||
); |
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.
Good simplification, because block_delays
was already defined above
@@ -1432,6 +1439,24 @@ fn observe_head_block_delays<E: EthSpec, S: SlotClock>( | |||
set_as_head_time_ms = format_delay(&block_delays.set_as_head), | |||
"Delayed head block" | |||
); | |||
if let Some(event_handler) = event_handler { | |||
if event_handler.has_late_head_subscribers() { |
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.
Nice! Because it is already in the if !block_from_sync{}
and now it's put in if late_head{}
arm, so the condition becomes simpler
Thanks for the review @chong-he! |
Proposed Changes
Small tweak to
Delayed head block
logging to make it more representative of actual issues. Previously we used the total import delay to determine whether a block was late, but this includes the time taken for IO (and now hdiff computation) which happens after the block is made attestable.This PR changes the logic to use the attestable delay (where possible) falling back to the previous value if the block doesn't have one; e.g. if it didn't meet the conditions to make it into the attestable cache.
Additional Info
I've also applied some refactors and simplifications related to the relocation of the
late_head
variable.I got rid of some raw
SystemTime
usage as well, which improves repeatability of test cases by removing realtime variability. In production it should be exactly equivalent.