From c4989ddc442df2d8a09a7a28057a640f8898894b Mon Sep 17 00:00:00 2001 From: debris Date: Sat, 29 Jul 2017 21:56:42 +0200 Subject: [PATCH] removed util::common --- dapps/src/api/time.rs | 5 ++-- ethcore/evm/src/ext.rs | 1 + ethcore/evm/src/interpreter/mod.rs | 1 + ethcore/evm/src/tests.rs | 2 ++ ethcore/src/blockchain/blockchain.rs | 1 + ethcore/src/client/test_client.rs | 1 + ethcore/src/engines/authority_round/mod.rs | 22 +++++++-------- ethcore/src/engines/basic_authority.rs | 3 ++- ethcore/src/engines/instant_seal.rs | 1 + ethcore/src/engines/mod.rs | 3 ++- ethcore/src/engines/signer.rs | 3 ++- ethcore/src/engines/tendermint/message.rs | 1 + ethcore/src/engines/tendermint/mod.rs | 2 +- ethcore/src/engines/validator_set/contract.rs | 1 + ethcore/src/engines/validator_set/multi.rs | 1 + .../engines/validator_set/safe_contract.rs | 3 ++- ethcore/src/engines/validator_set/test.rs | 3 ++- ethcore/src/engines/vote_collector.rs | 1 + ethcore/src/ethereum/ethash.rs | 2 ++ ethcore/src/executive.rs | 1 + ethcore/src/externalities.rs | 1 + ethcore/src/miner/miner.rs | 1 + ethcore/src/service.rs | 2 ++ ethcore/src/spec/spec.rs | 2 ++ ethcore/src/state/account.rs | 1 + ethcore/src/state/mod.rs | 1 + ethcore/src/state_db.rs | 3 ++- ethcore/src/tests/client.rs | 1 + ethcore/src/tests/evm.rs | 1 + ethcore/src/tests/helpers.rs | 1 + ethcore/src/verification/queue/mod.rs | 2 +- json/src/spec/authority_round.rs | 5 ++-- rpc/src/v1/tests/helpers/miner_service.rs | 3 +-- sync/src/tests/chain.rs | 2 +- sync/src/tests/consensus.rs | 1 + sync/src/tests/helpers.rs | 1 + sync/src/tests/snapshot.rs | 1 + util/network/src/tests.rs | 3 ++- util/src/common.rs | 11 ++------ util/src/error.rs | 2 +- util/src/journaldb/archivedb.rs | 6 +++-- util/src/journaldb/earlymergedb.rs | 9 +++++-- util/src/journaldb/mod.rs | 2 +- util/src/journaldb/overlayrecentdb.rs | 8 ++++-- util/src/journaldb/refcounteddb.rs | 6 +++-- util/src/journaldb/traits.rs | 3 ++- util/src/kvdb.rs | 7 +++-- util/src/lib.rs | 12 +++++++-- util/src/migration/tests.rs | 5 ++-- util/src/misc.rs | 2 +- util/src/standard.rs | 27 ------------------- util/src/trie/triedb.rs | 3 ++- 52 files changed, 109 insertions(+), 84 deletions(-) delete mode 100644 util/src/standard.rs diff --git a/dapps/src/api/time.rs b/dapps/src/api/time.rs index b81b4a844..3117f4cc9 100644 --- a/dapps/src/api/time.rs +++ b/dapps/src/api/time.rs @@ -33,13 +33,14 @@ use std::io; use std::{fmt, mem, time}; - +use std::sync::Arc; use std::collections::VecDeque; + use futures::{self, Future, BoxFuture}; use futures_cpupool::CpuPool; use ntp; use time::{Duration, Timespec}; -use util::{Arc, RwLock}; +use util::RwLock; /// Time checker error. #[derive(Debug, Clone, PartialEq)] diff --git a/ethcore/evm/src/ext.rs b/ethcore/evm/src/ext.rs index 1c3ddb317..2861b1ca5 100644 --- a/ethcore/evm/src/ext.rs +++ b/ethcore/evm/src/ext.rs @@ -16,6 +16,7 @@ //! Interface for Evm externalities. +use std::sync::Arc; use util::*; use call_type::CallType; use env_info::EnvInfo; diff --git a/ethcore/evm/src/interpreter/mod.rs b/ethcore/evm/src/interpreter/mod.rs index 621febffd..36e652ab2 100644 --- a/ethcore/evm/src/interpreter/mod.rs +++ b/ethcore/evm/src/interpreter/mod.rs @@ -25,6 +25,7 @@ mod shared_cache; use std::marker::PhantomData; use std::{cmp, mem}; +use std::sync::Arc; use self::gasometer::Gasometer; use self::stack::{Stack, VecStack}; use self::memory::Memory; diff --git a/ethcore/evm/src/tests.rs b/ethcore/evm/src/tests.rs index c19a575f3..7679ab980 100644 --- a/ethcore/evm/src/tests.rs +++ b/ethcore/evm/src/tests.rs @@ -16,6 +16,8 @@ use std::fmt::Debug; use std::str::FromStr; +use std::hash::Hash; +use std::sync::Arc; use std::collections::{HashMap, HashSet}; use rustc_hex::FromHex; use util::*; diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index 59b4fb7c3..bd0defa47 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -17,6 +17,7 @@ //! Blockchain database. use std::collections::{HashMap, HashSet}; +use std::sync::Arc; use std::mem; use bloomchain as bc; use util::*; diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index e33888e72..aa49e6abc 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -17,6 +17,7 @@ //! Test client. use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrder}; +use std::sync::Arc; use std::collections::{HashMap, BTreeMap}; use std::mem; use rustc_hex::FromHex; diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index a72091e5e..d260c9ac8 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -17,7 +17,7 @@ //! A blockchain engine that supports a non-instant BFT proof-of-authority. use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering as AtomicOrdering}; -use std::sync::Weak; +use std::sync::{Weak, Arc}; use std::time::{UNIX_EPOCH, Duration}; use std::collections::{BTreeMap, HashSet, HashMap}; use std::cmp; @@ -853,8 +853,8 @@ impl Engine for AuthorityRound { #[cfg(test)] mod tests { + use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; - use std::str::FromStr; use util::*; use header::Header; use error::{Error, BlockError}; @@ -944,10 +944,10 @@ mod tests { let addr = tap.insert_account("0".sha3().into(), "0").unwrap(); let mut parent_header: Header = Header::default(); parent_header.set_seal(vec![encode(&0usize).into_vec()]); - parent_header.set_gas_limit(U256::from_str("222222").unwrap()); + parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); header.set_number(1); - header.set_gas_limit(U256::from_str("222222").unwrap()); + header.set_gas_limit("222222".parse::().unwrap()); header.set_author(addr); let engine = Spec::new_test_round().engine; @@ -970,10 +970,10 @@ mod tests { let mut parent_header: Header = Header::default(); parent_header.set_seal(vec![encode(&0usize).into_vec()]); - parent_header.set_gas_limit(U256::from_str("222222").unwrap()); + parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); header.set_number(1); - header.set_gas_limit(U256::from_str("222222").unwrap()); + header.set_gas_limit("222222".parse::().unwrap()); header.set_author(addr); let engine = Spec::new_test_round().engine; @@ -996,10 +996,10 @@ mod tests { let mut parent_header: Header = Header::default(); parent_header.set_seal(vec![encode(&4usize).into_vec()]); - parent_header.set_gas_limit(U256::from_str("222222").unwrap()); + parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); header.set_number(1); - header.set_gas_limit(U256::from_str("222222").unwrap()); + header.set_gas_limit("222222".parse::().unwrap()); header.set_author(addr); let engine = Spec::new_test_round().engine; @@ -1017,7 +1017,7 @@ mod tests { fn reports_skipped() { let last_benign = Arc::new(AtomicUsize::new(0)); let params = AuthorityRoundParams { - gas_limit_bound_divisor: U256::from_str("400").unwrap(), + gas_limit_bound_divisor: "400".parse::().unwrap(), step_duration: Default::default(), block_reward: Default::default(), registrar: Default::default(), @@ -1032,10 +1032,10 @@ mod tests { let mut parent_header: Header = Header::default(); parent_header.set_seal(vec![encode(&1usize).into_vec()]); - parent_header.set_gas_limit(U256::from_str("222222").unwrap()); + parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); header.set_number(1); - header.set_gas_limit(U256::from_str("222222").unwrap()); + header.set_gas_limit("222222".parse::().unwrap()); header.set_seal(vec![encode(&3usize).into_vec()]); // Do not report when signer not present. diff --git a/ethcore/src/engines/basic_authority.rs b/ethcore/src/engines/basic_authority.rs index a3f4b9114..38db41c53 100644 --- a/ethcore/src/engines/basic_authority.rs +++ b/ethcore/src/engines/basic_authority.rs @@ -16,7 +16,7 @@ //! A blockchain engine that supports a basic, non-BFT proof-of-authority. -use std::sync::Weak; +use std::sync::{Weak, Arc}; use std::collections::BTreeMap; use std::cmp; use util::*; @@ -256,6 +256,7 @@ impl Engine for BasicAuthority { #[cfg(test)] mod tests { + use std::sync::Arc; use util::*; use block::*; use error::{BlockError, Error}; diff --git a/ethcore/src/engines/instant_seal.rs b/ethcore/src/engines/instant_seal.rs index 4d297dc3f..94e3184ef 100644 --- a/ethcore/src/engines/instant_seal.rs +++ b/ethcore/src/engines/instant_seal.rs @@ -65,6 +65,7 @@ impl Engine for InstantSeal { #[cfg(test)] mod tests { + use std::sync::Arc; use util::*; use tests::helpers::*; use spec::Spec; diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 77b89e59c..b5a0d934f 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -35,7 +35,7 @@ pub use self::instant_seal::InstantSeal; pub use self::null_engine::NullEngine; pub use self::tendermint::Tendermint; -use std::sync::Weak; +use std::sync::{Weak, Arc}; use std::collections::{BTreeMap, HashMap}; use std::fmt; @@ -395,6 +395,7 @@ pub trait Engine : Sync + Send { /// Common engine utilities pub mod common { + use std::sync::Arc; use block::ExecutedBlock; use evm::env_info::{EnvInfo, LastHashes}; use error::Error; diff --git a/ethcore/src/engines/signer.rs b/ethcore/src/engines/signer.rs index 4ec4318c9..4069488ab 100644 --- a/ethcore/src/engines/signer.rs +++ b/ethcore/src/engines/signer.rs @@ -16,7 +16,8 @@ //! A signer used by Engines which need to sign messages. -use util::{Arc, H256, Address}; +use std::sync::Arc; +use util::{H256, Address}; use ethkey::Signature; use account_provider::{self, AccountProvider}; diff --git a/ethcore/src/engines/tendermint/message.rs b/ethcore/src/engines/tendermint/message.rs index 623284839..68bdcb0f7 100644 --- a/ethcore/src/engines/tendermint/message.rs +++ b/ethcore/src/engines/tendermint/message.rs @@ -199,6 +199,7 @@ pub fn message_hash(vote_step: VoteStep, block_hash: H256) -> H256 { #[cfg(test)] mod tests { + use std::sync::Arc; use util::*; use rlp::*; use account_provider::AccountProvider; diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index 5d334a610..a340db5d4 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -25,7 +25,7 @@ mod message; mod params; -use std::sync::Weak; +use std::sync::{Weak, Arc}; use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; use std::collections::{HashSet, BTreeMap, HashMap}; use std::cmp; diff --git a/ethcore/src/engines/validator_set/contract.rs b/ethcore/src/engines/validator_set/contract.rs index e93d06a27..7c1890379 100644 --- a/ethcore/src/engines/validator_set/contract.rs +++ b/ethcore/src/engines/validator_set/contract.rs @@ -126,6 +126,7 @@ impl ValidatorSet for ValidatorContract { #[cfg(test)] mod tests { + use std::sync::Arc; use rustc_hex::FromHex; use util::*; use rlp::encode; diff --git a/ethcore/src/engines/validator_set/multi.rs b/ethcore/src/engines/validator_set/multi.rs index 79a5a7d26..9acf6050b 100644 --- a/ethcore/src/engines/validator_set/multi.rs +++ b/ethcore/src/engines/validator_set/multi.rs @@ -142,6 +142,7 @@ impl ValidatorSet for Multi { #[cfg(test)] mod tests { + use std::sync::Arc; use std::collections::BTreeMap; use account_provider::AccountProvider; use client::{BlockChainClient, EngineClient}; diff --git a/ethcore/src/engines/validator_set/safe_contract.rs b/ethcore/src/engines/validator_set/safe_contract.rs index 172ec53b7..8148846e7 100644 --- a/ethcore/src/engines/validator_set/safe_contract.rs +++ b/ethcore/src/engines/validator_set/safe_contract.rs @@ -16,7 +16,7 @@ /// Validator set maintained in a contract, updated using `getValidators` method. -use std::sync::Weak; +use std::sync::{Weak, Arc}; use futures::Future; use native_contracts::ValidatorSet as Provider; @@ -422,6 +422,7 @@ impl ValidatorSet for ValidatorSafeContract { #[cfg(test)] mod tests { + use std::sync::Arc; use rustc_hex::FromHex; use util::*; use types::ids::BlockId; diff --git a/ethcore/src/engines/validator_set/test.rs b/ethcore/src/engines/validator_set/test.rs index 4960ee7be..25eeff66e 100644 --- a/ethcore/src/engines/validator_set/test.rs +++ b/ethcore/src/engines/validator_set/test.rs @@ -17,8 +17,9 @@ /// Used for Engine testing. use std::str::FromStr; +use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; -use util::{Arc, Bytes, H256, Address, HeapSizeOf}; +use util::{Bytes, H256, Address, HeapSizeOf}; use engines::{Call, Engine}; use header::{Header, BlockNumber}; diff --git a/ethcore/src/engines/vote_collector.rs b/ethcore/src/engines/vote_collector.rs index de9188e74..b934fdb2e 100644 --- a/ethcore/src/engines/vote_collector.rs +++ b/ethcore/src/engines/vote_collector.rs @@ -18,6 +18,7 @@ use std::fmt::Debug; use std::collections::{BTreeMap, HashSet, HashMap}; +use std::hash::Hash; use util::*; use rlp::{Encodable, RlpStream}; diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 06a4ad0d8..0f984517c 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -17,6 +17,7 @@ use std::path::Path; use std::cmp; use std::collections::{BTreeMap, HashMap}; +use std::sync::Arc; use ethash::{quick_get_difficulty, slow_get_seedhash, EthashManager}; use util::*; use block::*; @@ -563,6 +564,7 @@ impl Header { mod tests { use std::str::FromStr; use std::collections::BTreeMap; + use std::sync::Arc; use util::*; use block::*; use tests::helpers::*; diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index 9845d4575..a63605a81 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -16,6 +16,7 @@ //! Transaction Execution environment. use std::cmp; +use std::sync::Arc; use util::*; use evm::action_params::{ActionParams, ActionValue}; use state::{Backend as StateBackend, State, Substate, CleanupMode}; diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index d718fd256..5baca496d 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -16,6 +16,7 @@ //! Transaction Execution environment. use std::cmp; +use std::sync::Arc; use util::*; use evm::action_params::{ActionParams, ActionValue}; use state::{Backend as StateBackend, State, Substate, CleanupMode}; diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index cc5c8b6f3..241d90c32 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -16,6 +16,7 @@ use std::time::{Instant, Duration}; use std::collections::{BTreeMap, HashSet}; +use std::sync::Arc; use util::*; use using_queue::{UsingQueue, GetAction}; diff --git a/ethcore/src/service.rs b/ethcore/src/service.rs index e4c3d7519..5e65a4de8 100644 --- a/ethcore/src/service.rs +++ b/ethcore/src/service.rs @@ -16,6 +16,8 @@ //! Creates and registers client and network services. +use std::sync::Arc; +use std::path::Path; use util::*; use io::*; use spec::Spec; diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index c4afc93d7..a5426faa8 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -18,6 +18,8 @@ use std::io::Read; use std::collections::BTreeMap; +use std::path::Path; +use std::sync::Arc; use rustc_hex::FromHex; use super::genesis::Genesis; use super::seal::Generic as GenericSeal; diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index 8f528b9d8..1235fd289 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -17,6 +17,7 @@ //! Single account in the system. use std::fmt; +use std::sync::Arc; use std::collections::HashMap; use util::*; use pod_account::*; diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index 25c019dc0..1dd6204c3 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -23,6 +23,7 @@ use std::cell::{RefCell, RefMut}; use std::collections::hash_map::Entry; use std::collections::{HashMap, BTreeMap, HashSet}; use std::fmt; +use std::sync::Arc; use receipt::Receipt; use engines::Engine; diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index de5a3f75b..e2f6fdaf0 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -15,6 +15,7 @@ // along with Parity. If not, see . use std::collections::{VecDeque, HashSet}; +use std::sync::Arc; use lru_cache::LruCache; use util::cache::MemoryLruCache; use util::journaldb::JournalDB; @@ -23,7 +24,7 @@ use util::hash::{H256}; use util::hashdb::HashDB; use state::{self, Account}; use header::BlockNumber; -use util::{Arc, Address, DBTransaction, UtilError, Mutex, Hashable}; +use util::{Address, DBTransaction, UtilError, Mutex, Hashable}; use bloom_journal::{Bloom, BloomJournal}; use db::COL_ACCOUNT_BLOOM; use byteorder::{LittleEndian, ByteOrder}; diff --git a/ethcore/src/tests/client.rs b/ethcore/src/tests/client.rs index 54256b285..639fce3ab 100644 --- a/ethcore/src/tests/client.rs +++ b/ethcore/src/tests/client.rs @@ -15,6 +15,7 @@ // along with Parity. If not, see . use std::str::FromStr; +use std::sync::Arc; use io::IoChannel; use client::{BlockChainClient, MiningBlockChainClient, Client, ClientConfig, BlockId}; use state::{self, State, CleanupMode}; diff --git a/ethcore/src/tests/evm.rs b/ethcore/src/tests/evm.rs index c97fd4ac0..50cf4deb7 100644 --- a/ethcore/src/tests/evm.rs +++ b/ethcore/src/tests/evm.rs @@ -1,5 +1,6 @@ //! Tests of EVM integration with transaction execution. +use std::sync::Arc; use evm::action_params::{ActionParams, ActionValue}; use evm::env_info::EnvInfo; use evm::{Factory, VMType}; diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index 2c50f0fc2..2d48e470b 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -15,6 +15,7 @@ // along with Parity. If not, see . use std::collections::BTreeMap; +use std::sync::Arc; use ethkey::KeyPair; use io::*; use client::{BlockChainClient, Client, ClientConfig}; diff --git a/ethcore/src/verification/queue/mod.rs b/ethcore/src/verification/queue/mod.rs index 192a0dc77..ce0cb4179 100644 --- a/ethcore/src/verification/queue/mod.rs +++ b/ethcore/src/verification/queue/mod.rs @@ -19,7 +19,7 @@ use std::thread::{self, JoinHandle}; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrdering}; -use std::sync::{Condvar as SCondvar, Mutex as SMutex}; +use std::sync::{Condvar as SCondvar, Mutex as SMutex, Arc}; use std::cmp; use std::collections::{VecDeque, HashSet, HashMap}; use util::*; diff --git a/json/src/spec/authority_round.rs b/json/src/spec/authority_round.rs index 0fdbfbfb3..91a5fd828 100644 --- a/json/src/spec/authority_round.rs +++ b/json/src/spec/authority_round.rs @@ -63,11 +63,10 @@ pub struct AuthorityRound { #[cfg(test)] mod tests { + use util::{H160, U256}; use uint::Uint; - use util::U256; - use util::H160; - use serde_json; use hash::Address; + use serde_json; use spec::validator_set::ValidatorSet; use spec::authority_round::AuthorityRound; diff --git a/rpc/src/v1/tests/helpers/miner_service.rs b/rpc/src/v1/tests/helpers/miner_service.rs index ecc453622..ef9b5724b 100644 --- a/rpc/src/v1/tests/helpers/miner_service.rs +++ b/rpc/src/v1/tests/helpers/miner_service.rs @@ -18,8 +18,7 @@ use std::collections::{BTreeMap, HashMap}; use std::collections::hash_map::Entry; -use util::{Address, H256, Bytes, U256}; -use util::standard::*; +use util::{Address, H256, Bytes, U256, RwLock, Mutex}; use ethcore::error::{Error, CallError}; use ethcore::client::{MiningBlockChainClient, Executed, CallAnalytics}; use ethcore::block::{ClosedBlock, IsBlock}; diff --git a/sync/src/tests/chain.rs b/sync/src/tests/chain.rs index 23ed4b7ea..f9ce17b5b 100644 --- a/sync/src/tests/chain.rs +++ b/sync/src/tests/chain.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use util::*; +use std::sync::Arc; use ethcore::client::{TestBlockChainClient, BlockChainClient, BlockId, EachBlockWith}; use chain::{SyncState}; use super::helpers::*; diff --git a/sync/src/tests/consensus.rs b/sync/src/tests/consensus.rs index 6b91b11c6..499b7de17 100644 --- a/sync/src/tests/consensus.rs +++ b/sync/src/tests/consensus.rs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +use std::sync::Arc; use util::*; use io::{IoHandler, IoContext, IoChannel}; use ethcore::client::{BlockChainClient, Client}; diff --git a/sync/src/tests/helpers.rs b/sync/src/tests/helpers.rs index fa3039b63..3ac68b0fb 100644 --- a/sync/src/tests/helpers.rs +++ b/sync/src/tests/helpers.rs @@ -15,6 +15,7 @@ // along with Parity. If not, see . use std::collections::{VecDeque, HashSet, HashMap}; +use std::sync::Arc; use util::*; use network::*; use tests::snapshot::*; diff --git a/sync/src/tests/snapshot.rs b/sync/src/tests/snapshot.rs index 0a3b31fb0..9303aa9f7 100644 --- a/sync/src/tests/snapshot.rs +++ b/sync/src/tests/snapshot.rs @@ -15,6 +15,7 @@ // along with Parity. If not, see . use std::collections::HashMap; +use std::sync::Arc; use util::*; use ethcore::snapshot::{SnapshotService, ManifestData, RestorationStatus}; use ethcore::header::BlockNumber; diff --git a/util/network/src/tests.rs b/util/network/src/tests.rs index 52184061c..81325f57b 100644 --- a/util/network/src/tests.rs +++ b/util/network/src/tests.rs @@ -16,9 +16,10 @@ use super::*; use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering}; +use std::sync::Arc; use std::thread; use std::time::*; -use util::common::*; +use util::{Bytes, Mutex}; use io::TimerToken; use ethkey::{Random, Generator}; diff --git a/util/src/common.rs b/util/src/common.rs index 89ce9d95f..4bf3a06ed 100644 --- a/util/src/common.rs +++ b/util/src/common.rs @@ -17,13 +17,6 @@ //! Utils common types and macros global reexport. use std::io; -pub use standard::*; -pub use error::*; -pub use bytes::*; -pub use vector::*; -pub use sha3::*; -pub use bigint::prelude::*; -pub use bigint::hash; #[macro_export] macro_rules! vec_into { @@ -89,8 +82,8 @@ macro_rules! map_into { #[macro_export] macro_rules! flush { - ($arg:expr) => ($crate::flush($arg.into())); - ($($arg:tt)*) => ($crate::flush(format!("{}", format_args!($($arg)*)))); + ($arg:expr) => ($crate::common::flush($arg.into())); + ($($arg:tt)*) => ($crate::common::flush(format!("{}", format_args!($($arg)*)))); } #[macro_export] diff --git a/util/src/error.rs b/util/src/error.rs index 4ed2fc9bd..b0e887434 100644 --- a/util/src/error.rs +++ b/util/src/error.rs @@ -19,7 +19,7 @@ use rustc_hex::FromHexError; use rlp::DecoderError; use std::fmt; -use hash::H256; +use bigint::hash::H256; #[derive(Debug)] /// Error in database subsystem. diff --git a/util/src/journaldb/archivedb.rs b/util/src/journaldb/archivedb.rs index e882f3f18..fc893654a 100644 --- a/util/src/journaldb/archivedb.rs +++ b/util/src/journaldb/archivedb.rs @@ -17,13 +17,14 @@ //! Disk-backed `HashDB` implementation. use std::collections::HashMap; -use common::*; +use std::sync::Arc; use rlp::*; use hashdb::*; use memorydb::*; use super::{DB_PREFIX_LEN, LATEST_ERA_KEY}; use super::traits::JournalDB; use kvdb::{KeyValueDB, DBTransaction}; +use {Bytes, H256, BaseDataError, UtilError}; /// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay /// and latent-removal semantics. @@ -197,11 +198,12 @@ mod tests { #![cfg_attr(feature="dev", allow(blacklisted_name))] #![cfg_attr(feature="dev", allow(similar_names))] - use common::*; + use std::path::Path; use hashdb::{HashDB, DBValue}; use super::*; use journaldb::traits::JournalDB; use kvdb::Database; + use {Hashable, H32}; #[test] fn insert_same_in_fork() { diff --git a/util/src/journaldb/earlymergedb.rs b/util/src/journaldb/earlymergedb.rs index de0e19d6e..5f409d327 100644 --- a/util/src/journaldb/earlymergedb.rs +++ b/util/src/journaldb/earlymergedb.rs @@ -18,13 +18,17 @@ use std::fmt; use std::collections::HashMap; -use common::*; +use std::sync::Arc; +use parking_lot::RwLock; +use heapsize::HeapSizeOf; +use itertools::Itertools; use rlp::*; use hashdb::*; use memorydb::*; use super::{DB_PREFIX_LEN, LATEST_ERA_KEY}; use super::traits::JournalDB; use kvdb::{KeyValueDB, DBTransaction}; +use {H256, BaseDataError, UtilError, Bytes}; #[derive(Clone, PartialEq, Eq)] struct RefInfo { @@ -551,12 +555,13 @@ mod tests { #![cfg_attr(feature="dev", allow(blacklisted_name))] #![cfg_attr(feature="dev", allow(similar_names))] - use common::*; + use std::path::Path; use hashdb::{HashDB, DBValue}; use super::*; use super::super::traits::JournalDB; use ethcore_logger::init_log; use kvdb::{DatabaseConfig}; + use {Hashable, H32}; #[test] fn insert_same_in_fork() { diff --git a/util/src/journaldb/mod.rs b/util/src/journaldb/mod.rs index 80ddbf7a1..4f0f2fb1b 100644 --- a/util/src/journaldb/mod.rs +++ b/util/src/journaldb/mod.rs @@ -17,7 +17,7 @@ //! `JournalDB` interface and implementation. use std::{fmt, str}; -use common::*; +use std::sync::Arc; /// Export the journaldb module. pub mod traits; diff --git a/util/src/journaldb/overlayrecentdb.rs b/util/src/journaldb/overlayrecentdb.rs index 73a63bd4b..e96430e06 100644 --- a/util/src/journaldb/overlayrecentdb.rs +++ b/util/src/journaldb/overlayrecentdb.rs @@ -17,13 +17,16 @@ //! `JournalDB` over in-memory overlay use std::collections::HashMap; -use common::*; +use std::sync::Arc; +use parking_lot::RwLock; +use heapsize::HeapSizeOf; use rlp::*; use hashdb::*; use memorydb::*; use super::{DB_PREFIX_LEN, LATEST_ERA_KEY}; use kvdb::{KeyValueDB, DBTransaction}; use super::JournalDB; +use {H256, BaseDataError, UtilError, Bytes, H256FastMap}; /// Implementation of the `JournalDB` trait for a disk-backed database with a memory overlay /// and, possibly, latent-removal semantics. @@ -451,12 +454,13 @@ mod tests { #![cfg_attr(feature="dev", allow(blacklisted_name))] #![cfg_attr(feature="dev", allow(similar_names))] - use common::*; + use std::path::Path; use super::*; use hashdb::{HashDB, DBValue}; use ethcore_logger::init_log; use journaldb::JournalDB; use kvdb::Database; + use {H32, Hashable}; fn new_db(path: &Path) -> OverlayRecentDB { let backing = Arc::new(Database::open_default(path.to_str().unwrap()).unwrap()); diff --git a/util/src/journaldb/refcounteddb.rs b/util/src/journaldb/refcounteddb.rs index 772281abd..e38994700 100644 --- a/util/src/journaldb/refcounteddb.rs +++ b/util/src/journaldb/refcounteddb.rs @@ -17,7 +17,8 @@ //! Disk-backed, ref-counted `JournalDB` implementation. use std::collections::HashMap; -use common::*; +use std::sync::Arc; +use heapsize::HeapSizeOf; use rlp::*; use hashdb::*; use overlaydb::OverlayDB; @@ -25,6 +26,7 @@ use memorydb::MemoryDB; use super::{DB_PREFIX_LEN, LATEST_ERA_KEY}; use super::traits::JournalDB; use kvdb::{KeyValueDB, DBTransaction}; +use {UtilError, H256, Bytes}; /// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay /// and latent-removal semantics. @@ -211,10 +213,10 @@ mod tests { #![cfg_attr(feature="dev", allow(blacklisted_name))] #![cfg_attr(feature="dev", allow(similar_names))] - use common::*; use hashdb::{HashDB, DBValue}; use super::*; use super::super::traits::JournalDB; + use {Hashable}; #[test] fn long_history() { diff --git a/util/src/journaldb/traits.rs b/util/src/journaldb/traits.rs index 8a89f1368..1f14e9765 100644 --- a/util/src/journaldb/traits.rs +++ b/util/src/journaldb/traits.rs @@ -16,9 +16,10 @@ //! Disk-backed `HashDB` implementation. -use common::*; +use std::sync::Arc; use hashdb::*; use kvdb::{self, DBTransaction}; +use {Bytes, H256, UtilError}; /// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually /// exclusive actions. diff --git a/util/src/kvdb.rs b/util/src/kvdb.rs index 6692064ed..c231e682d 100644 --- a/util/src/kvdb.rs +++ b/util/src/kvdb.rs @@ -20,14 +20,17 @@ use std::{mem, fs}; use std::collections::{HashMap, BTreeMap}; use std::io::ErrorKind; use std::marker::PhantomData; -use std::path::PathBuf; +use std::path::{PathBuf, Path}; +use parking_lot::{Mutex, MutexGuard, RwLock}; -use common::*; use elastic_array::*; use hashdb::DBValue; use rlp::{UntrustedRlp, RlpType, Compressible}; use rocksdb::{DB, Writable, WriteBatch, WriteOptions, IteratorMode, DBIterator, Options, DBCompactionStyle, BlockBasedOptions, Direction, Cache, Column, ReadOptions}; +use {UtilError, Bytes}; + + #[cfg(target_os = "linux")] use regex::Regex; #[cfg(target_os = "linux")] diff --git a/util/src/lib.rs b/util/src/lib.rs index c2d9c59d3..544f60d39 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -112,7 +112,6 @@ extern crate ethcore_logger; #[macro_use] extern crate log as rlog; -pub mod standard; #[macro_use] pub mod common; pub mod error; @@ -135,7 +134,6 @@ pub mod snappy; pub mod cache; mod timer; -pub use common::*; pub use misc::*; pub use hashdb::*; pub use memorydb::MemoryDB; @@ -146,7 +144,17 @@ pub use trie::{Trie, TrieMut, TrieDB, TrieDBMut, TrieFactory, TrieError, SecTrie pub use semantic_version::*; pub use kvdb::*; pub use timer::*; +pub use error::*; +pub use bytes::*; +pub use vector::*; +pub use sha3::*; +pub use bigint::prelude::*; +pub use bigint::hash; + pub use ansi_term::{Colour, Style}; +pub use heapsize::HeapSizeOf; +pub use itertools::Itertools; +pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard}; /// 160-bit integer representing account address pub type Address = H160; diff --git a/util/src/migration/tests.rs b/util/src/migration/tests.rs index 7cd19009a..64f2d976a 100644 --- a/util/src/migration/tests.rs +++ b/util/src/migration/tests.rs @@ -19,12 +19,11 @@ //! are performed in temp sub-directories. use std::collections::BTreeMap; -use common::*; +use std::sync::Arc; +use std::path::{Path, PathBuf}; use migration::{Batch, Config, Error, SimpleMigration, Migration, Manager}; use kvdb::Database; - use devtools::RandomTempPath; -use std::path::PathBuf; fn db_path(path: &Path) -> PathBuf { let mut p = path.to_owned(); diff --git a/util/src/misc.rs b/util/src/misc.rs index 120805f0c..e33b5e857 100644 --- a/util/src/misc.rs +++ b/util/src/misc.rs @@ -16,9 +16,9 @@ //! Diff misc. -use common::*; use rlp::RlpStream; use target_info::Target; +use Bytes; include!(concat!(env!("OUT_DIR"), "/version.rs")); include!(concat!(env!("OUT_DIR"), "/rustc_version.rs")); diff --git a/util/src/standard.rs b/util/src/standard.rs deleted file mode 100644 index cc67b0de5..000000000 --- a/util/src/standard.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015-2017 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 . - -//! Std lib global reexports. - -pub use std::path::Path; -pub use std::hash::{Hash, Hasher}; - -pub use std::sync::Arc; - -pub use heapsize::HeapSizeOf; -pub use itertools::Itertools; - -pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard}; diff --git a/util/src/trie/triedb.rs b/util/src/trie/triedb.rs index a8600914c..262a874ea 100644 --- a/util/src/trie/triedb.rs +++ b/util/src/trie/triedb.rs @@ -15,13 +15,14 @@ // along with Parity. If not, see . use std::fmt; -use common::*; +use itertools::Itertools; use hashdb::*; use nibbleslice::*; use rlp::*; use super::node::{Node, OwnedNode}; use super::lookup::Lookup; use super::{Trie, TrieItem, TrieError, TrieIterator, Query}; +use {ToPretty, Bytes, H256}; /// A `Trie` implementation using a generic `HashDB` backing database. ///