Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: advance without target #131

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[patch.crates-io]
kona-derive = { git = "https://github.com/anton-rs/kona", branch = "main" }
kona-driver = { git = "https://github.com/anton-rs/kona", branch = "main" }
kona-derive = { git = "https://github.com/anton-rs/kona", branch = "rf/chore/driver-advancing" }
kona-driver = { git = "https://github.com/anton-rs/kona", branch = "rf/chore/driver-advancing" }

[workspace.dependencies]
# Workspace
Expand Down
19 changes: 14 additions & 5 deletions crates/driver/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use alloy_transport::TransportResult;
use kona_derive::{errors::PipelineErrorKind, traits::SignalReceiver, types::ResetSignal};
use kona_driver::{Driver, DriverPipeline, PipelineCursor, TipCursor};
use kona_driver::{Driver, PipelineCursor, TipCursor};
use std::sync::Arc;

use hilo_engine::{EngineApi, HiloExecutorConstructor};
Expand All @@ -26,6 +26,9 @@ pub enum DriverError {
/// A pipeline reset failed.
#[error("pipeline reset error: {0}")]
PipelineReset(#[from] PipelineErrorKind),
/// Kona's driver unexpectedly errored.
#[error("kona driver error")]
DriverErrored,
}

/// HiloDriver is a wrapper around the `Driver` that
Expand Down Expand Up @@ -122,10 +125,16 @@ where
// Step 3: Start the processing loop
loop {
tokio::select! {
Ok(_) = driver.pipeline.produce_payload(*driver.cursor.l2_safe_head()) => {
info!("Produced payload");
// todo
}
result = driver.advance_to_target(&self.cfg.rollup_config, None) => match result {
Ok((bn, hash)) => {
error!("Driver unexpectedly stopped at target block: {} {}", bn, hash);
}
Err(e) => {
error!("Driver error: {}", e);
// TODO: optionally allow recovery
return Err(DriverError::DriverErrored);
}
},
Some(notification) = self.ctx.recv_notification() => {
self.handle_notification(notification, &mut driver).await?;
}
Expand Down