mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add engine2 binary (#9772)
This commit is contained in:
@ -153,6 +153,10 @@ ethereum = []
|
||||
name = "reth"
|
||||
path = "src/main.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "engine2"
|
||||
path = "src/engine2.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "op-reth"
|
||||
path = "src/optimism.rs"
|
||||
|
||||
40
bin/reth/src/engine2.rs
Normal file
40
bin/reth/src/engine2.rs
Normal file
@ -0,0 +1,40 @@
|
||||
#![allow(missing_docs)]
|
||||
#![allow(rustdoc::missing_crate_level_docs)]
|
||||
|
||||
// We use jemalloc for performance reasons.
|
||||
#[cfg(all(feature = "jemalloc", unix))]
|
||||
#[global_allocator]
|
||||
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
||||
|
||||
#[cfg(not(feature = "optimism"))]
|
||||
fn main() {
|
||||
use reth::cli::Cli;
|
||||
use reth_node_ethereum::{launch::EthNodeLauncher, node::EthereumAddOns, EthereumNode};
|
||||
use reth_provider::providers::BlockchainProvider2;
|
||||
|
||||
reth_cli_util::sigsegv_handler::install();
|
||||
|
||||
// Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
|
||||
if std::env::var_os("RUST_BACKTRACE").is_none() {
|
||||
std::env::set_var("RUST_BACKTRACE", "1");
|
||||
}
|
||||
|
||||
if let Err(err) = Cli::parse_args().run(|builder, _| async {
|
||||
let handle = builder
|
||||
.with_types_and_provider::<EthereumNode, BlockchainProvider2<_>>()
|
||||
.with_components(EthereumNode::components())
|
||||
.with_add_ons::<EthereumAddOns>()
|
||||
.launch_with_fn(|builder| {
|
||||
let launcher = EthNodeLauncher::new(
|
||||
builder.task_executor().clone(),
|
||||
builder.config().datadir(),
|
||||
);
|
||||
builder.launch_with(launcher)
|
||||
})
|
||||
.await?;
|
||||
handle.node_exit_future.await
|
||||
}) {
|
||||
eprintln!("Error: {err:?}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
@ -40,7 +40,7 @@ use crate::{
|
||||
components::NodeComponentsBuilder,
|
||||
node::FullNode,
|
||||
rpc::{EthApiBuilderProvider, RethRpcServerHandles, RpcContext},
|
||||
DefaultNodeLauncher, Node, NodeHandle,
|
||||
DefaultNodeLauncher, LaunchNode, Node, NodeHandle,
|
||||
};
|
||||
|
||||
/// The adapter type for a reth node with the builtin provider type
|
||||
@ -374,6 +374,11 @@ where
|
||||
AO: NodeAddOns<NodeAdapter<T, CB::Components>>,
|
||||
AO::EthApi: FullEthApiServer + AddDevSigners,
|
||||
{
|
||||
/// Returns a reference to the node builder's config.
|
||||
pub const fn config(&self) -> &NodeConfig {
|
||||
&self.builder.config
|
||||
}
|
||||
|
||||
/// Sets the hook that is run once the node's components are initialized.
|
||||
pub fn on_component_initialized<F>(self, hook: F) -> Self
|
||||
where
|
||||
@ -435,6 +440,14 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Launches the node with the given launcher.
|
||||
pub async fn launch_with<L>(self, launcher: L) -> eyre::Result<L::Node>
|
||||
where
|
||||
L: LaunchNode<NodeBuilderWithComponents<T, CB, AO>>,
|
||||
{
|
||||
launcher.launch_node(self.builder).await
|
||||
}
|
||||
|
||||
/// Launches the node with the given closure.
|
||||
pub fn launch_with_fn<L, R>(self, launcher: L) -> R
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user