mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 02:49:55 +00:00
chore: add and fix more lints, improve docs (#4765)
This commit is contained in:
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[alias]
|
||||
docs = "doc --workspace --all-features --no-deps"
|
||||
30
.github/workflows/book.yml
vendored
30
.github/workflows/book.yml
vendored
@ -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: |
|
||||
|
||||
91
.github/workflows/ci.yml
vendored
91
.github/workflows/ci.yml
vendored
@ -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
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
- name: Install toolchain
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
components: rustfmt, 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
|
||||
|
||||
doc-lint:
|
||||
name: doc lint
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 60
|
||||
clippy:
|
||||
name: clippy
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/rust-toolchain@clippy
|
||||
- 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 clippy --workspace --all-targets --all-features
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
|
||||
docs:
|
||||
name: docs
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- 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
|
||||
|
||||
@ -113,6 +113,7 @@ impl<T> 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 {}
|
||||
|
||||
@ -81,7 +81,7 @@ impl<Ext: RethCliExt> Cli<Ext> {
|
||||
|
||||
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()),
|
||||
|
||||
@ -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,
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -60,7 +60,7 @@ pub fn logs_dir() -> Option<PathBuf> {
|
||||
///
|
||||
/// 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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<dyn CanonChainTracker>,
|
||||
}
|
||||
|
||||
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<dyn CanonChainTracker>) -> 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,
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ level = 1
|
||||
build-dir = "target/book"
|
||||
|
||||
[preprocessor.template]
|
||||
before = [ "links" ]
|
||||
before = ["links"]
|
||||
|
||||
[preprocessor.index]
|
||||
|
||||
|
||||
@ -98,6 +98,7 @@ pub struct BlockchainTree<DB: Database, C: Consensus, EF: ExecutorFactory> {
|
||||
|
||||
/// 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<BlockChainId, AppendableChain>,
|
||||
|
||||
@ -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};
|
||||
|
||||
|
||||
@ -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<DB: Database, C: Consensus, EF: ExecutorFactory> {
|
||||
/// BlockchainTree
|
||||
pub tree: Arc<RwLock<BlockchainTree<DB, C, EF>>>,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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, Pool> {
|
||||
client: Client,
|
||||
consensus: AutoSealConsensus,
|
||||
|
||||
@ -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<Box<dyn EngineHook>>,
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@ -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<DB> {
|
||||
metrics: Metrics,
|
||||
}
|
||||
|
||||
impl<DB: fmt::Debug> fmt::Debug for PruneHook<DB> {
|
||||
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<DB: Database + 'static> PruneHook<DB> {
|
||||
/// Create a new instance
|
||||
pub fn new(pruner: Pruner<DB>, pruner_task_spawner: Box<dyn TaskSpawner>) -> Self {
|
||||
@ -150,6 +162,7 @@ impl<DB: Database + 'static> EngineHook for PruneHook<DB> {
|
||||
/// 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<DB> {
|
||||
/// Pruner is idle.
|
||||
Idle(Option<Pruner<DB>>),
|
||||
|
||||
@ -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<DB, BT, Client>
|
||||
where
|
||||
DB: Database,
|
||||
|
||||
@ -50,6 +50,7 @@ type TestBeaconConsensusEngine<Client> = BeaconConsensusEngine<
|
||||
Arc<EitherDownloader<Client, NoopFullBlockClient>>,
|
||||
>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TestEnv<DB> {
|
||||
pub db: DB,
|
||||
// Keep the tip receiver around, so it's not dropped.
|
||||
@ -116,7 +117,7 @@ impl<DB> TestEnv<DB> {
|
||||
// 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<Result<ExecOutput, StageError>>),
|
||||
@ -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<BundleStateWithReceipts>),
|
||||
@ -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<ChainSpec>,
|
||||
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<Client> {
|
||||
base_config: TestConsensusEngineBuilder,
|
||||
client: Option<Client>,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -1,22 +1,18 @@
|
||||
#![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))
|
||||
))]
|
||||
|
||||
//! 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_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)]
|
||||
#![deny(unused_must_use, rust_2018_idioms)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
/// Consensus traits.
|
||||
pub mod consensus;
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ impl EthResponseValidator for RequestResult<Vec<Header>> {
|
||||
}
|
||||
|
||||
/// 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.")]
|
||||
|
||||
@ -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<Client>
|
||||
where
|
||||
Client: BodiesClient + HeadersClient,
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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<T> {
|
||||
/// The [PollSender](PollSender) that this wraps around
|
||||
/// The [PollSender] that this wraps around.
|
||||
sender: PollSender<T>,
|
||||
/// Holds metrics for this type
|
||||
/// Holds metrics for this type.
|
||||
metrics: MeteredPollSenderMetrics,
|
||||
}
|
||||
|
||||
impl<T: Send + 'static> MeteredPollSender<T> {
|
||||
/// Creates a new [`MeteredPollSender`] wrapping around the provided [PollSender](PollSender)
|
||||
/// Creates a new [`MeteredPollSender`] wrapping around the provided [PollSender].
|
||||
pub fn new(sender: PollSender<T>, scope: &'static str) -> Self {
|
||||
Self { sender, metrics: MeteredPollSenderMetrics::new(scope) }
|
||||
}
|
||||
|
||||
/// Returns the underlying [PollSender](PollSender).
|
||||
/// Returns the underlying [PollSender].
|
||||
pub fn inner(&self) -> &PollSender<T> {
|
||||
&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<Result<(), PollSendError<T>>> {
|
||||
match self.sender.poll_reserve(cx) {
|
||||
@ -300,7 +300,7 @@ impl<T: Send + 'static> MeteredPollSender<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// 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<T>> {
|
||||
match self.sender.send_item(item) {
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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: <https://github.com/ethereum/devp2p/blob/master/discv4.md>
|
||||
//!
|
||||
//! 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,
|
||||
|
||||
@ -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<NodeRecord>, to: SocketAddr },
|
||||
}
|
||||
|
||||
/// Command for interacting with the `MockDiscovery` service
|
||||
#[derive(Debug)]
|
||||
pub enum MockCommand {
|
||||
MockPong { node_id: PeerId },
|
||||
MockNeighbours { target: PeerId, nodes: Vec<NodeRecord> },
|
||||
|
||||
@ -1,22 +1,19 @@
|
||||
#![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))
|
||||
))]
|
||||
|
||||
//! 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_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::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<DnsDiscoveryCommand>,
|
||||
@ -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<R: Resolver = DnsResolver> {
|
||||
/// Copy of the sender half, so new [`DnsDiscoveryHandle`] can be created on demand.
|
||||
command_tx: UnboundedSender<DnsDiscoveryCommand>,
|
||||
|
||||
@ -48,7 +48,7 @@ impl<P: ConnectionProvider> Resolver for AsyncResolver<P> {
|
||||
/// 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 ===
|
||||
|
||||
@ -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<H: HeadersClient> {
|
||||
/// Consensus client used to validate headers
|
||||
consensus: Arc<dyn Consensus>,
|
||||
|
||||
@ -1,23 +1,19 @@
|
||||
#![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))
|
||||
))]
|
||||
#![allow(clippy::result_large_err)]
|
||||
|
||||
//! 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/"
|
||||
)]
|
||||
#![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))]
|
||||
|
||||
/// The collection of algorithms for downloading block bodies.
|
||||
pub mod bodies;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -85,6 +85,7 @@ impl StatusBuilder {
|
||||
}
|
||||
|
||||
/// Builder for [`HelloMessage`] messages.
|
||||
#[derive(Debug)]
|
||||
pub struct HelloBuilder {
|
||||
hello: HelloMessage,
|
||||
}
|
||||
|
||||
@ -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<S> {
|
||||
#[pin]
|
||||
inner: S,
|
||||
|
||||
@ -45,6 +45,7 @@ impl HelloMessage {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HelloMessageBuilder {
|
||||
/// The version of the `p2p` protocol.
|
||||
pub protocol_version: Option<ProtocolVersion>,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<S> {
|
||||
#[pin]
|
||||
inner: S,
|
||||
|
||||
@ -1,22 +1,18 @@
|
||||
#![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))
|
||||
))]
|
||||
|
||||
//! 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_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 igd::aio::search_gateway;
|
||||
use pin_project_lite::pin_project;
|
||||
use std::{
|
||||
@ -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 }
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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<C, Tx, Eth> {
|
||||
pub(crate) network: NetworkManager<C>,
|
||||
pub(crate) transactions: Tx,
|
||||
|
||||
@ -27,6 +27,7 @@ pub fn rng_secret_key() -> SecretKey {
|
||||
}
|
||||
|
||||
/// All network related initialization settings.
|
||||
#[derive(Debug)]
|
||||
pub struct NetworkConfig<C> {
|
||||
/// The client type that can interact with the chain.
|
||||
///
|
||||
|
||||
@ -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.
|
||||
///
|
||||
|
||||
@ -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<C> {
|
||||
/// The client type that can interact with the chain.
|
||||
|
||||
@ -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<Req, Resp> {
|
||||
/// The issued request object
|
||||
/// TODO: this can be attached to the response in error case
|
||||
@ -358,6 +362,7 @@ struct Request<Req, Resp> {
|
||||
}
|
||||
|
||||
/// 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 {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<C> {
|
||||
/// The type that manages the actual network part, which includes connections.
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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<PeerId, Peer>,
|
||||
/// 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<DisconnectReason> },
|
||||
Disconnect {
|
||||
/// The peer ID of the established connection.
|
||||
peer_id: PeerId,
|
||||
/// An optional reason for the disconnect.
|
||||
reason: Option<DisconnectReason>,
|
||||
},
|
||||
/// 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))]
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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<C> {
|
||||
/// All active peers and their state.
|
||||
active_peers: HashMap<PeerId, ActivePeer>,
|
||||
@ -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 {
|
||||
|
||||
@ -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<C> {
|
||||
/// 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,
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -187,6 +187,7 @@ where
|
||||
}
|
||||
|
||||
/// A handle to a [`Testnet`] that can be shared.
|
||||
#[derive(Debug)]
|
||||
pub struct TestnetHandle<C> {
|
||||
_handle: JoinHandle<()>,
|
||||
terminate: oneshot::Sender<oneshot::Sender<Testnet<C>>>,
|
||||
@ -203,7 +204,9 @@ impl<C> TestnetHandle<C> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A peer in the [`Testnet`].
|
||||
#[pin_project]
|
||||
#[derive(Debug)]
|
||||
pub struct Peer<C> {
|
||||
#[pin]
|
||||
network: NetworkManager<C>,
|
||||
@ -262,6 +265,7 @@ where
|
||||
}
|
||||
|
||||
/// A helper config for setting up the reth networking stack.
|
||||
#[derive(Debug)]
|
||||
pub struct PeerConfig<C = NoopProvider> {
|
||||
config: NetworkConfig<C>,
|
||||
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<NetworkEvent>,
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ const GET_POOLED_TRANSACTION_SOFT_LIMIT_SIZE: GetPooledTransactionLimit =
|
||||
pub type PoolImportFuture = Pin<Box<dyn Future<Output = PoolResult<TxHash>> + Send + 'static>>;
|
||||
|
||||
/// Api to interact with [`TransactionsManager`] task.
|
||||
#[derive(Debug)]
|
||||
pub struct TransactionsHandle {
|
||||
/// Command channel to the [`TransactionsManager`]
|
||||
manager_tx: mpsc::UnboundedSender<TransactionsCommand>,
|
||||
@ -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<Pool> {
|
||||
/// 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<H256>,
|
||||
@ -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),
|
||||
|
||||
@ -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<Client, Pool, Tasks, Builder = ()> {
|
||||
/// 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<Semaphore>);
|
||||
|
||||
// === 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<Client, Pool, Tasks, Builder> {
|
||||
/// 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<Pool, Client> {
|
||||
client: Client,
|
||||
pool: Pool,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<Gen>
|
||||
where
|
||||
@ -331,3 +333,20 @@ enum PayloadServiceCommand {
|
||||
/// Resolve the payload and return the payload
|
||||
Resolve(PayloadId, oneshot::Sender<Option<PayloadFuture>>),
|
||||
}
|
||||
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -33,6 +33,7 @@ pub type PrunerResult = Result<bool, PrunerError>;
|
||||
pub type PrunerWithResult<DB> = (Pruner<DB>, PrunerResult);
|
||||
|
||||
/// Pruning routine. Main pruning logic happens in [Pruner::run].
|
||||
#[derive(Debug)]
|
||||
pub struct Pruner<DB> {
|
||||
metrics: Metrics,
|
||||
provider_factory: ProviderFactory<DB>,
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<ChainSpec>,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,22 +1,18 @@
|
||||
#![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 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, rustdoc::all)]
|
||||
#![deny(unused_must_use, rust_2018_idioms)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
#[cfg(unix)]
|
||||
pub mod client;
|
||||
pub mod server;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<EthConfig>,
|
||||
}
|
||||
@ -708,6 +704,7 @@ impl Serialize for RethRpcModule {
|
||||
}
|
||||
|
||||
/// A Helper type the holds instances of the configured modules.
|
||||
#[derive(Debug)]
|
||||
pub struct RethModuleRegistry<Provider, Pool, Network, Tasks, Events> {
|
||||
provider: Provider,
|
||||
pool: Pool,
|
||||
|
||||
@ -705,6 +705,7 @@ where
|
||||
}
|
||||
|
||||
/// Handler for `engine_getPayloadBodiesByRangeV1`
|
||||
///
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/6452a6b194d7db269bf1dbd087a267251d3cc7f8/src/engine/shanghai.md#engine_getpayloadbodiesbyrangev1>
|
||||
///
|
||||
/// 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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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::*;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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>(T);
|
||||
impl<T> Sealed for Bounds<T> {}
|
||||
}
|
||||
|
||||
@ -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<T>) -> 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>
|
||||
{
|
||||
|
||||
@ -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<u8>, Vec<u8>>,
|
||||
@ -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,
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 {
|
||||
|
||||
10
crates/storage/libmdbx-rs/mdbx-sys/src/lib.rs
vendored
10
crates/storage/libmdbx-rs/mdbx-sys/src/lib.rs
vendored
@ -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"));
|
||||
|
||||
@ -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<E: EnvironmentKind>(
|
||||
txn: &'txn Transaction<K, E>,
|
||||
txn: &'txn Transaction<'_, K, E>,
|
||||
dbi: ffi::MDBX_dbi,
|
||||
) -> Result<Self> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<E> fmt::Debug for Environment<E>
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user