diff --git a/Cargo.lock b/Cargo.lock index ab66b3b568c..2fb48d4bf9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6725,8 +6725,8 @@ dependencies = [ "rand 0.8.5", "reth-chainspec", "reth-ethereum-forks", - "reth-net-common", "reth-network-peers", + "reth-tokio-util", "reth-tracing", "schnellru", "secp256k1", @@ -7213,7 +7213,6 @@ name = "reth-net-common" version = "1.0.0-rc.2" dependencies = [ "alloy-primitives", - "tokio", ] [[package]] diff --git a/crates/net/common/Cargo.toml b/crates/net/common/Cargo.toml index 975c2bdecc7..360c27c0aeb 100644 --- a/crates/net/common/Cargo.toml +++ b/crates/net/common/Cargo.toml @@ -13,7 +13,4 @@ workspace = true [dependencies] # ethereum -alloy-primitives.workspace = true - -# async -tokio = { workspace = true, features = ["time"] } +alloy-primitives.workspace = true \ No newline at end of file diff --git a/crates/net/common/src/lib.rs b/crates/net/common/src/lib.rs index 3020abf26d6..b4fcc48d675 100644 --- a/crates/net/common/src/lib.rs +++ b/crates/net/common/src/lib.rs @@ -9,5 +9,3 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] pub mod ban_list; - -pub mod ratelimit; diff --git a/crates/net/dns/Cargo.toml b/crates/net/dns/Cargo.toml index b20253a5bf3..64419db96f2 100644 --- a/crates/net/dns/Cargo.toml +++ b/crates/net/dns/Cargo.toml @@ -14,8 +14,8 @@ workspace = true [dependencies] # reth reth-ethereum-forks.workspace = true -reth-net-common.workspace = true reth-network-peers = { workspace = true, features = ["secp256k1"] } +reth-tokio-util = { workspace = true, features = ["time"] } # ethereum alloy-primitives.workspace = true diff --git a/crates/net/dns/src/query.rs b/crates/net/dns/src/query.rs index a1c67740ed7..6023f82dcf2 100644 --- a/crates/net/dns/src/query.rs +++ b/crates/net/dns/src/query.rs @@ -7,7 +7,7 @@ use crate::{ tree::{DnsEntry, LinkEntry, TreeRootEntry}, }; use enr::EnrKeyUnambiguous; -use reth_net_common::ratelimit::{Rate, RateLimit}; +use reth_tokio_util::ratelimit::{Rate, RateLimit}; use std::{ collections::VecDeque, future::Future, diff --git a/crates/tokio-util/Cargo.toml b/crates/tokio-util/Cargo.toml index ccace030c0f..3a8ad768d59 100644 --- a/crates/tokio-util/Cargo.toml +++ b/crates/tokio-util/Cargo.toml @@ -19,4 +19,7 @@ tokio = { workspace = true, features = ["sync"] } tokio-stream = { workspace = true, features = ["sync"] } [dev-dependencies] -tokio = { workspace = true, features = ["full", "macros"] } \ No newline at end of file +tokio = { workspace = true, features = ["full", "macros"] } + +[features] +time = ["tokio/time"] \ No newline at end of file diff --git a/crates/tokio-util/src/lib.rs b/crates/tokio-util/src/lib.rs index 2053bf60bc5..e476c4063d9 100644 --- a/crates/tokio-util/src/lib.rs +++ b/crates/tokio-util/src/lib.rs @@ -12,3 +12,6 @@ mod event_sender; mod event_stream; pub use event_sender::EventSender; pub use event_stream::EventStream; + +#[cfg(feature = "time")] +pub mod ratelimit; diff --git a/crates/net/common/src/ratelimit.rs b/crates/tokio-util/src/ratelimit.rs similarity index 100% rename from crates/net/common/src/ratelimit.rs rename to crates/tokio-util/src/ratelimit.rs