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
163 changes: 81 additions & 82 deletions Cargo.lock

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ panic = "abort"
codegen-units = 1
lto = "fat"

[patch.crates-io]
# Patch op-alloy to remove it's dependency on superchain-primitives
op-alloy-protocol = { git = "https://github.com/alloy-rs/op-alloy", branch = "main" }
op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", branch = "main" }
op-alloy-genesis = { git = "https://github.com/alloy-rs/op-alloy", branch = "main" }

[workspace.dependencies]
# Workspace
kona-client = { path = "bin/client", version = "0.1.0" }
Expand Down Expand Up @@ -92,23 +98,23 @@ unsigned-varint = "0.8.0"
revm = { version = "14.0", default-features = false }

# Superchain
superchain = "0.4"
superchain-primitives = { version = "0.4", default-features = false }
superchain = { version = "0.5", default-features = false }

# K/V database
rocksdb = { version = "0.22", default-features = false, features = ["snappy"] }

# Alloy
alloy-rlp = { version = "0.3.2", default-features = false }
alloy-rlp = { version = "0.3.8", default-features = false }
alloy-trie = { version = "0.5", default-features = false }
alloy-provider = { version = "0.3.2", default-features = false }
alloy-provider = { version = "0.3.5", default-features = false }
alloy-primitives = { version = "0.8", default-features = false }
alloy-rpc-types = { version = "0.3.2", default-features = false }
alloy-consensus = { version = "0.3.2", default-features = false }
alloy-transport = { version = "0.3.2", default-features = false }
alloy-transport-http = { version = "0.3.2", default-features = false }
alloy-eips = { version = "0.3.2", default-features = false }
alloy-rpc-client = { version = "0.3.2", default-features = false }
alloy-node-bindings = { version = "0.3.2", default-features = false }
op-alloy-consensus = { version = "0.2.9", default-features = false }
op-alloy-protocol = { version = "0.2.9", default-features = false }
alloy-rpc-types = { version = "0.3.5", default-features = false }
alloy-consensus = { version = "0.3.5", default-features = false }
alloy-transport = { version = "0.3.5", default-features = false }
alloy-transport-http = { version = "0.3.5", default-features = false }
alloy-eips = { version = "0.3.5", default-features = false }
alloy-rpc-client = { version = "0.3.5", default-features = false }
alloy-node-bindings = { version = "0.3.5", default-features = false }
op-alloy-consensus = { version = "0.2.11", default-features = false }
op-alloy-protocol = { version = "0.2.11", default-features = false }
op-alloy-genesis = { version = "0.2.11", default-features = false }
2 changes: 2 additions & 0 deletions bin/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ kona-mpt.workspace = true
kona-derive.workspace = true
kona-executor.workspace = true
kona-primitives = { workspace = true, features = ["serde"] }
op-alloy-genesis = { workspace = true, features = ["serde"] }
op-alloy-protocol = { workspace = true, features = ["serde"] }

# Revm + Alloy
revm.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/client/src/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use alloy_primitives::{B256, U256};
use anyhow::{anyhow, Result};
use kona_preimage::{PreimageKey, PreimageOracleClient};
use kona_primitives::RollupConfig;
use op_alloy_genesis::RollupConfig;
use serde::{Deserialize, Serialize};
use tracing::warn;

Expand Down
3 changes: 2 additions & 1 deletion bin/client/src/l1/blob_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use alloy_primitives::keccak256;
use async_trait::async_trait;
use kona_derive::{errors::BlobProviderError, traits::BlobProvider};
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use kona_primitives::{BlockInfo, IndexedBlobHash};
use kona_primitives::IndexedBlobHash;
use op_alloy_protocol::BlockInfo;

/// An oracle-backed blob provider.
#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion bin/client/src/l1/chain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use async_trait::async_trait;
use kona_derive::traits::ChainProvider;
use kona_mpt::{OrderedListWalker, TrieDBFetcher};
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use kona_primitives::BlockInfo;
use op_alloy_protocol::BlockInfo;

/// The oracle-backed L1 chain provider for the client program.
#[derive(Debug, Clone)]
Expand Down
3 changes: 2 additions & 1 deletion bin/client/src/l1/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use kona_derive::{
};
use kona_mpt::TrieDBFetcher;
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use kona_primitives::{BlockInfo, L2AttributesWithParent, L2BlockInfo};
use kona_primitives::L2AttributesWithParent;
use op_alloy_protocol::{BlockInfo, L2BlockInfo};
use tracing::{info, warn};

/// An oracle-backed derivation pipeline.
Expand Down
6 changes: 3 additions & 3 deletions bin/client/src/l2/chain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use async_trait::async_trait;
use kona_derive::traits::L2ChainProvider;
use kona_mpt::{OrderedListWalker, TrieDBFetcher, TrieDBHinter};
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use kona_primitives::{
L2BlockInfo, L2ExecutionPayloadEnvelope, OpBlock, RollupConfig, SystemConfig,
};
use kona_primitives::{L2ExecutionPayloadEnvelope, OpBlock};
use op_alloy_consensus::OpTxEnvelope;
use op_alloy_genesis::{RollupConfig, SystemConfig};
use op_alloy_protocol::L2BlockInfo;

/// The oracle-backed L2 chain provider for the client program.
#[derive(Debug, Clone)]
Expand Down
2 changes: 2 additions & 0 deletions bin/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ kona-common.workspace = true
kona-preimage.workspace = true
kona-derive = { workspace = true, features = ["online"] }
kona-primitives = { workspace = true, features = ["online"] }
op-alloy-genesis = { workspace = true, features = ["std", "serde"] }
op-alloy-protocol = { workspace = true, features = ["std", "serde"] }

# Alloy & Revm
alloy-eips.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/host/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::kv::{
use alloy_primitives::B256;
use anyhow::{anyhow, Result};
use clap::{ArgAction, Parser};
use kona_primitives::RollupConfig;
use op_alloy_genesis::RollupConfig;
use serde::Serialize;
use std::{path::PathBuf, sync::Arc};
use tokio::sync::RwLock;
Expand Down
3 changes: 2 additions & 1 deletion bin/host/src/fetcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use anyhow::{anyhow, Result};
use kona_client::HintType;
use kona_derive::online::{OnlineBeaconClient, OnlineBlobProvider, SimpleSlotDerivation};
use kona_preimage::{PreimageKey, PreimageKeyType};
use kona_primitives::{BlockInfo, IndexedBlobHash};
use kona_primitives::IndexedBlobHash;
use op_alloy_protocol::BlockInfo;
use std::sync::Arc;
use tokio::sync::RwLock;
use tracing::trace;
Expand Down
9 changes: 8 additions & 1 deletion crates/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ alloy-rlp = { workspace = true, features = ["derive"] }
alloy-consensus = { workspace = true, features = ["k256"] }
alloy-primitives = { workspace = true, features = ["rlp", "k256"] }
op-alloy-consensus = { workspace = true, features = ["k256"] }
op-alloy-protocol.workspace = true
op-alloy-genesis.workspace = true

# General
hashbrown.workspace = true
Expand Down Expand Up @@ -66,7 +68,9 @@ serde = [
"kona-primitives/serde",
"alloy-primitives/serde",
"alloy-consensus/serde",
"op-alloy-consensus/serde"
"op-alloy-consensus/serde",
"op-alloy-protocol/serde",
"op-alloy-genesis/serde",
]
metrics = ["dep:prometheus", "dep:lazy_static"]
online = [
Expand All @@ -78,6 +82,9 @@ online = [
"alloy-consensus/serde",
"kona-primitives/online",
"kona-primitives/serde",
"op-alloy-consensus/std",
"op-alloy-protocol/std",
"op-alloy-genesis/std",
]
test-utils = [
"dep:spin",
Expand Down
3 changes: 2 additions & 1 deletion crates/derive/src/batch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
//! [SingleBatch].

use alloy_rlp::{Buf, Decodable};
use kona_primitives::{BlockInfo, L2BlockInfo, RollupConfig};
use op_alloy_genesis::RollupConfig;
use op_alloy_protocol::{BlockInfo, L2BlockInfo};

use crate::{errors::DecodeError, traits::L2ChainProvider};

Expand Down
20 changes: 11 additions & 9 deletions crates/derive/src/batch/single_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

use super::validity::BatchValidity;
use alloc::vec::Vec;
use alloy_eips::BlockNumHash;
use alloy_primitives::{BlockHash, Bytes};
use alloy_rlp::{RlpDecodable, RlpEncodable};
use kona_primitives::{starts_with_2718_deposit, BlockID, BlockInfo, L2BlockInfo, RollupConfig};
use op_alloy_genesis::RollupConfig;
use op_alloy_protocol::{starts_with_2718_deposit, BlockInfo, L2BlockInfo};
use tracing::{info, warn};

/// Represents a single batch: a single encoded L2 block
Expand All @@ -29,9 +31,9 @@ impl SingleBatch {
self.transactions.iter().any(|tx| tx.0.is_empty() || tx.0[0] == 0x7E)
}

/// Returns the [BlockID] of the batch.
pub fn epoch(&self) -> BlockID {
BlockID { number: self.epoch_num, hash: self.epoch_hash }
/// Returns the [BlockNumHash] of the batch.
pub fn epoch(&self) -> BlockNumHash {
BlockNumHash { number: self.epoch_num, hash: self.epoch_hash }
}

/// Checks if the batch is valid.
Expand Down Expand Up @@ -81,7 +83,7 @@ impl SingleBatch {
// Check the L1 origin of the batch
let mut batch_origin = epoch;
if self.epoch_num < epoch.number {
warn!("dropped batch, epoch is too old, minimum: {}", epoch.id());
warn!("dropped batch, epoch is too old, minimum: {:?}", epoch.id());
return BatchValidity::Drop;
} else if self.epoch_num == epoch.number {
// Batch is sticking to the current epoch, continue.
Expand All @@ -92,23 +94,23 @@ impl SingleBatch {
// more information otherwise the eager algorithm may diverge from a non-eager
// algorithm.
if l1_blocks.len() < 2 {
info!("eager batch wants to advance epoch, but could not without more L1 blocks at epoch: {}", epoch.id());
info!("eager batch wants to advance epoch, but could not without more L1 blocks at epoch: {:?}", epoch.id());
return BatchValidity::Undecided;
}
batch_origin = l1_blocks[1];
} else {
warn!("dropped batch, epoch is too far ahead, maximum: {}", epoch.id());
warn!("dropped batch, epoch is too far ahead, maximum: {:?}", epoch.id());
return BatchValidity::Drop;
}

// Validate the batch epoch hash
if self.epoch_hash != batch_origin.hash {
warn!("dropped batch, epoch hash does not match, expected: {}", batch_origin.id());
warn!("dropped batch, epoch hash does not match, expected: {:?}", batch_origin.id());
return BatchValidity::Drop;
}

if self.timestamp < batch_origin.timestamp {
warn!("dropped batch, batch timestamp is less than L1 origin timestamp, l2_timestamp: {}, l1_timestamp: {}, origin: {}", self.timestamp, batch_origin.timestamp, batch_origin.id());
warn!("dropped batch, batch timestamp is less than L1 origin timestamp, l2_timestamp: {}, l1_timestamp: {}, origin: {:?}", self.timestamp, batch_origin.timestamp, batch_origin.id());
return BatchValidity::Drop;
}

Expand Down
Loading