mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: introduce OpNetworkPrimitives (#13335)
This commit is contained in:
@ -52,7 +52,7 @@ use reth_node_core::{
|
||||
version::{LONG_VERSION, SHORT_VERSION},
|
||||
};
|
||||
use reth_optimism_evm::OpExecutorProvider;
|
||||
use reth_optimism_node::OpNode;
|
||||
use reth_optimism_node::{OpNetworkPrimitives, OpNode};
|
||||
use reth_tracing::FileWorkerGuard;
|
||||
use tracing::info;
|
||||
|
||||
@ -164,9 +164,12 @@ where
|
||||
Commands::DumpGenesis(command) => runner.run_blocking_until_ctrl_c(command.execute()),
|
||||
Commands::Db(command) => runner.run_blocking_until_ctrl_c(command.execute::<OpNode>()),
|
||||
Commands::Stage(command) => runner.run_command_until_exit(|ctx| {
|
||||
command.execute::<OpNode, _, _>(ctx, OpExecutorProvider::optimism)
|
||||
command
|
||||
.execute::<OpNode, _, _, OpNetworkPrimitives>(ctx, OpExecutorProvider::optimism)
|
||||
}),
|
||||
Commands::P2P(command) => runner.run_until_ctrl_c(command.execute()),
|
||||
Commands::P2P(command) => {
|
||||
runner.run_until_ctrl_c(command.execute::<OpNetworkPrimitives>())
|
||||
}
|
||||
Commands::Config(command) => runner.run_until_ctrl_c(command.execute()),
|
||||
Commands::Recover(command) => {
|
||||
runner.run_command_until_exit(|ctx| command.execute::<OpNode>(ctx))
|
||||
|
||||
@ -21,7 +21,7 @@ pub mod engine;
|
||||
pub use engine::OpEngineTypes;
|
||||
|
||||
pub mod node;
|
||||
pub use node::OpNode;
|
||||
pub use node::{OpNetworkPrimitives, OpNode};
|
||||
|
||||
pub mod txpool;
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGenera
|
||||
use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks};
|
||||
use reth_db::transaction::{DbTx, DbTxMut};
|
||||
use reth_evm::{execute::BasicBlockExecutorProvider, ConfigureEvm};
|
||||
use reth_network::{EthNetworkPrimitives, NetworkConfig, NetworkHandle, NetworkManager, PeersInfo};
|
||||
use reth_network::{NetworkConfig, NetworkHandle, NetworkManager, NetworkPrimitives, PeersInfo};
|
||||
use reth_node_api::{AddOnsContext, EngineValidator, FullNodeComponents, NodeAddOns, TxTy};
|
||||
use reth_node_builder::{
|
||||
components::{
|
||||
@ -621,7 +621,7 @@ impl OpNetworkBuilder {
|
||||
pub fn network_config<Node>(
|
||||
&self,
|
||||
ctx: &BuilderContext<Node>,
|
||||
) -> eyre::Result<NetworkConfig<<Node as FullNodeTypes>::Provider>>
|
||||
) -> eyre::Result<NetworkConfig<<Node as FullNodeTypes>::Provider, OpNetworkPrimitives>>
|
||||
where
|
||||
Node: FullNodeTypes<Types: NodeTypes<ChainSpec: Hardforks>>,
|
||||
{
|
||||
@ -670,13 +670,13 @@ where
|
||||
> + Unpin
|
||||
+ 'static,
|
||||
{
|
||||
type Primitives = EthNetworkPrimitives;
|
||||
type Primitives = OpNetworkPrimitives;
|
||||
|
||||
async fn build_network(
|
||||
self,
|
||||
ctx: &BuilderContext<Node>,
|
||||
pool: Pool,
|
||||
) -> eyre::Result<NetworkHandle> {
|
||||
) -> eyre::Result<NetworkHandle<Self::Primitives>> {
|
||||
let network_config = self.network_config(ctx)?;
|
||||
let network = NetworkManager::builder(network_config).await?;
|
||||
let handle = ctx.start_network(network, pool);
|
||||
@ -722,3 +722,17 @@ where
|
||||
Ok(OpEngineValidator::new(ctx.config.chain.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Network primitive types used by Optimism networks.
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[non_exhaustive]
|
||||
pub struct OpNetworkPrimitives;
|
||||
|
||||
impl NetworkPrimitives for OpNetworkPrimitives {
|
||||
type BlockHeader = alloy_consensus::Header;
|
||||
type BlockBody = reth_primitives::BlockBody;
|
||||
type Block = reth_primitives::Block;
|
||||
type BroadcastedTransaction = reth_primitives::TransactionSigned;
|
||||
type PooledTransaction = reth_primitives::PooledTransaction;
|
||||
type Receipt = reth_primitives::Receipt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user