chore(net): extract NetworkHandle methods for launching node to traits (#9966)

This commit is contained in:
Emilia Hane
2024-08-01 18:44:23 +02:00
committed by GitHub
parent f3fac56fd9
commit b10517b3bf
56 changed files with 985 additions and 776 deletions

View File

@ -1,6 +1,7 @@
//! Command for debugging execution.
use crate::{args::NetworkArgs, macros::block_executor, utils::get_single_header};
use std::{path::PathBuf, sync::Arc};
use clap::Parser;
use futures::{stream::select as stream_select, StreamExt};
use reth_beacon_consensus::EthBeaconConsensus;
@ -16,7 +17,7 @@ use reth_downloaders::{
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
};
use reth_exex::ExExManagerHandle;
use reth_network::{NetworkEvents, NetworkHandle};
use reth_network::{BlockDownloaderProvider, NetworkEvents, NetworkHandle};
use reth_network_api::NetworkInfo;
use reth_network_p2p::{bodies::client::BodiesClient, headers::client::HeadersClient};
use reth_primitives::{BlockHashOrNumber, BlockNumber, B256};
@ -30,10 +31,11 @@ use reth_stages::{
};
use reth_static_file::StaticFileProducer;
use reth_tasks::TaskExecutor;
use std::{path::PathBuf, sync::Arc};
use tokio::sync::watch;
use tracing::*;
use crate::{args::NetworkArgs, macros::block_executor, utils::get_single_header};
/// `reth debug execution` command
#[derive(Debug, Parser)]
pub struct Command {

View File

@ -1,10 +1,7 @@
//! Command for debugging in-memory merkle trie calculation.
use crate::{
args::NetworkArgs,
macros::block_executor,
utils::{get_single_body, get_single_header},
};
use std::{path::PathBuf, sync::Arc};
use backon::{ConstantBuilder, Retryable};
use clap::Parser;
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
@ -15,7 +12,7 @@ use reth_db::DatabaseEnv;
use reth_errors::BlockValidationError;
use reth_evm::execute::{BlockExecutionOutput, BlockExecutorProvider, Executor};
use reth_execution_types::ExecutionOutcome;
use reth_network::NetworkHandle;
use reth_network::{BlockDownloaderProvider, NetworkHandle};
use reth_network_api::NetworkInfo;
use reth_primitives::BlockHashOrNumber;
use reth_provider::{
@ -28,9 +25,14 @@ use reth_stages::StageId;
use reth_tasks::TaskExecutor;
use reth_trie::StateRoot;
use reth_trie_db::DatabaseStateRoot;
use std::{path::PathBuf, sync::Arc};
use tracing::*;
use crate::{
args::NetworkArgs,
macros::block_executor,
utils::{get_single_body, get_single_header},
};
/// `reth debug in-memory-merkle` command
/// This debug routine requires that the node is positioned at the block before the target.
/// The script will then download the block from p2p network and attempt to calculate and verify

View File

@ -1,5 +1,7 @@
//! Command for debugging merkle trie calculation.
use crate::{args::NetworkArgs, macros::block_executor, utils::get_single_header};
use std::{path::PathBuf, sync::Arc};
use backon::{ConstantBuilder, Retryable};
use clap::Parser;
use reth_beacon_consensus::EthBeaconConsensus;
@ -11,7 +13,7 @@ use reth_consensus::Consensus;
use reth_db::{tables, DatabaseEnv};
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_evm::execute::{BatchExecutor, BlockExecutorProvider};
use reth_network::NetworkHandle;
use reth_network::{BlockDownloaderProvider, NetworkHandle};
use reth_network_api::NetworkInfo;
use reth_network_p2p::full_block::FullBlockClient;
use reth_primitives::BlockHashOrNumber;
@ -25,9 +27,10 @@ use reth_stages::{
ExecInput, Stage, StageCheckpoint,
};
use reth_tasks::TaskExecutor;
use std::{path::PathBuf, sync::Arc};
use tracing::*;
use crate::{args::NetworkArgs, macros::block_executor, utils::get_single_header};
/// `reth debug merkle` command
#[derive(Debug, Parser)]
pub struct Command {

View File

@ -1,4 +1,5 @@
use crate::{args::NetworkArgs, macros::block_executor};
use std::{path::PathBuf, sync::Arc, time::Duration};
use clap::Parser;
use eyre::Context;
use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig};
@ -14,7 +15,7 @@ use reth_consensus::Consensus;
use reth_db::DatabaseEnv;
use reth_engine_util::engine_store::{EngineMessageStore, StoredEngineApiMessage};
use reth_fs_util as fs;
use reth_network::NetworkHandle;
use reth_network::{BlockDownloaderProvider, NetworkHandle};
use reth_network_api::NetworkInfo;
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
use reth_provider::{
@ -25,10 +26,11 @@ use reth_stages::Pipeline;
use reth_static_file::StaticFileProducer;
use reth_tasks::TaskExecutor;
use reth_transaction_pool::noop::NoopTransactionPool;
use std::{path::PathBuf, sync::Arc, time::Duration};
use tokio::sync::oneshot;
use tracing::*;
use crate::{args::NetworkArgs, macros::block_executor};
/// `reth debug replay-engine` command
/// This script will read stored engine API messages and replay them by the timestamp.
/// It does not require