renamed OptimismNode to OpNode (#12338)

This commit is contained in:
Steven
2024-11-06 02:30:15 -06:00
committed by GitHub
parent 0c7700f2c7
commit e34a88d2cc
7 changed files with 25 additions and 27 deletions

View File

@ -79,7 +79,7 @@ pub type RethFullAdapter<DB, Types> = FullNodeTypesAdapter<
/// configured components and can interact with the node.
///
/// There are convenience functions for networks that come with a preset of types and components via
/// the [Node] trait, see `reth_node_ethereum::EthereumNode` or `reth_optimism_node::OptimismNode`.
/// the [`Node`] trait, see `reth_node_ethereum::EthereumNode` or `reth_optimism_node::OpNode`.
///
/// The [`NodeBuilder::node`] function configures the node's types and components in one step.
///

View File

@ -5,7 +5,7 @@
use clap::Parser;
use reth_node_builder::{engine_tree_config::TreeConfig, EngineNodeLauncher};
use reth_optimism_cli::{chainspec::OpChainSpecParser, Cli};
use reth_optimism_node::{args::RollupArgs, node::OptimismAddOns, OptimismNode};
use reth_optimism_node::{args::RollupArgs, node::OptimismAddOns, OpNode};
use reth_provider::providers::BlockchainProvider2;
use tracing as _;
@ -34,8 +34,8 @@ fn main() {
.with_persistence_threshold(rollup_args.persistence_threshold)
.with_memory_block_buffer_target(rollup_args.memory_block_buffer_target);
let handle = builder
.with_types_and_provider::<OptimismNode, BlockchainProvider2<_>>()
.with_components(OptimismNode::components(rollup_args))
.with_types_and_provider::<OpNode, BlockchainProvider2<_>>()
.with_components(OpNode::components(rollup_args))
.with_add_ons(OptimismAddOns::new(sequencer_http_arg))
.launch_with_fn(|builder| {
let launcher = EngineNodeLauncher::new(
@ -51,7 +51,7 @@ fn main() {
}
true => {
let handle =
builder.node(OptimismNode::new(rollup_args.clone())).launch().await?;
builder.node(OpNode::new(rollup_args.clone())).launch().await?;
handle.node_exit_future.await
}

View File

@ -47,7 +47,7 @@ use reth_node_core::{
version::{LONG_VERSION, SHORT_VERSION},
};
use reth_optimism_evm::OpExecutorProvider;
use reth_optimism_node::OptimismNode;
use reth_optimism_node::OpNode;
use reth_tracing::FileWorkerGuard;
use tracing::info;
@ -145,30 +145,28 @@ where
runner.run_command_until_exit(|ctx| command.execute(ctx, launcher))
}
Commands::Init(command) => {
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
runner.run_blocking_until_ctrl_c(command.execute::<OpNode>())
}
Commands::InitState(command) => {
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
runner.run_blocking_until_ctrl_c(command.execute::<OpNode>())
}
Commands::ImportOp(command) => {
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
runner.run_blocking_until_ctrl_c(command.execute::<OpNode>())
}
Commands::ImportReceiptsOp(command) => {
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
runner.run_blocking_until_ctrl_c(command.execute::<OpNode>())
}
Commands::DumpGenesis(command) => runner.run_blocking_until_ctrl_c(command.execute()),
Commands::Db(command) => {
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
}
Commands::Db(command) => runner.run_blocking_until_ctrl_c(command.execute::<OpNode>()),
Commands::Stage(command) => runner.run_command_until_exit(|ctx| {
command.execute::<OptimismNode, _, _>(ctx, OpExecutorProvider::optimism)
command.execute::<OpNode, _, _>(ctx, OpExecutorProvider::optimism)
}),
Commands::P2P(command) => runner.run_until_ctrl_c(command.execute()),
Commands::Config(command) => runner.run_until_ctrl_c(command.execute()),
Commands::Recover(command) => {
runner.run_command_until_exit(|ctx| command.execute::<OptimismNode>(ctx))
runner.run_command_until_exit(|ctx| command.execute::<OpNode>(ctx))
}
Commands::Prune(command) => runner.run_until_ctrl_c(command.execute::<OptimismNode>()),
Commands::Prune(command) => runner.run_until_ctrl_c(command.execute::<OpNode>()),
#[cfg(feature = "dev")]
Commands::TestVectors(command) => runner.run_until_ctrl_c(command.execute()),
}

View File

@ -18,7 +18,7 @@ pub mod engine;
pub use engine::OpEngineTypes;
pub mod node;
pub use node::OptimismNode;
pub use node::OpNode;
pub mod txpool;

View File

@ -51,12 +51,12 @@ impl NodePrimitives for OpPrimitives {
/// Type configuration for a regular Optimism node.
#[derive(Debug, Default, Clone)]
#[non_exhaustive]
pub struct OptimismNode {
pub struct OpNode {
/// Additional Optimism args
pub args: RollupArgs,
}
impl OptimismNode {
impl OpNode {
/// Creates a new instance of the Optimism node type.
pub const fn new(args: RollupArgs) -> Self {
Self { args }
@ -92,7 +92,7 @@ impl OptimismNode {
}
}
impl<N> Node<N> for OptimismNode
impl<N> Node<N> for OpNode
where
N: FullNodeTypes<Types: NodeTypesWithEngine<Engine = OpEngineTypes, ChainSpec = OpChainSpec>>,
{
@ -119,13 +119,13 @@ where
}
}
impl NodeTypes for OptimismNode {
impl NodeTypes for OpNode {
type Primitives = OpPrimitives;
type ChainSpec = OpChainSpec;
type StateCommitment = MerklePatriciaTrie;
}
impl NodeTypesWithEngine for OptimismNode {
impl NodeTypesWithEngine for OpNode {
type Engine = OpEngineTypes;
}

View File

@ -6,14 +6,14 @@ use reth_e2e_test_utils::{
};
use reth_optimism_chainspec::OpChainSpecBuilder;
use reth_optimism_node::{
node::OptimismAddOns, OpBuiltPayload, OpPayloadBuilderAttributes, OptimismNode,
node::OptimismAddOns, OpBuiltPayload, OpNode as OtherOpNode, OpPayloadBuilderAttributes,
};
use reth_payload_builder::EthPayloadBuilderAttributes;
use std::sync::Arc;
use tokio::sync::Mutex;
/// Optimism Node Helper type
pub(crate) type OpNode = NodeHelperType<OptimismNode, OptimismAddOns<Adapter<OptimismNode>>>;
pub(crate) type OpNode = NodeHelperType<OtherOpNode, OptimismAddOns<Adapter<OtherOpNode>>>;
pub(crate) async fn setup(num_nodes: usize) -> eyre::Result<(Vec<OpNode>, TaskManager, Wallet)> {
let genesis: Genesis = serde_json::from_str(include_str!("../assets/genesis.json")).unwrap();

View File

@ -4,7 +4,7 @@ use reth_db::test_utils::create_test_rw_db;
use reth_node_api::FullNodeComponents;
use reth_node_builder::{NodeBuilder, NodeConfig};
use reth_optimism_chainspec::BASE_MAINNET;
use reth_optimism_node::{node::OptimismAddOns, OptimismNode};
use reth_optimism_node::{node::OptimismAddOns, OpNode};
#[test]
fn test_basic_setup() {
@ -13,8 +13,8 @@ fn test_basic_setup() {
let db = create_test_rw_db();
let _builder = NodeBuilder::new(config)
.with_database(db)
.with_types::<OptimismNode>()
.with_components(OptimismNode::components(Default::default()))
.with_types::<OpNode>()
.with_components(OpNode::components(Default::default()))
.with_add_ons(OptimismAddOns::new(None))
.on_component_initialized(move |ctx| {
let _provider = ctx.provider();