mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-09 15:28:01 -05: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: |
|
run: |
|
||||||
mkdir mdbook
|
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
|
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
|
- name: Install mdbook-template
|
||||||
run: |
|
run: |
|
||||||
mkdir mdbook-template
|
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
|
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
|
- name: Run tests
|
||||||
run: mdbook test
|
run: mdbook test
|
||||||
@@ -43,8 +43,8 @@ jobs:
|
|||||||
mkdir mdbook-linkcheck
|
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
|
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
|
unzip mdbook-linkcheck.zip -d ./mdbook-linkcheck
|
||||||
chmod +x `pwd`/mdbook-linkcheck/mdbook-linkcheck
|
chmod +x $(pwd)/mdbook-linkcheck/mdbook-linkcheck
|
||||||
echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH
|
echo $(pwd)/mdbook-linkcheck >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Run linkcheck
|
- name: Run linkcheck
|
||||||
run: mdbook-linkcheck --standalone
|
run: mdbook-linkcheck --standalone
|
||||||
@@ -54,32 +54,32 @@ jobs:
|
|||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install toolchain
|
|
||||||
uses: dtolnay/rust-toolchain@nightly
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
cache-on-failure: true
|
|
||||||
|
|
||||||
- name: Install mdbook
|
- name: Install mdbook
|
||||||
run: |
|
run: |
|
||||||
mkdir mdbook
|
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
|
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
|
- name: Install mdbook-template
|
||||||
run: |
|
run: |
|
||||||
mkdir mdbook-template
|
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
|
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
|
- name: Build book
|
||||||
run: mdbook build
|
run: mdbook build
|
||||||
|
|
||||||
- name: Build docs
|
- 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
|
- name: Move docs to book folder
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
91
.github/workflows/ci.yml
vendored
91
.github/workflows/ci.yml
vendored
@@ -5,64 +5,53 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RUSTFLAGS: -D warnings
|
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
name: ci
|
name: ci
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
clippy:
|
||||||
name: code lint
|
name: clippy
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 60
|
timeout-minutes: 30
|
||||||
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
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install toolchain
|
- uses: dtolnay/rust-toolchain@clippy
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- name: Check if documentation builds
|
- run: cargo clippy --workspace --all-targets --all-features
|
||||||
run: RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --all-features --document-private-items
|
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:
|
grafana-lint:
|
||||||
name: grafana lint
|
name: grafana lint
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 60
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Check dashboard JSON with jq
|
- name: Check dashboard JSON with jq
|
||||||
@@ -73,9 +62,9 @@ jobs:
|
|||||||
lint-success:
|
lint-success:
|
||||||
if: always()
|
if: always()
|
||||||
name: lint success
|
name: lint success
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
needs: [lint, doc-lint, grafana-lint]
|
needs: [clippy, docs, fmt, grafana-lint]
|
||||||
timeout-minutes: 60
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Decide whether the needed jobs succeeded or failed
|
- name: Decide whether the needed jobs succeeded or failed
|
||||||
uses: re-actors/alls-green@release/v1
|
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<()>].
|
/// This is a convenience type for [NoArgs<()>].
|
||||||
#[derive(Debug, Clone, Copy, Default, Args)]
|
#[derive(Debug, Clone, Copy, Default, Args)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct DefaultRethNodeCommandConfig;
|
pub struct DefaultRethNodeCommandConfig;
|
||||||
|
|
||||||
impl RethNodeCommandConfig for DefaultRethNodeCommandConfig {}
|
impl RethNodeCommandConfig for DefaultRethNodeCommandConfig {}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ impl<Ext: RethCliExt> Cli<Ext> {
|
|||||||
|
|
||||||
let _guard = self.init_tracing()?;
|
let _guard = self.init_tracing()?;
|
||||||
|
|
||||||
let runner = CliRunner::default();
|
let runner = CliRunner;
|
||||||
match self.command {
|
match self.command {
|
||||||
Commands::Node(command) => runner.run_command_until_exit(|ctx| command.execute(ctx)),
|
Commands::Node(command) => runner.run_command_until_exit(|ctx| command.execute(ctx)),
|
||||||
Commands::Init(command) => runner.run_blocking_until_ctrl_c(command.execute()),
|
Commands::Init(command) => runner.run_blocking_until_ctrl_c(command.execute()),
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
use reth_db::{
|
use reth_db::{
|
||||||
database::Database,
|
database::Database,
|
||||||
table::Table,
|
table::Table,
|
||||||
@@ -11,7 +10,6 @@ use reth_db::{
|
|||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
pub struct Command {
|
pub struct Command {
|
||||||
/// Table name
|
/// Table name
|
||||||
#[arg()]
|
|
||||||
pub table: Tables,
|
pub table: Tables,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ pub struct Command {
|
|||||||
/// The table name
|
/// The table name
|
||||||
///
|
///
|
||||||
/// NOTE: The dupsort tables are not supported now.
|
/// NOTE: The dupsort tables are not supported now.
|
||||||
#[arg()]
|
|
||||||
pub table: Tables,
|
pub table: Tables,
|
||||||
|
|
||||||
/// The key to get content for
|
/// 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
|
/// 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.
|
/// include all information for that chain, such as the p2p secret.
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct DataDirPath;
|
pub struct DataDirPath;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ impl XdgPath for DataDirPath {
|
|||||||
/// Returns the path to the reth logs directory.
|
/// Returns the path to the reth logs directory.
|
||||||
///
|
///
|
||||||
/// Refer to [dirs_next::cache_dir] for cross-platform behavior.
|
/// Refer to [dirs_next::cache_dir] for cross-platform behavior.
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct LogsDir;
|
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.
|
//! Rust Ethereum (reth) binary executable.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
@@ -23,6 +16,15 @@
|
|||||||
//! - `min-debug-logs`: Disables all logs below `debug` level.
|
//! - `min-debug-logs`: Disables all logs below `debug` level.
|
||||||
//! - `min-trace-logs`: Disables all logs below `trace` 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 args;
|
||||||
pub mod chain;
|
pub mod chain;
|
||||||
pub mod cli;
|
pub mod cli;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
use reth_provider::CanonChainTracker;
|
use reth_provider::CanonChainTracker;
|
||||||
use std::{
|
use std::{
|
||||||
|
fmt,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
task::{ready, Context, Poll},
|
task::{ready, Context, Poll},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
@@ -24,6 +25,12 @@ pub struct ConsensusLayerHealthEvents {
|
|||||||
canon_chain: Box<dyn CanonChainTracker>,
|
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 {
|
impl ConsensusLayerHealthEvents {
|
||||||
/// Creates a new [ConsensusLayerHealthEvents] with the given canonical chain tracker.
|
/// Creates a new [ConsensusLayerHealthEvents] with the given canonical chain tracker.
|
||||||
pub fn new(canon_chain: Box<dyn CanonChainTracker>) -> Self {
|
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
|
/// Event that is triggered when Consensus Layer health is degraded from the
|
||||||
/// Execution Layer point of view.
|
/// Execution Layer point of view.
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum ConsensusLayerHealthEvent {
|
pub enum ConsensusLayerHealthEvent {
|
||||||
/// Consensus Layer client was never seen.
|
/// Consensus Layer client was never seen.
|
||||||
NeverSeen,
|
NeverSeen,
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ pub struct Command {
|
|||||||
command: Subcommands,
|
command: Subcommands,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
|
||||||
/// `reth p2p` subcommands
|
/// `reth p2p` subcommands
|
||||||
|
#[derive(Subcommand, Debug)]
|
||||||
pub enum Subcommands {
|
pub enum Subcommands {
|
||||||
/// Download block header
|
/// Download block header
|
||||||
Header {
|
Header {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ use reth_tasks::{TaskExecutor, TaskManager};
|
|||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
|
|
||||||
/// Used to execute cli commands
|
/// Executes CLI commands.
|
||||||
#[derive(Default, Debug)]
|
#[derive(Clone, Debug, Default)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct CliRunner;
|
pub struct CliRunner;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ level = 1
|
|||||||
build-dir = "target/book"
|
build-dir = "target/book"
|
||||||
|
|
||||||
[preprocessor.template]
|
[preprocessor.template]
|
||||||
before = [ "links" ]
|
before = ["links"]
|
||||||
|
|
||||||
[preprocessor.index]
|
[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
|
/// A container that wraps chains and block indices to allow searching for block hashes across all
|
||||||
/// sidechains.
|
/// sidechains.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct BlockHashes<'a> {
|
pub struct BlockHashes<'a> {
|
||||||
/// The current tracked chains.
|
/// The current tracked chains.
|
||||||
pub chains: &'a mut HashMap<BlockChainId, AppendableChain>,
|
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.
|
//! Implementation of a tree-like structure for blockchains.
|
||||||
//!
|
//!
|
||||||
//! The [BlockchainTree] can validate, execute, and revert blocks in multiple competing sidechains.
|
//! The [BlockchainTree] can validate, execute, and revert blocks in multiple competing sidechains.
|
||||||
@@ -22,6 +10,15 @@
|
|||||||
//!
|
//!
|
||||||
//! - `test-utils`: Export utilities for testing
|
//! - `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 mod blockchain_tree;
|
||||||
pub use blockchain_tree::{BlockHashes, BlockchainTree};
|
pub use blockchain_tree::{BlockHashes, BlockchainTree};
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use std::{
|
|||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
|
|
||||||
/// Shareable blockchain tree that is behind tokio::RwLock
|
/// Shareable blockchain tree that is behind tokio::RwLock
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ShareableBlockchainTree<DB: Database, C: Consensus, EF: ExecutorFactory> {
|
pub struct ShareableBlockchainTree<DB: Database, C: Consensus, EF: ExecutorFactory> {
|
||||||
/// BlockchainTree
|
/// BlockchainTree
|
||||||
pub tree: Arc<RwLock<BlockchainTree<DB, C, EF>>>,
|
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(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! Standalone crate for Reth config types
|
|
||||||
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub use config::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
|
//! A [Consensus] implementation for local testing purposes
|
||||||
//! that automatically seals blocks.
|
//! that automatically seals blocks.
|
||||||
//!
|
//!
|
||||||
@@ -20,6 +7,15 @@
|
|||||||
//! These downloaders poll the miner, assemble the block, and return transactions that are ready to
|
//! These downloaders poll the miner, assemble the block, and return transactions that are ready to
|
||||||
//! be mined.
|
//! 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_beacon_consensus::BeaconEngineMessage;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::{
|
||||||
consensus::{Consensus, ConsensusError},
|
consensus::{Consensus, ConsensusError},
|
||||||
@@ -98,6 +94,7 @@ impl Consensus for AutoSealConsensus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Builder type for configuring the setup
|
/// Builder type for configuring the setup
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct AutoSealBuilder<Client, Pool> {
|
pub struct AutoSealBuilder<Client, Pool> {
|
||||||
client: Client,
|
client: Client,
|
||||||
consensus: AutoSealConsensus,
|
consensus: AutoSealConsensus,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
use reth_interfaces::RethError;
|
||||||
use reth_primitives::BlockNumber;
|
use reth_primitives::BlockNumber;
|
||||||
use std::{
|
use std::{
|
||||||
fmt::Debug,
|
fmt,
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -9,7 +10,6 @@ pub(crate) use controller::{EngineHooksController, PolledHook};
|
|||||||
|
|
||||||
mod prune;
|
mod prune;
|
||||||
pub use prune::PruneHook;
|
pub use prune::PruneHook;
|
||||||
use reth_interfaces::RethError;
|
|
||||||
|
|
||||||
/// Collection of [engine hooks][`EngineHook`].
|
/// Collection of [engine hooks][`EngineHook`].
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
@@ -17,6 +17,12 @@ pub struct EngineHooks {
|
|||||||
inner: Vec<Box<dyn EngineHook>>,
|
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 {
|
impl EngineHooks {
|
||||||
/// Creates a new empty collection of [engine hooks][`EngineHook`].
|
/// Creates a new empty collection of [engine hooks][`EngineHook`].
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ use reth_interfaces::RethError;
|
|||||||
use reth_primitives::BlockNumber;
|
use reth_primitives::BlockNumber;
|
||||||
use reth_prune::{Pruner, PrunerError, PrunerWithResult};
|
use reth_prune::{Pruner, PrunerError, PrunerWithResult};
|
||||||
use reth_tasks::TaskSpawner;
|
use reth_tasks::TaskSpawner;
|
||||||
use std::task::{ready, Context, Poll};
|
use std::{
|
||||||
|
fmt,
|
||||||
|
task::{ready, Context, Poll},
|
||||||
|
};
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
|
|
||||||
/// Manages pruning under the control of the engine.
|
/// Manages pruning under the control of the engine.
|
||||||
@@ -27,6 +30,15 @@ pub struct PruneHook<DB> {
|
|||||||
metrics: Metrics,
|
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> {
|
impl<DB: Database + 'static> PruneHook<DB> {
|
||||||
/// Create a new instance
|
/// Create a new instance
|
||||||
pub fn new(pruner: Pruner<DB>, pruner_task_spawner: Box<dyn TaskSpawner>) -> Self {
|
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
|
/// 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
|
/// blockchain tree any messages that would result in database writes, since it would result in a
|
||||||
/// deadlock.
|
/// deadlock.
|
||||||
|
#[derive(Debug)]
|
||||||
enum PrunerState<DB> {
|
enum PrunerState<DB> {
|
||||||
/// Pruner is idle.
|
/// Pruner is idle.
|
||||||
Idle(Option<Pruner<DB>>),
|
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.
|
/// If the future is polled more than once. Leads to undefined state.
|
||||||
#[must_use = "Future does nothing unless polled"]
|
#[must_use = "Future does nothing unless polled"]
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct BeaconConsensusEngine<DB, BT, Client>
|
pub struct BeaconConsensusEngine<DB, BT, Client>
|
||||||
where
|
where
|
||||||
DB: Database,
|
DB: Database,
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ type TestBeaconConsensusEngine<Client> = BeaconConsensusEngine<
|
|||||||
Arc<EitherDownloader<Client, NoopFullBlockClient>>,
|
Arc<EitherDownloader<Client, NoopFullBlockClient>>,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct TestEnv<DB> {
|
pub struct TestEnv<DB> {
|
||||||
pub db: DB,
|
pub db: DB,
|
||||||
// Keep the tip receiver around, so it's not dropped.
|
// 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
|
// 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
|
// would require similar patterns to how we use with_client and the EitherDownloader
|
||||||
/// Represents either a real consensus engine, or a test consensus engine.
|
/// Represents either a real consensus engine, or a test consensus engine.
|
||||||
#[derive(Default)]
|
#[derive(Debug, Default)]
|
||||||
enum TestConsensusConfig {
|
enum TestConsensusConfig {
|
||||||
/// Test consensus engine
|
/// Test consensus engine
|
||||||
#[default]
|
#[default]
|
||||||
@@ -126,6 +127,7 @@ enum TestConsensusConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Represents either test pipeline outputs, or real pipeline configuration.
|
/// Represents either test pipeline outputs, or real pipeline configuration.
|
||||||
|
#[derive(Debug)]
|
||||||
enum TestPipelineConfig {
|
enum TestPipelineConfig {
|
||||||
/// Test pipeline outputs.
|
/// Test pipeline outputs.
|
||||||
Test(VecDeque<Result<ExecOutput, StageError>>),
|
Test(VecDeque<Result<ExecOutput, StageError>>),
|
||||||
@@ -140,6 +142,7 @@ impl Default for TestPipelineConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Represents either test executor results, or real executor configuration.
|
/// Represents either test executor results, or real executor configuration.
|
||||||
|
#[derive(Debug)]
|
||||||
enum TestExecutorConfig {
|
enum TestExecutorConfig {
|
||||||
/// Test executor results.
|
/// Test executor results.
|
||||||
Test(Vec<BundleStateWithReceipts>),
|
Test(Vec<BundleStateWithReceipts>),
|
||||||
@@ -271,6 +274,7 @@ where
|
|||||||
|
|
||||||
/// The basic configuration for a `TestConsensusEngine`, without generics for the client or
|
/// The basic configuration for a `TestConsensusEngine`, without generics for the client or
|
||||||
/// consensus engine.
|
/// consensus engine.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct TestConsensusEngineBuilder {
|
pub struct TestConsensusEngineBuilder {
|
||||||
chain_spec: Arc<ChainSpec>,
|
chain_spec: Arc<ChainSpec>,
|
||||||
pipeline_config: TestPipelineConfig,
|
pipeline_config: TestPipelineConfig,
|
||||||
@@ -362,6 +366,7 @@ impl TestConsensusEngineBuilder {
|
|||||||
/// mocked executor results.
|
/// mocked executor results.
|
||||||
///
|
///
|
||||||
/// This optionally includes a client for network operations.
|
/// This optionally includes a client for network operations.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct NetworkedTestConsensusEngineBuilder<Client> {
|
pub struct NetworkedTestConsensusEngineBuilder<Client> {
|
||||||
base_config: TestConsensusEngineBuilder,
|
base_config: TestConsensusEngineBuilder,
|
||||||
client: Option<Client>,
|
client: Option<Client>,
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! Beacon consensus implementation.
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
//! Beacon consensus implementation.
|
|
||||||
|
|
||||||
mod beacon_consensus;
|
mod beacon_consensus;
|
||||||
pub use beacon_consensus::BeaconConsensus;
|
pub use beacon_consensus::BeaconConsensus;
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! Commonly used consensus methods.
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! Commonly used consensus methods.
|
|
||||||
|
|
||||||
/// Collection of consensus validation methods.
|
/// Collection of consensus validation methods.
|
||||||
pub mod validation;
|
pub mod validation;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ pub enum DatabaseError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Database write operation type
|
/// Database write operation type
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub enum DatabaseWriteOperation {
|
pub enum DatabaseWriteOperation {
|
||||||
CursorAppend,
|
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.
|
//! A collection of shared traits and error types used in Reth.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! - `test-utils`: Export utilities for testing
|
//! - `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.
|
/// Consensus traits.
|
||||||
pub mod consensus;
|
pub mod consensus;
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ impl EthResponseValidator for RequestResult<Vec<Header>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Error variants that can happen when sending requests to a session.
|
/// 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)]
|
#[allow(missing_docs)]
|
||||||
pub enum RequestError {
|
pub enum RequestError {
|
||||||
#[error("Closed channel to the peer.")]
|
#[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
|
/// NOTE: this assumes that bodies responses are returned by the client in the same order as the
|
||||||
/// hash array used to request them.
|
/// hash array used to request them.
|
||||||
#[must_use = "futures do nothing unless polled"]
|
#[must_use = "futures do nothing unless polled"]
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct FetchFullBlockRangeFuture<Client>
|
pub struct FetchFullBlockRangeFuture<Client>
|
||||||
where
|
where
|
||||||
Client: BodiesClient + HeadersClient,
|
Client: BodiesClient + HeadersClient,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ impl SyncState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A [NetworkSyncUpdater] implementation that does nothing.
|
/// A [NetworkSyncUpdater] implementation that does nothing.
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct NoopSyncStateUpdater;
|
pub struct NoopSyncStateUpdater;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! This crate provides [Metrics] derive macro
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! This crate provides [Metrics] derive macro
|
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use syn::{parse_macro_input, DeriveInput};
|
use syn::{parse_macro_input, DeriveInput};
|
||||||
|
|||||||
@@ -267,27 +267,27 @@ struct MeteredReceiverMetrics {
|
|||||||
messages_received: Counter,
|
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)]
|
#[derive(Debug)]
|
||||||
pub struct MeteredPollSender<T> {
|
pub struct MeteredPollSender<T> {
|
||||||
/// The [PollSender](PollSender) that this wraps around
|
/// The [PollSender] that this wraps around.
|
||||||
sender: PollSender<T>,
|
sender: PollSender<T>,
|
||||||
/// Holds metrics for this type
|
/// Holds metrics for this type.
|
||||||
metrics: MeteredPollSenderMetrics,
|
metrics: MeteredPollSenderMetrics,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Send + 'static> MeteredPollSender<T> {
|
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 {
|
pub fn new(sender: PollSender<T>, scope: &'static str) -> Self {
|
||||||
Self { sender, metrics: MeteredPollSenderMetrics::new(scope) }
|
Self { sender, metrics: MeteredPollSenderMetrics::new(scope) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the underlying [PollSender](PollSender).
|
/// Returns the underlying [PollSender].
|
||||||
pub fn inner(&self) -> &PollSender<T> {
|
pub fn inner(&self) -> &PollSender<T> {
|
||||||
&self.sender
|
&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.
|
/// metrics depending on the result.
|
||||||
pub fn poll_reserve(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), PollSendError<T>>> {
|
pub fn poll_reserve(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), PollSendError<T>>> {
|
||||||
match self.sender.poll_reserve(cx) {
|
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.
|
/// metrics depending on the result.
|
||||||
pub fn send_item(&mut self, item: T) -> Result<(), PollSendError<T>> {
|
pub fn send_item(&mut self, item: T) -> Result<(), PollSendError<T>> {
|
||||||
match self.sender.send_item(item) {
|
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.
|
//! Collection of metrics utilities.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
@@ -18,6 +5,15 @@
|
|||||||
//! - `common`: Common metrics utilities, such as wrappers around tokio senders and receivers. Pulls
|
//! - `common`: Common metrics utilities, such as wrappers around tokio senders and receivers. Pulls
|
||||||
//! in `tokio`.
|
//! 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.
|
/// Metrics derive macro.
|
||||||
pub use reth_metrics_derive::Metrics;
|
pub use reth_metrics_derive::Metrics;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! Shared types across `reth-net`.
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! Shared types across reth-net
|
|
||||||
|
|
||||||
pub mod ban_list;
|
pub mod ban_list;
|
||||||
pub mod bandwidth_meter;
|
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>
|
//! 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.
|
//! Discv4 employs a kademlia-like routing table to store and manage discovered peers and topics.
|
||||||
@@ -28,6 +15,16 @@
|
|||||||
//!
|
//!
|
||||||
//! - `serde` (default): Enable serde support
|
//! - `serde` (default): Enable serde support
|
||||||
//! - `test-utils`: Export utilities for testing
|
//! - `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::{
|
use crate::{
|
||||||
error::{DecodePacketError, Discv4Error},
|
error::{DecodePacketError, Discv4Error},
|
||||||
proto::{FindNode, Message, Neighbours, Packet, Ping, Pong},
|
proto::{FindNode, Message, Neighbours, Packet, Ping, Pong},
|
||||||
@@ -383,6 +380,7 @@ impl Discv4 {
|
|||||||
|
|
||||||
/// Manages discv4 peer discovery over UDP.
|
/// Manages discv4 peer discovery over UDP.
|
||||||
#[must_use = "Stream does nothing unless polled"]
|
#[must_use = "Stream does nothing unless polled"]
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct Discv4Service {
|
pub struct Discv4Service {
|
||||||
/// Local address of the UDP socket.
|
/// Local address of the UDP socket.
|
||||||
local_address: SocketAddr,
|
local_address: SocketAddr,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ use tokio_stream::{Stream, StreamExt};
|
|||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
/// Mock discovery node
|
/// Mock discovery node
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct MockDiscovery {
|
pub struct MockDiscovery {
|
||||||
local_addr: SocketAddr,
|
local_addr: SocketAddr,
|
||||||
local_enr: NodeRecord,
|
local_enr: NodeRecord,
|
||||||
@@ -190,12 +191,14 @@ impl Stream for MockDiscovery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The event type the mock service produces
|
/// The event type the mock service produces
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum MockEvent {
|
pub enum MockEvent {
|
||||||
Pong { ping: Ping, pong: Pong, to: SocketAddr },
|
Pong { ping: Ping, pong: Pong, to: SocketAddr },
|
||||||
Neighbours { nodes: Vec<NodeRecord>, to: SocketAddr },
|
Neighbours { nodes: Vec<NodeRecord>, to: SocketAddr },
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Command for interacting with the `MockDiscovery` service
|
/// Command for interacting with the `MockDiscovery` service
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum MockCommand {
|
pub enum MockCommand {
|
||||||
MockPong { node_id: PeerId },
|
MockPong { node_id: PeerId },
|
||||||
MockNeighbours { target: PeerId, nodes: Vec<NodeRecord> },
|
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.
|
//! Implementation of [EIP-1459](https://eips.ethereum.org/EIPS/eip-1459) Node Discovery via DNS.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! - `serde` (default): Enable serde support
|
//! - `serde` (default): Enable serde support
|
||||||
//! - `test-utils`: Export utilities for testing
|
//! - `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};
|
pub use crate::resolver::{DnsResolver, MapResolver, Resolver};
|
||||||
use crate::{
|
use crate::{
|
||||||
query::{QueryOutcome, QueryPool, ResolveEntryResult, ResolveRootResult},
|
query::{QueryOutcome, QueryPool, ResolveEntryResult, ResolveRootResult},
|
||||||
@@ -60,7 +57,7 @@ mod sync;
|
|||||||
pub mod tree;
|
pub mod tree;
|
||||||
|
|
||||||
/// [DnsDiscoveryService] front-end.
|
/// [DnsDiscoveryService] front-end.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct DnsDiscoveryHandle {
|
pub struct DnsDiscoveryHandle {
|
||||||
/// Channel for sending commands to the service.
|
/// Channel for sending commands to the service.
|
||||||
to_service: UnboundedSender<DnsDiscoveryCommand>,
|
to_service: UnboundedSender<DnsDiscoveryCommand>,
|
||||||
@@ -93,6 +90,7 @@ impl DnsDiscoveryHandle {
|
|||||||
|
|
||||||
/// A client that discovers nodes via DNS.
|
/// A client that discovers nodes via DNS.
|
||||||
#[must_use = "Service does nothing unless polled"]
|
#[must_use = "Service does nothing unless polled"]
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct DnsDiscoveryService<R: Resolver = DnsResolver> {
|
pub struct DnsDiscoveryService<R: Resolver = DnsResolver> {
|
||||||
/// Copy of the sender half, so new [`DnsDiscoveryHandle`] can be created on demand.
|
/// Copy of the sender half, so new [`DnsDiscoveryHandle`] can be created on demand.
|
||||||
command_tx: UnboundedSender<DnsDiscoveryCommand>,
|
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
|
/// Note: This [Resolver] can send multiple lookup attempts, See also
|
||||||
/// [ResolverOpts](trust_dns_resolver::config::ResolverOpts) which configures 2 attempts (1 retry)
|
/// [ResolverOpts](trust_dns_resolver::config::ResolverOpts) which configures 2 attempts (1 retry)
|
||||||
/// by default.
|
/// by default.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct DnsResolver(TokioAsyncResolver);
|
pub struct DnsResolver(TokioAsyncResolver);
|
||||||
|
|
||||||
// === impl DnsResolver ===
|
// === 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 batches of headers that this downloader yields will start at the chain tip and move towards
|
||||||
/// the local head: falling block numbers.
|
/// the local head: falling block numbers.
|
||||||
#[must_use = "Stream does nothing unless polled"]
|
#[must_use = "Stream does nothing unless polled"]
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct ReverseHeadersDownloader<H: HeadersClient> {
|
pub struct ReverseHeadersDownloader<H: HeadersClient> {
|
||||||
/// Consensus client used to validate headers
|
/// Consensus client used to validate headers
|
||||||
consensus: Arc<dyn Consensus>,
|
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.
|
//! Implements the downloader algorithms.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! - `test-utils`: Export utilities for testing
|
//! - `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.
|
/// The collection of algorithms for downloading block bodies.
|
||||||
pub mod bodies;
|
pub mod bodies;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! RLPx ECIES framed transport protocol.
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! RLPx ECIES framed transport protocol.
|
|
||||||
|
|
||||||
pub mod algorithm;
|
pub mod algorithm;
|
||||||
pub mod mac;
|
pub mod mac;
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ impl StatusBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Builder for [`HelloMessage`] messages.
|
/// Builder for [`HelloMessage`] messages.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct HelloBuilder {
|
pub struct HelloBuilder {
|
||||||
hello: HelloMessage,
|
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
|
/// An un-authenticated [`EthStream`]. This is consumed and returns a [`EthStream`] after the
|
||||||
/// `Status` handshake is completed.
|
/// `Status` handshake is completed.
|
||||||
#[pin_project]
|
#[pin_project]
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct UnauthedEthStream<S> {
|
pub struct UnauthedEthStream<S> {
|
||||||
#[pin]
|
#[pin]
|
||||||
inner: S,
|
inner: S,
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ impl HelloMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct HelloMessageBuilder {
|
pub struct HelloMessageBuilder {
|
||||||
/// The version of the `p2p` protocol.
|
/// The version of the `p2p` protocol.
|
||||||
pub protocol_version: Option<ProtocolVersion>,
|
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.
|
//! Implementation of the `eth` wire protocol.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
@@ -17,6 +5,15 @@
|
|||||||
//! - `serde` (default): Enable serde support
|
//! - `serde` (default): Enable serde support
|
||||||
//! - `arbitrary`: Adds `proptest` and `arbitrary` support for wire types.
|
//! - `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 builder;
|
||||||
pub mod capability;
|
pub mod capability;
|
||||||
mod disconnect;
|
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
|
/// An un-authenticated [`P2PStream`]. This is consumed and returns a [`P2PStream`] after the
|
||||||
/// `Hello` handshake is completed.
|
/// `Hello` handshake is completed.
|
||||||
#[pin_project]
|
#[pin_project]
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct UnauthedP2PStream<S> {
|
pub struct UnauthedP2PStream<S> {
|
||||||
#[pin]
|
#[pin]
|
||||||
inner: S,
|
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.
|
//! Helpers for resolving the external IP.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! - `serde` (default): Enable serde support
|
//! - `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 igd::aio::search_gateway;
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
use std::{
|
use std::{
|
||||||
@@ -114,6 +110,16 @@ pub struct ResolveNatInterval {
|
|||||||
|
|
||||||
// === impl 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 {
|
impl ResolveNatInterval {
|
||||||
fn with_interval(resolver: NatResolver, interval: tokio::time::Interval) -> Self {
|
fn with_interval(resolver: NatResolver, interval: tokio::time::Interval) -> Self {
|
||||||
Self { resolver, future: None, interval }
|
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.
|
//! Reth network interface definitions.
|
||||||
//!
|
//!
|
||||||
//! Provides abstractions for the reth-network crate.
|
//! Provides abstractions for the reth-network crate.
|
||||||
@@ -18,6 +5,16 @@
|
|||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! - `serde` (default): Enable serde support
|
//! - `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 async_trait::async_trait;
|
||||||
use reth_eth_wire::{DisconnectReason, EthVersion, Status};
|
use reth_eth_wire::{DisconnectReason, EthVersion, Status};
|
||||||
use reth_primitives::{NodeRecord, PeerId};
|
use reth_primitives::{NodeRecord, PeerId};
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use tokio::sync::mpsc;
|
|||||||
pub(crate) const ETH_REQUEST_CHANNEL_CAPACITY: usize = 256;
|
pub(crate) const ETH_REQUEST_CHANNEL_CAPACITY: usize = 256;
|
||||||
|
|
||||||
/// A builder that can configure all components of the network.
|
/// A builder that can configure all components of the network.
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct NetworkBuilder<C, Tx, Eth> {
|
pub struct NetworkBuilder<C, Tx, Eth> {
|
||||||
pub(crate) network: NetworkManager<C>,
|
pub(crate) network: NetworkManager<C>,
|
||||||
pub(crate) transactions: Tx,
|
pub(crate) transactions: Tx,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ pub fn rng_secret_key() -> SecretKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All network related initialization settings.
|
/// All network related initialization settings.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct NetworkConfig<C> {
|
pub struct NetworkConfig<C> {
|
||||||
/// The client type that can interact with the chain.
|
/// 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.
|
/// An abstraction over the configured discovery protocol.
|
||||||
///
|
///
|
||||||
/// Listens for new discovered nodes and emits events for discovered nodes and their
|
/// Listens for new discovered nodes and emits events for discovered nodes and their
|
||||||
/// address.#[derive(Debug, Clone)]
|
/// address.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Discovery {
|
pub struct Discovery {
|
||||||
/// All nodes discovered via discovery protocol.
|
/// 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.
|
/// 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.
|
/// 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."]
|
#[must_use = "Manager does nothing unless polled."]
|
||||||
pub struct EthRequestHandler<C> {
|
pub struct EthRequestHandler<C> {
|
||||||
/// The client type that can interact with the chain.
|
/// The client type that can interact with the chain.
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ pub use client::FetchClient;
|
|||||||
/// peers and sends the response once ready.
|
/// peers and sends the response once ready.
|
||||||
///
|
///
|
||||||
/// This type maintains a list of connected peers that are available for requests.
|
/// This type maintains a list of connected peers that are available for requests.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct StateFetcher {
|
pub struct StateFetcher {
|
||||||
/// Currently active [`GetBlockHeaders`] requests
|
/// Currently active [`GetBlockHeaders`] requests
|
||||||
inflight_headers_requests:
|
inflight_headers_requests:
|
||||||
@@ -296,6 +297,7 @@ enum PollAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a connected peer
|
/// Represents a connected peer
|
||||||
|
#[derive(Debug)]
|
||||||
struct Peer {
|
struct Peer {
|
||||||
/// The state this peer currently resides in.
|
/// The state this peer currently resides in.
|
||||||
state: PeerState,
|
state: PeerState,
|
||||||
@@ -314,6 +316,7 @@ impl Peer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Tracks the state of an individual peer
|
/// Tracks the state of an individual peer
|
||||||
|
#[derive(Debug)]
|
||||||
enum PeerState {
|
enum PeerState {
|
||||||
/// Peer is currently not handling requests and is available.
|
/// Peer is currently not handling requests and is available.
|
||||||
Idle,
|
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
|
/// A request that waits for a response from the network, so it can send it back through the
|
||||||
/// response channel.
|
/// response channel.
|
||||||
|
#[derive(Debug)]
|
||||||
struct Request<Req, Resp> {
|
struct Request<Req, Resp> {
|
||||||
/// The issued request object
|
/// The issued request object
|
||||||
/// TODO: this can be attached to the response in error case
|
/// 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`]
|
/// Requests that can be sent to the Syncer from a [`FetchClient`]
|
||||||
|
#[derive(Debug)]
|
||||||
pub(crate) enum DownloadRequest {
|
pub(crate) enum DownloadRequest {
|
||||||
/// Download the requested headers and send response through channel
|
/// Download the requested headers and send response through channel
|
||||||
GetBlockHeaders {
|
GetBlockHeaders {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use reth_primitives::PeerId;
|
|||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
/// Abstraction over block import.
|
/// 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.
|
/// Invoked for a received `NewBlock` broadcast message from the peer.
|
||||||
///
|
///
|
||||||
/// > When a `NewBlock` announcement message is received from a peer, the client first verifies
|
/// > 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.
|
/// Outcome of the [`BlockImport`]'s block handling.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct BlockImportOutcome {
|
pub struct BlockImportOutcome {
|
||||||
/// Sender of the `NewBlock` message.
|
/// Sender of the `NewBlock` message.
|
||||||
pub peer: PeerId,
|
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.
|
//! reth P2P networking.
|
||||||
//!
|
//!
|
||||||
//! Ethereum's networking protocol is specified in [devp2p](https://github.com/ethereum/devp2p).
|
//! 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
|
//! - `test-utils`: Various utilities helpful for writing tests
|
||||||
//! - `geth-tests`: Runs tests that require Geth to be installed locally.
|
//! - `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"))]
|
#[cfg(any(test, feature = "test-utils"))]
|
||||||
/// Common helpers for network testing.
|
/// Common helpers for network testing.
|
||||||
pub mod test_utils;
|
pub mod test_utils;
|
||||||
@@ -145,7 +140,7 @@ pub mod transactions;
|
|||||||
|
|
||||||
pub use builder::NetworkBuilder;
|
pub use builder::NetworkBuilder;
|
||||||
pub use config::{NetworkConfig, NetworkConfigBuilder};
|
pub use config::{NetworkConfig, NetworkConfigBuilder};
|
||||||
pub use discovery::Discovery;
|
pub use discovery::{Discovery, DiscoveryEvent};
|
||||||
pub use fetch::FetchClient;
|
pub use fetch::FetchClient;
|
||||||
pub use manager::{NetworkEvent, NetworkManager};
|
pub use manager::{NetworkEvent, NetworkManager};
|
||||||
pub use message::PeerRequest;
|
pub use message::PeerRequest;
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ use tracing::{debug, error, trace, warn};
|
|||||||
/// ethrequest <--> |ETH request handing| NetworkManager
|
/// ethrequest <--> |ETH request handing| NetworkManager
|
||||||
/// discovery --> |Discovered peers| NetworkManager
|
/// discovery --> |Discovered peers| NetworkManager
|
||||||
/// ```
|
/// ```
|
||||||
|
#[derive(Debug)]
|
||||||
#[must_use = "The NetworkManager does nothing unless polled"]
|
#[must_use = "The NetworkManager does nothing unless polled"]
|
||||||
pub struct NetworkManager<C> {
|
pub struct NetworkManager<C> {
|
||||||
/// The type that manages the actual network part, which includes connections.
|
/// 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 {
|
pub fn bandwidth_meter(&self) -> &BandwidthMeter {
|
||||||
&self.inner.bandwidth_meter
|
&self.inner.bandwidth_meter
|
||||||
}
|
}
|
||||||
@@ -321,6 +321,7 @@ struct NetworkInner {
|
|||||||
|
|
||||||
/// Internal messages that can be passed to the [`NetworkManager`](crate::NetworkManager).
|
/// Internal messages that can be passed to the [`NetworkManager`](crate::NetworkManager).
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
|
#[derive(Debug)]
|
||||||
pub(crate) enum NetworkHandleMessage {
|
pub(crate) enum NetworkHandleMessage {
|
||||||
/// Adds an address for a peer.
|
/// Adds an address for a peer.
|
||||||
AddPeerAddress(PeerId, PeerKind, SocketAddr),
|
AddPeerAddress(PeerId, PeerKind, SocketAddr),
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ impl PeersHandle {
|
|||||||
/// From this type, connections to peers are established or disconnected, see [`PeerAction`].
|
/// From this type, connections to peers are established or disconnected, see [`PeerAction`].
|
||||||
///
|
///
|
||||||
/// The [`PeersManager`] will be notified on peer related changes
|
/// The [`PeersManager`] will be notified on peer related changes
|
||||||
pub(crate) struct PeersManager {
|
#[derive(Debug)]
|
||||||
|
pub struct PeersManager {
|
||||||
/// All peers known to the network
|
/// All peers known to the network
|
||||||
peers: HashMap<PeerId, Peer>,
|
peers: HashMap<PeerId, Peer>,
|
||||||
/// Copy of the sender half, so new [`PeersHandle`] can be created on demand.
|
/// Copy of the sender half, so new [`PeersHandle`] can be created on demand.
|
||||||
@@ -117,7 +118,7 @@ pub(crate) struct PeersManager {
|
|||||||
|
|
||||||
impl PeersManager {
|
impl PeersManager {
|
||||||
/// Create a new instance with the given config
|
/// Create a new instance with the given config
|
||||||
pub(crate) fn new(config: PeersConfig) -> Self {
|
pub fn new(config: PeersConfig) -> Self {
|
||||||
let PeersConfig {
|
let PeersConfig {
|
||||||
refill_slots_interval,
|
refill_slots_interval,
|
||||||
connection_info,
|
connection_info,
|
||||||
@@ -1020,6 +1021,7 @@ impl PeerConnectionState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Commands the [`PeersManager`] listens for.
|
/// Commands the [`PeersManager`] listens for.
|
||||||
|
#[derive(Debug)]
|
||||||
pub(crate) enum PeerCommand {
|
pub(crate) enum PeerCommand {
|
||||||
/// Command for manually add
|
/// Command for manually add
|
||||||
Add(PeerId, SocketAddr),
|
Add(PeerId, SocketAddr),
|
||||||
@@ -1046,28 +1048,47 @@ pub enum PeerAction {
|
|||||||
remote_addr: SocketAddr,
|
remote_addr: SocketAddr,
|
||||||
},
|
},
|
||||||
/// Disconnect an existing connection.
|
/// 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
|
/// Disconnect an existing incoming connection, because the peers reputation is below the
|
||||||
/// banned threshold or is on the [`BanList`]
|
/// banned threshold or is on the [`BanList`]
|
||||||
DisconnectBannedIncoming {
|
DisconnectBannedIncoming {
|
||||||
/// Peer id of the established connection.
|
/// The peer ID of the established connection.
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
},
|
},
|
||||||
/// Ban the peer in discovery.
|
/// 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.
|
/// Ban the IP in discovery.
|
||||||
DiscoveryBanIp { ip_addr: IpAddr },
|
DiscoveryBanIp {
|
||||||
|
/// The IP address.
|
||||||
|
ip_addr: IpAddr,
|
||||||
|
},
|
||||||
/// Ban the peer temporarily
|
/// Ban the peer temporarily
|
||||||
BanPeer { peer_id: PeerId },
|
BanPeer {
|
||||||
|
/// The peer ID.
|
||||||
|
peer_id: PeerId,
|
||||||
|
},
|
||||||
/// Unban the peer temporarily
|
/// Unban the peer temporarily
|
||||||
UnBanPeer { peer_id: PeerId },
|
UnBanPeer {
|
||||||
|
/// The peer ID.
|
||||||
|
peer_id: PeerId,
|
||||||
|
},
|
||||||
/// Emit peerAdded event
|
/// Emit peerAdded event
|
||||||
PeerAdded(PeerId),
|
PeerAdded(PeerId),
|
||||||
/// Emit peerRemoved event
|
/// Emit peerRemoved event
|
||||||
PeerRemoved(PeerId),
|
PeerRemoved(PeerId),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Config type for initiating a [`PeersManager`] instance
|
/// Config type for initiating a [`PeersManager`] instance.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(default))]
|
#[cfg_attr(feature = "serde", serde(default))]
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
mod manager;
|
mod manager;
|
||||||
mod reputation;
|
mod reputation;
|
||||||
|
|
||||||
pub(crate) use manager::{InboundConnectionError, PeerAction, PeersManager};
|
pub(crate) use manager::InboundConnectionError;
|
||||||
pub use manager::{Peer, PeersConfig, PeersHandle};
|
pub use manager::{Peer, PeerAction, PeersConfig, PeersHandle, PeersManager};
|
||||||
pub use reputation::ReputationChangeWeights;
|
pub use reputation::ReputationChangeWeights;
|
||||||
pub use reth_network_api::PeerKind;
|
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.
|
/// then send to the session of the peer.
|
||||||
///
|
///
|
||||||
/// This type is also responsible for responding for received request.
|
/// This type is also responsible for responding for received request.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct NetworkState<C> {
|
pub struct NetworkState<C> {
|
||||||
/// All active peers and their state.
|
/// All active peers and their state.
|
||||||
active_peers: HashMap<PeerId, ActivePeer>,
|
active_peers: HashMap<PeerId, ActivePeer>,
|
||||||
@@ -465,6 +466,7 @@ where
|
|||||||
/// Tracks the state of a Peer with an active Session.
|
/// Tracks the state of a Peer with an active Session.
|
||||||
///
|
///
|
||||||
/// For example known blocks,so we can decide what to announce.
|
/// For example known blocks,so we can decide what to announce.
|
||||||
|
#[derive(Debug)]
|
||||||
pub(crate) struct ActivePeer {
|
pub(crate) struct ActivePeer {
|
||||||
/// Best block of the peer.
|
/// Best block of the peer.
|
||||||
pub(crate) best_hash: H256,
|
pub(crate) best_hash: H256,
|
||||||
@@ -480,6 +482,7 @@ pub(crate) struct ActivePeer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Message variants triggered by the [`NetworkState`]
|
/// Message variants triggered by the [`NetworkState`]
|
||||||
|
#[derive(Debug)]
|
||||||
pub(crate) enum StateAction {
|
pub(crate) enum StateAction {
|
||||||
/// Dispatch a `NewBlock` message to the peer
|
/// Dispatch a `NewBlock` message to the peer
|
||||||
NewBlock {
|
NewBlock {
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ use tracing::{debug, trace};
|
|||||||
/// fetchRequest --> |request Headers, Bodies| StateFetch
|
/// fetchRequest --> |request Headers, Bodies| StateFetch
|
||||||
/// State --> |poll pending requests| StateFetch
|
/// State --> |poll pending requests| StateFetch
|
||||||
/// ```
|
/// ```
|
||||||
|
#[derive(Debug)]
|
||||||
#[must_use = "Swarm does nothing unless polled"]
|
#[must_use = "Swarm does nothing unless polled"]
|
||||||
pub(crate) struct Swarm<C> {
|
pub(crate) struct Swarm<C> {
|
||||||
/// Listens for new incoming connections.
|
/// 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,
|
/// Represents the state of the connection of the node. If shutting down,
|
||||||
/// new connections won't be established.
|
/// new connections won't be established.
|
||||||
#[derive(Default)]
|
#[derive(Debug, Default)]
|
||||||
pub(crate) enum NetworkConnectionState {
|
pub(crate) enum NetworkConnectionState {
|
||||||
#[default]
|
#[default]
|
||||||
Active,
|
Active,
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![warn(missing_docs, unreachable_pub)]
|
|
||||||
|
|
||||||
//! Common helpers for network testing.
|
//! Common helpers for network testing.
|
||||||
|
|
||||||
mod init;
|
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,
|
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,
|
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.
|
/// A handle to a [`Testnet`] that can be shared.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct TestnetHandle<C> {
|
pub struct TestnetHandle<C> {
|
||||||
_handle: JoinHandle<()>,
|
_handle: JoinHandle<()>,
|
||||||
terminate: oneshot::Sender<oneshot::Sender<Testnet<C>>>,
|
terminate: oneshot::Sender<oneshot::Sender<Testnet<C>>>,
|
||||||
@@ -203,7 +204,9 @@ impl<C> TestnetHandle<C> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A peer in the [`Testnet`].
|
||||||
#[pin_project]
|
#[pin_project]
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Peer<C> {
|
pub struct Peer<C> {
|
||||||
#[pin]
|
#[pin]
|
||||||
network: NetworkManager<C>,
|
network: NetworkManager<C>,
|
||||||
@@ -262,6 +265,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A helper config for setting up the reth networking stack.
|
/// A helper config for setting up the reth networking stack.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct PeerConfig<C = NoopProvider> {
|
pub struct PeerConfig<C = NoopProvider> {
|
||||||
config: NetworkConfig<C>,
|
config: NetworkConfig<C>,
|
||||||
client: C,
|
client: C,
|
||||||
@@ -327,6 +331,7 @@ impl Default for PeerConfig {
|
|||||||
/// A helper type to await network events
|
/// A helper type to await network events
|
||||||
///
|
///
|
||||||
/// This makes it easier to await established connections
|
/// This makes it easier to await established connections
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct NetworkEventStream {
|
pub struct NetworkEventStream {
|
||||||
inner: UnboundedReceiverStream<NetworkEvent>,
|
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>>;
|
pub type PoolImportFuture = Pin<Box<dyn Future<Output = PoolResult<TxHash>> + Send + 'static>>;
|
||||||
|
|
||||||
/// Api to interact with [`TransactionsManager`] task.
|
/// Api to interact with [`TransactionsManager`] task.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct TransactionsHandle {
|
pub struct TransactionsHandle {
|
||||||
/// Command channel to the [`TransactionsManager`]
|
/// Command channel to the [`TransactionsManager`]
|
||||||
manager_tx: mpsc::UnboundedSender<TransactionsCommand>,
|
manager_tx: mpsc::UnboundedSender<TransactionsCommand>,
|
||||||
@@ -117,6 +118,7 @@ impl TransactionsHandle {
|
|||||||
///
|
///
|
||||||
/// It is directly connected to the [`TransactionPool`] to retrieve requested transactions and
|
/// It is directly connected to the [`TransactionPool`] to retrieve requested transactions and
|
||||||
/// propagate new transactions over the network.
|
/// propagate new transactions over the network.
|
||||||
|
#[derive(Debug)]
|
||||||
#[must_use = "Manager does nothing unless polled."]
|
#[must_use = "Manager does nothing unless polled."]
|
||||||
pub struct TransactionsManager<Pool> {
|
pub struct TransactionsManager<Pool> {
|
||||||
/// Access to the transaction pool.
|
/// Access to the transaction pool.
|
||||||
@@ -844,6 +846,7 @@ impl Future for GetPooledTxRequestFut {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Tracks a single peer
|
/// Tracks a single peer
|
||||||
|
#[derive(Debug)]
|
||||||
struct Peer {
|
struct Peer {
|
||||||
/// Keeps track of transactions that we know the peer has seen.
|
/// Keeps track of transactions that we know the peer has seen.
|
||||||
transactions: LruCache<H256>,
|
transactions: LruCache<H256>,
|
||||||
@@ -857,6 +860,7 @@ struct Peer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Commands to send to the [`TransactionsManager`]
|
/// Commands to send to the [`TransactionsManager`]
|
||||||
|
#[derive(Debug)]
|
||||||
enum TransactionsCommand {
|
enum TransactionsCommand {
|
||||||
/// Propagate a transaction hash to the network.
|
/// Propagate a transaction hash to the network.
|
||||||
PropagateHash(H256),
|
PropagateHash(H256),
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! A basic payload generator for reth.
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! A basic payload generator for reth.
|
|
||||||
|
|
||||||
use crate::metrics::PayloadBuilderMetrics;
|
use crate::metrics::PayloadBuilderMetrics;
|
||||||
use futures_core::ready;
|
use futures_core::ready;
|
||||||
@@ -63,6 +59,7 @@ use tracing::{debug, trace};
|
|||||||
mod metrics;
|
mod metrics;
|
||||||
|
|
||||||
/// The [`PayloadJobGenerator`] that creates [`BasicPayloadJob`]s.
|
/// The [`PayloadJobGenerator`] that creates [`BasicPayloadJob`]s.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct BasicPayloadJobGenerator<Client, Pool, Tasks, Builder = ()> {
|
pub struct BasicPayloadJobGenerator<Client, Pool, Tasks, Builder = ()> {
|
||||||
/// The client that can interact with the chain.
|
/// The client that can interact with the chain.
|
||||||
client: Client,
|
client: Client,
|
||||||
@@ -185,7 +182,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Restricts how many generator tasks can be executed at once.
|
/// Restricts how many generator tasks can be executed at once.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct PayloadTaskGuard(Arc<Semaphore>);
|
struct PayloadTaskGuard(Arc<Semaphore>);
|
||||||
|
|
||||||
// === impl PayloadTaskGuard ===
|
// === 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.
|
/// 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> {
|
pub struct BasicPayloadJob<Client, Pool, Tasks, Builder> {
|
||||||
/// The configuration for how the payload will be created.
|
/// The configuration for how the payload will be created.
|
||||||
config: PayloadConfig,
|
config: PayloadConfig,
|
||||||
@@ -534,7 +532,7 @@ impl Drop for Cancelled {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Static config for how to build a payload.
|
/// Static config for how to build a payload.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
struct PayloadConfig {
|
struct PayloadConfig {
|
||||||
/// Pre-configured block environment.
|
/// Pre-configured block environment.
|
||||||
initialized_block_env: BlockEnv,
|
initialized_block_env: BlockEnv,
|
||||||
@@ -576,6 +574,7 @@ pub enum BuildOutcome {
|
|||||||
/// This struct encapsulates the essential components and configuration required for the payload
|
/// 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,
|
/// building process. It holds references to the Ethereum client, transaction pool, cached reads,
|
||||||
/// payload configuration, cancellation status, and the best payload achieved so far.
|
/// payload configuration, cancellation status, and the best payload achieved so far.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct BuildArguments<Pool, Client> {
|
pub struct BuildArguments<Pool, Client> {
|
||||||
client: Client,
|
client: Client,
|
||||||
pool: Pool,
|
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):
|
//! This crate defines abstractions to create and update payloads (blocks):
|
||||||
//! - [`PayloadJobGenerator`]: a type that knows how to create new jobs for creating payloads based
|
//! - [`PayloadJobGenerator`]: a type that knows how to create new jobs for creating payloads based
|
||||||
//! on [`PayloadAttributes`](reth_rpc_types::engine::PayloadAttributes).
|
//! on [`PayloadAttributes`](reth_rpc_types::engine::PayloadAttributes).
|
||||||
@@ -110,6 +92,15 @@
|
|||||||
//!
|
//!
|
||||||
//! - `test-utils`: Export utilities for testing
|
//! - `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 database;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
mod metrics;
|
mod metrics;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use crate::{
|
|||||||
use futures_util::{future::FutureExt, StreamExt};
|
use futures_util::{future::FutureExt, StreamExt};
|
||||||
use reth_rpc_types::engine::PayloadId;
|
use reth_rpc_types::engine::PayloadId;
|
||||||
use std::{
|
use std::{
|
||||||
|
fmt,
|
||||||
future::Future,
|
future::Future,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
@@ -150,6 +151,7 @@ impl PayloadBuilderHandle {
|
|||||||
///
|
///
|
||||||
/// By design, this type relies entirely on the [`PayloadJobGenerator`] to create new payloads and
|
/// 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.
|
/// 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"]
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct PayloadBuilderService<Gen>
|
pub struct PayloadBuilderService<Gen>
|
||||||
where
|
where
|
||||||
@@ -331,3 +333,20 @@ enum PayloadServiceCommand {
|
|||||||
/// Resolve the payload and return the payload
|
/// Resolve the payload and return the payload
|
||||||
Resolve(PayloadId, oneshot::Sender<Option<PayloadFuture>>),
|
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.
|
//! Commonly used types in reth.
|
||||||
//!
|
//!
|
||||||
//! This crate contains Ethereum primitive types and helper functions.
|
//! This crate contains Ethereum primitive types and helper functions.
|
||||||
@@ -20,6 +6,17 @@
|
|||||||
//!
|
//!
|
||||||
//! - `arbitrary`: Adds `proptest` and `arbitrary` support for primitive types.
|
//! - `arbitrary`: Adds `proptest` and `arbitrary` support for primitive types.
|
||||||
//! - `test-utils`: Export utilities for testing
|
//! - `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;
|
pub mod abi;
|
||||||
mod account;
|
mod account;
|
||||||
pub mod basefee;
|
pub mod basefee;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ pub const EMPTY_ROOT: H256 =
|
|||||||
|
|
||||||
/// A [Hasher] that calculates a keccak256 hash of the given data.
|
/// A [Hasher] that calculates a keccak256 hash of the given data.
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Clone, PartialEq, Eq)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct KeccakHasher;
|
pub struct KeccakHasher;
|
||||||
|
|
||||||
impl Hasher for 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 error;
|
||||||
mod metrics;
|
mod metrics;
|
||||||
mod pruner;
|
mod pruner;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ pub type PrunerResult = Result<bool, PrunerError>;
|
|||||||
pub type PrunerWithResult<DB> = (Pruner<DB>, PrunerResult);
|
pub type PrunerWithResult<DB> = (Pruner<DB>, PrunerResult);
|
||||||
|
|
||||||
/// Pruning routine. Main pruning logic happens in [Pruner::run].
|
/// Pruning routine. Main pruning logic happens in [Pruner::run].
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Pruner<DB> {
|
pub struct Pruner<DB> {
|
||||||
metrics: Metrics,
|
metrics: Metrics,
|
||||||
provider_factory: ProviderFactory<DB>,
|
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
|
//! revm [Inspector](revm::Inspector) implementations, such as call tracers
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
@@ -18,6 +5,15 @@
|
|||||||
//! - `js-tracer` (default): Enables a JavaScript tracer implementation. This pulls in extra
|
//! - `js-tracer` (default): Enables a JavaScript tracer implementation. This pulls in extra
|
||||||
//! dependencies (such as `boa`, `tokio` and `serde_json`).
|
//! 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
|
/// An inspector implementation for an EIP2930 Accesslist
|
||||||
pub mod access_list;
|
pub mod access_list;
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ impl InspectorStack {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
/// Configuration for the inspectors.
|
/// Configuration for the inspectors.
|
||||||
|
#[derive(Debug, Default)]
|
||||||
pub struct InspectorStackConfig {
|
pub struct InspectorStackConfig {
|
||||||
/// Enable revm inspector printer.
|
/// Enable revm inspector printer.
|
||||||
/// In execution this will print opcode level traces directly to console.
|
/// 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(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! revm utils and implementations specific to reth.
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
|
|
||||||
/// Helpers for configuring revm [Env](revm::primitives::Env)
|
/// 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(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! revm utils and implementations specific to reth.
|
|
||||||
|
|
||||||
/// Contains glue code for integrating reth database into revm's [Database].
|
/// Contains glue code for integrating reth database into revm's [Database].
|
||||||
pub mod database;
|
pub mod database;
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ use tracing::{debug, trace};
|
|||||||
///
|
///
|
||||||
/// InspectorStack are used for optional inspecting execution. And it contains
|
/// InspectorStack are used for optional inspecting execution. And it contains
|
||||||
/// various duration of parts of execution.
|
/// various duration of parts of execution.
|
||||||
|
// TODO: https://github.com/bluealloy/revm/pull/745
|
||||||
|
// #[derive(Debug)]
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct EVMProcessor<'a> {
|
pub struct EVMProcessor<'a> {
|
||||||
/// The configured chain-spec
|
/// The configured chain-spec
|
||||||
chain_spec: Arc<ChainSpec>,
|
chain_spec: Arc<ChainSpec>,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, unused_crate_dependencies)]
|
||||||
#![doc(test(
|
#![doc(test(
|
||||||
no_crate_inject,
|
no_crate_inject,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
||||||
)]
|
)]
|
||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub, rustdoc::all)]
|
||||||
#![deny(unused_must_use)]
|
#![deny(unused_must_use)]
|
||||||
#![doc(test(
|
#![doc(test(
|
||||||
no_crate_inject,
|
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)]
|
#[derive(Debug, Clone, Default)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct IpcTransportClientBuilder;
|
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
|
//! Reth IPC transport implementation
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! - `client`: Enables JSON-RPC client support.
|
//! - `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)]
|
#[cfg(unix)]
|
||||||
pub mod client;
|
pub mod client;
|
||||||
pub mod server;
|
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
|
//! Reth RPC interface definitions
|
||||||
//!
|
//!
|
||||||
//! Provides all RPC interfaces.
|
//! Provides all RPC interfaces.
|
||||||
@@ -19,6 +6,15 @@
|
|||||||
//!
|
//!
|
||||||
//! - `client`: Enables JSON-RPC client support.
|
//! - `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 admin;
|
||||||
mod debug;
|
mod debug;
|
||||||
mod engine;
|
mod engine;
|
||||||
|
|||||||
@@ -1,17 +1,4 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! Configure reth RPC.
|
||||||
#![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
|
|
||||||
//!
|
//!
|
||||||
//! This crate contains several builder and config types that allow to configure the selection of
|
//! This crate contains several builder and config types that allow to configure the selection of
|
||||||
//! [RethRpcModule] specific to transports (ws, http, ipc).
|
//! [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 crate::{auth::AuthRpcModule, error::WsHttpSamePortError, metrics::RpcServerMetrics};
|
||||||
use constants::*;
|
use constants::*;
|
||||||
use error::{RpcError, ServerKind};
|
use error::{RpcError, ServerKind};
|
||||||
@@ -434,7 +430,7 @@ impl RpcModuleConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Configures [RpcModuleConfig]
|
/// Configures [RpcModuleConfig]
|
||||||
#[derive(Default)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct RpcModuleConfigBuilder {
|
pub struct RpcModuleConfigBuilder {
|
||||||
eth: Option<EthConfig>,
|
eth: Option<EthConfig>,
|
||||||
}
|
}
|
||||||
@@ -708,6 +704,7 @@ impl Serialize for RethRpcModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A Helper type the holds instances of the configured modules.
|
/// A Helper type the holds instances of the configured modules.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct RethModuleRegistry<Provider, Pool, Network, Tasks, Events> {
|
pub struct RethModuleRegistry<Provider, Pool, Network, Tasks, Events> {
|
||||||
provider: Provider,
|
provider: Provider,
|
||||||
pool: Pool,
|
pool: Pool,
|
||||||
|
|||||||
@@ -705,6 +705,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Handler for `engine_getPayloadBodiesByRangeV1`
|
/// Handler for `engine_getPayloadBodiesByRangeV1`
|
||||||
|
///
|
||||||
/// See also <https://github.com/ethereum/execution-apis/blob/6452a6b194d7db269bf1dbd087a267251d3cc7f8/src/engine/shanghai.md#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`
|
/// 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
|
/// ensuring that the range is limited properly, and that the range boundaries are computed
|
||||||
/// correctly and without panics.
|
/// 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(
|
async fn get_payload_bodies_by_range_v1(
|
||||||
&self,
|
&self,
|
||||||
start: U64,
|
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(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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, unused_crate_dependencies)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
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).
|
|
||||||
|
|
||||||
/// The Engine API implementation.
|
/// The Engine API implementation.
|
||||||
mod engine_api;
|
mod engine_api;
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! Reth RPC testing utilities.
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
//! Reth RPC testing utilities.
|
|
||||||
|
|
||||||
pub mod debug;
|
pub mod debug;
|
||||||
pub mod trace;
|
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(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
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.
|
|
||||||
|
|
||||||
pub mod block;
|
pub mod block;
|
||||||
pub use 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(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
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.
|
|
||||||
|
|
||||||
mod admin;
|
mod admin;
|
||||||
mod eth;
|
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
|
//! Reth RPC implementation
|
||||||
//!
|
//!
|
||||||
//! Provides the implementation of all RPC interfaces.
|
//! 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
|
//! 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.
|
//! 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 admin;
|
||||||
mod debug;
|
mod debug;
|
||||||
mod engine;
|
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.
|
//! Staged syncing primitives for reth.
|
||||||
//!
|
//!
|
||||||
//! This crate contains the syncing primitives [`Pipeline`] and [`Stage`], as well as all stages
|
//! This crate contains the syncing primitives [`Pipeline`] and [`Stage`], as well as all stages
|
||||||
@@ -63,6 +50,17 @@
|
|||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! - `test-utils`: Export utilities for testing
|
//! - `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 error;
|
||||||
mod metrics;
|
mod metrics;
|
||||||
mod pipeline;
|
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
|
/// This stage does not write anything; it's checkpoint is used to denote the highest fully synced
|
||||||
/// block.
|
/// block.
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Default, Debug, Clone)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct FinishStage;
|
pub struct FinishStage;
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
extern crate proc_macro2;
|
|
||||||
use proc_macro::{self, TokenStream};
|
use proc_macro::{self, TokenStream};
|
||||||
use proc_macro2::{Ident, TokenStream as TokenStream2};
|
use proc_macro2::{Ident, TokenStream as TokenStream2};
|
||||||
use quote::{format_ident, quote};
|
use quote::{format_ident, quote};
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! Derive macros for the Compact codec traits.
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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 proc_macro::{self, TokenStream, TokenTree};
|
||||||
use quote::{format_ident, quote};
|
use quote::{format_ident, quote};
|
||||||
use syn::{parse_macro_input, DeriveInput};
|
use syn::{parse_macro_input, DeriveInput};
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
//! Compact codec.
|
||||||
|
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
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};
|
use bytes::{Buf, Bytes};
|
||||||
pub use codecs_derive::*;
|
|
||||||
use revm_primitives::{B160 as H160, B256 as H256, U256};
|
use revm_primitives::{B160 as H160, B256 as H256, U256};
|
||||||
|
|
||||||
|
pub use codecs_derive::*;
|
||||||
|
|
||||||
/// Trait that implements the `Compact` codec.
|
/// Trait that implements the `Compact` codec.
|
||||||
///
|
///
|
||||||
/// When deriving the trait for custom structs, be aware of certain limitations/recommendations:
|
/// 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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use revm_primitives::B160;
|
use revm_primitives::Address;
|
||||||
|
|
||||||
pub type Address = B160;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compact_bytes() {
|
fn compact_bytes() {
|
||||||
@@ -490,7 +494,7 @@ mod tests {
|
|||||||
|
|
||||||
#[main_codec]
|
#[main_codec]
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct TestStruct {
|
struct TestStruct {
|
||||||
f_u64: u64,
|
f_u64: u64,
|
||||||
f_u256: U256,
|
f_u256: U256,
|
||||||
f_bool_t: bool,
|
f_bool_t: bool,
|
||||||
@@ -542,7 +546,7 @@ mod tests {
|
|||||||
|
|
||||||
#[main_codec]
|
#[main_codec]
|
||||||
#[derive(Debug, PartialEq, Clone, Default)]
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
pub enum TestEnum {
|
enum TestEnum {
|
||||||
#[default]
|
#[default]
|
||||||
Var0,
|
Var0,
|
||||||
Var1(TestStruct),
|
Var1(TestStruct),
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ use crate::{abstraction::table::*, DatabaseError};
|
|||||||
// Sealed trait helper to prevent misuse of the API.
|
// Sealed trait helper to prevent misuse of the API.
|
||||||
mod sealed {
|
mod sealed {
|
||||||
pub trait Sealed: Sized {}
|
pub trait Sealed: Sized {}
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct Bounds<T>(T);
|
pub struct Bounds<T>(T);
|
||||||
impl<T> Sealed for Bounds<T> {}
|
impl<T> Sealed for Bounds<T> {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
|
fmt,
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
ops::{Bound, RangeBounds},
|
ops::{Bound, RangeBounds},
|
||||||
};
|
};
|
||||||
@@ -148,6 +149,16 @@ pub struct Walker<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> {
|
|||||||
_tx_phantom: PhantomData<&'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
|
impl<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> std::iter::Iterator
|
||||||
for Walker<'cursor, 'tx, T, CURSOR>
|
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>,
|
_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> {
|
impl<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> ReverseWalker<'cursor, 'tx, T, CURSOR> {
|
||||||
/// construct ReverseWalker
|
/// construct ReverseWalker
|
||||||
pub fn new(cursor: &'cursor mut CURSOR, start: IterPairResult<T>) -> Self {
|
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>,
|
_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
|
impl<'cursor, 'tx, T: Table, CURSOR: DbCursorRO<'tx, T>> std::iter::Iterator
|
||||||
for RangeWalker<'cursor, 'tx, T, CURSOR>
|
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>,
|
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>>
|
impl<'cursor, 'tx, T: DupSort, CURSOR: DbCursorRW<'tx, T> + DbDupCursorRO<'tx, T>>
|
||||||
DupWalker<'cursor, 'tx, T, CURSOR>
|
DupWalker<'cursor, 'tx, T, CURSOR>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use crate::{
|
|||||||
|
|
||||||
/// Mock database used for testing with inner BTreeMap structure
|
/// Mock database used for testing with inner BTreeMap structure
|
||||||
/// TODO
|
/// TODO
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct DatabaseMock {
|
pub struct DatabaseMock {
|
||||||
/// Main data. TODO (Make it table aware)
|
/// Main data. TODO (Make it table aware)
|
||||||
pub data: BTreeMap<Vec<u8>, Vec<u8>>,
|
pub data: BTreeMap<Vec<u8>, Vec<u8>>,
|
||||||
@@ -115,6 +115,7 @@ impl<'a> DbTxMut<'a> for TxMock {
|
|||||||
impl<'a> TableImporter<'a> for TxMock {}
|
impl<'a> TableImporter<'a> for TxMock {}
|
||||||
|
|
||||||
/// Cursor that iterates over table
|
/// Cursor that iterates over table
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct CursorMock {
|
pub struct CursorMock {
|
||||||
_cursor: u32,
|
_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.
|
//! reth's database abstraction layer with concrete implementations.
|
||||||
//!
|
//!
|
||||||
//! The database abstraction assumes that the underlying store is a KV store subdivided into tables.
|
//! The database abstraction assumes that the underlying store is a KV store subdivided into tables.
|
||||||
@@ -61,12 +55,14 @@
|
|||||||
//! [`Decompress`]: crate::abstraction::table::Decompress
|
//! [`Decompress`]: crate::abstraction::table::Decompress
|
||||||
//! [`Table`]: crate::abstraction::table::Table
|
//! [`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)]
|
#![deny(unused_must_use, rust_2018_idioms)]
|
||||||
#![doc(test(
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
no_crate_inject,
|
|
||||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
|
||||||
))]
|
|
||||||
|
|
||||||
/// Traits defining the database abstractions, such as cursors and transactions.
|
/// Traits defining the database abstractions, such as cursors and transactions.
|
||||||
pub mod abstraction;
|
pub mod abstraction;
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ use std::ops::Range;
|
|||||||
/// Total number of transactions.
|
/// Total number of transactions.
|
||||||
pub type NumTransactions = u64;
|
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
|
/// 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)]
|
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
||||||
#[main_codec]
|
#[main_codec]
|
||||||
pub struct StoredBlockBodyIndices {
|
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.
|
/// It is stored as the headers of the block's uncles.
|
||||||
/// tx_amount)`.
|
|
||||||
#[main_codec]
|
#[main_codec]
|
||||||
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
||||||
pub struct StoredBlockOmmers {
|
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(
|
#![doc(
|
||||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
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",
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
||||||
)]
|
)]
|
||||||
#![deny(warnings)]
|
#![allow(non_upper_case_globals, non_camel_case_types, non_snake_case, clippy::all)]
|
||||||
#![allow(non_upper_case_globals)]
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
#![allow(non_camel_case_types)]
|
|
||||||
#![allow(non_snake_case)]
|
|
||||||
#![allow(clippy::all)]
|
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use ffi::{
|
|||||||
};
|
};
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use parking_lot::Mutex;
|
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.
|
/// A cursor for navigating the items within a database.
|
||||||
pub struct Cursor<'txn, K>
|
pub struct Cursor<'txn, K>
|
||||||
@@ -30,7 +30,7 @@ where
|
|||||||
K: TransactionKind,
|
K: TransactionKind,
|
||||||
{
|
{
|
||||||
pub(crate) fn new<E: EnvironmentKind>(
|
pub(crate) fn new<E: EnvironmentKind>(
|
||||||
txn: &'txn Transaction<K, E>,
|
txn: &'txn Transaction<'_, K, E>,
|
||||||
dbi: ffi::MDBX_dbi,
|
dbi: ffi::MDBX_dbi,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let mut cursor: *mut ffi::MDBX_cursor = ptr::null_mut();
|
let mut cursor: *mut ffi::MDBX_cursor = ptr::null_mut();
|
||||||
@@ -467,7 +467,7 @@ impl<'txn, K> fmt::Debug for Cursor<'txn, K>
|
|||||||
where
|
where
|
||||||
K: TransactionKind,
|
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()
|
f.debug_struct("Cursor").finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -733,7 +733,7 @@ where
|
|||||||
Key: TableObject<'txn>,
|
Key: TableObject<'txn>,
|
||||||
Value: 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()
|
f.debug_struct("IterDup").finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use std::{
|
|||||||
mem,
|
mem,
|
||||||
ops::{Bound, RangeBounds},
|
ops::{Bound, RangeBounds},
|
||||||
path::Path,
|
path::Path,
|
||||||
ptr, result,
|
ptr,
|
||||||
sync::mpsc::{sync_channel, SyncSender},
|
sync::mpsc::{sync_channel, SyncSender},
|
||||||
thread::sleep,
|
thread::sleep,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
@@ -35,8 +35,11 @@ pub trait EnvironmentKind: private::Sealed + Debug + 'static {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct NoWriteMap;
|
pub struct NoWriteMap;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct WriteMap;
|
pub struct WriteMap;
|
||||||
|
|
||||||
impl EnvironmentKind for NoWriteMap {
|
impl EnvironmentKind for NoWriteMap {
|
||||||
@@ -325,7 +328,7 @@ impl<E> fmt::Debug for Environment<E>
|
|||||||
where
|
where
|
||||||
E: EnvironmentKind,
|
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()
|
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