Skip to content

Commit

Permalink
fix: add rollup config in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed Aug 22, 2024
1 parent 424f14c commit bb75457
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 5 additions & 2 deletions bin/kona-exex/src/kona.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ use superchain_registry::RollupConfig;

use crate::cli::KonaArgsExt;

/// The Kona Execution Extension.
#[derive(Debug)]
#[allow(unused)]
pub(crate) struct KonaExEx<Node: FullNodeComponents> {
/// The rollup configuration
cfg: Arc<RollupConfig>,
/// The context of the Execution Extension
ctx: ExExContext<Node>,
}

#[allow(unused)]
impl<Node: FullNodeComponents> KonaExEx<Node> {
/// Creates a new instance of the Kona Execution Extension.
pub async fn new(ctx: ExExContext<Node>, args: KonaArgsExt) -> Self {
unimplemented!()
pub async fn new(ctx: ExExContext<Node>, args: KonaArgsExt, cfg: Arc<RollupConfig>) -> Self {
Self { ctx, cfg }
}

/// Starts the Kona Execution Extension loop.
Expand Down
11 changes: 9 additions & 2 deletions bin/kona-exex/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use std::sync::Arc;

use clap::Parser;
use eyre::Result;
use eyre::{bail, Result};
use reth::cli::Cli;
use reth_node_ethereum::EthereumNode;
use superchain_registry::ROLLUP_CONFIGS;

mod kona;
use kona::KonaExEx;
Expand All @@ -14,8 +17,12 @@ const EXEX_ID: &str = "kona";

fn main() -> Result<()> {
Cli::<KonaArgsExt>::parse().run(|builder, args| async move {
let Some(cfg) = ROLLUP_CONFIGS.get(&args.l2_chain_id).cloned() else {
bail!("Rollup configuration not found for L2 chain ID: {}", args.l2_chain_id);
};

let node = EthereumNode::default();
let kona = move |ctx| async { Ok(KonaExEx::new(ctx, args).await.start()) };
let kona = move |ctx| async { Ok(KonaExEx::new(ctx, args, Arc::new(cfg)).await.start()) };
let handle = builder.node(node).install_exex(EXEX_ID, kona).launch().await?;
handle.wait_for_node_exit().await
})
Expand Down

0 comments on commit bb75457

Please sign in to comment.