feat: use OpChainSpec in OptimismNode and its components (#11304)

This commit is contained in:
Arsenii Kulikov
2024-09-28 16:06:52 +03:00
committed by GitHub
parent b090578b77
commit 2aa3dd0fd8
65 changed files with 379 additions and 284 deletions

View File

@ -10,7 +10,7 @@ pub use states::*;
use std::sync::Arc;
use futures::Future;
use reth_chainspec::{ChainSpec, EthChainSpec, EthereumHardforks, Hardforks};
use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks};
use reth_cli_util::get_secret_key;
use reth_db_api::{
database::Database,
@ -641,7 +641,7 @@ impl<Node: FullNodeTypes> BuilderContext<Node> {
}
}
impl<Node: FullNodeTypes<Types: NodeTypes<ChainSpec = ChainSpec>>> BuilderContext<Node> {
impl<Node: FullNodeTypes<Types: NodeTypes<ChainSpec: Hardforks>>> BuilderContext<Node> {
/// Creates the [`NetworkBuilder`] for the node.
pub async fn network_builder(&self) -> eyre::Result<NetworkBuilder<(), ()>> {
let network_config = self.network_config()?;

View File

@ -10,7 +10,7 @@ use reth_beacon_consensus::EthBeaconConsensus;
use reth_blockchain_tree::{
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
};
use reth_chainspec::{Chain, ChainSpec, EthChainSpec, EthereumHardforks};
use reth_chainspec::{Chain, EthChainSpec, EthereumHardforks};
use reth_config::{config::EtlConfig, PruneConfig};
use reth_consensus::Consensus;
use reth_db_api::database::Database;
@ -879,8 +879,8 @@ impl<T, CB>
>
where
T: FullNodeTypes<
Provider: WithTree + StateProviderFactory + ChainSpecProvider<ChainSpec = ChainSpec>,
Types: NodeTypes<ChainSpec = ChainSpec>,
Provider: WithTree + StateProviderFactory + ChainSpecProvider,
Types: NodeTypes<ChainSpec: EthereumHardforks>,
>,
CB: NodeComponentsBuilder<T>,
{

View File

@ -7,7 +7,7 @@ use reth_beacon_consensus::{
BeaconConsensusEngineHandle,
};
use reth_blockchain_tree::BlockchainTreeConfig;
use reth_chainspec::ChainSpec;
use reth_chainspec::EthChainSpec;
use reth_consensus_debug_client::{DebugConsensusClient, EtherscanBlockProvider};
use reth_engine_service::service::{ChainEvent, EngineService};
use reth_engine_tree::{
@ -18,9 +18,7 @@ use reth_engine_util::EngineMessageStreamExt;
use reth_exex::ExExManagerHandle;
use reth_network::{NetworkSyncUpdater, SyncState};
use reth_network_api::{BlockDownloaderProvider, NetworkEventListenerProvider};
use reth_node_api::{
BuiltPayload, FullNodeTypes, NodeAddOns, NodeTypesWithDB, NodeTypesWithEngine,
};
use reth_node_api::{BuiltPayload, FullNodeTypes, NodeAddOns, NodeTypesWithEngine};
use reth_node_core::{
dirs::{ChainPath, DataDirPath},
exit::NodeExitFuture,
@ -30,7 +28,8 @@ use reth_node_core::{
};
use reth_node_events::{cl::ConsensusLayerHealthEvents, node};
use reth_payload_primitives::PayloadBuilder;
use reth_provider::providers::BlockchainProvider2;
use reth_primitives::EthereumHardforks;
use reth_provider::providers::{BlockchainProvider2, ProviderNodeTypes};
use reth_rpc_engine_api::{capabilities::EngineCapabilities, EngineApi};
use reth_tasks::TaskExecutor;
use reth_tokio_util::EventSender;
@ -72,7 +71,7 @@ impl EngineNodeLauncher {
impl<Types, T, CB, AO> LaunchNode<NodeBuilderWithComponents<T, CB, AO>> for EngineNodeLauncher
where
Types: NodeTypesWithDB<ChainSpec = ChainSpec> + NodeTypesWithEngine,
Types: ProviderNodeTypes + NodeTypesWithEngine,
T: FullNodeTypes<Types = Types, Provider = BlockchainProvider2<Types>>,
CB: NodeComponentsBuilder<T>,
AO: NodeAddOns<
@ -127,7 +126,7 @@ where
debug!(target: "reth::cli", chain=%this.chain_id(), genesis=?this.genesis_hash(), "Initializing genesis");
})
.with_genesis()?
.inspect(|this: &LaunchContextWith<Attached<WithConfigs<ChainSpec>, _>>| {
.inspect(|this: &LaunchContextWith<Attached<WithConfigs<Types::ChainSpec>, _>>| {
info!(target: "reth::cli", "\n{}", this.chain_spec().display_hardforks());
})
.with_metrics_task()
@ -296,7 +295,7 @@ where
if let Some(maybe_custom_etherscan_url) = ctx.node_config().debug.etherscan.clone() {
info!(target: "reth::cli", "Using etherscan as consensus client");
let chain = ctx.node_config().chain.chain;
let chain = ctx.node_config().chain.chain();
let etherscan_url = maybe_custom_etherscan_url.map(Ok).unwrap_or_else(|| {
// If URL isn't provided, use default Etherscan URL for the chain if it is known
chain