Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renamed OptimismNode to OpNode #12338

Merged
merged 4 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/node/builder/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
8 changes: 4 additions & 4 deletions crates/optimism/bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 _;
Expand Down Expand Up @@ -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(
Expand All @@ -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
}
Expand Down
20 changes: 9 additions & 11 deletions crates/optimism/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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()),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions crates/optimism/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,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 }
Expand Down Expand Up @@ -91,7 +91,7 @@ impl OptimismNode {
}
}

impl<N> Node<N> for OptimismNode
impl<N> Node<N> for OpNode
where
N: FullNodeTypes<Types: NodeTypesWithEngine<Engine = OpEngineTypes, ChainSpec = OpChainSpec>>,
{
Expand All @@ -118,13 +118,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;
}

Expand Down
4 changes: 2 additions & 2 deletions crates/optimism/node/tests/e2e/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions crates/optimism/node/tests/it/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
Expand Down
Loading