Skip to content
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
32 changes: 16 additions & 16 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions bin/client/src/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use core::fmt::Debug;
use kona_driver::{Driver, DriverError};
use kona_executor::{ExecutorError, KonaHandleRegister, TrieDBProvider};
use kona_preimage::{CommsClient, HintWriterClient, PreimageKey, PreimageOracleClient};
use kona_proof::l1::OracleEigenDaProvider;
use kona_proof::{
errors::OracleProviderError,
executor::KonaExecutor,
Expand All @@ -17,7 +18,6 @@ use kona_proof::{
};
use thiserror::Error;
use tracing::{error, info};
use kona_proof::l1::OracleEigenDaProvider;

/// An error that can occur when running the fault proof program.
#[derive(Error, Debug)]
Expand Down Expand Up @@ -66,7 +66,6 @@ where
let beacon = OracleBlobProvider::new(oracle.clone());
let eigen_da_provider = OracleEigenDaProvider::new(oracle.clone());


// Fetch the safe head's block header.
let safe_head = l2_provider
.header_by_hash(safe_head_hash)
Expand Down
1 change: 0 additions & 1 deletion bin/host/src/bin/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@ async fn main() -> Result<()> {
}
}

info!("Exiting host program.");
Ok(())
}
1 change: 0 additions & 1 deletion bin/host/src/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub use disk::DiskKeyValueStore;
mod split;
pub use split::SplitKeyValueStore;


/// A type alias for a shared key-value store.
pub type SharedKeyValueStore = Arc<RwLock<dyn KeyValueStore + Send + Sync>>;

Expand Down
52 changes: 23 additions & 29 deletions bin/host/src/single/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use alloy_primitives::B256;
use alloy_provider::RootProvider;
use anyhow::{anyhow, Result};
use clap::Parser;
use eigen_da::{EigenDaConfig, EigenDaProxy};
use kona_preimage::{
BidirectionalChannel, Channel, HintReader, HintWriter, OracleReader, OracleServer,
};
Expand All @@ -20,13 +21,12 @@ use kona_std_fpvm::{FileChannel, FileDescriptor};
use op_alloy_genesis::RollupConfig;
use op_alloy_network::Optimism;
use serde::Serialize;
use std::{path::PathBuf, sync::Arc};
use std::time::Duration;
use std::{path::PathBuf, sync::Arc};
use tokio::{
sync::RwLock,
task::{self, JoinHandle},
};
use eigen_da::{EigenDaConfig, EigenDaProxy};

/// The host binary CLI application arguments.
#[derive(Default, Parser, Serialize, Clone, Debug)]
Expand Down Expand Up @@ -110,12 +110,11 @@ pub struct SingleChainHost {
)]
pub rollup_config_path: Option<PathBuf>,
/// The url of Mantle da indexer.
#[clap(long,
alias = "da-indexer-url",
env)]
#[clap(long, alias = "da-indexer-url", env)]
pub mantle_da_indexer_url: Option<String>,
/// The url of EigenDA Proxy service
#[clap(long,
#[clap(
long,
alias = "proxy-url",
conflicts_with = "mantle_da_indexer_url",
required_unless_present = "mantle_da_indexer_url",
Expand All @@ -124,11 +123,7 @@ pub struct SingleChainHost {
pub proxy_url: Option<String>,
/// EigenDA Disperser RPC URL
/// does not need to be configured in derive.
#[clap(long,
alias = "disperse-url",
conflicts_with = "mantle_da_indexer_url",
env
)]
#[clap(long, alias = "disperse-url", conflicts_with = "mantle_da_indexer_url", env)]
pub disperse_url: Option<String>,
/// The total amount of time that the batcher will spend waiting for EigenDA to disperse a blob
/// does not need to be configured in derive.
Expand All @@ -152,7 +147,8 @@ pub struct SingleChainHost {
}

fn parse_duration(input: &str) -> Result<Duration, String> {
input.parse::<u64>()
input
.parse::<u64>()
.map(Duration::from_secs)
.map_err(|e| format!("Failed to parse duration: {}", e))
}
Expand Down Expand Up @@ -230,10 +226,10 @@ impl SingleChainHost {

/// Returns `true` if the host is running in offline mode.
pub const fn is_offline(&self) -> bool {
self.l1_node_address.is_none() &&
self.l2_node_address.is_none() &&
self.l1_beacon_address.is_none() &&
self.data_dir.is_some()
self.l1_node_address.is_none()
&& self.l2_node_address.is_none()
&& self.l1_beacon_address.is_none()
&& self.data_dir.is_some()
}

/// Reads the [RollupConfig] from the file system and returns it as a string.
Expand Down Expand Up @@ -284,27 +280,25 @@ impl SingleChainHost {

let mut eigen_da_config = EigenDaConfig::default();
let mut eigen_proxy_url = "".to_string();
let mut da_indexer_url = "".to_string();
let da_indexer_url = "".to_string();
let mantle_da_indexer = false;
// match self.read_rollup_config().ok() {
// Some(rollup_config) => {
// if rollup_config.mantle_da_switch {
// mantle_da_switch = true;
// // da_indexer_url = self.mantle_da_indexer_url.clone().ok_or(anyhow!("Mantle da indexer URL must be set"))?;
// }
// }
// None => {}
// }

if da_indexer_url.is_empty() {
eigen_proxy_url = self.proxy_url.clone().ok_or(anyhow!("EigenDA Proxy URL must be set"))?;
eigen_proxy_url =
self.proxy_url.clone().ok_or(anyhow!("EigenDA Proxy URL must be set"))?;
}
eigen_da_config.proxy_url = eigen_proxy_url;
eigen_da_config.retrieve_blob_timeout = self.retrieve_timeout;
let eigen_da_provider = EigenDaProxy::new(eigen_da_config);
let mut eigen_da = OnlineEigenDaProvider::new(eigen_da_provider,da_indexer_url, mantle_da_indexer);
let eigen_da =
OnlineEigenDaProvider::new(eigen_da_provider, da_indexer_url, mantle_da_indexer);

Ok(SingleChainProviders { l1: l1_provider, blobs: blob_provider, l2: l2_provider, eigen_da })
Ok(SingleChainProviders {
l1: l1_provider,
blobs: blob_provider,
l2: l2_provider,
eigen_da,
})
}
}

Expand Down
3 changes: 1 addition & 2 deletions bin/host/src/single/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ impl HintHandler for SingleChainHintHandler {
HintType::EigenDa => {
ensure!(hint.data.len() > 32, "Invalid hint data length");


let commitment = hint.data.to_vec();
// Fetch the blob from the eigen da provider.
let blob = providers
Expand All @@ -361,7 +360,7 @@ impl HintHandler for SingleChainHintHandler {
.map_err(|e| anyhow!("Failed to fetch blob: {e}"))?;
let mut kv_lock = kv.write().await;
kv_lock.set(
PreimageKey::new(*keccak256(commitment),PreimageKeyType::GlobalGeneric).into(),
PreimageKey::new(*keccak256(commitment), PreimageKeyType::GlobalGeneric).into(),
blob.into(),
)?;
}
Expand Down
16 changes: 5 additions & 11 deletions crates/derive/src/attributes/stateful.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use alloy_rlp::Encodable;
use alloy_rpc_types_engine::PayloadAttributes;
use async_trait::async_trait;
use op_alloy_genesis::RollupConfig;
use op_alloy_protocol::{decode_deposit, L1BlockInfoTx, DEPOSIT_EVENT_ABI_HASH};
use op_alloy_protocol::L2BlockInfo;
use op_alloy_protocol::{decode_deposit, L1BlockInfoTx, DEPOSIT_EVENT_ABI_HASH};
use op_alloy_rpc_types_engine::OpPayloadAttributes;

/// The sequencer fee vault address.
Expand Down Expand Up @@ -89,10 +89,7 @@ where
.await
.map_err(|e| PipelineError::BadEncoding(e).crit())?;
sys_config
.update_with_receipts(
&receipts,
self.rollup_cfg.l1_system_config_address,
)
.update_with_receipts(&receipts, self.rollup_cfg.l1_system_config_address)
.map_err(|e| PipelineError::SystemConfigUpdate(e).crit())?;
l1_header = header;
deposit_transactions = deposits;
Expand Down Expand Up @@ -127,7 +124,6 @@ where
));
}


// Build and encode the L1 info transaction for the current payload.
let (_, l1_info_tx_envelope) = L1BlockInfoTx::try_new_with_deposit_tx(
&self.rollup_cfg,
Expand All @@ -142,8 +138,7 @@ where
let mut encoded_l1_info_tx = Vec::with_capacity(l1_info_tx_envelope.length());
l1_info_tx_envelope.encode_2718(&mut encoded_l1_info_tx);

let mut txs =
Vec::with_capacity(1 + deposit_transactions.len());
let mut txs = Vec::with_capacity(1 + deposit_transactions.len());
txs.push(encoded_l1_info_tx.into());
txs.extend(deposit_transactions);

Expand Down Expand Up @@ -210,8 +205,8 @@ mod tests {
use alloy_consensus::Header;
use alloy_primitives::{Log, LogData, B256, U256, U64};
use op_alloy_genesis::SystemConfig;
use op_alloy_protocol::{DepositError};
use op_alloy_protocol::BlockInfo;
use op_alloy_protocol::DepositError;
use proptest::num::u128;

fn generate_valid_log() -> Log {
Expand Down Expand Up @@ -439,5 +434,4 @@ mod tests {
assert_eq!(payload, expected);
assert_eq!(payload.transactions.unwrap().len(), 1);
}

}
}
8 changes: 3 additions & 5 deletions crates/derive/src/da/da.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::fmt::Display;
use async_trait::async_trait;
use alloc::boxed::Box;
use core::fmt::Display;

#[async_trait]
pub trait IEigenDA {

/// The error type for the [IEigenDA].
type Error: Display;

Expand All @@ -14,5 +13,4 @@ pub trait IEigenDA {
&self,
commitment: &[u8],
) -> Result<Vec<u8>, Self::Error>;

}
}
2 changes: 1 addition & 1 deletion crates/derive/src/da/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub mod da;
pub use da::*;
pub use da::*;
3 changes: 1 addition & 2 deletions crates/derive/src/errors/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ pub enum EigenDAProviderError {
RLPDecodeError(String),
#[error("Failed to decode proto buf, error: {0}")]
ProtoDecodeError(String),

}
}
2 changes: 1 addition & 1 deletion crates/derive/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ mod sources;
pub use sources::{BlobDecodingError, BlobProviderError};

mod da;
pub use da::{EigenDAProxyError, EigenDAProviderError};
pub use da::{EigenDAProviderError, EigenDAProxyError};
4 changes: 2 additions & 2 deletions crates/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub mod stages;
pub mod traits;
pub mod types;

pub mod da;
mod proto;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;
mod proto;
pub mod da;
6 changes: 2 additions & 4 deletions crates/derive/src/pipeline/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@ where
let frame_queue = FrameQueue::new(l1_retrieval, Arc::clone(&rollup_config));
let channel_provider = ChannelProvider::new(Arc::clone(&rollup_config), frame_queue);
let channel_reader = ChannelReader::new(channel_provider, Arc::clone(&rollup_config));
let batch_stream =
BatchStream::new(channel_reader);
let batch_provider =
BatchProvider::new(rollup_config.clone(), batch_stream);
let batch_stream = BatchStream::new(channel_reader);
let batch_provider = BatchProvider::new(rollup_config.clone(), batch_stream);
let attributes =
AttributesQueue::new(rollup_config.clone(), batch_provider, attributes_builder);

Expand Down
Loading