mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: Move node-core/events to standalone crate (#7713)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com>
This commit is contained in:
27
Cargo.lock
generated
27
Cargo.lock
generated
@ -6104,6 +6104,7 @@ dependencies = [
|
||||
"reth-node-builder",
|
||||
"reth-node-core",
|
||||
"reth-node-ethereum",
|
||||
"reth-node-events",
|
||||
"reth-node-optimism",
|
||||
"reth-payload-builder",
|
||||
"reth-payload-validator",
|
||||
@ -6864,6 +6865,7 @@ dependencies = [
|
||||
"reth-network",
|
||||
"reth-node-api",
|
||||
"reth-node-core",
|
||||
"reth-node-events",
|
||||
"reth-payload-builder",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
@ -6899,7 +6901,6 @@ dependencies = [
|
||||
"metrics-process",
|
||||
"metrics-util",
|
||||
"once_cell",
|
||||
"pin-project",
|
||||
"procfs",
|
||||
"proptest",
|
||||
"rand 0.8.5",
|
||||
@ -6918,15 +6919,12 @@ dependencies = [
|
||||
"reth-network-api",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"reth-prune",
|
||||
"reth-rpc",
|
||||
"reth-rpc-api",
|
||||
"reth-rpc-builder",
|
||||
"reth-rpc-engine-api",
|
||||
"reth-rpc-types",
|
||||
"reth-rpc-types-compat",
|
||||
"reth-stages",
|
||||
"reth-static-file",
|
||||
"reth-tasks",
|
||||
"reth-tracing",
|
||||
"reth-transaction-pool",
|
||||
@ -6963,6 +6961,27 @@ dependencies = [
|
||||
"reth-transaction-pool",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-node-events"
|
||||
version = "0.2.0-beta.5"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"humantime",
|
||||
"pin-project",
|
||||
"reth-beacon-consensus",
|
||||
"reth-db",
|
||||
"reth-interfaces",
|
||||
"reth-network",
|
||||
"reth-network-api",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"reth-prune",
|
||||
"reth-stages",
|
||||
"reth-static-file",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-node-optimism"
|
||||
version = "0.2.0-beta.5"
|
||||
|
||||
@ -34,6 +34,7 @@ members = [
|
||||
"crates/primitives/",
|
||||
"crates/prune/",
|
||||
"crates/revm/",
|
||||
"crates/node-events/",
|
||||
"crates/rpc/ipc/",
|
||||
"crates/rpc/rpc/",
|
||||
"crates/rpc/rpc-api/",
|
||||
@ -258,6 +259,7 @@ reth-tracing = { path = "crates/tracing" }
|
||||
reth-transaction-pool = { path = "crates/transaction-pool" }
|
||||
reth-trie = { path = "crates/trie" }
|
||||
reth-trie-parallel = { path = "crates/trie-parallel" }
|
||||
reth-node-events = {path = "crates/node-events"}
|
||||
|
||||
# revm
|
||||
revm = { version = "8.0.0", features = [
|
||||
@ -304,6 +306,7 @@ thiserror = "1.0"
|
||||
serde_json = "1.0.94"
|
||||
serde = { version = "1.0", default-features = false }
|
||||
serde_with = "3.3.0"
|
||||
humantime = "2.1"
|
||||
humantime-serde = "1.1"
|
||||
rand = "0.8.5"
|
||||
schnellru = "0.2"
|
||||
|
||||
@ -51,6 +51,7 @@ reth-node-ethereum.workspace = true
|
||||
reth-node-optimism = { workspace = true, optional = true, features = ["optimism"] }
|
||||
reth-node-core.workspace = true
|
||||
reth-node-builder.workspace = true
|
||||
reth-node-events.workspace = true
|
||||
|
||||
# crypto
|
||||
alloy-rlp.workspace = true
|
||||
|
||||
@ -260,7 +260,7 @@ impl Command {
|
||||
);
|
||||
ctx.task_executor.spawn_critical(
|
||||
"events task",
|
||||
reth_node_core::events::node::handle_events(
|
||||
reth_node_events::node::handle_events(
|
||||
Some(network.clone()),
|
||||
latest_block_number,
|
||||
events,
|
||||
|
||||
@ -26,8 +26,9 @@ use reth_interfaces::{
|
||||
headers::downloader::{HeaderDownloader, SyncTarget},
|
||||
},
|
||||
};
|
||||
use reth_node_core::{events::node::NodeEvent, init::init_genesis};
|
||||
use reth_node_core::init::init_genesis;
|
||||
use reth_node_ethereum::EthEvmConfig;
|
||||
use reth_node_events::node::NodeEvent;
|
||||
use reth_primitives::{stage::StageId, ChainSpec, PruneModes, B256, OP_RETH_MAINNET_BELOW_BEDROCK};
|
||||
use reth_provider::{HeaderSyncMode, ProviderFactory, StageCheckpointReader};
|
||||
use reth_stages::{
|
||||
@ -168,7 +169,7 @@ impl ImportCommand {
|
||||
|
||||
let latest_block_number =
|
||||
provider.get_stage_checkpoint(StageId::Finish)?.map(|ch| ch.block_number);
|
||||
tokio::spawn(reth_node_core::events::node::handle_events(
|
||||
tokio::spawn(reth_node_events::node::handle_events(
|
||||
None,
|
||||
latest_block_number,
|
||||
events,
|
||||
|
||||
@ -36,6 +36,7 @@ reth-prune.workspace = true
|
||||
reth-stages.workspace = true
|
||||
reth-config.workspace = true
|
||||
reth-downloaders.workspace = true
|
||||
reth-node-events.workspace = true
|
||||
|
||||
## async
|
||||
futures.workspace = true
|
||||
|
||||
@ -38,13 +38,15 @@ use reth_node_core::{
|
||||
dirs::{ChainPath, DataDirPath, MaybePlatformPath},
|
||||
engine_api_store::EngineApiStore,
|
||||
engine_skip_fcu::EngineApiSkipFcu,
|
||||
events::cl::ConsensusLayerHealthEvents,
|
||||
exit::NodeExitFuture,
|
||||
init::init_genesis,
|
||||
node_config::NodeConfig,
|
||||
primitives::{kzg::KzgSettings, Head},
|
||||
utils::write_peers_to_file,
|
||||
};
|
||||
use reth_node_events::node;
|
||||
|
||||
use reth_node_events::cl::ConsensusLayerHealthEvents;
|
||||
use reth_primitives::{constants::eip4844::MAINNET_KZG_TRUSTED_SETUP, format_ether, ChainSpec};
|
||||
use reth_provider::{
|
||||
providers::BlockchainProvider, CanonStateSubscriptions, ChainSpecProvider, ProviderFactory,
|
||||
@ -816,12 +818,7 @@ where
|
||||
);
|
||||
executor.spawn_critical(
|
||||
"events task",
|
||||
reth_node_core::events::node::handle_events(
|
||||
Some(network.clone()),
|
||||
Some(head.number),
|
||||
events,
|
||||
database.clone(),
|
||||
),
|
||||
node::handle_events(Some(network.clone()), Some(head.number), events, database.clone()),
|
||||
);
|
||||
|
||||
let engine_api = EngineApi::new(
|
||||
|
||||
@ -35,9 +35,6 @@ reth-tasks.workspace = true
|
||||
reth-consensus-common.workspace = true
|
||||
reth-auto-seal-consensus.workspace = true
|
||||
reth-beacon-consensus.workspace = true
|
||||
reth-stages.workspace = true
|
||||
reth-prune.workspace = true
|
||||
reth-static-file.workspace = true
|
||||
|
||||
# ethereum
|
||||
discv5.workspace = true
|
||||
@ -56,11 +53,10 @@ reth-metrics.workspace = true
|
||||
# misc
|
||||
eyre.workspace = true
|
||||
clap = { workspace = true, features = ["derive"] }
|
||||
humantime = "2.1.0"
|
||||
humantime.workspace = true
|
||||
thiserror.workspace = true
|
||||
const-str = "0.5.6"
|
||||
rand.workspace = true
|
||||
pin-project.workspace = true
|
||||
derive_more.workspace = true
|
||||
|
||||
# io
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
//! Various event handlers for the node.
|
||||
|
||||
pub mod cl;
|
||||
pub mod node;
|
||||
@ -13,7 +13,6 @@ pub mod cli;
|
||||
pub mod dirs;
|
||||
pub mod engine_api_store;
|
||||
pub mod engine_skip_fcu;
|
||||
pub mod events;
|
||||
pub mod exit;
|
||||
pub mod init;
|
||||
pub mod metrics;
|
||||
|
||||
35
crates/node-events/Cargo.toml
Normal file
35
crates/node-events/Cargo.toml
Normal file
@ -0,0 +1,35 @@
|
||||
[package]
|
||||
name = "reth-node-events"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
reth-provider.workspace = true
|
||||
reth-beacon-consensus.workspace = true
|
||||
reth-network = { workspace = true, features = ["serde"] }
|
||||
reth-network-api.workspace = true
|
||||
reth-stages.workspace = true
|
||||
reth-prune.workspace = true
|
||||
reth-static-file.workspace = true
|
||||
reth-interfaces.workspace = true
|
||||
reth-db.workspace = true
|
||||
reth-primitives.workspace = true
|
||||
|
||||
# async
|
||||
tokio.workspace = true
|
||||
|
||||
# async
|
||||
futures.workspace = true
|
||||
|
||||
tracing.workspace = true
|
||||
|
||||
#misc
|
||||
pin-project.workspace = true
|
||||
humantime.workspace = true
|
||||
12
crates/node-events/src/lib.rs
Normal file
12
crates/node-events/src/lib.rs
Normal file
@ -0,0 +1,12 @@
|
||||
//! Various event handlers for the node.
|
||||
|
||||
#![doc(
|
||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
||||
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
|
||||
)]
|
||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
pub mod cl;
|
||||
pub mod node;
|
||||
@ -1,6 +1,6 @@
|
||||
//! Support for handling events emitted by node components.
|
||||
|
||||
use crate::events::cl::ConsensusLayerHealthEvent;
|
||||
use crate::cl::ConsensusLayerHealthEvent;
|
||||
use futures::Stream;
|
||||
use reth_beacon_consensus::{
|
||||
BeaconConsensusEngineEvent, ConsensusEngineLiveSyncProgress, ForkchoiceStatus,
|
||||
Reference in New Issue
Block a user