Repository: dusk-network/rusk (language: rust)

Issue:
Remove deprecate `tempdir` dependency
#### Summary
> The tempdir crate is being merged into [tempfile](https://github.com/Stebalien/tempfile) and is available in 3.x. Please direct new issues and pull requests to tempfile.

Source https://github.com/rust-lang-deprecated/tempdir?tab=readme-ov-file#deprecation-note


Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 27cc57bad9..b78bfc08fc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1682,7 +1682,7 @@ dependencies = [
  "serde_with",
  "smallvec",
  "sqlx",
- "tempdir",
+ "tempfile",
  "thiserror",
  "time-util",
  "tokio",
@@ -2155,12 +2155,6 @@ version = "1.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
 
-[[package]]
-name = "fuchsia-cprng"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
-
 [[package]]
 name = "funty"
 version = "2.0.0"
@@ -3953,19 +3947,6 @@ version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
 
-[[package]]
-name = "rand"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
-dependencies = [
- "fuchsia-cprng",
- "libc",
- "rand_core 0.3.1",
- "rdrand",
- "winapi",
-]
-
 [[package]]
 name = "rand"
 version = "0.7.3"
@@ -4010,21 +3991,6 @@ dependencies = [
  "rand_core 0.6.4",
 ]
 
-[[package]]
-name = "rand_core"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
-dependencies = [
- "rand_core 0.4.2",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
-
 [[package]]
 name = "rand_core"
 version = "0.5.1"
@@ -4093,15 +4059,6 @@ dependencies = [
  "crossbeam-utils",
 ]
 
-[[package]]
-name = "rdrand"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
-dependencies = [
- "rand_core 0.3.1",
-]
-
 [[package]]
 name = "redox_syscall"
 version = "0.5.7"
@@ -4179,15 +4136,6 @@ version = "0.8.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
 
-[[package]]
-name = "remove_dir_all"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
-dependencies = [
- "winapi",
-]
-
 [[package]]
 name = "rend"
 version = "0.3.6"
@@ -4367,7 +4315,7 @@ dependencies = [
  "serde",
  "serde_derive",
  "tar",
- "tempdir",
+ "tempfile",
  "tokio",
  "toml",
  "tracing",
@@ -5164,16 +5112,6 @@ version = "0.12.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
 
-[[package]]
-name = "tempdir"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
-dependencies = [
- "rand 0.4.6",
- "remove_dir_all",
-]
-
 [[package]]
 name = "tempfile"
 version = "3.12.0"
diff --git a/Cargo.toml b/Cargo.toml
index 10e6b7f9c7..686a592c58 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -132,7 +132,6 @@ sha3 = "0.10.8"
 smallvec = "1.13.2"
 sqlx = "0.8.2"
 tar = "0.4.42"
-tempdir = "0.3.7"
 tempfile = "3.12"
 thiserror = "1.0.64"
 time-util = "0.3.4"
diff --git a/node/CHANGELOG.md b/node/CHANGELOG.md
index 18bdee0951..f56c617e40 100644
--- a/node/CHANGELOG.md
+++ b/node/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 
+### Changed
+
+- Change deprecated `tempdir` with `tempfile` dependency [#3407]
+
 ## [1.0.1] - 2025-01-23
 
 ### Changed
@@ -18,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - First `dusk-node` release
 
 <!-- Issues -->
+[#3407]: https://github.com/dusk-network/rusk/issues/3407
 [#3405]: https://github.com/dusk-network/rusk/issues/3405
 
 [Unreleased]: https://github.com/dusk-network/rusk/compare/dusk-node-1.0.1...HEAD
diff --git a/node/Cargo.toml b/node/Cargo.toml
index 4a9cd65eb8..8c5f946f71 100644
--- a/node/Cargo.toml
+++ b/node/Cargo.toml
@@ -49,7 +49,7 @@ serde_with = { workspace = true, features = ["hex"], optional = true }
 fake = { workspace = true, features = ['derive'] }
 node-data = { workspace = true, features = ["faker"] }
 rand = { workspace = true }
-tempdir = { workspace = true }
+tempfile = { workspace = true }
 criterion = { workspace = true, features = ["async_futures"] }
 
 [features]
diff --git a/node/src/database/rocksdb.rs b/node/src/database/rocksdb.rs
index 55f01d524a..d8b462ac23 100644
--- a/node/src/database/rocksdb.rs
+++ b/node/src/database/rocksdb.rs
@@ -1741,12 +1741,12 @@ mod tests {
             .for_each(drop);
     }
 
-    struct TestWrapper(tempdir::TempDir);
+    struct TestWrapper(tempfile::TempDir);
 
     impl TestWrapper {
         fn new(path: &'static str) -> Self {
             Self(
-                tempdir::TempDir::new(path)
+                tempfile::TempDir::with_prefix(path)
                     .expect("Temp directory to be created"),
             )
         }
diff --git a/rusk-recovery/CHANGELOG.md b/rusk-recovery/CHANGELOG.md
index 9b99c59719..7af904af36 100644
--- a/rusk-recovery/CHANGELOG.md
+++ b/rusk-recovery/CHANGELOG.md
@@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 
-[1.0.2] - 2025-01-23
+### Changed
+
+- Change deprecated `tempdir` with `tempfile` dependency [#3407]
+
+## [1.0.2] - 2025-01-23
 
 ### Changed
 
@@ -18,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - First `rusk-recovery` release
 
 <!-- Issues -->
+[#3407]: https://github.com/dusk-network/rusk/issues/3407
 [#3405]: https://github.com/dusk-network/rusk/issues/3405
 
 [Unreleased]: https://github.com/dusk-network/rusk/compare/rusk-recovery-1.0.2...HEAD
diff --git a/rusk-recovery/Cargo.toml b/rusk-recovery/Cargo.toml
index 804e276745..0394d0002a 100644
--- a/rusk-recovery/Cargo.toml
+++ b/rusk-recovery/Cargo.toml
@@ -43,7 +43,7 @@ reqwest = { workspace = true, optional = true }
 tokio = { workspace = true, features = ["full"], optional = true }
 
 [dev-dependencies]
-tempdir = { workspace = true }
+tempfile = { workspace = true }
 
 [build-dependencies]
 cargo_toml = { workspace = true }
diff --git a/rusk-recovery/src/state.rs b/rusk-recovery/src/state.rs
index be2dcf275e..8bad02a0b2 100644
--- a/rusk-recovery/src/state.rs
+++ b/rusk-recovery/src/state.rs
@@ -346,7 +346,7 @@ mod tests {
     #[test]
     fn mainnet_genesis() -> Result<(), Box<dyn Error>> {
         let mainnet = mainnet_from_file()?;
-        let tmp = tempdir::TempDir::new("genesis")
+        let tmp = tempfile::TempDir::with_prefix("genesis")
             .expect("Should be able to create temporary directory");
         let (_, root) =
             deploy(tmp.path(), &mainnet, dusk_mainnet_key(), |_| {})?;


Test patch: