chore: use builtin launch fn for opnode (#13900)

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
This commit is contained in:
Matthias Seitz
2025-01-21 18:52:03 +01:00
committed by GitHub
parent b63dc2ad89
commit c1fd0ce4a1

View File

@ -3,12 +3,9 @@
#![cfg(feature = "optimism")]
use clap::Parser;
use reth_node_builder::{engine_tree_config::TreeConfig, EngineNodeLauncher, Node};
use reth_optimism_cli::{chainspec::OpChainSpecParser, Cli};
use reth_optimism_node::{args::RollupArgs, OpNode};
use reth_provider::providers::BlockchainProvider;
use tracing as _;
use tracing::info;
#[global_allocator]
static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::new_allocator();
@ -23,29 +20,8 @@ fn main() {
if let Err(err) =
Cli::<OpChainSpecParser, RollupArgs>::parse().run(|builder, rollup_args| async move {
let engine_tree_config = TreeConfig::default()
.with_persistence_threshold(builder.config().engine.persistence_threshold)
.with_memory_block_buffer_target(builder.config().engine.memory_block_buffer_target)
.with_state_root_task(builder.config().engine.state_root_task_enabled)
.with_always_compare_trie_updates(
builder.config().engine.state_root_task_compare_updates,
);
let op_node = OpNode::new(rollup_args.clone());
let handle = builder
.with_types_and_provider::<OpNode, BlockchainProvider<_>>()
.with_components(op_node.components())
.with_add_ons(op_node.add_ons())
.launch_with_fn(|builder| {
let launcher = EngineNodeLauncher::new(
builder.task_executor().clone(),
builder.config().datadir(),
engine_tree_config,
);
builder.launch_with(launcher)
})
.await?;
info!(target: "reth::cli", "Launching node");
let handle = builder.launch_node(OpNode::new(rollup_args)).await?;
handle.node_exit_future.await
})
{