chainbound / bolt

Bolt: permissionless out-of-protocol proposer commitments.
https://chainbound.github.io/bolt-docs/
MIT License
27 stars 5 forks source link

Sidecar StateDriver #99

Open merklefruit opened 1 week ago

merklefruit commented 1 week ago

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:

  1. subscribe to the latest head updates from the HeadTracker
  2. 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
    • in the future: handle reorgs as well