diff --git a/crates/rollup/src/cli.rs b/crates/rollup/src/cli.rs index 6e60172..0989942 100644 --- a/crates/rollup/src/cli.rs +++ b/crates/rollup/src/cli.rs @@ -16,9 +16,6 @@ pub const DEFAULT_L2_CHAIN_ID: u64 = 10; /// The default L1 RPC URL to use. pub const DEFAULT_L1_RPC_URL: &str = "https://cloudflare-eth.com"; -/// The default L2 RPC URL to use. -pub const DEFAULT_L2_RPC_URL: &str = "https://optimism.llamarpc.com/"; - /// The default L1 Beacon Client RPC URL to use. pub const DEFAULT_L1_BEACON_CLIENT_URL: &str = "http://localhost:5052/"; @@ -34,10 +31,6 @@ pub struct HeraArgsExt { #[clap(long = "hera.l2-config-file")] pub l2_config_file: Option, - /// RPC URL of an L2 execution client - #[clap(long = "hera.l2-rpc-url", default_value = DEFAULT_L2_RPC_URL)] - pub l2_rpc_url: Url, - /// RPC URL of an L1 execution client /// (This is only needed when running in Standalone mode) #[clap(long = "hera.l1-rpc-url", default_value = DEFAULT_L1_RPC_URL)] diff --git a/crates/rollup/src/engine/controller.rs b/crates/rollup/src/engine/controller.rs new file mode 100644 index 0000000..b3ad983 --- /dev/null +++ b/crates/rollup/src/engine/controller.rs @@ -0,0 +1,20 @@ +//! The engine controller keeps the state of the engine. + +use op_alloy_protocol::L2BlockInfo; + +/// The engine controller. +#[derive(Debug, Clone)] +pub struct EngineController { + /// The block head state. + pub unsafe_head: L2BlockInfo, + /// A cross unsafe head. + pub cross_unsafe_head: L2BlockInfo, + /// The pending local safe head. + pub pending_local_safe_head: L2BlockInfo, + /// The local safe head. + pub local_safe_head: L2BlockInfo, + /// Derived from L1 and cross-verified. + pub safe_head: L2BlockInfo, + /// The finalized safe head. + pub finalized_head: L2BlockInfo, +} diff --git a/crates/rollup/src/engine/mod.rs b/crates/rollup/src/engine/mod.rs new file mode 100644 index 0000000..a2ae6a6 --- /dev/null +++ b/crates/rollup/src/engine/mod.rs @@ -0,0 +1,7 @@ +//! The engine module contains logic for interacting with the L2 Engine API. + +mod controller; +pub use controller::EngineController; + +mod relay; +pub use relay::EngineRelay; diff --git a/crates/rollup/src/engine.rs b/crates/rollup/src/engine/relay.rs similarity index 91% rename from crates/rollup/src/engine.rs rename to crates/rollup/src/engine/relay.rs index 36601e1..806a16b 100644 --- a/crates/rollup/src/engine.rs +++ b/crates/rollup/src/engine/relay.rs @@ -1,3 +1,5 @@ +//! The engine relay handles forwarding [OpAttributesWithParent] to the L2 Engine API. + use std::ops::Deref; use alloy_network::AnyNetwork; @@ -25,12 +27,12 @@ type HyperAuthClient> = HyperClient, AnyNetwork>, } -impl Engine { - /// Creates a new [`Engine`] from the provided [Url] and [JwtSecret]. +impl EngineRelay { + /// Creates a new [`EngineRelay`] from the provided [Url] and [JwtSecret]. pub fn new_http(url: Url, jwt: JwtSecret) -> Self { let hyper_client = Client::builder(TokioExecutor::new()).build_http::>(); @@ -66,7 +68,7 @@ impl Engine { } } -impl Deref for Engine { +impl Deref for EngineRelay { type Target = RootProvider, AnyNetwork>; fn deref(&self) -> &Self::Target { diff --git a/crates/rollup/src/lib.rs b/crates/rollup/src/lib.rs index 400baaf..f0b31be 100644 --- a/crates/rollup/src/lib.rs +++ b/crates/rollup/src/lib.rs @@ -11,7 +11,7 @@ mod cli; pub use cli::HeraArgsExt; mod engine; -pub use engine::Engine; +pub use engine::{EngineRelay, EngineController}; mod validator; pub use validator::TrustedPayloadValidator;