Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.
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
13 changes: 13 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/host/src/bin/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use anyhow::Result;
use clap::{Parser, Subcommand};
use kona_cli::{LogConfig, cli_styles, log::LogArgs};
use kona_cli::{LogArgs, LogConfig, cli_styles};
use serde::Serialize;
use tracing::info;
use tracing_subscriber::EnvFilter;
Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/commands/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use alloy_rpc_types_engine::JwtSecret;
use anyhow::{Result, bail};
use backon::{ExponentialBuilder, Retryable};
use clap::Parser;
use kona_cli::{LogConfig, metrics_args::MetricsArgs};
use kona_cli::{LogConfig, MetricsArgs};
use kona_genesis::RollupConfig;
use kona_node_service::{NodeMode, RollupNode, RollupNodeService};
use kona_registry::scr_rollup_config_by_alloy_ident;
Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/flags/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use alloy_primitives::Address;
use clap::Parser;
use kona_cli::{log::LogArgs, metrics_args::MetricsArgs};
use kona_cli::{LogArgs, MetricsArgs};
use kona_genesis::RollupConfig;
use kona_registry::OPCHAINS;

Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/flags/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Specifies the available flags for prometheus metric configuration inside CLI

use crate::metrics::VersionInfo;
use kona_cli::metrics_args::MetricsArgs;
use kona_cli::MetricsArgs;

/// Initializes metrics for a Kona application, including Prometheus and node-specific metrics.
/// Initialize the tracing stack and Prometheus metrics recorder.
Expand Down
15 changes: 15 additions & 0 deletions bin/rollup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,18 @@ rust-version.workspace = true
workspace = true

[dependencies]
# Workspace
kona-genesis.workspace = true

kona-cli = { workspace = true, features = ["secrets"] }

# General
anyhow = { workspace = true, default-features = false }
clap = { workspace = true, features = ["derive", "env"] }

[dev-dependencies]
rstest.workspace = true

[build-dependencies]
vergen = { workspace = true, features = ["build", "cargo", "emit_and_set"] }
vergen-git2.workspace = true
29 changes: 27 additions & 2 deletions bin/rollup/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# rollup
# Rollup

Coming soon.
Unified OP Stack rollup binary that integrates Kona services as an Execution Extension (ExEx).

## Usage

For example, this shows how to run `rollup` with the `kona-node` as an execution extension.

```bash
./rollup node --l1.eth http://localhost:8545 --l1.beacon http://localhost:5052 --chain 10
```

## Architecture

- **Custom CLI**: Extends kona-node arguments with reth compatibility
- **ExEx Integration**: Embeds kona-node as a reth Execution Extension
- **Buffered Provider**: Caches L2 chain state for efficient processing
- **Event Processing**: Handles chain commits, reorgs, and reverts

## Key Files

- `src/main.rs` - Entry point and CLI parsing
- `src/cli.rs` - Command-line interface
- `src/exex.rs` - Kona Node ExEx implementation

## Configuration

Use `--kona.*` prefixed flags for kona-specific options to avoid conflicts with reth.
92 changes: 92 additions & 0 deletions bin/rollup/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
//! Derived from [`reth-node-core`][reth-build-script]
//!
//! [reth-build-script]: https://github.com/paradigmxyz/reth/blob/805fb1012cd1601c3b4fe9e8ca2d97c96f61355b/crates/node/core/build.rs

#![allow(missing_docs)]

use std::{env, error::Error};
use vergen::{BuildBuilder, CargoBuilder, Emitter};
use vergen_git2::Git2Builder;

fn main() -> Result<(), Box<dyn Error>> {
let mut emitter = Emitter::default();

let build_builder = BuildBuilder::default().build_timestamp(true).build()?;

// Add build timestamp information.
emitter.add_instructions(&build_builder)?;

let cargo_builder = CargoBuilder::default().features(true).target_triple(true).build()?;

// Add cargo features and target information.
emitter.add_instructions(&cargo_builder)?;

let git_builder =
Git2Builder::default().describe(false, true, None).dirty(true).sha(false).build()?;

// Add commit information.
emitter.add_instructions(&git_builder)?;

emitter.emit_and_set()?;
let sha = env::var("VERGEN_GIT_SHA")?;
let sha_short = &sha[0..7];

let is_dirty = env::var("VERGEN_GIT_DIRTY")? == "true";
// > git describe --always --tags
// if not on a tag: v0.2.0-beta.3-82-g1939939b
// if on a tag: v0.2.0-beta.3
let not_on_tag = env::var("VERGEN_GIT_DESCRIBE")?.ends_with(&format!("-g{sha_short}"));
let version_suffix = if is_dirty || not_on_tag { "-dev" } else { "" };
println!("cargo:rustc-env=KONA_NODE_VERSION_SUFFIX={version_suffix}");

// Set short SHA
println!("cargo:rustc-env=VERGEN_GIT_SHA_SHORT={}", &sha[..8]);

// Set the build profile
let out_dir = env::var("OUT_DIR").unwrap();
let profile = out_dir.rsplit(std::path::MAIN_SEPARATOR).nth(3).unwrap();
println!("cargo:rustc-env=KONA_NODE_BUILD_PROFILE={profile}");

// Set formatted version strings
let pkg_version = env!("CARGO_PKG_VERSION");

// The short version information for kona-node.
// - The latest version from Cargo.toml
// - The short SHA of the latest commit.
// Example: 0.1.0 (defa64b2)
println!("cargo:rustc-env=KONA_NODE_SHORT_VERSION={pkg_version}{version_suffix} ({sha_short})");

let features = env::var("VERGEN_CARGO_FEATURES")?;

// LONG_VERSION
// The long version information for kona-node.
//
// - The latest version from Cargo.toml + version suffix (if any)
// - The full SHA of the latest commit
// - The build datetime
// - The build features
// - The build profile
//
// Example:
//
// ```text
// Version: 0.1.0
// Commit SHA: defa64b2
// Build Timestamp: 2023-05-19T01:47:19.815651705Z
// Build Features: jemalloc
// Build Profile: maxperf
// ```
println!("cargo:rustc-env=KONA_NODE_LONG_VERSION_0=Version: {pkg_version}{version_suffix}");
println!("cargo:rustc-env=KONA_NODE_LONG_VERSION_1=Commit SHA: {sha}");
println!(
"cargo:rustc-env=KONA_NODE_LONG_VERSION_2=Build Timestamp: {}",
env::var("VERGEN_BUILD_TIMESTAMP")?
);
println!(
"cargo:rustc-env=KONA_NODE_LONG_VERSION_3=Build Features: {}",
if features.is_empty() { "no features enabled".to_string() } else { features }
);
println!("cargo:rustc-env=KONA_NODE_LONG_VERSION_4=Build Profile: {profile}");

Ok(())
}
29 changes: 29 additions & 0 deletions bin/rollup/src/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//! Contains the rollup CLI.

use crate::version;
use anyhow::Result;
use clap::Parser;
use kona_cli::{GlobalArgs, cli_styles};

/// The rollup CLI.
#[derive(Parser, Clone, Debug)]
#[command(
author,
version = version::SHORT_VERSION,
long_version = version::LONG_VERSION,
about,
styles = cli_styles(),
long_about = None
)]
pub struct Cli {
/// Global arguments for the CLI.
#[command(flatten)]
pub global: GlobalArgs,
}

impl Cli {
/// Runs the rollup binary.
pub fn run(self) -> Result<()> {
unimplemented!("Rollup CLI is not yet implemented")
}
}
28 changes: 19 additions & 9 deletions bin/rollup/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
//! Kona's Rollup Binary.

#![doc(issue_tracker_base_url = "https://github.com/op-rs/kona/issues/")]
#![doc = include_str!("../README.md")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/op-rs/kona/main/assets/square.png",
html_favicon_url = "https://raw.githubusercontent.com/op-rs/kona/main/assets/favicon.ico",
issue_tracker_base_url = "https://github.com/op-rs/kona/issues/"
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![deny(missing_docs)]
#![deny(unused_must_use)]
#![deny(rust_2018_idioms)]
#![deny(missing_docs, unused_must_use, rust_2018_idioms)]

pub mod cli;
pub mod version;

/// Main entry point for the rollup binary.
#[allow(clippy::missing_const_for_fn)]
fn main() {
// TODO: Implementation coming soon
use clap::Parser;

kona_cli::sigsegv_handler::install();
kona_cli::backtrace::enable();

if let Err(err) = cli::Cli::parse().run() {
eprintln!("Error: {err:?}");
std::process::exit(1);
}
}
37 changes: 37 additions & 0 deletions bin/rollup/src/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//! Version information for kona-node.

#![allow(dead_code)]

/// The latest version from Cargo.toml.
pub(crate) const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");

/// The 8 character short SHA of the latest commit.
pub(crate) const VERGEN_GIT_SHA: &str = env!("VERGEN_GIT_SHA_SHORT");

/// The build timestamp.
pub(crate) const VERGEN_BUILD_TIMESTAMP: &str = env!("VERGEN_BUILD_TIMESTAMP");

/// The target triple.
pub(crate) const VERGEN_CARGO_TARGET_TRIPLE: &str = env!("VERGEN_CARGO_TARGET_TRIPLE");

/// The build features.
pub(crate) const VERGEN_CARGO_FEATURES: &str = env!("VERGEN_CARGO_FEATURES");

/// The short version information for kona-node.
pub(crate) const SHORT_VERSION: &str = env!("KONA_NODE_SHORT_VERSION");

/// The long version information for kona-node.
pub(crate) const LONG_VERSION: &str = concat!(
env!("KONA_NODE_LONG_VERSION_0"),
"\n",
env!("KONA_NODE_LONG_VERSION_1"),
"\n",
env!("KONA_NODE_LONG_VERSION_2"),
"\n",
env!("KONA_NODE_LONG_VERSION_3"),
"\n",
env!("KONA_NODE_LONG_VERSION_4")
);

/// The build profile name.
pub(crate) const BUILD_PROFILE_NAME: &str = env!("KONA_NODE_BUILD_PROFILE");
2 changes: 1 addition & 1 deletion bin/supervisor/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::{flags::SupervisorArgs, metrics::VersionInfo};
use anyhow::Result;
use clap::Parser;
use kona_cli::{LogConfig, cli_styles, log::LogArgs, metrics_args::MetricsArgs};
use kona_cli::{LogArgs, LogConfig, MetricsArgs, cli_styles};
use kona_supervisor_service::Service;
use tracing::{error, info};

Expand Down
11 changes: 11 additions & 0 deletions crates/utilities/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ homepage.workspace = true
workspace = true

[dependencies]
# Workspace
kona-genesis.workspace = true
kona-registry.workspace = true

# Alloy
alloy-chains.workspace = true

# General
tracing.workspace = true
serde = { workspace = true, features = ["derive"]}
clap = { workspace = true, features = ["derive", "env"] }
Expand All @@ -26,6 +34,9 @@ libp2p = { workspace = true, features = ["secp256k1"], optional = true }
thiserror = { workspace = true, optional = true }
alloy-primitives = { workspace = true, optional = true }

[dev-dependencies]
rstest.workspace = true

[target.'cfg(unix)'.dependencies]
libc = "0.2"

Expand Down
Loading
Loading