refactor: engine interceptors (#8048)

This commit is contained in:
Roman Krasiuk
2024-05-02 17:17:28 +02:00
committed by GitHub
parent 1603113ce5
commit e68ab2f58c
11 changed files with 220 additions and 133 deletions

View File

@@ -19,7 +19,7 @@ use reth_consensus::Consensus;
use reth_db::{init_db, DatabaseEnv};
use reth_network::NetworkHandle;
use reth_network_api::NetworkInfo;
use reth_node_core::engine_api_store::{EngineApiStore, StoredEngineApiMessage};
use reth_node_core::engine::engine_store::{EngineMessageStore, StoredEngineApiMessage};
#[cfg(not(feature = "optimism"))]
use reth_node_ethereum::{EthEngineTypes, EthEvmConfig};
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
@@ -34,7 +34,7 @@ use reth_static_file::StaticFileProducer;
use reth_tasks::TaskExecutor;
use reth_transaction_pool::noop::NoopTransactionPool;
use std::{net::SocketAddr, path::PathBuf, sync::Arc, time::Duration};
use tokio::sync::{mpsc, oneshot};
use tokio::sync::oneshot;
use tracing::*;
/// `reth debug replay-engine` command
@@ -191,8 +191,7 @@ impl Command {
// Configure the consensus engine
let network_client = network.fetch_client().await?;
let (consensus_engine_tx, consensus_engine_rx) = mpsc::unbounded_channel();
let (beacon_consensus_engine, beacon_engine_handle) = BeaconConsensusEngine::with_channel(
let (beacon_consensus_engine, beacon_engine_handle) = BeaconConsensusEngine::new(
network_client,
Pipeline::builder().build(
provider_factory.clone(),
@@ -210,8 +209,6 @@ impl Command {
payload_builder,
None,
u64::MAX,
consensus_engine_tx,
consensus_engine_rx,
EngineHooks::new(),
)?;
info!(target: "reth::cli", "Consensus engine initialized");
@@ -224,7 +221,7 @@ impl Command {
let _ = tx.send(res);
});
let engine_api_store = EngineApiStore::new(self.engine_api_store.clone());
let engine_api_store = EngineMessageStore::new(self.engine_api_store.clone());
for filepath in engine_api_store.engine_messages_iter()? {
let contents =
fs::read(&filepath).wrap_err(format!("failed to read: {}", filepath.display()))?;