mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: extract db commands (#9217)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
44
Cargo.lock
generated
44
Cargo.lock
generated
@ -6279,34 +6279,26 @@ dependencies = [
|
||||
name = "reth"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"alloy-rlp",
|
||||
"aquamarine",
|
||||
"arbitrary",
|
||||
"assert_matches",
|
||||
"backon",
|
||||
"clap",
|
||||
"comfy-table",
|
||||
"confy",
|
||||
"crossterm",
|
||||
"discv5",
|
||||
"eyre",
|
||||
"fdlimit",
|
||||
"futures",
|
||||
"human_bytes",
|
||||
"itertools 0.13.0",
|
||||
"jsonrpsee",
|
||||
"libc",
|
||||
"metrics-process",
|
||||
"proptest",
|
||||
"proptest-arbitrary-interop",
|
||||
"rand 0.8.5",
|
||||
"ratatui",
|
||||
"rayon",
|
||||
"reth-basic-payload-builder",
|
||||
"reth-beacon-consensus",
|
||||
"reth-blockchain-tree",
|
||||
"reth-chainspec",
|
||||
"reth-cli-commands",
|
||||
"reth-cli-runner",
|
||||
"reth-config",
|
||||
"reth-consensus",
|
||||
@ -6315,7 +6307,6 @@ dependencies = [
|
||||
"reth-db-api",
|
||||
"reth-db-common",
|
||||
"reth-discv4",
|
||||
"reth-discv5",
|
||||
"reth-downloaders",
|
||||
"reth-engine-util",
|
||||
"reth-errors",
|
||||
@ -6324,11 +6315,9 @@ dependencies = [
|
||||
"reth-execution-types",
|
||||
"reth-exex",
|
||||
"reth-fs-util",
|
||||
"reth-net-banlist",
|
||||
"reth-network",
|
||||
"reth-network-api",
|
||||
"reth-network-p2p",
|
||||
"reth-nippy-jar",
|
||||
"reth-node-api",
|
||||
"reth-node-builder",
|
||||
"reth-node-core",
|
||||
@ -6342,7 +6331,6 @@ dependencies = [
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"reth-prune",
|
||||
"reth-prune-types",
|
||||
"reth-revm",
|
||||
"reth-rpc",
|
||||
"reth-rpc-api",
|
||||
@ -6587,6 +6575,36 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "reth-cli-commands"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"clap",
|
||||
"comfy-table",
|
||||
"confy",
|
||||
"crossterm",
|
||||
"eyre",
|
||||
"human_bytes",
|
||||
"itertools 0.13.0",
|
||||
"ratatui",
|
||||
"reth-beacon-consensus",
|
||||
"reth-chainspec",
|
||||
"reth-config",
|
||||
"reth-db",
|
||||
"reth-db-api",
|
||||
"reth-db-common",
|
||||
"reth-downloaders",
|
||||
"reth-evm",
|
||||
"reth-fs-util",
|
||||
"reth-node-core",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"reth-stages",
|
||||
"reth-static-file",
|
||||
"reth-static-file-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-cli-runner"
|
||||
|
||||
@ -21,7 +21,7 @@ reth-fs-util.workspace = true
|
||||
reth-db = { workspace = true, features = ["mdbx"] }
|
||||
reth-db-api.workspace = true
|
||||
reth-exex.workspace = true
|
||||
reth-provider = { workspace = true }
|
||||
reth-provider.workspace = true
|
||||
reth-evm.workspace = true
|
||||
reth-revm.workspace = true
|
||||
reth-stages.workspace = true
|
||||
@ -30,6 +30,7 @@ reth-errors.workspace = true
|
||||
reth-transaction-pool.workspace = true
|
||||
reth-beacon-consensus.workspace = true
|
||||
reth-cli-runner.workspace = true
|
||||
reth-cli-commands.workspace = true
|
||||
reth-consensus-common.workspace = true
|
||||
reth-blockchain-tree.workspace = true
|
||||
reth-rpc-builder.workspace = true
|
||||
@ -41,34 +42,29 @@ reth-rpc-eth-types.workspace = true
|
||||
reth-rpc-server-types.workspace = true
|
||||
reth-network = { workspace = true, features = ["serde"] }
|
||||
reth-network-p2p.workspace = true
|
||||
reth-net-banlist.workspace = true
|
||||
reth-network-api.workspace = true
|
||||
reth-downloaders.workspace = true
|
||||
reth-tracing.workspace = true
|
||||
reth-tasks.workspace = true
|
||||
reth-ethereum-payload-builder.workspace = true
|
||||
reth-payload-builder.workspace = true
|
||||
reth-payload-primitives.workspace = true
|
||||
reth-payload-validator.workspace = true
|
||||
reth-basic-payload-builder.workspace = true
|
||||
reth-discv4.workspace = true
|
||||
reth-discv5.workspace = true
|
||||
reth-static-file.workspace = true
|
||||
reth-static-file-types = { workspace = true, features = ["clap"] }
|
||||
reth-trie = { workspace = true, features = ["metrics"] }
|
||||
reth-nippy-jar.workspace = true
|
||||
reth-node-api.workspace = true
|
||||
reth-node-ethereum.workspace = true
|
||||
reth-node-optimism = { workspace = true, optional = true, features = [
|
||||
"optimism",
|
||||
] }
|
||||
reth-node-core.workspace = true
|
||||
reth-ethereum-payload-builder.workspace = true
|
||||
reth-db-common.workspace = true
|
||||
reth-node-ethereum.workspace = true
|
||||
reth-node-builder.workspace = true
|
||||
reth-node-events.workspace = true
|
||||
reth-consensus.workspace = true
|
||||
reth-optimism-primitives.workspace = true
|
||||
reth-prune-types.workspace = true
|
||||
reth-engine-util.workspace = true
|
||||
reth-prune.workspace = true
|
||||
|
||||
@ -92,15 +88,7 @@ metrics-process.workspace = true
|
||||
proptest.workspace = true
|
||||
arbitrary.workspace = true
|
||||
proptest-arbitrary-interop.workspace = true
|
||||
rand.workspace = true
|
||||
|
||||
# tui
|
||||
comfy-table = "7.1"
|
||||
crossterm = "0.27.0"
|
||||
ratatui = { version = "0.27", default-features = false, features = [
|
||||
"crossterm",
|
||||
] }
|
||||
human_bytes = "0.4.1"
|
||||
|
||||
# async
|
||||
tokio = { workspace = true, features = [
|
||||
@ -119,8 +107,6 @@ tempfile.workspace = true
|
||||
backon.workspace = true
|
||||
similar-asserts.workspace = true
|
||||
itertools.workspace = true
|
||||
rayon.workspace = true
|
||||
ahash = "0.8"
|
||||
|
||||
# p2p
|
||||
discv5.workspace = true
|
||||
@ -130,8 +116,9 @@ tikv-jemallocator = { version = "0.5.0", optional = true }
|
||||
libc = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
jsonrpsee.workspace = true
|
||||
assert_matches = "1.5.0"
|
||||
reth-discv4.workspace = true
|
||||
|
||||
|
||||
|
||||
[features]
|
||||
default = ["jemalloc"]
|
||||
|
||||
@ -6,7 +6,7 @@ use crate::{
|
||||
LogArgs,
|
||||
},
|
||||
commands::{
|
||||
config_cmd, db, debug_cmd, dump_genesis, import, init_cmd, init_state,
|
||||
config_cmd, debug_cmd, dump_genesis, import, init_cmd, init_state,
|
||||
node::{self, NoArgs},
|
||||
p2p, prune, recover, stage, test_vectors,
|
||||
},
|
||||
@ -14,6 +14,7 @@ use crate::{
|
||||
};
|
||||
use clap::{value_parser, Parser, Subcommand};
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_cli_commands::db;
|
||||
use reth_cli_runner::CliRunner;
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_node_builder::{NodeBuilder, WithLaunchContext};
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
//! Command for debugging block building.
|
||||
|
||||
use crate::{
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
macros::block_executor,
|
||||
};
|
||||
use crate::macros::block_executor;
|
||||
use alloy_rlp::Decodable;
|
||||
use clap::Parser;
|
||||
use eyre::Context;
|
||||
@ -14,6 +10,7 @@ use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_blockchain_tree::{
|
||||
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
|
||||
};
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_db::DatabaseEnv;
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
|
||||
use crate::{
|
||||
args::{get_secret_key, NetworkArgs},
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
macros::block_executor,
|
||||
utils::get_single_header,
|
||||
};
|
||||
use clap::Parser;
|
||||
use futures::{stream::select as stream_select, StreamExt};
|
||||
use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
use crate::{
|
||||
args::{get_secret_key, NetworkArgs},
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
macros::block_executor,
|
||||
utils::{get_single_body, get_single_header},
|
||||
};
|
||||
use backon::{ConstantBuilder, Retryable};
|
||||
use clap::Parser;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_db::DatabaseEnv;
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
//! Command for debugging merkle trie calculation.
|
||||
|
||||
use crate::{
|
||||
args::{get_secret_key, NetworkArgs},
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
macros::block_executor,
|
||||
utils::get_single_header,
|
||||
};
|
||||
use backon::{ConstantBuilder, Retryable};
|
||||
use clap::Parser;
|
||||
use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
args::{get_secret_key, NetworkArgs},
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
macros::block_executor,
|
||||
};
|
||||
use clap::Parser;
|
||||
@ -10,6 +9,7 @@ use reth_beacon_consensus::{hooks::EngineHooks, BeaconConsensusEngine, EthBeacon
|
||||
use reth_blockchain_tree::{
|
||||
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
|
||||
};
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
//! Command that initializes the node by importing a chain from a file.
|
||||
|
||||
use crate::{
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
macros::block_executor,
|
||||
version::SHORT_VERSION,
|
||||
};
|
||||
use crate::{macros::block_executor, version::SHORT_VERSION};
|
||||
use clap::Parser;
|
||||
use futures::{Stream, StreamExt};
|
||||
use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_db::tables;
|
||||
|
||||
@ -1,14 +1,8 @@
|
||||
//! Command that initializes the node by importing OP Mainnet chain segment below Bedrock, from a
|
||||
//! file.
|
||||
|
||||
use crate::{
|
||||
commands::{
|
||||
common::{AccessRights, Environment, EnvironmentArgs},
|
||||
import::build_import_pipeline,
|
||||
},
|
||||
version::SHORT_VERSION,
|
||||
};
|
||||
use crate::{commands::import::build_import_pipeline, version::SHORT_VERSION};
|
||||
use clap::Parser;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_consensus::noop::NoopConsensus;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::transaction::DbTx;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
//! Command that imports OP mainnet receipts from Bedrock datadir, exported via
|
||||
//! <https://github.com/testinprod-io/op-geth/pull/1>.
|
||||
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::Parser;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{database::Database, transaction::DbTx};
|
||||
use reth_downloaders::{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! Command that initializes the node from a genesis file.
|
||||
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::Parser;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_provider::BlockHashReader;
|
||||
use tracing::info;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! Command that initializes the node from a genesis file.
|
||||
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::Parser;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_config::config::EtlConfig;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_db_common::init::init_from_state_dump;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
//! This contains all of the `reth` commands
|
||||
|
||||
pub mod config_cmd;
|
||||
pub mod db;
|
||||
pub mod debug_cmd;
|
||||
pub mod dump_genesis;
|
||||
pub mod import;
|
||||
@ -15,5 +14,3 @@ pub mod prune;
|
||||
pub mod recover;
|
||||
pub mod stage;
|
||||
pub mod test_vectors;
|
||||
|
||||
pub mod common;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
//! Command that runs pruning without any limits.
|
||||
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::Parser;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_prune::PrunerBuilder;
|
||||
use reth_static_file::StaticFileProducer;
|
||||
use tracing::info;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::Parser;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
//! Database debugging tool
|
||||
|
||||
use crate::{
|
||||
args::StageEnum,
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
};
|
||||
use crate::args::StageEnum;
|
||||
use clap::Parser;
|
||||
use itertools::Itertools;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_db::{static_file::iter_static_files, tables, DatabaseEnv};
|
||||
use reth_db_api::transaction::DbTxMut;
|
||||
use reth_db_common::{
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
//! Database debugging tool
|
||||
|
||||
use crate::{
|
||||
args::DatadirArgs,
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
dirs::DataDirPath,
|
||||
};
|
||||
use crate::{args::DatadirArgs, dirs::DataDirPath};
|
||||
use clap::Parser;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_db::{init_db, mdbx::DatabaseArguments, tables, DatabaseEnv};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO, database::Database, models::ClientVersion, table::TableImporter,
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
//! Main `stage` command
|
||||
//!
|
||||
//! Stage debugging tool
|
||||
|
||||
use crate::{
|
||||
args::{get_secret_key, NetworkArgs, StageEnum},
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
macros::block_executor,
|
||||
prometheus_exporter,
|
||||
};
|
||||
use clap::Parser;
|
||||
use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::config::{HashingConfig, SenderRecoveryConfig, TransactionLookupConfig};
|
||||
use reth_downloaders::bodies::bodies::BodiesDownloaderBuilder;
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
//! Unwinding a certain block range
|
||||
|
||||
use crate::macros::block_executor;
|
||||
use clap::{Parser, Subcommand};
|
||||
use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_db_api::database::Database;
|
||||
@ -24,11 +26,6 @@ use std::{ops::RangeInclusive, sync::Arc};
|
||||
use tokio::sync::watch;
|
||||
use tracing::info;
|
||||
|
||||
use crate::{
|
||||
commands::common::{AccessRights, Environment, EnvironmentArgs},
|
||||
macros::block_executor,
|
||||
};
|
||||
|
||||
/// `reth stage unwind` command
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct Command {
|
||||
|
||||
@ -8,3 +8,40 @@ homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lints]
|
||||
|
||||
[dependencies]
|
||||
reth-db = { workspace = true, features = ["mdbx"] }
|
||||
reth-db-api.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-primitives.workspace = true
|
||||
reth-node-core.workspace = true
|
||||
reth-fs-util.workspace = true
|
||||
reth-db-common.workspace = true
|
||||
reth-static-file-types.workspace = true
|
||||
reth-beacon-consensus.workspace = true
|
||||
reth-chainspec.workspace = true
|
||||
reth-config.workspace = true
|
||||
reth-downloaders.workspace = true
|
||||
reth-evm.workspace = true
|
||||
reth-stages.workspace = true
|
||||
reth-static-file.workspace = true
|
||||
|
||||
confy.workspace = true
|
||||
tokio.workspace = true
|
||||
itertools.workspace = true
|
||||
|
||||
# misc
|
||||
ahash = "0.8"
|
||||
human_bytes = "0.4.1"
|
||||
eyre.workspace = true
|
||||
clap = { workspace = true, features = ["derive", "env"] }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
# tui
|
||||
comfy-table = "7.0"
|
||||
crossterm = "0.27.0"
|
||||
ratatui = { version = "0.27", default-features = false, features = [
|
||||
"crossterm",
|
||||
] }
|
||||
@ -1,4 +1,4 @@
|
||||
use crate::commands::db::get::{maybe_json_value_parser, table_key};
|
||||
use crate::db::get::{maybe_json_value_parser, table_key};
|
||||
use ahash::RandomState;
|
||||
use clap::Parser;
|
||||
use reth_db::{DatabaseEnv, RawKey, RawTable, RawValue, TableViewer, Tables};
|
||||
@ -1,11 +1,11 @@
|
||||
use crate::{
|
||||
args::DatabaseArgs,
|
||||
dirs::{DataDirPath, PlatformPath},
|
||||
};
|
||||
use clap::Parser;
|
||||
use reth_db::{open_db_read_only, tables_to_generic, DatabaseEnv, Tables};
|
||||
use reth_db_api::{cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_node_core::{
|
||||
args::DatabaseArgs,
|
||||
dirs::{DataDirPath, PlatformPath},
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fmt::Debug,
|
||||
@ -1,6 +1,4 @@
|
||||
//! Database debugging tool
|
||||
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use crate::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::{Parser, Subcommand};
|
||||
use reth_db::version::{get_db_version, DatabaseVersionError, DB_VERSION};
|
||||
use reth_db_common::DbTool;
|
||||
@ -1,4 +1,4 @@
|
||||
use crate::commands::db::checksum::ChecksumViewer;
|
||||
use crate::db::checksum::ChecksumViewer;
|
||||
use clap::Parser;
|
||||
use comfy_table::{Cell, Row, Table as ComfyTable};
|
||||
use eyre::WrapErr;
|
||||
@ -7,3 +7,6 @@
|
||||
)]
|
||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
pub mod common;
|
||||
pub mod db;
|
||||
|
||||
Reference in New Issue
Block a user