kona_driver/
executor.rs

1//! An abstraction for the driver's block executor.
2
3use alloc::boxed::Box;
4use alloy_consensus::{Header, Sealed};
5use alloy_primitives::B256;
6use async_trait::async_trait;
7use core::error::Error;
8use kona_executor::BlockBuildingOutcome;
9use op_alloy_rpc_types_engine::OpPayloadAttributes;
10
11/// Executor
12///
13/// Abstracts block execution by the driver.
14#[async_trait]
15pub trait Executor {
16    /// The error type for the Executor.
17    type Error: Error;
18
19    /// Waits for the executor to be ready.
20    async fn wait_until_ready(&mut self);
21
22    /// Updates the safe header.
23    fn update_safe_head(&mut self, header: Sealed<Header>);
24
25    /// Execute the given [`OpPayloadAttributes`].
26    async fn execute_payload(
27        &mut self,
28        attributes: OpPayloadAttributes,
29    ) -> Result<BlockBuildingOutcome, Self::Error>;
30
31    /// Computes the output root.
32    /// Expected to be called after the payload has been executed.
33    fn compute_output_root(&mut self) -> Result<B256, Self::Error>;
34}