From 50c1a8e48aef0fd577659db915275ac64bdf7cab Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 21 Jun 2024 02:10:07 +0200 Subject: [PATCH] chore: move ratelimit type to tokio util (#9007) --- Cargo.lock | 3 +-- crates/net/common/Cargo.toml | 5 +---- crates/net/common/src/lib.rs | 2 -- crates/net/dns/Cargo.toml | 2 +- crates/net/dns/src/query.rs | 2 +- crates/tokio-util/Cargo.toml | 5 ++++- crates/tokio-util/src/lib.rs | 3 +++ crates/{net/common => tokio-util}/src/ratelimit.rs | 0 8 files changed, 11 insertions(+), 11 deletions(-) rename crates/{net/common => tokio-util}/src/ratelimit.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 3ebaa9a26..bb62e8c47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6739,8 +6739,8 @@ dependencies = [ "rand 0.8.5", "reth-chainspec", "reth-ethereum-forks", - "reth-net-common", "reth-network-peers", + "reth-tokio-util", "reth-tracing", "schnellru", "secp256k1", @@ -7225,7 +7225,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 975c2bdec..360c27c0a 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 3020abf26..b4fcc48d6 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 b20253a5b..64419db96 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 a1c67740e..6023f82dc 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 ccace030c..3a8ad768d 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 2053bf60b..e476c4063 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