mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
renamed OptimismNode to OpNode (#12338)
This commit is contained in:
@ -79,7 +79,7 @@ pub type RethFullAdapter<DB, Types> = FullNodeTypesAdapter<
|
|||||||
/// configured components and can interact with the node.
|
/// configured components and can interact with the node.
|
||||||
///
|
///
|
||||||
/// There are convenience functions for networks that come with a preset of types and components via
|
/// 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.
|
/// The [`NodeBuilder::node`] function configures the node's types and components in one step.
|
||||||
///
|
///
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use reth_node_builder::{engine_tree_config::TreeConfig, EngineNodeLauncher};
|
use reth_node_builder::{engine_tree_config::TreeConfig, EngineNodeLauncher};
|
||||||
use reth_optimism_cli::{chainspec::OpChainSpecParser, Cli};
|
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 reth_provider::providers::BlockchainProvider2;
|
||||||
|
|
||||||
use tracing as _;
|
use tracing as _;
|
||||||
@ -34,8 +34,8 @@ fn main() {
|
|||||||
.with_persistence_threshold(rollup_args.persistence_threshold)
|
.with_persistence_threshold(rollup_args.persistence_threshold)
|
||||||
.with_memory_block_buffer_target(rollup_args.memory_block_buffer_target);
|
.with_memory_block_buffer_target(rollup_args.memory_block_buffer_target);
|
||||||
let handle = builder
|
let handle = builder
|
||||||
.with_types_and_provider::<OptimismNode, BlockchainProvider2<_>>()
|
.with_types_and_provider::<OpNode, BlockchainProvider2<_>>()
|
||||||
.with_components(OptimismNode::components(rollup_args))
|
.with_components(OpNode::components(rollup_args))
|
||||||
.with_add_ons(OptimismAddOns::new(sequencer_http_arg))
|
.with_add_ons(OptimismAddOns::new(sequencer_http_arg))
|
||||||
.launch_with_fn(|builder| {
|
.launch_with_fn(|builder| {
|
||||||
let launcher = EngineNodeLauncher::new(
|
let launcher = EngineNodeLauncher::new(
|
||||||
@ -51,7 +51,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
true => {
|
true => {
|
||||||
let handle =
|
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
|
handle.node_exit_future.await
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ use reth_node_core::{
|
|||||||
version::{LONG_VERSION, SHORT_VERSION},
|
version::{LONG_VERSION, SHORT_VERSION},
|
||||||
};
|
};
|
||||||
use reth_optimism_evm::OpExecutorProvider;
|
use reth_optimism_evm::OpExecutorProvider;
|
||||||
use reth_optimism_node::OptimismNode;
|
use reth_optimism_node::OpNode;
|
||||||
use reth_tracing::FileWorkerGuard;
|
use reth_tracing::FileWorkerGuard;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
@ -145,30 +145,28 @@ where
|
|||||||
runner.run_command_until_exit(|ctx| command.execute(ctx, launcher))
|
runner.run_command_until_exit(|ctx| command.execute(ctx, launcher))
|
||||||
}
|
}
|
||||||
Commands::Init(command) => {
|
Commands::Init(command) => {
|
||||||
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
|
runner.run_blocking_until_ctrl_c(command.execute::<OpNode>())
|
||||||
}
|
}
|
||||||
Commands::InitState(command) => {
|
Commands::InitState(command) => {
|
||||||
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
|
runner.run_blocking_until_ctrl_c(command.execute::<OpNode>())
|
||||||
}
|
}
|
||||||
Commands::ImportOp(command) => {
|
Commands::ImportOp(command) => {
|
||||||
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
|
runner.run_blocking_until_ctrl_c(command.execute::<OpNode>())
|
||||||
}
|
}
|
||||||
Commands::ImportReceiptsOp(command) => {
|
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::DumpGenesis(command) => runner.run_blocking_until_ctrl_c(command.execute()),
|
||||||
Commands::Db(command) => {
|
Commands::Db(command) => runner.run_blocking_until_ctrl_c(command.execute::<OpNode>()),
|
||||||
runner.run_blocking_until_ctrl_c(command.execute::<OptimismNode>())
|
|
||||||
}
|
|
||||||
Commands::Stage(command) => runner.run_command_until_exit(|ctx| {
|
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::P2P(command) => runner.run_until_ctrl_c(command.execute()),
|
||||||
Commands::Config(command) => runner.run_until_ctrl_c(command.execute()),
|
Commands::Config(command) => runner.run_until_ctrl_c(command.execute()),
|
||||||
Commands::Recover(command) => {
|
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")]
|
#[cfg(feature = "dev")]
|
||||||
Commands::TestVectors(command) => runner.run_until_ctrl_c(command.execute()),
|
Commands::TestVectors(command) => runner.run_until_ctrl_c(command.execute()),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ pub mod engine;
|
|||||||
pub use engine::OpEngineTypes;
|
pub use engine::OpEngineTypes;
|
||||||
|
|
||||||
pub mod node;
|
pub mod node;
|
||||||
pub use node::OptimismNode;
|
pub use node::OpNode;
|
||||||
|
|
||||||
pub mod txpool;
|
pub mod txpool;
|
||||||
|
|
||||||
|
|||||||
@ -51,12 +51,12 @@ impl NodePrimitives for OpPrimitives {
|
|||||||
/// Type configuration for a regular Optimism node.
|
/// Type configuration for a regular Optimism node.
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct OptimismNode {
|
pub struct OpNode {
|
||||||
/// Additional Optimism args
|
/// Additional Optimism args
|
||||||
pub args: RollupArgs,
|
pub args: RollupArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OptimismNode {
|
impl OpNode {
|
||||||
/// Creates a new instance of the Optimism node type.
|
/// Creates a new instance of the Optimism node type.
|
||||||
pub const fn new(args: RollupArgs) -> Self {
|
pub const fn new(args: RollupArgs) -> Self {
|
||||||
Self { args }
|
Self { args }
|
||||||
@ -92,7 +92,7 @@ impl OptimismNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N> Node<N> for OptimismNode
|
impl<N> Node<N> for OpNode
|
||||||
where
|
where
|
||||||
N: FullNodeTypes<Types: NodeTypesWithEngine<Engine = OpEngineTypes, ChainSpec = OpChainSpec>>,
|
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 Primitives = OpPrimitives;
|
||||||
type ChainSpec = OpChainSpec;
|
type ChainSpec = OpChainSpec;
|
||||||
type StateCommitment = MerklePatriciaTrie;
|
type StateCommitment = MerklePatriciaTrie;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NodeTypesWithEngine for OptimismNode {
|
impl NodeTypesWithEngine for OpNode {
|
||||||
type Engine = OpEngineTypes;
|
type Engine = OpEngineTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,14 +6,14 @@ use reth_e2e_test_utils::{
|
|||||||
};
|
};
|
||||||
use reth_optimism_chainspec::OpChainSpecBuilder;
|
use reth_optimism_chainspec::OpChainSpecBuilder;
|
||||||
use reth_optimism_node::{
|
use reth_optimism_node::{
|
||||||
node::OptimismAddOns, OpBuiltPayload, OpPayloadBuilderAttributes, OptimismNode,
|
node::OptimismAddOns, OpBuiltPayload, OpNode as OtherOpNode, OpPayloadBuilderAttributes,
|
||||||
};
|
};
|
||||||
use reth_payload_builder::EthPayloadBuilderAttributes;
|
use reth_payload_builder::EthPayloadBuilderAttributes;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
/// Optimism Node Helper type
|
/// 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)> {
|
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();
|
let genesis: Genesis = serde_json::from_str(include_str!("../assets/genesis.json")).unwrap();
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use reth_db::test_utils::create_test_rw_db;
|
|||||||
use reth_node_api::FullNodeComponents;
|
use reth_node_api::FullNodeComponents;
|
||||||
use reth_node_builder::{NodeBuilder, NodeConfig};
|
use reth_node_builder::{NodeBuilder, NodeConfig};
|
||||||
use reth_optimism_chainspec::BASE_MAINNET;
|
use reth_optimism_chainspec::BASE_MAINNET;
|
||||||
use reth_optimism_node::{node::OptimismAddOns, OptimismNode};
|
use reth_optimism_node::{node::OptimismAddOns, OpNode};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_basic_setup() {
|
fn test_basic_setup() {
|
||||||
@ -13,8 +13,8 @@ fn test_basic_setup() {
|
|||||||
let db = create_test_rw_db();
|
let db = create_test_rw_db();
|
||||||
let _builder = NodeBuilder::new(config)
|
let _builder = NodeBuilder::new(config)
|
||||||
.with_database(db)
|
.with_database(db)
|
||||||
.with_types::<OptimismNode>()
|
.with_types::<OpNode>()
|
||||||
.with_components(OptimismNode::components(Default::default()))
|
.with_components(OpNode::components(Default::default()))
|
||||||
.with_add_ons(OptimismAddOns::new(None))
|
.with_add_ons(OptimismAddOns::new(None))
|
||||||
.on_component_initialized(move |ctx| {
|
.on_component_initialized(move |ctx| {
|
||||||
let _provider = ctx.provider();
|
let _provider = ctx.provider();
|
||||||
|
|||||||
Reference in New Issue
Block a user