Skip to content

Commit

Permalink
chore: Split Alloy (#103)
Browse files Browse the repository at this point in the history
### Description

Breaks up alloy
  • Loading branch information
refcell authored Oct 18, 2024
1 parent a809286 commit e6538c7
Show file tree
Hide file tree
Showing 21 changed files with 133 additions and 165 deletions.
85 changes: 15 additions & 70 deletions Cargo.lock

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

40 changes: 19 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,35 @@ rollup = { path = "crates/rollup" }
ser = { path = "crates/ser" }
kona-providers-local = { path = "crates/providers-local" }

# Optimism
superchain = { git = "https://github.com/anton-rs/superchain", branch = "main", default-features = false }
# Kona
kona-derive = { git = "https://github.com/anton-rs/kona", branch = "main", default-features = true }
kona-providers = { git = "https://github.com/anton-rs/kona", branch = "main", default-features = true }
kona-providers-alloy = { git = "https://github.com/anton-rs/kona", branch = "main", default-features = true }
kona-primitives = { git = "https://github.com/anton-rs/kona", branch = "main", default-features = true }
kona-derive = { git = "https://github.com/anton-rs/kona", branch = "main", default-features = true }
kona-providers-alloy = { git = "https://github.com/anton-rs/kona", branch = "main", default-features = true }

# Superchain
superchain = { git = "https://github.com/anton-rs/superchain", branch = "main", default-features = false }

# Alloy
alloy = { version = "0.4.2", features = [
"contract",
"providers",
"provider-http",
"provider-ws",
"provider-ipc",
"signers",
"consensus",
"rpc-types",
"rpc-types-engine",
"network",
"ssz"
] }
alloy-rlp = "0.3"
alloy-rlp = { version = "0.3.8", default-features = false }
alloy-eips = { version = "0.4", default-features = false }
alloy-signer = { version = "0.4.2", default-features = false }
alloy-network = { version = "0.4.2", default-features = false }
alloy-provider = { version = "0.4.2", default-features = false }
alloy-contract = { version = "0.4.2", default-features = false }
alloy-transport = { version = "0.4.2", default-features = false }
alloy-rpc-types = { version = "0.4.2", default-features = false }
alloy-consensus = { version = "0.4.2", default-features = false }
alloy-primitives = { version = "0.8.8", default-features = false }
alloy-rpc-types-engine = { version = "0.4.2", default-features = false }

# Op Alloy
op-alloy-consensus = { version = "0.4.0", default-features = false }
op-alloy-protocol = { version = "0.4.0", default-features = false }
op-alloy-genesis = { version = "0.4.0", default-features = false }
op-alloy-protocol = { version = "0.4.0", default-features = false }
op-alloy-consensus = { version = "0.4.0", default-features = false }
op-alloy-rpc-types = { version = "0.4.0", default-features = false }
op-alloy-rpc-types-engine = { version = "0.4.0", default-features = false }
op-alloy-rpc-jsonrpsee = { version = "0.4.0", default-features = false }
op-alloy-rpc-types-engine = { version = "0.4.0", default-features = false }

# Reth
reth = { git = "https://github.com/paradigmxyz/reth", rev = "a846cbd" }
Expand Down
9 changes: 6 additions & 3 deletions crates/net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ rust-version.workspace = true

[dependencies]
# Alloy
alloy.workspace = true
alloy-rlp.workspace = true
alloy-primitives = { workspace = true, features = ["k256"] }
alloy-rpc-types-engine = { workspace = true, features = ["std"] }

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

# Networking
Expand All @@ -37,8 +40,8 @@ arbitrary = { workspace = true, features = ["derive"], optional = true }
[dev-dependencies]
arbtest.workspace = true
arbitrary = { workspace = true, features = ["derive"] }
alloy = { workspace = true, features = ["arbitrary"] }
alloy-primitives = { workspace = true, features = ["arbitrary"] }

[features]
default = []
arbitrary = ["dep:arbitrary", "alloy/arbitrary"]
arbitrary = ["dep:arbitrary", "alloy-primitives/arbitrary"]
2 changes: 1 addition & 1 deletion crates/net/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Contains a gossipsub driver to run discv5 peer discovery and block gossip.

```rust,no_run
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use alloy::primitives::address;
use alloy_primitives::address;
use op_net::driver::NetworkDriver;
// Build the network driver.
Expand Down
4 changes: 2 additions & 2 deletions crates/net/src/builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Network Builder Module.

use alloy::primitives::Address;
use alloy_primitives::Address;
use discv5::{Config, ListenConfig};
use eyre::Result;
use std::{
Expand Down Expand Up @@ -151,7 +151,7 @@ impl NetworkDriverBuilder {
/// ## Example
///
/// ```rust
/// use alloy::primitives::{address, Address};
/// use alloy_primitives::{address, Address};
/// use discv5::{ConfigBuilder, ListenConfig};
/// use op_net::builder::NetworkDriverBuilder;
/// use std::net::{IpAddr, Ipv4Addr, SocketAddr};
Expand Down
3 changes: 2 additions & 1 deletion crates/net/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

use std::sync::mpsc::Receiver;

use alloy::{primitives::Address, rpc::types::engine::ExecutionPayload};
use alloy_primitives::Address;
use alloy_rpc_types_engine::ExecutionPayload;
use eyre::Result;
use tokio::{select, sync::watch};

Expand Down
2 changes: 1 addition & 1 deletion crates/net/src/gossip/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Behaviour {
mod tests {
use super::*;
use crate::gossip::{config, handler::BlockHandler};
use alloy::primitives::Address;
use alloy_primitives::Address;
use libp2p::gossipsub::{IdentTopic, TopicHash};

fn zero_topics() -> Vec<TopicHash> {
Expand Down
3 changes: 2 additions & 1 deletion crates/net/src/gossip/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use std::{
time::SystemTime,
};

use alloy::{primitives::Address, rpc::types::engine::ExecutionPayload};
use alloy_primitives::Address;
use alloy_rpc_types_engine::ExecutionPayload;
use libp2p::gossipsub::{IdentTopic, Message, MessageAcceptance, TopicHash};
use op_alloy_rpc_types_engine::OpNetworkPayloadEnvelope;
use tokio::sync::watch;
Expand Down
5 changes: 2 additions & 3 deletions crates/net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]

pub mod builder;
pub mod discovery;
pub mod driver;
pub mod gossip;
pub mod types;

pub mod builder;
pub mod driver;
6 changes: 3 additions & 3 deletions crates/net/src/types/enr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ impl Encodable for OpStackEnr {
let version_slice = encode::u128(self.version as u128, &mut version_buf);

let opstack = [chain_id_slice, version_slice].concat();
alloy::primitives::Bytes::from(opstack).encode(out);
alloy_primitives::Bytes::from(opstack).encode(out);
}
}

impl Decodable for OpStackEnr {
fn decode(buf: &mut &[u8]) -> alloy_rlp::Result<Self> {
let bytes = alloy::primitives::Bytes::decode(buf)?;
let bytes = alloy_primitives::Bytes::decode(buf)?;
let (chain_id, rest) = decode::u64(&bytes)
.map_err(|_| alloy_rlp::Error::Custom("could not decode chain id"))?;
let (version, _) =
Expand All @@ -62,7 +62,7 @@ impl Decodable for OpStackEnr {
#[cfg(test)]
mod tests {
use super::*;
use alloy::primitives::{bytes, Bytes};
use alloy_primitives::{bytes, Bytes};

#[test]
fn roundtrip_op_stack_enr() {
Expand Down
28 changes: 20 additions & 8 deletions crates/providers-local/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,29 @@ categories.workspace = true
rust-version.workspace = true

[dependencies]
reth.workspace = true
alloy.workspace = true
# Alloy
alloy-rlp.workspace = true
hashbrown.workspace = true
async-trait.workspace = true
parking_lot.workspace = true
alloy-eips.workspace = true
alloy-signer.workspace = true
alloy-consensus.workspace = true
alloy-primitives.workspace = true

# Op Alloy
op-alloy-protocol.workspace = true

# Kona
kona-derive.workspace = true
kona-providers.workspace = true
kona-providers-alloy.workspace = true
kona-primitives.workspace = true
tracing.workspace = true
eyre.workspace = true

# Reth
reth.workspace = true

# Misc
url.workspace = true
op-alloy-protocol.workspace = true
eyre.workspace = true
tracing.workspace = true
hashbrown.workspace = true
async-trait.workspace = true
parking_lot.workspace = true
3 changes: 2 additions & 1 deletion crates/providers-local/src/blob_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
use alloc::{boxed::Box, collections::VecDeque, string::ToString, sync::Arc, vec::Vec};
use hashbrown::HashMap;

use alloy::{eips::eip4844::Blob, primitives::B256};
use alloy_eips::eip4844::Blob;
use alloy_primitives::B256;
use async_trait::async_trait;
use eyre::{eyre, Result};
use kona_derive::{errors::BlobProviderError, traits::BlobProvider};
Expand Down
Loading

0 comments on commit e6538c7

Please sign in to comment.