op-node: handle crit error events, lift event-system out of driver #11932
+119
−53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The
OnEvent
handler ofDriver
wasn't properly hooked up, causing it to missCriticalErrorEvent
.Additionally, I disliked how the critical-error still allowed continued event processing, while being queued up. I changed the event-system to enshrine the idea of the
CriticalErrorEvent
, such that no further events will be processed, except the critical error event itself.The event-system is now initialized in the
OpNode
, rather than in theDriver
.This gets us one step closer to removing the
Driver
event-loop:once the
OpNode
emits events for the arrived subscription data (L1 head updates and such), gossip data (L2 unsafe blocks from P2P), and once we make the driver schedule the sequencer actions separately, then we don't really need the monolithic event-loop anymore.And by hosting the event-system in
OpNode
, we can potentially also attach an external API to it at some point (for event-streaming).Tests
Added a test that the event-system handles
CriticalErrorEvent
.