removed util::common
This commit is contained in:
		
							parent
							
								
									eecd823d32
								
							
						
					
					
						commit
						c4989ddc44
					
				@ -33,13 +33,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::io;
 | 
					use std::io;
 | 
				
			||||||
use std::{fmt, mem, time};
 | 
					use std::{fmt, mem, time};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use std::collections::VecDeque;
 | 
					use std::collections::VecDeque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use futures::{self, Future, BoxFuture};
 | 
					use futures::{self, Future, BoxFuture};
 | 
				
			||||||
use futures_cpupool::CpuPool;
 | 
					use futures_cpupool::CpuPool;
 | 
				
			||||||
use ntp;
 | 
					use ntp;
 | 
				
			||||||
use time::{Duration, Timespec};
 | 
					use time::{Duration, Timespec};
 | 
				
			||||||
use util::{Arc, RwLock};
 | 
					use util::RwLock;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Time checker error.
 | 
					/// Time checker error.
 | 
				
			||||||
#[derive(Debug, Clone, PartialEq)]
 | 
					#[derive(Debug, Clone, PartialEq)]
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//! Interface for Evm externalities.
 | 
					//! Interface for Evm externalities.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use call_type::CallType;
 | 
					use call_type::CallType;
 | 
				
			||||||
use env_info::EnvInfo;
 | 
					use env_info::EnvInfo;
 | 
				
			||||||
 | 
				
			|||||||
@ -25,6 +25,7 @@ mod shared_cache;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::marker::PhantomData;
 | 
					use std::marker::PhantomData;
 | 
				
			||||||
use std::{cmp, mem};
 | 
					use std::{cmp, mem};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use self::gasometer::Gasometer;
 | 
					use self::gasometer::Gasometer;
 | 
				
			||||||
use self::stack::{Stack, VecStack};
 | 
					use self::stack::{Stack, VecStack};
 | 
				
			||||||
use self::memory::Memory;
 | 
					use self::memory::Memory;
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::fmt::Debug;
 | 
					use std::fmt::Debug;
 | 
				
			||||||
use std::str::FromStr;
 | 
					use std::str::FromStr;
 | 
				
			||||||
 | 
					use std::hash::Hash;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use std::collections::{HashMap, HashSet};
 | 
					use std::collections::{HashMap, HashSet};
 | 
				
			||||||
use rustc_hex::FromHex;
 | 
					use rustc_hex::FromHex;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@
 | 
				
			|||||||
//! Blockchain database.
 | 
					//! Blockchain database.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::{HashMap, HashSet};
 | 
					use std::collections::{HashMap, HashSet};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use std::mem;
 | 
					use std::mem;
 | 
				
			||||||
use bloomchain as bc;
 | 
					use bloomchain as bc;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@
 | 
				
			|||||||
//! Test client.
 | 
					//! Test client.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrder};
 | 
					use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrder};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use std::collections::{HashMap, BTreeMap};
 | 
					use std::collections::{HashMap, BTreeMap};
 | 
				
			||||||
use std::mem;
 | 
					use std::mem;
 | 
				
			||||||
use rustc_hex::FromHex;
 | 
					use rustc_hex::FromHex;
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@
 | 
				
			|||||||
//! A blockchain engine that supports a non-instant BFT proof-of-authority.
 | 
					//! A blockchain engine that supports a non-instant BFT proof-of-authority.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering as AtomicOrdering};
 | 
					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::time::{UNIX_EPOCH, Duration};
 | 
				
			||||||
use std::collections::{BTreeMap, HashSet, HashMap};
 | 
					use std::collections::{BTreeMap, HashSet, HashMap};
 | 
				
			||||||
use std::cmp;
 | 
					use std::cmp;
 | 
				
			||||||
@ -853,8 +853,8 @@ impl Engine for AuthorityRound {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
 | 
						use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
 | 
				
			||||||
	use std::str::FromStr;
 | 
					 | 
				
			||||||
	use util::*;
 | 
						use util::*;
 | 
				
			||||||
	use header::Header;
 | 
						use header::Header;
 | 
				
			||||||
	use error::{Error, BlockError};
 | 
						use error::{Error, BlockError};
 | 
				
			||||||
@ -944,10 +944,10 @@ mod tests {
 | 
				
			|||||||
		let addr = tap.insert_account("0".sha3().into(), "0").unwrap();
 | 
							let addr = tap.insert_account("0".sha3().into(), "0").unwrap();
 | 
				
			||||||
		let mut parent_header: Header = Header::default();
 | 
							let mut parent_header: Header = Header::default();
 | 
				
			||||||
		parent_header.set_seal(vec![encode(&0usize).into_vec()]);
 | 
							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::<U256>().unwrap());
 | 
				
			||||||
		let mut header: Header = Header::default();
 | 
							let mut header: Header = Header::default();
 | 
				
			||||||
		header.set_number(1);
 | 
							header.set_number(1);
 | 
				
			||||||
		header.set_gas_limit(U256::from_str("222222").unwrap());
 | 
							header.set_gas_limit("222222".parse::<U256>().unwrap());
 | 
				
			||||||
		header.set_author(addr);
 | 
							header.set_author(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		let engine = Spec::new_test_round().engine;
 | 
							let engine = Spec::new_test_round().engine;
 | 
				
			||||||
@ -970,10 +970,10 @@ mod tests {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		let mut parent_header: Header = Header::default();
 | 
							let mut parent_header: Header = Header::default();
 | 
				
			||||||
		parent_header.set_seal(vec![encode(&0usize).into_vec()]);
 | 
							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::<U256>().unwrap());
 | 
				
			||||||
		let mut header: Header = Header::default();
 | 
							let mut header: Header = Header::default();
 | 
				
			||||||
		header.set_number(1);
 | 
							header.set_number(1);
 | 
				
			||||||
		header.set_gas_limit(U256::from_str("222222").unwrap());
 | 
							header.set_gas_limit("222222".parse::<U256>().unwrap());
 | 
				
			||||||
		header.set_author(addr);
 | 
							header.set_author(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		let engine = Spec::new_test_round().engine;
 | 
							let engine = Spec::new_test_round().engine;
 | 
				
			||||||
@ -996,10 +996,10 @@ mod tests {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		let mut parent_header: Header = Header::default();
 | 
							let mut parent_header: Header = Header::default();
 | 
				
			||||||
		parent_header.set_seal(vec![encode(&4usize).into_vec()]);
 | 
							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::<U256>().unwrap());
 | 
				
			||||||
		let mut header: Header = Header::default();
 | 
							let mut header: Header = Header::default();
 | 
				
			||||||
		header.set_number(1);
 | 
							header.set_number(1);
 | 
				
			||||||
		header.set_gas_limit(U256::from_str("222222").unwrap());
 | 
							header.set_gas_limit("222222".parse::<U256>().unwrap());
 | 
				
			||||||
		header.set_author(addr);
 | 
							header.set_author(addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		let engine = Spec::new_test_round().engine;
 | 
							let engine = Spec::new_test_round().engine;
 | 
				
			||||||
@ -1017,7 +1017,7 @@ mod tests {
 | 
				
			|||||||
	fn reports_skipped() {
 | 
						fn reports_skipped() {
 | 
				
			||||||
		let last_benign = Arc::new(AtomicUsize::new(0));
 | 
							let last_benign = Arc::new(AtomicUsize::new(0));
 | 
				
			||||||
		let params = AuthorityRoundParams {
 | 
							let params = AuthorityRoundParams {
 | 
				
			||||||
			gas_limit_bound_divisor: U256::from_str("400").unwrap(),
 | 
								gas_limit_bound_divisor: "400".parse::<U256>().unwrap(),
 | 
				
			||||||
			step_duration: Default::default(),
 | 
								step_duration: Default::default(),
 | 
				
			||||||
			block_reward: Default::default(),
 | 
								block_reward: Default::default(),
 | 
				
			||||||
			registrar: Default::default(),
 | 
								registrar: Default::default(),
 | 
				
			||||||
@ -1032,10 +1032,10 @@ mod tests {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		let mut parent_header: Header = Header::default();
 | 
							let mut parent_header: Header = Header::default();
 | 
				
			||||||
		parent_header.set_seal(vec![encode(&1usize).into_vec()]);
 | 
							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::<U256>().unwrap());
 | 
				
			||||||
		let mut header: Header = Header::default();
 | 
							let mut header: Header = Header::default();
 | 
				
			||||||
		header.set_number(1);
 | 
							header.set_number(1);
 | 
				
			||||||
		header.set_gas_limit(U256::from_str("222222").unwrap());
 | 
							header.set_gas_limit("222222".parse::<U256>().unwrap());
 | 
				
			||||||
		header.set_seal(vec![encode(&3usize).into_vec()]);
 | 
							header.set_seal(vec![encode(&3usize).into_vec()]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Do not report when signer not present.
 | 
							// Do not report when signer not present.
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//! A blockchain engine that supports a basic, non-BFT proof-of-authority.
 | 
					//! 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::collections::BTreeMap;
 | 
				
			||||||
use std::cmp;
 | 
					use std::cmp;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
@ -256,6 +256,7 @@ impl Engine for BasicAuthority {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use util::*;
 | 
						use util::*;
 | 
				
			||||||
	use block::*;
 | 
						use block::*;
 | 
				
			||||||
	use error::{BlockError, Error};
 | 
						use error::{BlockError, Error};
 | 
				
			||||||
 | 
				
			|||||||
@ -65,6 +65,7 @@ impl Engine for InstantSeal {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use util::*;
 | 
						use util::*;
 | 
				
			||||||
	use tests::helpers::*;
 | 
						use tests::helpers::*;
 | 
				
			||||||
	use spec::Spec;
 | 
						use spec::Spec;
 | 
				
			||||||
 | 
				
			|||||||
@ -35,7 +35,7 @@ pub use self::instant_seal::InstantSeal;
 | 
				
			|||||||
pub use self::null_engine::NullEngine;
 | 
					pub use self::null_engine::NullEngine;
 | 
				
			||||||
pub use self::tendermint::Tendermint;
 | 
					pub use self::tendermint::Tendermint;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::sync::Weak;
 | 
					use std::sync::{Weak, Arc};
 | 
				
			||||||
use std::collections::{BTreeMap, HashMap};
 | 
					use std::collections::{BTreeMap, HashMap};
 | 
				
			||||||
use std::fmt;
 | 
					use std::fmt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -395,6 +395,7 @@ pub trait Engine : Sync + Send {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Common engine utilities
 | 
					/// Common engine utilities
 | 
				
			||||||
pub mod common {
 | 
					pub mod common {
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use block::ExecutedBlock;
 | 
						use block::ExecutedBlock;
 | 
				
			||||||
	use evm::env_info::{EnvInfo, LastHashes};
 | 
						use evm::env_info::{EnvInfo, LastHashes};
 | 
				
			||||||
	use error::Error;
 | 
						use error::Error;
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//! A signer used by Engines which need to sign messages.
 | 
					//! 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 ethkey::Signature;
 | 
				
			||||||
use account_provider::{self, AccountProvider};
 | 
					use account_provider::{self, AccountProvider};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -199,6 +199,7 @@ pub fn message_hash(vote_step: VoteStep, block_hash: H256) -> H256 {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use util::*;
 | 
						use util::*;
 | 
				
			||||||
	use rlp::*;
 | 
						use rlp::*;
 | 
				
			||||||
	use account_provider::AccountProvider;
 | 
						use account_provider::AccountProvider;
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,7 @@
 | 
				
			|||||||
mod message;
 | 
					mod message;
 | 
				
			||||||
mod params;
 | 
					mod params;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::sync::Weak;
 | 
					use std::sync::{Weak, Arc};
 | 
				
			||||||
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
 | 
					use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
 | 
				
			||||||
use std::collections::{HashSet, BTreeMap, HashMap};
 | 
					use std::collections::{HashSet, BTreeMap, HashMap};
 | 
				
			||||||
use std::cmp;
 | 
					use std::cmp;
 | 
				
			||||||
 | 
				
			|||||||
@ -126,6 +126,7 @@ impl ValidatorSet for ValidatorContract {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use rustc_hex::FromHex;
 | 
						use rustc_hex::FromHex;
 | 
				
			||||||
	use util::*;
 | 
						use util::*;
 | 
				
			||||||
	use rlp::encode;
 | 
						use rlp::encode;
 | 
				
			||||||
 | 
				
			|||||||
@ -142,6 +142,7 @@ impl ValidatorSet for Multi {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use std::collections::BTreeMap;
 | 
						use std::collections::BTreeMap;
 | 
				
			||||||
	use account_provider::AccountProvider;
 | 
						use account_provider::AccountProvider;
 | 
				
			||||||
	use client::{BlockChainClient, EngineClient};
 | 
						use client::{BlockChainClient, EngineClient};
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Validator set maintained in a contract, updated using `getValidators` method.
 | 
					/// Validator set maintained in a contract, updated using `getValidators` method.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::sync::Weak;
 | 
					use std::sync::{Weak, Arc};
 | 
				
			||||||
use futures::Future;
 | 
					use futures::Future;
 | 
				
			||||||
use native_contracts::ValidatorSet as Provider;
 | 
					use native_contracts::ValidatorSet as Provider;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -422,6 +422,7 @@ impl ValidatorSet for ValidatorSafeContract {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use rustc_hex::FromHex;
 | 
						use rustc_hex::FromHex;
 | 
				
			||||||
	use util::*;
 | 
						use util::*;
 | 
				
			||||||
	use types::ids::BlockId;
 | 
						use types::ids::BlockId;
 | 
				
			||||||
 | 
				
			|||||||
@ -17,8 +17,9 @@
 | 
				
			|||||||
/// Used for Engine testing.
 | 
					/// Used for Engine testing.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::str::FromStr;
 | 
					use std::str::FromStr;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
 | 
					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 engines::{Call, Engine};
 | 
				
			||||||
use header::{Header, BlockNumber};
 | 
					use header::{Header, BlockNumber};
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::fmt::Debug;
 | 
					use std::fmt::Debug;
 | 
				
			||||||
use std::collections::{BTreeMap, HashSet, HashMap};
 | 
					use std::collections::{BTreeMap, HashSet, HashMap};
 | 
				
			||||||
 | 
					use std::hash::Hash;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use rlp::{Encodable, RlpStream};
 | 
					use rlp::{Encodable, RlpStream};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@
 | 
				
			|||||||
use std::path::Path;
 | 
					use std::path::Path;
 | 
				
			||||||
use std::cmp;
 | 
					use std::cmp;
 | 
				
			||||||
use std::collections::{BTreeMap, HashMap};
 | 
					use std::collections::{BTreeMap, HashMap};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use ethash::{quick_get_difficulty, slow_get_seedhash, EthashManager};
 | 
					use ethash::{quick_get_difficulty, slow_get_seedhash, EthashManager};
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use block::*;
 | 
					use block::*;
 | 
				
			||||||
@ -563,6 +564,7 @@ impl Header {
 | 
				
			|||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
	use std::str::FromStr;
 | 
						use std::str::FromStr;
 | 
				
			||||||
	use std::collections::BTreeMap;
 | 
						use std::collections::BTreeMap;
 | 
				
			||||||
 | 
						use std::sync::Arc;
 | 
				
			||||||
	use util::*;
 | 
						use util::*;
 | 
				
			||||||
	use block::*;
 | 
						use block::*;
 | 
				
			||||||
	use tests::helpers::*;
 | 
						use tests::helpers::*;
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//! Transaction Execution environment.
 | 
					//! Transaction Execution environment.
 | 
				
			||||||
use std::cmp;
 | 
					use std::cmp;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use evm::action_params::{ActionParams, ActionValue};
 | 
					use evm::action_params::{ActionParams, ActionValue};
 | 
				
			||||||
use state::{Backend as StateBackend, State, Substate, CleanupMode};
 | 
					use state::{Backend as StateBackend, State, Substate, CleanupMode};
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//! Transaction Execution environment.
 | 
					//! Transaction Execution environment.
 | 
				
			||||||
use std::cmp;
 | 
					use std::cmp;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use evm::action_params::{ActionParams, ActionValue};
 | 
					use evm::action_params::{ActionParams, ActionValue};
 | 
				
			||||||
use state::{Backend as StateBackend, State, Substate, CleanupMode};
 | 
					use state::{Backend as StateBackend, State, Substate, CleanupMode};
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::time::{Instant, Duration};
 | 
					use std::time::{Instant, Duration};
 | 
				
			||||||
use std::collections::{BTreeMap, HashSet};
 | 
					use std::collections::{BTreeMap, HashSet};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use using_queue::{UsingQueue, GetAction};
 | 
					use using_queue::{UsingQueue, GetAction};
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//! Creates and registers client and network services.
 | 
					//! Creates and registers client and network services.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					use std::path::Path;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use io::*;
 | 
					use io::*;
 | 
				
			||||||
use spec::Spec;
 | 
					use spec::Spec;
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::io::Read;
 | 
					use std::io::Read;
 | 
				
			||||||
use std::collections::BTreeMap;
 | 
					use std::collections::BTreeMap;
 | 
				
			||||||
 | 
					use std::path::Path;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use rustc_hex::FromHex;
 | 
					use rustc_hex::FromHex;
 | 
				
			||||||
use super::genesis::Genesis;
 | 
					use super::genesis::Genesis;
 | 
				
			||||||
use super::seal::Generic as GenericSeal;
 | 
					use super::seal::Generic as GenericSeal;
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@
 | 
				
			|||||||
//! Single account in the system.
 | 
					//! Single account in the system.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::fmt;
 | 
					use std::fmt;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use std::collections::HashMap;
 | 
					use std::collections::HashMap;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use pod_account::*;
 | 
					use pod_account::*;
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,7 @@ use std::cell::{RefCell, RefMut};
 | 
				
			|||||||
use std::collections::hash_map::Entry;
 | 
					use std::collections::hash_map::Entry;
 | 
				
			||||||
use std::collections::{HashMap, BTreeMap, HashSet};
 | 
					use std::collections::{HashMap, BTreeMap, HashSet};
 | 
				
			||||||
use std::fmt;
 | 
					use std::fmt;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use receipt::Receipt;
 | 
					use receipt::Receipt;
 | 
				
			||||||
use engines::Engine;
 | 
					use engines::Engine;
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@
 | 
				
			|||||||
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
					// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::{VecDeque, HashSet};
 | 
					use std::collections::{VecDeque, HashSet};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use lru_cache::LruCache;
 | 
					use lru_cache::LruCache;
 | 
				
			||||||
use util::cache::MemoryLruCache;
 | 
					use util::cache::MemoryLruCache;
 | 
				
			||||||
use util::journaldb::JournalDB;
 | 
					use util::journaldb::JournalDB;
 | 
				
			||||||
@ -23,7 +24,7 @@ use util::hash::{H256};
 | 
				
			|||||||
use util::hashdb::HashDB;
 | 
					use util::hashdb::HashDB;
 | 
				
			||||||
use state::{self, Account};
 | 
					use state::{self, Account};
 | 
				
			||||||
use header::BlockNumber;
 | 
					use header::BlockNumber;
 | 
				
			||||||
use util::{Arc, Address, DBTransaction, UtilError, Mutex, Hashable};
 | 
					use util::{Address, DBTransaction, UtilError, Mutex, Hashable};
 | 
				
			||||||
use bloom_journal::{Bloom, BloomJournal};
 | 
					use bloom_journal::{Bloom, BloomJournal};
 | 
				
			||||||
use db::COL_ACCOUNT_BLOOM;
 | 
					use db::COL_ACCOUNT_BLOOM;
 | 
				
			||||||
use byteorder::{LittleEndian, ByteOrder};
 | 
					use byteorder::{LittleEndian, ByteOrder};
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@
 | 
				
			|||||||
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
					// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::str::FromStr;
 | 
					use std::str::FromStr;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use io::IoChannel;
 | 
					use io::IoChannel;
 | 
				
			||||||
use client::{BlockChainClient, MiningBlockChainClient, Client, ClientConfig, BlockId};
 | 
					use client::{BlockChainClient, MiningBlockChainClient, Client, ClientConfig, BlockId};
 | 
				
			||||||
use state::{self, State, CleanupMode};
 | 
					use state::{self, State, CleanupMode};
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
//! Tests of EVM integration with transaction execution.
 | 
					//! Tests of EVM integration with transaction execution.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use evm::action_params::{ActionParams, ActionValue};
 | 
					use evm::action_params::{ActionParams, ActionValue};
 | 
				
			||||||
use evm::env_info::EnvInfo;
 | 
					use evm::env_info::EnvInfo;
 | 
				
			||||||
use evm::{Factory, VMType};
 | 
					use evm::{Factory, VMType};
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@
 | 
				
			|||||||
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
					// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::BTreeMap;
 | 
					use std::collections::BTreeMap;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use ethkey::KeyPair;
 | 
					use ethkey::KeyPair;
 | 
				
			||||||
use io::*;
 | 
					use io::*;
 | 
				
			||||||
use client::{BlockChainClient, Client, ClientConfig};
 | 
					use client::{BlockChainClient, Client, ClientConfig};
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::thread::{self, JoinHandle};
 | 
					use std::thread::{self, JoinHandle};
 | 
				
			||||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrdering};
 | 
					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::cmp;
 | 
				
			||||||
use std::collections::{VecDeque, HashSet, HashMap};
 | 
					use std::collections::{VecDeque, HashSet, HashMap};
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
 | 
				
			|||||||
@ -63,11 +63,10 @@ pub struct AuthorityRound {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests {
 | 
					mod tests {
 | 
				
			||||||
 | 
						use util::{H160, U256};
 | 
				
			||||||
	use uint::Uint;
 | 
						use uint::Uint;
 | 
				
			||||||
	use util::U256;
 | 
					 | 
				
			||||||
	use util::H160;
 | 
					 | 
				
			||||||
	use serde_json;
 | 
					 | 
				
			||||||
	use hash::Address;
 | 
						use hash::Address;
 | 
				
			||||||
 | 
						use serde_json;
 | 
				
			||||||
	use spec::validator_set::ValidatorSet;
 | 
						use spec::validator_set::ValidatorSet;
 | 
				
			||||||
	use spec::authority_round::AuthorityRound;
 | 
						use spec::authority_round::AuthorityRound;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -18,8 +18,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::collections::{BTreeMap, HashMap};
 | 
					use std::collections::{BTreeMap, HashMap};
 | 
				
			||||||
use std::collections::hash_map::Entry;
 | 
					use std::collections::hash_map::Entry;
 | 
				
			||||||
use util::{Address, H256, Bytes, U256};
 | 
					use util::{Address, H256, Bytes, U256, RwLock, Mutex};
 | 
				
			||||||
use util::standard::*;
 | 
					 | 
				
			||||||
use ethcore::error::{Error, CallError};
 | 
					use ethcore::error::{Error, CallError};
 | 
				
			||||||
use ethcore::client::{MiningBlockChainClient, Executed, CallAnalytics};
 | 
					use ethcore::client::{MiningBlockChainClient, Executed, CallAnalytics};
 | 
				
			||||||
use ethcore::block::{ClosedBlock, IsBlock};
 | 
					use ethcore::block::{ClosedBlock, IsBlock};
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,7 @@
 | 
				
			|||||||
// You should have received a copy of the GNU General Public License
 | 
					// You should have received a copy of the GNU General Public License
 | 
				
			||||||
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
					// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use util::*;
 | 
					use std::sync::Arc;
 | 
				
			||||||
use ethcore::client::{TestBlockChainClient, BlockChainClient, BlockId, EachBlockWith};
 | 
					use ethcore::client::{TestBlockChainClient, BlockChainClient, BlockId, EachBlockWith};
 | 
				
			||||||
use chain::{SyncState};
 | 
					use chain::{SyncState};
 | 
				
			||||||
use super::helpers::*;
 | 
					use super::helpers::*;
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,7 @@
 | 
				
			|||||||
// You should have received a copy of the GNU General Public License
 | 
					// You should have received a copy of the GNU General Public License
 | 
				
			||||||
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
					// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use io::{IoHandler, IoContext, IoChannel};
 | 
					use io::{IoHandler, IoContext, IoChannel};
 | 
				
			||||||
use ethcore::client::{BlockChainClient, Client};
 | 
					use ethcore::client::{BlockChainClient, Client};
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@
 | 
				
			|||||||
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
					// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::{VecDeque, HashSet, HashMap};
 | 
					use std::collections::{VecDeque, HashSet, HashMap};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use network::*;
 | 
					use network::*;
 | 
				
			||||||
use tests::snapshot::*;
 | 
					use tests::snapshot::*;
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@
 | 
				
			|||||||
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
					// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::HashMap;
 | 
					use std::collections::HashMap;
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use util::*;
 | 
					use util::*;
 | 
				
			||||||
use ethcore::snapshot::{SnapshotService, ManifestData, RestorationStatus};
 | 
					use ethcore::snapshot::{SnapshotService, ManifestData, RestorationStatus};
 | 
				
			||||||
use ethcore::header::BlockNumber;
 | 
					use ethcore::header::BlockNumber;
 | 
				
			||||||
 | 
				
			|||||||
@ -16,9 +16,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use super::*;
 | 
					use super::*;
 | 
				
			||||||
use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
 | 
					use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
 | 
				
			||||||
 | 
					use std::sync::Arc;
 | 
				
			||||||
use std::thread;
 | 
					use std::thread;
 | 
				
			||||||
use std::time::*;
 | 
					use std::time::*;
 | 
				
			||||||
use util::common::*;
 | 
					use util::{Bytes, Mutex};
 | 
				
			||||||
use io::TimerToken;
 | 
					use io::TimerToken;
 | 
				
			||||||
use ethkey::{Random, Generator};
 | 
					use ethkey::{Random, Generator};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -17,13 +17,6 @@
 | 
				
			|||||||
//! Utils common types and macros global reexport.
 | 
					//! Utils common types and macros global reexport.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::io;
 | 
					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_export]
 | 
				
			||||||
macro_rules! vec_into {
 | 
					macro_rules! vec_into {
 | 
				
			||||||
@ -89,8 +82,8 @@ macro_rules! map_into {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[macro_export]
 | 
					#[macro_export]
 | 
				
			||||||
macro_rules! flush {
 | 
					macro_rules! flush {
 | 
				
			||||||
	($arg:expr) => ($crate::flush($arg.into()));
 | 
						($arg:expr) => ($crate::common::flush($arg.into()));
 | 
				
			||||||
	($($arg:tt)*) => ($crate::flush(format!("{}", format_args!($($arg)*))));
 | 
						($($arg:tt)*) => ($crate::common::flush(format!("{}", format_args!($($arg)*))));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[macro_export]
 | 
					#[macro_export]
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,7 @@
 | 
				
			|||||||
use rustc_hex::FromHexError;
 | 
					use rustc_hex::FromHexError;
 | 
				
			||||||
use rlp::DecoderError;
 | 
					use rlp::DecoderError;
 | 
				
			||||||
use std::fmt;
 | 
					use std::fmt;
 | 
				
			||||||
use hash::H256;
 | 
					use bigint::hash::H256;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Debug)]
 | 
					#[derive(Debug)]
 | 
				
			||||||
/// Error in database subsystem.
 | 
					/// Error in database subsystem.
 | 
				
			||||||
 | 
				
			|||||||
@ -17,13 +17,14 @@
 | 
				
			|||||||
//! Disk-backed `HashDB` implementation.
 | 
					//! Disk-backed `HashDB` implementation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::HashMap;
 | 
					use std::collections::HashMap;
 | 
				
			||||||
use common::*;
 | 
					use std::sync::Arc;
 | 
				
			||||||
use rlp::*;
 | 
					use rlp::*;
 | 
				
			||||||
use hashdb::*;
 | 
					use hashdb::*;
 | 
				
			||||||
use memorydb::*;
 | 
					use memorydb::*;
 | 
				
			||||||
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
 | 
					use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
 | 
				
			||||||
use super::traits::JournalDB;
 | 
					use super::traits::JournalDB;
 | 
				
			||||||
use kvdb::{KeyValueDB, DBTransaction};
 | 
					use kvdb::{KeyValueDB, DBTransaction};
 | 
				
			||||||
 | 
					use {Bytes, H256, BaseDataError, UtilError};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
 | 
					/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
 | 
				
			||||||
/// and latent-removal semantics.
 | 
					/// and latent-removal semantics.
 | 
				
			||||||
@ -197,11 +198,12 @@ mod tests {
 | 
				
			|||||||
	#![cfg_attr(feature="dev", allow(blacklisted_name))]
 | 
						#![cfg_attr(feature="dev", allow(blacklisted_name))]
 | 
				
			||||||
	#![cfg_attr(feature="dev", allow(similar_names))]
 | 
						#![cfg_attr(feature="dev", allow(similar_names))]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	use common::*;
 | 
						use std::path::Path;
 | 
				
			||||||
	use hashdb::{HashDB, DBValue};
 | 
						use hashdb::{HashDB, DBValue};
 | 
				
			||||||
	use super::*;
 | 
						use super::*;
 | 
				
			||||||
	use journaldb::traits::JournalDB;
 | 
						use journaldb::traits::JournalDB;
 | 
				
			||||||
	use kvdb::Database;
 | 
						use kvdb::Database;
 | 
				
			||||||
 | 
						use {Hashable, H32};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	#[test]
 | 
						#[test]
 | 
				
			||||||
	fn insert_same_in_fork() {
 | 
						fn insert_same_in_fork() {
 | 
				
			||||||
 | 
				
			|||||||
@ -18,13 +18,17 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::fmt;
 | 
					use std::fmt;
 | 
				
			||||||
use std::collections::HashMap;
 | 
					use std::collections::HashMap;
 | 
				
			||||||
use common::*;
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					use parking_lot::RwLock;
 | 
				
			||||||
 | 
					use heapsize::HeapSizeOf;
 | 
				
			||||||
 | 
					use itertools::Itertools;
 | 
				
			||||||
use rlp::*;
 | 
					use rlp::*;
 | 
				
			||||||
use hashdb::*;
 | 
					use hashdb::*;
 | 
				
			||||||
use memorydb::*;
 | 
					use memorydb::*;
 | 
				
			||||||
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
 | 
					use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
 | 
				
			||||||
use super::traits::JournalDB;
 | 
					use super::traits::JournalDB;
 | 
				
			||||||
use kvdb::{KeyValueDB, DBTransaction};
 | 
					use kvdb::{KeyValueDB, DBTransaction};
 | 
				
			||||||
 | 
					use {H256, BaseDataError, UtilError, Bytes};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Clone, PartialEq, Eq)]
 | 
					#[derive(Clone, PartialEq, Eq)]
 | 
				
			||||||
struct RefInfo {
 | 
					struct RefInfo {
 | 
				
			||||||
@ -551,12 +555,13 @@ mod tests {
 | 
				
			|||||||
	#![cfg_attr(feature="dev", allow(blacklisted_name))]
 | 
						#![cfg_attr(feature="dev", allow(blacklisted_name))]
 | 
				
			||||||
	#![cfg_attr(feature="dev", allow(similar_names))]
 | 
						#![cfg_attr(feature="dev", allow(similar_names))]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	use common::*;
 | 
						use std::path::Path;
 | 
				
			||||||
	use hashdb::{HashDB, DBValue};
 | 
						use hashdb::{HashDB, DBValue};
 | 
				
			||||||
	use super::*;
 | 
						use super::*;
 | 
				
			||||||
	use super::super::traits::JournalDB;
 | 
						use super::super::traits::JournalDB;
 | 
				
			||||||
	use ethcore_logger::init_log;
 | 
						use ethcore_logger::init_log;
 | 
				
			||||||
	use kvdb::{DatabaseConfig};
 | 
						use kvdb::{DatabaseConfig};
 | 
				
			||||||
 | 
						use {Hashable, H32};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	#[test]
 | 
						#[test]
 | 
				
			||||||
	fn insert_same_in_fork() {
 | 
						fn insert_same_in_fork() {
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@
 | 
				
			|||||||
//! `JournalDB` interface and implementation.
 | 
					//! `JournalDB` interface and implementation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::{fmt, str};
 | 
					use std::{fmt, str};
 | 
				
			||||||
use common::*;
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Export the journaldb module.
 | 
					/// Export the journaldb module.
 | 
				
			||||||
pub mod traits;
 | 
					pub mod traits;
 | 
				
			||||||
 | 
				
			|||||||
@ -17,13 +17,16 @@
 | 
				
			|||||||
//! `JournalDB` over in-memory overlay
 | 
					//! `JournalDB` over in-memory overlay
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::HashMap;
 | 
					use std::collections::HashMap;
 | 
				
			||||||
use common::*;
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					use parking_lot::RwLock;
 | 
				
			||||||
 | 
					use heapsize::HeapSizeOf;
 | 
				
			||||||
use rlp::*;
 | 
					use rlp::*;
 | 
				
			||||||
use hashdb::*;
 | 
					use hashdb::*;
 | 
				
			||||||
use memorydb::*;
 | 
					use memorydb::*;
 | 
				
			||||||
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
 | 
					use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
 | 
				
			||||||
use kvdb::{KeyValueDB, DBTransaction};
 | 
					use kvdb::{KeyValueDB, DBTransaction};
 | 
				
			||||||
use super::JournalDB;
 | 
					use super::JournalDB;
 | 
				
			||||||
 | 
					use {H256, BaseDataError, UtilError, Bytes, H256FastMap};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Implementation of the `JournalDB` trait for a disk-backed database with a memory overlay
 | 
					/// Implementation of the `JournalDB` trait for a disk-backed database with a memory overlay
 | 
				
			||||||
/// and, possibly, latent-removal semantics.
 | 
					/// and, possibly, latent-removal semantics.
 | 
				
			||||||
@ -451,12 +454,13 @@ mod tests {
 | 
				
			|||||||
	#![cfg_attr(feature="dev", allow(blacklisted_name))]
 | 
						#![cfg_attr(feature="dev", allow(blacklisted_name))]
 | 
				
			||||||
	#![cfg_attr(feature="dev", allow(similar_names))]
 | 
						#![cfg_attr(feature="dev", allow(similar_names))]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	use common::*;
 | 
						use std::path::Path;
 | 
				
			||||||
	use super::*;
 | 
						use super::*;
 | 
				
			||||||
	use hashdb::{HashDB, DBValue};
 | 
						use hashdb::{HashDB, DBValue};
 | 
				
			||||||
	use ethcore_logger::init_log;
 | 
						use ethcore_logger::init_log;
 | 
				
			||||||
	use journaldb::JournalDB;
 | 
						use journaldb::JournalDB;
 | 
				
			||||||
	use kvdb::Database;
 | 
						use kvdb::Database;
 | 
				
			||||||
 | 
						use {H32, Hashable};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn new_db(path: &Path) -> OverlayRecentDB {
 | 
						fn new_db(path: &Path) -> OverlayRecentDB {
 | 
				
			||||||
		let backing = Arc::new(Database::open_default(path.to_str().unwrap()).unwrap());
 | 
							let backing = Arc::new(Database::open_default(path.to_str().unwrap()).unwrap());
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,8 @@
 | 
				
			|||||||
//! Disk-backed, ref-counted `JournalDB` implementation.
 | 
					//! Disk-backed, ref-counted `JournalDB` implementation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::HashMap;
 | 
					use std::collections::HashMap;
 | 
				
			||||||
use common::*;
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					use heapsize::HeapSizeOf;
 | 
				
			||||||
use rlp::*;
 | 
					use rlp::*;
 | 
				
			||||||
use hashdb::*;
 | 
					use hashdb::*;
 | 
				
			||||||
use overlaydb::OverlayDB;
 | 
					use overlaydb::OverlayDB;
 | 
				
			||||||
@ -25,6 +26,7 @@ use memorydb::MemoryDB;
 | 
				
			|||||||
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
 | 
					use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
 | 
				
			||||||
use super::traits::JournalDB;
 | 
					use super::traits::JournalDB;
 | 
				
			||||||
use kvdb::{KeyValueDB, DBTransaction};
 | 
					use kvdb::{KeyValueDB, DBTransaction};
 | 
				
			||||||
 | 
					use {UtilError, H256, Bytes};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
 | 
					/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
 | 
				
			||||||
/// and latent-removal semantics.
 | 
					/// and latent-removal semantics.
 | 
				
			||||||
@ -211,10 +213,10 @@ mod tests {
 | 
				
			|||||||
	#![cfg_attr(feature="dev", allow(blacklisted_name))]
 | 
						#![cfg_attr(feature="dev", allow(blacklisted_name))]
 | 
				
			||||||
	#![cfg_attr(feature="dev", allow(similar_names))]
 | 
						#![cfg_attr(feature="dev", allow(similar_names))]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	use common::*;
 | 
					 | 
				
			||||||
	use hashdb::{HashDB, DBValue};
 | 
						use hashdb::{HashDB, DBValue};
 | 
				
			||||||
	use super::*;
 | 
						use super::*;
 | 
				
			||||||
	use super::super::traits::JournalDB;
 | 
						use super::super::traits::JournalDB;
 | 
				
			||||||
 | 
						use {Hashable};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	#[test]
 | 
						#[test]
 | 
				
			||||||
	fn long_history() {
 | 
						fn long_history() {
 | 
				
			||||||
 | 
				
			|||||||
@ -16,9 +16,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//! Disk-backed `HashDB` implementation.
 | 
					//! Disk-backed `HashDB` implementation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use common::*;
 | 
					use std::sync::Arc;
 | 
				
			||||||
use hashdb::*;
 | 
					use hashdb::*;
 | 
				
			||||||
use kvdb::{self, DBTransaction};
 | 
					use kvdb::{self, DBTransaction};
 | 
				
			||||||
 | 
					use {Bytes, H256, UtilError};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually
 | 
					/// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually
 | 
				
			||||||
/// exclusive actions.
 | 
					/// exclusive actions.
 | 
				
			||||||
 | 
				
			|||||||
@ -20,14 +20,17 @@ use std::{mem, fs};
 | 
				
			|||||||
use std::collections::{HashMap, BTreeMap};
 | 
					use std::collections::{HashMap, BTreeMap};
 | 
				
			||||||
use std::io::ErrorKind;
 | 
					use std::io::ErrorKind;
 | 
				
			||||||
use std::marker::PhantomData;
 | 
					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 elastic_array::*;
 | 
				
			||||||
use hashdb::DBValue;
 | 
					use hashdb::DBValue;
 | 
				
			||||||
use rlp::{UntrustedRlp, RlpType, Compressible};
 | 
					use rlp::{UntrustedRlp, RlpType, Compressible};
 | 
				
			||||||
use rocksdb::{DB, Writable, WriteBatch, WriteOptions, IteratorMode, DBIterator,
 | 
					use rocksdb::{DB, Writable, WriteBatch, WriteOptions, IteratorMode, DBIterator,
 | 
				
			||||||
	Options, DBCompactionStyle, BlockBasedOptions, Direction, Cache, Column, ReadOptions};
 | 
						Options, DBCompactionStyle, BlockBasedOptions, Direction, Cache, Column, ReadOptions};
 | 
				
			||||||
 | 
					use {UtilError, Bytes};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(target_os = "linux")]
 | 
					#[cfg(target_os = "linux")]
 | 
				
			||||||
use regex::Regex;
 | 
					use regex::Regex;
 | 
				
			||||||
#[cfg(target_os = "linux")]
 | 
					#[cfg(target_os = "linux")]
 | 
				
			||||||
 | 
				
			|||||||
@ -112,7 +112,6 @@ extern crate ethcore_logger;
 | 
				
			|||||||
#[macro_use]
 | 
					#[macro_use]
 | 
				
			||||||
extern crate log as rlog;
 | 
					extern crate log as rlog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub mod standard;
 | 
					 | 
				
			||||||
#[macro_use]
 | 
					#[macro_use]
 | 
				
			||||||
pub mod common;
 | 
					pub mod common;
 | 
				
			||||||
pub mod error;
 | 
					pub mod error;
 | 
				
			||||||
@ -135,7 +134,6 @@ pub mod snappy;
 | 
				
			|||||||
pub mod cache;
 | 
					pub mod cache;
 | 
				
			||||||
mod timer;
 | 
					mod timer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub use common::*;
 | 
					 | 
				
			||||||
pub use misc::*;
 | 
					pub use misc::*;
 | 
				
			||||||
pub use hashdb::*;
 | 
					pub use hashdb::*;
 | 
				
			||||||
pub use memorydb::MemoryDB;
 | 
					pub use memorydb::MemoryDB;
 | 
				
			||||||
@ -146,7 +144,17 @@ pub use trie::{Trie, TrieMut, TrieDB, TrieDBMut, TrieFactory, TrieError, SecTrie
 | 
				
			|||||||
pub use semantic_version::*;
 | 
					pub use semantic_version::*;
 | 
				
			||||||
pub use kvdb::*;
 | 
					pub use kvdb::*;
 | 
				
			||||||
pub use timer::*;
 | 
					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 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
 | 
					/// 160-bit integer representing account address
 | 
				
			||||||
pub type Address = H160;
 | 
					pub type Address = H160;
 | 
				
			||||||
 | 
				
			|||||||
@ -19,12 +19,11 @@
 | 
				
			|||||||
//! are performed in temp sub-directories.
 | 
					//! are performed in temp sub-directories.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::collections::BTreeMap;
 | 
					use std::collections::BTreeMap;
 | 
				
			||||||
use common::*;
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					use std::path::{Path, PathBuf};
 | 
				
			||||||
use migration::{Batch, Config, Error, SimpleMigration, Migration, Manager};
 | 
					use migration::{Batch, Config, Error, SimpleMigration, Migration, Manager};
 | 
				
			||||||
use kvdb::Database;
 | 
					use kvdb::Database;
 | 
				
			||||||
 | 
					 | 
				
			||||||
use devtools::RandomTempPath;
 | 
					use devtools::RandomTempPath;
 | 
				
			||||||
use std::path::PathBuf;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn db_path(path: &Path) -> PathBuf {
 | 
					fn db_path(path: &Path) -> PathBuf {
 | 
				
			||||||
	let mut p = path.to_owned();
 | 
						let mut p = path.to_owned();
 | 
				
			||||||
 | 
				
			|||||||
@ -16,9 +16,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//! Diff misc.
 | 
					//! Diff misc.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use common::*;
 | 
					 | 
				
			||||||
use rlp::RlpStream;
 | 
					use rlp::RlpStream;
 | 
				
			||||||
use target_info::Target;
 | 
					use target_info::Target;
 | 
				
			||||||
 | 
					use Bytes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
include!(concat!(env!("OUT_DIR"), "/version.rs"));
 | 
					include!(concat!(env!("OUT_DIR"), "/version.rs"));
 | 
				
			||||||
include!(concat!(env!("OUT_DIR"), "/rustc_version.rs"));
 | 
					include!(concat!(env!("OUT_DIR"), "/rustc_version.rs"));
 | 
				
			||||||
 | 
				
			|||||||
@ -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 <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//! 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};
 | 
					 | 
				
			||||||
@ -15,13 +15,14 @@
 | 
				
			|||||||
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
					// along with Parity.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::fmt;
 | 
					use std::fmt;
 | 
				
			||||||
use common::*;
 | 
					use itertools::Itertools;
 | 
				
			||||||
use hashdb::*;
 | 
					use hashdb::*;
 | 
				
			||||||
use nibbleslice::*;
 | 
					use nibbleslice::*;
 | 
				
			||||||
use rlp::*;
 | 
					use rlp::*;
 | 
				
			||||||
use super::node::{Node, OwnedNode};
 | 
					use super::node::{Node, OwnedNode};
 | 
				
			||||||
use super::lookup::Lookup;
 | 
					use super::lookup::Lookup;
 | 
				
			||||||
use super::{Trie, TrieItem, TrieError, TrieIterator, Query};
 | 
					use super::{Trie, TrieItem, TrieError, TrieIterator, Query};
 | 
				
			||||||
 | 
					use {ToPretty, Bytes, H256};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// A `Trie` implementation using a generic `HashDB` backing database.
 | 
					/// A `Trie` implementation using a generic `HashDB` backing database.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user