Skip to content

Commit

Permalink
feat(driver): wait for engine (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell authored Nov 27, 2024
1 parent 344d851 commit 213bae5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions crates/driver/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ where
}
}

/// Waits until the executor is ready.
pub async fn wait_for_executor(&mut self) {
self.executor.wait_until_ready().await;
}

/// Advances the derivation pipeline to the target block number.
///
/// ## Takes
Expand Down
4 changes: 4 additions & 0 deletions crates/driver/src/executor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! An abstraction for the driver's block executor.
use alloc::boxed::Box;
use core::{
error::Error,
fmt::{Debug, Display},
Expand All @@ -19,6 +20,9 @@ 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>);

Expand Down
10 changes: 9 additions & 1 deletion crates/proof-sdk/proof/src/executor.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! An executor constructor.
use alloc::sync::Arc;
use alloc::{boxed::Box, sync::Arc};
use alloy_consensus::{Header, Sealed};
use alloy_primitives::B256;
use async_trait::async_trait;
use kona_driver::Executor;
use kona_executor::{KonaHandleRegister, StatelessL2BlockExecutor, TrieDBProvider};
use kona_mpt::TrieHinter;
Expand Down Expand Up @@ -45,13 +46,20 @@ where
}
}

#[async_trait]
impl<P, H> Executor for KonaExecutor<'_, P, H>
where
P: TrieDBProvider + Send + Sync + Clone,
H: TrieHinter + Send + Sync + Clone,
{
type Error = kona_executor::ExecutorError;

/// Waits for the executor to be ready.
async fn wait_until_ready(&mut self) {
/* no-op for the kona executor */
/* This is used when an engine api is used instead of a stateless block executor */
}

/// Updates the safe header.
///
/// Since the L2 block executor is stateless, on an update to the safe head,
Expand Down

0 comments on commit 213bae5

Please sign in to comment.