-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathexecutor.rs
39 lines (32 loc) · 1.06 KB
/
executor.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! An abstraction for the driver's block executor.
use alloc::boxed::Box;
use core::{
error::Error,
fmt::{Debug, Display},
};
use kona_executor::ExecutionArtifacts;
use alloc::string::ToString;
use alloy_consensus::{Header, Sealed};
use alloy_primitives::B256;
use async_trait::async_trait;
use op_alloy_rpc_types_engine::OpPayloadAttributes;
/// Executor
///
/// Abstracts block execution by the driver.
#[async_trait]
pub trait Executor {
/// The error type for the Executor.
type Error: Error + Debug + Display + ToString;
/// Waits for the executor to be ready.
async fn wait_until_ready(&mut self);
/// Updates the safe header.
fn update_safe_head(&mut self, header: Sealed<Header>);
/// Execute the gicen [OpPayloadAttributes].
async fn execute_payload(
&mut self,
attributes: OpPayloadAttributes,
) -> Result<ExecutionArtifacts, Self::Error>;
/// Computes the output root.
/// Expected to be called after the payload has been executed.
fn compute_output_root(&mut self) -> Result<B256, Self::Error>;
}