mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: Move consensus trait to standalone crate (#7757)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
27
Cargo.lock
generated
27
Cargo.lock
generated
@ -6064,6 +6064,7 @@ dependencies = [
|
|||||||
"reth-blockchain-tree",
|
"reth-blockchain-tree",
|
||||||
"reth-cli-runner",
|
"reth-cli-runner",
|
||||||
"reth-config",
|
"reth-config",
|
||||||
|
"reth-consensus",
|
||||||
"reth-consensus-common",
|
"reth-consensus-common",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-discv4",
|
"reth-discv4",
|
||||||
@ -6114,12 +6115,14 @@ version = "0.2.0-beta.6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"reth-beacon-consensus",
|
"reth-beacon-consensus",
|
||||||
|
"reth-consensus",
|
||||||
"reth-engine-primitives",
|
"reth-engine-primitives",
|
||||||
"reth-evm",
|
"reth-evm",
|
||||||
"reth-interfaces",
|
"reth-interfaces",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-provider",
|
"reth-provider",
|
||||||
"reth-revm",
|
"reth-revm",
|
||||||
|
"reth-rpc-types",
|
||||||
"reth-stages-api",
|
"reth-stages-api",
|
||||||
"reth-transaction-pool",
|
"reth-transaction-pool",
|
||||||
"tokio",
|
"tokio",
|
||||||
@ -6159,6 +6162,7 @@ dependencies = [
|
|||||||
"reth-beacon-consensus-core",
|
"reth-beacon-consensus-core",
|
||||||
"reth-blockchain-tree",
|
"reth-blockchain-tree",
|
||||||
"reth-config",
|
"reth-config",
|
||||||
|
"reth-consensus",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-downloaders",
|
"reth-downloaders",
|
||||||
"reth-engine-primitives",
|
"reth-engine-primitives",
|
||||||
@ -6191,8 +6195,8 @@ dependencies = [
|
|||||||
name = "reth-beacon-consensus-core"
|
name = "reth-beacon-consensus-core"
|
||||||
version = "0.2.0-beta.6"
|
version = "0.2.0-beta.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"reth-consensus",
|
||||||
"reth-consensus-common",
|
"reth-consensus-common",
|
||||||
"reth-interfaces",
|
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -6206,6 +6210,7 @@ dependencies = [
|
|||||||
"lru",
|
"lru",
|
||||||
"metrics",
|
"metrics",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.12.1",
|
||||||
|
"reth-consensus",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-interfaces",
|
"reth-interfaces",
|
||||||
"reth-metrics",
|
"reth-metrics",
|
||||||
@ -6274,11 +6279,21 @@ dependencies = [
|
|||||||
"toml",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "reth-consensus"
|
||||||
|
version = "0.2.0-beta.6"
|
||||||
|
dependencies = [
|
||||||
|
"auto_impl",
|
||||||
|
"reth-primitives",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reth-consensus-common"
|
name = "reth-consensus-common"
|
||||||
version = "0.2.0-beta.6"
|
version = "0.2.0-beta.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mockall",
|
"mockall",
|
||||||
|
"reth-consensus",
|
||||||
"reth-interfaces",
|
"reth-interfaces",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-provider",
|
"reth-provider",
|
||||||
@ -6405,6 +6420,7 @@ dependencies = [
|
|||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"rayon",
|
"rayon",
|
||||||
"reth-config",
|
"reth-config",
|
||||||
|
"reth-consensus",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-interfaces",
|
"reth-interfaces",
|
||||||
"reth-metrics",
|
"reth-metrics",
|
||||||
@ -6649,10 +6665,10 @@ dependencies = [
|
|||||||
"futures",
|
"futures",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.12.1",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
|
"reth-consensus",
|
||||||
"reth-eth-wire-types",
|
"reth-eth-wire-types",
|
||||||
"reth-network-api",
|
"reth-network-api",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-rpc-types",
|
|
||||||
"secp256k1 0.27.0",
|
"secp256k1 0.27.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
@ -6781,6 +6797,7 @@ dependencies = [
|
|||||||
"pin-project",
|
"pin-project",
|
||||||
"pprof",
|
"pprof",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
|
"reth-consensus",
|
||||||
"reth-discv4",
|
"reth-discv4",
|
||||||
"reth-discv5",
|
"reth-discv5",
|
||||||
"reth-dns-discovery",
|
"reth-dns-discovery",
|
||||||
@ -6875,6 +6892,7 @@ dependencies = [
|
|||||||
"reth-beacon-consensus",
|
"reth-beacon-consensus",
|
||||||
"reth-blockchain-tree",
|
"reth-blockchain-tree",
|
||||||
"reth-config",
|
"reth-config",
|
||||||
|
"reth-consensus",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-downloaders",
|
"reth-downloaders",
|
||||||
"reth-exex",
|
"reth-exex",
|
||||||
@ -6993,12 +7011,12 @@ dependencies = [
|
|||||||
"pin-project",
|
"pin-project",
|
||||||
"reth-beacon-consensus",
|
"reth-beacon-consensus",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-interfaces",
|
|
||||||
"reth-network",
|
"reth-network",
|
||||||
"reth-network-api",
|
"reth-network-api",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-provider",
|
"reth-provider",
|
||||||
"reth-prune",
|
"reth-prune",
|
||||||
|
"reth-rpc-types",
|
||||||
"reth-stages",
|
"reth-stages",
|
||||||
"reth-static-file",
|
"reth-static-file",
|
||||||
"tokio",
|
"tokio",
|
||||||
@ -7173,6 +7191,7 @@ dependencies = [
|
|||||||
"reth-metrics",
|
"reth-metrics",
|
||||||
"reth-nippy-jar",
|
"reth-nippy-jar",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
|
"reth-rpc-types",
|
||||||
"reth-trie",
|
"reth-trie",
|
||||||
"revm",
|
"revm",
|
||||||
"strum 0.26.2",
|
"strum 0.26.2",
|
||||||
@ -7422,6 +7441,7 @@ dependencies = [
|
|||||||
"rayon",
|
"rayon",
|
||||||
"reth-codecs",
|
"reth-codecs",
|
||||||
"reth-config",
|
"reth-config",
|
||||||
|
"reth-consensus",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-downloaders",
|
"reth-downloaders",
|
||||||
"reth-etl",
|
"reth-etl",
|
||||||
@ -7450,6 +7470,7 @@ dependencies = [
|
|||||||
"auto_impl",
|
"auto_impl",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"metrics",
|
"metrics",
|
||||||
|
"reth-consensus",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-interfaces",
|
"reth-interfaces",
|
||||||
"reth-metrics",
|
"reth-metrics",
|
||||||
|
|||||||
@ -8,6 +8,7 @@ members = [
|
|||||||
"crates/consensus/beacon/",
|
"crates/consensus/beacon/",
|
||||||
"crates/consensus/beacon-core/",
|
"crates/consensus/beacon-core/",
|
||||||
"crates/consensus/common/",
|
"crates/consensus/common/",
|
||||||
|
"crates/consensus/consensus/",
|
||||||
"crates/ethereum-forks/",
|
"crates/ethereum-forks/",
|
||||||
"crates/e2e-test-utils/",
|
"crates/e2e-test-utils/",
|
||||||
"crates/etl/",
|
"crates/etl/",
|
||||||
@ -84,7 +85,7 @@ members = [
|
|||||||
"examples/custom-inspector/",
|
"examples/custom-inspector/",
|
||||||
"examples/exex/minimal/",
|
"examples/exex/minimal/",
|
||||||
"examples/exex/op-bridge/",
|
"examples/exex/op-bridge/",
|
||||||
"testing/ef-tests/",
|
"testing/ef-tests/"
|
||||||
]
|
]
|
||||||
default-members = ["bin/reth"]
|
default-members = ["bin/reth"]
|
||||||
|
|
||||||
@ -207,6 +208,7 @@ reth-blockchain-tree = { path = "crates/blockchain-tree" }
|
|||||||
reth-cli-runner = { path = "crates/cli/runner" }
|
reth-cli-runner = { path = "crates/cli/runner" }
|
||||||
reth-codecs = { path = "crates/storage/codecs" }
|
reth-codecs = { path = "crates/storage/codecs" }
|
||||||
reth-config = { path = "crates/config" }
|
reth-config = { path = "crates/config" }
|
||||||
|
reth-consensus = { path = "crates/consensus/consensus" }
|
||||||
reth-consensus-common = { path = "crates/consensus/common" }
|
reth-consensus-common = { path = "crates/consensus/common" }
|
||||||
reth-db = { path = "crates/storage/db" }
|
reth-db = { path = "crates/storage/db" }
|
||||||
reth-discv4 = { path = "crates/net/discv4" }
|
reth-discv4 = { path = "crates/net/discv4" }
|
||||||
|
|||||||
@ -56,6 +56,7 @@ reth-node-optimism = { workspace = true, optional = true, features = [
|
|||||||
reth-node-core.workspace = true
|
reth-node-core.workspace = true
|
||||||
reth-node-builder.workspace = true
|
reth-node-builder.workspace = true
|
||||||
reth-node-events.workspace = true
|
reth-node-events.workspace = true
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
# crypto
|
# crypto
|
||||||
alloy-rlp.workspace = true
|
alloy-rlp.workspace = true
|
||||||
|
|||||||
@ -18,8 +18,9 @@ use reth_blockchain_tree::{
|
|||||||
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
|
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
|
||||||
};
|
};
|
||||||
use reth_cli_runner::CliContext;
|
use reth_cli_runner::CliContext;
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{init_db, DatabaseEnv};
|
use reth_db::{init_db, DatabaseEnv};
|
||||||
use reth_interfaces::{consensus::Consensus, RethResult};
|
use reth_interfaces::RethResult;
|
||||||
use reth_node_api::PayloadBuilderAttributes;
|
use reth_node_api::PayloadBuilderAttributes;
|
||||||
#[cfg(not(feature = "optimism"))]
|
#[cfg(not(feature = "optimism"))]
|
||||||
use reth_node_ethereum::EthEvmConfig;
|
use reth_node_ethereum::EthEvmConfig;
|
||||||
|
|||||||
@ -14,16 +14,14 @@ use futures::{stream::select as stream_select, StreamExt};
|
|||||||
use reth_beacon_consensus::BeaconConsensus;
|
use reth_beacon_consensus::BeaconConsensus;
|
||||||
use reth_cli_runner::CliContext;
|
use reth_cli_runner::CliContext;
|
||||||
use reth_config::{config::EtlConfig, Config};
|
use reth_config::{config::EtlConfig, Config};
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{database::Database, init_db, DatabaseEnv};
|
use reth_db::{database::Database, init_db, DatabaseEnv};
|
||||||
use reth_downloaders::{
|
use reth_downloaders::{
|
||||||
bodies::bodies::BodiesDownloaderBuilder,
|
bodies::bodies::BodiesDownloaderBuilder,
|
||||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||||
};
|
};
|
||||||
use reth_exex::ExExManagerHandle;
|
use reth_exex::ExExManagerHandle;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::p2p::{bodies::client::BodiesClient, headers::client::HeadersClient};
|
||||||
consensus::Consensus,
|
|
||||||
p2p::{bodies::client::BodiesClient, headers::client::HeadersClient},
|
|
||||||
};
|
|
||||||
use reth_network::{NetworkEvents, NetworkHandle};
|
use reth_network::{NetworkEvents, NetworkHandle};
|
||||||
use reth_network_api::NetworkInfo;
|
use reth_network_api::NetworkInfo;
|
||||||
use reth_node_core::init::init_genesis;
|
use reth_node_core::init::init_genesis;
|
||||||
|
|||||||
@ -14,9 +14,10 @@ use clap::Parser;
|
|||||||
use reth_beacon_consensus::BeaconConsensus;
|
use reth_beacon_consensus::BeaconConsensus;
|
||||||
use reth_cli_runner::CliContext;
|
use reth_cli_runner::CliContext;
|
||||||
use reth_config::Config;
|
use reth_config::Config;
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{cursor::DbCursorRO, init_db, tables, transaction::DbTx, DatabaseEnv};
|
use reth_db::{cursor::DbCursorRO, init_db, tables, transaction::DbTx, DatabaseEnv};
|
||||||
use reth_exex::ExExManagerHandle;
|
use reth_exex::ExExManagerHandle;
|
||||||
use reth_interfaces::{consensus::Consensus, p2p::full_block::FullBlockClient};
|
use reth_interfaces::p2p::full_block::FullBlockClient;
|
||||||
use reth_network::NetworkHandle;
|
use reth_network::NetworkHandle;
|
||||||
use reth_network_api::NetworkInfo;
|
use reth_network_api::NetworkInfo;
|
||||||
use reth_node_ethereum::EthEvmConfig;
|
use reth_node_ethereum::EthEvmConfig;
|
||||||
|
|||||||
@ -15,8 +15,8 @@ use reth_blockchain_tree::{
|
|||||||
};
|
};
|
||||||
use reth_cli_runner::CliContext;
|
use reth_cli_runner::CliContext;
|
||||||
use reth_config::Config;
|
use reth_config::Config;
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{init_db, DatabaseEnv};
|
use reth_db::{init_db, DatabaseEnv};
|
||||||
use reth_interfaces::consensus::Consensus;
|
|
||||||
use reth_network::NetworkHandle;
|
use reth_network::NetworkHandle;
|
||||||
use reth_network_api::NetworkInfo;
|
use reth_network_api::NetworkInfo;
|
||||||
use reth_node_core::engine_api_store::{EngineApiStore, StoredEngineApiMessage};
|
use reth_node_core::engine_api_store::{EngineApiStore, StoredEngineApiMessage};
|
||||||
|
|||||||
@ -13,6 +13,7 @@ use eyre::Context;
|
|||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
use reth_beacon_consensus::BeaconConsensus;
|
use reth_beacon_consensus::BeaconConsensus;
|
||||||
use reth_config::{config::EtlConfig, Config};
|
use reth_config::{config::EtlConfig, Config};
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{database::Database, init_db};
|
use reth_db::{database::Database, init_db};
|
||||||
use reth_downloaders::{
|
use reth_downloaders::{
|
||||||
bodies::bodies::BodiesDownloaderBuilder,
|
bodies::bodies::BodiesDownloaderBuilder,
|
||||||
@ -20,12 +21,9 @@ use reth_downloaders::{
|
|||||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||||
};
|
};
|
||||||
use reth_exex::ExExManagerHandle;
|
use reth_exex::ExExManagerHandle;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::p2p::{
|
||||||
consensus::Consensus,
|
bodies::downloader::BodyDownloader,
|
||||||
p2p::{
|
headers::downloader::{HeaderDownloader, SyncTarget},
|
||||||
bodies::downloader::BodyDownloader,
|
|
||||||
headers::downloader::{HeaderDownloader, SyncTarget},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use reth_node_core::init::init_genesis;
|
use reth_node_core::init::init_genesis;
|
||||||
use reth_node_ethereum::EthEvmConfig;
|
use reth_node_ethereum::EthEvmConfig;
|
||||||
|
|||||||
@ -10,13 +10,13 @@ use crate::{
|
|||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use reth_beacon_consensus::BeaconConsensus;
|
use reth_beacon_consensus::BeaconConsensus;
|
||||||
use reth_config::{Config, PruneConfig};
|
use reth_config::{Config, PruneConfig};
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{database::Database, open_db};
|
use reth_db::{database::Database, open_db};
|
||||||
use reth_downloaders::{
|
use reth_downloaders::{
|
||||||
bodies::bodies::BodiesDownloaderBuilder,
|
bodies::bodies::BodiesDownloaderBuilder,
|
||||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||||
};
|
};
|
||||||
use reth_exex::ExExManagerHandle;
|
use reth_exex::ExExManagerHandle;
|
||||||
use reth_interfaces::consensus::Consensus;
|
|
||||||
use reth_node_core::{
|
use reth_node_core::{
|
||||||
args::{get_secret_key, NetworkArgs},
|
args::{get_secret_key, NetworkArgs},
|
||||||
dirs::ChainPath,
|
dirs::ChainPath,
|
||||||
|
|||||||
@ -19,6 +19,7 @@ reth-provider.workspace = true
|
|||||||
reth-stages-api.workspace = true
|
reth-stages-api.workspace = true
|
||||||
reth-trie = { workspace = true, features = ["metrics"] }
|
reth-trie = { workspace = true, features = ["metrics"] }
|
||||||
reth-trie-parallel = { workspace = true, features = ["parallel"] }
|
reth-trie-parallel = { workspace = true, features = ["parallel"] }
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
# common
|
# common
|
||||||
parking_lot.workspace = true
|
parking_lot.workspace = true
|
||||||
|
|||||||
@ -5,13 +5,13 @@ use crate::{
|
|||||||
state::{BlockChainId, TreeState},
|
state::{BlockChainId, TreeState},
|
||||||
AppendableChain, BlockIndices, BlockchainTreeConfig, BundleStateData, TreeExternals,
|
AppendableChain, BlockIndices, BlockchainTreeConfig, BundleStateData, TreeExternals,
|
||||||
};
|
};
|
||||||
|
use reth_consensus::{Consensus, ConsensusError};
|
||||||
use reth_db::database::Database;
|
use reth_db::database::Database;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::{
|
||||||
blockchain_tree::{
|
blockchain_tree::{
|
||||||
error::{BlockchainTreeError, CanonicalError, InsertBlockError, InsertBlockErrorKind},
|
error::{BlockchainTreeError, CanonicalError, InsertBlockError, InsertBlockErrorKind},
|
||||||
BlockAttachment, BlockStatus, BlockValidationKind, CanonicalOutcome, InsertPayloadOk,
|
BlockAttachment, BlockStatus, BlockValidationKind, CanonicalOutcome, InsertPayloadOk,
|
||||||
},
|
},
|
||||||
consensus::{Consensus, ConsensusError},
|
|
||||||
executor::{BlockExecutionError, BlockValidationError},
|
executor::{BlockExecutionError, BlockValidationError},
|
||||||
provider::RootMismatch,
|
provider::RootMismatch,
|
||||||
RethResult,
|
RethResult,
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
use super::externals::TreeExternals;
|
use super::externals::TreeExternals;
|
||||||
use crate::BundleStateDataRef;
|
use crate::BundleStateDataRef;
|
||||||
|
use reth_consensus::{Consensus, ConsensusError};
|
||||||
use reth_db::database::Database;
|
use reth_db::database::Database;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::{
|
||||||
blockchain_tree::{
|
blockchain_tree::{
|
||||||
error::{BlockchainTreeError, InsertBlockErrorKind},
|
error::{BlockchainTreeError, InsertBlockErrorKind},
|
||||||
BlockAttachment, BlockValidationKind,
|
BlockAttachment, BlockValidationKind,
|
||||||
},
|
},
|
||||||
consensus::{Consensus, ConsensusError},
|
|
||||||
RethResult,
|
RethResult,
|
||||||
};
|
};
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
//! Blockchain tree externals.
|
//! Blockchain tree externals.
|
||||||
|
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{
|
use reth_db::{
|
||||||
cursor::DbCursorRO, database::Database, static_file::HeaderMask, tables, transaction::DbTx,
|
cursor::DbCursorRO, database::Database, static_file::HeaderMask, tables, transaction::DbTx,
|
||||||
};
|
};
|
||||||
use reth_interfaces::{consensus::Consensus, RethResult};
|
use reth_interfaces::RethResult;
|
||||||
use reth_primitives::{BlockHash, BlockNumber, StaticFileSegment};
|
use reth_primitives::{BlockHash, BlockNumber, StaticFileSegment};
|
||||||
use reth_provider::{ProviderFactory, StatsReader};
|
use reth_provider::{ProviderFactory, StatsReader};
|
||||||
use std::{collections::BTreeMap, sync::Arc};
|
use std::{collections::BTreeMap, sync::Arc};
|
||||||
|
|||||||
@ -22,6 +22,8 @@ reth-revm.workspace = true
|
|||||||
reth-transaction-pool.workspace = true
|
reth-transaction-pool.workspace = true
|
||||||
reth-evm.workspace = true
|
reth-evm.workspace = true
|
||||||
reth-engine-primitives.workspace = true
|
reth-engine-primitives.workspace = true
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
reth-rpc-types.workspace = true
|
||||||
|
|
||||||
# async
|
# async
|
||||||
futures-util.workspace = true
|
futures-util.workspace = true
|
||||||
|
|||||||
@ -16,12 +16,10 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
|
|
||||||
use reth_beacon_consensus::BeaconEngineMessage;
|
use reth_beacon_consensus::BeaconEngineMessage;
|
||||||
|
use reth_consensus::{Consensus, ConsensusError};
|
||||||
use reth_engine_primitives::EngineTypes;
|
use reth_engine_primitives::EngineTypes;
|
||||||
use reth_evm::ConfigureEvm;
|
use reth_evm::ConfigureEvm;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::executor::{BlockExecutionError, BlockValidationError};
|
||||||
consensus::{Consensus, ConsensusError},
|
|
||||||
executor::{BlockExecutionError, BlockValidationError},
|
|
||||||
};
|
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
constants::{EMPTY_RECEIPTS, EMPTY_TRANSACTIONS, ETHEREUM_BLOCK_GAS_LIMIT},
|
constants::{EMPTY_RECEIPTS, EMPTY_TRANSACTIONS, ETHEREUM_BLOCK_GAS_LIMIT},
|
||||||
eip4844::calculate_excess_blob_gas,
|
eip4844::calculate_excess_blob_gas,
|
||||||
|
|||||||
@ -3,9 +3,9 @@ use futures_util::{future::BoxFuture, FutureExt};
|
|||||||
use reth_beacon_consensus::{BeaconEngineMessage, ForkchoiceStatus};
|
use reth_beacon_consensus::{BeaconEngineMessage, ForkchoiceStatus};
|
||||||
use reth_engine_primitives::EngineTypes;
|
use reth_engine_primitives::EngineTypes;
|
||||||
use reth_evm::ConfigureEvm;
|
use reth_evm::ConfigureEvm;
|
||||||
use reth_interfaces::consensus::ForkchoiceState;
|
|
||||||
use reth_primitives::{Block, ChainSpec, IntoRecoveredTransaction, SealedBlockWithSenders};
|
use reth_primitives::{Block, ChainSpec, IntoRecoveredTransaction, SealedBlockWithSenders};
|
||||||
use reth_provider::{CanonChainTracker, CanonStateNotificationSender, Chain, StateProviderFactory};
|
use reth_provider::{CanonChainTracker, CanonStateNotificationSender, Chain, StateProviderFactory};
|
||||||
|
use reth_rpc_types::engine::ForkchoiceState;
|
||||||
use reth_stages_api::PipelineEvent;
|
use reth_stages_api::PipelineEvent;
|
||||||
use reth_transaction_pool::{TransactionPool, ValidPoolTransaction};
|
use reth_transaction_pool::{TransactionPool, ValidPoolTransaction};
|
||||||
use std::{
|
use std::{
|
||||||
|
|||||||
@ -14,7 +14,7 @@ workspace = true
|
|||||||
# reth
|
# reth
|
||||||
reth-consensus-common.workspace = true
|
reth-consensus-common.workspace = true
|
||||||
reth-primitives.workspace = true
|
reth-primitives.workspace = true
|
||||||
reth-interfaces.workspace = true
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
optimism = ["reth-primitives/optimism"]
|
optimism = ["reth-primitives/optimism"]
|
||||||
@ -8,8 +8,8 @@
|
|||||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
|
|
||||||
|
use reth_consensus::{Consensus, ConsensusError};
|
||||||
use reth_consensus_common::validation;
|
use reth_consensus_common::validation;
|
||||||
use reth_interfaces::consensus::{Consensus, ConsensusError};
|
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
constants::MAXIMUM_EXTRA_DATA_SIZE, Chain, ChainSpec, Hardfork, Header, SealedBlock,
|
constants::MAXIMUM_EXTRA_DATA_SIZE, Chain, ChainSpec, Hardfork, Header, SealedBlock,
|
||||||
SealedHeader, EMPTY_OMMER_ROOT_HASH, U256,
|
SealedHeader, EMPTY_OMMER_ROOT_HASH, U256,
|
||||||
|
|||||||
@ -57,6 +57,7 @@ reth-downloaders.workspace = true
|
|||||||
reth-evm-ethereum.workspace = true
|
reth-evm-ethereum.workspace = true
|
||||||
reth-ethereum-engine-primitives.workspace = true
|
reth-ethereum-engine-primitives.workspace = true
|
||||||
reth-config.workspace = true
|
reth-config.workspace = true
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
assert_matches.workspace = true
|
assert_matches.workspace = true
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use crate::engine::forkchoice::ForkchoiceStatus;
|
use crate::engine::forkchoice::ForkchoiceStatus;
|
||||||
use reth_interfaces::consensus::ForkchoiceState;
|
|
||||||
use reth_primitives::{SealedBlock, SealedHeader, B256};
|
use reth_primitives::{SealedBlock, SealedHeader, B256};
|
||||||
|
use reth_rpc_types::engine::ForkchoiceState;
|
||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
/// Events emitted by [crate::BeaconConsensusEngine].
|
/// Events emitted by [crate::BeaconConsensusEngine].
|
||||||
|
|||||||
@ -4,11 +4,11 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use futures::{future::Either, FutureExt};
|
use futures::{future::Either, FutureExt};
|
||||||
use reth_engine_primitives::EngineTypes;
|
use reth_engine_primitives::EngineTypes;
|
||||||
use reth_interfaces::{consensus::ForkchoiceState, RethResult};
|
use reth_interfaces::RethResult;
|
||||||
use reth_payload_builder::error::PayloadBuilderError;
|
use reth_payload_builder::error::PayloadBuilderError;
|
||||||
use reth_rpc_types::engine::{
|
use reth_rpc_types::engine::{
|
||||||
CancunPayloadFields, ExecutionPayload, ForkChoiceUpdateResult, ForkchoiceUpdateError,
|
CancunPayloadFields, ExecutionPayload, ForkChoiceUpdateResult, ForkchoiceState,
|
||||||
ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum,
|
ForkchoiceUpdateError, ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
future::Future,
|
future::Future,
|
||||||
|
|||||||
@ -14,7 +14,6 @@ use reth_interfaces::{
|
|||||||
error::{BlockchainTreeError, CanonicalError, InsertBlockError, InsertBlockErrorKind},
|
error::{BlockchainTreeError, CanonicalError, InsertBlockError, InsertBlockErrorKind},
|
||||||
BlockStatus, BlockchainTreeEngine, CanonicalOutcome, InsertPayloadOk,
|
BlockStatus, BlockchainTreeEngine, CanonicalOutcome, InsertPayloadOk,
|
||||||
},
|
},
|
||||||
consensus::ForkchoiceState,
|
|
||||||
executor::BlockValidationError,
|
executor::BlockValidationError,
|
||||||
p2p::{bodies::client::BodiesClient, headers::client::HeadersClient},
|
p2p::{bodies::client::BodiesClient, headers::client::HeadersClient},
|
||||||
provider::ProviderResult,
|
provider::ProviderResult,
|
||||||
@ -31,7 +30,8 @@ use reth_provider::{
|
|||||||
StageCheckpointReader,
|
StageCheckpointReader,
|
||||||
};
|
};
|
||||||
use reth_rpc_types::engine::{
|
use reth_rpc_types::engine::{
|
||||||
CancunPayloadFields, ExecutionPayload, PayloadStatus, PayloadStatusEnum, PayloadValidationError,
|
CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus, PayloadStatusEnum,
|
||||||
|
PayloadValidationError,
|
||||||
};
|
};
|
||||||
use reth_stages_api::{ControlFlow, Pipeline};
|
use reth_stages_api::{ControlFlow, Pipeline};
|
||||||
use reth_tasks::TaskSpawner;
|
use reth_tasks::TaskSpawner;
|
||||||
|
|||||||
@ -7,16 +7,15 @@ use reth_blockchain_tree::{
|
|||||||
config::BlockchainTreeConfig, externals::TreeExternals, BlockchainTree, ShareableBlockchainTree,
|
config::BlockchainTreeConfig, externals::TreeExternals, BlockchainTree, ShareableBlockchainTree,
|
||||||
};
|
};
|
||||||
use reth_config::config::EtlConfig;
|
use reth_config::config::EtlConfig;
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{test_utils::TempDatabase, DatabaseEnv as DE};
|
use reth_db::{test_utils::TempDatabase, DatabaseEnv as DE};
|
||||||
use reth_ethereum_engine_primitives::EthEngineTypes;
|
|
||||||
use reth_evm_ethereum::EthEvmConfig;
|
|
||||||
type DatabaseEnv = TempDatabase<DE>;
|
|
||||||
use reth_downloaders::{
|
use reth_downloaders::{
|
||||||
bodies::bodies::BodiesDownloaderBuilder,
|
bodies::bodies::BodiesDownloaderBuilder,
|
||||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||||
};
|
};
|
||||||
|
use reth_ethereum_engine_primitives::EthEngineTypes;
|
||||||
|
use reth_evm_ethereum::EthEvmConfig;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::{
|
||||||
consensus::Consensus,
|
|
||||||
executor::BlockExecutionError,
|
executor::BlockExecutionError,
|
||||||
p2p::{bodies::client::BodiesClient, either::EitherDownloader, headers::client::HeadersClient},
|
p2p::{bodies::client::BodiesClient, either::EitherDownloader, headers::client::HeadersClient},
|
||||||
sync::NoopSyncStateUpdater,
|
sync::NoopSyncStateUpdater,
|
||||||
@ -40,6 +39,8 @@ use reth_tasks::TokioTaskExecutor;
|
|||||||
use std::{collections::VecDeque, sync::Arc};
|
use std::{collections::VecDeque, sync::Arc};
|
||||||
use tokio::sync::{oneshot, watch};
|
use tokio::sync::{oneshot, watch};
|
||||||
|
|
||||||
|
type DatabaseEnv = TempDatabase<DE>;
|
||||||
|
|
||||||
type TestBeaconConsensusEngine<Client> = BeaconConsensusEngine<
|
type TestBeaconConsensusEngine<Client> = BeaconConsensusEngine<
|
||||||
Arc<DatabaseEnv>,
|
Arc<DatabaseEnv>,
|
||||||
BlockchainProvider<
|
BlockchainProvider<
|
||||||
|
|||||||
@ -15,6 +15,7 @@ workspace = true
|
|||||||
reth-primitives.workspace = true
|
reth-primitives.workspace = true
|
||||||
reth-interfaces.workspace = true
|
reth-interfaces.workspace = true
|
||||||
reth-provider.workspace = true
|
reth-provider.workspace = true
|
||||||
|
reth-consensus.workspace=true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
reth-interfaces = { workspace = true, features = ["test-utils"] }
|
reth-interfaces = { workspace = true, features = ["test-utils"] }
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
//! Collection of methods for block validation.
|
//! Collection of methods for block validation.
|
||||||
|
|
||||||
use reth_interfaces::{consensus::ConsensusError, RethResult};
|
use reth_consensus::ConsensusError;
|
||||||
|
use reth_interfaces::RethResult;
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
constants::eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK},
|
constants::eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK},
|
||||||
BlockNumber, ChainSpec, GotExpected, Hardfork, Header, InvalidTransactionError, SealedBlock,
|
BlockNumber, ChainSpec, GotExpected, Hardfork, Header, InvalidTransactionError, SealedBlock,
|
||||||
|
|||||||
18
crates/consensus/consensus/Cargo.toml
Normal file
18
crates/consensus/consensus/Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[package]
|
||||||
|
name = "reth-consensus"
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
reth-primitives.workspace = true
|
||||||
|
|
||||||
|
# misc
|
||||||
|
auto_impl.workspace = true
|
||||||
|
thiserror.workspace = true
|
||||||
@ -1,12 +1,19 @@
|
|||||||
|
//! Consensus protocol functions
|
||||||
|
|
||||||
|
#![doc(
|
||||||
|
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
||||||
|
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||||
|
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
|
||||||
|
)]
|
||||||
|
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||||
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
|
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
BlockHash, BlockNumber, GotExpected, GotExpectedBoxed, Header, HeaderValidationError,
|
BlockHash, BlockNumber, GotExpected, GotExpectedBoxed, Header, HeaderValidationError,
|
||||||
InvalidTransactionError, SealedBlock, SealedHeader, B256, U256,
|
InvalidTransactionError, SealedBlock, SealedHeader, B256, U256,
|
||||||
};
|
};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
/// Re-export fork choice state
|
|
||||||
pub use reth_rpc_types::engine::ForkchoiceState;
|
|
||||||
|
|
||||||
/// Consensus is a protocol that chooses canonical chain.
|
/// Consensus is a protocol that chooses canonical chain.
|
||||||
#[auto_impl::auto_impl(&, Arc)]
|
#[auto_impl::auto_impl(&, Arc)]
|
||||||
pub trait Consensus: Debug + Send + Sync {
|
pub trait Consensus: Debug + Send + Sync {
|
||||||
@ -12,9 +12,9 @@ workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
reth-primitives.workspace = true
|
reth-primitives.workspace = true
|
||||||
reth-rpc-types.workspace = true
|
|
||||||
reth-network-api.workspace = true
|
reth-network-api.workspace = true
|
||||||
reth-eth-wire-types.workspace = true
|
reth-eth-wire-types.workspace = true
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
# async
|
# async
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
//! Error handling for the blockchain tree
|
//! Error handling for the blockchain tree
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
consensus::ConsensusError,
|
|
||||||
executor::{BlockExecutionError, BlockValidationError},
|
executor::{BlockExecutionError, BlockValidationError},
|
||||||
provider::ProviderError,
|
provider::ProviderError,
|
||||||
RethError,
|
RethError,
|
||||||
};
|
};
|
||||||
|
use reth_consensus::ConsensusError;
|
||||||
use reth_primitives::{BlockHash, BlockNumber, SealedBlock};
|
use reth_primitives::{BlockHash, BlockNumber, SealedBlock};
|
||||||
|
|
||||||
/// Various error cases that can occur when a block violates tree assumptions.
|
/// Various error cases that can occur when a block violates tree assumptions.
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
blockchain_tree::error::{BlockchainTreeError, CanonicalError},
|
blockchain_tree::error::{BlockchainTreeError, CanonicalError},
|
||||||
consensus::ConsensusError,
|
|
||||||
db::DatabaseError,
|
db::DatabaseError,
|
||||||
executor::BlockExecutionError,
|
executor::BlockExecutionError,
|
||||||
provider::ProviderError,
|
provider::ProviderError,
|
||||||
};
|
};
|
||||||
|
use reth_consensus::ConsensusError;
|
||||||
use reth_network_api::NetworkError;
|
use reth_network_api::NetworkError;
|
||||||
use reth_primitives::fs::FsPathError;
|
use reth_primitives::fs::FsPathError;
|
||||||
|
|
||||||
|
|||||||
@ -12,9 +12,6 @@
|
|||||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
|
|
||||||
/// Consensus traits.
|
|
||||||
pub mod consensus;
|
|
||||||
|
|
||||||
/// Database error
|
/// Database error
|
||||||
pub mod db;
|
pub mod db;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
use super::headers::client::HeadersRequest;
|
use super::headers::client::HeadersRequest;
|
||||||
use crate::{consensus::ConsensusError, db::DatabaseError, provider::ProviderError};
|
use crate::{db::DatabaseError, provider::ProviderError};
|
||||||
|
use reth_consensus::ConsensusError;
|
||||||
use reth_network_api::ReputationChangeKind;
|
use reth_network_api::ReputationChangeKind;
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
BlockHashOrNumber, BlockNumber, GotExpected, GotExpectedBoxed, Header, WithPeerId, B256,
|
BlockHashOrNumber, BlockNumber, GotExpected, GotExpectedBoxed, Header, WithPeerId, B256,
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
use super::headers::client::HeadersRequest;
|
use super::headers::client::HeadersRequest;
|
||||||
use crate::{
|
use crate::p2p::{
|
||||||
consensus::{Consensus, ConsensusError},
|
bodies::client::{BodiesClient, SingleBodyRequest},
|
||||||
p2p::{
|
error::PeerRequestResult,
|
||||||
bodies::client::{BodiesClient, SingleBodyRequest},
|
headers::client::{HeadersClient, SingleHeaderRequest},
|
||||||
error::PeerRequestResult,
|
|
||||||
headers::client::{HeadersClient, SingleHeaderRequest},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
|
use reth_consensus::{Consensus, ConsensusError};
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
BlockBody, GotExpected, Header, HeadersDirection, SealedBlock, SealedHeader, WithPeerId, B256,
|
BlockBody, GotExpected, Header, HeadersDirection, SealedBlock, SealedHeader, WithPeerId, B256,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
use super::error::HeadersDownloaderResult;
|
use super::error::HeadersDownloaderResult;
|
||||||
use crate::{
|
use crate::p2p::error::{DownloadError, DownloadResult};
|
||||||
consensus::Consensus,
|
|
||||||
p2p::error::{DownloadError, DownloadResult},
|
|
||||||
};
|
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_primitives::{BlockHashOrNumber, SealedHeader, B256};
|
use reth_primitives::{BlockHashOrNumber, SealedHeader, B256};
|
||||||
|
|
||||||
/// A downloader capable of fetching and yielding block headers.
|
/// A downloader capable of fetching and yielding block headers.
|
||||||
///
|
///
|
||||||
/// A downloader represents a distinct strategy for submitting requests to download block headers,
|
/// A downloader represents a distinct strategy for submitting requests to download block headers,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use crate::consensus::ConsensusError;
|
use reth_consensus::ConsensusError;
|
||||||
use reth_primitives::SealedHeader;
|
use reth_primitives::SealedHeader;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ pub mod client;
|
|||||||
/// A downloader that receives and verifies block headers, is generic
|
/// A downloader that receives and verifies block headers, is generic
|
||||||
/// over the Consensus and the HeadersClient being used.
|
/// over the Consensus and the HeadersClient being used.
|
||||||
///
|
///
|
||||||
/// [`Consensus`]: crate::consensus::Consensus
|
/// [`Consensus`]: reth_consensus::Consensus
|
||||||
/// [`HeadersClient`]: client::HeadersClient
|
/// [`HeadersClient`]: client::HeadersClient
|
||||||
pub mod downloader;
|
pub mod downloader;
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ pub mod full_block;
|
|||||||
/// of a Linear and a Parallel downloader generic over the [`Consensus`] and
|
/// of a Linear and a Parallel downloader generic over the [`Consensus`] and
|
||||||
/// [`HeadersClient`].
|
/// [`HeadersClient`].
|
||||||
///
|
///
|
||||||
/// [`Consensus`]: crate::consensus::Consensus
|
/// [`Consensus`]: reth_consensus::Consensus
|
||||||
/// [`HeadersClient`]: crate::p2p::headers::client::HeadersClient
|
/// [`HeadersClient`]: crate::p2p::headers::client::HeadersClient
|
||||||
pub mod headers;
|
pub mod headers;
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,17 @@
|
|||||||
//! Testing support for headers related interfaces.
|
//! Testing support for headers related interfaces.
|
||||||
|
|
||||||
use crate::{
|
use crate::p2p::{
|
||||||
consensus::{self, Consensus, ConsensusError},
|
download::DownloadClient,
|
||||||
p2p::{
|
error::{DownloadError, DownloadResult, PeerRequestResult, RequestError},
|
||||||
download::DownloadClient,
|
headers::{
|
||||||
error::{DownloadError, DownloadResult, PeerRequestResult, RequestError},
|
client::{HeadersClient, HeadersRequest},
|
||||||
headers::{
|
downloader::{HeaderDownloader, SyncTarget},
|
||||||
client::{HeadersClient, HeadersRequest},
|
error::HeadersDownloaderResult,
|
||||||
downloader::{HeaderDownloader, SyncTarget},
|
|
||||||
error::HeadersDownloaderResult,
|
|
||||||
},
|
|
||||||
priority::Priority,
|
|
||||||
},
|
},
|
||||||
|
priority::Priority,
|
||||||
};
|
};
|
||||||
use futures::{Future, FutureExt, Stream, StreamExt};
|
use futures::{Future, FutureExt, Stream, StreamExt};
|
||||||
|
use reth_consensus::{Consensus, ConsensusError};
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
Header, HeadersDirection, PeerId, SealedBlock, SealedHeader, WithPeerId, U256,
|
Header, HeadersDirection, PeerId, SealedBlock, SealedHeader, WithPeerId, U256,
|
||||||
};
|
};
|
||||||
@ -274,7 +272,7 @@ impl TestConsensus {
|
|||||||
impl Consensus for TestConsensus {
|
impl Consensus for TestConsensus {
|
||||||
fn validate_header(&self, _header: &SealedHeader) -> Result<(), ConsensusError> {
|
fn validate_header(&self, _header: &SealedHeader) -> Result<(), ConsensusError> {
|
||||||
if self.fail_validation() {
|
if self.fail_validation() {
|
||||||
Err(consensus::ConsensusError::BaseFeeMissing)
|
Err(ConsensusError::BaseFeeMissing)
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -286,7 +284,7 @@ impl Consensus for TestConsensus {
|
|||||||
_parent: &SealedHeader,
|
_parent: &SealedHeader,
|
||||||
) -> Result<(), ConsensusError> {
|
) -> Result<(), ConsensusError> {
|
||||||
if self.fail_validation() {
|
if self.fail_validation() {
|
||||||
Err(consensus::ConsensusError::BaseFeeMissing)
|
Err(ConsensusError::BaseFeeMissing)
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -298,15 +296,15 @@ impl Consensus for TestConsensus {
|
|||||||
_total_difficulty: U256,
|
_total_difficulty: U256,
|
||||||
) -> Result<(), ConsensusError> {
|
) -> Result<(), ConsensusError> {
|
||||||
if self.fail_validation() {
|
if self.fail_validation() {
|
||||||
Err(consensus::ConsensusError::BaseFeeMissing)
|
Err(ConsensusError::BaseFeeMissing)
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_block(&self, _block: &SealedBlock) -> Result<(), consensus::ConsensusError> {
|
fn validate_block(&self, _block: &SealedBlock) -> Result<(), ConsensusError> {
|
||||||
if self.fail_validation() {
|
if self.fail_validation() {
|
||||||
Err(consensus::ConsensusError::BaseFeeMissing)
|
Err(ConsensusError::BaseFeeMissing)
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ reth-primitives.workspace = true
|
|||||||
reth-tasks.workspace = true
|
reth-tasks.workspace = true
|
||||||
reth-provider.workspace = true
|
reth-provider.workspace = true
|
||||||
reth-config.workspace = true
|
reth-config.workspace = true
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
# async
|
# async
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
|
|||||||
@ -3,16 +3,14 @@ use crate::{bodies::task::TaskDownloader, metrics::BodyDownloaderMetrics};
|
|||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
use reth_config::BodiesConfig;
|
use reth_config::BodiesConfig;
|
||||||
use reth_interfaces::{
|
use reth_consensus::Consensus;
|
||||||
consensus::Consensus,
|
use reth_interfaces::p2p::{
|
||||||
p2p::{
|
bodies::{
|
||||||
bodies::{
|
client::BodiesClient,
|
||||||
client::BodiesClient,
|
downloader::{BodyDownloader, BodyDownloaderResult},
|
||||||
downloader::{BodyDownloader, BodyDownloaderResult},
|
response::BlockResponse,
|
||||||
response::BlockResponse,
|
|
||||||
},
|
|
||||||
error::{DownloadError, DownloadResult},
|
|
||||||
},
|
},
|
||||||
|
error::{DownloadError, DownloadResult},
|
||||||
};
|
};
|
||||||
use reth_primitives::{BlockNumber, SealedHeader};
|
use reth_primitives::{BlockNumber, SealedHeader};
|
||||||
use reth_provider::HeaderProvider;
|
use reth_provider::HeaderProvider;
|
||||||
|
|||||||
@ -2,12 +2,10 @@ use super::request::BodiesRequestFuture;
|
|||||||
use crate::metrics::BodyDownloaderMetrics;
|
use crate::metrics::BodyDownloaderMetrics;
|
||||||
use futures::{stream::FuturesUnordered, Stream};
|
use futures::{stream::FuturesUnordered, Stream};
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
use reth_interfaces::{
|
use reth_consensus::Consensus;
|
||||||
consensus::Consensus,
|
use reth_interfaces::p2p::{
|
||||||
p2p::{
|
bodies::{client::BodiesClient, response::BlockResponse},
|
||||||
bodies::{client::BodiesClient, response::BlockResponse},
|
error::DownloadResult,
|
||||||
error::DownloadResult,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use reth_primitives::{BlockNumber, SealedHeader};
|
use reth_primitives::{BlockNumber, SealedHeader};
|
||||||
use std::{
|
use std::{
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
use crate::metrics::{BodyDownloaderMetrics, ResponseMetrics};
|
use crate::metrics::{BodyDownloaderMetrics, ResponseMetrics};
|
||||||
use futures::{Future, FutureExt};
|
use futures::{Future, FutureExt};
|
||||||
use reth_interfaces::{
|
use reth_consensus::Consensus;
|
||||||
consensus::{Consensus as ConsensusTrait, Consensus},
|
use reth_interfaces::p2p::{
|
||||||
p2p::{
|
bodies::{client::BodiesClient, response::BlockResponse},
|
||||||
bodies::{client::BodiesClient, response::BlockResponse},
|
error::{DownloadError, DownloadResult},
|
||||||
error::{DownloadError, DownloadResult},
|
priority::Priority,
|
||||||
priority::Priority,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
BlockBody, GotExpected, PeerId, SealedBlock, SealedHeader, WithPeerId, B256,
|
BlockBody, GotExpected, PeerId, SealedBlock, SealedHeader, WithPeerId, B256,
|
||||||
|
|||||||
@ -42,8 +42,9 @@ impl TaskDownloader {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// use reth_consensus::Consensus;
|
||||||
/// use reth_downloaders::bodies::{bodies::BodiesDownloaderBuilder, task::TaskDownloader};
|
/// use reth_downloaders::bodies::{bodies::BodiesDownloaderBuilder, task::TaskDownloader};
|
||||||
/// use reth_interfaces::{consensus::Consensus, p2p::bodies::client::BodiesClient};
|
/// use reth_interfaces::p2p::bodies::client::BodiesClient;
|
||||||
/// use reth_provider::HeaderProvider;
|
/// use reth_provider::HeaderProvider;
|
||||||
/// use std::sync::Arc;
|
/// use std::sync::Arc;
|
||||||
///
|
///
|
||||||
|
|||||||
@ -6,17 +6,15 @@ use futures::{stream::Stream, FutureExt};
|
|||||||
use futures_util::{stream::FuturesUnordered, StreamExt};
|
use futures_util::{stream::FuturesUnordered, StreamExt};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use reth_config::config::HeadersConfig;
|
use reth_config::config::HeadersConfig;
|
||||||
use reth_interfaces::{
|
use reth_consensus::Consensus;
|
||||||
consensus::Consensus,
|
use reth_interfaces::p2p::{
|
||||||
p2p::{
|
error::{DownloadError, DownloadResult, PeerRequestResult},
|
||||||
error::{DownloadError, DownloadResult, PeerRequestResult},
|
headers::{
|
||||||
headers::{
|
client::{HeadersClient, HeadersRequest},
|
||||||
client::{HeadersClient, HeadersRequest},
|
downloader::{validate_header_download, HeaderDownloader, SyncTarget},
|
||||||
downloader::{validate_header_download, HeaderDownloader, SyncTarget},
|
error::{HeadersDownloaderError, HeadersDownloaderResult},
|
||||||
error::{HeadersDownloaderError, HeadersDownloaderResult},
|
|
||||||
},
|
|
||||||
priority::Priority,
|
|
||||||
},
|
},
|
||||||
|
priority::Priority,
|
||||||
};
|
};
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
BlockHashOrNumber, BlockNumber, GotExpected, Header, HeadersDirection, PeerId, SealedHeader,
|
BlockHashOrNumber, BlockNumber, GotExpected, Header, HeadersDirection, PeerId, SealedHeader,
|
||||||
|
|||||||
@ -44,7 +44,7 @@ impl TaskDownloader {
|
|||||||
/// # use std::sync::Arc;
|
/// # use std::sync::Arc;
|
||||||
/// # use reth_downloaders::headers::reverse_headers::ReverseHeadersDownloader;
|
/// # use reth_downloaders::headers::reverse_headers::ReverseHeadersDownloader;
|
||||||
/// # use reth_downloaders::headers::task::TaskDownloader;
|
/// # use reth_downloaders::headers::task::TaskDownloader;
|
||||||
/// # use reth_interfaces::consensus::Consensus;
|
/// # use reth_consensus::Consensus;
|
||||||
/// # use reth_interfaces::p2p::headers::client::HeadersClient;
|
/// # use reth_interfaces::p2p::headers::client::HeadersClient;
|
||||||
/// # fn t<H: HeadersClient + 'static>(consensus:Arc<dyn Consensus>, client: Arc<H>) {
|
/// # fn t<H: HeadersClient + 'static>(consensus:Arc<dyn Consensus>, client: Arc<H>) {
|
||||||
/// let downloader = ReverseHeadersDownloader::<H>::builder().build(
|
/// let downloader = ReverseHeadersDownloader::<H>::builder().build(
|
||||||
|
|||||||
@ -27,6 +27,7 @@ reth-transaction-pool.workspace = true
|
|||||||
reth-provider.workspace = true
|
reth-provider.workspace = true
|
||||||
reth-rpc-types.workspace = true
|
reth-rpc-types.workspace = true
|
||||||
reth-tokio-util.workspace = true
|
reth-tokio-util.workspace = true
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
# ethereum
|
# ethereum
|
||||||
enr = { workspace = true, features = ["serde", "rust-secp256k1"] }
|
enr = { workspace = true, features = ["serde", "rust-secp256k1"] }
|
||||||
|
|||||||
@ -50,7 +50,7 @@ pub enum BlockValidation {
|
|||||||
pub enum BlockImportError {
|
pub enum BlockImportError {
|
||||||
/// Consensus error
|
/// Consensus error
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Consensus(#[from] reth_interfaces::consensus::ConsensusError),
|
Consensus(#[from] reth_consensus::ConsensusError),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An implementation of `BlockImport` used in Proof-of-Stake consensus that does nothing.
|
/// An implementation of `BlockImport` used in Proof-of-Stake consensus that does nothing.
|
||||||
|
|||||||
@ -37,6 +37,7 @@ reth-stages.workspace = true
|
|||||||
reth-config.workspace = true
|
reth-config.workspace = true
|
||||||
reth-downloaders.workspace = true
|
reth-downloaders.workspace = true
|
||||||
reth-node-events.workspace = true
|
reth-node-events.workspace = true
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
## async
|
## async
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
|
|||||||
@ -22,6 +22,7 @@ use reth_blockchain_tree::{
|
|||||||
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
|
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
|
||||||
};
|
};
|
||||||
use reth_config::config::EtlConfig;
|
use reth_config::config::EtlConfig;
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{
|
use reth_db::{
|
||||||
database::Database,
|
database::Database,
|
||||||
database_metrics::{DatabaseMetadata, DatabaseMetrics},
|
database_metrics::{DatabaseMetadata, DatabaseMetrics},
|
||||||
@ -29,7 +30,7 @@ use reth_db::{
|
|||||||
DatabaseEnv,
|
DatabaseEnv,
|
||||||
};
|
};
|
||||||
use reth_exex::{ExExContext, ExExHandle, ExExManager, ExExManagerHandle};
|
use reth_exex::{ExExContext, ExExHandle, ExExManager, ExExManagerHandle};
|
||||||
use reth_interfaces::{consensus::Consensus, p2p::either::EitherDownloader};
|
use reth_interfaces::p2p::either::EitherDownloader;
|
||||||
use reth_network::{NetworkBuilder, NetworkConfig, NetworkEvents, NetworkHandle};
|
use reth_network::{NetworkBuilder, NetworkConfig, NetworkEvents, NetworkHandle};
|
||||||
use reth_node_api::{
|
use reth_node_api::{
|
||||||
FullNodeComponents, FullNodeComponentsAdapter, FullNodeTypes, FullNodeTypesAdapter, NodeTypes,
|
FullNodeComponents, FullNodeComponentsAdapter, FullNodeTypes, FullNodeTypesAdapter, NodeTypes,
|
||||||
|
|||||||
@ -2,18 +2,16 @@
|
|||||||
|
|
||||||
use crate::ConfigureEvm;
|
use crate::ConfigureEvm;
|
||||||
use reth_config::{config::StageConfig, PruneConfig};
|
use reth_config::{config::StageConfig, PruneConfig};
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::database::Database;
|
use reth_db::database::Database;
|
||||||
use reth_downloaders::{
|
use reth_downloaders::{
|
||||||
bodies::bodies::BodiesDownloaderBuilder,
|
bodies::bodies::BodiesDownloaderBuilder,
|
||||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||||
};
|
};
|
||||||
use reth_exex::ExExManagerHandle;
|
use reth_exex::ExExManagerHandle;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::p2p::{
|
||||||
consensus::Consensus,
|
bodies::{client::BodiesClient, downloader::BodyDownloader},
|
||||||
p2p::{
|
headers::{client::HeadersClient, downloader::HeaderDownloader},
|
||||||
bodies::{client::BodiesClient, downloader::BodyDownloader},
|
|
||||||
headers::{client::HeadersClient, downloader::HeaderDownloader},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use reth_node_core::{
|
use reth_node_core::{
|
||||||
node_config::NodeConfig,
|
node_config::NodeConfig,
|
||||||
|
|||||||
@ -18,9 +18,9 @@ reth-network-api.workspace = true
|
|||||||
reth-stages.workspace = true
|
reth-stages.workspace = true
|
||||||
reth-prune.workspace = true
|
reth-prune.workspace = true
|
||||||
reth-static-file.workspace = true
|
reth-static-file.workspace = true
|
||||||
reth-interfaces.workspace = true
|
|
||||||
reth-db.workspace = true
|
reth-db.workspace = true
|
||||||
reth-primitives.workspace = true
|
reth-primitives.workspace = true
|
||||||
|
reth-rpc-types.workspace = true
|
||||||
|
|
||||||
# async
|
# async
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
|
|||||||
@ -6,7 +6,6 @@ use reth_beacon_consensus::{
|
|||||||
BeaconConsensusEngineEvent, ConsensusEngineLiveSyncProgress, ForkchoiceStatus,
|
BeaconConsensusEngineEvent, ConsensusEngineLiveSyncProgress, ForkchoiceStatus,
|
||||||
};
|
};
|
||||||
use reth_db::{database::Database, database_metrics::DatabaseMetadata};
|
use reth_db::{database::Database, database_metrics::DatabaseMetadata};
|
||||||
use reth_interfaces::consensus::ForkchoiceState;
|
|
||||||
use reth_network::{NetworkEvent, NetworkHandle};
|
use reth_network::{NetworkEvent, NetworkHandle};
|
||||||
use reth_network_api::PeersInfo;
|
use reth_network_api::PeersInfo;
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
@ -15,6 +14,7 @@ use reth_primitives::{
|
|||||||
BlockNumber, B256,
|
BlockNumber, B256,
|
||||||
};
|
};
|
||||||
use reth_prune::PrunerEvent;
|
use reth_prune::PrunerEvent;
|
||||||
|
use reth_rpc_types::engine::ForkchoiceState;
|
||||||
use reth_stages::{ExecOutput, PipelineEvent};
|
use reth_stages::{ExecOutput, PipelineEvent};
|
||||||
use reth_static_file::StaticFileProducerEvent;
|
use reth_static_file::StaticFileProducerEvent;
|
||||||
use std::{
|
use std::{
|
||||||
|
|||||||
@ -14,7 +14,6 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# reth
|
# reth
|
||||||
reth-primitives.workspace = true
|
reth-primitives.workspace = true
|
||||||
reth-interfaces.workspace = true
|
|
||||||
reth-provider.workspace = true
|
reth-provider.workspace = true
|
||||||
reth-rpc-types.workspace = true
|
reth-rpc-types.workspace = true
|
||||||
reth-rpc-api.workspace = true
|
reth-rpc-api.workspace = true
|
||||||
|
|||||||
@ -6,15 +6,14 @@ use reth_engine_primitives::{
|
|||||||
validate_payload_timestamp, EngineApiMessageVersion, EngineTypes, PayloadAttributes,
|
validate_payload_timestamp, EngineApiMessageVersion, EngineTypes, PayloadAttributes,
|
||||||
PayloadBuilderAttributes, PayloadOrAttributes,
|
PayloadBuilderAttributes, PayloadOrAttributes,
|
||||||
};
|
};
|
||||||
use reth_interfaces::consensus::ForkchoiceState;
|
|
||||||
use reth_payload_builder::PayloadStore;
|
use reth_payload_builder::PayloadStore;
|
||||||
use reth_primitives::{BlockHash, BlockHashOrNumber, BlockNumber, ChainSpec, Hardfork, B256, U64};
|
use reth_primitives::{BlockHash, BlockHashOrNumber, BlockNumber, ChainSpec, Hardfork, B256, U64};
|
||||||
use reth_provider::{BlockReader, EvmEnvProvider, HeaderProvider, StateProviderFactory};
|
use reth_provider::{BlockReader, EvmEnvProvider, HeaderProvider, StateProviderFactory};
|
||||||
use reth_rpc_api::EngineApiServer;
|
use reth_rpc_api::EngineApiServer;
|
||||||
use reth_rpc_types::engine::{
|
use reth_rpc_types::engine::{
|
||||||
CancunPayloadFields, ExecutionPayload, ExecutionPayloadBodiesV1, ExecutionPayloadInputV2,
|
CancunPayloadFields, ExecutionPayload, ExecutionPayloadBodiesV1, ExecutionPayloadInputV2,
|
||||||
ExecutionPayloadV1, ExecutionPayloadV3, ForkchoiceUpdated, PayloadId, PayloadStatus,
|
ExecutionPayloadV1, ExecutionPayloadV3, ForkchoiceState, ForkchoiceUpdated, PayloadId,
|
||||||
TransitionConfiguration, CAPABILITIES,
|
PayloadStatus, TransitionConfiguration, CAPABILITIES,
|
||||||
};
|
};
|
||||||
use reth_rpc_types_compat::engine::payload::{
|
use reth_rpc_types_compat::engine::payload::{
|
||||||
convert_payload_input_v2_to_payload, convert_to_payload_body_v1,
|
convert_payload_input_v2_to_payload, convert_to_payload_body_v1,
|
||||||
|
|||||||
@ -18,6 +18,7 @@ reth-db.workspace = true
|
|||||||
reth-interfaces.workspace = true
|
reth-interfaces.workspace = true
|
||||||
reth-static-file.workspace = true
|
reth-static-file.workspace = true
|
||||||
reth-tokio-util.workspace = true
|
reth-tokio-util.workspace = true
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
# metrics
|
# metrics
|
||||||
reth-metrics.workspace = true
|
reth-metrics.workspace = true
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
|
use reth_consensus::ConsensusError;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::{
|
||||||
consensus, db::DatabaseError as DbError, executor, p2p::error::DownloadError, RethError,
|
db::DatabaseError as DbError, executor, p2p::error::DownloadError, RethError,
|
||||||
};
|
};
|
||||||
use reth_primitives::{BlockNumber, SealedHeader, StaticFileSegment, TxNumber};
|
use reth_primitives::{BlockNumber, SealedHeader, StaticFileSegment, TxNumber};
|
||||||
use reth_provider::ProviderError;
|
use reth_provider::ProviderError;
|
||||||
@ -13,7 +14,7 @@ use tokio::sync::mpsc::error::SendError;
|
|||||||
pub enum BlockErrorKind {
|
pub enum BlockErrorKind {
|
||||||
/// The block encountered a validation error.
|
/// The block encountered a validation error.
|
||||||
#[error("validation error: {0}")]
|
#[error("validation error: {0}")]
|
||||||
Validation(#[from] consensus::ConsensusError),
|
Validation(#[from] ConsensusError),
|
||||||
/// The block encountered an execution error.
|
/// The block encountered an execution error.
|
||||||
#[error("execution error: {0}")]
|
#[error("execution error: {0}")]
|
||||||
Execution(#[from] executor::BlockExecutionError),
|
Execution(#[from] executor::BlockExecutionError),
|
||||||
@ -49,7 +50,7 @@ pub enum StageError {
|
|||||||
header: Box<SealedHeader>,
|
header: Box<SealedHeader>,
|
||||||
/// The error that occurred when attempting to attach the header.
|
/// The error that occurred when attempting to attach the header.
|
||||||
#[source]
|
#[source]
|
||||||
error: Box<consensus::ConsensusError>,
|
error: Box<ConsensusError>,
|
||||||
},
|
},
|
||||||
/// The headers stage is missing sync gap.
|
/// The headers stage is missing sync gap.
|
||||||
#[error("missing sync gap")]
|
#[error("missing sync gap")]
|
||||||
|
|||||||
@ -552,8 +552,8 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::{test_utils::TestStage, UnwindOutput};
|
use crate::{test_utils::TestStage, UnwindOutput};
|
||||||
use assert_matches::assert_matches;
|
use assert_matches::assert_matches;
|
||||||
|
use reth_consensus::ConsensusError;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::{
|
||||||
consensus,
|
|
||||||
provider::ProviderError,
|
provider::ProviderError,
|
||||||
test_utils::{generators, generators::random_header},
|
test_utils::{generators, generators::random_header},
|
||||||
};
|
};
|
||||||
@ -922,9 +922,7 @@ mod tests {
|
|||||||
5,
|
5,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)),
|
)),
|
||||||
error: BlockErrorKind::Validation(
|
error: BlockErrorKind::Validation(ConsensusError::BaseFeeMissing),
|
||||||
consensus::ConsensusError::BaseFeeMissing,
|
|
||||||
),
|
|
||||||
}))
|
}))
|
||||||
.add_unwind(Ok(UnwindOutput { checkpoint: StageCheckpoint::new(0) }))
|
.add_unwind(Ok(UnwindOutput { checkpoint: StageCheckpoint::new(0) }))
|
||||||
.add_exec(Ok(ExecOutput { checkpoint: StageCheckpoint::new(10), done: true })),
|
.add_exec(Ok(ExecOutput { checkpoint: StageCheckpoint::new(10), done: true })),
|
||||||
|
|||||||
@ -23,6 +23,7 @@ reth-trie = { workspace = true, features = ["metrics"] }
|
|||||||
reth-etl.workspace = true
|
reth-etl.workspace = true
|
||||||
reth-config.workspace = true
|
reth-config.workspace = true
|
||||||
reth-stages-api = { workspace = true, features = ["test-utils"] }
|
reth-stages-api = { workspace = true, features = ["test-utils"] }
|
||||||
|
reth-consensus.workspace = true
|
||||||
|
|
||||||
# async
|
# async
|
||||||
tokio = { workspace = true, features = ["sync"] }
|
tokio = { workspace = true, features = ["sync"] }
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
//! # use std::sync::Arc;
|
//! # use std::sync::Arc;
|
||||||
//! # use reth_downloaders::bodies::bodies::BodiesDownloaderBuilder;
|
//! # use reth_downloaders::bodies::bodies::BodiesDownloaderBuilder;
|
||||||
//! # use reth_downloaders::headers::reverse_headers::ReverseHeadersDownloaderBuilder;
|
//! # use reth_downloaders::headers::reverse_headers::ReverseHeadersDownloaderBuilder;
|
||||||
//! # use reth_interfaces::consensus::Consensus;
|
|
||||||
//! # use reth_interfaces::test_utils::{TestBodiesClient, TestConsensus, TestHeadersClient};
|
//! # use reth_interfaces::test_utils::{TestBodiesClient, TestConsensus, TestHeadersClient};
|
||||||
//! # use reth_revm::EvmProcessorFactory;
|
//! # use reth_revm::EvmProcessorFactory;
|
||||||
//! # use reth_primitives::{PeerId, MAINNET, B256, PruneModes};
|
//! # use reth_primitives::{PeerId, MAINNET, B256, PruneModes};
|
||||||
@ -28,6 +27,7 @@
|
|||||||
//! # use reth_provider::test_utils::create_test_provider_factory;
|
//! # use reth_provider::test_utils::create_test_provider_factory;
|
||||||
//! # use reth_static_file::StaticFileProducer;
|
//! # use reth_static_file::StaticFileProducer;
|
||||||
//! # use reth_config::config::EtlConfig;
|
//! # use reth_config::config::EtlConfig;
|
||||||
|
//! # use reth_consensus::Consensus;
|
||||||
//! #
|
//! #
|
||||||
//! # let chain_spec = MAINNET.clone();
|
//! # let chain_spec = MAINNET.clone();
|
||||||
//! # let consensus: Arc<dyn Consensus> = Arc::new(TestConsensus::default());
|
//! # let consensus: Arc<dyn Consensus> = Arc::new(TestConsensus::default());
|
||||||
|
|||||||
@ -58,10 +58,10 @@ use crate::{
|
|||||||
StageSet, StageSetBuilder,
|
StageSet, StageSetBuilder,
|
||||||
};
|
};
|
||||||
use reth_config::config::EtlConfig;
|
use reth_config::config::EtlConfig;
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::database::Database;
|
use reth_db::database::Database;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::p2p::{
|
||||||
consensus::Consensus,
|
bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader,
|
||||||
p2p::{bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader},
|
|
||||||
};
|
};
|
||||||
use reth_provider::{ExecutorFactory, HeaderSyncGapProvider, HeaderSyncMode};
|
use reth_provider::{ExecutorFactory, HeaderSyncGapProvider, HeaderSyncMode};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
use reth_codecs::Compact;
|
use reth_codecs::Compact;
|
||||||
use reth_config::config::EtlConfig;
|
use reth_config::config::EtlConfig;
|
||||||
|
use reth_consensus::Consensus;
|
||||||
use reth_db::{
|
use reth_db::{
|
||||||
cursor::{DbCursorRO, DbCursorRW},
|
cursor::{DbCursorRO, DbCursorRW},
|
||||||
database::Database,
|
database::Database,
|
||||||
@ -10,7 +11,6 @@ use reth_db::{
|
|||||||
};
|
};
|
||||||
use reth_etl::Collector;
|
use reth_etl::Collector;
|
||||||
use reth_interfaces::{
|
use reth_interfaces::{
|
||||||
consensus::Consensus,
|
|
||||||
p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError},
|
p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError},
|
||||||
provider::ProviderError,
|
provider::ProviderError,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
use reth_codecs::Compact;
|
use reth_codecs::Compact;
|
||||||
|
use reth_consensus::ConsensusError;
|
||||||
use reth_db::{
|
use reth_db::{
|
||||||
database::Database,
|
database::Database,
|
||||||
tables,
|
tables,
|
||||||
transaction::{DbTx, DbTxMut},
|
transaction::{DbTx, DbTxMut},
|
||||||
};
|
};
|
||||||
use reth_interfaces::consensus;
|
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
stage::{EntitiesCheckpoint, MerkleCheckpoint, StageCheckpoint, StageId},
|
stage::{EntitiesCheckpoint, MerkleCheckpoint, StageCheckpoint, StageId},
|
||||||
trie::StoredSubNode,
|
trie::StoredSubNode,
|
||||||
@ -327,7 +327,7 @@ fn validate_state_root(
|
|||||||
} else {
|
} else {
|
||||||
warn!(target: "sync::stages::merkle", ?target_block, ?got, ?expected, "Failed to verify block state root");
|
warn!(target: "sync::stages::merkle", ?target_block, ?got, ?expected, "Failed to verify block state root");
|
||||||
Err(StageError::Block {
|
Err(StageError::Block {
|
||||||
error: BlockErrorKind::Validation(consensus::ConsensusError::BodyStateRootDiff(
|
error: BlockErrorKind::Validation(ConsensusError::BodyStateRootDiff(
|
||||||
GotExpected { got, expected: expected.state_root }.into(),
|
GotExpected { got, expected: expected.state_root }.into(),
|
||||||
)),
|
)),
|
||||||
block: Box::new(expected),
|
block: Box::new(expected),
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
use reth_consensus::ConsensusError;
|
||||||
use reth_db::{
|
use reth_db::{
|
||||||
cursor::DbCursorRW,
|
cursor::DbCursorRW,
|
||||||
database::Database,
|
database::Database,
|
||||||
@ -6,7 +7,6 @@ use reth_db::{
|
|||||||
transaction::{DbTx, DbTxMut},
|
transaction::{DbTx, DbTxMut},
|
||||||
RawValue,
|
RawValue,
|
||||||
};
|
};
|
||||||
use reth_interfaces::consensus;
|
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
stage::{EntitiesCheckpoint, StageCheckpoint, StageId},
|
stage::{EntitiesCheckpoint, StageCheckpoint, StageId},
|
||||||
Address, PruneSegment, StaticFileSegment, TransactionSignedNoHash, TxNumber,
|
Address, PruneSegment, StaticFileSegment, TransactionSignedNoHash, TxNumber,
|
||||||
@ -209,7 +209,7 @@ fn recover_range<DB: Database>(
|
|||||||
Err(StageError::Block {
|
Err(StageError::Block {
|
||||||
block: Box::new(sealed_header),
|
block: Box::new(sealed_header),
|
||||||
error: BlockErrorKind::Validation(
|
error: BlockErrorKind::Validation(
|
||||||
consensus::ConsensusError::TransactionSignerRecoveryError,
|
ConsensusError::TransactionSignerRecoveryError,
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ workspace = true
|
|||||||
# reth
|
# reth
|
||||||
reth-primitives.workspace = true
|
reth-primitives.workspace = true
|
||||||
reth-interfaces.workspace = true
|
reth-interfaces.workspace = true
|
||||||
|
reth-rpc-types.workspace = true
|
||||||
reth-db.workspace = true
|
reth-db.workspace = true
|
||||||
reth-trie = { workspace = true, features = ["metrics"] }
|
reth-trie = { workspace = true, features = ["metrics"] }
|
||||||
reth-nippy-jar.workspace = true
|
reth-nippy-jar.workspace = true
|
||||||
|
|||||||
@ -17,7 +17,6 @@ use reth_interfaces::{
|
|||||||
BlockValidationKind, BlockchainTreeEngine, BlockchainTreeViewer, CanonicalOutcome,
|
BlockValidationKind, BlockchainTreeEngine, BlockchainTreeViewer, CanonicalOutcome,
|
||||||
InsertPayloadOk,
|
InsertPayloadOk,
|
||||||
},
|
},
|
||||||
consensus::ForkchoiceState,
|
|
||||||
provider::ProviderResult,
|
provider::ProviderResult,
|
||||||
RethResult,
|
RethResult,
|
||||||
};
|
};
|
||||||
@ -61,6 +60,7 @@ use chain_info::ChainInfoTracker;
|
|||||||
|
|
||||||
mod consistent_view;
|
mod consistent_view;
|
||||||
pub use consistent_view::{ConsistentDbView, ConsistentViewError};
|
pub use consistent_view::{ConsistentDbView, ConsistentViewError};
|
||||||
|
use reth_rpc_types::engine::ForkchoiceState;
|
||||||
|
|
||||||
/// The main type for interacting with the blockchain.
|
/// The main type for interacting with the blockchain.
|
||||||
///
|
///
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use reth_interfaces::consensus::ForkchoiceState;
|
|
||||||
use reth_primitives::SealedHeader;
|
use reth_primitives::SealedHeader;
|
||||||
|
use reth_rpc_types::engine::ForkchoiceState;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
/// A type that can track updates related to fork choice updates.
|
/// A type that can track updates related to fork choice updates.
|
||||||
|
|||||||
Reference in New Issue
Block a user