Replace deprecated tempdir dependency with tempfile (#11588)
`Tempdir` is deprecated, but the functionality has been merged into another crate: `tempfile`. This commit removes all `tempdir` dependencies and replaces them with `tempfile` and the equivalent bindings. Fixes #11560
This commit is contained in:
@@ -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"
|
||||
]
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<dyn BlockChainDB> {
|
||||
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(),
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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())]);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<StateDB> {
|
||||
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);
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -98,5 +98,5 @@ extern crate ethcore;
|
||||
#[cfg(test)]
|
||||
extern crate kvdb_memorydb;
|
||||
#[cfg(test)]
|
||||
extern crate tempdir;
|
||||
extern crate tempfile;
|
||||
extern crate journaldb;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -35,7 +35,7 @@ extern crate trace_time;
|
||||
#[cfg(test)]
|
||||
extern crate ethcore_db;
|
||||
#[cfg(test)]
|
||||
extern crate tempdir;
|
||||
extern crate tempfile;
|
||||
|
||||
mod service;
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<dyn SnapshotReader>, 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());
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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::<ClientIoMessage<Client>>::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(
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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<H: FnMut(&str, HookType)>(path: &Path, json_data: &[u8], h: &mut H) -> Vec<String> {
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let tempdir = TempDir::new().unwrap();
|
||||
json_difficulty_test(path, json_data, crate::spec::$spec(&tempdir.path()), h)
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<dyn BlockChainDB> {
|
||||
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<dyn BlockChainDB> {
|
||||
|
||||
/// Creates a new temporary `BlockChainDB` on FS
|
||||
pub fn new_temp_db(tempdir: &Path) -> Arc<dyn BlockChainDB> {
|
||||
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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user