refactor(engine): remove reth-engine-service crate (#22187)

Co-authored-by: mattsse <mattsse@users.noreply.github.com>
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Georgios Konstantopoulos
2026-02-14 07:40:16 -08:00
committed by GitHub
parent 3ab7cb98aa
commit 1f3fd5da2e
9 changed files with 127 additions and 331 deletions

View File

@@ -11,10 +11,10 @@ use crate::{
use alloy_consensus::BlockHeader;
use futures::{stream_select, FutureExt, StreamExt};
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_engine_service::service::{ChainEvent, EngineService};
use reth_engine_tree::{
chain::FromOrchestrator,
engine::{EngineApiRequest, EngineRequestHandler},
chain::{ChainEvent, FromOrchestrator},
engine::{EngineApiKind, EngineApiRequest, EngineRequestHandler},
launch::build_engine_orchestrator,
tree::TreeConfig,
};
use reth_engine_util::EngineMessageStreamExt;
@@ -219,9 +219,15 @@ impl EngineNodeLauncher {
// during this run.
.maybe_store_messages(node_config.debug.engine_api_store.clone());
let mut engine_service = EngineService::new(
let engine_kind = if ctx.chain_spec().is_optimism() {
EngineApiKind::OpStack
} else {
EngineApiKind::Ethereum
};
let mut orchestrator = build_engine_orchestrator(
engine_kind,
consensus.clone(),
ctx.chain_spec(),
network_client.clone(),
Box::pin(consensus_engine_stream),
pipeline,
@@ -290,7 +296,7 @@ impl EngineNodeLauncher {
if let Some(initial_target) = initial_target {
debug!(target: "reth::cli", %initial_target, "start backfill sync");
// network_handle's sync state is already initialized at Syncing
engine_service.orchestrator_mut().start_backfill_sync(initial_target);
orchestrator.start_backfill_sync(initial_target);
} else if startup_sync_state_idle {
network_handle.update_sync_state(SyncState::Idle);
}
@@ -303,7 +309,7 @@ impl EngineNodeLauncher {
// the CL
loop {
tokio::select! {
event = engine_service.next() => {
event = orchestrator.next() => {
let Some(event) = event else { break };
debug!(target: "reth::cli", "Event: {event}");
match event {
@@ -353,13 +359,13 @@ impl EngineNodeLauncher {
payload = built_payloads.select_next_some() => {
if let Some(executed_block) = payload.executed_block() {
debug!(target: "reth::cli", block=?executed_block.recovered_block.num_hash(), "inserting built payload");
engine_service.orchestrator_mut().handler_mut().handler_mut().on_event(EngineApiRequest::InsertExecutedBlock(executed_block.into_executed_payload()).into());
orchestrator.handler_mut().handler_mut().on_event(EngineApiRequest::InsertExecutedBlock(executed_block.into_executed_payload()).into());
}
}
shutdown_req = &mut shutdown_rx => {
if let Ok(req) = shutdown_req {
debug!(target: "reth::cli", "received engine shutdown request");
engine_service.orchestrator_mut().handler_mut().handler_mut().on_event(
orchestrator.handler_mut().handler_mut().on_event(
FromOrchestrator::Terminate { tx: req.done_tx }.into()
);
}