Skip to content

Commit

Permalink
feat(workspace): Distribute pipeline, not providers
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Oct 19, 2024
1 parent 49c3118 commit ba3c337
Show file tree
Hide file tree
Showing 51 changed files with 167 additions and 266 deletions.
80 changes: 32 additions & 48 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ kona-common = { path = "crates/common", version = "0.0.3", default-features = fa
kona-derive = { path = "crates/derive", version = "0.0.3", default-features = false }
kona-preimage = { path = "crates/preimage", version = "0.0.3", default-features = false }
kona-executor = { path = "crates/executor", version = "0.0.2", default-features = false }
kona-providers = { path = "crates/providers", version = "0.0.1", default-features = false }
kona-common-proc = { path = "crates/common-proc", version = "0.0.3", default-features = false }
kona-providers-alloy = { path = "crates/providers-alloy", version = "0.0.1", default-features = false }
kona-derive-alloy = { path = "crates/derive-alloy", version = "0.0.1", default-features = false }

# Alloy
alloy-rlp = { version = "0.3.8", default-features = false }
Expand Down Expand Up @@ -123,7 +122,7 @@ miniz_oxide = "0.8.0"
brotli = { version = "7.0.0", default-features = false }

# Testing
pprof = "0.13.0"
pprof = "0.13.0"
proptest = "1.5"
criterion = "0.5.1"

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rollup state transition in order to verify an [L2 output root][g-output-root] fr

### Alternative Backends

Kona's libraries were built with alternative backend support and extensibility in mind - it is not just a fault proof
Kona's libraries were built with alternative backend support and extensibility in mind - it is not just a fault proof
program! Kona is also used by:

- [`op-succinct`][op-succinct]
Expand Down Expand Up @@ -59,11 +59,13 @@ see the [SDK section of the book](https://anton-rs.github.io/kona/sdk/intro.html

- [`common`](./crates/common): A suite of utilities for developing `client` programs to be run on top of Fault Proof VMs.
- [`common-proc`](./crates/common-proc): Proc macro for the `client` program entrypoint.
- [`primitives`](./crates/primitives): Primitive types for use in `kona` crates.
- [`preimage`](./crates/preimage): High level interfaces to the [`PreimageOracle`][fpp-specs] ABI

**Protocol**
- [`mpt`](./crates/mpt): Utilities for interacting with the Merkle Patricia Trie in the client program.
- [`executor`](./crates/executor): `no_std` stateless block executor for the [OP Stack][op-stack].
- [`derive`](./crates/derive): `no_std` compatible implementation of the [derivation pipeline][g-derivation-pipeline].
- [`derive-alloy`](./crates/derive-alloy/): Online, `alloy`-backed derivation pipeline.

## Book

Expand Down
1 change: 0 additions & 1 deletion bin/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ kona-common.workspace = true
kona-derive.workspace = true
kona-preimage.workspace = true
kona-executor.workspace = true
kona-providers.workspace = true
kona-common-proc.workspace = true

# Alloy
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 @@ -8,9 +8,9 @@ use alloy_primitives::{Bytes, B256};
use alloy_rlp::Decodable;
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use kona_derive::traits::ChainProvider;
use kona_mpt::{OrderedListWalker, TrieProvider};
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use kona_providers::ChainProvider;
use op_alloy_protocol::BlockInfo;

/// The oracle-backed L1 chain provider for the client program.
Expand Down
6 changes: 4 additions & 2 deletions bin/client/src/l1/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ use kona_derive::{
AttributesQueue, BatchQueue, BatchStream, ChannelProvider, ChannelReader, FrameQueue,
L1Retrieval, L1Traversal,
},
traits::{ActivationSignal, BlobProvider, OriginProvider, ResetSignal, Signal, SignalReceiver},
traits::{
ActivationSignal, BlobProvider, ChainProvider, L2ChainProvider, OriginProvider,
ResetSignal, Signal, SignalReceiver,
},
};
use kona_executor::{KonaHandleRegister, StatelessL2BlockExecutor};
use kona_mpt::{TrieHinter, TrieProvider};
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use kona_providers::{ChainProvider, L2ChainProvider};
use op_alloy_consensus::OpTxType;
use op_alloy_genesis::RollupConfig;
use op_alloy_protocol::{BlockInfo, L2BlockInfo};
Expand Down
2 changes: 1 addition & 1 deletion bin/client/src/l2/chain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use alloy_primitives::{Address, Bytes, B256};
use alloy_rlp::Decodable;
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use kona_derive::traits::L2ChainProvider;
use kona_mpt::{OrderedListWalker, TrieHinter, TrieProvider};
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use kona_providers::L2ChainProvider;
use op_alloy_consensus::{OpBlock, OpTxEnvelope};
use op_alloy_genesis::{RollupConfig, SystemConfig};
use op_alloy_protocol::{to_system_config, L2BlockInfo};
Expand Down
6 changes: 3 additions & 3 deletions bin/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ kona-client.workspace = true
kona-derive.workspace = true
kona-common.workspace = true
kona-preimage.workspace = true
kona-providers-alloy.workspace = true
kona-derive-alloy.workspace = true

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

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 @@ -14,7 +14,7 @@ use clap::{
builder::styling::{AnsiColor, Color, Style},
ArgAction, Parser,
};
use kona_providers_alloy::{OnlineBeaconClient, OnlineBlobProvider};
use kona_derive_alloy::{OnlineBeaconClient, OnlineBlobProvider};
use op_alloy_genesis::RollupConfig;
use serde::Serialize;
use std::{path::PathBuf, sync::Arc};
Expand Down
2 changes: 1 addition & 1 deletion bin/host/src/fetcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use alloy_rpc_types::{
use anyhow::{anyhow, Result};
use kona_client::HintType;
use kona_derive::sources::IndexedBlobHash;
use kona_derive_alloy::{OnlineBeaconClient, OnlineBlobProvider};
use kona_preimage::{PreimageKey, PreimageKeyType};
use kona_providers_alloy::{OnlineBeaconClient, OnlineBlobProvider};
use op_alloy_protocol::BlockInfo;
use std::sync::Arc;
use tokio::sync::RwLock;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kona-providers-alloy"
description = "Alloy provider implementations for Kona"
name = "kona-derive-alloy"
description = "An alloy-backed derivation pipeline for the OP Stack, built on `kona-derive`"
version = "0.0.1"
edition.workspace = true
authors.workspace = true
Expand Down Expand Up @@ -35,7 +35,6 @@ alloy-serde.workspace = true
async-trait.workspace = true

# Workspace
kona-providers.workspace = true
kona-derive = { workspace = true, features = ["serde"] }

# `metrics` feature dependencies
Expand All @@ -46,7 +45,7 @@ prometheus = { workspace = true, optional = true, features = ["process"] }
thiserror = { workspace = true, optional = true }
alloy-rpc-client = { workspace = true, optional = true }
alloy-node-bindings = { workspace = true, optional = true }
alloy-transport-http = { workspace = true, optional = true, features = ["reqwest"] }
alloy-transport-http = { workspace = true, optional = true, features = ["reqwest"] }

[dev-dependencies]
thiserror.workspace = true
Expand All @@ -55,17 +54,15 @@ alloy-rpc-client.workspace = true
alloy-node-bindings.workspace = true
alloy-transport-http.workspace = true
tokio = { workspace = true, features = ["full"] }
kona-providers = { workspace = true, features = ["test-utils"] }
kona-derive = { workspace = true, features = ["serde", "test-utils"] }

[features]
default = []
metrics = ["dep:prometheus", "dep:lazy_static"]
test-utils = [
"dep:thiserror",
"dep:thiserror",
"dep:alloy-rpc-client",
"dep:alloy-node-bindings",
"dep:alloy-transport-http",
"kona-derive/test-utils",
"kona-providers/test-utils",
]
5 changes: 5 additions & 0 deletions crates/derive-alloy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## `kona-derive-alloy`

_Notice: Requires an `std` environment._

An online, alloy-backed derivation pipeline, built on [`kona-derive`](../derive).
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloy_provider::{Provider, ReqwestProvider};
use alloy_rlp::{Buf, Decodable};
use alloy_transport::{RpcError, TransportErrorKind, TransportResult};
use async_trait::async_trait;
use kona_providers::{ChainProvider, L2ChainProvider};
use kona_derive::traits::{ChainProvider, L2ChainProvider};
use lru::LruCache;
use op_alloy_consensus::OpBlock;
use op_alloy_genesis::{RollupConfig, SystemConfig};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 1 addition & 6 deletions crates/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ async-trait.workspace = true
unsigned-varint.workspace = true
alloc-no-stdlib.workspace = true

# Workspace
kona-providers.workspace = true

# `serde` feature dependencies
serde = { workspace = true, optional = true, features = ["derive"] }

Expand All @@ -49,7 +46,7 @@ spin = { workspace = true, optional = true }
anyhow = { workspace = true, optional = true }
alloy-rpc-client = { workspace = true, optional = true }
alloy-node-bindings = { workspace = true, optional = true }
alloy-transport-http = { workspace = true, optional = true }
alloy-transport-http = { workspace = true, optional = true }
tracing-subscriber = { workspace = true, optional = true, features = ["fmt"] }

[dev-dependencies]
Expand All @@ -62,7 +59,6 @@ alloy-node-bindings.workspace = true
alloy-transport-http.workspace = true
tokio = { workspace = true, features = ["full"] }
tracing-subscriber = { workspace = true, features = ["fmt"] }
kona-providers = { workspace = true, features = ["test-utils"] }
alloy-primitives = { workspace = true, features = ["rlp", "k256", "map", "arbitrary"] }

[features]
Expand All @@ -87,6 +83,5 @@ test-utils = [
"dep:alloy-node-bindings",
"dep:tracing-subscriber",
"dep:alloy-rpc-client",
"kona-providers/test-utils",
"alloy-transport-http/reqwest"
]
9 changes: 5 additions & 4 deletions crates/derive/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
errors::{
BuilderError, PipelineEncodingError, PipelineError, PipelineErrorKind, PipelineResult,
},
traits::AttributesBuilder,
traits::{AttributesBuilder, ChainProvider, L2ChainProvider},
};
use alloc::{boxed::Box, fmt::Debug, string::ToString, sync::Arc, vec, vec::Vec};
use alloy_consensus::{Eip658Value, Receipt};
Expand All @@ -13,7 +13,6 @@ use alloy_primitives::{address, Address, Bytes, B256, B64};
use alloy_rlp::Encodable;
use alloy_rpc_types_engine::PayloadAttributes;
use async_trait::async_trait;
use kona_providers::{ChainProvider, L2ChainProvider};
use op_alloy_consensus::Hardforks;
use op_alloy_genesis::{RollupConfig, SystemConfig};
use op_alloy_protocol::{decode_deposit, L1BlockInfoTx, L2BlockInfo, DEPOSIT_EVENT_ABI_HASH};
Expand Down Expand Up @@ -266,11 +265,13 @@ async fn derive_deposits(
#[cfg(test)]
mod tests {
use super::*;
use crate::{errors::ResetError, test_utils::TestSystemConfigL2Fetcher};
use crate::{
errors::ResetError,
test_utils::{TestChainProvider, TestSystemConfigL2Fetcher},
};
use alloc::vec;
use alloy_consensus::Header;
use alloy_primitives::{Log, LogData, B256, U256, U64};
use kona_providers::test_utils::TestChainProvider;
use op_alloy_genesis::SystemConfig;
use op_alloy_protocol::{BlockInfo, DepositError};

Expand Down
2 changes: 1 addition & 1 deletion crates/derive/src/batch/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This module contains the batch types for the OP Stack derivation pipeline: [SpanBatch] &
//! [SingleBatch].

use crate::traits::L2ChainProvider;
use alloy_rlp::{Buf, Decodable};
use kona_providers::L2ChainProvider;
use op_alloy_genesis::RollupConfig;
use op_alloy_protocol::{BlockInfo, L2BlockInfo};

Expand Down
Loading

0 comments on commit ba3c337

Please sign in to comment.