chore: use reth_chainspec where possible (#8891)

This commit is contained in:
joshieDo
2024-06-17 18:09:09 +02:00
committed by GitHub
parent 01d81b4dcc
commit 2a5c93fab3
183 changed files with 430 additions and 261 deletions

View File

@ -14,6 +14,7 @@ workspace = true
[dependencies]
# reth
reth-chainspec.workspace = true
reth-config.workspace = true
reth-primitives.workspace = true
reth-fs-util.workspace = true

View File

@ -13,10 +13,10 @@ use crate::{
version::{LONG_VERSION, SHORT_VERSION},
};
use clap::{value_parser, Parser, Subcommand};
use reth_chainspec::ChainSpec;
use reth_cli_runner::CliRunner;
use reth_db::DatabaseEnv;
use reth_node_builder::{NodeBuilder, WithLaunchContext};
use reth_primitives::ChainSpec;
use reth_tracing::FileWorkerGuard;
use std::{ffi::OsString, fmt, future::Future, sync::Arc};
use tracing::info;

View File

@ -2,6 +2,7 @@
use clap::Parser;
use reth_beacon_consensus::EthBeaconConsensus;
use reth_chainspec::ChainSpec;
use reth_config::{config::EtlConfig, Config};
use reth_db::{init_db, open_db_read_only, DatabaseEnv};
use reth_db_common::init::init_genesis;
@ -14,7 +15,7 @@ use reth_node_core::{
},
dirs::{ChainPath, DataDirPath},
};
use reth_primitives::{ChainSpec, B256};
use reth_primitives::B256;
use reth_provider::{providers::StaticFileProvider, ProviderFactory, StaticFileProviderFactory};
use reth_stages::{sets::DefaultStages, Pipeline, PipelineTarget};
use reth_static_file::StaticFileProducer;

View File

@ -1,7 +1,7 @@
//! Command that dumps genesis block JSON configuration to stdout
use crate::args::utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS};
use clap::Parser;
use reth_primitives::ChainSpec;
use reth_chainspec::ChainSpec;
use std::sync::Arc;
/// Dumps genesis block JSON configuration to stdout
@ -39,7 +39,7 @@ mod tests {
DumpGenesisCommand::parse_from(["reth", "--chain", chain]);
assert_eq!(
Ok(args.chain.chain),
chain.parse::<reth_primitives::Chain>(),
chain.parse::<reth_chainspec::Chain>(),
"failed to parse chain {chain}"
);
}

View File

@ -237,7 +237,7 @@ mod tests {
let args: ImportCommand = ImportCommand::parse_from(["reth", "--chain", chain, "."]);
assert_eq!(
Ok(args.env.chain.chain),
chain.parse::<reth_primitives::Chain>(),
chain.parse::<reth_chainspec::Chain>(),
"failed to parse chain {chain}"
);
}

View File

@ -6,11 +6,11 @@ use crate::args::{
RpcServerArgs, TxPoolArgs,
};
use clap::{value_parser, Args, Parser};
use reth_chainspec::ChainSpec;
use reth_cli_runner::CliContext;
use reth_db::{init_db, DatabaseEnv};
use reth_node_builder::{NodeBuilder, WithLaunchContext};
use reth_node_core::{node_config::NodeConfig, version};
use reth_primitives::ChainSpec;
use std::{ffi::OsString, fmt, future::Future, net::SocketAddr, path::PathBuf, sync::Arc};
/// Start the node
@ -213,7 +213,7 @@ mod tests {
fn parse_common_node_command_chain_args() {
for chain in SUPPORTED_CHAINS {
let args: NodeCommand = NodeCommand::<NoArgs>::parse_from(["reth", "--chain", chain]);
assert_eq!(args.chain.chain, chain.parse::<reth_primitives::Chain>().unwrap());
assert_eq!(args.chain.chain, chain.parse::<reth_chainspec::Chain>().unwrap());
}
}
@ -305,7 +305,7 @@ mod tests {
#[cfg(not(feature = "optimism"))] // dev mode not yet supported in op-reth
fn parse_dev() {
let cmd = NodeCommand::<NoArgs>::parse_from(["reth", "--dev"]);
let chain = reth_primitives::DEV.clone();
let chain = reth_chainspec::DEV.clone();
assert_eq!(cmd.chain.chain, chain.chain);
assert_eq!(cmd.chain.genesis_hash, chain.genesis_hash);
assert_eq!(

View File

@ -11,12 +11,13 @@ use crate::{
use backon::{ConstantBuilder, Retryable};
use clap::{Parser, Subcommand};
use discv5::ListenConfig;
use reth_chainspec::ChainSpec;
use reth_config::Config;
use reth_db::create_db;
use reth_network::NetworkConfigBuilder;
use reth_network_p2p::bodies::client::BodiesClient;
use reth_node_core::args::DatadirArgs;
use reth_primitives::{BlockHashOrNumber, ChainSpec};
use reth_primitives::BlockHashOrNumber;
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
use std::{
net::{IpAddr, SocketAddrV4, SocketAddrV6},

View File

@ -2,6 +2,7 @@
use boyer_moore_magiclen::BMByte;
use eyre::Result;
use reth_chainspec::ChainSpec;
use reth_db::{RawTable, TableRawRow};
use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO},
@ -11,7 +12,6 @@ use reth_db_api::{
DatabaseError,
};
use reth_fs_util as fs;
use reth_primitives::ChainSpec;
use reth_provider::{ChainSpecProvider, ProviderFactory};
use std::{path::Path, rc::Rc, sync::Arc};
use tracing::info;