diff --git a/Cargo.lock b/Cargo.lock index 2dece98910..bec3e28ac0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3101,15 +3101,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" -dependencies = [ - "dirs-sys", -] - [[package]] name = "dirs-next" version = "2.0.0" @@ -3120,18 +3111,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" -dependencies = [ - "libc", - "option-ext", - "redox_users 0.5.2", - "windows-sys 0.59.0", -] - [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -3139,7 +3118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users 0.4.6", + "redox_users", "winapi", ] @@ -6549,12 +6528,6 @@ dependencies = [ "thiserror 2.0.18", ] -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "ordered-float" version = "5.1.0" @@ -7418,17 +7391,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "redox_users" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" -dependencies = [ - "getrandom 0.2.17", - "libredox", - "thiserror 2.0.18", -] - [[package]] name = "ref-cast" version = "1.0.25" @@ -7683,7 +7645,6 @@ dependencies = [ "reth-tracing", "serde", "serde_json", - "shellexpand", "shlex", "tokio", "tracing", @@ -7752,7 +7713,6 @@ dependencies = [ "reth-cli-runner", "reth-db", "serde_json", - "shellexpand", ] [[package]] @@ -9335,7 +9295,6 @@ dependencies = [ "reth-transaction-pool", "secp256k1 0.30.0", "serde", - "shellexpand", "strum", "thiserror 2.0.18", "tokio", @@ -11563,15 +11522,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shellexpand" -version = "3.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32824fab5e16e6c4d86dc1ba84489390419a39f97699852b66480bb87d297ed8" -dependencies = [ - "dirs", -] - [[package]] name = "shlex" version = "1.3.0" diff --git a/Cargo.toml b/Cargo.toml index 604a831635..70bef1b6a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -539,7 +539,6 @@ serde = { version = "1.0", default-features = false } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } serde_with = { version = "3", default-features = false, features = ["macros"] } sha2 = { version = "0.10", default-features = false } -shellexpand = "3.0.0" shlex = "1.3" smallvec = "1" strum = { version = "0.27", default-features = false } diff --git a/bin/reth-bench-compare/Cargo.toml b/bin/reth-bench-compare/Cargo.toml index 37cad179cc..6dc860a5d1 100644 --- a/bin/reth-bench-compare/Cargo.toml +++ b/bin/reth-bench-compare/Cargo.toml @@ -45,9 +45,6 @@ serde_json.workspace = true # Time handling chrono = { workspace = true, features = ["serde"] } -# Path manipulation -shellexpand.workspace = true - # CSV handling csv.workspace = true diff --git a/bin/reth-bench-compare/src/cli.rs b/bin/reth-bench-compare/src/cli.rs index 3c412f0f91..ed00534649 100644 --- a/bin/reth-bench-compare/src/cli.rs +++ b/bin/reth-bench-compare/src/cli.rs @@ -289,11 +289,7 @@ impl Args { /// Get the JWT secret path - either provided or derived from datadir pub(crate) fn jwt_secret_path(&self) -> PathBuf { match &self.jwt_secret { - Some(path) => { - let jwt_secret_str = path.to_string_lossy(); - let expanded = shellexpand::tilde(&jwt_secret_str); - PathBuf::from(expanded.as_ref()) - } + Some(path) => path.clone(), None => { // Use the same logic as reth: //jwt.hex let chain_path = self.datadir.clone().resolve_datadir(self.chain); @@ -308,10 +304,9 @@ impl Args { chain_path.data_dir().to_path_buf() } - /// Get the expanded output directory path + /// Get the output directory path pub(crate) fn output_dir_path(&self) -> PathBuf { - let expanded = shellexpand::tilde(&self.output_dir); - PathBuf::from(expanded.as_ref()) + PathBuf::from(&self.output_dir) } /// Get the effective warmup blocks value - either specified or defaults to blocks diff --git a/crates/cli/cli/Cargo.toml b/crates/cli/cli/Cargo.toml index 34e3dc8d44..009f5b2454 100644 --- a/crates/cli/cli/Cargo.toml +++ b/crates/cli/cli/Cargo.toml @@ -18,6 +18,5 @@ alloy-genesis.workspace = true # misc clap.workspace = true -shellexpand.workspace = true eyre.workspace = true serde_json.workspace = true diff --git a/crates/cli/cli/src/chainspec.rs b/crates/cli/cli/src/chainspec.rs index 4a76bb8a5e..cfcedebdbc 100644 --- a/crates/cli/cli/src/chainspec.rs +++ b/crates/cli/cli/src/chainspec.rs @@ -73,7 +73,7 @@ pub trait ChainSpecParser: Clone + Send + Sync + 'static { /// A helper to parse a [`Genesis`](alloy_genesis::Genesis) as argument or from disk. pub fn parse_genesis(s: &str) -> eyre::Result { // try to read json from path first - let raw = match fs::read_to_string(PathBuf::from(shellexpand::full(s)?.into_owned())) { + let raw = match fs::read_to_string(PathBuf::from(s)) { Ok(raw) => raw, Err(io_err) => { // valid json may start with "\n", but must contain "{" diff --git a/crates/node/core/Cargo.toml b/crates/node/core/Cargo.toml index 767e44608f..fac90dec75 100644 --- a/crates/node/core/Cargo.toml +++ b/crates/node/core/Cargo.toml @@ -59,7 +59,6 @@ url.workspace = true ipnet.workspace = true # io dirs-next.workspace = true -shellexpand.workspace = true # obs tracing.workspace = true diff --git a/crates/node/core/src/dirs.rs b/crates/node/core/src/dirs.rs index 815bd8e62f..85388727b6 100644 --- a/crates/node/core/src/dirs.rs +++ b/crates/node/core/src/dirs.rs @@ -3,7 +3,7 @@ use crate::{args::DatadirArgs, utils::parse_path}; use reth_chainspec::Chain; use std::{ - env::VarError, + convert::Infallible, fmt::{Debug, Display, Formatter}, path::{Path, PathBuf}, str::FromStr, @@ -86,8 +86,7 @@ pub trait XdgPath { /// A wrapper type that either parses a user-given path or defaults to an /// OS-specific path. /// -/// The [`FromStr`] implementation supports shell expansions and common patterns such as `~` for the -/// home directory. +/// The [`FromStr`] implementation parses a string into a path. /// /// # Example /// @@ -127,10 +126,10 @@ impl Default for PlatformPath { } impl FromStr for PlatformPath { - type Err = shellexpand::LookupError; + type Err = Infallible; fn from_str(s: &str) -> Result { - Ok(Self(parse_path(s)?, std::marker::PhantomData)) + Ok(Self(parse_path(s), std::marker::PhantomData)) } } @@ -235,7 +234,7 @@ impl Default for MaybePlatformPath { } impl FromStr for MaybePlatformPath { - type Err = shellexpand::LookupError; + type Err = Infallible; fn from_str(s: &str) -> Result { let p = match s { diff --git a/crates/node/core/src/utils.rs b/crates/node/core/src/utils.rs index 062013d85d..68cab7929f 100644 --- a/crates/node/core/src/utils.rs +++ b/crates/node/core/src/utils.rs @@ -10,16 +10,12 @@ use reth_network_p2p::{ bodies::client::BodiesClient, headers::client::HeadersClient, priority::Priority, }; use reth_primitives_traits::{Block, SealedBlock, SealedHeader}; -use std::{ - env::VarError, - path::{Path, PathBuf}, -}; +use std::path::{Path, PathBuf}; use tracing::{debug, info}; -/// Parses a user-specified path with support for environment variables and common shorthands (e.g. -/// ~ for the user's home directory). -pub fn parse_path(value: &str) -> Result> { - shellexpand::full(value).map(|path| PathBuf::from(path.into_owned())) +/// Parses a user-specified path into a [`PathBuf`]. +pub fn parse_path(value: &str) -> PathBuf { + PathBuf::from(value) } /// Attempts to retrieve or create a JWT secret from the specified path.