mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: move events mod to node core (#6585)
This commit is contained in:
@ -1,9 +1,6 @@
|
||||
//! Contains types and methods that can be used to launch a node based off of a [NodeConfig].
|
||||
|
||||
use crate::commands::{
|
||||
debug_cmd::engine_api_store::EngineApiStore,
|
||||
node::{cl_events::ConsensusLayerHealthEvents, events},
|
||||
};
|
||||
use crate::commands::debug_cmd::engine_api_store::EngineApiStore;
|
||||
use eyre::Context;
|
||||
use fdlimit::raise_fd_limit;
|
||||
use futures::{future::Either, stream, stream_select, StreamExt};
|
||||
@ -29,6 +26,7 @@ use reth_node_core::{
|
||||
ext::{DefaultRethNodeCommandConfig, RethCliExt, RethNodeCommandConfig},
|
||||
},
|
||||
dirs::{ChainPath, DataDirPath},
|
||||
events::cl::ConsensusLayerHealthEvents,
|
||||
init::init_genesis,
|
||||
version::SHORT_VERSION,
|
||||
};
|
||||
@ -378,7 +376,7 @@ impl<DB: Database + DatabaseMetrics + DatabaseMetadata + 'static> NodeBuilderWit
|
||||
);
|
||||
executor.spawn_critical(
|
||||
"events task",
|
||||
events::handle_events(
|
||||
reth_node_core::events::node::handle_events(
|
||||
Some(network.clone()),
|
||||
Some(head.number),
|
||||
events,
|
||||
|
||||
@ -6,7 +6,6 @@ use crate::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs, NetworkArgs,
|
||||
},
|
||||
commands::node::events,
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
runner::CliContext,
|
||||
utils::get_single_header,
|
||||
@ -253,7 +252,12 @@ impl Command {
|
||||
);
|
||||
ctx.task_executor.spawn_critical(
|
||||
"events task",
|
||||
events::handle_events(Some(network.clone()), latest_block_number, events, db.clone()),
|
||||
reth_node_core::events::node::handle_events(
|
||||
Some(network.clone()),
|
||||
latest_block_number,
|
||||
events,
|
||||
db.clone(),
|
||||
),
|
||||
);
|
||||
|
||||
let mut current_max_block = latest_block_number.unwrap_or_default();
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
//! Command that initializes the node by importing a chain from a file.
|
||||
|
||||
use crate::{
|
||||
commands::node::events::{handle_events, NodeEvent},
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
},
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
version::SHORT_VERSION,
|
||||
};
|
||||
use clap::Parser;
|
||||
@ -15,7 +19,7 @@ use reth_downloaders::{
|
||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||
};
|
||||
use reth_interfaces::consensus::Consensus;
|
||||
use reth_node_core::init::init_genesis;
|
||||
use reth_node_core::{events::node::NodeEvent, init::init_genesis};
|
||||
use reth_node_ethereum::EthEvmConfig;
|
||||
use reth_primitives::{stage::StageId, ChainSpec, B256};
|
||||
use reth_provider::{HeaderSyncMode, ProviderFactory, StageCheckpointReader};
|
||||
@ -27,14 +31,6 @@ use std::{path::PathBuf, sync::Arc};
|
||||
use tokio::sync::watch;
|
||||
use tracing::{debug, info};
|
||||
|
||||
use crate::{
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
},
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
};
|
||||
|
||||
/// Syncs RLP encoded blocks from a file.
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct ImportCommand {
|
||||
@ -122,7 +118,12 @@ impl ImportCommand {
|
||||
|
||||
let latest_block_number =
|
||||
provider.get_stage_checkpoint(StageId::Finish)?.map(|ch| ch.block_number);
|
||||
tokio::spawn(handle_events(None, latest_block_number, events, db.clone()));
|
||||
tokio::spawn(reth_node_core::events::node::handle_events(
|
||||
None,
|
||||
latest_block_number,
|
||||
events,
|
||||
db.clone(),
|
||||
));
|
||||
|
||||
// Run pipeline
|
||||
info!(target: "reth::cli", "Starting sync pipeline");
|
||||
|
||||
@ -2,16 +2,6 @@
|
||||
//!
|
||||
//! Starts the client
|
||||
|
||||
use clap::{value_parser, Parser};
|
||||
use reth_auto_seal_consensus::AutoSealConsensus;
|
||||
use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_interfaces::consensus::Consensus;
|
||||
use reth_primitives::ChainSpec;
|
||||
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
|
||||
pub mod cl_events;
|
||||
pub mod events;
|
||||
|
||||
use crate::{
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, parse_socket_address, SUPPORTED_CHAINS},
|
||||
@ -23,6 +13,12 @@ use crate::{
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
runner::CliContext,
|
||||
};
|
||||
use clap::{value_parser, Parser};
|
||||
use reth_auto_seal_consensus::AutoSealConsensus;
|
||||
use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_interfaces::consensus::Consensus;
|
||||
use reth_primitives::ChainSpec;
|
||||
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
|
||||
/// Start the node
|
||||
#[derive(Debug, Parser)]
|
||||
|
||||
4
crates/node-core/src/events/mod.rs
Normal file
4
crates/node-core/src/events/mod.rs
Normal file
@ -0,0 +1,4 @@
|
||||
//! Various event handlers for the node.
|
||||
|
||||
pub mod cl;
|
||||
pub mod node;
|
||||
@ -1,6 +1,6 @@
|
||||
//! Support for handling events emitted by node components.
|
||||
|
||||
use crate::{commands::node::cl_events::ConsensusLayerHealthEvent, primitives::B256};
|
||||
use crate::events::cl::ConsensusLayerHealthEvent;
|
||||
use futures::Stream;
|
||||
use reth_beacon_consensus::{BeaconConsensusEngineEvent, ForkchoiceStatus};
|
||||
use reth_db::{database::Database, database_metrics::DatabaseMetadata};
|
||||
@ -10,7 +10,7 @@ use reth_network_api::PeersInfo;
|
||||
use reth_primitives::{
|
||||
constants,
|
||||
stage::{EntitiesCheckpoint, StageCheckpoint, StageId},
|
||||
BlockNumber,
|
||||
BlockNumber, B256,
|
||||
};
|
||||
use reth_prune::PrunerEvent;
|
||||
use reth_stages::{ExecOutput, PipelineEvent};
|
||||
@ -10,6 +10,7 @@
|
||||
pub mod args;
|
||||
pub mod cli;
|
||||
pub mod dirs;
|
||||
pub mod events;
|
||||
pub mod init;
|
||||
pub mod metrics;
|
||||
pub mod node_config;
|
||||
|
||||
Reference in New Issue
Block a user