-
Notifications
You must be signed in to change notification settings - Fork 290
delay onSlotEnd
if there are duties
#5196
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
We currently call `onSlotEnd` whenever all in-BN validator duties are completed. VC validator duties are not awaited. When `onSlotEnd` is processed close to the slot start, a VC may therefore miss duties. Adding a delay before `onSlotEnd` improves this situation. The logic can be optimized further if `ActionTracker` would track `knownValidators` from REST separately from in-process ones.
I'm not deeply opposed to changing the (unspecified meaning of) the on slot end messages, but it's not really per-se a problem/bug as such that it fires immediately on the end of BN duties. If the downstream code of that has problems, that's to some extent downstream code problems. To the extent this PR practically removes latency spikes, sure, probably a net improvement, but the current slot end thing itself is merely a trigger.
Might not depend on ActionTracker -- there are other mechanisms already to check for in-BN validators, so REST validators == actiontracker validators without the in-BN ones. |
Well, if a block is produced via REST, and during the await in the REST handler, the scheduler happens to decide to process the
Yes, the set of validators could be determined like that, but it's still tricky to determine whether any of them have duties for the wall slot. We could use "actiontracker minus in-BN ones" to check whether there are any VC validators. Not sure if that's good though, as it retains an instance of BN-validators being treated separately from VC-validators. On the flipside, we could also simply always wait, regardless of validators being attached or not. In the end, it doesn't seem to make too much sense conceptually to run the GC and pruning right at the start of a slot, while the next block is expected to be received any time soon. |
Yeah, agree, the GC and pruning specifically should be tied to slot timing, not in-BN validators. So, I'd suggest that's maybe another principled approach, to split out the on slot end processing from actual-within-slot-duties from the end-of-slot-Nim-GC-maintenance things which don't depend on duties (BN, VC, or otherwise). |
Are there parts in Probably something for @arnetheduck to comment on :) |
We currently call
onSlotEnd
whenever all in-BN validator duties are completed. VC validator duties are not awaited. WhenonSlotEnd
is processed close to the slot start, a VC may therefore miss duties. Adding a delay beforeonSlotEnd
improves this situation. The logic can be optimized further ifActionTracker
would trackknownValidators
from REST separately from in-process ones.