diff --git a/Cargo.lock b/Cargo.lock index c6e5e7e..1b07d26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4492,6 +4492,7 @@ dependencies = [ "semver 1.0.26", "serde", "serde_json", + "tempfile", "tokio", "tracing", ] @@ -4504,7 +4505,7 @@ dependencies = [ "clap", "semver 1.0.26", "serde", - "temp-dir", + "tempfile", ] [[package]] @@ -4530,7 +4531,6 @@ dependencies = [ "semver 1.0.26", "serde", "serde_json", - "temp-dir", "tempfile", "tokio", "tracing", @@ -4572,7 +4572,7 @@ dependencies = [ "serde_json", "sp-core", "sp-runtime", - "temp-dir", + "tempfile", "tokio", "tracing", ] @@ -5786,12 +5786,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "temp-dir" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83176759e9416cf81ee66cb6508dbfe9c96f20b8b56265a39917551c23c70964" - [[package]] name = "tempfile" version = "3.20.0" diff --git a/Cargo.toml b/Cargo.toml index d8b4213..7efdd50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,6 @@ serde_json = { version = "1.0", default-features = false, features = [ sha2 = { version = "0.10.9" } sp-core = "36.1.0" sp-runtime = "41.1.0" -temp-dir = { version = "0.1.16" } tempfile = "3.3" thiserror = "2" tokio = { version = "1.47.0", default-features = false, features = [ diff --git a/crates/compiler/Cargo.toml b/crates/compiler/Cargo.toml index 6797a22..73cb43a 100644 --- a/crates/compiler/Cargo.toml +++ b/crates/compiler/Cargo.toml @@ -26,5 +26,8 @@ serde_json = { workspace = true } tracing = { workspace = true } tokio = { workspace = true } +[dev-dependencies] +tempfile = { workspace = true } + [lints] workspace = true diff --git a/crates/compiler/src/utils.rs b/crates/compiler/src/utils.rs index c348ed9..b001847 100644 --- a/crates/compiler/src/utils.rs +++ b/crates/compiler/src/utils.rs @@ -48,3 +48,28 @@ pub async fn solc_version(solc_path: &Path) -> anyhow::Result { } } } + +#[cfg(test)] +mod test { + use super::*; + use revive_dt_common::types::VersionOrRequirement; + + #[tokio::test] + async fn compiler_version_can_be_obtained() { + // Arrange + let temp_dir = tempfile::tempdir().expect("can create tempdir"); + let solc_path = revive_dt_solc_binaries::download_solc( + temp_dir.path(), + VersionOrRequirement::default(), + false, + ) + .await + .expect("can download solc"); + + // Act + let version = solc_version(&solc_path).await; + + // Assert + let _ = version.expect("Failed to get version"); + } +} diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index 10c5c61..133e4c9 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -12,7 +12,7 @@ rust-version.workspace = true alloy = { workspace = true } clap = { workspace = true } semver = { workspace = true } -temp-dir = { workspace = true } +tempfile = { workspace = true } serde = { workspace = true } [lints] diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 86ba19e..968ac51 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -10,7 +10,7 @@ use alloy::{network::EthereumWallet, signers::local::PrivateKeySigner}; use clap::{Parser, ValueEnum}; use semver::Version; use serde::{Deserialize, Serialize}; -use temp_dir::TempDir; +use tempfile::TempDir; #[derive(Debug, Parser, Clone, Serialize, Deserialize)] #[command(name = "retester")] diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 369fc08..125820a 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -37,7 +37,6 @@ tracing-subscriber = { workspace = true } semver = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } -temp-dir = { workspace = true } tempfile = { workspace = true } [lints] diff --git a/crates/core/src/main.rs b/crates/core/src/main.rs index c75dbad..b116acd 100644 --- a/crates/core/src/main.rs +++ b/crates/core/src/main.rs @@ -18,7 +18,7 @@ use futures::StreamExt; use futures::stream; use indexmap::IndexMap; use revive_dt_node_interaction::EthereumNode; -use temp_dir::TempDir; +use tempfile::TempDir; use tokio::{sync::mpsc, try_join}; use tracing::{debug, info, info_span, instrument}; use tracing_appender::non_blocking::WorkerGuard; diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index b895165..3683324 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -27,7 +27,7 @@ sp-core = { workspace = true } sp-runtime = { workspace = true } [dev-dependencies] -temp-dir = { workspace = true } +tempfile = { workspace = true } tokio = { workspace = true } [lints] diff --git a/crates/node/src/geth.rs b/crates/node/src/geth.rs index e72a7ed..d9f2bb2 100644 --- a/crates/node/src/geth.rs +++ b/crates/node/src/geth.rs @@ -605,7 +605,7 @@ impl Drop for GethNode { mod tests { use revive_dt_config::Arguments; - use temp_dir::TempDir; + use tempfile::TempDir; use crate::{GENESIS_JSON, Node};