From 373fdb65e96397cf859a5a15aa3ad50cd93a1641 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 12 Mar 2018 18:05:52 +0100 Subject: [PATCH] ethcore test::helpers cleanup (#8086) --- ethcore/src/block.rs | 2 +- ethcore/src/blockchain/blockchain.rs | 5 +- ethcore/src/client/client.rs | 2 +- ethcore/src/engines/authority_round/mod.rs | 5 +- ethcore/src/engines/basic_authority.rs | 2 +- ethcore/src/engines/instant_seal.rs | 2 +- ethcore/src/engines/tendermint/mod.rs | 5 +- ethcore/src/ethereum/ethash.rs | 32 ++++++++- ethcore/src/ethereum/mod.rs | 2 +- ethcore/src/executive.rs | 2 +- ethcore/src/externalities.rs | 2 +- ethcore/src/json_tests/executive.rs | 2 +- ethcore/src/machine.rs | 15 ++++- ethcore/src/service.rs | 4 +- ethcore/src/snapshot/service.rs | 6 +- ethcore/src/state/mod.rs | 2 +- ethcore/src/state_db.rs | 2 +- ethcore/src/tests/client.rs | 13 ++-- ethcore/src/tests/evm.rs | 18 ++++- ethcore/src/tests/helpers.rs | 76 ++++------------------ ethcore/src/tests/trace.rs | 2 +- ethcore/src/verification/queue/mod.rs | 8 +-- 22 files changed, 115 insertions(+), 94 deletions(-) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 8f6e01942..a0318d3e1 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -635,7 +635,7 @@ pub fn enact_verified( #[cfg(test)] mod tests { - use tests::helpers::*; + use tests::helpers::get_temp_state_db; use super::*; use engines::EthEngine; use vm::LastHashes; diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index 290fb66ea..f3fab416b 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -1312,7 +1312,10 @@ mod tests { use ethereum_types::*; use receipt::{Receipt, TransactionOutcome}; use blockchain::{BlockProvider, BlockChain, Config, ImportRoute}; - use tests::helpers::*; + use tests::helpers::{ + generate_dummy_blockchain, generate_dummy_blockchain_with_extra, + generate_dummy_empty_blockchain + }; use blockchain::generator::{BlockGenerator, BlockBuilder, BlockOptions}; use blockchain::extras::TransactionAddress; use transaction::{Transaction, Action}; diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 5a5ffae16..f5b7f07a8 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -2205,7 +2205,7 @@ mod tests { #[test] fn should_not_cache_details_before_commit() { use client::{BlockChainClient, ChainInfo}; - use tests::helpers::*; + use tests::helpers::{generate_dummy_client, get_good_dummy_block_hash}; use std::thread; use std::time::Duration; diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index 0fe369c6d..0acde347e 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -1326,7 +1326,10 @@ mod tests { use header::Header; use rlp::encode; use block::*; - use tests::helpers::*; + use tests::helpers::{ + generate_dummy_client_with_spec_and_accounts, get_temp_state_db, generate_dummy_client, + TestNotify + }; use account_provider::AccountProvider; use spec::Spec; use transaction::{Action, Transaction}; diff --git a/ethcore/src/engines/basic_authority.rs b/ethcore/src/engines/basic_authority.rs index c6bb0a115..c17fc0695 100644 --- a/ethcore/src/engines/basic_authority.rs +++ b/ethcore/src/engines/basic_authority.rs @@ -199,7 +199,7 @@ mod tests { use hash::keccak; use ethereum_types::H520; use block::*; - use tests::helpers::*; + use tests::helpers::get_temp_state_db; use account_provider::AccountProvider; use header::Header; use spec::Spec; diff --git a/ethcore/src/engines/instant_seal.rs b/ethcore/src/engines/instant_seal.rs index 828d4033f..9c2600212 100644 --- a/ethcore/src/engines/instant_seal.rs +++ b/ethcore/src/engines/instant_seal.rs @@ -56,7 +56,7 @@ impl Engine for InstantSeal mod tests { use std::sync::Arc; use ethereum_types::{H520, Address}; - use tests::helpers::*; + use tests::helpers::{get_temp_state_db}; use spec::Spec; use header::Header; use block::*; diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index 0d8081c44..4d0656749 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -783,7 +783,10 @@ mod tests { use header::Header; use client::ChainInfo; use miner::MinerService; - use tests::helpers::*; + use tests::helpers::{ + TestNotify, get_temp_state_db, generate_dummy_client, + generate_dummy_client_with_spec_and_accounts + }; use account_provider::AccountProvider; use spec::Spec; use engines::{EthEngine, EngineError, Seal}; diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 79755749f..14741df4b 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -487,7 +487,7 @@ mod tests { use std::sync::Arc; use ethereum_types::{H64, H256, U256, Address}; use block::*; - use tests::helpers::*; + use tests::helpers::get_temp_state_db; use error::{BlockError, Error}; use header::Header; use spec::Spec; @@ -500,6 +500,36 @@ mod tests { new_morden(&::std::env::temp_dir()) } + fn get_default_ethash_params() -> EthashParams { + EthashParams { + minimum_difficulty: U256::from(131072), + difficulty_bound_divisor: U256::from(2048), + difficulty_increment_divisor: 10, + metropolis_difficulty_increment_divisor: 9, + homestead_transition: 1150000, + duration_limit: 13, + block_reward: 0.into(), + difficulty_hardfork_transition: u64::max_value(), + difficulty_hardfork_bound_divisor: U256::from(0), + bomb_defuse_transition: u64::max_value(), + eip100b_transition: u64::max_value(), + ecip1010_pause_transition: u64::max_value(), + ecip1010_continue_transition: u64::max_value(), + ecip1017_era_rounds: u64::max_value(), + mcip3_transition: u64::max_value(), + mcip3_miner_reward: 0.into(), + mcip3_ubi_reward: 0.into(), + mcip3_ubi_contract: "0000000000000000000000000000000000000001".into(), + mcip3_dev_reward: 0.into(), + mcip3_dev_contract: "0000000000000000000000000000000000000001".into(), + eip649_transition: u64::max_value(), + eip649_delay: 3_000_000, + eip649_reward: None, + expip2_transition: u64::max_value(), + expip2_duration_limit: 30, + } + } + #[test] fn on_close_block() { let spec = test_spec(); diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index 03a7a1ad1..e892cf56a 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -140,7 +140,7 @@ mod tests { use ethereum_types::U256; use state::*; use super::*; - use tests::helpers::*; + use tests::helpers::get_temp_state_db; use views::BlockView; #[test] diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index c8b27576f..8e792f9e2 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -701,7 +701,7 @@ mod tests { use error::ExecutionError; use machine::EthereumMachine; use state::{Substate, CleanupMode}; - use tests::helpers::*; + use tests::helpers::{get_temp_state_with_factory, get_temp_state}; use trace::trace; use trace::{FlatTrace, Tracer, NoopTracer, ExecutiveTracer}; use trace::{VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff, VMTracer, NoopVMTracer, ExecutiveVMTracer}; diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index 05c295e06..732d3499a 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -414,7 +414,7 @@ mod tests { use ethereum_types::{U256, Address}; use evm::{EnvInfo, Ext, CallType}; use state::{State, Substate}; - use tests::helpers::*; + use tests::helpers::get_temp_state; use super::*; use trace::{NoopTracer, NoopVMTracer}; diff --git a/ethcore/src/json_tests/executive.rs b/ethcore/src/json_tests/executive.rs index 4a6309cac..0ec60d493 100644 --- a/ethcore/src/json_tests/executive.rs +++ b/ethcore/src/json_tests/executive.rs @@ -25,7 +25,7 @@ use vm::{ CreateContractAddress, ReturnData, }; use externalities::*; -use tests::helpers::*; +use tests::helpers::get_temp_state; use ethjson; use trace::{Tracer, NoopTracer}; use trace::{VMTracer, NoopVMTracer}; diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index f2045b0a1..ad36aa69d 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -473,12 +473,25 @@ fn round_block_gas_limit(gas_limit: U256, lower_limit: U256, upper_limit: U256) mod tests { use super::*; + fn get_default_ethash_extensions() -> EthashExtensions { + EthashExtensions { + homestead_transition: 1150000, + eip150_transition: u64::max_value(), + eip160_transition: u64::max_value(), + eip161abc_transition: u64::max_value(), + eip161d_transition: u64::max_value(), + dao_hardfork_transition: u64::max_value(), + dao_hardfork_beneficiary: "0000000000000000000000000000000000000001".into(), + dao_hardfork_accounts: Vec::new(), + } + } + #[test] fn ethash_gas_limit_is_multiple_of_determinant() { use ethereum_types::U256; let spec = ::ethereum::new_homestead_test(); - let ethparams = ::tests::helpers::get_default_ethash_extensions(); + let ethparams = get_default_ethash_extensions(); let machine = EthereumMachine::with_ethash_extensions( spec.params().clone(), diff --git a/ethcore/src/service.rs b/ethcore/src/service.rs index 61f9ecd3b..5a523c6ea 100644 --- a/ethcore/src/service.rs +++ b/ethcore/src/service.rs @@ -222,8 +222,8 @@ impl IoHandler for ClientIoHandler { #[cfg(test)] mod tests { use std::{time, thread}; + use spec::Spec; use super::*; - use tests::helpers::*; use client::ClientConfig; use std::sync::Arc; use miner::Miner; @@ -235,7 +235,7 @@ mod tests { let client_path = tempdir.path().join("client"); let snapshot_path = tempdir.path().join("snapshot"); - let spec = get_test_spec(); + let spec = Spec::new_test(); let service = ClientService::start( ClientConfig::default(), &spec, diff --git a/ethcore/src/snapshot/service.rs b/ethcore/src/snapshot/service.rs index ae1f6feca..25356f78c 100644 --- a/ethcore/src/snapshot/service.rs +++ b/ethcore/src/snapshot/service.rs @@ -633,7 +633,7 @@ mod tests { use std::sync::Arc; use service::ClientIoMessage; use io::{IoService}; - use tests::helpers::get_test_spec; + use spec::Spec; use journaldb::Algorithm; use error::Error; use snapshot::{ManifestData, RestorationStatus, SnapshotService}; @@ -650,7 +650,7 @@ mod tests { #[test] fn sends_async_messages() { let service = IoService::::start().unwrap(); - let spec = get_test_spec(); + let spec = Spec::new_test(); let tempdir = TempDir::new("").unwrap(); let dir = tempdir.path().join("snapshot"); @@ -691,7 +691,7 @@ mod tests { use ethereum_types::H256; use kvdb_rocksdb::DatabaseConfig; - let spec = get_test_spec(); + let spec = Spec::new_test(); let tempdir = TempDir::new("").unwrap(); let state_hashes: Vec<_> = (0..5).map(|_| H256::random()).collect(); diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index 09f6953f0..fa8ca009b 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -1088,7 +1088,7 @@ mod tests { use super::*; use ethkey::Secret; use ethereum_types::{H256, U256, Address}; - use tests::helpers::*; + use tests::helpers::{get_temp_state, get_temp_state_db}; use machine::EthereumMachine; use vm::EnvInfo; use spec::*; diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index fc4012335..647ec3849 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -480,7 +480,7 @@ unsafe impl Sync for SyncAccount {} mod tests { use ethereum_types::{H256, U256, Address}; use kvdb::DBTransaction; - use tests::helpers::*; + use tests::helpers::{get_temp_state_db}; use state::{Account, Backend}; use ethcore_logger::init_log; diff --git a/ethcore/src/tests/client.rs b/ethcore/src/tests/client.rs index 30685425b..2fee61412 100644 --- a/ethcore/src/tests/client.rs +++ b/ethcore/src/tests/client.rs @@ -23,7 +23,10 @@ use state::{self, State, CleanupMode}; use executive::{Executive, TransactOptions}; use ethereum; use block::IsBlock; -use tests::helpers::*; +use tests::helpers::{ + generate_dummy_client, push_blocks_to_client, get_test_client_with_blocks, get_good_dummy_block_seq, + generate_dummy_client_with_data, get_good_dummy_block, get_bad_state_dummy_block +}; use types::filter::Filter; use ethereum_types::{U256, Address}; use kvdb_rocksdb::{Database, DatabaseConfig}; @@ -38,7 +41,7 @@ use tempdir::TempDir; #[test] fn imports_from_empty() { let tempdir = TempDir::new("").unwrap(); - let spec = get_test_spec(); + let spec = Spec::new_test(); let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS); let client_db = Arc::new(Database::open(&db_config, tempdir.path().to_str().unwrap()).unwrap()); @@ -77,7 +80,7 @@ fn should_return_registrar() { #[test] fn returns_state_root_basic() { let client = generate_dummy_client(6); - let test_spec = get_test_spec(); + let test_spec = Spec::new_test(); let genesis_header = test_spec.genesis_header(); assert!(client.state_data(genesis_header.state_root()).is_some()); @@ -86,7 +89,7 @@ fn returns_state_root_basic() { #[test] fn imports_good_block() { let tempdir = TempDir::new("").unwrap(); - let spec = get_test_spec(); + let spec = Spec::new_test(); let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS); let client_db = Arc::new(Database::open(&db_config, tempdir.path().to_str().unwrap()).unwrap()); @@ -111,7 +114,7 @@ fn imports_good_block() { #[test] fn query_none_block() { let tempdir = TempDir::new("").unwrap(); - let spec = get_test_spec(); + let spec = Spec::new_test(); let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS); let client_db = Arc::new(Database::open(&db_config, tempdir.path().to_str().unwrap()).unwrap()); diff --git a/ethcore/src/tests/evm.rs b/ethcore/src/tests/evm.rs index a020b7aa3..39feb1364 100644 --- a/ethcore/src/tests/evm.rs +++ b/ethcore/src/tests/evm.rs @@ -1,3 +1,19 @@ +// Copyright 2015-2018 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + //! Tests of EVM integration with transaction execution. use std::sync::Arc; @@ -6,7 +22,7 @@ use vm::{EnvInfo, ActionParams, ActionValue, CallType, ParamsType}; use evm::{Factory, VMType}; use executive::Executive; use state::Substate; -use tests::helpers::*; +use tests::helpers::get_temp_state_with_factory; use trace::{NoopVMTracer, NoopTracer}; use transaction::SYSTEM_ADDRESS; diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index 8151d4064..fd37164dc 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -20,29 +20,22 @@ use block::{OpenBlock, Drain}; use blockchain::{BlockChain, Config as BlockChainConfig}; use bytes::Bytes; use client::{Client, ClientConfig, ChainInfo, ImportBlock, ChainNotify}; -use ethereum::ethash::EthashParams; use ethkey::KeyPair; use evm::Factory as EvmFactory; use factory::Factories; use hash::keccak; use header::Header; use io::*; -use machine::EthashExtensions; use miner::Miner; use parking_lot::RwLock; use rlp::{self, RlpStream}; -use spec::*; +use spec::Spec; use state_db::StateDB; use state::*; use std::sync::Arc; use transaction::{Action, Transaction, SignedTransaction}; use views::BlockView; -// TODO: move everything over to get_null_spec. -pub fn get_test_spec() -> Spec { - Spec::new_test() -} - pub fn create_test_block(header: &Header) -> Bytes { let mut rlp = RlpStream::new_list(3); rlp.append(header); @@ -100,16 +93,16 @@ pub fn generate_dummy_client_with_data(block_number: u32, txs_per_block: usize, } -pub fn generate_dummy_client_with_spec_and_data(get_test_spec: F, block_number: u32, txs_per_block: usize, tx_gas_prices: &[U256]) -> Arc where F: Fn()->Spec { - generate_dummy_client_with_spec_accounts_and_data(get_test_spec, None, block_number, txs_per_block, tx_gas_prices) +pub fn generate_dummy_client_with_spec_and_data(test_spec: F, block_number: u32, txs_per_block: usize, tx_gas_prices: &[U256]) -> Arc where F: Fn()->Spec { + generate_dummy_client_with_spec_accounts_and_data(test_spec, None, block_number, txs_per_block, tx_gas_prices) } -pub fn generate_dummy_client_with_spec_and_accounts(get_test_spec: F, accounts: Option>) -> Arc where F: Fn()->Spec { - generate_dummy_client_with_spec_accounts_and_data(get_test_spec, accounts, 0, 0, &[]) +pub fn generate_dummy_client_with_spec_and_accounts(test_spec: F, accounts: Option>) -> Arc where F: Fn()->Spec { + generate_dummy_client_with_spec_accounts_and_data(test_spec, accounts, 0, 0, &[]) } -pub fn generate_dummy_client_with_spec_accounts_and_data(get_test_spec: F, accounts: Option>, block_number: u32, txs_per_block: usize, tx_gas_prices: &[U256]) -> Arc where F: Fn()->Spec { - let test_spec = get_test_spec(); +pub fn generate_dummy_client_with_spec_accounts_and_data(test_spec: F, accounts: Option>, block_number: u32, txs_per_block: usize, tx_gas_prices: &[U256]) -> Arc where F: Fn()->Spec { + let test_spec = test_spec(); let client_db = new_db(); let client = Client::new( @@ -179,7 +172,7 @@ pub fn generate_dummy_client_with_spec_accounts_and_data(get_test_spec: F, ac } pub fn push_blocks_to_client(client: &Arc, timestamp_salt: u64, starting_number: usize, block_number: usize) { - let test_spec = get_test_spec(); + let test_spec = Spec::new_test(); let state_root = test_spec.genesis_header().state_root().clone(); let genesis_gas = test_spec.genesis_header().gas_limit().clone(); @@ -208,7 +201,7 @@ pub fn push_blocks_to_client(client: &Arc, timestamp_salt: u64, starting } pub fn get_test_client_with_blocks(blocks: Vec) -> Arc { - let test_spec = get_test_spec(); + let test_spec = Spec::new_test(); let client_db = new_db(); let client = Client::new( @@ -285,12 +278,12 @@ pub fn get_temp_state_db() -> StateDB { } pub fn get_good_dummy_block_seq(count: usize) -> Vec { - let test_spec = get_test_spec(); + let test_spec = Spec::new_test(); get_good_dummy_block_fork_seq(1, count, &test_spec.genesis_header().hash()) } pub fn get_good_dummy_block_fork_seq(start_number: usize, count: usize, parent_hash: &H256) -> Vec { - let test_spec = get_test_spec(); + let test_spec = Spec::new_test(); let genesis_gas = test_spec.genesis_header().gas_limit().clone(); let mut rolling_timestamp = start_number as u64 * 10; let mut parent = *parent_hash; @@ -314,7 +307,7 @@ pub fn get_good_dummy_block_fork_seq(start_number: usize, count: usize, parent_h pub fn get_good_dummy_block_hash() -> (H256, Bytes) { let mut block_header = Header::new(); - let test_spec = get_test_spec(); + let test_spec = Spec::new_test(); let genesis_gas = test_spec.genesis_header().gas_limit().clone(); block_header.set_gas_limit(genesis_gas); block_header.set_difficulty(U256::from(0x20000)); @@ -333,7 +326,7 @@ pub fn get_good_dummy_block() -> Bytes { pub fn get_bad_state_dummy_block() -> Bytes { let mut block_header = Header::new(); - let test_spec = get_test_spec(); + let test_spec = Spec::new_test(); let genesis_gas = test_spec.genesis_header().gas_limit().clone(); block_header.set_gas_limit(genesis_gas); @@ -346,49 +339,6 @@ pub fn get_bad_state_dummy_block() -> Bytes { create_test_block(&block_header) } -pub fn get_default_ethash_extensions() -> EthashExtensions { - EthashExtensions { - homestead_transition: 1150000, - eip150_transition: u64::max_value(), - eip160_transition: u64::max_value(), - eip161abc_transition: u64::max_value(), - eip161d_transition: u64::max_value(), - dao_hardfork_transition: u64::max_value(), - dao_hardfork_beneficiary: "0000000000000000000000000000000000000001".into(), - dao_hardfork_accounts: Vec::new(), - } -} - -pub fn get_default_ethash_params() -> EthashParams { - EthashParams { - minimum_difficulty: U256::from(131072), - difficulty_bound_divisor: U256::from(2048), - difficulty_increment_divisor: 10, - metropolis_difficulty_increment_divisor: 9, - homestead_transition: 1150000, - duration_limit: 13, - block_reward: 0.into(), - difficulty_hardfork_transition: u64::max_value(), - difficulty_hardfork_bound_divisor: U256::from(0), - bomb_defuse_transition: u64::max_value(), - eip100b_transition: u64::max_value(), - ecip1010_pause_transition: u64::max_value(), - ecip1010_continue_transition: u64::max_value(), - ecip1017_era_rounds: u64::max_value(), - mcip3_transition: u64::max_value(), - mcip3_miner_reward: 0.into(), - mcip3_ubi_reward: 0.into(), - mcip3_ubi_contract: "0000000000000000000000000000000000000001".into(), - mcip3_dev_reward: 0.into(), - mcip3_dev_contract: "0000000000000000000000000000000000000001".into(), - eip649_transition: u64::max_value(), - eip649_delay: 3_000_000, - eip649_reward: None, - expip2_transition: u64::max_value(), - expip2_duration_limit: 30, - } -} - #[derive(Default)] pub struct TestNotify { pub messages: RwLock>, diff --git a/ethcore/src/tests/trace.rs b/ethcore/src/tests/trace.rs index 77f4891a6..5483c6263 100644 --- a/ethcore/src/tests/trace.rs +++ b/ethcore/src/tests/trace.rs @@ -24,7 +24,7 @@ use ethereum_types::{U256, Address}; use io::*; use spec::*; use client::*; -use tests::helpers::*; +use tests::helpers::get_temp_state_db; use client::{BlockChainClient, Client, ClientConfig}; use kvdb_rocksdb::{Database, DatabaseConfig}; use std::sync::Arc; diff --git a/ethcore/src/verification/queue/mod.rs b/ethcore/src/verification/queue/mod.rs index ae87ae0b1..63193020b 100644 --- a/ethcore/src/verification/queue/mod.rs +++ b/ethcore/src/verification/queue/mod.rs @@ -728,17 +728,17 @@ impl Drop for VerificationQueue { #[cfg(test)] mod tests { use io::*; - use spec::*; + use spec::Spec; use super::{BlockQueue, Config, State}; use super::kind::blocks::Unverified; - use tests::helpers::*; + use tests::helpers::{get_good_dummy_block_seq, get_good_dummy_block}; use error::*; use views::*; // create a test block queue. // auto_scaling enables verifier adjustment. fn get_test_queue(auto_scale: bool) -> BlockQueue { - let spec = get_test_spec(); + let spec = Spec::new_test(); let engine = spec.engine; let mut config = Config::default(); @@ -827,7 +827,7 @@ mod tests { #[test] fn test_mem_limit() { - let spec = get_test_spec(); + let spec = Spec::new_test(); let engine = spec.engine; let mut config = Config::default(); config.max_mem_use = super::MIN_MEM_LIMIT; // empty queue uses about 15000