Skip to content

Commit

Permalink
chore: cleanup crates/modules structure and dependencies (#14)
Browse files Browse the repository at this point in the history
* chore: cleanup crates/modules structure and dependencies

* chore: rename hokulea-eigenda-proof -> hokulea-proof
  • Loading branch information
samlaf authored Dec 16, 2024
1 parent 6893f5e commit 8c2dfa3
Show file tree
Hide file tree
Showing 17 changed files with 146 additions and 279 deletions.
188 changes: 77 additions & 111 deletions Cargo.lock

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ members = ["bin/*"]
[workspace.dependencies]
# Workspace
hokulea-client = { path = "bin/client", version = "0.1.0", default-features = false }
eigenda = { path = "crates/eigenda", version = "0.1.0", default-features = false }
eigenda-proof = { path = "crates/proof", version = "0.1.0", default-features = false }
hokulea-eigenda = { path = "crates/eigenda", version = "0.1.0", default-features = false }
hokulea-proof = { path = "crates/proof", version = "0.1.0", default-features = false }

# Kona
# We use git dependencies instead of version dependencies because Kona is moving very fast right now
# but publish infrequently (last was 2 weeks ago). We want to make sure to use the latest code
# while we're still figuring out how to integrate with it.
kona-mpt = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-derive = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-driver = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-executor = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-proof = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-std-fpvm = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-preimage = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-std-fpvm-proc = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-mpt = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }
kona-derive = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }
kona-driver = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }
kona-executor = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }
kona-proof = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }
kona-std-fpvm = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }
kona-preimage = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }
kona-std-fpvm-proc = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }

# These are kona binary crates that aren't even published to crates.io, so we need to use git dependencies.
# These two kona crates aren't published to crates.io, so we need to use git dependencies.
# TODO: Given that Hokulea is just meant to be a library crate to extend kona with eigenda understanding,
# we prob want to move these to dev-dependencies since we only need them for testing?
kona-client = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-host = { git = "https://github.com/anton-rs/kona", commit = "f2b634f", default-features = false }
kona-client = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }
kona-host = { git = "https://github.com/anton-rs/kona", rev = "8f21eff5d48f2a7e72380c15e24a927799dd8175", default-features = false }


# Alloy
Expand Down
10 changes: 1 addition & 9 deletions bin/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@ version = "0.1.0"
edition = "2021"

[dependencies]
alloy-primitives.workspace = true
alloy-provider.workspace = true
alloy-consensus.workspace = true
anyhow.workspace = true
clap.workspace = true

kona-client.workspace = true
kona-host.workspace = true
kona-preimage.workspace = true
kona-proof.workspace = true
kona-driver.workspace = true
kona-executor.workspace = true

eigenda.workspace = true
eigenda-proof.workspace = true
hokulea-proof.workspace = true

thiserror.workspace = true
tracing.workspace = true

4 changes: 2 additions & 2 deletions bin/client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate alloc;
use alloy_consensus::{Header, Sealed};
use eigenda_proof::pipeline::OraclePipeline;
use hokulea_proof::pipeline::OraclePipeline;
use kona_client::FaultProofProgramError;
use kona_driver::Driver;
use kona_preimage::{
Expand All @@ -20,7 +20,7 @@ use kona_proof::{
};
use tracing::{error, info};

use eigenda_proof::eigenda_provider::OracleEigenDAProvider;
use hokulea_proof::eigenda_provider::OracleEigenDAProvider;

#[inline]
pub async fn run<P, H>(oracle_client: P, hint_client: H) -> Result<(), FaultProofProgramError>
Expand Down
24 changes: 9 additions & 15 deletions bin/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,32 @@ edition = "2021"
[dependencies]
# Workspace
kona-mpt.workspace = true
kona-derive.workspace = true
kona-std-fpvm.workspace = true
kona-preimage = { workspace = true, features = ["std"] }
kona-proof = { workspace = true, features = ["std"] }
kona-client.workspace = true
kona-host.workspace = true

eigenda-proof.workspace = true
hokulea-proof.workspace = true
hokulea-client.workspace = true

# Alloy
alloy-rlp.workspace = true
alloy-eips = { workspace = true, features = ["kzg"] }
alloy-serde.workspace = true
alloy-provider = { workspace = true, features = ["reqwest"] }
alloy-consensus.workspace = true
alloy-rpc-client.workspace = true
alloy-transport-http.workspace = true
alloy-rpc-types = { workspace = true, features = ["eth", "debug"] }
alloy-primitives = { workspace = true, features = ["serde"] }
alloy-rpc-types-beacon.workspace = true

# Op Alloy
op-alloy-genesis = { workspace = true, features = ["std", "serde"] }
op-alloy-protocol = { workspace = true, features = ["std", "serde"] }
op-alloy-rpc-types-engine = { workspace = true, features = ["serde"] }

# Revm
revm = { workspace = true, features = ["std", "c-kzg", "secp256k1", "portable", "blst"] }
revm = { workspace = true, features = [
"std",
"c-kzg",
"secp256k1",
"portable",
"blst",
] }

# General
anyhow.workspace = true
Expand All @@ -43,10 +40,7 @@ reqwest.workspace = true
serde_json.workspace = true
async-trait.workspace = true
tokio = { workspace = true, features = ["full"] }
serde = { workspace = true, features = ["derive"] }
rocksdb = { workspace = true, features = ["snappy"] }
clap = { workspace = true, features = ["derive", "env"] }
tracing-subscriber = { workspace = true, features = ["fmt"] }

[dev-dependencies]
proptest.workspace = true
proptest.workspace = true
2 changes: 1 addition & 1 deletion bin/host/src/fetcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use alloy_rpc_types::{
Transaction,
};
use anyhow::{anyhow, Result};
use eigenda_proof::hint::{Hint, HintType};
use hokulea_proof::hint::{Hint, HintType};
use kona_host::{blobs::OnlineBlobProvider, kv::KeyValueStore};
use kona_preimage::{PreimageKey, PreimageKeyType};
use op_alloy_protocol::BlockInfo;
Expand Down
7 changes: 2 additions & 5 deletions bin/host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ pub mod preimage;

use server::PreimageServer;

use kona_host::cli::{init_tracing_subscriber, HostCli};
use kona_host::cli::HostCli;

use kona_host::kv;

use kona_client;

use hokulea_client;

use crate::eigenda_blobs::OnlineEigenDABlobProvider;
Expand All @@ -22,7 +20,6 @@ use fetcher::Fetcher;
use kona_preimage::{
BidirectionalChannel, HintReader, HintWriter, NativeChannel, OracleReader, OracleServer,
};
use kona_std_fpvm::{FileChannel, FileDescriptor};
use kv::KeyValueStore;
use std::sync::Arc;
use tokio::{sync::RwLock, task};
Expand Down Expand Up @@ -50,7 +47,7 @@ pub async fn start_server_and_native_client(cfg: HostCli) -> Result<i32> {
)
.await
.map_err(|e| anyhow!("Failed to load eigenda blob provider configuration: {e}"))?;
info!(target: "host", "create fetch with eigenda_provider");
info!(target: "host", "create fetch with eigenda_provider");
Some(Arc::new(RwLock::new(Fetcher::new(
kv_store.clone(),
l1_provider,
Expand Down
2 changes: 1 addition & 1 deletion crates/eigenda/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "eigenda"
name = "hokulea-eigenda"
version = "0.1.0"
edition = "2021"

Expand Down
3 changes: 3 additions & 0 deletions crates/eigenda/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `eigenda`

This binary contains the client program for executing the Optimism rollup state transition.
23 changes: 9 additions & 14 deletions crates/eigenda/src/eigenda_blobs.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
//! Blob Data Source
use crate::eigenda::EigenDADataSource;
use crate::eigenda_data::EigenDABlobData;
use crate::traits::EigenDABlobProvider;

use alloc::{boxed::Box, string::ToString, vec::Vec};
use alloy_primitives::{Address, Bytes};
use async_trait::async_trait;
use alloc::vec::Vec;
use alloy_primitives::Bytes;
use kona_derive::{
errors::{BlobProviderError, PipelineError},
traits::{BlobProvider, ChainProvider, DataAvailabilityProvider},
types::PipelineResult,
};

use op_alloy_protocol::{BlockInfo, Frame, DERIVATION_VERSION_0};

/// A data iterator that reads from a blob.
#[derive(Debug, Clone)]
pub struct EigenDABlobSource<B>
Expand Down Expand Up @@ -43,18 +38,18 @@ where
}

/// Loads blob data into the source if it is not open.
async fn load_blobs(&mut self, altDACommitment: &Bytes) -> Result<(), BlobProviderError> {
async fn load_blobs(&mut self, altda_commitment: &Bytes) -> Result<(), BlobProviderError> {
if self.open {
return Ok(());
}

info!(target: "eigenda-blobsource", "going to fetch through altda fetcher");
// it should use self.altda_fetcher to get the blob
let data = self.altda_fetcher.get_blob(altDACommitment).await;
let data = self.altda_fetcher.get_blob(altda_commitment).await;
match data {
Ok(data) => {
self.open = true;
let mut new_blob = data.clone();
let new_blob = data.clone();
// new_blob.truncate(data.len()-1);
let eigenda_blob = EigenDABlobData { blob: new_blob };
self.data.push(eigenda_blob);
Expand All @@ -63,7 +58,7 @@ where

Ok(())
}
Err(e) => {
Err(_) => {
self.open = true;
return Ok(());
}
Expand All @@ -79,9 +74,9 @@ where
Ok(self.data.remove(0))
}

pub async fn next(&mut self, altDACommitment: &Bytes) -> PipelineResult<Bytes> {
pub async fn next(&mut self, altda_commitment: &Bytes) -> PipelineResult<Bytes> {
info!(target: "eigenda-blobsource", "next");
self.load_blobs(altDACommitment).await?;
self.load_blobs(altda_commitment).await?;
info!(target: "eigenda-blobsource", "next 1");
let next_data = match self.next_data() {
Ok(d) => d,
Expand All @@ -99,7 +94,7 @@ where
warn!(target: "blob-source", "Failed to decode blob data, skipping");
panic!()
// todo need to add recursion
// self.next(altDACommitment).await
// self.next(altda_commitment).await
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/eigenda/src/eigenda_data.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_primitives::{Address, Bytes};
use alloy_primitives::Bytes;

use kona_derive::errors::BlobDecodingError;

Expand Down
13 changes: 9 additions & 4 deletions crates/eigenda/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![doc = include_str!("../README.md")]
#![warn(
missing_debug_implementations,
missing_docs,
Expand All @@ -14,10 +15,14 @@ extern crate alloc;
#[macro_use]
extern crate tracing;

pub mod traits;
mod traits;
pub use traits::EigenDABlobProvider;

pub mod eigenda;
mod eigenda;
pub use eigenda::EigenDADataSource;

pub mod eigenda_blobs;
mod eigenda_blobs;
pub use eigenda_blobs::EigenDABlobSource;

pub mod eigenda_data;
mod eigenda_data;
pub use eigenda_data::EigenDABlobData;
4 changes: 2 additions & 2 deletions crates/eigenda/src/traits.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use alloc::{boxed::Box, fmt::Debug, string::ToString, vec::Vec};
use alloc::{boxed::Box, string::ToString};
use alloy_primitives::Bytes;
use async_trait::async_trait;
use core::fmt::Display;
use kona_derive::{errors::PipelineErrorKind, types::PipelineResult};
use kona_derive::errors::PipelineErrorKind;

#[async_trait]
pub trait EigenDABlobProvider {
Expand Down
28 changes: 2 additions & 26 deletions crates/proof/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "eigenda-proof"
name = "hokulea-proof"
description = "Eigenda Proof SDK"
version = "0.1.0"
edition = "2021"
Expand All @@ -9,40 +9,16 @@ kona-preimage.workspace = true
kona-driver.workspace = true
kona-proof.workspace = true
kona-derive.workspace = true
eigenda.workspace = true

kona-mpt.workspace = true
kona-executor.workspace = true
# Alloy

# Op Alloy


hokulea-eigenda.workspace = true

# Alloy
alloy-rlp.workspace = true
alloy-eips.workspace = true
alloy-consensus.workspace = true
alloy-primitives.workspace = true

# Op Alloy
op-alloy-registry.workspace = true
op-alloy-protocol.workspace = true
op-alloy-consensus.workspace = true
op-alloy-rpc-types-engine.workspace = true
op-alloy-genesis = { workspace = true, features = ["serde"] }

# General
lru.workspace = true
spin.workspace = true
serde.workspace = true
tracing.workspace = true
serde_json.workspace = true
async-trait.workspace = true
thiserror.workspace = true

# `std` feature dependencies
tokio = { workspace = true, features = ["full"], optional = true }

[features]
std = ["dep:tokio"]
2 changes: 1 addition & 1 deletion crates/proof/src/eigenda_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use alloc::boxed::Box;
use alloc::sync::Arc;
use alloy_primitives::{keccak256, Bytes};
use async_trait::async_trait;
use eigenda::traits::EigenDABlobProvider;
use hokulea_eigenda::EigenDABlobProvider;
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};

use kona_proof::errors::OracleProviderError;
Expand Down
4 changes: 1 addition & 3 deletions crates/proof/src/pipeline.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use alloc::{boxed::Box, sync::Arc};
use async_trait::async_trait;
use core::fmt::Debug;
use eigenda::eigenda::EigenDADataSource;
use eigenda::eigenda_blobs::EigenDABlobSource;
use eigenda::traits::EigenDABlobProvider;
use hokulea_eigenda::{EigenDABlobProvider, EigenDABlobSource, EigenDADataSource};
use kona_derive::{
attributes::StatefulAttributesBuilder,
errors::PipelineErrorKind,
Expand Down
Loading

0 comments on commit 8c2dfa3

Please sign in to comment.