The responsibilities of the sidecar main loop are starting to grow as we develop the fallback block building and consensus state container. Right now the main loop is exposed in the executable bin/sidecar.rs, but ideally that file should just contain initialization code and not business logic.
To clean this up, we will create a StateDriver component with the following responsibilities:
subscribe to the latest head updates from the HeadTracker
run function with an infinite loop:
await for a new head event to be emitted
try to update the execution_state with its update_head() method
try to update the consensus_state with its update_head() method
The responsibilities of the sidecar main loop are starting to grow as we develop the fallback block building and consensus state container. Right now the main loop is exposed in the executable
bin/sidecar.rs
, but ideally that file should just contain initialization code and not business logic.To clean this up, we will create a
StateDriver
component with the following responsibilities:HeadTracker
run
function with an infinite loop:update_head()
methodupdate_head()
method