mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
add doc_markdown clippy lint (#8552)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -156,6 +156,7 @@ use_self = "warn"
|
||||
missing_const_for_fn = "warn"
|
||||
empty_line_after_doc_comments = "warn"
|
||||
iter_on_single_items = "warn"
|
||||
doc_markdown = "warn"
|
||||
unnecessary_struct_initialization = "warn"
|
||||
string_lit_as_bytes = "warn"
|
||||
|
||||
|
||||
@ -59,10 +59,10 @@ pub struct Cli<Ext: clap::Args + fmt::Debug = NoArgs> {
|
||||
/// port numbers that conflict with each other.
|
||||
///
|
||||
/// Changes to the following port numbers:
|
||||
/// - DISCOVERY_PORT: default + `instance` - 1
|
||||
/// - AUTH_PORT: default + `instance` * 100 - 100
|
||||
/// - HTTP_RPC_PORT: default - `instance` + 1
|
||||
/// - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
/// - `DISCOVERY_PORT`: default + `instance` - 1
|
||||
/// - `AUTH_PORT`: default + `instance` * 100 - 100
|
||||
/// - `HTTP_RPC_PORT`: default - `instance` + 1
|
||||
/// - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
#[arg(long, value_name = "INSTANCE", global = true, default_value_t = 1, value_parser = value_parser!(u16).range(..=200))]
|
||||
instance: u16,
|
||||
|
||||
@ -90,7 +90,7 @@ impl<Ext: clap::Args + fmt::Debug> Cli<Ext> {
|
||||
/// Execute the configured cli command.
|
||||
///
|
||||
/// This accepts a closure that is used to launch the node via the
|
||||
/// [NodeCommand](node::NodeCommand).
|
||||
/// [`NodeCommand`](node::NodeCommand).
|
||||
///
|
||||
///
|
||||
/// # Example
|
||||
|
||||
@ -89,7 +89,7 @@ pub enum Subcommands {
|
||||
Path,
|
||||
}
|
||||
|
||||
/// db_ro_exec opens a database in read-only mode, and then execute with the provided command
|
||||
/// `db_ro_exec` opens a database in read-only mode, and then execute with the provided command
|
||||
macro_rules! db_ro_exec {
|
||||
($chain:expr, $db_path:expr, $db_args:ident, $sfp:ident, $tool:ident, $command:block) => {
|
||||
let db = open_db_read_only($db_path, $db_args)?;
|
||||
|
||||
@ -20,7 +20,7 @@ use std::{
|
||||
};
|
||||
use tracing::error;
|
||||
|
||||
/// Available keybindings for the [DbListTUI]
|
||||
/// Available keybindings for the [`DbListTUI`]
|
||||
static CMDS: [(&str, &str); 6] = [
|
||||
("q", "Quit"),
|
||||
("↑", "Entry above"),
|
||||
@ -30,8 +30,8 @@ static CMDS: [(&str, &str); 6] = [
|
||||
("G", "Go to a specific page"),
|
||||
];
|
||||
|
||||
/// Modified version of the [ListState] struct that exposes the `offset` field.
|
||||
/// Used to make the [DbListTUI] keys clickable.
|
||||
/// Modified version of the [`ListState`] struct that exposes the `offset` field.
|
||||
/// Used to make the [`DbListTUI`] keys clickable.
|
||||
struct ExpListState {
|
||||
pub(crate) offset: usize,
|
||||
}
|
||||
@ -46,15 +46,15 @@ pub(crate) enum ViewMode {
|
||||
}
|
||||
|
||||
enum Entries<T: Table> {
|
||||
/// Pairs of [Table::Key] and [RawValue<Table::Value>]
|
||||
/// Pairs of [`Table::Key`] and [`RawValue<Table::Value>`]
|
||||
RawValues(Vec<(T::Key, RawValue<T::Value>)>),
|
||||
/// Pairs of [Table::Key] and [Table::Value]
|
||||
/// Pairs of [`Table::Key`] and [`Table::Value`]
|
||||
Values(Vec<TableRow<T>>),
|
||||
}
|
||||
|
||||
impl<T: Table> Entries<T> {
|
||||
/// Creates new empty [Entries] as [Entries::RawValues] if `raw_values == true` and as
|
||||
/// [Entries::Values] if `raw == false`.
|
||||
/// Creates new empty [Entries] as [`Entries::RawValues`] if `raw_values == true` and as
|
||||
/// [`Entries::Values`] if `raw == false`.
|
||||
const fn new_with_raw_values(raw_values: bool) -> Self {
|
||||
if raw_values {
|
||||
Self::RawValues(Vec::new())
|
||||
@ -63,8 +63,8 @@ impl<T: Table> Entries<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the internal entries [Vec], converting the [Table::Value] into [RawValue<Table::Value>]
|
||||
/// if needed.
|
||||
/// Sets the internal entries [Vec], converting the [`Table::Value`] into
|
||||
/// [`RawValue<Table::Value>`] if needed.
|
||||
fn set(&mut self, new_entries: Vec<TableRow<T>>) {
|
||||
match self {
|
||||
Self::RawValues(old_entries) => {
|
||||
@ -83,8 +83,8 @@ impl<T: Table> Entries<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an iterator over keys of the internal [Vec]. For both [Entries::RawValues] and
|
||||
/// [Entries::Values], this iterator will yield [Table::Key].
|
||||
/// Returns an iterator over keys of the internal [Vec]. For both [`Entries::RawValues`] and
|
||||
/// [`Entries::Values`], this iterator will yield [`Table::Key`].
|
||||
const fn iter_keys(&self) -> EntriesKeyIter<'_, T> {
|
||||
EntriesKeyIter { entries: self, index: 0 }
|
||||
}
|
||||
@ -210,7 +210,7 @@ where
|
||||
self.reset();
|
||||
}
|
||||
|
||||
/// Show the [DbListTUI] in the terminal.
|
||||
/// Show the [`DbListTUI`] in the terminal.
|
||||
pub(crate) fn run(mut self) -> eyre::Result<()> {
|
||||
// Setup backend
|
||||
enable_raw_mode()?;
|
||||
|
||||
@ -62,10 +62,10 @@ pub struct NodeCommand<Ext: clap::Args + fmt::Debug = NoArgs> {
|
||||
/// port numbers that conflict with each other.
|
||||
///
|
||||
/// Changes to the following port numbers:
|
||||
/// - DISCOVERY_PORT: default + `instance` - 1
|
||||
/// - AUTH_PORT: default + `instance` * 100 - 100
|
||||
/// - HTTP_RPC_PORT: default - `instance` + 1
|
||||
/// - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
/// - `DISCOVERY_PORT`: default + `instance` - 1
|
||||
/// - `AUTH_PORT`: default + `instance` * 100 - 100
|
||||
/// - `HTTP_RPC_PORT`: default - `instance` + 1
|
||||
/// - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
#[arg(long, value_name = "INSTANCE", global = true, default_value_t = 1, value_parser = value_parser!(u16).range(..=200))]
|
||||
pub instance: u16,
|
||||
|
||||
@ -119,7 +119,7 @@ impl NodeCommand {
|
||||
Self::parse()
|
||||
}
|
||||
|
||||
/// Parsers only the default [NodeCommand] arguments from the given iterator
|
||||
/// Parsers only the default [`NodeCommand`] arguments from the given iterator
|
||||
pub fn try_parse_args_from<I, T>(itr: I) -> Result<Self, clap::error::Error>
|
||||
where
|
||||
I: IntoIterator<Item = T>,
|
||||
|
||||
@ -117,8 +117,8 @@ fn import_tables_with_range<DB: Database>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Dry-run an unwind to FROM block, so we can get the PlainStorageState and
|
||||
/// PlainAccountState safely. There might be some state dependency from an address
|
||||
/// Dry-run an unwind to FROM block, so we can get the `PlainStorageState` and
|
||||
/// `PlainAccountState` safely. There might be some state dependency from an address
|
||||
/// which hasn't been changed in the given range.
|
||||
async fn unwind_and_copy<DB: Database>(
|
||||
db_tool: &DbTool<DB>,
|
||||
|
||||
@ -70,9 +70,9 @@ pub struct Command {
|
||||
pub enum Stages {
|
||||
/// Execution stage.
|
||||
Execution(StageCommand),
|
||||
/// StorageHashing stage.
|
||||
/// `StorageHashing` stage.
|
||||
StorageHashing(StageCommand),
|
||||
/// AccountHashing stage.
|
||||
/// `AccountHashing` stage.
|
||||
AccountHashing(StageCommand),
|
||||
/// Merkle stage.
|
||||
Merkle(StageCommand),
|
||||
|
||||
@ -29,7 +29,7 @@ pub use reth_node_core::utils::*;
|
||||
pub struct DbTool<DB: Database> {
|
||||
/// The provider factory that the db tool will use.
|
||||
pub provider_factory: ProviderFactory<DB>,
|
||||
/// The [ChainSpec] that the db tool will use.
|
||||
/// The [`ChainSpec`] that the db tool will use.
|
||||
pub chain: Arc<ChainSpec>,
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ impl<DB: Database> DbTool<DB> {
|
||||
self.provider_factory.db_ref().view(|tx| tx.get::<T>(key))?.map_err(|e| eyre::eyre!(e))
|
||||
}
|
||||
|
||||
/// Grabs the content of the DupSort table for the given key and subkey
|
||||
/// Grabs the content of the `DupSort` table for the given key and subkey
|
||||
pub fn get_dup<T: DupSort>(&self, key: T::Key, subkey: T::SubKey) -> Result<Option<T::Value>> {
|
||||
self.provider_factory
|
||||
.db_ref()
|
||||
|
||||
2
book/cli/reth.md
vendored
2
book/cli/reth.md
vendored
@ -38,7 +38,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/config.md
vendored
2
book/cli/reth/config.md
vendored
@ -29,7 +29,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db.md
vendored
2
book/cli/reth/db.md
vendored
@ -46,7 +46,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/checksum.md
vendored
2
book/cli/reth/db/checksum.md
vendored
@ -47,7 +47,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/clear.md
vendored
2
book/cli/reth/db/clear.md
vendored
@ -39,7 +39,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/clear/mdbx.md
vendored
2
book/cli/reth/db/clear/mdbx.md
vendored
@ -38,7 +38,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/clear/static-file.md
vendored
2
book/cli/reth/db/clear/static-file.md
vendored
@ -41,7 +41,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/clear/static_file.md
vendored
2
book/cli/reth/db/clear/static_file.md
vendored
@ -41,7 +41,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/diff.md
vendored
2
book/cli/reth/db/diff.md
vendored
@ -37,7 +37,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/drop.md
vendored
2
book/cli/reth/db/drop.md
vendored
@ -37,7 +37,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/get.md
vendored
2
book/cli/reth/db/get.md
vendored
@ -39,7 +39,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/get/mdbx.md
vendored
2
book/cli/reth/db/get/mdbx.md
vendored
@ -47,7 +47,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/get/static-file.md
vendored
2
book/cli/reth/db/get/static-file.md
vendored
@ -47,7 +47,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/get/static_file.md
vendored
2
book/cli/reth/db/get/static_file.md
vendored
@ -47,7 +47,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/list.md
vendored
2
book/cli/reth/db/list.md
vendored
@ -80,7 +80,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/path.md
vendored
2
book/cli/reth/db/path.md
vendored
@ -34,7 +34,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/static_file.md
vendored
2
book/cli/reth/db/static_file.md
vendored
@ -88,7 +88,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/stats.md
vendored
2
book/cli/reth/db/stats.md
vendored
@ -47,7 +47,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/db/version.md
vendored
2
book/cli/reth/db/version.md
vendored
@ -34,7 +34,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/debug.md
vendored
2
book/cli/reth/debug.md
vendored
@ -31,7 +31,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/dump-genesis.md
vendored
2
book/cli/reth/dump-genesis.md
vendored
@ -23,7 +23,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/import.md
vendored
2
book/cli/reth/import.md
vendored
@ -43,7 +43,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/init-state.md
vendored
2
book/cli/reth/init-state.md
vendored
@ -54,7 +54,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/init.md
vendored
2
book/cli/reth/init.md
vendored
@ -34,7 +34,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
14
book/cli/reth/node.md
vendored
14
book/cli/reth/node.md
vendored
@ -37,7 +37,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
@ -79,10 +79,10 @@ Networking:
|
||||
[default: 30303]
|
||||
|
||||
--discovery.v5.addr <DISCOVERY_V5_ADDR>
|
||||
The UDP IPv4 address to use for devp2p peer discovery version 5. Overwritten by RLPx address, if it's also IPv4
|
||||
The UDP IPv4 address to use for devp2p peer discovery version 5. Overwritten by `RLPx` address, if it's also IPv4
|
||||
|
||||
--discovery.v5.addr.ipv6 <DISCOVERY_V5_ADDR_IPV6>
|
||||
The UDP IPv6 address to use for devp2p peer discovery version 5. Overwritten by RLPx address, if it's also IPv6
|
||||
The UDP IPv6 address to use for devp2p peer discovery version 5. Overwritten by `RLPx` address, if it's also IPv6
|
||||
|
||||
--discovery.v5.port <DISCOVERY_V5_PORT>
|
||||
The UDP IPv4 port to use for devp2p peer discovery version 5. Not used unless `--addr` is IPv4, or `--discv5.addr` is set
|
||||
@ -171,8 +171,8 @@ Networking:
|
||||
Experimental, for usage in research. Sets the max accumulated byte size of transactions to
|
||||
request in one request.
|
||||
|
||||
Since RLPx protocol version 68, the byte size of a transaction is shared as metadata in a
|
||||
transaction announcement (see RLPx specs). This allows a node to request a specific size
|
||||
Since `RLPx` protocol version 68, the byte size of a transaction is shared as metadata in a
|
||||
transaction announcement (see `RLPx` specs). This allows a node to request a specific size
|
||||
response.
|
||||
|
||||
By default, nodes request only 128 KiB worth of transactions, but should a peer request
|
||||
@ -218,7 +218,7 @@ RPC:
|
||||
[default: 8546]
|
||||
|
||||
--ws.origins <ws.origins>
|
||||
Origins from which to accept WebSocket requests
|
||||
Origins from which to accept `WebSocket` requests
|
||||
|
||||
--ws.api <WS_API>
|
||||
Rpc Modules to be configured for the WS server
|
||||
@ -498,7 +498,7 @@ Dev testnet:
|
||||
--dev.block-time <BLOCK_TIME>
|
||||
Interval between blocks.
|
||||
|
||||
Parses strings using [humantime::parse_duration]
|
||||
Parses strings using [`humantime::parse_duration`]
|
||||
--dev.block-time 12s
|
||||
|
||||
Pruning:
|
||||
|
||||
10
book/cli/reth/p2p.md
vendored
10
book/cli/reth/p2p.md
vendored
@ -42,7 +42,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
@ -73,10 +73,10 @@ Networking:
|
||||
[default: 30303]
|
||||
|
||||
--discovery.v5.addr <DISCOVERY_V5_ADDR>
|
||||
The UDP IPv4 address to use for devp2p peer discovery version 5. Overwritten by RLPx address, if it's also IPv4
|
||||
The UDP IPv4 address to use for devp2p peer discovery version 5. Overwritten by `RLPx` address, if it's also IPv4
|
||||
|
||||
--discovery.v5.addr.ipv6 <DISCOVERY_V5_ADDR_IPV6>
|
||||
The UDP IPv6 address to use for devp2p peer discovery version 5. Overwritten by RLPx address, if it's also IPv6
|
||||
The UDP IPv6 address to use for devp2p peer discovery version 5. Overwritten by `RLPx` address, if it's also IPv6
|
||||
|
||||
--discovery.v5.port <DISCOVERY_V5_PORT>
|
||||
The UDP IPv4 port to use for devp2p peer discovery version 5. Not used unless `--addr` is IPv4, or `--discv5.addr` is set
|
||||
@ -165,8 +165,8 @@ Networking:
|
||||
Experimental, for usage in research. Sets the max accumulated byte size of transactions to
|
||||
request in one request.
|
||||
|
||||
Since RLPx protocol version 68, the byte size of a transaction is shared as metadata in a
|
||||
transaction announcement (see RLPx specs). This allows a node to request a specific size
|
||||
Since `RLPx` protocol version 68, the byte size of a transaction is shared as metadata in a
|
||||
transaction announcement (see `RLPx` specs). This allows a node to request a specific size
|
||||
response.
|
||||
|
||||
By default, nodes request only 128 KiB worth of transactions, but should a peer request
|
||||
|
||||
2
book/cli/reth/p2p/body.md
vendored
2
book/cli/reth/p2p/body.md
vendored
@ -18,7 +18,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/p2p/header.md
vendored
2
book/cli/reth/p2p/header.md
vendored
@ -18,7 +18,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/recover.md
vendored
2
book/cli/reth/recover.md
vendored
@ -27,7 +27,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/recover/storage-tries.md
vendored
2
book/cli/reth/recover/storage-tries.md
vendored
@ -34,7 +34,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/stage.md
vendored
2
book/cli/reth/stage.md
vendored
@ -30,7 +30,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/stage/drop.md
vendored
2
book/cli/reth/stage/drop.md
vendored
@ -34,7 +34,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
6
book/cli/reth/stage/dump.md
vendored
6
book/cli/reth/stage/dump.md
vendored
@ -8,8 +8,8 @@ Usage: reth stage dump [OPTIONS] <COMMAND>
|
||||
|
||||
Commands:
|
||||
execution Execution stage
|
||||
storage-hashing StorageHashing stage
|
||||
account-hashing AccountHashing stage
|
||||
storage-hashing `StorageHashing` stage
|
||||
account-hashing `AccountHashing` stage
|
||||
merkle Merkle stage
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
@ -41,7 +41,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
4
book/cli/reth/stage/dump/account-hashing.md
vendored
4
book/cli/reth/stage/dump/account-hashing.md
vendored
@ -1,6 +1,6 @@
|
||||
# reth stage dump account-hashing
|
||||
|
||||
AccountHashing stage
|
||||
`AccountHashing` stage
|
||||
|
||||
```bash
|
||||
$ reth stage dump account-hashing --help
|
||||
@ -26,7 +26,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/stage/dump/execution.md
vendored
2
book/cli/reth/stage/dump/execution.md
vendored
@ -26,7 +26,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/stage/dump/merkle.md
vendored
2
book/cli/reth/stage/dump/merkle.md
vendored
@ -26,7 +26,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
4
book/cli/reth/stage/dump/storage-hashing.md
vendored
4
book/cli/reth/stage/dump/storage-hashing.md
vendored
@ -1,6 +1,6 @@
|
||||
# reth stage dump storage-hashing
|
||||
|
||||
StorageHashing stage
|
||||
`StorageHashing` stage
|
||||
|
||||
```bash
|
||||
$ reth stage dump storage-hashing --help
|
||||
@ -26,7 +26,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
10
book/cli/reth/stage/run.md
vendored
10
book/cli/reth/stage/run.md
vendored
@ -79,7 +79,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
@ -110,10 +110,10 @@ Networking:
|
||||
[default: 30303]
|
||||
|
||||
--discovery.v5.addr <DISCOVERY_V5_ADDR>
|
||||
The UDP IPv4 address to use for devp2p peer discovery version 5. Overwritten by RLPx address, if it's also IPv4
|
||||
The UDP IPv4 address to use for devp2p peer discovery version 5. Overwritten by `RLPx` address, if it's also IPv4
|
||||
|
||||
--discovery.v5.addr.ipv6 <DISCOVERY_V5_ADDR_IPV6>
|
||||
The UDP IPv6 address to use for devp2p peer discovery version 5. Overwritten by RLPx address, if it's also IPv6
|
||||
The UDP IPv6 address to use for devp2p peer discovery version 5. Overwritten by `RLPx` address, if it's also IPv6
|
||||
|
||||
--discovery.v5.port <DISCOVERY_V5_PORT>
|
||||
The UDP IPv4 port to use for devp2p peer discovery version 5. Not used unless `--addr` is IPv4, or `--discv5.addr` is set
|
||||
@ -202,8 +202,8 @@ Networking:
|
||||
Experimental, for usage in research. Sets the max accumulated byte size of transactions to
|
||||
request in one request.
|
||||
|
||||
Since RLPx protocol version 68, the byte size of a transaction is shared as metadata in a
|
||||
transaction announcement (see RLPx specs). This allows a node to request a specific size
|
||||
Since `RLPx` protocol version 68, the byte size of a transaction is shared as metadata in a
|
||||
transaction announcement (see `RLPx` specs). This allows a node to request a specific size
|
||||
response.
|
||||
|
||||
By default, nodes request only 128 KiB worth of transactions, but should a peer request
|
||||
|
||||
10
book/cli/reth/stage/unwind.md
vendored
10
book/cli/reth/stage/unwind.md
vendored
@ -39,7 +39,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
@ -89,10 +89,10 @@ Networking:
|
||||
[default: 30303]
|
||||
|
||||
--discovery.v5.addr <DISCOVERY_V5_ADDR>
|
||||
The UDP IPv4 address to use for devp2p peer discovery version 5. Overwritten by RLPx address, if it's also IPv4
|
||||
The UDP IPv4 address to use for devp2p peer discovery version 5. Overwritten by `RLPx` address, if it's also IPv4
|
||||
|
||||
--discovery.v5.addr.ipv6 <DISCOVERY_V5_ADDR_IPV6>
|
||||
The UDP IPv6 address to use for devp2p peer discovery version 5. Overwritten by RLPx address, if it's also IPv6
|
||||
The UDP IPv6 address to use for devp2p peer discovery version 5. Overwritten by `RLPx` address, if it's also IPv6
|
||||
|
||||
--discovery.v5.port <DISCOVERY_V5_PORT>
|
||||
The UDP IPv4 port to use for devp2p peer discovery version 5. Not used unless `--addr` is IPv4, or `--discv5.addr` is set
|
||||
@ -181,8 +181,8 @@ Networking:
|
||||
Experimental, for usage in research. Sets the max accumulated byte size of transactions to
|
||||
request in one request.
|
||||
|
||||
Since RLPx protocol version 68, the byte size of a transaction is shared as metadata in a
|
||||
transaction announcement (see RLPx specs). This allows a node to request a specific size
|
||||
Since `RLPx` protocol version 68, the byte size of a transaction is shared as metadata in a
|
||||
transaction announcement (see `RLPx` specs). This allows a node to request a specific size
|
||||
response.
|
||||
|
||||
By default, nodes request only 128 KiB worth of transactions, but should a peer request
|
||||
|
||||
2
book/cli/reth/stage/unwind/num-blocks.md
vendored
2
book/cli/reth/stage/unwind/num-blocks.md
vendored
@ -38,7 +38,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/stage/unwind/to-block.md
vendored
2
book/cli/reth/stage/unwind/to-block.md
vendored
@ -38,7 +38,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/test-vectors.md
vendored
2
book/cli/reth/test-vectors.md
vendored
@ -27,7 +27,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
2
book/cli/reth/test-vectors/tables.md
vendored
2
book/cli/reth/test-vectors/tables.md
vendored
@ -27,7 +27,7 @@ Options:
|
||||
|
||||
Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
|
||||
|
||||
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
|
||||
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
|
||||
|
||||
[default: 1]
|
||||
|
||||
|
||||
@ -79,13 +79,13 @@ impl CanonicalError {
|
||||
}
|
||||
|
||||
/// Returns `true` if the underlying error matches
|
||||
/// [BlockchainTreeError::BlockHashNotFoundInChain].
|
||||
/// [`BlockchainTreeError::BlockHashNotFoundInChain`].
|
||||
pub const fn is_block_hash_not_found(&self) -> bool {
|
||||
matches!(self, Self::BlockchainTree(BlockchainTreeError::BlockHashNotFoundInChain { .. }))
|
||||
}
|
||||
|
||||
/// Returns `Some(BlockNumber)` if the underlying error matches
|
||||
/// [CanonicalError::OptimisticTargetRevert].
|
||||
/// [`CanonicalError::OptimisticTargetRevert`].
|
||||
pub const fn optimistic_revert_block_number(&self) -> Option<BlockNumber> {
|
||||
match self {
|
||||
Self::OptimisticTargetRevert(block_number) => Some(*block_number),
|
||||
@ -104,27 +104,27 @@ pub struct InsertBlockError {
|
||||
// === impl InsertBlockError ===
|
||||
|
||||
impl InsertBlockError {
|
||||
/// Create a new InsertInvalidBlockError
|
||||
/// Create a new `InsertInvalidBlockError`
|
||||
pub fn new(block: SealedBlock, kind: InsertBlockErrorKind) -> Self {
|
||||
Self { inner: InsertBlockErrorData::boxed(block, kind) }
|
||||
}
|
||||
|
||||
/// Create a new InsertInvalidBlockError from a tree error
|
||||
/// Create a new `InsertInvalidBlockError` from a tree error
|
||||
pub fn tree_error(error: BlockchainTreeError, block: SealedBlock) -> Self {
|
||||
Self::new(block, InsertBlockErrorKind::Tree(error))
|
||||
}
|
||||
|
||||
/// Create a new InsertInvalidBlockError from a consensus error
|
||||
/// Create a new `InsertInvalidBlockError` from a consensus error
|
||||
pub fn consensus_error(error: ConsensusError, block: SealedBlock) -> Self {
|
||||
Self::new(block, InsertBlockErrorKind::Consensus(error))
|
||||
}
|
||||
|
||||
/// Create a new InsertInvalidBlockError from a consensus error
|
||||
/// Create a new `InsertInvalidBlockError` from a consensus error
|
||||
pub fn sender_recovery_error(block: SealedBlock) -> Self {
|
||||
Self::new(block, InsertBlockErrorKind::SenderRecovery)
|
||||
}
|
||||
|
||||
/// Create a new InsertInvalidBlockError from an execution error
|
||||
/// Create a new `InsertInvalidBlockError` from an execution error
|
||||
pub fn execution_error(error: BlockExecutionError, block: SealedBlock) -> Self {
|
||||
Self::new(block, InsertBlockErrorKind::Execution(error))
|
||||
}
|
||||
@ -231,7 +231,7 @@ pub enum InsertBlockErrorKind {
|
||||
/// Canonical error.
|
||||
#[error(transparent)]
|
||||
Canonical(#[from] CanonicalError),
|
||||
/// BlockchainTree error.
|
||||
/// `BlockchainTree` error.
|
||||
#[error(transparent)]
|
||||
BlockchainTree(BlockchainTreeError),
|
||||
}
|
||||
|
||||
@ -18,11 +18,11 @@ use std::collections::BTreeMap;
|
||||
|
||||
pub mod error;
|
||||
|
||||
/// * [BlockchainTreeEngine::insert_block]: Connect block to chain, execute it and if valid insert
|
||||
/// * [`BlockchainTreeEngine::insert_block`]: Connect block to chain, execute it and if valid insert
|
||||
/// block inside tree.
|
||||
/// * [BlockchainTreeEngine::finalize_block]: Remove chains that join to now finalized block, as
|
||||
/// * [`BlockchainTreeEngine::finalize_block`]: Remove chains that join to now finalized block, as
|
||||
/// chain becomes invalid.
|
||||
/// * [BlockchainTreeEngine::make_canonical]: Check if we have the hash of block that we want to
|
||||
/// * [`BlockchainTreeEngine::make_canonical`]: Check if we have the hash of block that we want to
|
||||
/// finalize and commit it to db. If we don't have the block, syncing should start to fetch the
|
||||
/// blocks from p2p. Do reorg in tables if canonical chain if needed.
|
||||
pub trait BlockchainTreeEngine: BlockchainTreeViewer + Send + Sync {
|
||||
@ -60,8 +60,8 @@ pub trait BlockchainTreeEngine: BlockchainTreeViewer + Send + Sync {
|
||||
/// The `validation_kind` parameter controls which validation checks are performed.
|
||||
///
|
||||
/// Caution: If the block was received from the consensus layer, this should always be called
|
||||
/// with [BlockValidationKind::Exhaustive] to validate the state root, if possible to adhere to
|
||||
/// the engine API spec.
|
||||
/// with [`BlockValidationKind::Exhaustive`] to validate the state root, if possible to adhere
|
||||
/// to the engine API spec.
|
||||
fn insert_block(
|
||||
&self,
|
||||
block: SealedBlockWithSenders,
|
||||
@ -157,14 +157,14 @@ impl std::fmt::Display for BlockValidationKind {
|
||||
}
|
||||
}
|
||||
|
||||
/// All possible outcomes of a canonicalization attempt of [BlockchainTreeEngine::make_canonical].
|
||||
/// All possible outcomes of a canonicalization attempt of [`BlockchainTreeEngine::make_canonical`].
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum CanonicalOutcome {
|
||||
/// The block is already canonical.
|
||||
AlreadyCanonical {
|
||||
/// Block number and hash of current head.
|
||||
head: BlockNumHash,
|
||||
/// The corresponding [SealedHeader] that was attempted to be made a current head and
|
||||
/// The corresponding [`SealedHeader`] that was attempted to be made a current head and
|
||||
/// is already canonical.
|
||||
header: SealedHeader,
|
||||
},
|
||||
@ -201,13 +201,13 @@ impl CanonicalOutcome {
|
||||
/// From Engine API spec, block inclusion can be valid, accepted or invalid.
|
||||
/// Invalid case is already covered by error, but we need to make distinction
|
||||
/// between valid blocks that extend canonical chain and the ones that fork off
|
||||
/// into side chains (see [BlockAttachment]). If we don't know the block
|
||||
/// into side chains (see [`BlockAttachment`]). If we don't know the block
|
||||
/// parent we are returning Disconnected status as we can't make a claim if
|
||||
/// block is valid or not.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum BlockStatus {
|
||||
/// If block is valid and block extends canonical chain.
|
||||
/// In BlockchainTree terms, it forks off canonical tip.
|
||||
/// In `BlockchainTree` terms, it forks off canonical tip.
|
||||
Valid(BlockAttachment),
|
||||
/// If block is valid and block forks off canonical chain.
|
||||
/// If blocks is not connected to canonical chain.
|
||||
@ -286,7 +286,7 @@ pub trait BlockchainTreeViewer: Send + Sync {
|
||||
/// Returns the _buffered_ (disconnected) header with matching hash from the internal buffer if
|
||||
/// it exists.
|
||||
///
|
||||
/// Caution: Unlike [Self::block_by_hash] this will only return headers that are currently
|
||||
/// Caution: Unlike [`Self::block_by_hash`] this will only return headers that are currently
|
||||
/// disconnected from the canonical chain.
|
||||
fn buffered_header_by_hash(&self, block_hash: BlockHash) -> Option<SealedHeader>;
|
||||
|
||||
@ -304,7 +304,7 @@ pub trait BlockchainTreeViewer: Send + Sync {
|
||||
/// If there is a buffered block with the given hash, this returns the block itself.
|
||||
fn lowest_buffered_ancestor(&self, hash: BlockHash) -> Option<SealedBlockWithSenders>;
|
||||
|
||||
/// Return BlockchainTree best known canonical chain tip (BlockHash, BlockNumber)
|
||||
/// Return `BlockchainTree` best known canonical chain tip (`BlockHash`, `BlockNumber`)
|
||||
fn canonical_tip(&self) -> BlockNumHash;
|
||||
|
||||
/// Return block number and hash that extends the canonical chain tip by one.
|
||||
@ -325,7 +325,7 @@ pub trait BlockchainTreeViewer: Send + Sync {
|
||||
/// Returns the pending block and its receipts in one call.
|
||||
///
|
||||
/// This exists to prevent a potential data race if the pending block changes in between
|
||||
/// [Self::pending_block] and [Self::pending_receipts] calls.
|
||||
/// [`Self::pending_block`] and [`Self::pending_receipts`] calls.
|
||||
fn pending_block_and_receipts(&self) -> Option<(SealedBlock, Vec<Receipt>)>;
|
||||
|
||||
/// Returns the pending receipts if there is one.
|
||||
|
||||
@ -7,10 +7,10 @@ use std::collections::{btree_map, hash_map, BTreeMap, HashMap, HashSet};
|
||||
/// It allows to store unconnected blocks for potential future inclusion.
|
||||
///
|
||||
/// The buffer has three main functionalities:
|
||||
/// * [BlockBuffer::insert_block] for inserting blocks inside the buffer.
|
||||
/// * [BlockBuffer::remove_block_with_children] for connecting blocks if the parent gets received
|
||||
/// * [`BlockBuffer::insert_block`] for inserting blocks inside the buffer.
|
||||
/// * [`BlockBuffer::remove_block_with_children`] for connecting blocks if the parent gets received
|
||||
/// and inserted.
|
||||
/// * [BlockBuffer::remove_old_blocks] to remove old blocks that precede the finalized number.
|
||||
/// * [`BlockBuffer::remove_old_blocks`] to remove old blocks that precede the finalized number.
|
||||
///
|
||||
/// Note: Buffer is limited by number of blocks that it can contain and eviction of the block
|
||||
/// is done by last recently used block.
|
||||
@ -22,7 +22,7 @@ pub struct BlockBuffer {
|
||||
/// to the buffered children.
|
||||
/// Allows connecting buffered blocks by parent.
|
||||
pub(crate) parent_to_child: HashMap<BlockHash, HashSet<BlockHash>>,
|
||||
/// BTreeMap tracking the earliest blocks by block number.
|
||||
/// `BTreeMap` tracking the earliest blocks by block number.
|
||||
/// Used for removal of old blocks that precede finalization.
|
||||
pub(crate) earliest_blocks: BTreeMap<BlockNumber, HashSet<BlockHash>>,
|
||||
/// LRU used for tracing oldest inserted blocks that are going to be
|
||||
|
||||
@ -18,14 +18,14 @@ pub struct BlockIndices {
|
||||
/// Last finalized block.
|
||||
last_finalized_block: BlockNumber,
|
||||
/// Non-finalized canonical chain. Contains N number (depends on `finalization_depth`) of
|
||||
/// blocks. These blocks are found in fork_to_child but not inside `blocks_to_chain` or
|
||||
/// blocks. These blocks are found in `fork_to_child` but not inside `blocks_to_chain` or
|
||||
/// `number_to_block` as those are sidechain specific indices.
|
||||
canonical_chain: CanonicalChain,
|
||||
/// Index needed when discarding the chain, so we can remove connected chains from tree.
|
||||
///
|
||||
/// This maintains insertion order for all child blocks, so
|
||||
/// [BlockIndices::pending_block_num_hash] returns always the same block: the first child block
|
||||
/// we inserted.
|
||||
/// [`BlockIndices::pending_block_num_hash`] returns always the same block: the first child
|
||||
/// block we inserted.
|
||||
///
|
||||
/// NOTE: It contains just blocks that are forks as a key and not all blocks.
|
||||
fork_to_child: HashMap<BlockHash, LinkedHashSet<BlockHash>>,
|
||||
@ -122,7 +122,7 @@ impl BlockIndices {
|
||||
self.fork_to_child.entry(first.parent_hash).or_default().insert_if_absent(first.hash());
|
||||
}
|
||||
|
||||
/// Get the [BlockchainId] the given block belongs to if it exists.
|
||||
/// Get the [`BlockchainId`] the given block belongs to if it exists.
|
||||
pub(crate) fn get_block_chain_id(&self, block: &BlockHash) -> Option<BlockchainId> {
|
||||
self.blocks_to_chain.get(block).cloned()
|
||||
}
|
||||
|
||||
@ -46,13 +46,13 @@ use tracing::{debug, error, info, instrument, trace, warn};
|
||||
/// canonical blocks to the tree (by removing them from the database), and commit the sidechain
|
||||
/// blocks to the database to become the canonical chain (reorg).
|
||||
///
|
||||
/// include_mmd!("docs/mermaid/tree.mmd")
|
||||
/// `include_mmd!("docs/mermaid/tree.mmd`")
|
||||
///
|
||||
/// # Main functions
|
||||
/// * [BlockchainTree::insert_block]: Connect a block to a chain, execute it, and if valid, insert
|
||||
/// * [`BlockchainTree::insert_block`]: Connect a block to a chain, execute it, and if valid, insert
|
||||
/// the block into the tree.
|
||||
/// * [BlockchainTree::finalize_block]: Remove chains that branch off of the now finalized block.
|
||||
/// * [BlockchainTree::make_canonical]: Check if we have the hash of a block that is the current
|
||||
/// * [`BlockchainTree::finalize_block`]: Remove chains that branch off of the now finalized block.
|
||||
/// * [`BlockchainTree::make_canonical`]: Check if we have the hash of a block that is the current
|
||||
/// canonical head and commit it to db.
|
||||
#[derive(Debug)]
|
||||
pub struct BlockchainTree<DB, E> {
|
||||
@ -179,9 +179,9 @@ where
|
||||
/// Check if the block is known to blockchain tree or database and return its status.
|
||||
///
|
||||
/// Function will check:
|
||||
/// * if block is inside database returns [BlockStatus::Valid].
|
||||
/// * if block is inside buffer returns [BlockStatus::Disconnected].
|
||||
/// * if block is part of the canonical returns [BlockStatus::Valid].
|
||||
/// * if block is inside database returns [`BlockStatus::Valid`].
|
||||
/// * if block is inside buffer returns [`BlockStatus::Disconnected`].
|
||||
/// * if block is part of the canonical returns [`BlockStatus::Valid`].
|
||||
///
|
||||
/// Returns an error if
|
||||
/// - an error occurred while reading from the database.
|
||||
@ -225,7 +225,7 @@ where
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
/// Expose internal indices of the BlockchainTree.
|
||||
/// Expose internal indices of the `BlockchainTree`.
|
||||
#[inline]
|
||||
pub const fn block_indices(&self) -> &BlockIndices {
|
||||
self.state.block_indices()
|
||||
@ -272,7 +272,7 @@ where
|
||||
/// needed for evm `BLOCKHASH` opcode.
|
||||
/// Return none if:
|
||||
/// * block unknown.
|
||||
/// * chain_id not present in state.
|
||||
/// * `chain_id` not present in state.
|
||||
/// * there are no parent hashes stored.
|
||||
pub fn post_state_data(&self, block_hash: BlockHash) -> Option<BundleStateData> {
|
||||
trace!(target: "blockchain_tree", ?block_hash, "Searching for post state data");
|
||||
@ -730,8 +730,8 @@ where
|
||||
|
||||
/// Check if block is found inside a sidechain and its attachment.
|
||||
///
|
||||
/// if it is canonical or extends the canonical chain, return [BlockAttachment::Canonical]
|
||||
/// if it does not extend the canonical chain, return [BlockAttachment::HistoricalFork]
|
||||
/// if it is canonical or extends the canonical chain, return [`BlockAttachment::Canonical`]
|
||||
/// if it does not extend the canonical chain, return [`BlockAttachment::HistoricalFork`]
|
||||
/// if the block is not in the tree or its chain id is not valid, return None
|
||||
#[track_caller]
|
||||
fn is_block_inside_sidechain(&self, block: &BlockNumHash) -> Option<BlockAttachment> {
|
||||
@ -754,7 +754,7 @@ where
|
||||
|
||||
/// Insert a block (with recovered senders) into the tree.
|
||||
///
|
||||
/// Returns the [BlockStatus] on success:
|
||||
/// Returns the [`BlockStatus`] on success:
|
||||
///
|
||||
/// - The block is already part of a sidechain in the tree, or
|
||||
/// - The block is already part of the canonical chain, or
|
||||
@ -767,8 +767,8 @@ where
|
||||
/// This means that if the block becomes canonical, we need to fetch the missing blocks over
|
||||
/// P2P.
|
||||
///
|
||||
/// If the [BlockValidationKind::SkipStateRootValidation] variant is provided the state root is
|
||||
/// not validated.
|
||||
/// If the [`BlockValidationKind::SkipStateRootValidation`] variant is provided the state root
|
||||
/// is not validated.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
@ -1353,7 +1353,7 @@ where
|
||||
///
|
||||
/// NOTE: this method should not be called during the pipeline sync, because otherwise the sync
|
||||
/// checkpoint metric will get overwritten. Buffered blocks metrics are updated in
|
||||
/// [BlockBuffer](crate::block_buffer::BlockBuffer) during the pipeline sync.
|
||||
/// [`BlockBuffer`](crate::block_buffer::BlockBuffer) during the pipeline sync.
|
||||
pub(crate) fn update_chains_metrics(&mut self) {
|
||||
let height = self.state.block_indices.canonical_tip().number;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//! [BundleStateDataProvider] implementations used by the tree.
|
||||
//! [`BundleStateDataProvider`] implementations used by the tree.
|
||||
|
||||
use reth_primitives::{BlockHash, BlockNumber, ForkBlock};
|
||||
use reth_provider::{BundleStateDataProvider, BundleStateForkProvider, BundleStateWithReceipts};
|
||||
|
||||
@ -64,8 +64,8 @@ impl AppendableChain {
|
||||
|
||||
/// Create a new chain that forks off of the canonical chain.
|
||||
///
|
||||
/// if [BlockValidationKind::Exhaustive] is specified, the method will verify the state root of
|
||||
/// the block.
|
||||
/// if [`BlockValidationKind::Exhaustive`] is specified, the method will verify the state root
|
||||
/// of the block.
|
||||
pub fn new_canonical_fork<DB, E>(
|
||||
block: SealedBlockWithSenders,
|
||||
parent_header: &SealedHeader,
|
||||
@ -103,7 +103,7 @@ impl AppendableChain {
|
||||
|
||||
/// Create a new chain that forks off of an existing sidechain.
|
||||
///
|
||||
/// This differs from [AppendableChain::new_canonical_fork] in that this starts a new fork.
|
||||
/// This differs from [`AppendableChain::new_canonical_fork`] in that this starts a new fork.
|
||||
pub(crate) fn new_chain_fork<DB, E>(
|
||||
&self,
|
||||
block: SealedBlockWithSenders,
|
||||
@ -162,11 +162,11 @@ impl AppendableChain {
|
||||
/// state root after execution if possible and requested.
|
||||
///
|
||||
/// Note: State root validation is limited to blocks that extend the canonical chain and is
|
||||
/// optional, see [BlockValidationKind]. So this function takes two parameters to determine
|
||||
/// optional, see [`BlockValidationKind`]. So this function takes two parameters to determine
|
||||
/// if the state can and should be validated.
|
||||
/// - [BlockAttachment] represents if the block extends the canonical chain, and thus we can
|
||||
/// - [`BlockAttachment`] represents if the block extends the canonical chain, and thus we can
|
||||
/// cache the trie state updates.
|
||||
/// - [BlockValidationKind] determines if the state root __should__ be validated.
|
||||
/// - [`BlockValidationKind`] determines if the state root __should__ be validated.
|
||||
fn validate_and_execute<BSDP, DB, E>(
|
||||
block: SealedBlockWithSenders,
|
||||
parent_block: &SealedHeader,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
//! Implementation of a tree-like structure for blockchains.
|
||||
//!
|
||||
//! The [BlockchainTree] can validate, execute, and revert blocks in multiple competing sidechains.
|
||||
//! This structure is used for Reth's sync mode at the tip instead of the pipeline, and is the
|
||||
//! primary executor and validator of payloads sent from the consensus layer.
|
||||
//! The [`BlockchainTree`] can validate, execute, and revert blocks in multiple competing
|
||||
//! sidechains. This structure is used for Reth's sync mode at the tip instead of the pipeline, and
|
||||
//! is the primary executor and validator of payloads sent from the consensus layer.
|
||||
//!
|
||||
//! Blocks and their resulting state transitions are kept in-memory until they are persisted.
|
||||
//!
|
||||
|
||||
@ -14,7 +14,7 @@ use reth_provider::{
|
||||
};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
/// A BlockchainTree that does nothing.
|
||||
/// A `BlockchainTree` that does nothing.
|
||||
///
|
||||
/// Caution: this is only intended for testing purposes, or for wiring components together.
|
||||
#[derive(Debug, Clone, Default)]
|
||||
@ -25,7 +25,7 @@ pub struct NoopBlockchainTree {
|
||||
}
|
||||
|
||||
impl NoopBlockchainTree {
|
||||
/// Create a new NoopBlockchainTree with a canon state notification sender.
|
||||
/// Create a new `NoopBlockchainTree` with a canon state notification sender.
|
||||
pub fn with_canon_state_notifications(
|
||||
canon_state_notification_sender: CanonStateNotificationSender,
|
||||
) -> Self {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//! Wrapper around BlockchainTree that allows for it to be shared.
|
||||
//! Wrapper around `BlockchainTree` that allows for it to be shared.
|
||||
|
||||
use super::BlockchainTree;
|
||||
use parking_lot::RwLock;
|
||||
@ -20,10 +20,10 @@ use reth_provider::{
|
||||
use std::{collections::BTreeMap, sync::Arc};
|
||||
use tracing::trace;
|
||||
|
||||
/// Shareable blockchain tree that is behind a RwLock
|
||||
/// Shareable blockchain tree that is behind a `RwLock`
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ShareableBlockchainTree<DB, E> {
|
||||
/// BlockchainTree
|
||||
/// `BlockchainTree`
|
||||
pub tree: Arc<RwLock<BlockchainTree<DB, E>>>,
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ impl TreeState {
|
||||
BlockchainId(id)
|
||||
}
|
||||
|
||||
/// Expose internal indices of the BlockchainTree.
|
||||
/// Expose internal indices of the `BlockchainTree`.
|
||||
#[inline]
|
||||
pub(crate) const fn block_indices(&self) -> &BlockIndices {
|
||||
&self.block_indices
|
||||
|
||||
@ -27,8 +27,8 @@ impl CliRunner {
|
||||
/// Executes the given _async_ command on the tokio runtime until the command future resolves or
|
||||
/// until the process receives a `SIGINT` or `SIGTERM` signal.
|
||||
///
|
||||
/// Tasks spawned by the command via the [TaskExecutor] are shut down and an attempt is made to
|
||||
/// drive their shutdown to completion after the command has finished.
|
||||
/// Tasks spawned by the command via the [`TaskExecutor`] are shut down and an attempt is made
|
||||
/// to drive their shutdown to completion after the command has finished.
|
||||
pub fn run_command_until_exit<F, E>(
|
||||
self,
|
||||
command: impl FnOnce(CliContext) -> F,
|
||||
@ -80,7 +80,7 @@ impl CliRunner {
|
||||
/// Executes a regular future as a spawned blocking task until completion or until external
|
||||
/// signal received.
|
||||
///
|
||||
/// See [Runtime::spawn_blocking](tokio::runtime::Runtime::spawn_blocking) .
|
||||
/// See [`Runtime::spawn_blocking`](tokio::runtime::Runtime::spawn_blocking) .
|
||||
pub fn run_blocking_until_ctrl_c<F, E>(self, fut: F) -> Result<(), E>
|
||||
where
|
||||
F: Future<Output = Result<(), E>> + Send + 'static,
|
||||
@ -104,7 +104,7 @@ impl CliRunner {
|
||||
}
|
||||
}
|
||||
|
||||
/// [CliRunner] configuration when executing commands asynchronously
|
||||
/// [`CliRunner`] configuration when executing commands asynchronously
|
||||
struct AsyncCliRunner {
|
||||
context: CliContext,
|
||||
task_manager: TaskManager,
|
||||
@ -124,7 +124,7 @@ impl AsyncCliRunner {
|
||||
}
|
||||
}
|
||||
|
||||
/// Additional context provided by the [CliRunner] when executing commands
|
||||
/// Additional context provided by the [`CliRunner`] when executing commands
|
||||
#[derive(Debug)]
|
||||
pub struct CliContext {
|
||||
/// Used to execute/spawn tasks
|
||||
|
||||
@ -28,7 +28,7 @@ pub struct Config {
|
||||
}
|
||||
|
||||
impl Config {
|
||||
/// Returns the [PeersConfig] for the node.
|
||||
/// Returns the [`PeersConfig`] for the node.
|
||||
///
|
||||
/// If a peers file is provided, the basic nodes from the file are added to the configuration.
|
||||
pub fn peers_config_with_basic_nodes_from_file(
|
||||
@ -142,7 +142,7 @@ pub struct BodiesConfig {
|
||||
pub downloader_request_limit: u64,
|
||||
/// The maximum number of block bodies returned at once from the stream
|
||||
///
|
||||
/// Default: 1_000
|
||||
/// Default: `1_000`
|
||||
pub downloader_stream_batch_size: usize,
|
||||
/// The size of the internal block buffer in bytes.
|
||||
///
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! A [Consensus] implementation for local testing purposes
|
||||
//! that automatically seals blocks.
|
||||
//!
|
||||
//! The Mining task polls a [MiningMode], and will return a list of transactions that are ready to
|
||||
//! The Mining task polls a [`MiningMode`], and will return a list of transactions that are ready to
|
||||
//! be mined.
|
||||
//!
|
||||
//! These downloaders poll the miner, assemble the block, and return transactions that are ready to
|
||||
@ -57,7 +57,7 @@ pub struct AutoSealConsensus {
|
||||
}
|
||||
|
||||
impl AutoSealConsensus {
|
||||
/// Create a new instance of [AutoSealConsensus]
|
||||
/// Create a new instance of [`AutoSealConsensus`]
|
||||
pub fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
Self { chain_spec }
|
||||
}
|
||||
@ -143,7 +143,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the [MiningMode] it operates in, default is [MiningMode::Auto]
|
||||
/// Sets the [`MiningMode`] it operates in, default is [`MiningMode::Auto`]
|
||||
pub fn mode(mut self, mode: MiningMode) -> Self {
|
||||
self.mode = mode;
|
||||
self
|
||||
|
||||
@ -7,7 +7,7 @@ use reth_stages_api::PipelineError;
|
||||
pub type BeaconEngineResult<Ok> = Result<Ok, BeaconConsensusEngineError>;
|
||||
|
||||
/// The error type for the beacon consensus engine service
|
||||
/// [BeaconConsensusEngine](crate::BeaconConsensusEngine)
|
||||
/// [`BeaconConsensusEngine`](crate::BeaconConsensusEngine)
|
||||
///
|
||||
/// Represents all possible error cases for the beacon consensus engine.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@ -24,7 +24,7 @@ pub enum BeaconConsensusEngineError {
|
||||
/// Hook error.
|
||||
#[error(transparent)]
|
||||
Hook(#[from] EngineHookError),
|
||||
/// Common error. Wrapper around [RethError].
|
||||
/// Common error. Wrapper around [`RethError`].
|
||||
#[error(transparent)]
|
||||
Common(#[from] RethError),
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ use reth_primitives::{SealedBlock, SealedHeader, B256};
|
||||
use reth_rpc_types::engine::ForkchoiceState;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
/// Events emitted by [crate::BeaconConsensusEngine].
|
||||
/// Events emitted by [`crate::BeaconConsensusEngine`].
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum BeaconConsensusEngineEvent {
|
||||
/// The fork choice state was updated, and the current fork choice status
|
||||
|
||||
@ -38,26 +38,26 @@ impl ForkchoiceStateTracker {
|
||||
self.last_valid = Some(state);
|
||||
}
|
||||
|
||||
/// Returns the [ForkchoiceStatus] of the latest received FCU.
|
||||
/// Returns the [`ForkchoiceStatus`] of the latest received FCU.
|
||||
///
|
||||
/// Caution: this can be invalid.
|
||||
pub(crate) fn latest_status(&self) -> Option<ForkchoiceStatus> {
|
||||
self.latest.as_ref().map(|s| s.status)
|
||||
}
|
||||
|
||||
/// Returns whether the latest received FCU is valid: [ForkchoiceStatus::Valid]
|
||||
/// Returns whether the latest received FCU is valid: [`ForkchoiceStatus::Valid`]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn is_latest_valid(&self) -> bool {
|
||||
self.latest_status().map(|s| s.is_valid()).unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Returns whether the latest received FCU is syncing: [ForkchoiceStatus::Syncing]
|
||||
/// Returns whether the latest received FCU is syncing: [`ForkchoiceStatus::Syncing`]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn is_latest_syncing(&self) -> bool {
|
||||
self.latest_status().map(|s| s.is_syncing()).unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Returns whether the latest received FCU is syncing: [ForkchoiceStatus::Invalid]
|
||||
/// Returns whether the latest received FCU is syncing: [`ForkchoiceStatus::Invalid`]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn is_latest_invalid(&self) -> bool {
|
||||
self.latest_status().map(|s| s.is_invalid()).unwrap_or(false)
|
||||
@ -75,7 +75,7 @@ impl ForkchoiceStateTracker {
|
||||
self.last_syncing.as_ref().map(|s| s.head_block_hash)
|
||||
}
|
||||
|
||||
/// Returns the last received ForkchoiceState to which we need to sync.
|
||||
/// Returns the last received `ForkchoiceState` to which we need to sync.
|
||||
pub(crate) const fn sync_target_state(&self) -> Option<ForkchoiceState> {
|
||||
self.last_syncing
|
||||
}
|
||||
@ -94,7 +94,7 @@ pub(crate) struct ReceivedForkchoiceState {
|
||||
status: ForkchoiceStatus,
|
||||
}
|
||||
|
||||
/// A simplified representation of [PayloadStatusEnum] specifically for FCU.
|
||||
/// A simplified representation of [`PayloadStatusEnum`] specifically for FCU.
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||
pub enum ForkchoiceStatus {
|
||||
/// The forkchoice state is valid.
|
||||
@ -118,7 +118,7 @@ impl ForkchoiceStatus {
|
||||
matches!(self, Self::Syncing)
|
||||
}
|
||||
|
||||
/// Converts the general purpose [PayloadStatusEnum] into a [ForkchoiceStatus].
|
||||
/// Converts the general purpose [`PayloadStatusEnum`] into a [`ForkchoiceStatus`].
|
||||
pub(crate) const fn from_payload_status(status: &PayloadStatusEnum) -> Self {
|
||||
match status {
|
||||
PayloadStatusEnum::Valid | PayloadStatusEnum::Accepted => {
|
||||
@ -137,7 +137,7 @@ impl From<PayloadStatusEnum> for ForkchoiceStatus {
|
||||
}
|
||||
}
|
||||
|
||||
/// A helper type to check represent hashes of a [ForkchoiceState]
|
||||
/// A helper type to check represent hashes of a [`ForkchoiceState`]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum ForkchoiceStateHash {
|
||||
Head(B256),
|
||||
@ -146,7 +146,7 @@ pub(crate) enum ForkchoiceStateHash {
|
||||
}
|
||||
|
||||
impl ForkchoiceStateHash {
|
||||
/// Tries to find a matching hash in the given [ForkchoiceState].
|
||||
/// Tries to find a matching hash in the given [`ForkchoiceState`].
|
||||
pub(crate) fn find(state: &ForkchoiceState, hash: B256) -> Option<Self> {
|
||||
if state.head_block_hash == hash {
|
||||
Some(Self::Head(hash))
|
||||
@ -159,7 +159,7 @@ impl ForkchoiceStateHash {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if this is the head hash of the [ForkchoiceState]
|
||||
/// Returns true if this is the head hash of the [`ForkchoiceState`]
|
||||
pub(crate) const fn is_head(&self) -> bool {
|
||||
matches!(self, Self::Head(_))
|
||||
}
|
||||
|
||||
@ -18,8 +18,8 @@ pub(crate) struct PolledHook {
|
||||
/// Manages hooks under the control of the engine.
|
||||
///
|
||||
/// This type polls the initialized hooks one by one, respecting the DB access level
|
||||
/// (i.e. [crate::hooks::EngineHookDBAccessLevel::ReadWrite] that enforces running at most one such
|
||||
/// hook).
|
||||
/// (i.e. [`crate::hooks::EngineHookDBAccessLevel::ReadWrite`] that enforces running at most one
|
||||
/// such hook).
|
||||
pub(crate) struct EngineHooksController {
|
||||
/// Collection of hooks.
|
||||
///
|
||||
|
||||
@ -99,7 +99,7 @@ pub enum EngineHookError {
|
||||
/// Hook channel closed.
|
||||
#[error("hook channel closed")]
|
||||
ChannelClosed,
|
||||
/// Common error. Wrapper around [RethError].
|
||||
/// Common error. Wrapper around [`RethError`].
|
||||
#[error(transparent)]
|
||||
Common(#[from] RethError),
|
||||
/// An internal error occurred.
|
||||
|
||||
@ -77,11 +77,11 @@ impl<DB: Database + 'static> PruneHook<DB> {
|
||||
}
|
||||
|
||||
/// This will try to spawn the pruner if it is idle:
|
||||
/// 1. Check if pruning is needed through [Pruner::is_pruning_needed].
|
||||
/// 1. Check if pruning is needed through [`Pruner::is_pruning_needed`].
|
||||
///
|
||||
/// 2.1. If pruning is needed, pass tip block number to the [Pruner::run] and spawn it in a
|
||||
/// separate task. Set pruner state to [PrunerState::Running].
|
||||
/// 2.2. If pruning is not needed, set pruner state back to [PrunerState::Idle].
|
||||
/// 2.1. If pruning is needed, pass tip block number to the [`Pruner::run`] and spawn it in a
|
||||
/// separate task. Set pruner state to [`PrunerState::Running`].
|
||||
/// 2.2. If pruning is not needed, set pruner state back to [`PrunerState::Idle`].
|
||||
///
|
||||
/// If pruner is already running, do nothing.
|
||||
fn try_spawn_pruner(&mut self, tip_block_number: BlockNumber) -> Option<EngineHookEvent> {
|
||||
@ -141,8 +141,8 @@ impl<DB: Database + 'static> EngineHook for PruneHook<DB> {
|
||||
|
||||
/// The possible pruner states within the sync controller.
|
||||
///
|
||||
/// [PrunerState::Idle] means that the pruner is currently idle.
|
||||
/// [PrunerState::Running] means that the pruner is currently running.
|
||||
/// [`PrunerState::Idle`] means that the pruner is currently idle.
|
||||
/// [`PrunerState::Running`] means that the pruner is currently running.
|
||||
///
|
||||
/// NOTE: The differentiation between these two states is important, because when the pruner is
|
||||
/// running, it acquires the write lock over the database. This means that we cannot forward to the
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//! StaticFile hook for the engine implementation.
|
||||
//! `StaticFile` hook for the engine implementation.
|
||||
|
||||
use crate::{
|
||||
engine::hooks::{EngineHook, EngineHookContext, EngineHookError, EngineHookEvent},
|
||||
@ -16,12 +16,12 @@ use tracing::trace;
|
||||
|
||||
/// Manages producing static files under the control of the engine.
|
||||
///
|
||||
/// This type controls the [StaticFileProducer].
|
||||
/// This type controls the [`StaticFileProducer`].
|
||||
#[derive(Debug)]
|
||||
pub struct StaticFileHook<DB> {
|
||||
/// The current state of the static_file_producer.
|
||||
/// The current state of the `static_file_producer`.
|
||||
state: StaticFileProducerState<DB>,
|
||||
/// The type that can spawn the static_file_producer task.
|
||||
/// The type that can spawn the `static_file_producer` task.
|
||||
task_spawner: Box<dyn TaskSpawner>,
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ impl<DB: Database + 'static> StaticFileHook<DB> {
|
||||
Self { state: StaticFileProducerState::Idle(Some(static_file_producer)), task_spawner }
|
||||
}
|
||||
|
||||
/// Advances the static_file_producer state.
|
||||
/// Advances the `static_file_producer` state.
|
||||
///
|
||||
/// This checks for the result in the channel, or returns pending if the static_file_producer is
|
||||
/// idle.
|
||||
/// This checks for the result in the channel, or returns pending if the `static_file_producer`
|
||||
/// is idle.
|
||||
fn poll_static_file_producer(
|
||||
&mut self,
|
||||
cx: &mut Context<'_>,
|
||||
@ -67,19 +67,19 @@ impl<DB: Database + 'static> StaticFileHook<DB> {
|
||||
Poll::Ready(Ok(event))
|
||||
}
|
||||
|
||||
/// This will try to spawn the static_file_producer if it is idle:
|
||||
/// This will try to spawn the `static_file_producer` if it is idle:
|
||||
/// 1. Check if producing static files is needed through
|
||||
/// [StaticFileProducer::get_static_file_targets](reth_static_file::StaticFileProducerInner::get_static_file_targets)
|
||||
/// and then [StaticFileTargets::any](reth_static_file::StaticFileTargets::any).
|
||||
/// [`StaticFileProducer::get_static_file_targets`](reth_static_file::StaticFileProducerInner::get_static_file_targets)
|
||||
/// and then [`StaticFileTargets::any`](reth_static_file::StaticFileTargets::any).
|
||||
///
|
||||
/// 2.1. If producing static files is needed, pass static file request to the
|
||||
/// [StaticFileProducer::run](reth_static_file::StaticFileProducerInner::run) and
|
||||
/// [`StaticFileProducer::run`](reth_static_file::StaticFileProducerInner::run) and
|
||||
/// spawn it in a separate task. Set static file producer state to
|
||||
/// [StaticFileProducerState::Running].
|
||||
/// [`StaticFileProducerState::Running`].
|
||||
/// 2.2. If producing static files is not needed, set static file producer state back to
|
||||
/// [StaticFileProducerState::Idle].
|
||||
/// [`StaticFileProducerState::Idle`].
|
||||
///
|
||||
/// If static_file_producer is already running, do nothing.
|
||||
/// If `static_file_producer` is already running, do nothing.
|
||||
fn try_spawn_static_file_producer(
|
||||
&mut self,
|
||||
finalized_block_number: BlockNumber,
|
||||
@ -157,14 +157,14 @@ impl<DB: Database + 'static> EngineHook for StaticFileHook<DB> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The possible static_file_producer states within the sync controller.
|
||||
/// The possible `static_file_producer` states within the sync controller.
|
||||
///
|
||||
/// [StaticFileProducerState::Idle] means that the static file producer is currently idle.
|
||||
/// [StaticFileProducerState::Running] means that the static file producer is currently running.
|
||||
/// [`StaticFileProducerState::Idle`] means that the static file producer is currently idle.
|
||||
/// [`StaticFileProducerState::Running`] means that the static file producer is currently running.
|
||||
#[derive(Debug)]
|
||||
enum StaticFileProducerState<DB> {
|
||||
/// [StaticFileProducer] is idle.
|
||||
/// [`StaticFileProducer`] is idle.
|
||||
Idle(Option<StaticFileProducer<DB>>),
|
||||
/// [StaticFileProducer] is running and waiting for a response
|
||||
/// [`StaticFileProducer`] is running and waiting for a response
|
||||
Running(oneshot::Receiver<StaticFileProducerWithResult<DB>>),
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ use tokio::sync::oneshot;
|
||||
|
||||
/// Represents the outcome of forkchoice update.
|
||||
///
|
||||
/// This is a future that resolves to [ForkChoiceUpdateResult]
|
||||
/// This is a future that resolves to [`ForkChoiceUpdateResult`]
|
||||
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||
#[derive(Debug)]
|
||||
pub struct OnForkChoiceUpdated {
|
||||
@ -32,7 +32,7 @@ pub struct OnForkChoiceUpdated {
|
||||
// === impl OnForkChoiceUpdated ===
|
||||
|
||||
impl OnForkChoiceUpdated {
|
||||
/// Returns the determined status of the received ForkchoiceState.
|
||||
/// Returns the determined status of the received `ForkchoiceState`.
|
||||
pub const fn forkchoice_status(&self) -> ForkchoiceStatus {
|
||||
self.forkchoice_status
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ pub const MIN_BLOCKS_FOR_PIPELINE_RUN: u64 = EPOCH_SLOTS;
|
||||
/// received by Engine API (JSON-RPC).
|
||||
///
|
||||
/// The consensus engine is idle until it receives the first
|
||||
/// [BeaconEngineMessage::ForkchoiceUpdated] message from the CL which would initiate the sync. At
|
||||
/// [`BeaconEngineMessage::ForkchoiceUpdated`] message from the CL which would initiate the sync. At
|
||||
/// first, the consensus engine would run the [Pipeline] until the latest known block hash.
|
||||
/// Afterward, it would attempt to create/restore the [`BlockchainTreeEngine`] from the blocks
|
||||
/// that are currently available. In case the restoration is successful, the consensus engine would
|
||||
@ -107,10 +107,10 @@ pub const MIN_BLOCKS_FOR_PIPELINE_RUN: u64 = EPOCH_SLOTS;
|
||||
/// ## New Payload (`engine_newPayloadV{}`)
|
||||
///
|
||||
/// The engine receives new payloads from the CL. If the payload is connected to the canonical
|
||||
/// chain, it will be fully validated added to a chain in the [BlockchainTreeEngine]: `VALID`
|
||||
/// chain, it will be fully validated added to a chain in the [`BlockchainTreeEngine`]: `VALID`
|
||||
///
|
||||
/// If the payload's chain is disconnected (at least 1 block is missing) then it will be buffered:
|
||||
/// `SYNCING` ([BlockStatus::Disconnected]).
|
||||
/// `SYNCING` ([`BlockStatus::Disconnected`]).
|
||||
///
|
||||
/// ## Forkchoice Update (FCU) (`engine_forkchoiceUpdatedV{}`)
|
||||
///
|
||||
@ -125,14 +125,14 @@ pub const MIN_BLOCKS_FOR_PIPELINE_RUN: u64 = EPOCH_SLOTS;
|
||||
///
|
||||
/// ### The chain is connected
|
||||
///
|
||||
/// All blocks of the `head_hash`'s chain are present in the [BlockchainTreeEngine] and are
|
||||
/// All blocks of the `head_hash`'s chain are present in the [`BlockchainTreeEngine`] and are
|
||||
/// committed to the canonical chain. This also includes reorgs.
|
||||
///
|
||||
/// ### The chain is disconnected
|
||||
///
|
||||
/// In this case the [BlockchainTreeEngine] doesn't know how the new chain connects to the existing
|
||||
/// canonical chain. It could be a simple commit (new blocks extend the current head) or a re-org
|
||||
/// that requires unwinding the canonical chain.
|
||||
/// In this case the [`BlockchainTreeEngine`] doesn't know how the new chain connects to the
|
||||
/// existing canonical chain. It could be a simple commit (new blocks extend the current head) or a
|
||||
/// re-org that requires unwinding the canonical chain.
|
||||
///
|
||||
/// This further distinguishes between two variants:
|
||||
///
|
||||
@ -231,7 +231,7 @@ where
|
||||
Client: HeadersClient + BodiesClient + Clone + Unpin + 'static,
|
||||
EngineT: EngineTypes + Unpin + 'static,
|
||||
{
|
||||
/// Create a new instance of the [BeaconConsensusEngine].
|
||||
/// Create a new instance of the [`BeaconConsensusEngine`].
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
client: Client,
|
||||
@ -264,16 +264,17 @@ where
|
||||
)
|
||||
}
|
||||
|
||||
/// Create a new instance of the [BeaconConsensusEngine] using the given channel to configure
|
||||
/// the [BeaconEngineMessage] communication channel.
|
||||
/// Create a new instance of the [`BeaconConsensusEngine`] using the given channel to configure
|
||||
/// the [`BeaconEngineMessage`] communication channel.
|
||||
///
|
||||
/// By default the engine is started with idle pipeline.
|
||||
/// The pipeline can be launched immediately in one of the following ways descending in
|
||||
/// priority:
|
||||
/// - Explicit [Option::Some] target block hash provided via a constructor argument.
|
||||
/// - Explicit [`Option::Some`] target block hash provided via a constructor argument.
|
||||
/// - The process was previously interrupted amidst the pipeline run. This is checked by
|
||||
/// comparing the checkpoints of the first ([StageId::Headers]) and last ([StageId::Finish])
|
||||
/// stages. In this case, the latest available header in the database is used as the target.
|
||||
/// comparing the checkpoints of the first ([`StageId::Headers`]) and last
|
||||
/// ([`StageId::Finish`]) stages. In this case, the latest available header in the database is
|
||||
/// used as the target.
|
||||
///
|
||||
/// Propagates any database related error.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@ -334,7 +335,7 @@ where
|
||||
Ok((this, handle))
|
||||
}
|
||||
|
||||
/// Returns current [EngineHookContext] that's used for polling engine hooks.
|
||||
/// Returns current [`EngineHookContext`] that's used for polling engine hooks.
|
||||
fn current_engine_hook_context(&self) -> RethResult<EngineHookContext> {
|
||||
Ok(EngineHookContext {
|
||||
tip_block_number: self.blockchain.canonical_tip().number,
|
||||
@ -732,7 +733,7 @@ where
|
||||
/// - It is fully validated and deemed VALID
|
||||
/// - Any other ancestor of the invalid payload with a higher blockNumber is INVALID
|
||||
/// - 0x0000000000000000000000000000000000000000000000000000000000000000 if the above
|
||||
/// conditions are satisfied by a PoW block.
|
||||
/// conditions are satisfied by a `PoW` block.
|
||||
/// - null if client software cannot determine the ancestor of the invalid payload satisfying
|
||||
/// the above conditions.
|
||||
fn latest_valid_hash_for_invalid_payload(
|
||||
@ -841,9 +842,9 @@ where
|
||||
/// made canonical.
|
||||
///
|
||||
/// If the forkchoice state is consistent, this will return Ok(None). Otherwise, this will
|
||||
/// return an instance of [OnForkChoiceUpdated] that is INVALID.
|
||||
/// return an instance of [`OnForkChoiceUpdated`] that is INVALID.
|
||||
///
|
||||
/// This also updates the safe and finalized blocks in the [CanonChainTracker], if they are
|
||||
/// This also updates the safe and finalized blocks in the [`CanonChainTracker`], if they are
|
||||
/// consistent with the head block.
|
||||
fn ensure_consistent_forkchoice_state(
|
||||
&self,
|
||||
@ -971,7 +972,7 @@ where
|
||||
///
|
||||
/// If the newest head is not invalid, then this will trigger a new pipeline run to sync the gap
|
||||
///
|
||||
/// See [Self::on_forkchoice_updated] and [BlockchainTreeEngine::make_canonical].
|
||||
/// See [`Self::on_forkchoice_updated`] and [`BlockchainTreeEngine::make_canonical`].
|
||||
fn on_failed_canonical_forkchoice_update(
|
||||
&mut self,
|
||||
state: &ForkchoiceState,
|
||||
@ -1320,7 +1321,7 @@ where
|
||||
/// Attempt to form a new canonical chain based on the current sync target.
|
||||
///
|
||||
/// This is invoked when we successfully __downloaded__ a new block from the network which
|
||||
/// resulted in [BlockStatus::Valid].
|
||||
/// resulted in [`BlockStatus::Valid`].
|
||||
///
|
||||
/// Note: This will not succeed if the sync target has changed since the block download request
|
||||
/// was issued and the new target is still disconnected and additional missing blocks are
|
||||
@ -1385,7 +1386,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Event handler for events emitted by the [EngineSyncController].
|
||||
/// Event handler for events emitted by the [`EngineSyncController`].
|
||||
///
|
||||
/// This returns a result to indicate whether the engine future should resolve (fatal error).
|
||||
fn on_sync_event(
|
||||
@ -1785,7 +1786,7 @@ where
|
||||
}
|
||||
|
||||
/// On initialization, the consensus engine will poll the message receiver and return
|
||||
/// [Poll::Pending] until the first forkchoice update message is received.
|
||||
/// [`Poll::Pending`] until the first forkchoice update message is received.
|
||||
///
|
||||
/// As soon as the consensus engine receives the first forkchoice updated message and updates the
|
||||
/// local forkchoice state, it will launch the pipeline to sync to the head hash.
|
||||
@ -1946,13 +1947,13 @@ enum BlockchainTreeAction<EngineT: EngineTypes> {
|
||||
/// Action to insert a new block that we successfully downloaded from the network.
|
||||
/// There are several outcomes for inserting a downloaded block into the tree:
|
||||
///
|
||||
/// ## [BlockStatus::Valid]
|
||||
/// ## [`BlockStatus::Valid`]
|
||||
///
|
||||
/// The block is connected to the current canonical chain and is valid.
|
||||
/// If the block is an ancestor of the current forkchoice head, then we can try again to
|
||||
/// make the chain canonical.
|
||||
///
|
||||
/// ## [BlockStatus::Disconnected]
|
||||
/// ## [`BlockStatus::Disconnected`]
|
||||
///
|
||||
/// The block is not connected to the canonical chain, and we need to download the
|
||||
/// missing parent first.
|
||||
|
||||
@ -29,7 +29,7 @@ use tracing::trace;
|
||||
/// This type controls the [Pipeline] and supports (single) full block downloads.
|
||||
///
|
||||
/// Caution: If the pipeline is running, this type will not emit blocks downloaded from the network
|
||||
/// [EngineSyncEvent::FetchedFullBlock] until the pipeline is idle to prevent commits to the
|
||||
/// [`EngineSyncEvent::FetchedFullBlock`] until the pipeline is idle to prevent commits to the
|
||||
/// database while the pipeline is still active.
|
||||
pub(crate) struct EngineSyncController<DB, Client>
|
||||
where
|
||||
@ -359,7 +359,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// A wrapper type around [SealedBlock] that implements the [Ord] trait by block number.
|
||||
/// A wrapper type around [`SealedBlock`] that implements the [Ord] trait by block number.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
struct OrderedSealedBlock(SealedBlock);
|
||||
|
||||
@ -375,7 +375,7 @@ impl Ord for OrderedSealedBlock {
|
||||
}
|
||||
}
|
||||
|
||||
/// The event type emitted by the [EngineSyncController].
|
||||
/// The event type emitted by the [`EngineSyncController`].
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum EngineSyncEvent {
|
||||
/// A full block has been downloaded from the network.
|
||||
@ -402,8 +402,8 @@ pub(crate) enum EngineSyncEvent {
|
||||
|
||||
/// The possible pipeline states within the sync controller.
|
||||
///
|
||||
/// [PipelineState::Idle] means that the pipeline is currently idle.
|
||||
/// [PipelineState::Running] means that the pipeline is currently running.
|
||||
/// [`PipelineState::Idle`] means that the pipeline is currently idle.
|
||||
/// [`PipelineState::Running`] means that the pipeline is currently running.
|
||||
///
|
||||
/// NOTE: The differentiation between these two states is important, because when the pipeline is
|
||||
/// running, it acquires the write lock over the database. This means that we cannot forward to the
|
||||
@ -451,7 +451,7 @@ mod tests {
|
||||
}
|
||||
|
||||
impl TestPipelineBuilder {
|
||||
/// Create a new [TestPipelineBuilder].
|
||||
/// Create a new [`TestPipelineBuilder`].
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
pipeline_exec_outputs: VecDeque::new(),
|
||||
@ -515,7 +515,7 @@ mod tests {
|
||||
}
|
||||
|
||||
impl<Client> TestSyncControllerBuilder<Client> {
|
||||
/// Create a new [TestSyncControllerBuilder].
|
||||
/// Create a new [`TestSyncControllerBuilder`].
|
||||
const fn new() -> Self {
|
||||
Self { max_block: None, client: None }
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ pub mod noop;
|
||||
/// test helpers for mocking consensus
|
||||
pub mod test_utils;
|
||||
|
||||
/// Post execution input passed to [Consensus::validate_block_post_execution].
|
||||
/// Post execution input passed to [`Consensus::validate_block_post_execution`].
|
||||
#[derive(Debug)]
|
||||
pub struct PostExecutionInput<'a> {
|
||||
/// Receipts of the block.
|
||||
@ -320,7 +320,7 @@ pub enum ConsensusError {
|
||||
#[error(transparent)]
|
||||
InvalidTransaction(#[from] InvalidTransactionError),
|
||||
|
||||
/// Error type transparently wrapping HeaderValidationError.
|
||||
/// Error type transparently wrapping `HeaderValidationError`.
|
||||
#[error(transparent)]
|
||||
HeaderValidationError(#[from] HeaderValidationError),
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ use thiserror::Error;
|
||||
/// Thrown when the payload or attributes are known to be invalid before processing.
|
||||
///
|
||||
/// This is used mainly for
|
||||
/// [validate_version_specific_fields](crate::validate_version_specific_fields), which validates
|
||||
/// [`validate_version_specific_fields`](crate::validate_version_specific_fields), which validates
|
||||
/// both execution payloads and forkchoice update attributes with respect to a method version.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum EngineObjectValidationError {
|
||||
@ -37,14 +37,14 @@ pub enum VersionSpecificValidationError {
|
||||
/// block root
|
||||
#[error("parent beacon block root not supported before V3")]
|
||||
ParentBeaconBlockRootNotSupportedBeforeV3,
|
||||
/// Thrown if engine_forkchoiceUpdatedV1 or engine_newPayloadV1 contains withdrawals
|
||||
/// Thrown if `engine_forkchoiceUpdatedV1` or `engine_newPayloadV1` contains withdrawals
|
||||
#[error("withdrawals not supported in V1")]
|
||||
WithdrawalsNotSupportedInV1,
|
||||
/// Thrown if engine_forkchoiceUpdated or engine_newPayload contains no withdrawals after
|
||||
/// Thrown if `engine_forkchoiceUpdated` or `engine_newPayload` contains no withdrawals after
|
||||
/// Shanghai
|
||||
#[error("no withdrawals post-Shanghai")]
|
||||
NoWithdrawalsPostShanghai,
|
||||
/// Thrown if engine_forkchoiceUpdated or engine_newPayload contains withdrawals before
|
||||
/// Thrown if `engine_forkchoiceUpdated` or `engine_newPayload` contains withdrawals before
|
||||
/// Shanghai
|
||||
#[error("withdrawals pre-Shanghai")]
|
||||
HasWithdrawalsPreShanghai,
|
||||
|
||||
@ -12,7 +12,7 @@ use core::fmt;
|
||||
use reth_primitives::ChainSpec;
|
||||
|
||||
/// Contains traits to abstract over payload attributes types and default implementations of the
|
||||
/// [PayloadAttributes] trait for ethereum mainnet and optimism types.
|
||||
/// [`PayloadAttributes`] trait for ethereum mainnet and optimism types.
|
||||
pub mod traits;
|
||||
use serde::{de::DeserializeOwned, ser::Serialize};
|
||||
pub use traits::{BuiltPayload, PayloadAttributes, PayloadBuilderAttributes};
|
||||
@ -21,7 +21,7 @@ pub use traits::{BuiltPayload, PayloadAttributes, PayloadBuilderAttributes};
|
||||
pub mod error;
|
||||
pub use error::{EngineObjectValidationError, VersionSpecificValidationError};
|
||||
|
||||
/// Contains types used in implementations of the [PayloadAttributes] trait.
|
||||
/// Contains types used in implementations of the [`PayloadAttributes`] trait.
|
||||
pub mod payload;
|
||||
pub use payload::PayloadOrAttributes;
|
||||
|
||||
@ -70,7 +70,7 @@ pub trait EngineTypes:
|
||||
/// * If V3, this ensures that the payload timestamp is within the Cancun timestamp.
|
||||
/// * If V4, this ensures that the payload timestamp is within the Prague timestamp.
|
||||
///
|
||||
/// Otherwise, this will return [EngineObjectValidationError::UnsupportedFork].
|
||||
/// Otherwise, this will return [`EngineObjectValidationError::UnsupportedFork`].
|
||||
pub fn validate_payload_timestamp(
|
||||
chain_spec: &ChainSpec,
|
||||
version: EngineApiMessageVersion,
|
||||
@ -187,13 +187,13 @@ pub fn validate_withdrawals_presence(
|
||||
/// Before Cancun, the `parentBeaconBlockRoot` field must be [None].
|
||||
///
|
||||
/// If the engine API message version is V1 or V2, and the timestamp is post-Cancun, then this will
|
||||
/// return [EngineObjectValidationError::UnsupportedFork].
|
||||
/// return [`EngineObjectValidationError::UnsupportedFork`].
|
||||
///
|
||||
/// If the timestamp is before the Cancun fork and the engine API message version is V3, then this
|
||||
/// will return [EngineObjectValidationError::UnsupportedFork].
|
||||
/// will return [`EngineObjectValidationError::UnsupportedFork`].
|
||||
///
|
||||
/// If the engine API message version is V3, but the `parentBeaconBlockRoot` is [None], then
|
||||
/// this will return [VersionSpecificValidationError::NoParentBeaconBlockRootPostCancun].
|
||||
/// this will return [`VersionSpecificValidationError::NoParentBeaconBlockRootPostCancun`].
|
||||
///
|
||||
/// This implements the following Engine API spec rules:
|
||||
///
|
||||
@ -317,10 +317,10 @@ impl MessageValidationKind {
|
||||
/// Validates the presence or exclusion of fork-specific fields based on the ethereum execution
|
||||
/// payload, or payload attributes, and the message version.
|
||||
///
|
||||
/// The object being validated is provided by the [PayloadOrAttributes] argument, which can be
|
||||
/// The object being validated is provided by the [`PayloadOrAttributes`] argument, which can be
|
||||
/// either an execution payload, or payload attributes.
|
||||
///
|
||||
/// The version is provided by the [EngineApiMessageVersion] argument.
|
||||
/// The version is provided by the [`EngineApiMessageVersion`] argument.
|
||||
pub fn validate_version_specific_fields<Type>(
|
||||
chain_spec: &ChainSpec,
|
||||
version: EngineApiMessageVersion,
|
||||
|
||||
@ -4,10 +4,10 @@ use reth_rpc_types::engine::ExecutionPayload;
|
||||
|
||||
use super::MessageValidationKind;
|
||||
|
||||
/// Either an [ExecutionPayload] or a types that implements the [PayloadAttributes] trait.
|
||||
/// Either an [`ExecutionPayload`] or a types that implements the [`PayloadAttributes`] trait.
|
||||
#[derive(Debug)]
|
||||
pub enum PayloadOrAttributes<'a, AttributesType> {
|
||||
/// An [ExecutionPayload] and optional parent beacon block root.
|
||||
/// An [`ExecutionPayload`] and optional parent beacon block root.
|
||||
ExecutionPayload {
|
||||
/// The inner execution payload
|
||||
payload: &'a ExecutionPayload,
|
||||
@ -22,7 +22,7 @@ impl<'a, AttributesType> PayloadOrAttributes<'a, AttributesType>
|
||||
where
|
||||
AttributesType: PayloadAttributes,
|
||||
{
|
||||
/// Construct a [PayloadOrAttributes] from an [ExecutionPayload] and optional parent beacon
|
||||
/// Construct a [`PayloadOrAttributes`] from an [`ExecutionPayload`] and optional parent beacon
|
||||
/// block root.
|
||||
pub const fn from_execution_payload(
|
||||
payload: &'a ExecutionPayload,
|
||||
@ -55,7 +55,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a [MessageValidationKind] for the payload or attributes.
|
||||
/// Return a [`MessageValidationKind`] for the payload or attributes.
|
||||
pub const fn message_validation_kind(&self) -> MessageValidationKind {
|
||||
match self {
|
||||
Self::ExecutionPayload { .. } => MessageValidationKind::Payload,
|
||||
|
||||
@ -10,7 +10,7 @@ use reth_rpc_types::{
|
||||
Withdrawal,
|
||||
};
|
||||
|
||||
/// Represents a built payload type that contains a built [SealedBlock] and can be converted into
|
||||
/// Represents a built payload type that contains a built [`SealedBlock`] and can be converted into
|
||||
/// engine API execution payloads.
|
||||
pub trait BuiltPayload: Send + Sync + std::fmt::Debug {
|
||||
/// Returns the built block (sealed)
|
||||
@ -26,14 +26,14 @@ pub trait BuiltPayload: Send + Sync + std::fmt::Debug {
|
||||
/// receives, into a type that the payload builder can use.
|
||||
pub trait PayloadBuilderAttributes: Send + Sync + std::fmt::Debug {
|
||||
/// The payload attributes that can be used to construct this type. Used as the argument in
|
||||
/// [PayloadBuilderAttributes::try_new].
|
||||
/// [`PayloadBuilderAttributes::try_new`].
|
||||
type RpcPayloadAttributes;
|
||||
/// The error type used in [PayloadBuilderAttributes::try_new].
|
||||
/// The error type used in [`PayloadBuilderAttributes::try_new`].
|
||||
type Error: std::error::Error;
|
||||
|
||||
/// Creates a new payload builder for the given parent block and the attributes.
|
||||
///
|
||||
/// Derives the unique [PayloadId] for the given parent and attributes
|
||||
/// Derives the unique [`PayloadId`] for the given parent and attributes
|
||||
fn try_new(
|
||||
parent: B256,
|
||||
rpc_payload_attributes: Self::RpcPayloadAttributes,
|
||||
@ -41,7 +41,7 @@ pub trait PayloadBuilderAttributes: Send + Sync + std::fmt::Debug {
|
||||
where
|
||||
Self: Sized;
|
||||
|
||||
/// Returns the [PayloadId] for the running payload job.
|
||||
/// Returns the [`PayloadId`] for the running payload job.
|
||||
fn payload_id(&self) -> PayloadId;
|
||||
|
||||
/// Returns the parent block hash for the running payload job.
|
||||
@ -62,8 +62,8 @@ pub trait PayloadBuilderAttributes: Send + Sync + std::fmt::Debug {
|
||||
/// Returns the withdrawals for the running payload job.
|
||||
fn withdrawals(&self) -> &Withdrawals;
|
||||
|
||||
/// Returns the configured [CfgEnvWithHandlerCfg] and [BlockEnv] for the targeted payload (that
|
||||
/// has the `parent` as its parent).
|
||||
/// Returns the configured [`CfgEnvWithHandlerCfg`] and [`BlockEnv`] for the targeted payload
|
||||
/// (that has the `parent` as its parent).
|
||||
///
|
||||
/// The `chain_spec` is used to determine the correct chain id and hardfork for the payload
|
||||
/// based on its timestamp.
|
||||
@ -94,8 +94,8 @@ pub trait PayloadAttributes:
|
||||
/// Return the parent beacon block root for the payload attributes.
|
||||
fn parent_beacon_block_root(&self) -> Option<B256>;
|
||||
|
||||
/// Ensures that the payload attributes are valid for the given [ChainSpec] and
|
||||
/// [EngineApiMessageVersion].
|
||||
/// Ensures that the payload attributes are valid for the given [`ChainSpec`] and
|
||||
/// [`EngineApiMessageVersion`].
|
||||
fn ensure_well_formed_attributes(
|
||||
&self,
|
||||
chain_spec: &ChainSpec,
|
||||
|
||||
@ -121,7 +121,7 @@ pub struct ForkId {
|
||||
/// See:
|
||||
/// <https://github.com/ethereum/devp2p/blob/master/enr-entries/eth.md#entry-format>
|
||||
///
|
||||
/// for how geth implements ForkId values and forward compatibility.
|
||||
/// for how geth implements `ForkId` values and forward compatibility.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, RlpEncodable)]
|
||||
pub struct EnrForkIdEntry {
|
||||
/// The inner forkid
|
||||
@ -183,7 +183,7 @@ pub enum ValidationError {
|
||||
RemoteStale {
|
||||
/// locally configured forkId
|
||||
local: ForkId,
|
||||
/// ForkId received from remote
|
||||
/// `ForkId` received from remote
|
||||
remote: ForkId,
|
||||
},
|
||||
/// Local node is on an incompatible chain or needs a software update.
|
||||
@ -191,7 +191,7 @@ pub enum ValidationError {
|
||||
LocalIncompatibleOrStale {
|
||||
/// locally configured forkId
|
||||
local: ForkId,
|
||||
/// ForkId received from remote
|
||||
/// `ForkId` received from remote
|
||||
remote: ForkId,
|
||||
},
|
||||
}
|
||||
@ -389,9 +389,9 @@ impl ForkFilter {
|
||||
/// See also [`ForkFilter::set_head`]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct ForkTransition {
|
||||
/// The new, active ForkId
|
||||
/// The new, active `ForkId`
|
||||
pub current: ForkId,
|
||||
/// The previously active ForkId before the transition
|
||||
/// The previously active `ForkId` before the transition
|
||||
pub past: ForkId,
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ pub struct EthBeaconConsensus {
|
||||
}
|
||||
|
||||
impl EthBeaconConsensus {
|
||||
/// Create a new instance of [EthBeaconConsensus]
|
||||
/// Create a new instance of [`EthBeaconConsensus`]
|
||||
pub fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
Self { chain_spec }
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ impl EthPayloadBuilderAttributes {
|
||||
|
||||
/// Creates a new payload builder for the given parent block and the attributes.
|
||||
///
|
||||
/// Derives the unique [PayloadId] for the given parent and attributes
|
||||
/// Derives the unique [`PayloadId`] for the given parent and attributes
|
||||
pub fn new(parent: B256, attributes: PayloadAttributes) -> Self {
|
||||
let id = payload_id(&parent, &attributes);
|
||||
|
||||
@ -200,7 +200,7 @@ impl PayloadBuilderAttributes for EthPayloadBuilderAttributes {
|
||||
|
||||
/// Creates a new payload builder for the given parent block and the attributes.
|
||||
///
|
||||
/// Derives the unique [PayloadId] for the given parent and attributes
|
||||
/// Derives the unique [`PayloadId`] for the given parent and attributes
|
||||
fn try_new(parent: B256, attributes: PayloadAttributes) -> Result<Self, Infallible> {
|
||||
Ok(Self::new(parent, attributes))
|
||||
}
|
||||
@ -293,7 +293,7 @@ impl PayloadBuilderAttributes for EthPayloadBuilderAttributes {
|
||||
}
|
||||
}
|
||||
|
||||
/// Generates the payload id for the configured payload from the [PayloadAttributes].
|
||||
/// Generates the payload id for the configured payload from the [`PayloadAttributes`].
|
||||
///
|
||||
/// Returns an 8-byte identifier by hashing the payload components with sha256 hash.
|
||||
pub(crate) fn payload_id(parent: &B256, attributes: &PayloadAttributes) -> PayloadId {
|
||||
|
||||
@ -17,7 +17,7 @@ sol! {
|
||||
}
|
||||
|
||||
/// Parse [deposit contract](https://etherscan.io/address/0x00000000219ab540356cbb839cbe05303d7705fa)
|
||||
/// (address is from the passed [ChainSpec]) deposits from receipts, and return them as a
|
||||
/// (address is from the passed [`ChainSpec`]) deposits from receipts, and return them as a
|
||||
/// [vector](Vec) of (requests)[Request].
|
||||
pub fn parse_deposits_from_receipts<'a, I>(
|
||||
chain_spec: &ChainSpec,
|
||||
|
||||
@ -131,7 +131,7 @@ where
|
||||
/// # Note
|
||||
///
|
||||
/// It does __not__ apply post-execution changes that do not require an [EVM](Evm), for that see
|
||||
/// [EthBlockExecutor::post_execution].
|
||||
/// [`EthBlockExecutor::post_execution`].
|
||||
fn execute_state_transitions<Ext, DB>(
|
||||
&self,
|
||||
block: &BlockWithSenders,
|
||||
|
||||
@ -25,7 +25,7 @@ use reth_transaction_pool::{
|
||||
pub struct EthereumNode;
|
||||
|
||||
impl EthereumNode {
|
||||
/// Returns a [ComponentsBuilder] configured for a regular Ethereum node.
|
||||
/// Returns a [`ComponentsBuilder`] configured for a regular Ethereum node.
|
||||
pub fn components<Node>() -> ComponentsBuilder<
|
||||
Node,
|
||||
EthereumPoolBuilder,
|
||||
|
||||
@ -97,7 +97,7 @@ pub enum BlockValidationError {
|
||||
DepositRequestDecode(String),
|
||||
}
|
||||
|
||||
/// BlockExecutor Errors
|
||||
/// `BlockExecutor` Errors
|
||||
#[derive(Error, Debug)]
|
||||
pub enum BlockExecutionError {
|
||||
/// Validation error, transparently wrapping `BlockValidationError`
|
||||
@ -148,7 +148,7 @@ impl BlockExecutionError {
|
||||
Self::Other(Box::new(error))
|
||||
}
|
||||
|
||||
/// Create a new [BlockExecutionError::Other] from a given message.
|
||||
/// Create a new [`BlockExecutionError::Other`] from a given message.
|
||||
pub fn msg(msg: impl Display) -> Self {
|
||||
Self::Other(msg.to_string().into())
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ impl From<BundleStateWithReceipts> for BatchBlockExecutionOutput {
|
||||
pub type BundleStateInit =
|
||||
HashMap<Address, (Option<Account>, Option<Account>, HashMap<B256, (U256, U256)>)>;
|
||||
|
||||
/// Types used inside RevertsInit to initialize revms reverts.
|
||||
/// Types used inside `RevertsInit` to initialize revms reverts.
|
||||
pub type AccountRevertInit = (Option<Option<Account>>, Vec<StorageEntry>);
|
||||
|
||||
/// Type used to initialize revms reverts.
|
||||
@ -120,7 +120,7 @@ impl BundleStateWithReceipts {
|
||||
self.bundle.state().iter().map(|(a, acc)| (*a, acc.info.as_ref()))
|
||||
}
|
||||
|
||||
/// Return iterator over all [BundleAccount]s in the bundle
|
||||
/// Return iterator over all [`BundleAccount`]s in the bundle
|
||||
pub fn bundle_accounts_iter(&self) -> impl Iterator<Item = (Address, &BundleAccount)> {
|
||||
self.bundle.state().iter().map(|(a, acc)| (*a, acc))
|
||||
}
|
||||
@ -132,7 +132,7 @@ impl BundleStateWithReceipts {
|
||||
|
||||
/// Get storage if value is known.
|
||||
///
|
||||
/// This means that depending on status we can potentially return U256::ZERO.
|
||||
/// This means that depending on status we can potentially return `U256::ZERO`.
|
||||
pub fn storage(&self, address: &Address, storage_key: U256) -> Option<U256> {
|
||||
self.bundle.account(address).and_then(|a| a.storage_slot(storage_key))
|
||||
}
|
||||
@ -142,8 +142,8 @@ impl BundleStateWithReceipts {
|
||||
self.bundle.bytecode(code_hash).map(Bytecode)
|
||||
}
|
||||
|
||||
/// Returns [HashedPostState] for this bundle state.
|
||||
/// See [HashedPostState::from_bundle_state] for more info.
|
||||
/// Returns [`HashedPostState`] for this bundle state.
|
||||
/// See [`HashedPostState::from_bundle_state`] for more info.
|
||||
pub fn hash_state_slow(&self) -> HashedPostState {
|
||||
HashedPostState::from_bundle_state(&self.bundle.state)
|
||||
}
|
||||
@ -288,7 +288,7 @@ impl BundleStateWithReceipts {
|
||||
self.receipts.extend(other.receipts.receipt_vec);
|
||||
}
|
||||
|
||||
/// Prepends present the state with the given BundleState.
|
||||
/// Prepends present the state with the given `BundleState`.
|
||||
/// It adds changes from the given state but does not override any existing changes.
|
||||
///
|
||||
/// Reverts and receipts are not updated.
|
||||
|
||||
@ -15,7 +15,7 @@ use std::{borrow::Cow, collections::BTreeMap, fmt, ops::RangeInclusive};
|
||||
/// The chain contains the state of accounts after execution of its blocks,
|
||||
/// changesets for those blocks (and their transactions), as well as the blocks themselves.
|
||||
///
|
||||
/// Used inside the BlockchainTree.
|
||||
/// Used inside the `BlockchainTree`.
|
||||
///
|
||||
/// # Warning
|
||||
///
|
||||
@ -25,7 +25,7 @@ pub struct Chain {
|
||||
/// All blocks in this chain.
|
||||
blocks: BTreeMap<BlockNumber, SealedBlockWithSenders>,
|
||||
/// The state of all accounts after execution of the _all_ blocks in this chain's range from
|
||||
/// [Chain::first] to [Chain::tip], inclusive.
|
||||
/// [`Chain::first`] to [`Chain::tip`], inclusive.
|
||||
///
|
||||
/// This state also contains the individual changes that lead to the current state.
|
||||
state: BundleStateWithReceipts,
|
||||
@ -403,7 +403,7 @@ impl<'a> ChainBlocks<'a> {
|
||||
self.blocks.values().flat_map(|block| block.transactions_with_sender())
|
||||
}
|
||||
|
||||
/// Returns an iterator over all [TransactionSignedEcRecovered] in the blocks
|
||||
/// Returns an iterator over all [`TransactionSignedEcRecovered`] in the blocks
|
||||
///
|
||||
/// Note: This clones the transactions since it is assumed this is part of a shared [Chain].
|
||||
#[inline]
|
||||
@ -459,13 +459,13 @@ pub enum ChainSplit {
|
||||
/// Given block split is lower than first block.
|
||||
NoSplitCanonical(Chain),
|
||||
/// Chain is split into two: `[canonical]` and `[pending]`
|
||||
/// The target of this chain split [ChainSplitTarget] belongs to the `canonical` chain.
|
||||
/// The target of this chain split [`ChainSplitTarget`] belongs to the `canonical` chain.
|
||||
Split {
|
||||
/// Contains lower block numbers that are considered canonicalized. It ends with
|
||||
/// the [ChainSplitTarget] block. The state of this chain is now empty and no longer
|
||||
/// the [`ChainSplitTarget`] block. The state of this chain is now empty and no longer
|
||||
/// usable.
|
||||
canonical: Chain,
|
||||
/// Right contains all subsequent blocks __after__ the [ChainSplitTarget] that are still
|
||||
/// Right contains all subsequent blocks __after__ the [`ChainSplitTarget`] that are still
|
||||
/// pending.
|
||||
///
|
||||
/// The state of the original chain is moved here.
|
||||
|
||||
@ -12,7 +12,7 @@ pub use reth_storage_errors::provider::ProviderError;
|
||||
/// A general purpose executor trait that executes an input (e.g. block) and produces an output
|
||||
/// (e.g. state changes and receipts).
|
||||
///
|
||||
/// This executor does not validate the output, see [BatchExecutor] for that.
|
||||
/// This executor does not validate the output, see [`BatchExecutor`] for that.
|
||||
pub trait Executor<DB> {
|
||||
/// The input type for the executor.
|
||||
type Input<'a>;
|
||||
@ -25,7 +25,7 @@ pub trait Executor<DB> {
|
||||
///
|
||||
/// # Note
|
||||
/// Execution happens without any validation of the output. To validate the output, use the
|
||||
/// [BatchExecutor].
|
||||
/// [`BatchExecutor`].
|
||||
///
|
||||
/// # Returns
|
||||
/// The output of the block execution.
|
||||
@ -91,7 +91,7 @@ pub trait BatchExecutor<DB> {
|
||||
///
|
||||
/// Contains the state changes, transaction receipts, and total gas used in the block.
|
||||
///
|
||||
/// TODO(mattsse): combine with BundleStateWithReceipts
|
||||
/// TODO(mattsse): combine with `BundleStateWithReceipts`
|
||||
#[derive(Debug)]
|
||||
pub struct BlockExecutionOutput<T> {
|
||||
/// The changed state of the block after execution.
|
||||
@ -166,8 +166,8 @@ pub trait BlockExecutorProvider: Send + Sync + Clone + Unpin + 'static {
|
||||
///
|
||||
/// # Verification
|
||||
///
|
||||
/// The on [Executor::execute] the executor is expected to validate the execution output of the
|
||||
/// input, this includes:
|
||||
/// The on [`Executor::execute`] the executor is expected to validate the execution output of
|
||||
/// the input, this includes:
|
||||
/// - Cumulative gas used must match the input's gas used.
|
||||
/// - Receipts must match the input's receipts root.
|
||||
///
|
||||
|
||||
@ -30,7 +30,7 @@ pub trait ConfigureEvm: ConfigureEvmEnv {
|
||||
|
||||
/// Returns new EVM with the given database
|
||||
///
|
||||
/// This does not automatically configure the EVM with [ConfigureEvmEnv] methods. It is up to
|
||||
/// This does not automatically configure the EVM with [`ConfigureEvmEnv`] methods. It is up to
|
||||
/// the caller to call an appropriate method to fill the transaction and block environment
|
||||
/// before executing any transactions using the provided EVM.
|
||||
fn evm<'a, DB: Database + 'a>(
|
||||
@ -77,8 +77,8 @@ pub trait ConfigureEvm: ConfigureEvmEnv {
|
||||
|
||||
/// Returns a new EVM with the given inspector.
|
||||
///
|
||||
/// Caution: This does not automatically configure the EVM with [ConfigureEvmEnv] methods. It is
|
||||
/// up to the caller to call an appropriate method to fill the transaction and block
|
||||
/// Caution: This does not automatically configure the EVM with [`ConfigureEvmEnv`] methods. It
|
||||
/// is up to the caller to call an appropriate method to fill the transaction and block
|
||||
/// environment before executing any transactions using the provided EVM.
|
||||
fn evm_with_inspector<'a, DB, I>(&'a self, db: DB, inspector: I) -> Evm<'a, I, DB>
|
||||
where
|
||||
@ -96,10 +96,10 @@ pub trait ConfigureEvm: ConfigureEvmEnv {
|
||||
/// This represents the set of methods used to configure the EVM's environment before block
|
||||
/// execution.
|
||||
pub trait ConfigureEvmEnv: Send + Sync + Unpin + Clone + 'static {
|
||||
/// Fill transaction environment from a [TransactionSigned] and the given sender address.
|
||||
/// Fill transaction environment from a [`TransactionSigned`] and the given sender address.
|
||||
fn fill_tx_env(tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address);
|
||||
|
||||
/// Fill [CfgEnvWithHandlerCfg] fields according to the chain spec and given header
|
||||
/// Fill [`CfgEnvWithHandlerCfg`] fields according to the chain spec and given header
|
||||
fn fill_cfg_env(
|
||||
cfg_env: &mut CfgEnvWithHandlerCfg,
|
||||
chain_spec: &ChainSpec,
|
||||
@ -107,8 +107,8 @@ pub trait ConfigureEvmEnv: Send + Sync + Unpin + Clone + 'static {
|
||||
total_difficulty: U256,
|
||||
);
|
||||
|
||||
/// Convenience function to call both [fill_cfg_env](ConfigureEvmEnv::fill_cfg_env) and
|
||||
/// [fill_block_env].
|
||||
/// Convenience function to call both [`fill_cfg_env`](ConfigureEvmEnv::fill_cfg_env) and
|
||||
/// [`fill_block_env`].
|
||||
fn fill_cfg_and_block_env(
|
||||
cfg: &mut CfgEnvWithHandlerCfg,
|
||||
block_env: &mut BlockEnv,
|
||||
|
||||
@ -12,7 +12,7 @@ use crate::execute::{
|
||||
|
||||
const UNAVAILABLE_FOR_NOOP: &str = "execution unavailable for noop";
|
||||
|
||||
/// A [BlockExecutorProvider] implementation that does nothing.
|
||||
/// A [`BlockExecutorProvider`] implementation that does nothing.
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub struct NoopBlockExecutorProvider;
|
||||
|
||||
@ -11,7 +11,7 @@ use reth_storage_errors::provider::ProviderError;
|
||||
use revm_primitives::db::Database;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// A [BlockExecutorProvider] that returns mocked execution results.
|
||||
/// A [`BlockExecutorProvider`] that returns mocked execution results.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct MockExecutorProvider {
|
||||
exec_results: Arc<Mutex<Vec<BatchBlockExecutionOutput>>>,
|
||||
|
||||
@ -9,7 +9,7 @@ use tokio::sync::mpsc::{Receiver, UnboundedSender};
|
||||
|
||||
use crate::{ExExEvent, ExExNotification};
|
||||
|
||||
/// Captures the context that an ExEx has access to.
|
||||
/// Captures the context that an `ExEx` has access to.
|
||||
#[derive(Debug)]
|
||||
pub struct ExExContext<Node: FullNodeComponents> {
|
||||
/// The current head of the blockchain at launch.
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
use reth_primitives::BlockNumber;
|
||||
|
||||
/// Events emitted by an ExEx.
|
||||
/// Events emitted by an `ExEx`.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ExExEvent {
|
||||
/// Highest block processed by the ExEx.
|
||||
/// Highest block processed by the `ExEx`.
|
||||
///
|
||||
/// The ExEx must guarantee that it will not require all earlier blocks in the future, meaning
|
||||
/// that Reth is allowed to prune them.
|
||||
/// The `ExEx` must guarantee that it will not require all earlier blocks in the future,
|
||||
/// meaning that Reth is allowed to prune them.
|
||||
///
|
||||
/// On reorgs, it's possible for the height to go down.
|
||||
FinishedHeight(BlockNumber),
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
// todo: expand this (examples, assumptions, invariants)
|
||||
//! Execution extensions (ExEx).
|
||||
//! Execution extensions (`ExEx`).
|
||||
//!
|
||||
//! An execution extension is a task that derives its state from Reth's state.
|
||||
//!
|
||||
//! Some examples of such state derives are rollups, bridges, and indexers.
|
||||
//!
|
||||
//! An ExEx is a [`Future`] resolving to a `Result<()>` that is run indefinitely alongside Reth.
|
||||
//! An `ExEx` is a [`Future`] resolving to a `Result<()>` that is run indefinitely alongside Reth.
|
||||
//!
|
||||
//! ExEx's are initialized using an async closure that resolves to the ExEx; this closure gets
|
||||
//! `ExEx`'s are initialized using an async closure that resolves to the `ExEx`; this closure gets
|
||||
//! passed an [`ExExContext`] where it is possible to spawn additional tasks and modify Reth.
|
||||
//!
|
||||
//! Most ExEx's will want to derive their state from the [`CanonStateNotification`] channel given in
|
||||
//! [`ExExContext`]. A new notification is emitted whenever blocks are executed in live and
|
||||
//! Most `ExEx`'s will want to derive their state from the [`CanonStateNotification`] channel given
|
||||
//! in [`ExExContext`]. A new notification is emitted whenever blocks are executed in live and
|
||||
//! historical sync.
|
||||
//!
|
||||
//! # Pruning
|
||||
//!
|
||||
//! ExEx's **SHOULD** emit an `ExExEvent::FinishedHeight` event to signify what blocks have been
|
||||
//! `ExEx`'s **SHOULD** emit an `ExExEvent::FinishedHeight` event to signify what blocks have been
|
||||
//! processed. This event is used by Reth to determine what state can be pruned.
|
||||
//!
|
||||
//! An ExEx will only receive notifications for blocks greater than the block emitted in the event.
|
||||
//! To clarify: if the ExEx emits `ExExEvent::FinishedHeight(0)` it will receive notifications for
|
||||
//! any `block_number > 0`.
|
||||
//! An `ExEx` will only receive notifications for blocks greater than the block emitted in the
|
||||
//! event. To clarify: if the `ExEx` emits `ExExEvent::FinishedHeight(0)` it will receive
|
||||
//! notifications for any `block_number > 0`.
|
||||
//!
|
||||
//! [`Future`]: std::future::Future
|
||||
//! [`ExExContext`]: crate::ExExContext
|
||||
|
||||
@ -19,46 +19,46 @@ use tokio::sync::{
|
||||
};
|
||||
use tokio_util::sync::{PollSendError, PollSender, ReusableBoxFuture};
|
||||
|
||||
/// Metrics for an ExEx.
|
||||
/// Metrics for an `ExEx`.
|
||||
#[derive(Metrics)]
|
||||
#[metrics(scope = "exex")]
|
||||
struct ExExMetrics {
|
||||
/// The total number of notifications sent to an ExEx.
|
||||
/// The total number of notifications sent to an `ExEx`.
|
||||
notifications_sent_total: Counter,
|
||||
/// The total number of events an ExEx has sent to the manager.
|
||||
/// The total number of events an `ExEx` has sent to the manager.
|
||||
events_sent_total: Counter,
|
||||
}
|
||||
|
||||
/// A handle to an ExEx used by the [`ExExManager`] to communicate with ExEx's.
|
||||
/// A handle to an `ExEx` used by the [`ExExManager`] to communicate with `ExEx`'s.
|
||||
///
|
||||
/// A handle should be created for each ExEx with a unique ID. The channels returned by
|
||||
/// [`ExExHandle::new`] should be given to the ExEx, while the handle itself should be given to the
|
||||
/// manager in [`ExExManager::new`].
|
||||
/// A handle should be created for each `ExEx` with a unique ID. The channels returned by
|
||||
/// [`ExExHandle::new`] should be given to the `ExEx`, while the handle itself should be given to
|
||||
/// the manager in [`ExExManager::new`].
|
||||
#[derive(Debug)]
|
||||
pub struct ExExHandle {
|
||||
/// The execution extension's ID.
|
||||
id: String,
|
||||
/// Metrics for an ExEx.
|
||||
/// Metrics for an `ExEx`.
|
||||
metrics: ExExMetrics,
|
||||
|
||||
/// Channel to send [`ExExNotification`]s to the ExEx.
|
||||
/// Channel to send [`ExExNotification`]s to the `ExEx`.
|
||||
sender: PollSender<ExExNotification>,
|
||||
/// Channel to receive [`ExExEvent`]s from the ExEx.
|
||||
/// Channel to receive [`ExExEvent`]s from the `ExEx`.
|
||||
receiver: UnboundedReceiver<ExExEvent>,
|
||||
/// The ID of the next notification to send to this ExEx.
|
||||
/// The ID of the next notification to send to this `ExEx`.
|
||||
next_notification_id: usize,
|
||||
|
||||
/// The finished block number of the ExEx.
|
||||
/// The finished block number of the `ExEx`.
|
||||
///
|
||||
/// If this is `None`, the ExEx has not emitted a `FinishedHeight` event.
|
||||
/// If this is `None`, the `ExEx` has not emitted a `FinishedHeight` event.
|
||||
finished_height: Option<BlockNumber>,
|
||||
}
|
||||
|
||||
impl ExExHandle {
|
||||
/// Create a new handle for the given ExEx.
|
||||
/// Create a new handle for the given `ExEx`.
|
||||
///
|
||||
/// Returns the handle, as well as a [`UnboundedSender`] for [`ExExEvent`]s and a
|
||||
/// [`Receiver`] for [`ExExNotification`]s that should be given to the ExEx.
|
||||
/// [`Receiver`] for [`ExExNotification`]s that should be given to the `ExEx`.
|
||||
pub fn new(id: String) -> (Self, UnboundedSender<ExExEvent>, Receiver<ExExNotification>) {
|
||||
let (notification_tx, notification_rx) = mpsc::channel(1);
|
||||
let (event_tx, event_rx) = mpsc::unbounded_channel();
|
||||
@ -139,7 +139,7 @@ impl ExExHandle {
|
||||
}
|
||||
}
|
||||
|
||||
/// Metrics for the ExEx manager.
|
||||
/// Metrics for the `ExEx` manager.
|
||||
#[derive(Metrics)]
|
||||
#[metrics(scope = "exex_manager")]
|
||||
pub struct ExExManagerMetrics {
|
||||
@ -151,7 +151,7 @@ pub struct ExExManagerMetrics {
|
||||
///
|
||||
/// Note that this might be slightly bigger than the maximum capacity in some cases.
|
||||
buffer_size: Gauge,
|
||||
/// Current number of ExEx's on the node.
|
||||
/// Current number of `ExEx`'s on the node.
|
||||
num_exexs: Gauge,
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ pub struct ExExManagerMetrics {
|
||||
/// - Monitoring
|
||||
#[derive(Debug)]
|
||||
pub struct ExExManager {
|
||||
/// Handles to communicate with the ExEx's.
|
||||
/// Handles to communicate with the `ExEx`'s.
|
||||
exex_handles: Vec<ExExHandle>,
|
||||
|
||||
/// [`ExExNotification`] channel from the [`ExExManagerHandle`]s.
|
||||
@ -191,22 +191,22 @@ pub struct ExExManager {
|
||||
/// Whether the manager is ready to receive new notifications.
|
||||
is_ready: watch::Sender<bool>,
|
||||
|
||||
/// The finished height of all ExEx's.
|
||||
/// The finished height of all `ExEx`'s.
|
||||
finished_height: watch::Sender<FinishedExExHeight>,
|
||||
|
||||
/// A handle to the ExEx manager.
|
||||
/// A handle to the `ExEx` manager.
|
||||
handle: ExExManagerHandle,
|
||||
/// Metrics for the ExEx manager.
|
||||
/// Metrics for the `ExEx` manager.
|
||||
metrics: ExExManagerMetrics,
|
||||
}
|
||||
|
||||
impl ExExManager {
|
||||
/// Create a new [`ExExManager`].
|
||||
///
|
||||
/// You must provide an [`ExExHandle`] for each ExEx and the maximum capacity of the
|
||||
/// You must provide an [`ExExHandle`] for each `ExEx` and the maximum capacity of the
|
||||
/// notification buffer in the manager.
|
||||
///
|
||||
/// When the capacity is exceeded (which can happen if an ExEx is slow) no one can send
|
||||
/// When the capacity is exceeded (which can happen if an `ExEx` is slow) no one can send
|
||||
/// notifications over [`ExExManagerHandle`]s until there is capacity again.
|
||||
pub fn new(handles: Vec<ExExHandle>, max_capacity: usize) -> Self {
|
||||
let num_exexs = handles.len();
|
||||
@ -363,9 +363,9 @@ impl Future for ExExManager {
|
||||
/// A handle to communicate with the [`ExExManager`].
|
||||
#[derive(Debug)]
|
||||
pub struct ExExManagerHandle {
|
||||
/// Channel to send notifications to the ExEx manager.
|
||||
/// Channel to send notifications to the `ExEx` manager.
|
||||
exex_tx: UnboundedSender<ExExNotification>,
|
||||
/// The number of ExEx's running on the node.
|
||||
/// The number of `ExEx`'s running on the node.
|
||||
num_exexs: usize,
|
||||
/// A watch channel denoting whether the manager is ready for new notifications or not.
|
||||
///
|
||||
@ -378,7 +378,7 @@ pub struct ExExManagerHandle {
|
||||
is_ready: ReusableBoxFuture<'static, watch::Receiver<bool>>,
|
||||
/// The current capacity of the manager's internal notification buffer.
|
||||
current_capacity: Arc<AtomicUsize>,
|
||||
/// The finished height of all ExEx's.
|
||||
/// The finished height of all `ExEx`'s.
|
||||
finished_height: watch::Receiver<FinishedExExHeight>,
|
||||
}
|
||||
|
||||
@ -422,12 +422,12 @@ impl ExExManagerHandle {
|
||||
self.exex_tx.send(notification)
|
||||
}
|
||||
|
||||
/// Get the current capacity of the ExEx manager's internal notification buffer.
|
||||
/// Get the current capacity of the `ExEx` manager's internal notification buffer.
|
||||
pub fn capacity(&self) -> usize {
|
||||
self.current_capacity.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// Whether there is capacity in the ExEx manager's internal notification buffer.
|
||||
/// Whether there is capacity in the `ExEx` manager's internal notification buffer.
|
||||
///
|
||||
/// If this returns `false`, the owner of the handle should **NOT** send new notifications over
|
||||
/// the channel until the manager is ready again, as this can lead to unbounded memory growth.
|
||||
@ -435,12 +435,12 @@ impl ExExManagerHandle {
|
||||
self.current_capacity.load(Ordering::Relaxed) > 0
|
||||
}
|
||||
|
||||
/// Returns `true` if there are ExEx's installed in the node.
|
||||
/// Returns `true` if there are `ExEx`'s installed in the node.
|
||||
pub const fn has_exexs(&self) -> bool {
|
||||
self.num_exexs > 0
|
||||
}
|
||||
|
||||
/// The finished height of all ExEx's.
|
||||
/// The finished height of all `ExEx`'s.
|
||||
pub fn finished_height(&self) -> watch::Receiver<FinishedExExHeight> {
|
||||
self.finished_height.clone()
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
|
||||
use reth_provider::{CanonStateNotification, Chain};
|
||||
|
||||
/// Notifications sent to an ExEx.
|
||||
/// Notifications sent to an `ExEx`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ExExNotification {
|
||||
/// Chain got committed without a reorg, and only the new chain is returned.
|
||||
@ -25,7 +25,7 @@ pub enum ExExNotification {
|
||||
}
|
||||
|
||||
impl ExExNotification {
|
||||
/// Returns the committed chain from the [Self::ChainCommitted] and [Self::ChainReorged]
|
||||
/// Returns the committed chain from the [`Self::ChainCommitted`] and [`Self::ChainReorged`]
|
||||
/// variants, if any.
|
||||
pub fn committed_chain(&self) -> Option<Arc<Chain>> {
|
||||
match self {
|
||||
@ -34,8 +34,8 @@ impl ExExNotification {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the reverted chain from the [Self::ChainReorged] and [Self::ChainReverted] variants,
|
||||
/// if any.
|
||||
/// Returns the reverted chain from the [`Self::ChainReorged`] and [`Self::ChainReverted`]
|
||||
/// variants, if any.
|
||||
pub fn reverted_chain(&self) -> Option<Arc<Chain>> {
|
||||
match self {
|
||||
Self::ChainReorged { old, new: _ } | Self::ChainReverted { old } => Some(old.clone()),
|
||||
|
||||
@ -13,11 +13,11 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
/// Result alias for [FsPathError].
|
||||
/// Result alias for [`FsPathError`].
|
||||
pub type Result<T> = std::result::Result<T, FsPathError>;
|
||||
|
||||
/// Various error variants for `std::fs` operations that serve as an addition to the io::Error which
|
||||
/// does not provide any information about the path.
|
||||
/// Various error variants for `std::fs` operations that serve as an addition to the `io::Error`
|
||||
/// which does not provide any information about the path.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum FsPathError {
|
||||
/// Error variant for failed write operation with additional path context.
|
||||
|
||||
@ -15,7 +15,7 @@ use tokio::sync::mpsc::{
|
||||
};
|
||||
use tokio_util::sync::{PollSendError, PollSender};
|
||||
|
||||
/// Wrapper around [mpsc::unbounded_channel] that returns a new unbounded metered channel.
|
||||
/// Wrapper around [`mpsc::unbounded_channel`] that returns a new unbounded metered channel.
|
||||
pub fn metered_unbounded_channel<T>(
|
||||
scope: &'static str,
|
||||
) -> (UnboundedMeteredSender<T>, UnboundedMeteredReceiver<T>) {
|
||||
@ -23,7 +23,7 @@ pub fn metered_unbounded_channel<T>(
|
||||
(UnboundedMeteredSender::new(tx, scope), UnboundedMeteredReceiver::new(rx, scope))
|
||||
}
|
||||
|
||||
/// Wrapper around [mpsc::channel] that returns a new bounded metered channel with the given
|
||||
/// Wrapper around [`mpsc::channel`] that returns a new bounded metered channel with the given
|
||||
/// buffer size.
|
||||
pub fn metered_channel<T>(
|
||||
buffer: usize,
|
||||
@ -33,10 +33,10 @@ pub fn metered_channel<T>(
|
||||
(MeteredSender::new(tx, scope), MeteredReceiver::new(rx, scope))
|
||||
}
|
||||
|
||||
/// A wrapper type around [UnboundedSender](mpsc::UnboundedSender) that updates metrics on send.
|
||||
/// A wrapper type around [`UnboundedSender`](mpsc::UnboundedSender) that updates metrics on send.
|
||||
#[derive(Debug)]
|
||||
pub struct UnboundedMeteredSender<T> {
|
||||
/// The [UnboundedSender](mpsc::UnboundedSender) that this wraps around
|
||||
/// The [`UnboundedSender`](mpsc::UnboundedSender) that this wraps around
|
||||
sender: mpsc::UnboundedSender<T>,
|
||||
/// Holds metrics for this type
|
||||
metrics: MeteredSenderMetrics,
|
||||
@ -84,7 +84,7 @@ pub struct UnboundedMeteredReceiver<T> {
|
||||
// === impl MeteredReceiver ===
|
||||
|
||||
impl<T> UnboundedMeteredReceiver<T> {
|
||||
/// Creates a new [UnboundedMeteredReceiver] wrapping around the provided
|
||||
/// Creates a new [`UnboundedMeteredReceiver`] wrapping around the provided
|
||||
/// [Receiver](mpsc::UnboundedReceiver)
|
||||
pub fn new(receiver: mpsc::UnboundedReceiver<T>, scope: &'static str) -> Self {
|
||||
Self { receiver, metrics: MeteredReceiverMetrics::new(scope) }
|
||||
@ -249,7 +249,7 @@ impl<T> Stream for MeteredReceiver<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Throughput metrics for [MeteredSender]
|
||||
/// Throughput metrics for [`MeteredSender`]
|
||||
#[derive(Clone, Metrics)]
|
||||
#[metrics(dynamic = true)]
|
||||
struct MeteredSenderMetrics {
|
||||
@ -259,7 +259,7 @@ struct MeteredSenderMetrics {
|
||||
send_errors_total: Counter,
|
||||
}
|
||||
|
||||
/// Throughput metrics for [MeteredReceiver]
|
||||
/// Throughput metrics for [`MeteredReceiver`]
|
||||
#[derive(Clone, Metrics)]
|
||||
#[metrics(dynamic = true)]
|
||||
struct MeteredReceiverMetrics {
|
||||
@ -267,27 +267,27 @@ struct MeteredReceiverMetrics {
|
||||
messages_received_total: Counter,
|
||||
}
|
||||
|
||||
/// A wrapper type around [PollSender] that updates metrics on send.
|
||||
/// A wrapper type around [`PollSender`] that updates metrics on send.
|
||||
#[derive(Debug)]
|
||||
pub struct MeteredPollSender<T> {
|
||||
/// The [PollSender] that this wraps around.
|
||||
/// The [`PollSender`] that this wraps around.
|
||||
sender: PollSender<T>,
|
||||
/// Holds metrics for this type.
|
||||
metrics: MeteredPollSenderMetrics,
|
||||
}
|
||||
|
||||
impl<T: Send + 'static> MeteredPollSender<T> {
|
||||
/// Creates a new [`MeteredPollSender`] wrapping around the provided [PollSender].
|
||||
/// Creates a new [`MeteredPollSender`] wrapping around the provided [`PollSender`].
|
||||
pub fn new(sender: PollSender<T>, scope: &'static str) -> Self {
|
||||
Self { sender, metrics: MeteredPollSenderMetrics::new(scope) }
|
||||
}
|
||||
|
||||
/// Returns the underlying [PollSender].
|
||||
/// Returns the underlying [`PollSender`].
|
||||
pub const fn inner(&self) -> &PollSender<T> {
|
||||
&self.sender
|
||||
}
|
||||
|
||||
/// Calls the underlying [PollSender]'s `poll_reserve`, incrementing the appropriate
|
||||
/// Calls the underlying [`PollSender`]'s `poll_reserve`, incrementing the appropriate
|
||||
/// metrics depending on the result.
|
||||
pub fn poll_reserve(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), PollSendError<T>>> {
|
||||
match self.sender.poll_reserve(cx) {
|
||||
@ -300,7 +300,7 @@ impl<T: Send + 'static> MeteredPollSender<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Calls the underlying [PollSender]'s `send_item`, incrementing the appropriate
|
||||
/// Calls the underlying [`PollSender`]'s `send_item`, incrementing the appropriate
|
||||
/// metrics depending on the result.
|
||||
pub fn send_item(&mut self, item: T) -> Result<(), PollSendError<T>> {
|
||||
match self.sender.send_item(item) {
|
||||
@ -319,7 +319,7 @@ impl<T> Clone for MeteredPollSender<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Throughput metrics for [MeteredPollSender]
|
||||
/// Throughput metrics for [`MeteredPollSender`]
|
||||
#[derive(Clone, Metrics)]
|
||||
#[metrics(dynamic = true)]
|
||||
struct MeteredPollSenderMetrics {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user