Skip to content

Commit

Permalink
chore: remove reth primitives [tokio] and [tokio-stream] dependencies (
Browse files Browse the repository at this point in the history
…paradigmxyz#5111)

Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
gr4yha7 and mattsse authored Oct 21, 2023
1 parent 9dd270e commit 33df4e5
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 19 deletions.
14 changes: 12 additions & 2 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ members = [
"crates/trie",
"testing/ef-tests",
"crates/rpc/rpc-types-compat",
"crates/tokio-util",
"examples",
"examples/additional-rpc-namespace-in-cli",
"examples/cli-extension-event-hooks",
Expand Down Expand Up @@ -107,6 +108,7 @@ reth-discv4 = { path = "./crates/net/discv4" }
reth-eth-wire = { path = "./crates/net/eth-wire" }
reth-ecies = { path = "./crates/net/ecies" }
reth-tracing = { path = "./crates/tracing" }
reth-tokio-util = { path = "crates/tokio-util" }
# revm
revm = { git = "https://github.com/bluealloy/revm", rev = "df44297bc3949dc9e0cec06594c62dd946708b2a" }
revm-primitives = { git = "https://github.com/bluealloy/revm", rev = "df44297bc3949dc9e0cec06594c62dd946708b2a" }
Expand Down
1 change: 1 addition & 0 deletions crates/consensus/beacon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ reth-payload-builder.workspace = true
reth-prune = { path = "../../prune" }
reth-snapshot = { path = "../../snapshot" }
reth-rpc-types-compat.workspace = true
reth-tokio-util.workspace = true
# async
tokio = { workspace = true, features = ["sync"] }
tokio-stream.workspace = true
Expand Down
5 changes: 3 additions & 2 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use reth_interfaces::{
};
use reth_payload_builder::{PayloadBuilderAttributes, PayloadBuilderHandle};
use reth_primitives::{
constants::EPOCH_SLOTS, listener::EventListeners, stage::StageId, BlockNumHash, BlockNumber,
ChainSpec, Head, Header, SealedBlock, SealedHeader, B256, U256,
constants::EPOCH_SLOTS, stage::StageId, BlockNumHash, BlockNumber, ChainSpec, Head, Header,
SealedBlock, SealedHeader, B256, U256,
};
use reth_provider::{
BlockIdReader, BlockReader, BlockSource, CanonChainTracker, ChainSpecProvider, ProviderError,
Expand All @@ -36,6 +36,7 @@ use reth_rpc_types::engine::{
use reth_rpc_types_compat::engine::payload::{try_into_block, validate_block_hash};
use reth_stages::{ControlFlow, Pipeline, PipelineError};
use reth_tasks::TaskSpawner;
use reth_tokio_util::EventListeners;
use std::{
pin::Pin,
sync::Arc,
Expand Down
1 change: 1 addition & 0 deletions crates/net/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ reth-tasks.workspace = true
reth-transaction-pool.workspace = true
reth-provider.workspace = true
reth-rpc-types.workspace = true
reth-tokio-util.workspace = true

alloy-rlp.workspace = true

Expand Down
3 changes: 2 additions & 1 deletion crates/net/network/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ use reth_eth_wire::{
use reth_metrics::common::mpsc::UnboundedMeteredSender;
use reth_net_common::bandwidth_meter::BandwidthMeter;
use reth_network_api::ReputationChangeKind;
use reth_primitives::{listener::EventListeners, ForkId, NodeRecord, PeerId, B256};
use reth_primitives::{ForkId, NodeRecord, PeerId, B256};
use reth_provider::{BlockNumReader, BlockReader};
use reth_rpc_types::{EthProtocolInfo, NetworkStatus};
use reth_tokio_util::EventListeners;
use std::{
net::SocketAddr,
pin::Pin,
Expand Down
4 changes: 0 additions & 4 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ crc = "3"
# tracing
tracing.workspace = true

# tokio
tokio = { workspace = true, default-features = false, features = ["sync"] }
tokio-stream.workspace = true

# misc
bytes.workspace = true
byteorder = "1"
Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ mod genesis;
mod hardfork;
mod header;
mod integer_list;
pub mod listener;
mod log;
mod net;
mod peer;
Expand Down
4 changes: 0 additions & 4 deletions crates/primitives/src/listener/mod.rs

This file was deleted.

1 change: 1 addition & 0 deletions crates/prune/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ reth-db.workspace = true
reth-provider.workspace = true
reth-interfaces.workspace = true
reth-snapshot = { path = "../snapshot" }
reth-tokio-util.workspace = true

# async
tokio = { workspace = true, features = ["sync"] }
Expand Down
5 changes: 2 additions & 3 deletions crates/prune/src/pruner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ use crate::{
Metrics, PrunerError, PrunerEvent,
};
use reth_db::database::Database;
use reth_primitives::{
listener::EventListeners, BlockNumber, ChainSpec, PruneMode, PruneProgress, PruneSegment,
};
use reth_primitives::{BlockNumber, ChainSpec, PruneMode, PruneProgress, PruneSegment};
use reth_provider::{ProviderFactory, PruneCheckpointReader};
use reth_snapshot::HighestSnapshotsTracker;
use reth_tokio_util::EventListeners;
use std::{collections::BTreeMap, sync::Arc, time::Instant};
use tokio_stream::wrappers::UnboundedReceiverStream;
use tracing::{debug, trace};
Expand Down
1 change: 1 addition & 0 deletions crates/stages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ reth-db.workspace = true
reth-codecs = { path = "../storage/codecs" }
reth-provider.workspace = true
reth-trie = { path = "../trie" }
reth-tokio-util.workspace = true

# revm
revm.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/stages/src/pipeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use futures_util::Future;
use reth_db::database::Database;
use reth_interfaces::executor::BlockExecutionError;
use reth_primitives::{
constants::BEACON_CONSENSUS_REORG_UNWIND_DEPTH, listener::EventListeners, stage::StageId,
BlockNumber, ChainSpec, B256,
constants::BEACON_CONSENSUS_REORG_UNWIND_DEPTH, stage::StageId, BlockNumber, ChainSpec, B256,
};
use reth_provider::{ProviderFactory, StageCheckpointReader, StageCheckpointWriter};
use reth_tokio_util::EventListeners;
use std::{pin::Pin, sync::Arc};
use tokio::sync::watch;
use tokio_stream::wrappers::UnboundedReceiverStream;
Expand Down
17 changes: 17 additions & 0 deletions crates/tokio-util/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "reth-tokio-util"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
description = """
Additional utilities for working with Tokio in reth.
"""

[dependencies]

# async
tokio = { workspace = true, features = ["sync"] }
tokio-stream = { workspace = true, features = ["sync"] }
File renamed without changes.
13 changes: 13 additions & 0 deletions crates/tokio-util/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//! Event listeners
#![doc(
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
)]
#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)]
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod event_listeners;
pub use event_listeners::EventListeners;

0 comments on commit 33df4e5

Please sign in to comment.