diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000000..59349e62eb1e --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +docs = "doc --workspace --all-features --no-deps" diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 310b7454250f..e5eac1efd233 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -19,13 +19,13 @@ jobs: run: | mkdir mdbook curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook - echo `pwd`/mdbook >> $GITHUB_PATH + echo $(pwd)/mdbook >> $GITHUB_PATH - name: Install mdbook-template run: | mkdir mdbook-template curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template - echo `pwd`/mdbook-template >> $GITHUB_PATH + echo $(pwd)/mdbook-template >> $GITHUB_PATH - name: Run tests run: mdbook test @@ -43,8 +43,8 @@ jobs: mkdir mdbook-linkcheck curl -sSL -o mdbook-linkcheck.zip https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip unzip mdbook-linkcheck.zip -d ./mdbook-linkcheck - chmod +x `pwd`/mdbook-linkcheck/mdbook-linkcheck - echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH + chmod +x $(pwd)/mdbook-linkcheck/mdbook-linkcheck + echo $(pwd)/mdbook-linkcheck >> $GITHUB_PATH - name: Run linkcheck run: mdbook-linkcheck --standalone @@ -54,32 +54,32 @@ jobs: timeout-minutes: 60 steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install toolchain - uses: dtolnay/rust-toolchain@nightly - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true + - uses: dtolnay/rust-toolchain@nightly - name: Install mdbook run: | mkdir mdbook curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook - echo `pwd`/mdbook >> $GITHUB_PATH + echo $(pwd)/mdbook >> $GITHUB_PATH - name: Install mdbook-template run: | mkdir mdbook-template curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template - echo `pwd`/mdbook-template >> $GITHUB_PATH + echo $(pwd)/mdbook-template >> $GITHUB_PATH + + - uses: Swatinem/rust-cache@v2 - name: Build book run: mdbook build - name: Build docs - run: RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all --no-deps + run: cargo docs + env: + # Keep in sync with ./ci.yml:jobs.docs + RUSTDOCFLAGS: + --cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page + -Zunstable-options - name: Move docs to book folder run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb7d6f68c557..7fecee5a770d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,64 +5,53 @@ on: branches: [main] env: - RUSTFLAGS: -D warnings CARGO_TERM_COLOR: always -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - name: ci jobs: - lint: - name: code lint - runs-on: ubuntu-20.04 - timeout-minutes: 60 + clippy: + name: clippy + runs-on: ubuntu-latest + timeout-minutes: 30 steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@nightly - with: - components: rustfmt, clippy + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@clippy - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - - name: cargo check - uses: actions-rs/cargo@v1 - with: - command: check - args: --all --all-features --benches --tests - - - name: cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all --check - - - name: cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all --all-features --benches --tests + - run: cargo clippy --workspace --all-targets --all-features + env: + RUSTFLAGS: -D warnings - doc-lint: - name: doc lint - runs-on: ubuntu-20.04 - timeout-minutes: 60 + docs: + name: docs + runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable + - uses: dtolnay/rust-toolchain@nightly - uses: Swatinem/rust-cache@v2 - - name: Check if documentation builds - run: RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --all-features --document-private-items + - run: cargo docs --document-private-items + env: + # Keep in sync with ./book.yml:jobs.build + # This should only add `-D warnings` + RUSTDOCFLAGS: + --cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page + -Zunstable-options -D warnings + + fmt: + name: fmt + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt + - run: cargo fmt --all --check grafana-lint: name: grafana lint - runs-on: ubuntu-20.04 - timeout-minutes: 60 + runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v3 - name: Check dashboard JSON with jq @@ -73,9 +62,9 @@ jobs: lint-success: if: always() name: lint success - runs-on: ubuntu-20.04 - needs: [lint, doc-lint, grafana-lint] - timeout-minutes: 60 + runs-on: ubuntu-latest + needs: [clippy, docs, fmt, grafana-lint] + timeout-minutes: 30 steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 diff --git a/bin/reth/src/cli/ext.rs b/bin/reth/src/cli/ext.rs index 663328cda025..a2d6b8e8ef03 100644 --- a/bin/reth/src/cli/ext.rs +++ b/bin/reth/src/cli/ext.rs @@ -113,6 +113,7 @@ impl RethNodeCommandExt for T where T: RethNodeCommandConfig + fmt::Debug + c /// /// This is a convenience type for [NoArgs<()>]. #[derive(Debug, Clone, Copy, Default, Args)] +#[non_exhaustive] pub struct DefaultRethNodeCommandConfig; impl RethNodeCommandConfig for DefaultRethNodeCommandConfig {} diff --git a/bin/reth/src/cli/mod.rs b/bin/reth/src/cli/mod.rs index 440a45d10062..a17ab8a30e17 100644 --- a/bin/reth/src/cli/mod.rs +++ b/bin/reth/src/cli/mod.rs @@ -81,7 +81,7 @@ impl Cli { let _guard = self.init_tracing()?; - let runner = CliRunner::default(); + let runner = CliRunner; match self.command { Commands::Node(command) => runner.run_command_until_exit(|ctx| command.execute(ctx)), Commands::Init(command) => runner.run_blocking_until_ctrl_c(command.execute()), diff --git a/bin/reth/src/db/clear.rs b/bin/reth/src/db/clear.rs index 0bd816db8b45..626df4bae01d 100644 --- a/bin/reth/src/db/clear.rs +++ b/bin/reth/src/db/clear.rs @@ -1,5 +1,4 @@ use clap::Parser; - use reth_db::{ database::Database, table::Table, @@ -11,7 +10,6 @@ use reth_db::{ #[derive(Parser, Debug)] pub struct Command { /// Table name - #[arg()] pub table: Tables, } diff --git a/bin/reth/src/db/get.rs b/bin/reth/src/db/get.rs index 5e4b127b37f6..09534ec00c67 100644 --- a/bin/reth/src/db/get.rs +++ b/bin/reth/src/db/get.rs @@ -10,7 +10,6 @@ pub struct Command { /// The table name /// /// NOTE: The dupsort tables are not supported now. - #[arg()] pub table: Tables, /// The key to get content for diff --git a/bin/reth/src/dirs.rs b/bin/reth/src/dirs.rs index 3305e8ab7138..13c64aef7f84 100644 --- a/bin/reth/src/dirs.rs +++ b/bin/reth/src/dirs.rs @@ -60,7 +60,7 @@ pub fn logs_dir() -> Option { /// /// The data dir should contain a subdirectory for each chain, and those chain directories will /// include all information for that chain, such as the p2p secret. -#[derive(Default, Debug, Clone)] +#[derive(Clone, Copy, Debug, Default)] #[non_exhaustive] pub struct DataDirPath; @@ -73,7 +73,7 @@ impl XdgPath for DataDirPath { /// Returns the path to the reth logs directory. /// /// Refer to [dirs_next::cache_dir] for cross-platform behavior. -#[derive(Default, Debug, Clone)] +#[derive(Clone, Copy, Debug, Default)] #[non_exhaustive] pub struct LogsDir; diff --git a/bin/reth/src/lib.rs b/bin/reth/src/lib.rs index 2f452eb4610f..5f226486e6e3 100644 --- a/bin/reth/src/lib.rs +++ b/bin/reth/src/lib.rs @@ -1,10 +1,3 @@ -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] -#![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - //! Rust Ethereum (reth) binary executable. //! //! ## Feature Flags @@ -23,6 +16,15 @@ //! - `min-debug-logs`: Disables all logs below `debug` level. //! - `min-trace-logs`: Disables all logs below `trace` level. +#![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/paradigmxzy/reth/issues/" +)] +#![warn(missing_docs, unreachable_pub, rustdoc::all)] +#![deny(unused_must_use, rust_2018_idioms)] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + pub mod args; pub mod chain; pub mod cli; diff --git a/bin/reth/src/node/cl_events.rs b/bin/reth/src/node/cl_events.rs index 1cf43682aed0..38f8c819e64b 100644 --- a/bin/reth/src/node/cl_events.rs +++ b/bin/reth/src/node/cl_events.rs @@ -3,6 +3,7 @@ use futures::Stream; use reth_provider::CanonChainTracker; use std::{ + fmt, pin::Pin, task::{ready, Context, Poll}, time::Duration, @@ -24,6 +25,12 @@ pub struct ConsensusLayerHealthEvents { canon_chain: Box, } +impl fmt::Debug for ConsensusLayerHealthEvents { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ConsensusLayerHealthEvents").field("interval", &self.interval).finish() + } +} + impl ConsensusLayerHealthEvents { /// Creates a new [ConsensusLayerHealthEvents] with the given canonical chain tracker. pub fn new(canon_chain: Box) -> Self { @@ -78,7 +85,7 @@ impl Stream for ConsensusLayerHealthEvents { /// Event that is triggered when Consensus Layer health is degraded from the /// Execution Layer point of view. -#[derive(Debug)] +#[derive(Clone, Copy, Debug)] pub enum ConsensusLayerHealthEvent { /// Consensus Layer client was never seen. NeverSeen, diff --git a/bin/reth/src/p2p/mod.rs b/bin/reth/src/p2p/mod.rs index 4fc87b294cac..cc0010486bcd 100644 --- a/bin/reth/src/p2p/mod.rs +++ b/bin/reth/src/p2p/mod.rs @@ -84,8 +84,8 @@ pub struct Command { command: Subcommands, } -#[derive(Subcommand, Debug)] /// `reth p2p` subcommands +#[derive(Subcommand, Debug)] pub enum Subcommands { /// Download block header Header { diff --git a/bin/reth/src/runner.rs b/bin/reth/src/runner.rs index 6f9277c42b4a..33b21673f6bb 100644 --- a/bin/reth/src/runner.rs +++ b/bin/reth/src/runner.rs @@ -5,8 +5,8 @@ use reth_tasks::{TaskExecutor, TaskManager}; use std::future::Future; use tracing::trace; -/// Used to execute cli commands -#[derive(Default, Debug)] +/// Executes CLI commands. +#[derive(Clone, Debug, Default)] #[non_exhaustive] pub struct CliRunner; diff --git a/book.toml b/book.toml index 0ecc92b4097b..00838b0010d0 100644 --- a/book.toml +++ b/book.toml @@ -20,7 +20,7 @@ level = 1 build-dir = "target/book" [preprocessor.template] -before = [ "links" ] +before = ["links"] [preprocessor.index] diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index feb93d60b3e6..bbd2abc198e7 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -98,6 +98,7 @@ pub struct BlockchainTree { /// A container that wraps chains and block indices to allow searching for block hashes across all /// sidechains. +#[derive(Debug)] pub struct BlockHashes<'a> { /// The current tracked chains. pub chains: &'a mut HashMap, diff --git a/crates/blockchain-tree/src/lib.rs b/crates/blockchain-tree/src/lib.rs index 9f48a41d819f..9c370a5e50f5 100644 --- a/crates/blockchain-tree/src/lib.rs +++ b/crates/blockchain-tree/src/lib.rs @@ -1,15 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![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)) -))] //! Implementation of a tree-like structure for blockchains. //! //! The [BlockchainTree] can validate, execute, and revert blocks in multiple competing sidechains. @@ -22,6 +10,15 @@ //! //! - `test-utils`: Export utilities for testing +#![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/paradigmxzy/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))] + pub mod blockchain_tree; pub use blockchain_tree::{BlockHashes, BlockchainTree}; diff --git a/crates/blockchain-tree/src/shareable.rs b/crates/blockchain-tree/src/shareable.rs index e67b14d27c96..a3f7505d930a 100644 --- a/crates/blockchain-tree/src/shareable.rs +++ b/crates/blockchain-tree/src/shareable.rs @@ -25,7 +25,7 @@ use std::{ use tracing::trace; /// Shareable blockchain tree that is behind tokio::RwLock -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct ShareableBlockchainTree { /// BlockchainTree pub tree: Arc>>, diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index a133180eb03c..5186e309de9a 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Standalone crate for Reth configuration types. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Standalone crate for Reth config types +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] pub mod config; pub use config::Config; diff --git a/crates/consensus/auto-seal/src/lib.rs b/crates/consensus/auto-seal/src/lib.rs index eb5f4a569d03..c2cc8bdfb16e 100644 --- a/crates/consensus/auto-seal/src/lib.rs +++ b/crates/consensus/auto-seal/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] -#![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - //! A [Consensus] implementation for local testing purposes //! that automatically seals blocks. //! @@ -20,6 +7,15 @@ //! These downloaders poll the miner, assemble the block, and return transactions that are ready to //! be mined. +#![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/paradigmxzy/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))] + use reth_beacon_consensus::BeaconEngineMessage; use reth_interfaces::{ consensus::{Consensus, ConsensusError}, @@ -98,6 +94,7 @@ impl Consensus for AutoSealConsensus { } /// Builder type for configuring the setup +#[derive(Debug)] pub struct AutoSealBuilder { client: Client, consensus: AutoSealConsensus, diff --git a/crates/consensus/beacon/src/engine/hooks/mod.rs b/crates/consensus/beacon/src/engine/hooks/mod.rs index b9c456ec2c5d..3185fcb3b28d 100644 --- a/crates/consensus/beacon/src/engine/hooks/mod.rs +++ b/crates/consensus/beacon/src/engine/hooks/mod.rs @@ -1,6 +1,7 @@ +use reth_interfaces::RethError; use reth_primitives::BlockNumber; use std::{ - fmt::Debug, + fmt, task::{Context, Poll}, }; @@ -9,7 +10,6 @@ pub(crate) use controller::{EngineHooksController, PolledHook}; mod prune; pub use prune::PruneHook; -use reth_interfaces::RethError; /// Collection of [engine hooks][`EngineHook`]. #[derive(Default)] @@ -17,6 +17,12 @@ pub struct EngineHooks { inner: Vec>, } +impl fmt::Debug for EngineHooks { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("EngineHooks").field("inner", &self.inner.len()).finish() + } +} + impl EngineHooks { /// Creates a new empty collection of [engine hooks][`EngineHook`]. pub fn new() -> Self { diff --git a/crates/consensus/beacon/src/engine/hooks/prune.rs b/crates/consensus/beacon/src/engine/hooks/prune.rs index 26e1b38d9643..35953e71bf84 100644 --- a/crates/consensus/beacon/src/engine/hooks/prune.rs +++ b/crates/consensus/beacon/src/engine/hooks/prune.rs @@ -13,7 +13,10 @@ use reth_interfaces::RethError; use reth_primitives::BlockNumber; use reth_prune::{Pruner, PrunerError, PrunerWithResult}; use reth_tasks::TaskSpawner; -use std::task::{ready, Context, Poll}; +use std::{ + fmt, + task::{ready, Context, Poll}, +}; use tokio::sync::oneshot; /// Manages pruning under the control of the engine. @@ -27,6 +30,15 @@ pub struct PruneHook { metrics: Metrics, } +impl fmt::Debug for PruneHook { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PruneHook") + .field("pruner_state", &self.pruner_state) + .field("metrics", &self.metrics) + .finish() + } +} + impl PruneHook { /// Create a new instance pub fn new(pruner: Pruner, pruner_task_spawner: Box) -> Self { @@ -150,6 +162,7 @@ impl EngineHook for PruneHook { /// running, it acquires the write lock over the database. This means that we cannot forward to the /// blockchain tree any messages that would result in database writes, since it would result in a /// deadlock. +#[derive(Debug)] enum PrunerState { /// Pruner is idle. Idle(Option>), diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 6fb09edc6c09..a6eaed2dab25 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -160,6 +160,7 @@ pub const MIN_BLOCKS_FOR_PIPELINE_RUN: u64 = EPOCH_SLOTS; /// /// If the future is polled more than once. Leads to undefined state. #[must_use = "Future does nothing unless polled"] +#[allow(missing_debug_implementations)] pub struct BeaconConsensusEngine where DB: Database, diff --git a/crates/consensus/beacon/src/engine/test_utils.rs b/crates/consensus/beacon/src/engine/test_utils.rs index d29d4e42af94..995583735929 100644 --- a/crates/consensus/beacon/src/engine/test_utils.rs +++ b/crates/consensus/beacon/src/engine/test_utils.rs @@ -50,6 +50,7 @@ type TestBeaconConsensusEngine = BeaconConsensusEngine< Arc>, >; +#[derive(Debug)] pub struct TestEnv { pub db: DB, // Keep the tip receiver around, so it's not dropped. @@ -116,7 +117,7 @@ impl TestEnv { // TODO: add with_consensus in case we want to use the TestConsensus purposeful failure - this // would require similar patterns to how we use with_client and the EitherDownloader /// Represents either a real consensus engine, or a test consensus engine. -#[derive(Default)] +#[derive(Debug, Default)] enum TestConsensusConfig { /// Test consensus engine #[default] @@ -126,6 +127,7 @@ enum TestConsensusConfig { } /// Represents either test pipeline outputs, or real pipeline configuration. +#[derive(Debug)] enum TestPipelineConfig { /// Test pipeline outputs. Test(VecDeque>), @@ -140,6 +142,7 @@ impl Default for TestPipelineConfig { } /// Represents either test executor results, or real executor configuration. +#[derive(Debug)] enum TestExecutorConfig { /// Test executor results. Test(Vec), @@ -271,6 +274,7 @@ where /// The basic configuration for a `TestConsensusEngine`, without generics for the client or /// consensus engine. +#[derive(Debug)] pub struct TestConsensusEngineBuilder { chain_spec: Arc, pipeline_config: TestPipelineConfig, @@ -362,6 +366,7 @@ impl TestConsensusEngineBuilder { /// mocked executor results. /// /// This optionally includes a client for network operations. +#[derive(Debug)] pub struct NetworkedTestConsensusEngineBuilder { base_config: TestConsensusEngineBuilder, client: Option, diff --git a/crates/consensus/beacon/src/lib.rs b/crates/consensus/beacon/src/lib.rs index 711a30e14460..d2d3fd3583f7 100644 --- a/crates/consensus/beacon/src/lib.rs +++ b/crates/consensus/beacon/src/lib.rs @@ -1,16 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Beacon consensus implementation. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] -//! Beacon consensus implementation. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] mod beacon_consensus; pub use beacon_consensus::BeaconConsensus; diff --git a/crates/consensus/common/src/lib.rs b/crates/consensus/common/src/lib.rs index 390c575707fa..31f0f2b15a98 100644 --- a/crates/consensus/common/src/lib.rs +++ b/crates/consensus/common/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Commonly used consensus methods. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Commonly used consensus methods. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] /// Collection of consensus validation methods. pub mod validation; diff --git a/crates/interfaces/src/db.rs b/crates/interfaces/src/db.rs index e0f44d7276e9..7606e859ffab 100644 --- a/crates/interfaces/src/db.rs +++ b/crates/interfaces/src/db.rs @@ -46,7 +46,7 @@ pub enum DatabaseError { } /// Database write operation type -#[derive(Debug, PartialEq, Eq, Clone)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[allow(missing_docs)] pub enum DatabaseWriteOperation { CursorAppend, diff --git a/crates/interfaces/src/lib.rs b/crates/interfaces/src/lib.rs index 563400503d0e..7e27108ff7d6 100644 --- a/crates/interfaces/src/lib.rs +++ b/crates/interfaces/src/lib.rs @@ -1,21 +1,17 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! A collection of shared traits and error types used in Reth. +//! +//! ## Feature Flags +//! +//! - `test-utils`: Export utilities for testing + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! A collection of shared traits and error types used in Reth. -//! -//! ## Feature Flags -//! -//! - `test-utils`: Export utilities for testing +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] /// Consensus traits. pub mod consensus; diff --git a/crates/interfaces/src/p2p/error.rs b/crates/interfaces/src/p2p/error.rs index d69db25fc751..ac0030c61b35 100644 --- a/crates/interfaces/src/p2p/error.rs +++ b/crates/interfaces/src/p2p/error.rs @@ -70,7 +70,7 @@ impl EthResponseValidator for RequestResult> { } /// Error variants that can happen when sending requests to a session. -#[derive(Debug, Error, Clone, Eq, PartialEq)] +#[derive(Clone, Debug, Error, Eq, PartialEq)] #[allow(missing_docs)] pub enum RequestError { #[error("Closed channel to the peer.")] diff --git a/crates/interfaces/src/p2p/full_block.rs b/crates/interfaces/src/p2p/full_block.rs index 2d3f0482f581..1536a7057ae8 100644 --- a/crates/interfaces/src/p2p/full_block.rs +++ b/crates/interfaces/src/p2p/full_block.rs @@ -354,6 +354,7 @@ fn ensure_valid_body_response( /// NOTE: this assumes that bodies responses are returned by the client in the same order as the /// hash array used to request them. #[must_use = "futures do nothing unless polled"] +#[allow(missing_debug_implementations)] pub struct FetchFullBlockRangeFuture where Client: BodiesClient + HeadersClient, diff --git a/crates/interfaces/src/sync.rs b/crates/interfaces/src/sync.rs index 78cad443d40d..79702cc3d335 100644 --- a/crates/interfaces/src/sync.rs +++ b/crates/interfaces/src/sync.rs @@ -49,7 +49,7 @@ impl SyncState { } /// A [NetworkSyncUpdater] implementation that does nothing. -#[derive(Debug, Clone, Default)] +#[derive(Clone, Copy, Debug, Default)] #[non_exhaustive] pub struct NoopSyncStateUpdater; diff --git a/crates/metrics/metrics-derive/src/lib.rs b/crates/metrics/metrics-derive/src/lib.rs index a0b75eddcb2a..12d253e363ef 100644 --- a/crates/metrics/metrics-derive/src/lib.rs +++ b/crates/metrics/metrics-derive/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! This crate provides [Metrics] derive macro + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! This crate provides [Metrics] derive macro +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] use proc_macro::TokenStream; use syn::{parse_macro_input, DeriveInput}; diff --git a/crates/metrics/src/common/mpsc.rs b/crates/metrics/src/common/mpsc.rs index ff4c224189fb..3c35c745eaf9 100644 --- a/crates/metrics/src/common/mpsc.rs +++ b/crates/metrics/src/common/mpsc.rs @@ -267,27 +267,27 @@ struct MeteredReceiverMetrics { messages_received: Counter, } -/// A wrapper type around [PollSender](PollSender) that updates metrics on send. +/// A wrapper type around [PollSender] that updates metrics on send. #[derive(Debug)] pub struct MeteredPollSender { - /// The [PollSender](PollSender) that this wraps around + /// The [PollSender] that this wraps around. sender: PollSender, - /// Holds metrics for this type + /// Holds metrics for this type. metrics: MeteredPollSenderMetrics, } impl MeteredPollSender { - /// Creates a new [`MeteredPollSender`] wrapping around the provided [PollSender](PollSender) + /// Creates a new [`MeteredPollSender`] wrapping around the provided [PollSender]. pub fn new(sender: PollSender, scope: &'static str) -> Self { Self { sender, metrics: MeteredPollSenderMetrics::new(scope) } } - /// Returns the underlying [PollSender](PollSender). + /// Returns the underlying [PollSender]. pub fn inner(&self) -> &PollSender { &self.sender } - /// Calls the underlying [PollSender](PollSender)'s `poll_reserve`, incrementing the appropriate + /// Calls the underlying [PollSender]'s `poll_reserve`, incrementing the appropriate /// metrics depending on the result. pub fn poll_reserve(&mut self, cx: &mut Context<'_>) -> Poll>> { match self.sender.poll_reserve(cx) { @@ -300,7 +300,7 @@ impl MeteredPollSender { } } - /// Calls the underlying [PollSender](PollSender)'s `send_item`, incrementing the appropriate + /// Calls the underlying [PollSender]'s `send_item`, incrementing the appropriate /// metrics depending on the result. pub fn send_item(&mut self, item: T) -> Result<(), PollSendError> { match self.sender.send_item(item) { diff --git a/crates/metrics/src/lib.rs b/crates/metrics/src/lib.rs index e80719cb08a6..b82146e8d553 100644 --- a/crates/metrics/src/lib.rs +++ b/crates/metrics/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] -#![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - //! Collection of metrics utilities. //! //! ## Feature Flags @@ -18,6 +5,15 @@ //! - `common`: Common metrics utilities, such as wrappers around tokio senders and receivers. Pulls //! in `tokio`. +#![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/paradigmxzy/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))] + /// Metrics derive macro. pub use reth_metrics_derive::Metrics; diff --git a/crates/net/common/src/lib.rs b/crates/net/common/src/lib.rs index fb4f6156f358..87c98bf6b0da 100644 --- a/crates/net/common/src/lib.rs +++ b/crates/net/common/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Shared types across `reth-net`. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Shared types across reth-net +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] pub mod ban_list; pub mod bandwidth_meter; diff --git a/crates/net/discv4/src/lib.rs b/crates/net/discv4/src/lib.rs index 36dde7c6e96a..1e1b3d63c931 100644 --- a/crates/net/discv4/src/lib.rs +++ b/crates/net/discv4/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_docs, unused_crate_dependencies)] -#![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - //! Discovery v4 implementation: //! //! Discv4 employs a kademlia-like routing table to store and manage discovered peers and topics. @@ -28,6 +15,16 @@ //! //! - `serde` (default): Enable serde support //! - `test-utils`: Export utilities for testing + +#![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/paradigmxzy/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))] + use crate::{ error::{DecodePacketError, Discv4Error}, proto::{FindNode, Message, Neighbours, Packet, Ping, Pong}, @@ -383,6 +380,7 @@ impl Discv4 { /// Manages discv4 peer discovery over UDP. #[must_use = "Stream does nothing unless polled"] +#[allow(missing_debug_implementations)] pub struct Discv4Service { /// Local address of the UDP socket. local_address: SocketAddr, diff --git a/crates/net/discv4/src/test_utils.rs b/crates/net/discv4/src/test_utils.rs index 3c1ce96b8b5b..4fa3b13fd784 100644 --- a/crates/net/discv4/src/test_utils.rs +++ b/crates/net/discv4/src/test_utils.rs @@ -29,6 +29,7 @@ use tokio_stream::{Stream, StreamExt}; use tracing::{debug, error}; /// Mock discovery node +#[derive(Debug)] pub struct MockDiscovery { local_addr: SocketAddr, local_enr: NodeRecord, @@ -190,12 +191,14 @@ impl Stream for MockDiscovery { } /// The event type the mock service produces +#[derive(Debug)] pub enum MockEvent { Pong { ping: Ping, pong: Pong, to: SocketAddr }, Neighbours { nodes: Vec, to: SocketAddr }, } /// Command for interacting with the `MockDiscovery` service +#[derive(Debug)] pub enum MockCommand { MockPong { node_id: PeerId }, MockNeighbours { target: PeerId, nodes: Vec }, diff --git a/crates/net/dns/src/lib.rs b/crates/net/dns/src/lib.rs index b101c8b3ed4d..e62e105456e6 100644 --- a/crates/net/dns/src/lib.rs +++ b/crates/net/dns/src/lib.rs @@ -1,22 +1,19 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Implementation of [EIP-1459](https://eips.ethereum.org/EIPS/eip-1459) Node Discovery via DNS. +//! +//! ## Feature Flags +//! +//! - `serde` (default): Enable serde support +//! - `test-utils`: Export utilities for testing + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -//! Implementation of [EIP-1459](https://eips.ethereum.org/EIPS/eip-1459) Node Discovery via DNS. -//! -//! ## Feature Flags -//! -//! - `serde` (default): Enable serde support -//! - `test-utils`: Export utilities for testing pub use crate::resolver::{DnsResolver, MapResolver, Resolver}; use crate::{ query::{QueryOutcome, QueryPool, ResolveEntryResult, ResolveRootResult}, @@ -60,7 +57,7 @@ mod sync; pub mod tree; /// [DnsDiscoveryService] front-end. -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct DnsDiscoveryHandle { /// Channel for sending commands to the service. to_service: UnboundedSender, @@ -93,6 +90,7 @@ impl DnsDiscoveryHandle { /// A client that discovers nodes via DNS. #[must_use = "Service does nothing unless polled"] +#[allow(missing_debug_implementations)] pub struct DnsDiscoveryService { /// Copy of the sender half, so new [`DnsDiscoveryHandle`] can be created on demand. command_tx: UnboundedSender, diff --git a/crates/net/dns/src/resolver.rs b/crates/net/dns/src/resolver.rs index d8b22831b4ab..e81fa9c60b03 100644 --- a/crates/net/dns/src/resolver.rs +++ b/crates/net/dns/src/resolver.rs @@ -48,7 +48,7 @@ impl Resolver for AsyncResolver

{ /// Note: This [Resolver] can send multiple lookup attempts, See also /// [ResolverOpts](trust_dns_resolver::config::ResolverOpts) which configures 2 attempts (1 retry) /// by default. -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct DnsResolver(TokioAsyncResolver); // === impl DnsResolver === diff --git a/crates/net/downloaders/src/headers/reverse_headers.rs b/crates/net/downloaders/src/headers/reverse_headers.rs index bcee0549cb47..848ab4945bdb 100644 --- a/crates/net/downloaders/src/headers/reverse_headers.rs +++ b/crates/net/downloaders/src/headers/reverse_headers.rs @@ -58,6 +58,7 @@ enum ReverseHeadersDownloaderError { /// the batches of headers that this downloader yields will start at the chain tip and move towards /// the local head: falling block numbers. #[must_use = "Stream does nothing unless polled"] +#[allow(missing_debug_implementations)] pub struct ReverseHeadersDownloader { /// Consensus client used to validate headers consensus: Arc, diff --git a/crates/net/downloaders/src/lib.rs b/crates/net/downloaders/src/lib.rs index 19d9dccfeea9..92f593682098 100644 --- a/crates/net/downloaders/src/lib.rs +++ b/crates/net/downloaders/src/lib.rs @@ -1,22 +1,18 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Implements the downloader algorithms. +//! +//! ## Feature Flags +//! +//! - `test-utils`: Export utilities for testing + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] +#![allow(clippy::result_large_err)] // TODO(danipopes): fix this +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] -#![allow(clippy::result_large_err)] - -//! Implements the downloader algorithms. -//! -//! ## Feature Flags -//! -//! - `test-utils`: Export utilities for testing +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] /// The collection of algorithms for downloading block bodies. pub mod bodies; diff --git a/crates/net/ecies/src/lib.rs b/crates/net/ecies/src/lib.rs index 7ab7878bcb9a..92ae43a775e8 100644 --- a/crates/net/ecies/src/lib.rs +++ b/crates/net/ecies/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! RLPx ECIES framed transport protocol. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! RLPx ECIES framed transport protocol. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] pub mod algorithm; pub mod mac; diff --git a/crates/net/eth-wire/src/builder.rs b/crates/net/eth-wire/src/builder.rs index b0ab46a49214..27b2f17e8820 100644 --- a/crates/net/eth-wire/src/builder.rs +++ b/crates/net/eth-wire/src/builder.rs @@ -85,6 +85,7 @@ impl StatusBuilder { } /// Builder for [`HelloMessage`] messages. +#[derive(Debug)] pub struct HelloBuilder { hello: HelloMessage, } diff --git a/crates/net/eth-wire/src/ethstream.rs b/crates/net/eth-wire/src/ethstream.rs index 3c06b10d4cae..47527e0b1a02 100644 --- a/crates/net/eth-wire/src/ethstream.rs +++ b/crates/net/eth-wire/src/ethstream.rs @@ -24,6 +24,7 @@ pub const MAX_MESSAGE_SIZE: usize = 10 * 1024 * 1024; /// An un-authenticated [`EthStream`]. This is consumed and returns a [`EthStream`] after the /// `Status` handshake is completed. #[pin_project] +#[derive(Debug)] pub struct UnauthedEthStream { #[pin] inner: S, diff --git a/crates/net/eth-wire/src/hello.rs b/crates/net/eth-wire/src/hello.rs index acbb2c4337d9..23cc0551e7c0 100644 --- a/crates/net/eth-wire/src/hello.rs +++ b/crates/net/eth-wire/src/hello.rs @@ -45,6 +45,7 @@ impl HelloMessage { } } +#[derive(Debug)] pub struct HelloMessageBuilder { /// The version of the `p2p` protocol. pub protocol_version: Option, diff --git a/crates/net/eth-wire/src/lib.rs b/crates/net/eth-wire/src/lib.rs index ef833030b4cb..f8b5978b1144 100644 --- a/crates/net/eth-wire/src/lib.rs +++ b/crates/net/eth-wire/src/lib.rs @@ -1,15 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![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)) -))] //! Implementation of the `eth` wire protocol. //! //! ## Feature Flags @@ -17,6 +5,15 @@ //! - `serde` (default): Enable serde support //! - `arbitrary`: Adds `proptest` and `arbitrary` support for wire types. +#![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/paradigmxzy/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))] + pub mod builder; pub mod capability; mod disconnect; diff --git a/crates/net/eth-wire/src/p2pstream.rs b/crates/net/eth-wire/src/p2pstream.rs index 41781f10207a..0b7ffcd5d8bf 100644 --- a/crates/net/eth-wire/src/p2pstream.rs +++ b/crates/net/eth-wire/src/p2pstream.rs @@ -65,6 +65,7 @@ const MAX_P2P_CAPACITY: usize = 2; /// An un-authenticated [`P2PStream`]. This is consumed and returns a [`P2PStream`] after the /// `Hello` handshake is completed. #[pin_project] +#[derive(Debug)] pub struct UnauthedP2PStream { #[pin] inner: S, diff --git a/crates/net/nat/src/lib.rs b/crates/net/nat/src/lib.rs index 06e2d4daa043..65382c7fc7b5 100644 --- a/crates/net/nat/src/lib.rs +++ b/crates/net/nat/src/lib.rs @@ -1,21 +1,17 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Helpers for resolving the external IP. +//! +//! ## Feature Flags +//! +//! - `serde` (default): Enable serde support + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Helpers for resolving the external IP. -//! -//! ## Feature Flags -//! -//! - `serde` (default): Enable serde support +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] use igd::aio::search_gateway; use pin_project_lite::pin_project; @@ -114,6 +110,16 @@ pub struct ResolveNatInterval { // === impl ResolveNatInterval === +impl fmt::Debug for ResolveNatInterval { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ResolveNatInterval") + .field("resolver", &self.resolver) + .field("future", &self.future.as_ref().map(drop)) + .field("interval", &self.interval) + .finish() + } +} + impl ResolveNatInterval { fn with_interval(resolver: NatResolver, interval: tokio::time::Interval) -> Self { Self { resolver, future: None, interval } diff --git a/crates/net/network-api/src/lib.rs b/crates/net/network-api/src/lib.rs index 947af332c7e5..1b9f76e0461d 100644 --- a/crates/net/network-api/src/lib.rs +++ b/crates/net/network-api/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![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)) -))] - //! Reth network interface definitions. //! //! Provides abstractions for the reth-network crate. @@ -18,6 +5,16 @@ //! ## Feature Flags //! //! - `serde` (default): Enable serde support + +#![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/paradigmxzy/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))] + use async_trait::async_trait; use reth_eth_wire::{DisconnectReason, EthVersion, Status}; use reth_primitives::{NodeRecord, PeerId}; diff --git a/crates/net/network/src/builder.rs b/crates/net/network/src/builder.rs index 1466e488d0f4..efe17ec5a4c8 100644 --- a/crates/net/network/src/builder.rs +++ b/crates/net/network/src/builder.rs @@ -12,6 +12,7 @@ use tokio::sync::mpsc; pub(crate) const ETH_REQUEST_CHANNEL_CAPACITY: usize = 256; /// A builder that can configure all components of the network. +#[allow(missing_debug_implementations)] pub struct NetworkBuilder { pub(crate) network: NetworkManager, pub(crate) transactions: Tx, diff --git a/crates/net/network/src/config.rs b/crates/net/network/src/config.rs index c1492f8ae6b0..641aefb62533 100644 --- a/crates/net/network/src/config.rs +++ b/crates/net/network/src/config.rs @@ -27,6 +27,7 @@ pub fn rng_secret_key() -> SecretKey { } /// All network related initialization settings. +#[derive(Debug)] pub struct NetworkConfig { /// The client type that can interact with the chain. /// diff --git a/crates/net/network/src/discovery.rs b/crates/net/network/src/discovery.rs index 5af2579567e0..df049372055f 100644 --- a/crates/net/network/src/discovery.rs +++ b/crates/net/network/src/discovery.rs @@ -23,8 +23,8 @@ use tokio_stream::wrappers::ReceiverStream; /// An abstraction over the configured discovery protocol. /// /// Listens for new discovered nodes and emits events for discovered nodes and their -/// address.#[derive(Debug, Clone)] - +/// address. +#[derive(Debug)] pub struct Discovery { /// All nodes discovered via discovery protocol. /// diff --git a/crates/net/network/src/eth_requests.rs b/crates/net/network/src/eth_requests.rs index 10b53f61701b..8491d7463027 100644 --- a/crates/net/network/src/eth_requests.rs +++ b/crates/net/network/src/eth_requests.rs @@ -53,6 +53,7 @@ const APPROX_HEADER_SIZE: usize = 500; /// Manages eth related requests on top of the p2p network. /// /// This can be spawned to another task and is supposed to be run as background service. +#[derive(Debug)] #[must_use = "Manager does nothing unless polled."] pub struct EthRequestHandler { /// The client type that can interact with the chain. diff --git a/crates/net/network/src/fetch/mod.rs b/crates/net/network/src/fetch/mod.rs index 8b73e820c85f..3a1a8f7675ac 100644 --- a/crates/net/network/src/fetch/mod.rs +++ b/crates/net/network/src/fetch/mod.rs @@ -30,6 +30,7 @@ pub use client::FetchClient; /// peers and sends the response once ready. /// /// This type maintains a list of connected peers that are available for requests. +#[derive(Debug)] pub struct StateFetcher { /// Currently active [`GetBlockHeaders`] requests inflight_headers_requests: @@ -296,6 +297,7 @@ enum PollAction { } /// Represents a connected peer +#[derive(Debug)] struct Peer { /// The state this peer currently resides in. state: PeerState, @@ -314,6 +316,7 @@ impl Peer { } /// Tracks the state of an individual peer +#[derive(Debug)] enum PeerState { /// Peer is currently not handling requests and is available. Idle, @@ -349,6 +352,7 @@ impl PeerState { /// A request that waits for a response from the network, so it can send it back through the /// response channel. +#[derive(Debug)] struct Request { /// The issued request object /// TODO: this can be attached to the response in error case @@ -358,6 +362,7 @@ struct Request { } /// Requests that can be sent to the Syncer from a [`FetchClient`] +#[derive(Debug)] pub(crate) enum DownloadRequest { /// Download the requested headers and send response through channel GetBlockHeaders { diff --git a/crates/net/network/src/import.rs b/crates/net/network/src/import.rs index 2146772c2ae3..f7564f977088 100644 --- a/crates/net/network/src/import.rs +++ b/crates/net/network/src/import.rs @@ -3,7 +3,7 @@ use reth_primitives::PeerId; use std::task::{Context, Poll}; /// Abstraction over block import. -pub trait BlockImport: Send + Sync { +pub trait BlockImport: std::fmt::Debug + Send + Sync { /// Invoked for a received `NewBlock` broadcast message from the peer. /// /// > When a `NewBlock` announcement message is received from a peer, the client first verifies @@ -18,6 +18,7 @@ pub trait BlockImport: Send + Sync { } /// Outcome of the [`BlockImport`]'s block handling. +#[derive(Debug)] pub struct BlockImportOutcome { /// Sender of the `NewBlock` message. pub peer: PeerId, diff --git a/crates/net/network/src/lib.rs b/crates/net/network/src/lib.rs index 968377d5e9e0..0978811ccb4b 100644 --- a/crates/net/network/src/lib.rs +++ b/crates/net/network/src/lib.rs @@ -1,17 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_docs)] -#![deny(unused_must_use, rust_2018_idioms, rustdoc::broken_intra_doc_links)] -#![allow(rustdoc::private_intra_doc_links)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - //! reth P2P networking. //! //! Ethereum's networking protocol is specified in [devp2p](https://github.com/ethereum/devp2p). @@ -119,6 +105,15 @@ //! - `test-utils`: Various utilities helpful for writing tests //! - `geth-tests`: Runs tests that require Geth to be installed locally. +#![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/paradigmxzy/reth/issues/" +)] +#![warn(missing_debug_implementations, missing_docs, rustdoc::all)] // TODO(danipopes): unreachable_pub +#![deny(unused_must_use, rust_2018_idioms)] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + #[cfg(any(test, feature = "test-utils"))] /// Common helpers for network testing. pub mod test_utils; @@ -145,7 +140,7 @@ pub mod transactions; pub use builder::NetworkBuilder; pub use config::{NetworkConfig, NetworkConfigBuilder}; -pub use discovery::Discovery; +pub use discovery::{Discovery, DiscoveryEvent}; pub use fetch::FetchClient; pub use manager::{NetworkEvent, NetworkManager}; pub use message::PeerRequest; diff --git a/crates/net/network/src/manager.rs b/crates/net/network/src/manager.rs index d094150a6a35..c076c7fba84f 100644 --- a/crates/net/network/src/manager.rs +++ b/crates/net/network/src/manager.rs @@ -85,6 +85,7 @@ use tracing::{debug, error, trace, warn}; /// ethrequest <--> |ETH request handing| NetworkManager /// discovery --> |Discovered peers| NetworkManager /// ``` +#[derive(Debug)] #[must_use = "The NetworkManager does nothing unless polled"] pub struct NetworkManager { /// The type that manages the actual network part, which includes connections. diff --git a/crates/net/network/src/network.rs b/crates/net/network/src/network.rs index ced055f58887..aa6d28721517 100644 --- a/crates/net/network/src/network.rs +++ b/crates/net/network/src/network.rs @@ -157,7 +157,7 @@ impl NetworkHandle { }) } - /// Provides a shareable reference to the [`BandwidthMeter`] stored on the [`NetworkInner`] + /// Provides a shareable reference to the [`BandwidthMeter`] stored on the `NetworkInner`. pub fn bandwidth_meter(&self) -> &BandwidthMeter { &self.inner.bandwidth_meter } @@ -321,6 +321,7 @@ struct NetworkInner { /// Internal messages that can be passed to the [`NetworkManager`](crate::NetworkManager). #[allow(missing_docs)] +#[derive(Debug)] pub(crate) enum NetworkHandleMessage { /// Adds an address for a peer. AddPeerAddress(PeerId, PeerKind, SocketAddr), diff --git a/crates/net/network/src/peers/manager.rs b/crates/net/network/src/peers/manager.rs index 2188647b3909..c25aeaceb4f6 100644 --- a/crates/net/network/src/peers/manager.rs +++ b/crates/net/network/src/peers/manager.rs @@ -81,7 +81,8 @@ impl PeersHandle { /// From this type, connections to peers are established or disconnected, see [`PeerAction`]. /// /// The [`PeersManager`] will be notified on peer related changes -pub(crate) struct PeersManager { +#[derive(Debug)] +pub struct PeersManager { /// All peers known to the network peers: HashMap, /// Copy of the sender half, so new [`PeersHandle`] can be created on demand. @@ -117,7 +118,7 @@ pub(crate) struct PeersManager { impl PeersManager { /// Create a new instance with the given config - pub(crate) fn new(config: PeersConfig) -> Self { + pub fn new(config: PeersConfig) -> Self { let PeersConfig { refill_slots_interval, connection_info, @@ -1020,6 +1021,7 @@ impl PeerConnectionState { } /// Commands the [`PeersManager`] listens for. +#[derive(Debug)] pub(crate) enum PeerCommand { /// Command for manually add Add(PeerId, SocketAddr), @@ -1046,28 +1048,47 @@ pub enum PeerAction { remote_addr: SocketAddr, }, /// Disconnect an existing connection. - Disconnect { peer_id: PeerId, reason: Option }, + Disconnect { + /// The peer ID of the established connection. + peer_id: PeerId, + /// An optional reason for the disconnect. + reason: Option, + }, /// Disconnect an existing incoming connection, because the peers reputation is below the /// banned threshold or is on the [`BanList`] DisconnectBannedIncoming { - /// Peer id of the established connection. + /// The peer ID of the established connection. peer_id: PeerId, }, /// Ban the peer in discovery. - DiscoveryBanPeerId { peer_id: PeerId, ip_addr: IpAddr }, + DiscoveryBanPeerId { + /// The peer ID. + peer_id: PeerId, + /// The IP address. + ip_addr: IpAddr, + }, /// Ban the IP in discovery. - DiscoveryBanIp { ip_addr: IpAddr }, + DiscoveryBanIp { + /// The IP address. + ip_addr: IpAddr, + }, /// Ban the peer temporarily - BanPeer { peer_id: PeerId }, + BanPeer { + /// The peer ID. + peer_id: PeerId, + }, /// Unban the peer temporarily - UnBanPeer { peer_id: PeerId }, + UnBanPeer { + /// The peer ID. + peer_id: PeerId, + }, /// Emit peerAdded event PeerAdded(PeerId), /// Emit peerRemoved event PeerRemoved(PeerId), } -/// Config type for initiating a [`PeersManager`] instance +/// Config type for initiating a [`PeersManager`] instance. #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(default))] diff --git a/crates/net/network/src/peers/mod.rs b/crates/net/network/src/peers/mod.rs index fb28d401328a..0261753ca7bf 100644 --- a/crates/net/network/src/peers/mod.rs +++ b/crates/net/network/src/peers/mod.rs @@ -3,8 +3,8 @@ mod manager; mod reputation; -pub(crate) use manager::{InboundConnectionError, PeerAction, PeersManager}; -pub use manager::{Peer, PeersConfig, PeersHandle}; +pub(crate) use manager::InboundConnectionError; +pub use manager::{Peer, PeerAction, PeersConfig, PeersHandle, PeersManager}; pub use reputation::ReputationChangeWeights; pub use reth_network_api::PeerKind; diff --git a/crates/net/network/src/state.rs b/crates/net/network/src/state.rs index bf8ba0a0cd4a..d2828e522ddf 100644 --- a/crates/net/network/src/state.rs +++ b/crates/net/network/src/state.rs @@ -44,6 +44,7 @@ const PEER_BLOCK_CACHE_LIMIT: usize = 512; /// then send to the session of the peer. /// /// This type is also responsible for responding for received request. +#[derive(Debug)] pub struct NetworkState { /// All active peers and their state. active_peers: HashMap, @@ -465,6 +466,7 @@ where /// Tracks the state of a Peer with an active Session. /// /// For example known blocks,so we can decide what to announce. +#[derive(Debug)] pub(crate) struct ActivePeer { /// Best block of the peer. pub(crate) best_hash: H256, @@ -480,6 +482,7 @@ pub(crate) struct ActivePeer { } /// Message variants triggered by the [`NetworkState`] +#[derive(Debug)] pub(crate) enum StateAction { /// Dispatch a `NewBlock` message to the peer NewBlock { diff --git a/crates/net/network/src/swarm.rs b/crates/net/network/src/swarm.rs index b3e7a0363478..ab92b3aa0590 100644 --- a/crates/net/network/src/swarm.rs +++ b/crates/net/network/src/swarm.rs @@ -61,6 +61,7 @@ use tracing::{debug, trace}; /// fetchRequest --> |request Headers, Bodies| StateFetch /// State --> |poll pending requests| StateFetch /// ``` +#[derive(Debug)] #[must_use = "Swarm does nothing unless polled"] pub(crate) struct Swarm { /// Listens for new incoming connections. @@ -428,7 +429,7 @@ pub(crate) enum SwarmEvent { /// Represents the state of the connection of the node. If shutting down, /// new connections won't be established. -#[derive(Default)] +#[derive(Debug, Default)] pub(crate) enum NetworkConnectionState { #[default] Active, diff --git a/crates/net/network/src/test_utils/mod.rs b/crates/net/network/src/test_utils/mod.rs index 2513f0e9f213..ead44ae61c8b 100644 --- a/crates/net/network/src/test_utils/mod.rs +++ b/crates/net/network/src/test_utils/mod.rs @@ -1,5 +1,3 @@ -#![warn(missing_docs, unreachable_pub)] - //! Common helpers for network testing. mod init; @@ -9,4 +7,4 @@ pub use init::{ enr_to_peer_id, unused_port, unused_tcp_addr, unused_tcp_and_udp_port, unused_tcp_udp, unused_udp_addr, unused_udp_port, GETH_TIMEOUT, }; -pub use testnet::{NetworkEventStream, PeerConfig, Testnet}; +pub use testnet::{NetworkEventStream, Peer, PeerConfig, Testnet}; diff --git a/crates/net/network/src/test_utils/testnet.rs b/crates/net/network/src/test_utils/testnet.rs index 443b7057e7af..78bcde9b2eb5 100644 --- a/crates/net/network/src/test_utils/testnet.rs +++ b/crates/net/network/src/test_utils/testnet.rs @@ -187,6 +187,7 @@ where } /// A handle to a [`Testnet`] that can be shared. +#[derive(Debug)] pub struct TestnetHandle { _handle: JoinHandle<()>, terminate: oneshot::Sender>>, @@ -203,7 +204,9 @@ impl TestnetHandle { } } +/// A peer in the [`Testnet`]. #[pin_project] +#[derive(Debug)] pub struct Peer { #[pin] network: NetworkManager, @@ -262,6 +265,7 @@ where } /// A helper config for setting up the reth networking stack. +#[derive(Debug)] pub struct PeerConfig { config: NetworkConfig, client: C, @@ -327,6 +331,7 @@ impl Default for PeerConfig { /// A helper type to await network events /// /// This makes it easier to await established connections +#[derive(Debug)] pub struct NetworkEventStream { inner: UnboundedReceiverStream, } diff --git a/crates/net/network/src/transactions.rs b/crates/net/network/src/transactions.rs index 16ab7252dab9..1db483101275 100644 --- a/crates/net/network/src/transactions.rs +++ b/crates/net/network/src/transactions.rs @@ -59,6 +59,7 @@ const GET_POOLED_TRANSACTION_SOFT_LIMIT_SIZE: GetPooledTransactionLimit = pub type PoolImportFuture = Pin> + Send + 'static>>; /// Api to interact with [`TransactionsManager`] task. +#[derive(Debug)] pub struct TransactionsHandle { /// Command channel to the [`TransactionsManager`] manager_tx: mpsc::UnboundedSender, @@ -117,6 +118,7 @@ impl TransactionsHandle { /// /// It is directly connected to the [`TransactionPool`] to retrieve requested transactions and /// propagate new transactions over the network. +#[derive(Debug)] #[must_use = "Manager does nothing unless polled."] pub struct TransactionsManager { /// Access to the transaction pool. @@ -844,6 +846,7 @@ impl Future for GetPooledTxRequestFut { } /// Tracks a single peer +#[derive(Debug)] struct Peer { /// Keeps track of transactions that we know the peer has seen. transactions: LruCache, @@ -857,6 +860,7 @@ struct Peer { } /// Commands to send to the [`TransactionsManager`] +#[derive(Debug)] enum TransactionsCommand { /// Propagate a transaction hash to the network. PropagateHash(H256), diff --git a/crates/payload/basic/src/lib.rs b/crates/payload/basic/src/lib.rs index 55322ce2518c..421bb45d98c7 100644 --- a/crates/payload/basic/src/lib.rs +++ b/crates/payload/basic/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! A basic payload generator for reth. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! A basic payload generator for reth. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] use crate::metrics::PayloadBuilderMetrics; use futures_core::ready; @@ -63,6 +59,7 @@ use tracing::{debug, trace}; mod metrics; /// The [`PayloadJobGenerator`] that creates [`BasicPayloadJob`]s. +#[derive(Debug)] pub struct BasicPayloadJobGenerator { /// The client that can interact with the chain. client: Client, @@ -185,7 +182,7 @@ where } /// Restricts how many generator tasks can be executed at once. -#[derive(Clone)] +#[derive(Debug, Clone)] struct PayloadTaskGuard(Arc); // === impl PayloadTaskGuard === @@ -270,6 +267,7 @@ impl Default for BasicPayloadJobGeneratorConfig { } /// A basic payload job that continuously builds a payload with the best transactions from the pool. +#[derive(Debug)] pub struct BasicPayloadJob { /// The configuration for how the payload will be created. config: PayloadConfig, @@ -534,7 +532,7 @@ impl Drop for Cancelled { } /// Static config for how to build a payload. -#[derive(Clone)] +#[derive(Clone, Debug)] struct PayloadConfig { /// Pre-configured block environment. initialized_block_env: BlockEnv, @@ -576,6 +574,7 @@ pub enum BuildOutcome { /// This struct encapsulates the essential components and configuration required for the payload /// building process. It holds references to the Ethereum client, transaction pool, cached reads, /// payload configuration, cancellation status, and the best payload achieved so far. +#[derive(Debug)] pub struct BuildArguments { client: Client, pool: Pool, diff --git a/crates/payload/builder/src/lib.rs b/crates/payload/builder/src/lib.rs index d0bfeb1c95f1..1180ce8e0879 100644 --- a/crates/payload/builder/src/lib.rs +++ b/crates/payload/builder/src/lib.rs @@ -1,21 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_docs)] -#![deny( - unused_must_use, - rust_2018_idioms, - rustdoc::broken_intra_doc_links, - unused_crate_dependencies -)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - //! This crate defines abstractions to create and update payloads (blocks): //! - [`PayloadJobGenerator`]: a type that knows how to create new jobs for creating payloads based //! on [`PayloadAttributes`](reth_rpc_types::engine::PayloadAttributes). @@ -110,6 +92,15 @@ //! //! - `test-utils`: Export utilities for testing +#![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/paradigmxzy/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))] + pub mod database; pub mod error; mod metrics; diff --git a/crates/payload/builder/src/service.rs b/crates/payload/builder/src/service.rs index 3a46f011b9c2..94872be5daf4 100644 --- a/crates/payload/builder/src/service.rs +++ b/crates/payload/builder/src/service.rs @@ -10,6 +10,7 @@ use crate::{ use futures_util::{future::FutureExt, StreamExt}; use reth_rpc_types::engine::PayloadId; use std::{ + fmt, future::Future, pin::Pin, sync::Arc, @@ -150,6 +151,7 @@ impl PayloadBuilderHandle { /// /// By design, this type relies entirely on the [`PayloadJobGenerator`] to create new payloads and /// does know nothing about how to build them, it just drives their jobs to completion. +#[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"] pub struct PayloadBuilderService where @@ -331,3 +333,20 @@ enum PayloadServiceCommand { /// Resolve the payload and return the payload Resolve(PayloadId, oneshot::Sender>), } + +impl fmt::Debug for PayloadServiceCommand { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + PayloadServiceCommand::BuildNewPayload(f0, f1) => { + f.debug_tuple("BuildNewPayload").field(&f0).field(&f1).finish() + } + PayloadServiceCommand::BestPayload(f0, f1) => { + f.debug_tuple("BestPayload").field(&f0).field(&f1).finish() + } + PayloadServiceCommand::PayloadAttributes(f0, f1) => { + f.debug_tuple("PayloadAttributes").field(&f0).field(&f1).finish() + } + PayloadServiceCommand::Resolve(f0, _f1) => f.debug_tuple("Resolve").field(&f0).finish(), + } + } +} diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 3d7356942735..bc1340cb8a43 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -1,17 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_debug_implementations, 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)) -))] -#![allow(clippy::non_canonical_clone_impl)] - //! Commonly used types in reth. //! //! This crate contains Ethereum primitive types and helper functions. @@ -20,6 +6,17 @@ //! //! - `arbitrary`: Adds `proptest` and `arbitrary` support for primitive types. //! - `test-utils`: Export utilities for testing + +#![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/paradigmxzy/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))] +#![allow(clippy::non_canonical_clone_impl)] + pub mod abi; mod account; pub mod basefee; diff --git a/crates/primitives/src/proofs.rs b/crates/primitives/src/proofs.rs index cdfef6bb54e6..54e234ef4408 100644 --- a/crates/primitives/src/proofs.rs +++ b/crates/primitives/src/proofs.rs @@ -22,6 +22,7 @@ pub const EMPTY_ROOT: H256 = /// A [Hasher] that calculates a keccak256 hash of the given data. #[derive(Default, Debug, Clone, PartialEq, Eq)] +#[non_exhaustive] pub struct KeccakHasher; impl Hasher for KeccakHasher { diff --git a/crates/prune/src/lib.rs b/crates/prune/src/lib.rs index 9c08cfff461a..30ff207bc883 100644 --- a/crates/prune/src/lib.rs +++ b/crates/prune/src/lib.rs @@ -1,3 +1,14 @@ +//! Pruning implementation. + +#![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/paradigmxzy/reth/issues/" +)] +#![warn(missing_debug_implementations, unreachable_pub, rustdoc::all)] // TODO(danipopes): missing_docs +#![deny(unused_must_use, rust_2018_idioms)] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + mod error; mod metrics; mod pruner; diff --git a/crates/prune/src/pruner.rs b/crates/prune/src/pruner.rs index 7be4cfdb5d2e..a38462b89046 100644 --- a/crates/prune/src/pruner.rs +++ b/crates/prune/src/pruner.rs @@ -33,6 +33,7 @@ pub type PrunerResult = Result; pub type PrunerWithResult = (Pruner, PrunerResult); /// Pruning routine. Main pruning logic happens in [Pruner::run]. +#[derive(Debug)] pub struct Pruner { metrics: Metrics, provider_factory: ProviderFactory, diff --git a/crates/revm/revm-inspectors/src/lib.rs b/crates/revm/revm-inspectors/src/lib.rs index 30e6dca6e3b9..a783ad865dca 100644 --- a/crates/revm/revm-inspectors/src/lib.rs +++ b/crates/revm/revm-inspectors/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![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)) -))] - //! revm [Inspector](revm::Inspector) implementations, such as call tracers //! //! ## Feature Flags @@ -18,6 +5,15 @@ //! - `js-tracer` (default): Enables a JavaScript tracer implementation. This pulls in extra //! dependencies (such as `boa`, `tokio` and `serde_json`). +#![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/paradigmxzy/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))] + /// An inspector implementation for an EIP2930 Accesslist pub mod access_list; diff --git a/crates/revm/revm-inspectors/src/stack/mod.rs b/crates/revm/revm-inspectors/src/stack/mod.rs index fac15905bbfe..c11fbc917f3d 100644 --- a/crates/revm/revm-inspectors/src/stack/mod.rs +++ b/crates/revm/revm-inspectors/src/stack/mod.rs @@ -73,8 +73,8 @@ impl InspectorStack { } } -#[derive(Default)] /// Configuration for the inspectors. +#[derive(Debug, Default)] pub struct InspectorStackConfig { /// Enable revm inspector printer. /// In execution this will print opcode level traces directly to console. diff --git a/crates/revm/revm-primitives/src/lib.rs b/crates/revm/revm-primitives/src/lib.rs index 3b5d59d34672..692cd2825857 100644 --- a/crates/revm/revm-primitives/src/lib.rs +++ b/crates/revm/revm-primitives/src/lib.rs @@ -1,17 +1,14 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Revm utils and implementations specific to reth. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -//! revm utils and implementations specific to reth. pub mod config; /// Helpers for configuring revm [Env](revm::primitives::Env) diff --git a/crates/revm/src/lib.rs b/crates/revm/src/lib.rs index 7dae2a87ef84..058661e972b8 100644 --- a/crates/revm/src/lib.rs +++ b/crates/revm/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Revm utils and implementations specific to reth. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! revm utils and implementations specific to reth. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] /// Contains glue code for integrating reth database into revm's [Database]. pub mod database; diff --git a/crates/revm/src/processor.rs b/crates/revm/src/processor.rs index a230385518f8..3fa89ac212a0 100644 --- a/crates/revm/src/processor.rs +++ b/crates/revm/src/processor.rs @@ -42,6 +42,9 @@ use tracing::{debug, trace}; /// /// InspectorStack are used for optional inspecting execution. And it contains /// various duration of parts of execution. +// TODO: https://github.com/bluealloy/revm/pull/745 +// #[derive(Debug)] +#[allow(missing_debug_implementations)] pub struct EVMProcessor<'a> { /// The configured chain-spec chain_spec: Arc, diff --git a/crates/rlp/rlp-derive/src/lib.rs b/crates/rlp/rlp-derive/src/lib.rs index 02d9bc4449cb..31240dcac17e 100644 --- a/crates/rlp/rlp-derive/src/lib.rs +++ b/crates/rlp/rlp-derive/src/lib.rs @@ -4,7 +4,7 @@ html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, unused_crate_dependencies)] #![doc(test( no_crate_inject, diff --git a/crates/rlp/src/lib.rs b/crates/rlp/src/lib.rs index c9bf35e5c5b8..897b3d178797 100644 --- a/crates/rlp/src/lib.rs +++ b/crates/rlp/src/lib.rs @@ -4,7 +4,7 @@ html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/" )] -#![warn(unreachable_pub)] +#![warn(unreachable_pub, rustdoc::all)] #![deny(unused_must_use)] #![doc(test( no_crate_inject, diff --git a/crates/rpc/ipc/src/client.rs b/crates/rpc/ipc/src/client.rs index c88eed597d1a..61a8381fcc20 100644 --- a/crates/rpc/ipc/src/client.rs +++ b/crates/rpc/ipc/src/client.rs @@ -81,7 +81,7 @@ impl TransportReceiverT for Receiver { } } -/// Builder for IPC transport [`Sender`] and ['Receiver`] pair. +/// Builder for IPC transport [`Sender`] and [`Receiver`] pair. #[derive(Debug, Clone, Default)] #[non_exhaustive] pub struct IpcTransportClientBuilder; diff --git a/crates/rpc/ipc/src/lib.rs b/crates/rpc/ipc/src/lib.rs index 0bc5e1207c34..84fba7177a18 100644 --- a/crates/rpc/ipc/src/lib.rs +++ b/crates/rpc/ipc/src/lib.rs @@ -1,21 +1,17 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Reth IPC transport implementation +//! +//! ## Feature Flags +//! +//! - `client`: Enables JSON-RPC client support. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_debug_implementations, missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Reth IPC transport implementation -//! -//! ## Feature Flags -//! -//! - `client`: Enables JSON-RPC client support. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #[cfg(unix)] pub mod client; diff --git a/crates/rpc/rpc-api/src/lib.rs b/crates/rpc/rpc-api/src/lib.rs index 27a4afc389c9..ea595a1ab5ac 100644 --- a/crates/rpc/rpc-api/src/lib.rs +++ b/crates/rpc/rpc-api/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_debug_implementations, missing_docs, unreachable_pub, unused_crate_dependencies)] -#![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - //! Reth RPC interface definitions //! //! Provides all RPC interfaces. @@ -19,6 +6,15 @@ //! //! - `client`: Enables JSON-RPC client support. +#![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/paradigmxzy/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 admin; mod debug; mod engine; diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index 8d4ad0cafb0f..39cda544311f 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -1,17 +1,4 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![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)) -))] - -//! Configure reth RPC +//! Configure reth RPC. //! //! This crate contains several builder and config types that allow to configure the selection of //! [RethRpcModule] specific to transports (ws, http, ipc). @@ -103,6 +90,15 @@ //! } //! ``` +#![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/paradigmxzy/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))] + use crate::{auth::AuthRpcModule, error::WsHttpSamePortError, metrics::RpcServerMetrics}; use constants::*; use error::{RpcError, ServerKind}; @@ -434,7 +430,7 @@ impl RpcModuleConfig { } /// Configures [RpcModuleConfig] -#[derive(Default)] +#[derive(Clone, Debug, Default)] pub struct RpcModuleConfigBuilder { eth: Option, } @@ -708,6 +704,7 @@ impl Serialize for RethRpcModule { } /// A Helper type the holds instances of the configured modules. +#[derive(Debug)] pub struct RethModuleRegistry { provider: Provider, pool: Pool, diff --git a/crates/rpc/rpc-engine-api/src/engine_api.rs b/crates/rpc/rpc-engine-api/src/engine_api.rs index 632676af7ab9..79b3aa189d8a 100644 --- a/crates/rpc/rpc-engine-api/src/engine_api.rs +++ b/crates/rpc/rpc-engine-api/src/engine_api.rs @@ -705,6 +705,7 @@ where } /// Handler for `engine_getPayloadBodiesByRangeV1` + /// /// See also /// /// Returns the execution payload bodies by the range starting at `start`, containing `count` @@ -718,7 +719,7 @@ where /// ensuring that the range is limited properly, and that the range boundaries are computed /// correctly and without panics. /// - /// Note: If a block is pre shanghai, `withdrawals` field will be `null + /// Note: If a block is pre shanghai, `withdrawals` field will be `null`. async fn get_payload_bodies_by_range_v1( &self, start: U64, diff --git a/crates/rpc/rpc-engine-api/src/lib.rs b/crates/rpc/rpc-engine-api/src/lib.rs index 92631faa10ab..f8aa0b47bd33 100644 --- a/crates/rpc/rpc-engine-api/src/lib.rs +++ b/crates/rpc/rpc-engine-api/src/lib.rs @@ -1,18 +1,14 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! The implementation of Engine API. +//! [Read more](https://github.com/ethereum/execution-apis/tree/main/src/engine). + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub)] -#![deny(unused_must_use, rust_2018_idioms, unused_crate_dependencies)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! The implementation of Engine API. -//! [Read more](https://github.com/ethereum/execution-apis/tree/main/src/engine). +#![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))] /// The Engine API implementation. mod engine_api; diff --git a/crates/rpc/rpc-testing-util/src/lib.rs b/crates/rpc/rpc-testing-util/src/lib.rs index 144b7408f4bd..85b479d5ef0c 100644 --- a/crates/rpc/rpc-testing-util/src/lib.rs +++ b/crates/rpc/rpc-testing-util/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Reth RPC testing utilities. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_debug_implementations, missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Reth RPC testing utilities. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] pub mod debug; pub mod trace; diff --git a/crates/rpc/rpc-types-compat/src/lib.rs b/crates/rpc/rpc-types-compat/src/lib.rs index 3774a08374a9..cedcd9809b0c 100644 --- a/crates/rpc/rpc-types-compat/src/lib.rs +++ b/crates/rpc/rpc-types-compat/src/lib.rs @@ -1,19 +1,15 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Reth compatibility and utils for RPC types +//! +//! This crate various helper functions to convert between reth primitive types and rpc types. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_debug_implementations, missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Reth compatibility and utils for RPC types -//! -//! This crate various helper functions to convert between reth primitive types and rpc types. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] pub mod block; pub use block::*; diff --git a/crates/rpc/rpc-types/src/lib.rs b/crates/rpc/rpc-types/src/lib.rs index 8b3542e6d35f..3c52b87738c4 100644 --- a/crates/rpc/rpc-types/src/lib.rs +++ b/crates/rpc/rpc-types/src/lib.rs @@ -1,19 +1,15 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Reth RPC type definitions. +//! +//! Provides all relevant types for the various RPC endpoints, grouped by namespace. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_debug_implementations, missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Reth RPC type definitions -//! -//! Provides all relevant types for the various RPC endpoints, grouped by namespace. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] mod admin; mod eth; diff --git a/crates/rpc/rpc/src/lib.rs b/crates/rpc/rpc/src/lib.rs index e1818523f296..5bd7da3c5002 100644 --- a/crates/rpc/rpc/src/lib.rs +++ b/crates/rpc/rpc/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_debug_implementations, 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)) -))] - //! Reth RPC implementation //! //! Provides the implementation of all RPC interfaces. @@ -30,6 +17,15 @@ //! lot of handlers make use of async functions, caching for example, but are also using blocking //! disk-io, hence these calls are spawned as futures to a blocking task manually. +#![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/paradigmxzy/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 admin; mod debug; mod engine; diff --git a/crates/stages/src/lib.rs b/crates/stages/src/lib.rs index 6b988366e1c7..ba60047a9d46 100644 --- a/crates/stages/src/lib.rs +++ b/crates/stages/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_debug_implementations, 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)) -))] -#![allow(clippy::result_large_err)] //! Staged syncing primitives for reth. //! //! This crate contains the syncing primitives [`Pipeline`] and [`Stage`], as well as all stages @@ -63,6 +50,17 @@ //! ## Feature Flags //! //! - `test-utils`: Export utilities for testing + +#![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/paradigmxzy/reth/issues/" +)] +#![allow(clippy::result_large_err)] // TODO(danipopes): fix this +#![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 error; mod metrics; mod pipeline; diff --git a/crates/stages/src/stages/finish.rs b/crates/stages/src/stages/finish.rs index 02c63215a602..751c4e37bfe1 100644 --- a/crates/stages/src/stages/finish.rs +++ b/crates/stages/src/stages/finish.rs @@ -8,6 +8,7 @@ use reth_provider::DatabaseProviderRW; /// This stage does not write anything; it's checkpoint is used to denote the highest fully synced /// block. #[derive(Default, Debug, Clone)] +#[non_exhaustive] pub struct FinishStage; #[async_trait::async_trait] diff --git a/crates/storage/codecs/derive/src/compact/mod.rs b/crates/storage/codecs/derive/src/compact/mod.rs index 6560b9034156..cf27bb80bc9b 100644 --- a/crates/storage/codecs/derive/src/compact/mod.rs +++ b/crates/storage/codecs/derive/src/compact/mod.rs @@ -1,4 +1,3 @@ -extern crate proc_macro2; use proc_macro::{self, TokenStream}; use proc_macro2::{Ident, TokenStream as TokenStream2}; use quote::{format_ident, quote}; diff --git a/crates/storage/codecs/derive/src/lib.rs b/crates/storage/codecs/derive/src/lib.rs index 071f7499aebc..97c9f619a30a 100644 --- a/crates/storage/codecs/derive/src/lib.rs +++ b/crates/storage/codecs/derive/src/lib.rs @@ -1,9 +1,15 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Derive macros for the Compact codec traits. + #![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/paradigmxzy/reth/issues/" )] +// TODO(danipopes): add these warnings +// #![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))] + use proc_macro::{self, TokenStream, TokenTree}; use quote::{format_ident, quote}; use syn::{parse_macro_input, DeriveInput}; diff --git a/crates/storage/codecs/src/lib.rs b/crates/storage/codecs/src/lib.rs index 23df27b47f59..a7831414e6d9 100644 --- a/crates/storage/codecs/src/lib.rs +++ b/crates/storage/codecs/src/lib.rs @@ -1,13 +1,19 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Compact codec. + #![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/paradigmxzy/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))] + use bytes::{Buf, Bytes}; -pub use codecs_derive::*; use revm_primitives::{B160 as H160, B256 as H256, U256}; +pub use codecs_derive::*; + /// Trait that implements the `Compact` codec. /// /// When deriving the trait for custom structs, be aware of certain limitations/recommendations: @@ -344,9 +350,7 @@ fn decode_varuint(mut buf: &[u8]) -> (usize, &[u8]) { #[cfg(test)] mod tests { use super::*; - use revm_primitives::B160; - - pub type Address = B160; + use revm_primitives::Address; #[test] fn compact_bytes() { @@ -490,7 +494,7 @@ mod tests { #[main_codec] #[derive(Debug, PartialEq, Clone)] - pub struct TestStruct { + struct TestStruct { f_u64: u64, f_u256: U256, f_bool_t: bool, @@ -542,7 +546,7 @@ mod tests { #[main_codec] #[derive(Debug, PartialEq, Clone, Default)] - pub enum TestEnum { + enum TestEnum { #[default] Var0, Var1(TestStruct), diff --git a/crates/storage/db/src/abstraction/common.rs b/crates/storage/db/src/abstraction/common.rs index 73d253ee2ad1..29a1e34294d9 100644 --- a/crates/storage/db/src/abstraction/common.rs +++ b/crates/storage/db/src/abstraction/common.rs @@ -21,6 +21,7 @@ use crate::{abstraction::table::*, DatabaseError}; // Sealed trait helper to prevent misuse of the API. mod sealed { pub trait Sealed: Sized {} + #[allow(missing_debug_implementations)] pub struct Bounds(T); impl Sealed for Bounds {} } diff --git a/crates/storage/db/src/abstraction/cursor.rs b/crates/storage/db/src/abstraction/cursor.rs index 7414190b19c8..cd1b90510a96 100644 --- a/crates/storage/db/src/abstraction/cursor.rs +++ b/crates/storage/db/src/abstraction/cursor.rs @@ -1,4 +1,5 @@ use std::{ + fmt, marker::PhantomData, ops::{Bound, RangeBounds}, }; @@ -148,6 +149,16 @@ pub struct Walker<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> { _tx_phantom: PhantomData<&'tx T>, } +impl<'tx, T, CURSOR> fmt::Debug for Walker<'_, 'tx, T, CURSOR> +where + T: Table, + CURSOR: DbCursorRO<'tx, T> + fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Walker").field("cursor", &self.cursor).field("start", &self.start).finish() + } +} + impl<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> std::iter::Iterator for Walker<'cursor, 'tx, T, CURSOR> { @@ -195,6 +206,19 @@ pub struct ReverseWalker<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> { _tx_phantom: PhantomData<&'tx T>, } +impl<'tx, T, CURSOR> fmt::Debug for ReverseWalker<'_, 'tx, T, CURSOR> +where + T: Table, + CURSOR: DbCursorRO<'tx, T> + fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ReverseWalker") + .field("cursor", &self.cursor) + .field("start", &self.start) + .finish() + } +} + impl<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> ReverseWalker<'cursor, 'tx, T, CURSOR> { /// construct ReverseWalker pub fn new(cursor: &'cursor mut CURSOR, start: IterPairResult) -> Self { @@ -247,6 +271,21 @@ pub struct RangeWalker<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> { _tx_phantom: PhantomData<&'tx T>, } +impl<'tx, T, CURSOR> fmt::Debug for RangeWalker<'_, 'tx, T, CURSOR> +where + T: Table, + CURSOR: DbCursorRO<'tx, T> + fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RangeWalker") + .field("cursor", &self.cursor) + .field("start", &self.start) + .field("end_key", &self.end_key) + .field("is_done", &self.is_done) + .finish() + } +} + impl<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> std::iter::Iterator for RangeWalker<'cursor, 'tx, T, CURSOR> { @@ -322,6 +361,19 @@ pub struct DupWalker<'cursor, 'tx, T: DupSort, CURSOR: DbDupCursorRO<'tx, T>> { pub _tx_phantom: PhantomData<&'tx T>, } +impl<'tx, T, CURSOR> fmt::Debug for DupWalker<'_, 'tx, T, CURSOR> +where + T: DupSort, + CURSOR: DbDupCursorRO<'tx, T> + fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("DupWalker") + .field("cursor", &self.cursor) + .field("start", &self.start) + .finish() + } +} + impl<'cursor, 'tx, T: DupSort, CURSOR: DbCursorRW<'tx, T> + DbDupCursorRO<'tx, T>> DupWalker<'cursor, 'tx, T, CURSOR> { diff --git a/crates/storage/db/src/abstraction/mock.rs b/crates/storage/db/src/abstraction/mock.rs index c7b340925291..af760f729063 100644 --- a/crates/storage/db/src/abstraction/mock.rs +++ b/crates/storage/db/src/abstraction/mock.rs @@ -15,7 +15,7 @@ use crate::{ /// Mock database used for testing with inner BTreeMap structure /// TODO -#[derive(Clone, Default)] +#[derive(Clone, Debug, Default)] pub struct DatabaseMock { /// Main data. TODO (Make it table aware) pub data: BTreeMap, Vec>, @@ -115,6 +115,7 @@ impl<'a> DbTxMut<'a> for TxMock { impl<'a> TableImporter<'a> for TxMock {} /// Cursor that iterates over table +#[derive(Debug)] pub struct CursorMock { _cursor: u32, } diff --git a/crates/storage/db/src/lib.rs b/crates/storage/db/src/lib.rs index 725b2c9dbf6b..cb705871d874 100644 --- a/crates/storage/db/src/lib.rs +++ b/crates/storage/db/src/lib.rs @@ -1,9 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] //! reth's database abstraction layer with concrete implementations. //! //! The database abstraction assumes that the underlying store is a KV store subdivided into tables. @@ -61,12 +55,14 @@ //! [`Decompress`]: crate::abstraction::table::Decompress //! [`Table`]: crate::abstraction::table::Table -#![warn(missing_docs, unreachable_pub)] +#![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/paradigmxzy/reth/issues/" +)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] /// Traits defining the database abstractions, such as cursors and transactions. pub mod abstraction; diff --git a/crates/storage/db/src/tables/models/blocks.rs b/crates/storage/db/src/tables/models/blocks.rs index c6f80b6e3419..20b305c2f06e 100644 --- a/crates/storage/db/src/tables/models/blocks.rs +++ b/crates/storage/db/src/tables/models/blocks.rs @@ -7,10 +7,10 @@ use std::ops::Range; /// Total number of transactions. pub type NumTransactions = u64; -/// The storage of the block body indices +/// The storage of the block body indices. /// /// It has the pointer to the transaction Number of the first -/// transaction in the block and the total number of transactions +/// transaction in the block and the total number of transactions. #[derive(Debug, Default, Eq, PartialEq, Clone)] #[main_codec] pub struct StoredBlockBodyIndices { @@ -65,10 +65,9 @@ impl StoredBlockBodyIndices { } } -/// The storage representation of a block ommers. +/// The storage representation of a block's ommers. /// /// It is stored as the headers of the block's uncles. -/// tx_amount)`. #[main_codec] #[derive(Debug, Default, Eq, PartialEq, Clone)] pub struct StoredBlockOmmers { diff --git a/crates/storage/libmdbx-rs/mdbx-sys/src/lib.rs b/crates/storage/libmdbx-rs/mdbx-sys/src/lib.rs index 78345d9185a8..e9365d437ac5 100644 --- a/crates/storage/libmdbx-rs/mdbx-sys/src/lib.rs +++ b/crates/storage/libmdbx-rs/mdbx-sys/src/lib.rs @@ -1,13 +1,11 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! [`libmbdx`](https://github.com/erthink/libmdbx) bindings. + #![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/paradigmxzy/reth/issues/" )] -#![deny(warnings)] -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(clippy::all)] +#![allow(non_upper_case_globals, non_camel_case_types, non_snake_case, clippy::all)] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); diff --git a/crates/storage/libmdbx-rs/src/cursor.rs b/crates/storage/libmdbx-rs/src/cursor.rs index 4bfb2f25681c..5d30d7abdd3b 100644 --- a/crates/storage/libmdbx-rs/src/cursor.rs +++ b/crates/storage/libmdbx-rs/src/cursor.rs @@ -13,7 +13,7 @@ use ffi::{ }; use libc::c_void; use parking_lot::Mutex; -use std::{borrow::Cow, fmt, marker::PhantomData, mem, ptr, rc::Rc, result}; +use std::{borrow::Cow, fmt, marker::PhantomData, mem, ptr, rc::Rc}; /// A cursor for navigating the items within a database. pub struct Cursor<'txn, K> @@ -30,7 +30,7 @@ where K: TransactionKind, { pub(crate) fn new( - txn: &'txn Transaction, + txn: &'txn Transaction<'_, K, E>, dbi: ffi::MDBX_dbi, ) -> Result { let mut cursor: *mut ffi::MDBX_cursor = ptr::null_mut(); @@ -467,7 +467,7 @@ impl<'txn, K> fmt::Debug for Cursor<'txn, K> where K: TransactionKind, { - fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Cursor").finish() } } @@ -733,7 +733,7 @@ where Key: TableObject<'txn>, Value: TableObject<'txn>, { - fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("IterDup").finish() } } diff --git a/crates/storage/libmdbx-rs/src/environment.rs b/crates/storage/libmdbx-rs/src/environment.rs index ff09838e3c3c..18217b1702c1 100644 --- a/crates/storage/libmdbx-rs/src/environment.rs +++ b/crates/storage/libmdbx-rs/src/environment.rs @@ -15,7 +15,7 @@ use std::{ mem, ops::{Bound, RangeBounds}, path::Path, - ptr, result, + ptr, sync::mpsc::{sync_channel, SyncSender}, thread::sleep, time::Duration, @@ -35,8 +35,11 @@ pub trait EnvironmentKind: private::Sealed + Debug + 'static { } #[derive(Debug)] +#[non_exhaustive] pub struct NoWriteMap; + #[derive(Debug)] +#[non_exhaustive] pub struct WriteMap; impl EnvironmentKind for NoWriteMap { @@ -325,7 +328,7 @@ impl fmt::Debug for Environment where E: EnvironmentKind, { - fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Environment").finish() } } diff --git a/crates/storage/libmdbx-rs/src/error.rs b/crates/storage/libmdbx-rs/src/error.rs index 0bc8e17724ef..ebe5a43a3d43 100644 --- a/crates/storage/libmdbx-rs/src/error.rs +++ b/crates/storage/libmdbx-rs/src/error.rs @@ -140,7 +140,7 @@ impl From for i32 { } impl fmt::Display for Error { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { let value = match self { Self::DecodeErrorLenDiff => "Mismatched data length", _ => unsafe { diff --git a/crates/storage/libmdbx-rs/src/lib.rs b/crates/storage/libmdbx-rs/src/lib.rs index e64d868b8790..9f785e325e23 100644 --- a/crates/storage/libmdbx-rs/src/lib.rs +++ b/crates/storage/libmdbx-rs/src/lib.rs @@ -1,11 +1,14 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +#![doc = include_str!("../README.md")] #![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/paradigmxzy/reth/issues/" )] #![allow(clippy::type_complexity)] -#![doc = include_str!("../README.md")] +// TODO(danipopes): add these warnings +// #![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))] pub use crate::{ codec::*, diff --git a/crates/storage/libmdbx-rs/src/transaction.rs b/crates/storage/libmdbx-rs/src/transaction.rs index 5f9bf644064f..bb6b42486069 100644 --- a/crates/storage/libmdbx-rs/src/transaction.rs +++ b/crates/storage/libmdbx-rs/src/transaction.rs @@ -10,7 +10,7 @@ use indexmap::IndexSet; use libc::{c_uint, c_void}; use parking_lot::Mutex; use std::{ - fmt, fmt::Debug, marker::PhantomData, mem::size_of, ptr, rc::Rc, result, slice, + fmt, fmt::Debug, marker::PhantomData, mem::size_of, ptr, rc::Rc, slice, sync::mpsc::sync_channel, }; @@ -32,8 +32,11 @@ pub trait TransactionKind: private::Sealed + Debug + 'static { } #[derive(Debug)] +#[non_exhaustive] pub struct RO; + #[derive(Debug)] +#[non_exhaustive] pub struct RW; impl TransactionKind for RO { @@ -421,7 +424,7 @@ where K: TransactionKind, E: EnvironmentKind, { - fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("RoTransaction").finish() } } diff --git a/crates/storage/nippy-jar/src/compression/zstd.rs b/crates/storage/nippy-jar/src/compression/zstd.rs index 219592e763f9..494ed6734dbd 100644 --- a/crates/storage/nippy-jar/src/compression/zstd.rs +++ b/crates/storage/nippy-jar/src/compression/zstd.rs @@ -104,7 +104,7 @@ impl Zstd { column_value: &[u8], tmp_buf: &mut Vec, handle: &mut File, - compressor: Option<&mut Compressor>, + compressor: Option<&mut Compressor<'_>>, ) -> Result<(), NippyJarError> { if let Some(compressor) = compressor { // Compressor requires the destination buffer to be big enough to write, otherwise it diff --git a/crates/storage/nippy-jar/src/lib.rs b/crates/storage/nippy-jar/src/lib.rs index bd491871a311..2626bbeb78c5 100644 --- a/crates/storage/nippy-jar/src/lib.rs +++ b/crates/storage/nippy-jar/src/lib.rs @@ -1,3 +1,15 @@ +//! Immutable data store format. + +#![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/paradigmxzy/reth/issues/" +)] +// TODO(danipopes): add these warnings +// #![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))] + use serde::{Deserialize, Serialize}; use std::{ clone::Clone, diff --git a/crates/storage/provider/src/bundle_state/state_changes.rs b/crates/storage/provider/src/bundle_state/state_changes.rs index fddfbdaac1a1..750e50acefad 100644 --- a/crates/storage/provider/src/bundle_state/state_changes.rs +++ b/crates/storage/provider/src/bundle_state/state_changes.rs @@ -12,7 +12,7 @@ use reth_revm_primitives::{ }; /// A change to the state of the world. -#[derive(Default)] +#[derive(Debug, Default)] pub struct StateChanges(pub StateChangeset); impl From for StateChanges { diff --git a/crates/storage/provider/src/bundle_state/state_reverts.rs b/crates/storage/provider/src/bundle_state/state_reverts.rs index e3a178ca0eec..e97c0855aeb8 100644 --- a/crates/storage/provider/src/bundle_state/state_reverts.rs +++ b/crates/storage/provider/src/bundle_state/state_reverts.rs @@ -14,7 +14,7 @@ use reth_revm_primitives::{ use std::iter::Peekable; /// Revert of the state. -#[derive(Default)] +#[derive(Debug, Default)] pub struct StateReverts(pub PlainStateReverts); impl From for StateReverts { diff --git a/crates/storage/provider/src/chain.rs b/crates/storage/provider/src/chain.rs index c37958166de9..bb97c25f2769 100644 --- a/crates/storage/provider/src/chain.rs +++ b/crates/storage/provider/src/chain.rs @@ -235,6 +235,7 @@ impl Chain { } /// Wrapper type for `blocks` display in `Chain` +#[derive(Debug)] pub struct DisplayBlocksChain<'a>(pub &'a BTreeMap); impl<'a> fmt::Display for DisplayBlocksChain<'a> { diff --git a/crates/storage/provider/src/lib.rs b/crates/storage/provider/src/lib.rs index 310f663d18ce..9a5045d73adb 100644 --- a/crates/storage/provider/src/lib.rs +++ b/crates/storage/provider/src/lib.rs @@ -1,22 +1,17 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Collection of traits and trait implementations for common database operations. +//! +//! ## Feature Flags +//! +//! - `test-utils`: Export utilities for testing + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! This crate contains a collection of traits and trait implementations for common database -//! operations. -//! -//! ## Feature Flags -//! -//! - `test-utils`: Export utilities for testing +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] /// Various provider traits. mod traits; diff --git a/crates/storage/provider/src/providers/bundle_state_provider.rs b/crates/storage/provider/src/providers/bundle_state_provider.rs index a6a01a16c4fb..63741919cab3 100644 --- a/crates/storage/provider/src/providers/bundle_state_provider.rs +++ b/crates/storage/provider/src/providers/bundle_state_provider.rs @@ -7,6 +7,7 @@ use reth_primitives::{Account, Address, BlockNumber, Bytecode, Bytes, H256}; /// A state provider that either resolves to data in a wrapped [`crate::BundleStateWithReceipts`], /// or an underlying state provider. +#[derive(Debug)] pub struct BundleStateProvider { /// The inner state provider. pub(crate) state_provider: SP, diff --git a/crates/storage/provider/src/providers/mod.rs b/crates/storage/provider/src/providers/mod.rs index a909149ca93c..b120d1d08594 100644 --- a/crates/storage/provider/src/providers/mod.rs +++ b/crates/storage/provider/src/providers/mod.rs @@ -49,7 +49,7 @@ use reth_interfaces::blockchain_tree::{ /// This type serves as the main entry point for interacting with the blockchain and provides data /// from database storage and from the blockchain tree (pending state etc.) It is a simple wrapper /// type that holds an instance of the database and the blockchain tree. -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct BlockchainProvider { /// Provider type used to access the database. database: ProviderFactory, diff --git a/crates/storage/provider/src/providers/state/historical.rs b/crates/storage/provider/src/providers/state/historical.rs index cd4c58c542fc..e63ab53b9a28 100644 --- a/crates/storage/provider/src/providers/state/historical.rs +++ b/crates/storage/provider/src/providers/state/historical.rs @@ -27,6 +27,7 @@ use std::marker::PhantomData; /// - [tables::StorageHistory] /// - [tables::AccountChangeSet] /// - [tables::StorageChangeSet] +#[derive(Debug)] pub struct HistoricalStateProviderRef<'a, 'b, TX: DbTx<'a>> { /// Transaction tx: &'b TX, @@ -258,6 +259,7 @@ impl<'a, 'b, TX: DbTx<'a>> StateProvider for HistoricalStateProviderRef<'a, 'b, /// State provider for a given block number. /// For more detailed description, see [HistoricalStateProviderRef]. +#[derive(Debug)] pub struct HistoricalStateProvider<'a, TX: DbTx<'a>> { /// Database transaction tx: TX, @@ -314,7 +316,7 @@ delegate_provider_impls!(HistoricalStateProvider<'a, TX> where [TX: DbTx<'a>]); /// Lowest blocks at which different parts of the state are available. /// They may be [Some] if pruning is enabled. -#[derive(Default, Copy, Clone)] +#[derive(Clone, Copy, Debug, Default)] pub struct LowestAvailableBlocks { /// Lowest block number at which the account history is available. It may not be available if /// [reth_primitives::PrunePart::AccountHistory] was pruned. diff --git a/crates/storage/provider/src/providers/state/latest.rs b/crates/storage/provider/src/providers/state/latest.rs index 0120bbcf2460..a1759b6ffe13 100644 --- a/crates/storage/provider/src/providers/state/latest.rs +++ b/crates/storage/provider/src/providers/state/latest.rs @@ -14,6 +14,7 @@ use reth_primitives::{ use std::marker::PhantomData; /// State provider over latest state that takes tx reference. +#[derive(Debug)] pub struct LatestStateProviderRef<'a, 'b, TX: DbTx<'a>> { /// database transaction db: &'b TX, @@ -105,6 +106,7 @@ impl<'a, 'b, TX: DbTx<'a>> StateProvider for LatestStateProviderRef<'a, 'b, TX> } /// State provider for the latest state. +#[derive(Debug)] pub struct LatestStateProvider<'a, TX: DbTx<'a>> { /// database transaction db: TX, diff --git a/crates/storage/provider/src/test_utils/blocks.rs b/crates/storage/provider/src/test_utils/blocks.rs index 55982b010870..e978e979cbc1 100644 --- a/crates/storage/provider/src/test_utils/blocks.rs +++ b/crates/storage/provider/src/test_utils/blocks.rs @@ -49,6 +49,7 @@ pub fn assert_genesis_block(provider: &DatabaseProviderRW<'_, DB>, /// Test chain with genesis, blocks, execution results /// that have valid changesets. +#[derive(Debug)] pub struct BlockChainTestData { /// Genesis pub genesis: SealedBlock, diff --git a/crates/storage/provider/src/test_utils/events.rs b/crates/storage/provider/src/test_utils/events.rs index cf253822693e..34c4266612e5 100644 --- a/crates/storage/provider/src/test_utils/events.rs +++ b/crates/storage/provider/src/test_utils/events.rs @@ -4,7 +4,7 @@ use tokio::sync::broadcast::{self, Sender}; use crate::{CanonStateNotification, CanonStateNotifications, CanonStateSubscriptions, Chain}; /// A test ChainEventSubscriptions -#[derive(Clone, Default)] +#[derive(Clone, Debug, Default)] pub struct TestCanonStateSubscriptions { canon_notif_tx: Arc>>>, } diff --git a/crates/storage/provider/src/test_utils/executor.rs b/crates/storage/provider/src/test_utils/executor.rs index 5ed366dfb3cb..c528218f0e97 100644 --- a/crates/storage/provider/src/test_utils/executor.rs +++ b/crates/storage/provider/src/test_utils/executor.rs @@ -7,6 +7,7 @@ use reth_interfaces::executor::BlockExecutionError; use reth_primitives::{Address, Block, BlockNumber, ChainSpec, PruneModes, U256}; use std::sync::Arc; /// Test executor with mocked result. +#[derive(Debug)] pub struct TestExecutor(pub Option); impl BlockExecutor for TestExecutor { diff --git a/crates/tasks/src/lib.rs b/crates/tasks/src/lib.rs index 86fa5a408eb6..05721ac4e5c0 100644 --- a/crates/tasks/src/lib.rs +++ b/crates/tasks/src/lib.rs @@ -1,17 +1,13 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] +//! Reth task management. + #![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/paradigmxzy/reth/issues/" )] -#![warn(missing_docs, unreachable_pub)] +#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)] #![deny(unused_must_use, rust_2018_idioms)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! reth task management +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] use crate::{ metrics::{IncCounterOnDrop, TaskExecutorMetrics}, @@ -138,6 +134,7 @@ impl TaskSpawner for TokioTaskExecutor { /// diagnostic purposes, since tokio task essentially fail silently. Therefore, this type is a /// Stream that yields the name of panicked task, See [`TaskExecutor::spawn_critical`]. In order to /// execute Tasks use the [`TaskExecutor`] type [`TaskManager::executor`]. +#[derive(Debug)] #[must_use = "TaskManager must be polled to monitor critical tasks"] pub struct TaskManager { /// Handle to the tokio runtime this task manager is associated with. diff --git a/crates/tasks/src/metrics.rs b/crates/tasks/src/metrics.rs index 08a557d8f544..89edaa245177 100644 --- a/crates/tasks/src/metrics.rs +++ b/crates/tasks/src/metrics.rs @@ -1,4 +1,6 @@ //! Task Executor Metrics +use core::fmt; + use reth_metrics::{metrics::Counter, Metrics}; /// Task Executor Metrics @@ -28,6 +30,12 @@ impl TaskExecutorMetrics { /// Helper type for increasing counters even if a task fails. pub struct IncCounterOnDrop(Counter); +impl fmt::Debug for IncCounterOnDrop { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_tuple("IncCounterOnDrop").finish() + } +} + impl IncCounterOnDrop { /// Create a new `IncCounterOnDrop`. pub fn new(counter: Counter) -> Self { diff --git a/crates/tracing/src/lib.rs b/crates/tracing/src/lib.rs index 8ad0d70e1c7c..9deb46b257ce 100644 --- a/crates/tracing/src/lib.rs +++ b/crates/tracing/src/lib.rs @@ -1,16 +1,4 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![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)) -))] -//! reth tracing subscribers and utilities. +//! Reth tracing subscribers and utilities. //! //! Contains a standardized set of layers: //! @@ -19,6 +7,16 @@ //! - [`journald()`] //! //! As well as a simple way to initialize a subscriber: [`init`]. + +#![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/paradigmxzy/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))] + use rolling_file::{RollingConditionBasic, RollingFileAppender}; use std::path::Path; use tracing::Subscriber; diff --git a/crates/transaction-pool/src/lib.rs b/crates/transaction-pool/src/lib.rs index ae8818222f9f..09955b1e38a2 100644 --- a/crates/transaction-pool/src/lib.rs +++ b/crates/transaction-pool/src/lib.rs @@ -1,22 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![warn(missing_docs)] -#![deny( - unused_must_use, - rust_2018_idioms, - unreachable_pub, - missing_debug_implementations, - rustdoc::broken_intra_doc_links -)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - //! Reth's transaction pool implementation. //! //! This crate provides a generic transaction pool implementation. @@ -153,6 +134,16 @@ //! //! - `serde` (default): Enable serde support //! - `test-utils`: Export utilities for testing + +#![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/paradigmxzy/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))] + use crate::pool::PoolInner; use aquamarine as _; use reth_primitives::{Address, BlobTransactionSidecar, PooledTransactionsElement, TxHash, U256}; diff --git a/crates/transaction-pool/src/pool/txpool.rs b/crates/transaction-pool/src/pool/txpool.rs index 8789fbd6c7d8..f1043df8338f 100644 --- a/crates/transaction-pool/src/pool/txpool.rs +++ b/crates/transaction-pool/src/pool/txpool.rs @@ -696,7 +696,7 @@ impl TxPool { /// Asserts all invariants of the pool's: /// - /// - All maps are bijections (`by_id`, `by_hash`)` + /// - All maps are bijections (`by_id`, `by_hash`) /// - Total size is equal to the sum of all sub-pools /// /// # Panics diff --git a/crates/transaction-pool/src/test_utils/mock.rs b/crates/transaction-pool/src/test_utils/mock.rs index 054e301ecf99..82bc1e0ba0d1 100644 --- a/crates/transaction-pool/src/test_utils/mock.rs +++ b/crates/transaction-pool/src/test_utils/mock.rs @@ -498,13 +498,13 @@ impl FromRecoveredTransaction for MockTransaction { let hash = transaction.hash(); match transaction.transaction { Transaction::Legacy(TxLegacy { - chain_id, + chain_id: _, nonce, gas_price, gas_limit, to, value, - input, + input: _, }) => MockTransaction::Legacy { hash, sender, @@ -515,15 +515,15 @@ impl FromRecoveredTransaction for MockTransaction { value: U256::from(value), }, Transaction::Eip1559(TxEip1559 { - chain_id, + chain_id: _, nonce, gas_limit, max_fee_per_gas, max_priority_fee_per_gas, to, value, - input, - access_list, + input: _, + access_list: _, }) => MockTransaction::Eip1559 { hash, sender, @@ -535,15 +535,15 @@ impl FromRecoveredTransaction for MockTransaction { value: U256::from(value), }, Transaction::Eip4844(TxEip4844 { - chain_id, + chain_id: _, nonce, gas_limit, max_fee_per_gas, max_priority_fee_per_gas, to, value, - input, - access_list, + input: _, + access_list: _, blob_versioned_hashes: _, max_fee_per_blob_gas, }) => MockTransaction::Eip4844 { diff --git a/crates/trie/src/hashed_cursor/post_state.rs b/crates/trie/src/hashed_cursor/post_state.rs index 1afff48c5927..58150d5e0a51 100644 --- a/crates/trie/src/hashed_cursor/post_state.rs +++ b/crates/trie/src/hashed_cursor/post_state.rs @@ -150,6 +150,7 @@ impl HashedPostState { } /// The hashed cursor factory for the post state. +#[derive(Debug)] pub struct HashedPostStateCursorFactory<'a, 'b, TX> { tx: &'a TX, post_state: &'b HashedPostState, diff --git a/crates/trie/src/lib.rs b/crates/trie/src/lib.rs index ae89671def47..98a200a23c8c 100644 --- a/crates/trie/src/lib.rs +++ b/crates/trie/src/lib.rs @@ -1,16 +1,3 @@ -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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/paradigmxzy/reth/issues/" -)] -#![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)) -))] - //! The implementation of Merkle Patricia Trie, a cryptographically //! authenticated radix trie that is used to store key-value bindings. //! @@ -19,6 +6,15 @@ //! //! - `test-utils`: Export utilities for testing +#![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/paradigmxzy/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))] + /// The Ethereum account as represented in the trie. pub mod account; diff --git a/crates/trie/src/prefix_set/loader.rs b/crates/trie/src/prefix_set/loader.rs index 0755e32c7b7e..3ee8b211a3fe 100644 --- a/crates/trie/src/prefix_set/loader.rs +++ b/crates/trie/src/prefix_set/loader.rs @@ -25,7 +25,7 @@ pub struct LoadedPrefixSets { } /// A wrapper around a database transaction that loads prefix sets within a given block range. -#[derive(Deref)] +#[derive(Debug, Deref)] pub struct PrefixSetLoader<'a, TX>(&'a TX); impl<'a, TX> PrefixSetLoader<'a, TX> { diff --git a/crates/trie/src/proof.rs b/crates/trie/src/proof.rs index d44ac4592eb8..d76f79ebdb48 100644 --- a/crates/trie/src/proof.rs +++ b/crates/trie/src/proof.rs @@ -34,6 +34,7 @@ use reth_rlp::Encodable; /// /// After traversing the path, the proof generator continues to restore the root node of the trie /// until completion. The root node is then inserted at the start of the proof. +#[derive(Debug)] pub struct Proof<'a, 'b, TX, H> { /// A reference to the database transaction. tx: &'a TX, diff --git a/crates/trie/src/trie.rs b/crates/trie/src/trie.rs index 42522cb45574..116166d93773 100644 --- a/crates/trie/src/trie.rs +++ b/crates/trie/src/trie.rs @@ -22,6 +22,7 @@ use std::{ }; /// StateRoot is used to compute the root node of a state trie. +#[derive(Debug)] pub struct StateRoot<'a, 'b, TX, H> { /// A reference to the database transaction. pub tx: &'a TX, @@ -368,6 +369,7 @@ where } /// StorageRoot is used to compute the root node of an account storage trie. +#[derive(Debug)] pub struct StorageRoot<'a, 'b, TX, H> { /// A reference to the database transaction. pub tx: &'a TX, diff --git a/crates/trie/src/trie_cursor/account_cursor.rs b/crates/trie/src/trie_cursor/account_cursor.rs index f7f3bd759f32..4160c278bb2c 100644 --- a/crates/trie/src/trie_cursor/account_cursor.rs +++ b/crates/trie/src/trie_cursor/account_cursor.rs @@ -4,6 +4,7 @@ use reth_db::{cursor::DbCursorRO, tables, DatabaseError}; use reth_primitives::trie::{BranchNodeCompact, StoredNibbles}; /// A cursor over the account trie. +#[derive(Debug)] pub struct AccountTrieCursor(C); impl AccountTrieCursor { diff --git a/crates/trie/src/trie_cursor/storage_cursor.rs b/crates/trie/src/trie_cursor/storage_cursor.rs index 8929e09ae286..61091e7741f8 100644 --- a/crates/trie/src/trie_cursor/storage_cursor.rs +++ b/crates/trie/src/trie_cursor/storage_cursor.rs @@ -10,6 +10,7 @@ use reth_primitives::{ }; /// A cursor over the storage trie. +#[derive(Debug)] pub struct StorageTrieCursor { /// The underlying cursor. pub cursor: C, diff --git a/crates/trie/src/walker.rs b/crates/trie/src/walker.rs index a343b0ee69f0..c3073b36434e 100644 --- a/crates/trie/src/walker.rs +++ b/crates/trie/src/walker.rs @@ -12,6 +12,7 @@ use std::marker::PhantomData; /// `TrieWalker` is a structure that enables traversal of a Merkle trie. /// It allows moving through the trie in a depth-first manner, skipping certain branches if the . +#[derive(Debug)] pub struct TrieWalker<'a, K, C> { /// A mutable reference to a trie cursor instance used for navigating the trie. pub cursor: &'a mut C, diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 619935b49538..2bbf33605bda 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -22,7 +22,6 @@ reth-network.workspace = true reth-transaction-pool.workspace = true reth-tasks.workspace = true - eyre = "0.6.8" futures.workspace = true async-trait.workspace = true diff --git a/examples/additional-rpc-namespace-in-cli/Cargo.toml b/examples/additional-rpc-namespace-in-cli/Cargo.toml index dadbe58587db..3c2a2a4239b4 100644 --- a/examples/additional-rpc-namespace-in-cli/Cargo.toml +++ b/examples/additional-rpc-namespace-in-cli/Cargo.toml @@ -11,4 +11,4 @@ reth-transaction-pool.workspace = true clap = { version = "4", features = ["derive"] } jsonrpsee = { workspace = true, features = ["server", "macros"] } -eyre = "0.6" \ No newline at end of file +eyre = "0.6" diff --git a/testing/ef-tests/Cargo.toml b/testing/ef-tests/Cargo.toml index 7145273a9310..bdc221a22d7e 100644 --- a/testing/ef-tests/Cargo.toml +++ b/testing/ef-tests/Cargo.toml @@ -23,4 +23,4 @@ tokio = "1.28.1" walkdir = "2.3.3" serde = "1.0.163" serde_json.workspace = true -thiserror.workspace = true \ No newline at end of file +thiserror.workspace = true diff --git a/testing/ef-tests/src/lib.rs b/testing/ef-tests/src/lib.rs index 3360af5661ec..c6b743a909ae 100644 --- a/testing/ef-tests/src/lib.rs +++ b/testing/ef-tests/src/lib.rs @@ -1,12 +1,14 @@ -#![warn(missing_debug_implementations, 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)) -))] - //! Abstractions and runners for EF tests. +#![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/paradigmxzy/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))] + pub mod case; pub mod result; pub mod suite;