From 7c877cb9213fdf78ac6621973247f1a1763575ab Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 17 Mar 2023 13:20:11 +0100 Subject: [PATCH] chore: cleanup some staged-sync deps (#1815) --- Cargo.lock | 41 --------------------- crates/staged-sync/Cargo.toml | 21 ++--------- crates/staged-sync/src/lib.rs | 9 +++++ crates/staged-sync/src/test_utils/clique.rs | 4 +- crates/staged-sync/src/test_utils/mod.rs | 2 - crates/staged-sync/src/utils/init.rs | 12 +++--- 6 files changed, 22 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09fd1b2f00..455fb0ddc9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -199,28 +199,6 @@ dependencies = [ "event-listener", ] -[[package]] -name = "async-stream" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965" -dependencies = [ - "proc-macro2 1.0.52", - "quote 1.0.23", - "syn 1.0.109", -] - [[package]] name = "async-trait" version = "0.1.65" @@ -5269,15 +5247,11 @@ dependencies = [ "reth-db", "reth-discv4", "reth-downloaders", - "reth-interfaces", "reth-net-nat", "reth-network", "reth-network-api", "reth-primitives", "reth-provider", - "reth-staged-sync", - "reth-stages", - "reth-tasks", "reth-tracing", "secp256k1", "serde", @@ -5286,8 +5260,6 @@ dependencies = [ "tempfile", "thiserror", "tokio", - "tokio-stream", - "tokio-test", "tracing", "walkdir", ] @@ -6592,19 +6564,6 @@ dependencies = [ "tokio-util 0.7.7", ] -[[package]] -name = "tokio-test" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53474327ae5e166530d17f2d956afcb4f8a004de581b3cae10f12006bc8163e3" -dependencies = [ - "async-stream", - "bytes", - "futures-core", - "tokio", - "tokio-stream", -] - [[package]] name = "tokio-tungstenite" version = "0.18.0" diff --git a/crates/staged-sync/Cargo.toml b/crates/staged-sync/Cargo.toml index 5ab9d6c58a..d81750ff66 100644 --- a/crates/staged-sync/Cargo.toml +++ b/crates/staged-sync/Cargo.toml @@ -7,12 +7,6 @@ repository = "https://github.com/paradigmxyz/reth" readme = "README.md" description = "Puts together all the Reth stages in a unified abstraction" -[package.metadata.cargo-udeps.ignore] -normal = [ - # Used for config loading - "confy" -] - [dependencies] # reth reth-db = {path = "../../crates/storage/db", features = ["mdbx", "test-utils"] } @@ -23,13 +17,10 @@ reth-downloaders = { path = "../../crates/net/downloaders" } reth-primitives = { path = "../../crates/primitives" } reth-provider = { path = "../../crates/storage/provider", features = ["test-utils"] } reth-net-nat = { path = "../../crates/net/nat" } -reth-interfaces = { path = "../interfaces", optional = true } -reth-tasks = { path = "../../crates/tasks" } # io serde = "1.0" serde_json = "1.0.91" -confy = "0.5" # misc walkdir = "2.3.2" @@ -55,23 +46,18 @@ ethers-signers = { git = "https://github.com/gakonst/ethers-rs", default-feature # async / futures async-trait = { version = "0.1", optional = true } tokio = { version = "1", features = ["io-util", "net", "macros", "rt-multi-thread", "time"], optional = true } -tokio-test = { version = "0.4", optional = true } # misc -tempfile = { version = "3.3", optional = true } hex = { version = "0.4", optional = true } [dev-dependencies] # reth crates reth-tracing = { path = "../tracing" } -reth-stages = { path = "../stages" } reth-downloaders = { path = "../net/downloaders" } -reth-staged-sync = { path = ".", features = ["test-utils"] } # async/futures futures = "0.3" tokio = { version = "1", features = ["io-util", "net", "macros", "rt-multi-thread", "time"] } -tokio-stream = "0.1" # crypto secp256k1 = { version = "0.26.0", features = [ @@ -80,19 +66,20 @@ secp256k1 = { version = "0.26.0", features = [ "recovery", ] } +confy = "0.5" + +tempfile = "3.4" + [features] test-utils = [ "reth-network/test-utils", - "reth-interfaces/test-utils", "reth-network/test-utils", "reth-provider/test-utils", "dep:enr", "dep:ethers-core", - "dep:tempfile", "dep:hex", "dep:rand", "dep:tokio", - "dep:tokio-test", "dep:ethers-signers", "dep:ethers-providers", "dep:ethers-middleware", diff --git a/crates/staged-sync/src/lib.rs b/crates/staged-sync/src/lib.rs index 781199fb5e..a0ea405be9 100644 --- a/crates/staged-sync/src/lib.rs +++ b/crates/staged-sync/src/lib.rs @@ -1,3 +1,12 @@ +#![warn(missing_docs, unreachable_pub)] +#![deny(unused_must_use, rust_2018_idioms)] +#![doc(test( + no_crate_inject, + attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) +))] + +//! Puts together all the Reth stages in a unified abstraction + pub mod config; pub use config::Config; diff --git a/crates/staged-sync/src/test_utils/clique.rs b/crates/staged-sync/src/test_utils/clique.rs index 8a75e60098..c053d8ee03 100644 --- a/crates/staged-sync/src/test_utils/clique.rs +++ b/crates/staged-sync/src/test_utils/clique.rs @@ -20,7 +20,7 @@ use std::{ /// ```no_run /// # use ethers_core::utils::Geth; /// # use reth_staged_sync::test_utils::CliqueGethInstance; -/// # tokio_test::block_on(async { +/// # let clique = async { /// /// // this creates a funded geth /// let clique_geth = Geth::new() @@ -32,7 +32,7 @@ use std::{ /// /// // don't print logs, but drain the stderr /// clique.prevent_blocking().await; -/// # }); +/// # }; /// ``` pub struct CliqueGethInstance { /// The spawned [`GethInstance`](ethers_core::utils::GethInstance). diff --git a/crates/staged-sync/src/test_utils/mod.rs b/crates/staged-sync/src/test_utils/mod.rs index 51dc7cd579..ff1105afad 100644 --- a/crates/staged-sync/src/test_utils/mod.rs +++ b/crates/staged-sync/src/test_utils/mod.rs @@ -1,5 +1,3 @@ -#![warn(missing_docs, unreachable_pub)] - //! Common helpers for staged sync integration testing. pub mod clique; diff --git a/crates/staged-sync/src/utils/init.rs b/crates/staged-sync/src/utils/init.rs index d911d5d229..7ee1d76382 100644 --- a/crates/staged-sync/src/utils/init.rs +++ b/crates/staged-sync/src/utils/init.rs @@ -12,10 +12,7 @@ use tracing::debug; /// Opens up an existing database or creates a new one at the specified path. pub fn init_db>(path: P) -> eyre::Result> { std::fs::create_dir_all(path.as_ref())?; - let db = reth_db::mdbx::Env::::open( - path.as_ref(), - reth_db::mdbx::EnvKind::RW, - )?; + let db = Env::::open(path.as_ref(), reth_db::mdbx::EnvKind::RW)?; db.create_tables()?; Ok(db) @@ -26,7 +23,12 @@ pub fn init_db>(path: P) -> eyre::Result> { pub enum InitDatabaseError { /// Attempted to reinitialize database with inconsistent genesis block #[error("Genesis hash mismatch: expected {expected}, got {actual}")] - GenesisHashMismatch { expected: H256, actual: H256 }, + GenesisHashMismatch { + /// Expected genesis hash. + expected: H256, + /// Actual genesis hash. + actual: H256, + }, /// Low-level database error. #[error(transparent)]