diff --git a/Cargo.lock b/Cargo.lock index 7ef7ead69..a0c1ce4ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ "parking_lot 0.10.0", "rlp", "spec", - "tempdir", + "tempfile", "validator-set", ] @@ -425,7 +425,7 @@ dependencies = [ "criterion", "ethbloom", "parking_lot 0.10.0", - "tempdir", + "tempfile", ] [[package]] @@ -1119,7 +1119,7 @@ dependencies = [ "rustc-hex 2.1.0", "serde_json", "static_assertions", - "tempdir", + "tempfile", ] [[package]] @@ -1138,7 +1138,7 @@ dependencies = [ "machine", "rlp", "spec", - "tempdir", + "tempfile", "unexpected", ] @@ -1215,7 +1215,7 @@ dependencies = [ "spec", "state-db", "stats", - "tempdir", + "tempfile", "trace", "trace-time", "trie-db", @@ -1241,7 +1241,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "tempdir", + "tempfile", ] [[package]] @@ -1269,7 +1269,7 @@ dependencies = [ "rlp-derive", "rlp_compress", "rustc-hex 2.1.0", - "tempdir", + "tempfile", "triehash-ethereum", ] @@ -1380,7 +1380,7 @@ dependencies = [ "smallvec 1.2.0", "spec", "stats", - "tempdir", + "tempfile", "trie-db", "triehash-ethereum", "verification", @@ -1486,7 +1486,7 @@ dependencies = [ "serde", "serde_json", "slab 0.2.0", - "tempdir", + "tempfile", "tiny-keccak 1.5.0", ] @@ -1560,7 +1560,7 @@ dependencies = [ "log", "snapshot", "spec", - "tempdir", + "tempfile", "trace-time", ] @@ -1704,7 +1704,7 @@ dependencies = [ "serde_derive", "serde_json", "smallvec 1.2.0", - "tempdir", + "tempfile", "time", "tiny-keccak 1.5.0", ] @@ -1725,7 +1725,7 @@ dependencies = [ "rustc-hex 2.1.0", "serde", "serde_derive", - "tempdir", + "tempfile", ] [[package]] @@ -1767,7 +1767,7 @@ dependencies = [ "serde", "serde_json", "spec", - "tempdir", + "tempfile", "trace", "vm", ] @@ -1799,7 +1799,7 @@ dependencies = [ "pod", "spec", "state-db", - "tempdir", + "tempfile", "trace", "trie-db", "trie-vm-factories", @@ -2808,7 +2808,7 @@ dependencies = [ "rlp", "spec", "state-db", - "tempdir", + "tempfile", "trace", "trie-vm-factories", "vm", @@ -2891,7 +2891,7 @@ dependencies = [ "kvdb-rocksdb 0.6.0", "log", "maplit", - "tempdir", + "tempfile", ] [[package]] @@ -3031,7 +3031,7 @@ dependencies = [ "lru-cache", "parking_lot 0.10.0", "spec", - "tempdir", + "tempfile", ] [[package]] @@ -3239,7 +3239,7 @@ dependencies = [ "serde_json", "snapshot", "spec", - "tempdir", + "tempfile", "term_size", "textwrap 0.9.0", "toml", @@ -3434,7 +3434,7 @@ dependencies = [ "snapshot", "spec", "stats", - "tempdir", + "tempfile", "tiny-keccak 1.5.0", "tokio-timer 0.1.2", "trace", @@ -3582,7 +3582,7 @@ dependencies = [ "rand 0.7.3", "semver", "target_info", - "tempdir", + "tempfile", ] [[package]] @@ -4690,7 +4690,7 @@ dependencies = [ "snapshot-tests", "spec", "state-db", - "tempdir", + "tempfile", "trie-db", "trie-standardmap", "triehash-ethereum", @@ -4733,7 +4733,7 @@ dependencies = [ "rlp", "snapshot", "spec", - "tempdir", + "tempfile", "trie-db", "trie-standardmap", "triehash-ethereum", @@ -4782,7 +4782,7 @@ dependencies = [ "parity-bytes", "pod", "rlp", - "tempdir", + "tempfile", "trace", "trie-vm-factories", "vm", @@ -4918,13 +4918,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" [[package]] -name = "tempdir" -version = "0.3.7" +name = "tempfile" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "rand 0.4.6", + "cfg-if", + "libc", + "rand 0.7.3", + "redox_syscall", "remove_dir_all", + "winapi 0.3.8", ] [[package]] @@ -5627,7 +5631,7 @@ dependencies = [ "parking_lot 0.10.0", "rlp", "spec", - "tempdir", + "tempfile", "time-utils", "triehash-ethereum", "unexpected", diff --git a/Cargo.toml b/Cargo.toml index b2f6f02ef..258ab7ae3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,7 +86,7 @@ rustc_version = "0.2" [dev-dependencies] pretty_assertions = "0.1" ipnetwork = "0.12.6" -tempdir = "0.3" +tempfile = "3.1" fake-fetch = { path = "util/fake-fetch" } [target.'cfg(windows)'.dependencies] diff --git a/accounts/Cargo.toml b/accounts/Cargo.toml index e0fdb5f3c..251f22e7c 100644 --- a/accounts/Cargo.toml +++ b/accounts/Cargo.toml @@ -18,4 +18,4 @@ serde_json = "1.0" [dev-dependencies] ethereum-types = "0.8.0" -tempdir = "0.3" +tempfile = "3.1" diff --git a/accounts/ethstore/Cargo.toml b/accounts/ethstore/Cargo.toml index 1635d6751..1c85028bb 100644 --- a/accounts/ethstore/Cargo.toml +++ b/accounts/ethstore/Cargo.toml @@ -22,7 +22,7 @@ ethereum-types = "0.8.0" dir = { path = "../../util/dir" } smallvec = "1.2.0" parity-wordlist = "1.3.1" -tempdir = "0.3" +tempfile = "3.1" [dev-dependencies] matches = "0.1" diff --git a/accounts/ethstore/cli/Cargo.toml b/accounts/ethstore/cli/Cargo.toml index bc8623392..561535ff3 100644 --- a/accounts/ethstore/cli/Cargo.toml +++ b/accounts/ethstore/cli/Cargo.toml @@ -24,4 +24,4 @@ path = "src/main.rs" doc = false [dev-dependencies] -tempdir = "0.3" +tempfile = "3.1" diff --git a/accounts/ethstore/cli/tests/cli.rs b/accounts/ethstore/cli/tests/cli.rs index 183a0987b..b30b1b4e4 100644 --- a/accounts/ethstore/cli/tests/cli.rs +++ b/accounts/ethstore/cli/tests/cli.rs @@ -14,9 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Open Ethereum. If not, see . -extern crate tempdir; +extern crate tempfile; use std::process::Command; -use tempdir::TempDir; +use tempfile::Builder; use std::fs::File; use std::io::Write; @@ -37,7 +37,7 @@ fn cli_cmd() { .output() .unwrap(); - let dir = TempDir::new("test-vault").unwrap(); + let dir = Builder::new().prefix("test-vault").tempdir().unwrap(); let mut passwd = File::create(dir.path().join("test-password")).unwrap(); writeln!(passwd, "password").unwrap(); diff --git a/accounts/ethstore/src/accounts_dir/disk.rs b/accounts/ethstore/src/accounts_dir/disk.rs index 71abdb049..c9354d38b 100644 --- a/accounts/ethstore/src/accounts_dir/disk.rs +++ b/accounts/ethstore/src/accounts_dir/disk.rs @@ -351,13 +351,13 @@ fn account_filename(account: &SafeAccount) -> String { #[cfg(test)] mod test { - extern crate tempdir; + extern crate tempfile; use std::{env, fs}; use super::{KeyDirectory, RootDiskDirectory, VaultKey}; use account::SafeAccount; use crypto::publickey::{Random, Generator}; - use self::tempdir::TempDir; + use self::tempfile::TempDir; #[test] fn should_create_new_account() { @@ -448,7 +448,7 @@ mod test { #[test] fn should_list_vaults() { // given - let temp_path = TempDir::new("").unwrap(); + let temp_path = TempDir::new().unwrap(); let directory = RootDiskDirectory::create(&temp_path).unwrap(); let vault_provider = directory.as_vault_provider().unwrap(); vault_provider.create("vault1", VaultKey::new(&"password1".into(), 1)).unwrap(); @@ -463,7 +463,7 @@ mod test { #[test] fn hash_of_files() { - let temp_path = TempDir::new("").unwrap(); + let temp_path = TempDir::new().unwrap(); let directory = RootDiskDirectory::create(&temp_path).unwrap(); let hash = directory.files_hash().expect("Files hash should be calculated ok"); diff --git a/accounts/ethstore/src/accounts_dir/vault.rs b/accounts/ethstore/src/accounts_dir/vault.rs index cb8c83cb5..abe4bfc94 100644 --- a/accounts/ethstore/src/accounts_dir/vault.rs +++ b/accounts/ethstore/src/accounts_dir/vault.rs @@ -278,14 +278,14 @@ fn read_vault_file

(vault_dir_path: P, key: Option<&VaultKey>) -> Result KeyPair { @@ -716,7 +716,7 @@ mod tests { impl RootDiskDirectoryGuard { pub fn new() -> Self { - let temp_path = TempDir::new("").unwrap(); + let temp_path = TempDir::new().unwrap(); let disk_dir = Box::new(RootDiskDirectory::create(temp_path.path()).unwrap()); RootDiskDirectoryGuard { diff --git a/accounts/ethstore/src/lib.rs b/accounts/ethstore/src/lib.rs index 16ea91260..f97306dec 100644 --- a/accounts/ethstore/src/lib.rs +++ b/accounts/ethstore/src/lib.rs @@ -28,7 +28,7 @@ extern crate serde_json; extern crate smallvec; extern crate time; extern crate tiny_keccak; -extern crate tempdir; +extern crate tempfile; extern crate parity_crypto as crypto; extern crate ethereum_types; diff --git a/accounts/src/stores.rs b/accounts/src/stores.rs index d460b2cc3..728067797 100644 --- a/accounts/src/stores.rs +++ b/accounts/src/stores.rs @@ -155,12 +155,12 @@ impl DiskMap { mod tests { use super::{AddressBook, Address}; use std::collections::HashMap; - use tempdir::TempDir; + use tempfile::TempDir; use crate::account_data::AccountMeta; #[test] fn should_save_and_reload_address_book() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let mut b = AddressBook::new(tempdir.path()); b.set_name(Address::from_low_u64_be(1), "One".to_owned()); b.set_meta(Address::from_low_u64_be(1), "{1:1}".to_owned()); @@ -172,7 +172,7 @@ mod tests { #[test] fn should_remove_address() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let mut b = AddressBook::new(tempdir.path()); b.set_name(Address::from_low_u64_be(1), "One".to_owned()); diff --git a/ethash/Cargo.toml b/ethash/Cargo.toml index 617883f67..3f586d1fd 100644 --- a/ethash/Cargo.toml +++ b/ethash/Cargo.toml @@ -20,7 +20,7 @@ criterion = "0.3" hex-literal = "0.2.1" rustc-hex = "2.1.0" serde_json = "1.0" -tempdir = "0.3" +tempfile = "3.1" [features] default = [] diff --git a/ethash/benches/progpow.rs b/ethash/benches/progpow.rs index ff2b2b409..f972da903 100644 --- a/ethash/benches/progpow.rs +++ b/ethash/benches/progpow.rs @@ -22,19 +22,19 @@ extern crate hex_literal; extern crate common_types; extern crate ethash; -extern crate tempdir; +extern crate tempfile; use criterion::Criterion; use ethash::progpow; -use tempdir::TempDir; +use tempfile::TempDir; use ethash::NodeCacheBuilder; use ethash::compute::light_compute; use common_types::engines::OptimizeFor; fn bench_hashimoto_light(c: &mut Criterion) { let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let light = builder.light(&tempdir.path(), 1); let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f"); let mut hash = [0; 32]; @@ -47,7 +47,7 @@ fn bench_hashimoto_light(c: &mut Criterion) { fn bench_progpow_light(c: &mut Criterion) { let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let cache = builder.new_cache(tempdir.into_path(), 0); let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f"); @@ -70,7 +70,7 @@ fn bench_progpow_light(c: &mut Criterion) { fn bench_progpow_optimal_light(c: &mut Criterion) { let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let cache = builder.new_cache(tempdir.into_path(), 0); let c_dag = progpow::generate_cdag(cache.as_ref()); diff --git a/ethash/src/compute.rs b/ethash/src/compute.rs index 454a7f369..8dc5a5295 100644 --- a/ethash/src/compute.rs +++ b/ethash/src/compute.rs @@ -329,7 +329,7 @@ pub fn calculate_dag_item(node_index: u32, cache: &[Node]) -> Node { mod test { use super::*; use std::fs; - use tempdir::TempDir; + use tempfile::TempDir; #[test] fn test_get_cache_size() { @@ -402,7 +402,7 @@ mod test { ]; let nonce = 0xd7b3ac70a301a249; - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); // difficulty = 0x085657254bd9u64; let light = NodeCacheBuilder::new(None, u64::max_value()).light(tempdir.path(), 486382); let result = light_compute(&light, &hash, nonce); @@ -412,7 +412,7 @@ mod test { #[test] fn test_drop_old_data() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let builder = NodeCacheBuilder::new(None, u64::max_value()); let first = builder.light(tempdir.path(), 0).to_file().unwrap().to_owned(); diff --git a/ethash/src/lib.rs b/ethash/src/lib.rs index 9ce356a90..953fa3b7a 100644 --- a/ethash/src/lib.rs +++ b/ethash/src/lib.rs @@ -37,7 +37,7 @@ extern crate rustc_hex; extern crate serde_json; #[cfg(test)] -extern crate tempdir; +extern crate tempfile; #[cfg(feature = "bench")] @@ -196,9 +196,9 @@ fn difficulty_to_boundary_aux>(difficulty: T) -> ethereum_types::U #[test] fn test_lru() { - use tempdir::TempDir; + use tempfile::TempDir; - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let ethash = EthashManager::new(tempdir.path(), None, u64::max_value()); let hash = [0u8; 32]; ethash.compute_light(1, &hash, 1); diff --git a/ethash/src/progpow.rs b/ethash/src/progpow.rs index ae64d3e16..ca30cf8fe 100644 --- a/ethash/src/progpow.rs +++ b/ethash/src/progpow.rs @@ -420,7 +420,7 @@ pub fn generate_cdag(cache: &[Node]) -> CDag { #[cfg(test)] mod test { - use tempdir::TempDir; + use tempfile::TempDir; use common_types::engines::OptimizeFor; use cache::NodeCacheBuilder; @@ -440,7 +440,7 @@ mod test { #[test] fn test_cdag() { let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let cache = builder.new_cache(tempdir.into_path(), 0); let c_dag = generate_cdag(cache.as_ref()); @@ -535,7 +535,7 @@ mod test { #[test] fn test_progpow_hash() { let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let cache = builder.new_cache(tempdir.into_path(), 0); let c_dag = generate_cdag(cache.as_ref()); @@ -596,7 +596,7 @@ mod test { for test in tests { let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let cache = builder.new_cache(tempdir.path().to_owned(), test.block_number); let c_dag = generate_cdag(cache.as_ref()); diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 16ec5090e..6f5b07f7d 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -56,7 +56,7 @@ serde_derive = "1.0" snapshot = { path = "snapshot" } spec = { path = "spec" } state-db = { path = "state-db" } -tempdir = { version = "0.3", optional = true } +tempfile = { version = "3.1", optional = true } trace = { path = "trace" } trace-time = "0.1" trie-vm-factories = { path = "trie-vm-factories" } @@ -85,7 +85,7 @@ parity-runtime = "0.1.1" serde_json = "1.0" stats = { path = "../util/stats" } pod = { path = "pod" } -tempdir = "0.3" +tempfile = "3.1" trie-standardmap = "0.15.0" [features] @@ -126,7 +126,7 @@ test-helpers = [ "kvdb-memorydb", "kvdb-rocksdb", "pod", - "tempdir", + "tempfile", "basic-authority/test-helpers" ] diff --git a/ethcore/blockchain/Cargo.toml b/ethcore/blockchain/Cargo.toml index 3612d30b6..55473326d 100644 --- a/ethcore/blockchain/Cargo.toml +++ b/ethcore/blockchain/Cargo.toml @@ -31,5 +31,5 @@ triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" } env_logger = "0.5" parity-crypto = { version = "0.5.0", features = ["publickey"] } rustc-hex = "2.1.0" -tempdir = "0.3" +tempfile = "3.1" kvdb-memorydb = "0.4.0" diff --git a/ethcore/blockchain/src/blockchain.rs b/ethcore/blockchain/src/blockchain.rs index 437059976..96a1d73e6 100644 --- a/ethcore/blockchain/src/blockchain.rs +++ b/ethcore/blockchain/src/blockchain.rs @@ -1629,7 +1629,7 @@ mod tests { use parity_crypto::publickey::Secret; use keccak_hash::keccak; use rustc_hex::FromHex; - use tempdir::TempDir; + use tempfile::TempDir; use std::str::FromStr; struct TestBlockChainDB { @@ -1656,8 +1656,8 @@ mod tests { /// Creates new test instance of `BlockChainDB` pub fn new_db() -> Arc { - let blooms_dir = TempDir::new("").unwrap(); - let trace_blooms_dir = TempDir::new("").unwrap(); + let blooms_dir = TempDir::new().unwrap(); + let trace_blooms_dir = TempDir::new().unwrap(); let db = TestBlockChainDB { blooms: blooms_db::Database::open(blooms_dir.path()).unwrap(), diff --git a/ethcore/engines/basic-authority/Cargo.toml b/ethcore/engines/basic-authority/Cargo.toml index 7ba7280be..b536e0179 100644 --- a/ethcore/engines/basic-authority/Cargo.toml +++ b/ethcore/engines/basic-authority/Cargo.toml @@ -24,7 +24,7 @@ accounts = { package = "ethcore-accounts", path = "../../../accounts" } engine = { path = "../../engine", features = ["test-helpers"] } ethcore = { path = "../..", features = ["test-helpers"] } keccak-hash = "0.4.0" -tempdir = "0.3" +tempfile = "3.1" spec = { path = "../../spec" } [features] diff --git a/ethcore/engines/basic-authority/src/lib.rs b/ethcore/engines/basic-authority/src/lib.rs index cefd51d08..870227ca3 100644 --- a/ethcore/engines/basic-authority/src/lib.rs +++ b/ethcore/engines/basic-authority/src/lib.rs @@ -230,12 +230,12 @@ mod tests { header::Header, engines::{Seal, SealingState} }; - use tempdir::TempDir; + use tempfile::TempDir; /// Create a new test chain spec with `BasicAuthority` consensus engine. fn new_test_authority() -> Spec { let bytes: &[u8] = include_bytes!("../res/basic_authority.json"); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); Spec::load(&tempdir.path(), bytes).expect("invalid chain spec") } diff --git a/ethcore/engines/ethash/Cargo.toml b/ethcore/engines/ethash/Cargo.toml index 3afc1c951..4708f2139 100644 --- a/ethcore/engines/ethash/Cargo.toml +++ b/ethcore/engines/ethash/Cargo.toml @@ -23,4 +23,4 @@ ethcore = { path = "../..", features = ["test-helpers"] } keccak-hash = "0.4.0" rlp = "0.4.2" spec = { path = "../../spec" } -tempdir = "0.3" +tempfile = "3.1" diff --git a/ethcore/engines/ethash/src/lib.rs b/ethcore/engines/ethash/src/lib.rs index 5f3a628e6..13404d35f 100644 --- a/ethcore/engines/ethash/src/lib.rs +++ b/ethcore/engines/ethash/src/lib.rs @@ -525,12 +525,12 @@ mod tests { }; use rlp; use spec::{new_ropsten, new_mcip3_test, new_homestead_test_machine, Spec}; - use tempdir::TempDir; + use tempfile::TempDir; use super::{Ethash, EthashParams, ecip1017_eras_block_reward}; fn test_spec() -> Spec { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); new_ropsten(&tempdir.path()) } @@ -799,7 +799,7 @@ mod tests { fn difficulty_frontier() { let machine = new_homestead_test_machine(); let ethparams = get_default_ethash_params(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let ethash = Ethash::new(tempdir.path(), ethparams, machine, None); let mut parent_header = Header::default(); @@ -818,7 +818,7 @@ mod tests { fn difficulty_homestead() { let machine = new_homestead_test_machine(); let ethparams = get_default_ethash_params(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let ethash = Ethash::new(tempdir.path(), ethparams, machine, None); let mut parent_header = Header::default(); @@ -840,7 +840,7 @@ mod tests { ecip1010_pause_transition: 3000000, ..get_default_ethash_params() }; - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let ethash = Ethash::new(tempdir.path(), ethparams, machine, None); let mut parent_header = Header::default(); @@ -875,7 +875,7 @@ mod tests { ecip1010_continue_transition: 5000000, ..get_default_ethash_params() }; - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let ethash = Ethash::new(tempdir.path(), ethparams, machine, None); let mut parent_header = Header::default(); @@ -922,7 +922,7 @@ mod tests { fn difficulty_max_timestamp() { let machine = new_homestead_test_machine(); let ethparams = get_default_ethash_params(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let ethash = Ethash::new(tempdir.path(), ethparams, machine, None); let mut parent_header = Header::default(); @@ -941,7 +941,7 @@ mod tests { fn test_extra_info() { let machine = new_homestead_test_machine(); let ethparams = get_default_ethash_params(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let ethash = Ethash::new(tempdir.path(), ethparams, machine, None); let mut header = Header::default(); header.set_seal(vec![rlp::encode(&H256::from_str("b251bd2e0283d0658f2cadfdc8ca619b5de94eca5742725e2e757dd13ed7503d").unwrap()), rlp::encode(&H64::zero())]); diff --git a/ethcore/executive-state/Cargo.toml b/ethcore/executive-state/Cargo.toml index 9c8006402..a00b3fb5d 100644 --- a/ethcore/executive-state/Cargo.toml +++ b/ethcore/executive-state/Cargo.toml @@ -41,4 +41,4 @@ criterion = "0.3.1" ethcore-db = { path = "../db" } journaldb = { path = "../../util/journaldb" } state-db = { path = "../state-db" } -tempdir = "0.3.7" +tempfile = "3.1" diff --git a/ethcore/executive-state/benches/execution.rs b/ethcore/executive-state/benches/execution.rs index 2386c7d76..d33df4b62 100644 --- a/ethcore/executive-state/benches/execution.rs +++ b/ethcore/executive-state/benches/execution.rs @@ -35,10 +35,10 @@ use ethereum_types::U256; use executive_state::ExecutiveState; use spec::{new_constantinople_test_machine, new_istanbul_test_machine}; use state_db::StateDB; -use tempdir::TempDir; +use tempfile::Builder; fn build_state() -> State { - let db_path = TempDir::new("execution-bench").unwrap(); + let db_path = Builder::new().prefix("execution-bench").tempdir().unwrap(); let db = new_temp_db(&db_path.path()); let journal_db = journaldb::new(db.key_value().clone(), journaldb::Algorithm::OverlayRecent, db::COL_STATE); let state_db = StateDB::new(journal_db, 25 * 1024 * 1024); diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml index 115f0c5b4..3f225cc37 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -51,7 +51,7 @@ verification = { path = "../verification" } [dev-dependencies] ethcore = { path = "..", features = ["test-helpers"] } kvdb-memorydb = "0.4.0" -tempdir = "0.3" +tempfile = "3.1" [features] default = [] diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 75ed983d1..cc4cc12b6 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -98,5 +98,5 @@ extern crate ethcore; #[cfg(test)] extern crate kvdb_memorydb; #[cfg(test)] -extern crate tempdir; +extern crate tempfile; extern crate journaldb; diff --git a/ethcore/light/src/net/load_timer.rs b/ethcore/light/src/net/load_timer.rs index 3fda7b8d3..f40f68b14 100644 --- a/ethcore/light/src/net/load_timer.rs +++ b/ethcore/light/src/net/load_timer.rs @@ -264,7 +264,7 @@ mod tests { #[test] fn file_store() { - let tempdir = ::tempdir::TempDir::new("").unwrap(); + let tempdir = ::tempfile::TempDir::new().unwrap(); let path = tempdir.path().join("file"); let store = FileStore(path); diff --git a/ethcore/machine/Cargo.toml b/ethcore/machine/Cargo.toml index ba2d62d40..9fb850c93 100644 --- a/ethcore/machine/Cargo.toml +++ b/ethcore/machine/Cargo.toml @@ -46,7 +46,7 @@ ethjson = { path = "../../json" } parity-crypto = { version = "0.5.0", features = ["publickey"] } hex-literal = "0.2.1" spec = { path = "../spec" } -tempdir = "0.3" +tempfile = "3.1" trace = { path = "../trace" } [features] diff --git a/ethcore/machine/src/tx_filter.rs b/ethcore/machine/src/tx_filter.rs index 3d3caff61..5293497aa 100644 --- a/ethcore/machine/src/tx_filter.rs +++ b/ethcore/machine/src/tx_filter.rs @@ -165,7 +165,7 @@ mod test { use std::sync::Arc; use std::str::FromStr; - use tempdir::TempDir; + use tempfile::TempDir; use ethereum_types::{U256, Address}; use client_traits::BlockChainClient; @@ -190,7 +190,7 @@ mod test { let spec_data = include_str!("../../res/tx_permission_tests/contract_ver_2_genesis.json"); let db = test_helpers::new_db(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let spec = Spec::load(&tempdir.path(), spec_data.as_bytes()).unwrap(); let client = Client::new( @@ -269,7 +269,7 @@ mod test { let spec_data = include_str!("../../res/tx_permission_tests/contract_ver_3_genesis.json"); let db = test_helpers::new_db(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let spec = Spec::load(&tempdir.path(), spec_data.as_bytes()).unwrap(); let client = Client::new( @@ -311,7 +311,7 @@ mod test { let spec_data = include_str!("../../res/tx_permission_tests/deprecated_contract_genesis.json"); let db = test_helpers::new_db(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let spec = Spec::load(&tempdir.path(), spec_data.as_bytes()).unwrap(); let client = Client::new( diff --git a/ethcore/node-filter/Cargo.toml b/ethcore/node-filter/Cargo.toml index c4e422b94..4cef9d6ff 100644 --- a/ethcore/node-filter/Cargo.toml +++ b/ethcore/node-filter/Cargo.toml @@ -25,4 +25,4 @@ ethcore = { path = "..", features = ["test-helpers"] } kvdb-memorydb = "0.4.0" ethcore-io = { path = "../../util/io" } spec = { path = "../spec" } -tempdir = "0.3" +tempfile = "3.1" diff --git a/ethcore/node-filter/src/lib.rs b/ethcore/node-filter/src/lib.rs index 6ecd35431..ac363f937 100644 --- a/ethcore/node-filter/src/lib.rs +++ b/ethcore/node-filter/src/lib.rs @@ -33,7 +33,7 @@ extern crate ethcore_io as io; #[cfg(test)] extern crate kvdb_memorydb; #[cfg(test)] -extern crate tempdir; +extern crate tempfile; #[cfg(test)] extern crate spec; #[macro_use] @@ -141,7 +141,7 @@ mod test { use network::{ConnectionDirection, ConnectionFilter, NodeId}; use io::IoChannel; use super::NodeFilter; - use tempdir::TempDir; + use tempfile::TempDir; use ethereum_types::Address; use std::str::FromStr; @@ -150,7 +150,7 @@ mod test { fn node_filter() { let contract_addr = Address::from_str("0000000000000000000000000000000000000005").unwrap(); let data = include_bytes!("../res/node_filter.json"); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let spec = Spec::load(&tempdir.path(), &data[..]).unwrap(); let client_db = test_helpers::new_db(); diff --git a/ethcore/service/Cargo.toml b/ethcore/service/Cargo.toml index 2fbf59e9a..530a3be56 100644 --- a/ethcore/service/Cargo.toml +++ b/ethcore/service/Cargo.toml @@ -24,4 +24,4 @@ trace-time = "0.1" ethcore = { path = "..", features = ["test-helpers"] } ethcore-db = { path = "../db" } kvdb-rocksdb = "0.6.0" -tempdir = "0.3" +tempfile = "3.1" diff --git a/ethcore/service/src/lib.rs b/ethcore/service/src/lib.rs index e700f4092..90300ceee 100644 --- a/ethcore/service/src/lib.rs +++ b/ethcore/service/src/lib.rs @@ -35,7 +35,7 @@ extern crate trace_time; #[cfg(test)] extern crate ethcore_db; #[cfg(test)] -extern crate tempdir; +extern crate tempfile; mod service; diff --git a/ethcore/service/src/service.rs b/ethcore/service/src/service.rs index eaed9aa5d..0be68fdba 100644 --- a/ethcore/service/src/service.rs +++ b/ethcore/service/src/service.rs @@ -297,7 +297,7 @@ mod tests { use std::sync::Arc; use std::{time, thread}; - use tempdir::TempDir; + use tempfile::TempDir; use ethcore_db::NUM_COLUMNS; use ethcore::client::ClientConfig; @@ -311,7 +311,7 @@ mod tests { #[test] fn it_can_be_started() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let client_path = tempdir.path().join("client"); let snapshot_path = tempdir.path().join("snapshot"); diff --git a/ethcore/snapshot/Cargo.toml b/ethcore/snapshot/Cargo.toml index c9ac9e045..9f8533ef4 100644 --- a/ethcore/snapshot/Cargo.toml +++ b/ethcore/snapshot/Cargo.toml @@ -56,7 +56,7 @@ ethkey = { path = "../../accounts/ethkey" } kvdb-rocksdb = "0.6.0" lazy_static = { version = "1.3" } spec = { path = "../spec" } -tempdir = "0.3" +tempfile = "3.1" trie-standardmap = "0.15.0" # Note[dvdplm]: Ensure the snapshot tests are included in the dependency tree, which in turn means that # `cargo test --all` runs the tests. diff --git a/ethcore/snapshot/benches/to_fat_rlps.rs b/ethcore/snapshot/benches/to_fat_rlps.rs index 1c5de444e..40c7ff62b 100644 --- a/ethcore/snapshot/benches/to_fat_rlps.rs +++ b/ethcore/snapshot/benches/to_fat_rlps.rs @@ -28,12 +28,12 @@ use ethcore::test_helpers::new_temp_db; use ethereum_types::H256; use parking_lot::RwLock; use snapshot::test_helpers::to_fat_rlps; -use tempdir::TempDir; +use tempfile::TempDir; use ethtrie::TrieDB; use trie_db::Trie; fn fat_rlps(c: &mut Criterion) { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let blockchain_db = new_temp_db(tempdir.path()); let mut state_rebuilder = snapshot::StateRebuilder::new(blockchain_db.key_value().clone(), journaldb::Algorithm::OverlayRecent); diff --git a/ethcore/snapshot/snapshot-tests/Cargo.toml b/ethcore/snapshot/snapshot-tests/Cargo.toml index 56be57d43..81a0674e3 100644 --- a/ethcore/snapshot/snapshot-tests/Cargo.toml +++ b/ethcore/snapshot/snapshot-tests/Cargo.toml @@ -34,7 +34,7 @@ rlp = "0.4.2" snappy = { package = "parity-snappy", version ="0.1.0" } snapshot = { path = "../../snapshot", features = ["test-helpers"] } spec = { path = "../../spec" } -tempdir = "0.3" +tempfile = "3.1" trie-db = "0.20.0" trie-standardmap = "0.15.0" ethabi = "9.0.1" diff --git a/ethcore/snapshot/snapshot-tests/src/helpers.rs b/ethcore/snapshot/snapshot-tests/src/helpers.rs index 02593f79a..cdeebe15c 100644 --- a/ethcore/snapshot/snapshot-tests/src/helpers.rs +++ b/ethcore/snapshot/snapshot-tests/src/helpers.rs @@ -49,7 +49,7 @@ use snapshot::{ io::{SnapshotReader, PackedWriter, PackedReader}, chunker, }; -use tempdir::TempDir; +use tempfile::TempDir; use trie_db::{TrieMut, Trie}; use trie_standardmap::{Alphabet, StandardMap, ValueMode}; @@ -144,7 +144,7 @@ pub fn fill_storage(mut db: AccountDBMut, root: &mut H256, seed: &mut H256) { /// Take a snapshot from the given client into a temporary file. /// Return a snapshot reader for it. pub fn snap(client: &Client) -> (Box, TempDir) { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let path = tempdir.path().join("file"); let writer = PackedWriter::new(&path).unwrap(); let progress = RwLock::new(Progress::new()); diff --git a/ethcore/snapshot/snapshot-tests/src/io.rs b/ethcore/snapshot/snapshot-tests/src/io.rs index d1a2707a9..3058a42be 100644 --- a/ethcore/snapshot/snapshot-tests/src/io.rs +++ b/ethcore/snapshot/snapshot-tests/src/io.rs @@ -16,7 +16,7 @@ //! Tests for snapshot i/o. -use tempdir::TempDir; +use tempfile::TempDir; use keccak_hash::keccak; use common_types::snapshot::ManifestData; @@ -31,7 +31,7 @@ const BLOCK_CHUNKS: &'static [&'static [u8]] = &[b"hello!", b"goodbye!", b"abcde #[test] fn packed_write_and_read() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let path = tempdir.path().join("packed"); let mut writer = PackedWriter::new(&path).unwrap(); @@ -71,7 +71,7 @@ fn packed_write_and_read() { #[test] fn loose_write_and_read() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let mut writer = LooseWriter::new(tempdir.path().into()).unwrap(); let mut state_hashes = Vec::new(); diff --git a/ethcore/snapshot/snapshot-tests/src/proof_of_authority.rs b/ethcore/snapshot/snapshot-tests/src/proof_of_authority.rs index 696398c53..697727f41 100644 --- a/ethcore/snapshot/snapshot-tests/src/proof_of_authority.rs +++ b/ethcore/snapshot/snapshot-tests/src/proof_of_authority.rs @@ -35,7 +35,7 @@ use keccak_hash::keccak; use lazy_static::lazy_static; use log::trace; use spec::Spec; -use tempdir::TempDir; +use tempfile::TempDir; use crate::helpers as snapshot_helpers; @@ -66,7 +66,7 @@ lazy_static! { /// `test_validator_set::ValidatorSet` provides a native wrapper for the ABi. fn spec_fixed_to_contract() -> Spec { let data = include_bytes!("test_validator_contract.json"); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); Spec::load(&tempdir.path(), &data[..]).unwrap() } diff --git a/ethcore/snapshot/snapshot-tests/src/proof_of_work.rs b/ethcore/snapshot/snapshot-tests/src/proof_of_work.rs index d89003e64..b322064d1 100644 --- a/ethcore/snapshot/snapshot-tests/src/proof_of_work.rs +++ b/ethcore/snapshot/snapshot-tests/src/proof_of_work.rs @@ -17,7 +17,7 @@ //! PoW block chunker and rebuilder tests. use std::sync::atomic::AtomicBool; -use tempdir::TempDir; +use tempfile::TempDir; use common_types::{ errors::{EthcoreError as Error, SnapshotError}, engines::ForkChoice, @@ -47,7 +47,7 @@ fn chunk_and_restore(amount: u64) { let genesis = genesis.last(); let engine = spec::new_test().engine; - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let snapshot_path = tempdir.path().join("SNAP"); let old_db = test_helpers::new_db(); diff --git a/ethcore/snapshot/snapshot-tests/src/service.rs b/ethcore/snapshot/snapshot-tests/src/service.rs index 21ec09375..ba8878ba5 100644 --- a/ethcore/snapshot/snapshot-tests/src/service.rs +++ b/ethcore/snapshot/snapshot-tests/src/service.rs @@ -19,7 +19,7 @@ use std::fs; use std::sync::Arc; -use tempdir::TempDir; +use tempfile::TempDir; use blockchain::BlockProvider; use ethcore::client::{Client, ClientConfig}; use client_traits::{BlockInfo, ImportBlock}; @@ -54,7 +54,7 @@ fn sends_async_messages() { let service = IoService::>::start().unwrap(); let spec = spec::new_test(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let dir = tempdir.path().join("snapshot"); let snapshot_params = ServiceParams { @@ -94,7 +94,7 @@ fn cannot_finish_with_invalid_chunks() { use kvdb_rocksdb::DatabaseConfig; let spec = spec::new_test(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let state_hashes: Vec<_> = (0..5).map(|_| H256::random()).collect(); let block_hashes: Vec<_> = (0..5).map(|_| H256::random()).collect(); @@ -145,7 +145,7 @@ fn restored_is_equivalent() { let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()]; let client = generate_dummy_client_with_spec_and_data(spec::new_null, NUM_BLOCKS, TX_PER, &gas_prices, false); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let client_db = tempdir.path().join("client_db"); let path = tempdir.path().join("snapshot"); @@ -210,7 +210,7 @@ fn guards_delete_folders() { let client = generate_dummy_client_with_spec_and_data(spec::new_null, 400, 5, &gas_prices, false); let spec = spec::new_null(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let service_params = ServiceParams { engine: spec.engine.clone(), genesis_block: spec.genesis_block(), @@ -259,7 +259,7 @@ fn keep_ancient_blocks() { const SNAPSHOT_MODE: PowSnapshot = PowSnapshot { blocks: NUM_SNAPSHOT_BLOCKS, max_restore_blocks: NUM_SNAPSHOT_BLOCKS }; // Temporary folders - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let snapshot_path = tempdir.path().join("SNAP"); // Generate blocks @@ -377,7 +377,7 @@ fn recover_aborted_recovery() { let client = generate_dummy_client_with_spec_and_data(spec::new_null, NUM_BLOCKS, 5, &gas_prices, false); let spec = spec::new_null(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_config = DatabaseConfig::with_columns(ethcore_db::NUM_COLUMNS); let client_db = new_db(); let client2 = Client::new( diff --git a/ethcore/snapshot/snapshot-tests/src/state.rs b/ethcore/snapshot/snapshot-tests/src/state.rs index e684eb4ec..083e096c5 100644 --- a/ethcore/snapshot/snapshot-tests/src/state.rs +++ b/ethcore/snapshot/snapshot-tests/src/state.rs @@ -36,7 +36,7 @@ use ethereum_types::H256; use journaldb::{self, Algorithm}; use kvdb_rocksdb::{Database, DatabaseConfig}; use parking_lot::{Mutex, RwLock}; -use tempdir::TempDir; +use tempfile::TempDir; use crate::helpers::StateProducer; @@ -54,7 +54,7 @@ fn snap_and_restore() { producer.tick(&mut rng, &mut old_db); } - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let snap_file = tempdir.path().join("SNAP"); let state_root = producer.state_root(); @@ -152,7 +152,7 @@ fn get_code_from_prev_chunk() { let chunk1 = make_chunk(acc.clone(), h1); let chunk2 = make_chunk(acc, h2); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_cfg = DatabaseConfig::with_columns(ethcore_db::NUM_COLUMNS); let new_db = Arc::new(Database::open(&db_cfg, tempdir.path().to_str().unwrap()).unwrap()); @@ -181,7 +181,7 @@ fn checks_flag() { producer.tick(&mut rng, &mut old_db); } - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let snap_file = tempdir.path().join("SNAP"); let state_root = producer.state_root(); @@ -199,7 +199,7 @@ fn checks_flag() { block_hash: H256::zero(), }).unwrap(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = tempdir.path().join("db"); { let new_db = Arc::new(Database::open(&db_cfg, &db_path.to_string_lossy()).unwrap()); diff --git a/ethcore/spec/Cargo.toml b/ethcore/spec/Cargo.toml index ef8158245..1c17d0cc0 100644 --- a/ethcore/spec/Cargo.toml +++ b/ethcore/spec/Cargo.toml @@ -39,4 +39,4 @@ vm = { path = "../vm" } [dev-dependencies] ethcore = { path = "..", features = ["test-helpers"] } env_logger = "0.5" -tempdir = "0.3.7" +tempfile = "3.1" diff --git a/ethcore/spec/src/chain.rs b/ethcore/spec/src/chain.rs index 471067003..1a34d3911 100644 --- a/ethcore/spec/src/chain.rs +++ b/ethcore/spec/src/chain.rs @@ -129,14 +129,14 @@ mod tests { use account_state::State; use common_types::{view, views::BlockView}; use ethereum_types::U256; - use tempdir::TempDir; + use tempfile::TempDir; use ethcore::test_helpers::get_temp_state_db; use super::{new_ropsten, new_foundation}; #[test] fn ensure_db_good() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let spec = new_ropsten(&tempdir.path()); let engine = &spec.engine; let genesis_header = spec.genesis_header(); @@ -152,7 +152,7 @@ mod tests { #[test] fn ropsten() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let ropsten = new_ropsten(&tempdir.path()); assert_eq!(ropsten.state_root, "217b0bbcfb72e2d57e28f33cb361b9983513177755dc3f33ce3e7022ed62b77b".parse().unwrap()); @@ -162,7 +162,7 @@ mod tests { #[test] fn frontier() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let frontier = new_foundation(&tempdir.path()); assert_eq!(frontier.state_root, "d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544".parse().unwrap()); diff --git a/ethcore/spec/src/spec.rs b/ethcore/spec/src/spec.rs index 747c2c546..507082cb0 100644 --- a/ethcore/spec/src/spec.rs +++ b/ethcore/spec/src/spec.rs @@ -638,13 +638,13 @@ mod tests { use common_types::{view, views::BlockView}; use ethereum_types::{Address, H256}; use ethcore::test_helpers::get_temp_state_db; - use tempdir::TempDir; + use tempfile::TempDir; use super::Spec; #[test] fn test_load_empty() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); assert!(Spec::load(&tempdir.path(), &[] as &[u8]).is_err()); } diff --git a/ethcore/src/json_tests/difficulty.rs b/ethcore/src/json_tests/difficulty.rs index c372d4a2e..cf0c380b6 100644 --- a/ethcore/src/json_tests/difficulty.rs +++ b/ethcore/src/json_tests/difficulty.rs @@ -64,11 +64,11 @@ macro_rules! difficulty_json_test { use std::path::Path; use super::json_difficulty_test; - use tempdir::TempDir; + use tempfile::TempDir; use json_tests::HookType; fn do_json_test(path: &Path, json_data: &[u8], h: &mut H) -> Vec { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); json_difficulty_test(path, json_data, crate::spec::$spec(&tempdir.path()), h) } diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 5aa1f3e98..b21cd959b 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -90,7 +90,7 @@ extern crate env_logger; #[cfg(test)] extern crate serde_json; #[cfg(any(test, feature = "tempdir"))] -extern crate tempdir; +extern crate tempfile; #[macro_use] extern crate log; diff --git a/ethcore/src/test_helpers/mod.rs b/ethcore/src/test_helpers/mod.rs index 6d27f99a4..754c8f755 100644 --- a/ethcore/src/test_helpers/mod.rs +++ b/ethcore/src/test_helpers/mod.rs @@ -16,6 +16,8 @@ //! Set of different helpers for client tests +extern crate tempfile; + mod test_client; mod evm_test_client; @@ -44,7 +46,7 @@ use kvdb::KeyValueDB; use kvdb_rocksdb::{self, Database, DatabaseConfig}; use parking_lot::RwLock; use rlp::{self, RlpStream}; -use tempdir::TempDir; +use self::tempfile::TempDir; use types::{ chain_notify::ChainMessageType, transaction::{Action, Transaction, SignedTransaction}, @@ -305,8 +307,8 @@ impl BlockChainDB for TestBlockChainDB { /// Creates new test instance of `BlockChainDB` pub fn new_db() -> Arc { - let blooms_dir = TempDir::new("").unwrap(); - let trace_blooms_dir = TempDir::new("").unwrap(); + let blooms_dir = TempDir::new().unwrap(); + let trace_blooms_dir = TempDir::new().unwrap(); let db = TestBlockChainDB { blooms: blooms_db::Database::open(blooms_dir.path()).unwrap(), @@ -321,8 +323,8 @@ pub fn new_db() -> Arc { /// Creates a new temporary `BlockChainDB` on FS pub fn new_temp_db(tempdir: &Path) -> Arc { - let blooms_dir = TempDir::new("").unwrap(); - let trace_blooms_dir = TempDir::new("").unwrap(); + let blooms_dir = TempDir::new().unwrap(); + let trace_blooms_dir = TempDir::new().unwrap(); let key_value_dir = tempdir.join("key_value"); let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS); diff --git a/ethcore/src/tests/client.rs b/ethcore/src/tests/client.rs index 841571c97..8196833de 100644 --- a/ethcore/src/tests/client.rs +++ b/ethcore/src/tests/client.rs @@ -22,7 +22,7 @@ use ethereum_types::{U256, Address}; use parity_crypto::publickey::KeyPair; use hash::keccak; use io::IoChannel; -use tempdir::TempDir; +use tempfile::TempDir; use types::{ data_format::DataFormat, ids::BlockId, @@ -75,7 +75,7 @@ fn imports_from_empty() { #[test] fn should_return_registrar() { let db = test_helpers::new_db(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let spec = spec::new_ropsten(&tempdir.path().to_owned()); let client = Client::new( diff --git a/ethcore/verification/Cargo.toml b/ethcore/verification/Cargo.toml index 568afbc17..6ba652b4d 100644 --- a/ethcore/verification/Cargo.toml +++ b/ethcore/verification/Cargo.toml @@ -42,7 +42,7 @@ spec = { path = "../spec" } # Benches ethash = { package = "ethash-engine", path = "../engines/ethash" } -tempdir = "0.3.7" +tempfile = "3.1" [features] # Used to selectively expose code for benchmarks. diff --git a/ethcore/verification/benches/verification.rs b/ethcore/verification/benches/verification.rs index f5fdc580f..3d07ef5bf 100644 --- a/ethcore/verification/benches/verification.rs +++ b/ethcore/verification/benches/verification.rs @@ -24,7 +24,7 @@ use ethash::{EthashParams, Ethash}; use ethereum_types::U256; use ethcore::test_helpers::TestBlockChainClient; use spec::new_constantinople_test_machine; -use tempdir::TempDir; +use tempfile::TempDir; use ::verification::{ FullFamilyParams, @@ -72,7 +72,7 @@ fn ethash_params() -> EthashParams { fn build_ethash() -> Ethash { let machine = new_constantinople_test_machine(); let ethash_params = ethash_params(); - let cache_dir = TempDir::new("").unwrap(); + let cache_dir = TempDir::new().unwrap(); Ethash::new( cache_dir.path(), ethash_params, diff --git a/evmbin/Cargo.toml b/evmbin/Cargo.toml index 3f02601b8..f377cc817 100644 --- a/evmbin/Cargo.toml +++ b/evmbin/Cargo.toml @@ -31,7 +31,7 @@ vm = { path = "../ethcore/vm" } [dev-dependencies] criterion = "0.3" hex-literal = "0.2.1" -tempdir = "0.3" +tempfile = "3.1" [features] evm-debug = ["ethcore/evm-debug-tests"] diff --git a/evmbin/src/info.rs b/evmbin/src/info.rs index c1b655422..13a3bc72f 100644 --- a/evmbin/src/info.rs +++ b/evmbin/src/info.rs @@ -239,7 +239,7 @@ pub mod tests { use std::sync::Arc; use rustc_hex::FromHex; use super::*; - use tempdir::TempDir; + use tempfile::TempDir; use ethereum_types::Address; use spec::{self, Spec}; @@ -258,7 +258,7 @@ pub mod tests { params.code = Some(Arc::new(code.from_hex().unwrap())); params.gas = gas.into(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let spec = spec::new_foundation(&tempdir.path()); let result = run_action(&spec, params, informant, TrieSpec::Secure); match result { @@ -280,7 +280,7 @@ pub mod tests { params.code_address = Address::from_low_u64_be(0x20); params.gas = 0xffff.into(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let spec = Spec::load(&tempdir.path(), include_bytes!("../res/testchain.json") as &[u8]).unwrap(); let _result = run_action(&spec, params, inf, TrieSpec::Secure); diff --git a/parity/configuration.rs b/parity/configuration.rs index 81472923f..803e53e06 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -1171,7 +1171,7 @@ mod tests { use std::fs::File; use std::str::FromStr; - use tempdir::TempDir; + use tempfile::TempDir; use ethcore::miner::MinerOptions; use miner::pool::PrioritizationStrategy; use parity_rpc::NetworkSettings; @@ -1620,7 +1620,7 @@ mod tests { #[test] fn should_not_bail_on_empty_line_in_reserved_peers() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let filename = tempdir.path().join("peers"); File::create(&filename).unwrap().write_all(b" \n\t\n").unwrap(); let args = vec!["parity", "--reserved-peers", filename.to_str().unwrap()]; @@ -1630,7 +1630,7 @@ mod tests { #[test] fn should_ignore_comments_in_reserved_peers() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let filename = tempdir.path().join("peers_comments"); File::create(&filename).unwrap().write_all(b"# Sample comment\nenode://6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e1407241d54947bbb39763a4cac9f77166ad92a0@172.0.0.1:30303\n").unwrap(); let args = vec!["parity", "--reserved-peers", filename.to_str().unwrap()]; diff --git a/parity/db/rocksdb/mod.rs b/parity/db/rocksdb/mod.rs index f1818b735..212220684 100644 --- a/parity/db/rocksdb/mod.rs +++ b/parity/db/rocksdb/mod.rs @@ -19,7 +19,7 @@ extern crate migration_rocksdb; extern crate ethcore_blockchain; #[cfg(test)] -extern crate tempdir; +extern crate tempfile; use std::{io, fs}; use std::sync::Arc; diff --git a/parity/helpers.rs b/parity/helpers.rs index 9031c50b7..6776cc555 100644 --- a/parity/helpers.rs +++ b/parity/helpers.rs @@ -350,7 +350,7 @@ mod tests { use std::fs::File; use std::io::Write; use std::collections::HashSet; - use tempdir::TempDir; + use tempfile::TempDir; use ethereum_types::U256; use ethcore::miner::PendingSet; use ethkey::Password; @@ -445,7 +445,7 @@ mod tests { #[test] fn test_password() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let path = tempdir.path().join("file"); let mut file = File::create(&path).unwrap(); file.write_all(b"a bc ").unwrap(); @@ -454,7 +454,7 @@ mod tests { #[test] fn test_password_multiline() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let path = tempdir.path().join("file"); let mut file = File::create(path.as_path()).unwrap(); file.write_all(br#" password with trailing whitespace diff --git a/parity/lib.rs b/parity/lib.rs index 34aaec8ac..f8be172fa 100644 --- a/parity/lib.rs +++ b/parity/lib.rs @@ -96,7 +96,7 @@ extern crate ethcore_call_contract as call_contract; extern crate pretty_assertions; #[cfg(test)] -extern crate tempdir; +extern crate tempfile; mod account; mod account_utils; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index e02504e7f..9857efec3 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -20,7 +20,7 @@ serde = "1.0" serde_derive = "1.0" serde_json = "1.0" parking_lot = "0.10.0" -tempdir = "0.3" +tempfile = "3.1" tiny-keccak = "1.4" tokio-timer = "0.1" transient-hashmap = "0.4" diff --git a/rpc/src/authcodes.rs b/rpc/src/authcodes.rs index c2cfc0874..1663fbc1a 100644 --- a/rpc/src/authcodes.rs +++ b/rpc/src/authcodes.rs @@ -215,7 +215,7 @@ mod tests { use std::io::{Read, Write}; use std::{time, fs}; use std::cell::Cell; - use tempdir::TempDir; + use tempfile::TempDir; use hash::keccak; use ethereum_types::H256; @@ -289,7 +289,7 @@ mod tests { #[test] fn should_read_old_format_from_file() { // given - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let file_path = tempdir.path().join("file"); let code = "23521352asdfasdfadf"; { @@ -308,7 +308,7 @@ mod tests { #[test] fn should_remove_old_unused_tokens() { // given - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let file_path = tempdir.path().join("file"); let code1 = "11111111asdfasdf111"; let code2 = "22222222asdfasdf222"; diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 9ad4ad095..3a3673b7b 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -86,7 +86,7 @@ extern crate account_state; extern crate stats; extern crate snapshot; -extern crate tempdir; +extern crate tempfile; extern crate trace; extern crate vm; diff --git a/rpc/src/tests/helpers.rs b/rpc/src/tests/helpers.rs index 42afd973c..41169a0a2 100644 --- a/rpc/src/tests/helpers.rs +++ b/rpc/src/tests/helpers.rs @@ -16,7 +16,7 @@ use std::ops::{Deref, DerefMut}; use std::path::PathBuf; -use tempdir::TempDir; +use tempfile::TempDir; use parity_runtime::{Runtime, TaskExecutor}; @@ -62,7 +62,7 @@ pub struct GuardedAuthCodes { impl Default for GuardedAuthCodes { fn default() -> Self { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let path = tempdir.path().join("file"); GuardedAuthCodes { diff --git a/rpc/src/v1/tests/mocked/parity_accounts.rs b/rpc/src/v1/tests/mocked/parity_accounts.rs index 609ad823b..f3741e03c 100644 --- a/rpc/src/v1/tests/mocked/parity_accounts.rs +++ b/rpc/src/v1/tests/mocked/parity_accounts.rs @@ -21,7 +21,7 @@ use accounts::{AccountProvider, AccountProviderSettings}; use ethereum_types::Address; use ethstore::EthStore; use ethstore::accounts_dir::RootDiskDirectory; -use tempdir::TempDir; +use tempfile::TempDir; use jsonrpc_core::IoHandler; use v1::{ParityAccounts, ParityAccountsInfo, ParityAccountsClient}; @@ -219,7 +219,7 @@ fn should_be_able_to_remove_address() { #[test] fn rpc_parity_new_vault() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); let request = r#"{"jsonrpc": "2.0", "method": "parity_newVault", "params":["vault1", "password1"], "id": 1}"#; @@ -232,7 +232,7 @@ fn rpc_parity_new_vault() { #[test] fn rpc_parity_open_vault() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok()); @@ -246,7 +246,7 @@ fn rpc_parity_open_vault() { #[test] fn rpc_parity_close_vault() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok()); @@ -259,7 +259,7 @@ fn rpc_parity_close_vault() { #[test] fn rpc_parity_change_vault_password() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok()); @@ -272,7 +272,7 @@ fn rpc_parity_change_vault_password() { #[test] fn rpc_parity_change_vault() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); let (address, _) = tester.accounts.new_account_and_public(&"root_password".into()).unwrap(); @@ -286,7 +286,7 @@ fn rpc_parity_change_vault() { #[test] fn rpc_parity_vault_adds_vault_field_to_acount_meta() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); let (address1, _) = tester.accounts.new_account_and_public(&"root_password1".into()).unwrap(); @@ -310,7 +310,7 @@ fn rpc_parity_vault_adds_vault_field_to_acount_meta() { #[test] fn rpc_parity_list_vaults() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok()); @@ -327,7 +327,7 @@ fn rpc_parity_list_vaults() { #[test] fn rpc_parity_list_opened_vaults() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok()); @@ -346,7 +346,7 @@ fn rpc_parity_list_opened_vaults() { #[test] fn rpc_parity_get_set_vault_meta() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap()); assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok()); diff --git a/updater/Cargo.toml b/updater/Cargo.toml index 2a731a245..5f10b80c9 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -28,7 +28,7 @@ target_info = "0.1" [dev-dependencies] ethcore = { path = "../ethcore", features = ["test-helpers"] } -tempdir = "0.3" +tempfile = "3.1" matches = "0.1" [features] diff --git a/updater/src/lib.rs b/updater/src/lib.rs index fff4665e8..037a4294b 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -43,7 +43,7 @@ extern crate lazy_static; extern crate log; #[cfg(test)] -extern crate tempdir; +extern crate tempfile; #[cfg(test)] #[macro_use] diff --git a/updater/src/updater.rs b/updater/src/updater.rs index dcff32be4..4577d6d3c 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -724,7 +724,7 @@ pub mod tests { use std::io::Read; use std::sync::Arc; use semver::Version; - use tempdir::TempDir; + use tempfile::TempDir; use ethcore::test_helpers::{TestBlockChainClient, EachBlockWith}; use self::fetch::Error; use super::*; @@ -865,7 +865,7 @@ pub mod tests { } fn update_policy() -> (UpdatePolicy, TempDir) { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let update_policy = UpdatePolicy { path: tempdir.path().into(), diff --git a/util/blooms-db/Cargo.toml b/util/blooms-db/Cargo.toml index fba83b419..5ba9b5b29 100644 --- a/util/blooms-db/Cargo.toml +++ b/util/blooms-db/Cargo.toml @@ -11,7 +11,7 @@ parking_lot = "0.10.0" [dev-dependencies] criterion = "0.3" -tempdir = "0.3" +tempfile = "3.1" [[bench]] name = "blooms" diff --git a/util/blooms-db/benches/blooms.rs b/util/blooms-db/benches/blooms.rs index 2a6734580..2726da8be 100644 --- a/util/blooms-db/benches/blooms.rs +++ b/util/blooms-db/benches/blooms.rs @@ -16,13 +16,13 @@ #[macro_use] extern crate criterion; -extern crate tempdir; +extern crate tempfile; extern crate blooms_db; extern crate ethbloom; use std::iter; use criterion::Criterion; -use tempdir::TempDir; +use tempfile::TempDir; use blooms_db::Database; use ethbloom::Bloom; @@ -35,7 +35,7 @@ criterion_group!( criterion_main!(blooms); fn bench_blooms_filter_1_million_ok(c: &mut Criterion) { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let database = Database::open(tempdir.path()).unwrap(); database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap(); let bloom = Bloom::from_low_u64_be(0x001); @@ -53,7 +53,7 @@ fn bench_blooms_filter_1_million_ok(c: &mut Criterion) { } fn bench_blooms_filter_1_million_miss(c: &mut Criterion) { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let database = Database::open(tempdir.path()).unwrap(); database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap(); let bloom = Bloom::from_low_u64_be(0x001); @@ -72,7 +72,7 @@ fn bench_blooms_filter_1_million_miss(c: &mut Criterion) { } fn bench_blooms_filter_1_million_miss_and_ok(c: &mut Criterion) { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let database = Database::open(tempdir.path()).unwrap(); database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap(); let bloom = Bloom::from_low_u64_be(0x001); diff --git a/util/blooms-db/src/db.rs b/util/blooms-db/src/db.rs index e50f41ea7..0a67c3c95 100644 --- a/util/blooms-db/src/db.rs +++ b/util/blooms-db/src/db.rs @@ -294,12 +294,12 @@ where ethbloom::BloomRef<'b>: From, 'b: 'a, II: IntoIterator Iterator for FileIterator<'a> { #[cfg(test)] mod tests { use ethbloom::Bloom; - use tempdir::TempDir; + use tempfile::TempDir; use super::File; #[test] fn test_file() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let mut file = File::open(tempdir.path().join("file")).unwrap(); file.accrue_bloom(0, &Bloom::from_low_u64_be(1)).unwrap(); file.flush().unwrap(); diff --git a/util/migration-rocksdb/Cargo.toml b/util/migration-rocksdb/Cargo.toml index 5d5cd40d8..82b3a47eb 100644 --- a/util/migration-rocksdb/Cargo.toml +++ b/util/migration-rocksdb/Cargo.toml @@ -11,5 +11,5 @@ kvdb = "0.4.0" kvdb-rocksdb = "0.6.0" [dev-dependencies] -tempdir = "0.3" +tempfile = "3.1" maplit = "1.0.2" diff --git a/util/migration-rocksdb/tests/tests.rs b/util/migration-rocksdb/tests/tests.rs index 4aa10a16f..185e12762 100644 --- a/util/migration-rocksdb/tests/tests.rs +++ b/util/migration-rocksdb/tests/tests.rs @@ -26,7 +26,7 @@ use std::sync::Arc; use kvdb_rocksdb::{Database, DatabaseConfig}; use maplit::btreemap; use migration_rocksdb::{Batch, Config, SimpleMigration, Migration, Manager, ChangeColumns}; -use tempdir::TempDir; +use tempfile::TempDir; #[inline] fn db_path(path: &Path) -> PathBuf { @@ -107,7 +107,7 @@ impl Migration for AddsColumn { #[test] fn one_simple_migration() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); let mut manager = Manager::new(Config::default()); make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]); @@ -122,7 +122,7 @@ fn one_simple_migration() { #[test] #[should_panic] fn no_migration_needed() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); let mut manager = Manager::new(Config::default()); make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]); @@ -134,7 +134,7 @@ fn no_migration_needed() { #[test] #[should_panic] fn wrong_adding_order() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); let mut manager = Manager::new(Config::default()); make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]); @@ -145,7 +145,7 @@ fn wrong_adding_order() { #[test] fn multiple_migrations() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); let mut manager = Manager::new(Config::default()); make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]); @@ -160,7 +160,7 @@ fn multiple_migrations() { #[test] fn second_migration() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); let mut manager = Manager::new(Config::default()); make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]); @@ -175,7 +175,7 @@ fn second_migration() { #[test] fn first_and_noop_migration() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); let mut manager = Manager::new(Config::default()); make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]); @@ -189,7 +189,7 @@ fn first_and_noop_migration() { #[test] fn noop_and_second_migration() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); let mut manager = Manager::new(Config::default()); make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]); @@ -217,7 +217,7 @@ fn pre_columns() { let mut manager = Manager::new(Config::default()); manager.add_migration(AddsColumn).unwrap(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); // this shouldn't fail to open the database even though it's one column @@ -236,7 +236,7 @@ fn change_columns() { version: 1, }).unwrap(); - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let db_path = db_path(tempdir.path()); let new_path = manager.execute(&db_path, 0).unwrap(); diff --git a/util/network-devp2p/Cargo.toml b/util/network-devp2p/Cargo.toml index f8c185d33..38b39b5df 100644 --- a/util/network-devp2p/Cargo.toml +++ b/util/network-devp2p/Cargo.toml @@ -37,7 +37,7 @@ tiny-keccak = "1.4" assert_matches = "1.2" env_logger = "0.5" hex-literal = "0.2.1" -tempdir = "0.3" +tempfile = "3.1" [features] default = [] diff --git a/util/network-devp2p/src/host.rs b/util/network-devp2p/src/host.rs index 170502fad..61dc94f4a 100644 --- a/util/network-devp2p/src/host.rs +++ b/util/network-devp2p/src/host.rs @@ -1270,9 +1270,9 @@ fn load_key(path: &Path) -> Option { #[test] fn key_save_load() { - use tempdir::TempDir; + use tempfile::TempDir; - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let key = H256::random().into(); save_key(tempdir.path(), &key); let r = load_key(tempdir.path()); diff --git a/util/network-devp2p/src/node_table.rs b/util/network-devp2p/src/node_table.rs index 47a516fc7..16bc73f43 100644 --- a/util/network-devp2p/src/node_table.rs +++ b/util/network-devp2p/src/node_table.rs @@ -616,7 +616,7 @@ mod tests { use ethereum_types::H512; use ipnetwork::IpNetwork; - use tempdir::TempDir; + use tempfile::TempDir; use assert_matches::assert_matches; @@ -782,7 +782,7 @@ mod tests { #[test] fn table_save_load() { - let tempdir = TempDir::new("").unwrap(); + let tempdir = TempDir::new().unwrap(); let node1 = Node::from_str("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap(); let node2 = Node::from_str("enode://b979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap(); let node3 = Node::from_str("enode://c979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap();