diff --git a/Cargo.lock b/Cargo.lock index a29e516dc..e3fd78eb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -352,6 +352,7 @@ version = "0.1.0" dependencies = [ "bloomable 0.1.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-util 1.8.0", "ethjson 0.1.0", "hash 0.1.0", @@ -559,6 +560,7 @@ dependencies = [ "ethash 1.8.0", "ethcore-bigint 0.1.3", "ethcore-bloom-journal 0.1.0", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -575,12 +577,14 @@ dependencies = [ "hardware-wallet 1.8.0", "hash 0.1.0", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.1.0", "hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.1.0", "native-contracts 0.1.0", "num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -598,6 +602,7 @@ dependencies = [ "table 0.1.0", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "transient-hashmap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie 0.1.0", "triehash 0.1.0", "unexpected 0.1.0", "using_queue 0.1.0", @@ -624,6 +629,10 @@ dependencies = [ "siphasher 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ethcore-bytes" +version = "0.1.0" + [[package]] name = "ethcore-devtools" version = "1.8.0" @@ -693,6 +702,7 @@ dependencies = [ name = "ethcore-ipc-tests" version = "0.1.0" dependencies = [ + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-ipc 1.8.0", "ethcore-ipc-codegen 1.8.0", @@ -710,6 +720,7 @@ dependencies = [ "bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -724,6 +735,7 @@ dependencies = [ "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.1.0", "rlp 0.2.0", "rlp_derive 0.1.0", "serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -731,6 +743,7 @@ dependencies = [ "smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "stats 0.1.0", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "trie 0.1.0", "triehash 0.1.0", "vm 0.1.0", ] @@ -758,6 +771,7 @@ dependencies = [ "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-logger 1.8.0", @@ -790,6 +804,7 @@ dependencies = [ "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-ipc 1.8.0", "ethcore-ipc-codegen 1.8.0", @@ -852,6 +867,7 @@ dependencies = [ "eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)", "ethcore-bigint 0.1.3", "ethcore-bloom-journal 0.1.0", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-logger 1.8.0", "hash 0.1.0", @@ -861,12 +877,17 @@ dependencies = [ "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.1.0", + "memorydb 0.1.0", + "nibbleslice 0.1.0", + "nibblevec 0.1.0", "rlp 0.2.0", "rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie 0.1.0", "triehash 0.1.0", "vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -965,6 +986,7 @@ dependencies = [ "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -1017,6 +1039,7 @@ dependencies = [ "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-util 1.8.0", "ethjson 0.1.0", "evm 0.1.0", @@ -1147,6 +1170,14 @@ dependencies = [ "tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hashdb" +version = "0.1.0" +dependencies = [ + "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", +] + [[package]] name = "heapsize" version = "0.4.1" @@ -1545,6 +1576,19 @@ dependencies = [ "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "memorydb" +version = "0.1.0" +dependencies = [ + "bigint 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", + "hash 0.1.0", + "hashdb 0.1.0", + "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.2.0", +] + [[package]] name = "mime" version = "0.2.6" @@ -1711,12 +1755,28 @@ dependencies = [ "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nibbleslice" +version = "0.1.0" +dependencies = [ + "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nibblevec" +version = "0.1.0" +dependencies = [ + "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nibbleslice 0.1.0", +] + [[package]] name = "node-filter" version = "1.8.0" dependencies = [ "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-io 1.8.0", "ethcore-network 1.8.0", "ethcore-util 1.8.0", @@ -1929,6 +1989,7 @@ dependencies = [ "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -1992,6 +2053,7 @@ dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-util 1.8.0", "fetch 0.1.0", @@ -2041,6 +2103,7 @@ version = "1.8.0" dependencies = [ "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-util 1.8.0", "fetch 0.1.0", "futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2062,6 +2125,7 @@ dependencies = [ "cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-util 1.8.0", "jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2102,6 +2166,7 @@ dependencies = [ "ethash 1.8.0", "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-devtools 1.8.0", "ethcore-io 1.8.0", "ethcore-ipc 1.8.0", @@ -2218,6 +2283,7 @@ dependencies = [ "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.8.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-ipc 1.8.0", "ethcore-ipc-codegen 1.8.0", "ethcore-util 1.8.0", @@ -3238,6 +3304,25 @@ dependencies = [ "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "trie" +version = "0.1.0" +dependencies = [ + "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", + "ethcore-logger 1.8.0", + "hash 0.1.0", + "hashdb 0.1.0", + "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.1.0", + "nibbleslice 0.1.0", + "nibblevec 0.1.0", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.2.0", + "triehash 0.1.0", +] + [[package]] name = "triehash" version = "0.1.0" @@ -3372,6 +3457,7 @@ dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "common-types 0.1.0", "ethcore-bigint 0.1.3", + "ethcore-bytes 0.1.0", "ethcore-util 1.8.0", "ethjson 0.1.0", "evmjit 1.8.0", @@ -3379,6 +3465,7 @@ dependencies = [ "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", + "trie 0.1.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 5f3a6ad73..68a288072 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "pa ethsync = { path = "sync" } ethcore = { path = "ethcore" } ethcore-util = { path = "util" } +ethcore-bytes = { path = "util/bytes" } ethcore-bigint = { path = "util/bigint" } ethcore-io = { path = "util/io" } ethcore-devtools = { path = "devtools" } diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index 2c55b79cb..cb384d011 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -32,6 +32,7 @@ jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branc ethcore-util = { path = "../util" } ethcore-bigint = { path = "../util/bigint" } +ethcore-bytes = { path = "../util/bytes" } fetch = { path = "../util/fetch" } node-health = { path = "./node-health" } parity-hash-fetch = { path = "../hash-fetch" } diff --git a/dapps/src/apps/fetcher/mod.rs b/dapps/src/apps/fetcher/mod.rs index fe529d772..8a11f7a9b 100644 --- a/dapps/src/apps/fetcher/mod.rs +++ b/dapps/src/apps/fetcher/mod.rs @@ -261,7 +261,7 @@ impl Fetcher for ContentFetcher { mod tests { use std::env; use std::sync::Arc; - use util::Bytes; + use bytes::Bytes; use fetch::{Fetch, Client}; use futures::{future, Future, BoxFuture}; use hash_fetch::urlhint::{URLHint, URLHintResult}; diff --git a/dapps/src/lib.rs b/dapps/src/lib.rs index 0cb0833af..e579439d0 100644 --- a/dapps/src/lib.rs +++ b/dapps/src/lib.rs @@ -39,6 +39,7 @@ extern crate jsonrpc_http_server; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate fetch; extern crate node_health; extern crate parity_dapps_glue as parity_dapps; diff --git a/dapps/src/tests/helpers/registrar.rs b/dapps/src/tests/helpers/registrar.rs index 41f296f8d..4df7e31b6 100644 --- a/dapps/src/tests/helpers/registrar.rs +++ b/dapps/src/tests/helpers/registrar.rs @@ -21,7 +21,8 @@ use rustc_hex::FromHex; use hash_fetch::urlhint::ContractClient; use bigint::hash::H256; -use util::{Bytes, Address, ToPretty}; +use util::Address; +use bytes::{Bytes, ToPretty}; use parking_lot::Mutex; const REGISTRAR: &'static str = "8e4e9b13d4b45cb0befc93c3061b1408f67316b2"; diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 5a2f7327a..638454aac 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -23,6 +23,10 @@ env_logger = "0.4" ethabi = "2.0" ethash = { path = "../ethash" } ethcore-bloom-journal = { path = "../util/bloom" } +ethcore-bytes = { path = "../util/bytes" } +hashdb = { path = "../util/hashdb" } +memorydb = { path = "../util/memorydb" } +trie = { path = "../util/trie" } ethcore-devtools = { path = "../devtools" } ethcore-io = { path = "../util/io" } ethcore-ipc = { path = "../ipc/rpc" } diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml index a96a7fb76..e7cf959ad 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -15,6 +15,9 @@ log = "0.3" ethcore = { path = ".."} ethcore-util = { path = "../../util" } ethcore-bigint = { path = "../../util/bigint" } +ethcore-bytes = { path = "../../util/bytes" } +memorydb = { path = "../../util/memorydb" } +trie = { path = "../../util/trie" } ethcore-network = { path = "../../util/network" } ethcore-io = { path = "../../util/io" } ethcore-ipc = { path = "../../ipc/rpc", optional = true } diff --git a/ethcore/light/src/cht.rs b/ethcore/light/src/cht.rs index d4d1f2294..d8a07fab9 100644 --- a/ethcore/light/src/cht.rs +++ b/ethcore/light/src/cht.rs @@ -23,8 +23,9 @@ use ethcore::ids::BlockId; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Bytes, HashDB, MemoryDB}; -use util::trie::{self, TrieMut, TrieDBMut, Trie, TrieDB, Recorder}; +use util::{HashDB, MemoryDB}; +use bytes::Bytes; +use trie::{self, TrieMut, TrieDBMut, Trie, TrieDB, Recorder}; use rlp::{RlpStream, UntrustedRlp}; // encode a key. diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 07f862a1a..4cf0b3e58 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -71,11 +71,14 @@ extern crate ethcore_io as io; extern crate ethcore_network as network; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate ethcore; extern crate evm; extern crate heapsize; extern crate futures; extern crate itertools; +extern crate memorydb; +extern crate trie; extern crate rand; extern crate rlp; extern crate parking_lot; diff --git a/ethcore/light/src/on_demand/request.rs b/ethcore/light/src/on_demand/request.rs index d9afd5582..162e2bb3a 100644 --- a/ethcore/light/src/on_demand/request.rs +++ b/ethcore/light/src/on_demand/request.rs @@ -33,9 +33,10 @@ use rlp::{RlpStream, UntrustedRlp}; use bigint::prelude::U256; use bigint::hash::H256; use parking_lot::Mutex; -use util::{Address, Bytes, DBValue, HashDB}; -use util::memorydb::MemoryDB; -use util::trie::{Trie, TrieDB, TrieError}; +use util::{Address, DBValue, HashDB}; +use bytes::Bytes; +use memorydb::MemoryDB; +use trie::{Trie, TrieDB, TrieError}; const SUPPLIED_MATCHES: &'static str = "supplied responses always match produced requests; enforced by `check_response`; qed"; @@ -896,8 +897,8 @@ mod tests { use bigint::hash::H256; use util::{MemoryDB, Address}; use parking_lot::Mutex; - use util::trie::{Trie, TrieMut, SecTrieDB, SecTrieDBMut}; - use util::trie::recorder::Recorder; + use trie::{Trie, TrieMut, SecTrieDB, SecTrieDBMut}; + use trie::recorder::Recorder; use hash::keccak; use ethcore::client::{BlockChainClient, TestBlockChainClient, EachBlockWith}; diff --git a/ethcore/light/src/types/request/mod.rs b/ethcore/light/src/types/request/mod.rs index c623ca656..c33d8b4cc 100644 --- a/ethcore/light/src/types/request/mod.rs +++ b/ethcore/light/src/types/request/mod.rs @@ -789,7 +789,7 @@ pub mod header_proof { use rlp::{Encodable, Decodable, DecoderError, RlpStream, UntrustedRlp}; use bigint::prelude::U256; use bigint::hash::H256; - use util::Bytes; + use bytes::Bytes; /// Potentially incomplete header proof request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1120,7 +1120,7 @@ pub mod account { use super::{Field, NoSuchOutput, OutputKind, Output}; use bigint::prelude::U256; use bigint::hash::H256; - use util::Bytes; + use bytes::Bytes; /// Potentially incomplete request for an account proof. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1220,7 +1220,7 @@ pub mod account { pub mod storage { use super::{Field, NoSuchOutput, OutputKind, Output}; use bigint::hash::H256; - use util::Bytes; + use bytes::Bytes; /// Potentially incomplete request for an storage proof. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1329,7 +1329,7 @@ pub mod storage { pub mod contract_code { use super::{Field, NoSuchOutput, OutputKind, Output}; use bigint::hash::H256; - use util::Bytes; + use bytes::Bytes; /// Potentially incomplete contract code request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] @@ -1417,7 +1417,8 @@ pub mod execution { use rlp::{Encodable, Decodable, DecoderError, RlpStream, UntrustedRlp}; use bigint::prelude::U256; use bigint::hash::H256; - use util::{Bytes, Address, DBValue}; + use util::{Address, DBValue}; + use bytes::Bytes; /// Potentially incomplete execution proof request. #[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] diff --git a/ethcore/node_filter/Cargo.toml b/ethcore/node_filter/Cargo.toml index 2d70c3461..6043c0e5d 100644 --- a/ethcore/node_filter/Cargo.toml +++ b/ethcore/node_filter/Cargo.toml @@ -10,6 +10,7 @@ authors = ["Parity Technologies "] ethcore = { path = ".."} ethcore-util = { path = "../../util" } ethcore-bigint = { path = "../../util/bigint" } +ethcore-bytes = { path = "../../util/bytes" } ethcore-io = { path = "../../util/io" } ethcore-network = { path = "../../util/network" } native-contracts = { path = "../native_contracts" } diff --git a/ethcore/node_filter/src/lib.rs b/ethcore/node_filter/src/lib.rs index 16a1bdd8f..276e6a5d7 100644 --- a/ethcore/node_filter/src/lib.rs +++ b/ethcore/node_filter/src/lib.rs @@ -19,6 +19,7 @@ extern crate ethcore; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate ethcore_network as network; extern crate native_contracts; extern crate futures; @@ -32,7 +33,8 @@ use native_contracts::PeerSet as Contract; use network::{NodeId, ConnectionFilter, ConnectionDirection}; use ethcore::client::{BlockChainClient, BlockId, ChainNotify}; use bigint::hash::H256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use parking_lot::Mutex; use futures::Future; diff --git a/ethcore/res/wasm-tests b/ethcore/res/wasm-tests index fcac936bf..5fd27564f 160000 --- a/ethcore/res/wasm-tests +++ b/ethcore/res/wasm-tests @@ -1 +1 @@ -Subproject commit fcac936bf68cc271a6a6ac088efb458f3a08f38a +Subproject commit 5fd27564f1ab49b25bb419bfc0cc68137e1f12f2 diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index d6fa65a41..63f79335d 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -25,7 +25,8 @@ use triehash::ordered_trie_root; use rlp::{UntrustedRlp, RlpStream, Encodable, Decodable, DecoderError}; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; use unexpected::{Mismatch, OutOfBounds}; use basic_types::{LogBloom, Seal}; diff --git a/ethcore/src/blockchain/best_block.rs b/ethcore/src/blockchain/best_block.rs index fd41f71e8..baf8819c5 100644 --- a/ethcore/src/blockchain/best_block.rs +++ b/ethcore/src/blockchain/best_block.rs @@ -16,7 +16,7 @@ use bigint::prelude::U256; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; use header::BlockNumber; /// Best block info. diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index d44d8ff9b..88bed91a3 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -25,6 +25,7 @@ use heapsize::HeapSizeOf; use bigint::prelude::U256; use bigint::hash::{H256, H2048}; use parking_lot::{Mutex, RwLock}; +use bytes::Bytes; use util::*; use rlp::*; use header::*; diff --git a/ethcore/src/blockchain/generator/block.rs b/ethcore/src/blockchain/generator/block.rs index d5243dc66..4aba039a3 100644 --- a/ethcore/src/blockchain/generator/block.rs +++ b/ethcore/src/blockchain/generator/block.rs @@ -16,7 +16,7 @@ use rlp::*; use bigint::hash::{H256, H2048}; -use util::bytes::Bytes; +use bytes::Bytes; use header::Header; use transaction::SignedTransaction; diff --git a/ethcore/src/blockchain/generator/complete.rs b/ethcore/src/blockchain/generator/complete.rs index be5695d36..7b9bc572a 100644 --- a/ethcore/src/blockchain/generator/complete.rs +++ b/ethcore/src/blockchain/generator/complete.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use bigint::hash::H256; -use util::bytes::Bytes; +use bytes::Bytes; use views::BlockView; #[derive(Default, Clone)] diff --git a/ethcore/src/blockchain/generator/generator.rs b/ethcore/src/blockchain/generator/generator.rs index a32e37942..967fc37fd 100644 --- a/ethcore/src/blockchain/generator/generator.rs +++ b/ethcore/src/blockchain/generator/generator.rs @@ -16,7 +16,7 @@ use bigint::prelude::U256; use bigint::hash::H2048; -use util::Bytes; +use bytes::Bytes; use header::BlockNumber; use transaction::SignedTransaction; use super::fork::Fork; diff --git a/ethcore/src/builtin.rs b/ethcore/src/builtin.rs index ac2726354..191e04dc6 100644 --- a/ethcore/src/builtin.rs +++ b/ethcore/src/builtin.rs @@ -26,7 +26,7 @@ use num::{BigUint, Zero, One}; use hash::keccak; use bigint::prelude::U256; use bigint::hash::H256; -use util::BytesRef; +use bytes::BytesRef; use ethkey::{Signature, recover as ec_recover}; use ethjson; @@ -509,7 +509,7 @@ mod tests { use super::{Builtin, Linear, ethereum_builtin, Pricer, Modexp, modexp as me}; use ethjson; use bigint::prelude::U256; - use util::BytesRef; + use bytes::BytesRef; use rustc_hex::FromHex; use num::{BigUint, Zero, One}; diff --git a/ethcore/src/client/chain_notify.rs b/ethcore/src/client/chain_notify.rs index 977e7b435..00b744167 100644 --- a/ethcore/src/client/chain_notify.rs +++ b/ethcore/src/client/chain_notify.rs @@ -16,7 +16,7 @@ use ipc::IpcConfig; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; /// Represents what has to be handled by actor listening to chain events #[ipc] diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 38dce1ffe..9fe9a4573 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -25,11 +25,10 @@ use itertools::Itertools; // util use hash::keccak; use timer::PerfTimer; -use util::UtilError; -use util::Bytes; -use util::{journaldb, DBValue, TrieFactory, Trie}; -use util::Address; -use util::trie::TrieSpec; +use bytes::Bytes; +use util::{journaldb, DBValue}; +use util::{Address, UtilError}; +use trie::{TrieSpec, TrieFactory, Trie}; use util::kvdb::*; // other diff --git a/ethcore/src/client/error.rs b/ethcore/src/client/error.rs index ff8b6d2ce..2bb5b46d4 100644 --- a/ethcore/src/client/error.rs +++ b/ethcore/src/client/error.rs @@ -17,7 +17,7 @@ use util::UtilError; use std::fmt::{Display, Formatter, Error as FmtError}; -use util::trie::TrieError; +use trie::TrieError; /// Client configuration errors. #[derive(Debug)] diff --git a/ethcore/src/client/evm_test_client.rs b/ethcore/src/client/evm_test_client.rs index e6f5e4675..2c465a24b 100644 --- a/ethcore/src/client/evm_test_client.rs +++ b/ethcore/src/client/evm_test_client.rs @@ -20,7 +20,9 @@ use std::fmt; use std::sync::Arc; use bigint::prelude::U256; use bigint::hash::H256; -use util::{self, journaldb, trie}; +use util::journaldb; +use trie; +use bytes; use util::kvdb::{self, KeyValueDB}; use {state, state_db, client, executive, trace, transaction, db, spec, pod_state}; use factory::Factories; @@ -31,7 +33,7 @@ use vm::{self, ActionParams}; #[derive(Debug)] pub enum EvmTestError { /// Trie integrity error. - Trie(util::TrieError), + Trie(trie::TrieError), /// EVM error. Evm(vm::Error), /// Initialization error. @@ -179,7 +181,7 @@ impl<'a> EvmTestClient<'a> { let (gas_left, _) = executive.call( params, &mut substate, - util::BytesRef::Flexible(&mut output), + bytes::BytesRef::Flexible(&mut output), &mut tracer, vm_tracer, ).map_err(EvmTestError::Evm)?; diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index b7245b25c..eb3706e01 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -27,6 +27,7 @@ use bigint::prelude::U256; use bigint::hash::H256; use parking_lot::RwLock; use util::*; +use bytes::Bytes; use rlp::*; use ethkey::{Generator, Random}; use devtools::*; diff --git a/ethcore/src/client/traits.rs b/ethcore/src/client/traits.rs index b7616a478..b4fc60f14 100644 --- a/ethcore/src/client/traits.rs +++ b/ethcore/src/client/traits.rs @@ -36,8 +36,9 @@ use verification::queue::QueueInfo as BlockQueueInfo; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Address, Bytes}; -use util::hashdb::DBValue; +use util::Address; +use bytes::Bytes; +use hashdb::DBValue; use types::ids::*; use types::basic_account::BasicAccount; diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index b50ebbc4f..4ea032411 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -48,6 +48,7 @@ use semantic_version::SemanticVersion; use parking_lot::{Mutex, RwLock}; use unexpected::{Mismatch, OutOfBounds}; use util::*; +use bytes::Bytes; mod finality; diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index fcf387f8b..b48ff2f3f 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -59,6 +59,7 @@ use bigint::hash::H256; use semantic_version::SemanticVersion; use util::*; use unexpected::{Mismatch, OutOfBounds}; +use bytes::Bytes; /// Default EIP-210 contrat code. /// As defined in https://github.com/ethereum/EIPs/pull/210/commits/9df24a3714af42e3bf350265bdc75b486c909d7f#diff-e02a92c2fb96c1a1bfb05e4c6e2ef5daR49 @@ -420,6 +421,7 @@ pub mod common { use bigint::prelude::U256; use bigint::hash::H256; use util::*; + use bytes::{Bytes, BytesRef}; use super::Engine; /// Execute a call as the system address. diff --git a/ethcore/src/engines/tendermint/message.rs b/ethcore/src/engines/tendermint/message.rs index baaf94601..5fec4f737 100644 --- a/ethcore/src/engines/tendermint/message.rs +++ b/ethcore/src/engines/tendermint/message.rs @@ -20,6 +20,7 @@ use std::cmp; use hash::keccak; use bigint::hash::{H256, H520}; use util::*; +use bytes::Bytes; use super::{Height, View, BlockHash, Step}; use error::Error; use header::Header; diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index ce0a0da24..6fe00aaab 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -36,6 +36,7 @@ use parking_lot::RwLock; use util::*; use unexpected::{OutOfBounds, Mismatch}; use client::EngineClient; +use bytes::Bytes; use error::{Error, BlockError}; use header::{Header, BlockNumber}; use builtin::Builtin; @@ -775,6 +776,7 @@ mod tests { use std::str::FromStr; use rustc_hex::FromHex; use util::*; + use bytes::Bytes; use block::*; use error::{Error, BlockError}; use header::Header; diff --git a/ethcore/src/engines/validator_set/contract.rs b/ethcore/src/engines/validator_set/contract.rs index 24e396c10..3f035d424 100644 --- a/ethcore/src/engines/validator_set/contract.rs +++ b/ethcore/src/engines/validator_set/contract.rs @@ -21,6 +21,7 @@ use std::sync::Weak; use bigint::hash::H256; use parking_lot::RwLock; use util::*; +use bytes::Bytes; use futures::Future; use native_contracts::ValidatorReport as Provider; @@ -139,6 +140,7 @@ mod tests { use hash::keccak; use bigint::hash::H520; use util::*; + use bytes::ToPretty; use rlp::encode; use spec::Spec; use header::Header; diff --git a/ethcore/src/engines/validator_set/mod.rs b/ethcore/src/engines/validator_set/mod.rs index 451abe6f2..32060f8bf 100644 --- a/ethcore/src/engines/validator_set/mod.rs +++ b/ethcore/src/engines/validator_set/mod.rs @@ -26,7 +26,8 @@ mod multi; use std::sync::Weak; use ids::BlockId; use bigint::hash::H256; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; use ethjson::spec::ValidatorSet as ValidatorSpec; use client::EngineClient; use header::{Header, BlockNumber}; diff --git a/ethcore/src/engines/validator_set/multi.rs b/ethcore/src/engines/validator_set/multi.rs index 043f8aab6..baf82b88d 100644 --- a/ethcore/src/engines/validator_set/multi.rs +++ b/ethcore/src/engines/validator_set/multi.rs @@ -21,7 +21,8 @@ use std::sync::Weak; use engines::{Call, Engine}; use bigint::hash::H256; use parking_lot::RwLock; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; use ids::BlockId; use header::{BlockNumber, Header}; use client::EngineClient; diff --git a/ethcore/src/engines/validator_set/safe_contract.rs b/ethcore/src/engines/validator_set/safe_contract.rs index c3f82e181..3e1279228 100644 --- a/ethcore/src/engines/validator_set/safe_contract.rs +++ b/ethcore/src/engines/validator_set/safe_contract.rs @@ -26,6 +26,7 @@ use bigint::hash::{H160, H256}; use parking_lot::{Mutex, RwLock}; use util::*; +use bytes::Bytes; use util::cache::MemoryLruCache; use unexpected::Mismatch; use rlp::{UntrustedRlp, RlpStream}; diff --git a/ethcore/src/engines/validator_set/test.rs b/ethcore/src/engines/validator_set/test.rs index da89880ca..e2a0c36c7 100644 --- a/ethcore/src/engines/validator_set/test.rs +++ b/ethcore/src/engines/validator_set/test.rs @@ -21,7 +21,8 @@ use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; use heapsize::HeapSizeOf; use bigint::hash::H256; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; 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 f759cbaf8..413d75389 100644 --- a/ethcore/src/engines/vote_collector.rs +++ b/ethcore/src/engines/vote_collector.rs @@ -22,6 +22,7 @@ use std::hash::Hash; use bigint::hash::{H256, H520}; use parking_lot:: RwLock; use util::*; +use bytes::Bytes; use rlp::{Encodable, RlpStream}; pub trait Message: Clone + PartialEq + Eq + Hash + Encodable + Debug { diff --git a/ethcore/src/error.rs b/ethcore/src/error.rs index 8b0554e5a..9c7f7b4e2 100644 --- a/ethcore/src/error.rs +++ b/ethcore/src/error.rs @@ -21,6 +21,7 @@ use bigint::prelude::U256; use bigint::hash::H256; use util::*; use unexpected::{Mismatch, OutOfBounds}; +use trie::TrieError; use io::*; use header::BlockNumber; use basic_types::LogBloom; diff --git a/ethcore/src/executed.rs b/ethcore/src/executed.rs index 909e1b6cb..490681dfb 100644 --- a/ethcore/src/executed.rs +++ b/ethcore/src/executed.rs @@ -17,7 +17,9 @@ //! Transaction execution format module. use bigint::prelude::{U256, U512}; -use util::{Bytes, Address, trie}; +use util::Address; +use bytes::Bytes; +use trie; use vm; use trace::{VMTrace, FlatTrace}; use log_entry::LogEntry; diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index c00046e0e..98ead0b8e 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -21,6 +21,7 @@ use hash::keccak; use bigint::prelude::{U256, U512}; use bigint::hash::H256; use util::*; +use bytes::{Bytes, BytesRef}; use state::{Backend as StateBackend, State, Substate, CleanupMode}; use engines::Engine; use vm::EnvInfo; @@ -680,7 +681,7 @@ mod tests { use bigint::prelude::{U256, U512}; use bigint::hash::H256; use util::Address; - use util::bytes::BytesRef; + use bytes::BytesRef; use vm::{ActionParams, ActionValue, CallType, EnvInfo, CreateContractAddress}; use evm::{Factory, VMType}; use error::ExecutionError; diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index 5fc613844..b84fbfe5b 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -20,6 +20,7 @@ use std::sync::Arc; use bigint::prelude::U256; use bigint::hash::H256; use util::*; +use bytes::{Bytes, BytesRef}; use state::{Backend as StateBackend, State, Substate, CleanupMode}; use engines::Engine; use executive::*; diff --git a/ethcore/src/factory.rs b/ethcore/src/factory.rs index e283491e1..e9edfa3bd 100644 --- a/ethcore/src/factory.rs +++ b/ethcore/src/factory.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::trie::TrieFactory; +use trie::TrieFactory; use evm::Factory as EvmFactory; use account_db::Factory as AccountFactory; @@ -27,4 +27,4 @@ pub struct Factories { pub trie: TrieFactory, /// factory for account databases. pub accountdb: AccountFactory, -} \ No newline at end of file +} diff --git a/ethcore/src/header.rs b/ethcore/src/header.rs index 8dca493a7..5cbd0d22b 100644 --- a/ethcore/src/header.rs +++ b/ethcore/src/header.rs @@ -23,6 +23,7 @@ use heapsize::HeapSizeOf; use bigint::prelude::U256; use bigint::hash::H256; use util::*; +use bytes::Bytes; use basic_types::{LogBloom, ZERO_LOGBLOOM}; use time::get_time; use rlp::*; diff --git a/ethcore/src/json_tests/executive.rs b/ethcore/src/json_tests/executive.rs index f7b4bbe81..f6d3023c9 100644 --- a/ethcore/src/json_tests/executive.rs +++ b/ethcore/src/json_tests/executive.rs @@ -30,6 +30,8 @@ use tests::helpers::*; use ethjson; use trace::{Tracer, NoopTracer}; use trace::{VMTracer, NoopVMTracer}; +use bytes::{Bytes, BytesRef}; +use trie; #[derive(Debug, PartialEq, Clone)] struct CallCreate { diff --git a/ethcore/src/json_tests/trie.rs b/ethcore/src/json_tests/trie.rs index 5d2696893..f7989bc09 100644 --- a/ethcore/src/json_tests/trie.rs +++ b/ethcore/src/json_tests/trie.rs @@ -15,9 +15,9 @@ // along with Parity. If not, see . use ethjson; -use util::trie::{TrieFactory, TrieSpec}; +use trie::{TrieFactory, TrieSpec}; use bigint::hash::H256; -use util::memorydb::MemoryDB; +use memorydb::MemoryDB; fn test_trie(json: &[u8], trie: TrieSpec) -> Vec { let tests = ethjson::trie::Test::load(json).unwrap(); @@ -49,7 +49,7 @@ fn test_trie(json: &[u8], trie: TrieSpec) -> Vec { } mod generic { - use util::trie::TrieSpec; + use trie::TrieSpec; fn do_json_test(json: &[u8]) -> Vec { super::test_trie(json, TrieSpec::Generic) @@ -60,7 +60,7 @@ mod generic { } mod secure { - use util::trie::TrieSpec; + use trie::TrieSpec; fn do_json_test(json: &[u8]) -> Vec { super::test_trie(json, TrieSpec::Secure) diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 82b3cfd96..6edd2261e 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -86,12 +86,14 @@ extern crate ethcore_devtools as devtools; extern crate ethcore_io as io; extern crate ethcore_ipc_nano as nanoipc; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate ethcore_logger; extern crate ethcore_stratum; extern crate ethjson; extern crate ethkey; extern crate futures; extern crate hardware_wallet; +extern crate hashdb; extern crate hyper; extern crate itertools; extern crate linked_hash_map; @@ -106,6 +108,8 @@ extern crate rayon; extern crate rlp; extern crate hash; extern crate heapsize; +extern crate memorydb; +extern crate trie; extern crate triehash; extern crate ansi_term; extern crate semantic_version; diff --git a/ethcore/src/migrations/state/v7.rs b/ethcore/src/migrations/state/v7.rs index 64fa5b272..4a9d850ad 100644 --- a/ethcore/src/migrations/state/v7.rs +++ b/ethcore/src/migrations/state/v7.rs @@ -20,7 +20,8 @@ use std::collections::HashMap; use bigint::hash::H256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use util::kvdb::Database; use util::migration::{Batch, Config, Error, Migration, SimpleMigration, Progress}; use hash::keccak; diff --git a/ethcore/src/migrations/v10.rs b/ethcore/src/migrations/v10.rs index dd6968bbb..d2f6952d4 100644 --- a/ethcore/src/migrations/v10.rs +++ b/ethcore/src/migrations/v10.rs @@ -19,13 +19,13 @@ use std::sync::Arc; use db::{COL_EXTRA, COL_HEADERS, COL_STATE}; use state_db::{ACCOUNT_BLOOM_SPACE, DEFAULT_ACCOUNT_PRESET, StateDB}; -use util::trie::TrieDB; +use trie::TrieDB; use views::HeaderView; use bloom_journal::Bloom; use util::migration::{Error, Migration, Progress, Batch, Config}; use util::journaldb; use bigint::hash::H256; -use util::Trie; +use trie::Trie; use util::{Database, DBTransaction}; /// Account bloom upgrade routine. If bloom already present, does nothing. diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index b28288570..c088a18be 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -22,6 +22,7 @@ use bigint::prelude::U256; use bigint::hash::H256; use parking_lot::{Mutex, RwLock}; use util::*; +use bytes::Bytes; use timer::PerfTimer; use using_queue::{UsingQueue, GetAction}; use account_provider::{AccountProvider, SignError as AccountError}; diff --git a/ethcore/src/miner/mod.rs b/ethcore/src/miner/mod.rs index b9bf7859e..6e1504c21 100644 --- a/ethcore/src/miner/mod.rs +++ b/ethcore/src/miner/mod.rs @@ -63,7 +63,8 @@ pub use self::stratum::{Stratum, Error as StratumError, Options as StratumOption use std::collections::BTreeMap; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use client::{MiningBlockChainClient}; use block::ClosedBlock; use header::BlockNumber; diff --git a/ethcore/src/pod_account.rs b/ethcore/src/pod_account.rs index 8f21de298..7276c0541 100644 --- a/ethcore/src/pod_account.rs +++ b/ethcore/src/pod_account.rs @@ -22,6 +22,8 @@ use bigint::prelude::U256; use bigint::hash::H256; use triehash::sec_trie_root; use util::*; +use bytes::Bytes; +use trie::TrieFactory; use state::Account; use ethjson; use types::account_diff::*; diff --git a/ethcore/src/service.rs b/ethcore/src/service.rs index 4e7e04341..ca283b0aa 100644 --- a/ethcore/src/service.rs +++ b/ethcore/src/service.rs @@ -20,6 +20,7 @@ use std::sync::Arc; use std::path::Path; use bigint::hash::H256; use util::*; +use bytes::Bytes; use io::*; use spec::Spec; use error::*; diff --git a/ethcore/src/snapshot/account.rs b/ethcore/src/snapshot/account.rs index 47598c86e..8fb990ca9 100644 --- a/ethcore/src/snapshot/account.rs +++ b/ethcore/src/snapshot/account.rs @@ -23,8 +23,9 @@ use hash::{KECCAK_EMPTY, KECCAK_NULL_RLP}; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Bytes, HashDB}; -use util::trie::{TrieDB, Trie}; +use util::HashDB; +use bytes::Bytes; +use trie::{TrieDB, Trie}; use rlp::{RlpStream, UntrustedRlp}; use std::collections::HashSet; @@ -151,7 +152,7 @@ pub fn from_fat_rlp( rlp: UntrustedRlp, mut storage_root: H256, ) -> Result<(BasicAccount, Option), Error> { - use util::{TrieDBMut, TrieMut}; + use trie::{TrieDBMut, TrieMut}; // check for special case of empty account. if rlp.is_empty() { diff --git a/ethcore/src/snapshot/block.rs b/ethcore/src/snapshot/block.rs index ed8c130d4..8143a4931 100644 --- a/ethcore/src/snapshot/block.rs +++ b/ethcore/src/snapshot/block.rs @@ -23,7 +23,7 @@ use hash::keccak; use views::BlockView; use rlp::{DecoderError, RlpStream, UntrustedRlp}; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; use triehash::ordered_trie_root; const HEADER_FIELDS: usize = 8; @@ -140,7 +140,8 @@ mod tests { use bigint::prelude::U256; use bigint::hash::H256; - use util::{Address, Bytes}; + use util::Address; + use bytes::Bytes; fn encode_block(b: &Block) -> Bytes { b.rlp_bytes(::basic_types::Seal::With) diff --git a/ethcore/src/snapshot/consensus/authority.rs b/ethcore/src/snapshot/consensus/authority.rs index 28222bfb5..0c1d12808 100644 --- a/ethcore/src/snapshot/consensus/authority.rs +++ b/ethcore/src/snapshot/consensus/authority.rs @@ -34,7 +34,8 @@ use snapshot::{Error, ManifestData}; use itertools::{Position, Itertools}; use rlp::{RlpStream, UntrustedRlp}; use bigint::hash::H256; -use util::{Bytes, KeyValueDB}; +use util::KeyValueDB; +use bytes::Bytes; /// Snapshot creation and restoration for PoA chains. /// Chunk format: diff --git a/ethcore/src/snapshot/consensus/work.rs b/ethcore/src/snapshot/consensus/work.rs index 16b8a5c18..349cce685 100644 --- a/ethcore/src/snapshot/consensus/work.rs +++ b/ethcore/src/snapshot/consensus/work.rs @@ -31,7 +31,8 @@ use engines::Engine; use snapshot::{Error, ManifestData}; use snapshot::block::AbridgedBlock; use bigint::hash::H256; -use util::{Bytes, KeyValueDB}; +use util::KeyValueDB; +use bytes::Bytes; use rlp::{RlpStream, UntrustedRlp}; use rand::OsRng; diff --git a/ethcore/src/snapshot/error.rs b/ethcore/src/snapshot/error.rs index b7a310c0d..bd0cb227b 100644 --- a/ethcore/src/snapshot/error.rs +++ b/ethcore/src/snapshot/error.rs @@ -21,7 +21,7 @@ use std::fmt; use ids::BlockId; use bigint::hash::H256; -use util::trie::TrieError; +use trie::TrieError; use rlp::DecoderError; /// Snapshot-related errors. diff --git a/ethcore/src/snapshot/io.rs b/ethcore/src/snapshot/io.rs index dabb86283..3f2622296 100644 --- a/ethcore/src/snapshot/io.rs +++ b/ethcore/src/snapshot/io.rs @@ -25,7 +25,7 @@ use std::io::{self, Read, Seek, SeekFrom, Write}; use std::fs::{self, File}; use std::path::{Path, PathBuf}; -use util::Bytes; +use bytes::Bytes; use bigint::hash::H256; use rlp::{RlpStream, UntrustedRlp}; diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index bd9672caf..9b8cfb726 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -32,11 +32,12 @@ use ids::BlockId; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Bytes, HashDB, DBValue, snappy}; +use util::{HashDB, DBValue, snappy}; +use bytes::Bytes; use parking_lot::Mutex; use util::journaldb::{self, Algorithm, JournalDB}; use util::kvdb::KeyValueDB; -use util::trie::{TrieDB, TrieDBMut, Trie, TrieMut}; +use trie::{TrieDB, TrieDBMut, Trie, TrieMut}; use rlp::{RlpStream, UntrustedRlp}; use bloom_journal::Bloom; diff --git a/ethcore/src/snapshot/service.rs b/ethcore/src/snapshot/service.rs index 72ef8ccc1..9cc841782 100644 --- a/ethcore/src/snapshot/service.rs +++ b/ethcore/src/snapshot/service.rs @@ -37,7 +37,8 @@ use io::IoChannel; use bigint::hash::H256; use parking_lot::{Mutex, RwLock, RwLockReadGuard}; -use util::{Bytes, UtilError}; +use util::UtilError; +use bytes::Bytes; use util::journaldb::Algorithm; use util::kvdb::{Database, DatabaseConfig}; use util::snappy; @@ -161,7 +162,7 @@ impl Restoration { // finish up restoration. fn finalize(mut self, engine: &Engine) -> Result<(), Error> { - use util::trie::TrieError; + use trie::TrieError; if !self.is_done() { return Ok(()) } diff --git a/ethcore/src/snapshot/snapshot_service_trait.rs b/ethcore/src/snapshot/snapshot_service_trait.rs index 9ef7706b4..8208400df 100644 --- a/ethcore/src/snapshot/snapshot_service_trait.rs +++ b/ethcore/src/snapshot/snapshot_service_trait.rs @@ -16,7 +16,7 @@ use super::{ManifestData, RestorationStatus}; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; use ipc::IpcConfig; /// The interface for a snapshot network service. diff --git a/ethcore/src/snapshot/tests/helpers.rs b/ethcore/src/snapshot/tests/helpers.rs index c93409c51..e5e48bf58 100644 --- a/ethcore/src/snapshot/tests/helpers.rs +++ b/ethcore/src/snapshot/tests/helpers.rs @@ -33,10 +33,10 @@ use rand::Rng; use util::{DBValue, KeyValueDB}; use bigint::hash::H256; -use util::hashdb::HashDB; +use hashdb::HashDB; use util::journaldb; -use util::trie::{Alphabet, StandardMap, SecTrieDBMut, TrieMut, ValueMode}; -use util::trie::{TrieDB, TrieDBMut, Trie}; +use trie::{Alphabet, StandardMap, SecTrieDBMut, TrieMut, ValueMode}; +use trie::{TrieDB, TrieDBMut, Trie}; // the proportion of accounts we will alter each tick. const ACCOUNT_CHURN: f32 = 0.01; diff --git a/ethcore/src/snapshot/tests/state.rs b/ethcore/src/snapshot/tests/state.rs index d3bea08dc..460dd77b5 100644 --- a/ethcore/src/snapshot/tests/state.rs +++ b/ethcore/src/snapshot/tests/state.rs @@ -28,7 +28,7 @@ use rand::{XorShiftRng, SeedableRng}; use bigint::hash::H256; use util::journaldb::{self, Algorithm}; use util::kvdb::{Database, DatabaseConfig}; -use util::memorydb::MemoryDB; +use memorydb::MemoryDB; use parking_lot::Mutex; use devtools::RandomTempPath; @@ -99,7 +99,7 @@ fn get_code_from_prev_chunk() { use rlp::RlpStream; use bigint::prelude::U256; use bigint::hash::H256; - use util::HashDB; + use hashdb::HashDB; use account_db::{AccountDBMut, AccountDB}; diff --git a/ethcore/src/snapshot/watcher.rs b/ethcore/src/snapshot/watcher.rs index e4b236b88..6c34cf39d 100644 --- a/ethcore/src/snapshot/watcher.rs +++ b/ethcore/src/snapshot/watcher.rs @@ -23,7 +23,7 @@ use service::ClientIoMessage; use io::IoChannel; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; use std::sync::Arc; diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index a807384be..0cf5e7eb5 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -43,6 +43,7 @@ use bigint::prelude::U256; use bigint::hash::{H256, H2048}; use parking_lot::RwLock; use util::*; +use bytes::Bytes; /// Parameters common to ethereum-like blockchains. /// NOTE: when adding bugfix hard-fork parameters, diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index b46b5ec4c..2d9a37e81 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -23,6 +23,9 @@ use hash::{KECCAK_EMPTY, KECCAK_NULL_RLP, keccak}; use bigint::prelude::U256; use bigint::hash::H256; use util::*; +use bytes::{Bytes, ToPretty}; +use trie; +use trie::{SecTrieDB, Trie, TrieFactory, TrieError}; use pod_account::*; use rlp::*; use lru_cache::LruCache; @@ -450,8 +453,8 @@ impl Account { /// `storage_key` is the hash of the desired storage key, meaning /// this will only work correctly under a secure trie. pub fn prove_storage(&self, db: &HashDB, storage_key: H256) -> Result<(Vec, H256), Box> { - use util::trie::{Trie, TrieDB}; - use util::trie::recorder::Recorder; + use trie::{Trie, TrieDB}; + use trie::recorder::Recorder; let mut recorder = Recorder::new(); @@ -475,6 +478,7 @@ impl fmt::Debug for Account { mod tests { use rlp::{UntrustedRlp, RlpType, Compressible}; use util::*; + use bytes::Bytes; use super::*; use account_db::*; diff --git a/ethcore/src/state/backend.rs b/ethcore/src/state/backend.rs index c0d0380e7..968d0cfd7 100644 --- a/ethcore/src/state/backend.rs +++ b/ethcore/src/state/backend.rs @@ -28,7 +28,7 @@ use state::Account; use bigint::hash::H256; use parking_lot::Mutex; use util::{Address, MemoryDB}; -use util::hashdb::{AsHashDB, HashDB, DBValue}; +use hashdb::{AsHashDB, HashDB, DBValue}; /// State backend. See module docs for more details. pub trait Backend: Send { diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index eb6deac23..8f7259c4b 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -45,9 +45,12 @@ use evm::{Factory as EvmFactory}; use bigint::prelude::U256; use bigint::hash::H256; use util::*; +use bytes::Bytes; + +use trie; +use trie::{Trie, TrieError, TrieDB}; +use trie::recorder::Recorder; -use util::trie; -use util::trie::recorder::Recorder; mod account; mod substate; diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index 346312c3b..34279a382 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -21,7 +21,7 @@ use util::cache::MemoryLruCache; use util::journaldb::JournalDB; use util::kvdb::KeyValueDB; use bigint::hash::H256; -use util::hashdb::HashDB; +use hashdb::HashDB; use state::{self, Account}; use header::BlockNumber; use hash::keccak; diff --git a/ethcore/src/tests/evm.rs b/ethcore/src/tests/evm.rs index 8b51c3487..f8eb178d5 100644 --- a/ethcore/src/tests/evm.rs +++ b/ethcore/src/tests/evm.rs @@ -14,6 +14,7 @@ use rustc_hex::FromHex; use bigint::hash::H256; use util::*; +use bytes::BytesRef; evm_test!{test_blockhash_eip210: test_blockhash_eip210_jit, test_blockhash_eip210_int} fn test_blockhash_eip210(factory: Factory) { diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index ac5669da7..80eadcfa5 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -23,6 +23,7 @@ use client::{BlockChainClient, Client, ClientConfig}; use bigint::prelude::U256; use bigint::hash::H256; use util::*; +use bytes::Bytes; use spec::*; use account_provider::AccountProvider; use state_db::StateDB; diff --git a/ethcore/src/trace/executive_tracer.rs b/ethcore/src/trace/executive_tracer.rs index fbc8eaee1..38c134e6b 100644 --- a/ethcore/src/trace/executive_tracer.rs +++ b/ethcore/src/trace/executive_tracer.rs @@ -17,7 +17,8 @@ //! Simple executive tracer. use bigint::prelude::U256; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; use vm::ActionParams; use trace::trace::{Call, Create, Action, Res, CreateResult, CallResult, VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff, Suicide, Reward, RewardType}; use trace::{Tracer, VMTracer, FlatTrace, TraceError}; diff --git a/ethcore/src/trace/mod.rs b/ethcore/src/trace/mod.rs index 06f1afb0b..0a255b357 100644 --- a/ethcore/src/trace/mod.rs +++ b/ethcore/src/trace/mod.rs @@ -39,7 +39,8 @@ pub use self::types::filter::{Filter, AddressesFilter}; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Bytes, Address, DBTransaction}; +use util::{Address, DBTransaction}; +use bytes::Bytes; use self::trace::{Call, Create}; use vm::ActionParams; use header::BlockNumber; diff --git a/ethcore/src/trace/noop_tracer.rs b/ethcore/src/trace/noop_tracer.rs index c39c805fb..6def53c6c 100644 --- a/ethcore/src/trace/noop_tracer.rs +++ b/ethcore/src/trace/noop_tracer.rs @@ -17,7 +17,8 @@ //! Nonoperative tracer. use bigint::prelude::U256; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; use vm::ActionParams; use trace::{Tracer, VMTracer, FlatTrace, TraceError}; use trace::trace::{Call, Create, VMTrace, RewardType}; diff --git a/ethcore/src/trace/types/trace.rs b/ethcore/src/trace/types/trace.rs index a4efcee0e..8c48e6a4a 100644 --- a/ethcore/src/trace/types/trace.rs +++ b/ethcore/src/trace/types/trace.rs @@ -17,7 +17,8 @@ //! Tracing datatypes. use bigint::prelude::U256; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; use hash::keccak; use bloomable::Bloomable; use rlp::*; diff --git a/ethcore/src/transaction.rs b/ethcore/src/transaction.rs index ce767cd0d..02f77d5f3 100644 --- a/ethcore/src/transaction.rs +++ b/ethcore/src/transaction.rs @@ -22,7 +22,8 @@ use hash::keccak; use heapsize::HeapSizeOf; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use ethkey::{Signature, Secret, Public, recover, public_to_address, Error as EthkeyError}; use error::*; use evm::Schedule; diff --git a/ethcore/src/tx_filter.rs b/ethcore/src/tx_filter.rs index b2b7828f1..e9863a154 100644 --- a/ethcore/src/tx_filter.rs +++ b/ethcore/src/tx_filter.rs @@ -22,7 +22,8 @@ use std::collections::hash_map::Entry; use bigint::hash::H256; use native_contracts::TransactAcl as Contract; use client::{EngineClient, BlockId, ChainNotify}; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use parking_lot::{Mutex, RwLock}; use futures::{self, Future}; use spec::CommonParams; diff --git a/ethcore/src/verification/queue/kind.rs b/ethcore/src/verification/queue/kind.rs index 686311579..47946ef74 100644 --- a/ethcore/src/verification/queue/kind.rs +++ b/ethcore/src/verification/queue/kind.rs @@ -77,7 +77,7 @@ pub mod blocks { use heapsize::HeapSizeOf; use bigint::prelude::U256; use bigint::hash::H256; - use util::Bytes; + use bytes::Bytes; /// A mode for verifying blocks. pub struct Blocks; diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs index 4ea0efe51..80d433950 100644 --- a/ethcore/src/verification/verification.rs +++ b/ethcore/src/verification/verification.rs @@ -26,8 +26,8 @@ use hash::keccak; use triehash::ordered_trie_root; use heapsize::HeapSizeOf; use bigint::hash::H256; -use util::*; use unexpected::{Mismatch, OutOfBounds}; +use bytes::Bytes; use engines::Engine; use error::{BlockError, Error}; use blockchain::*; @@ -276,7 +276,7 @@ mod tests { use bigint::hash::{H256, H2048}; use triehash::ordered_trie_root; use unexpected::{Mismatch, OutOfBounds}; - use util::*; + use bytes::Bytes; use ethkey::{Random, Generator}; use header::*; use verification::*; diff --git a/ethcore/src/views/block.rs b/ethcore/src/views/block.rs index 27906c6c5..450b8bafd 100644 --- a/ethcore/src/views/block.rs +++ b/ethcore/src/views/block.rs @@ -18,7 +18,7 @@ use hash::keccak; use bigint::hash::H256; -use util::*; +use bytes::Bytes; use header::*; use transaction::*; use super::{TransactionView, HeaderView}; diff --git a/ethcore/src/views/body.rs b/ethcore/src/views/body.rs index c9f78fc1c..092732d8a 100644 --- a/ethcore/src/views/body.rs +++ b/ethcore/src/views/body.rs @@ -18,7 +18,7 @@ use hash::keccak; use bigint::hash::H256; -use util::*; +use bytes::Bytes; use header::*; use transaction::*; use super::{TransactionView, HeaderView}; diff --git a/ethcore/src/views/header.rs b/ethcore/src/views/header.rs index c3c446e19..d308a042d 100644 --- a/ethcore/src/views/header.rs +++ b/ethcore/src/views/header.rs @@ -19,7 +19,8 @@ use hash::keccak; use bigint::prelude::U256; use bigint::hash::{H256, H2048}; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; use rlp::Rlp; use header::BlockNumber; diff --git a/ethcore/src/views/transaction.rs b/ethcore/src/views/transaction.rs index 25a6fde3a..60bcec90e 100644 --- a/ethcore/src/views/transaction.rs +++ b/ethcore/src/views/transaction.rs @@ -17,7 +17,7 @@ //! View onto transaction rlp use bigint::prelude::U256; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; use hash::keccak; use rlp::Rlp; diff --git a/ethcore/types/Cargo.toml b/ethcore/types/Cargo.toml index 8e156f416..73d7b2932 100644 --- a/ethcore/types/Cargo.toml +++ b/ethcore/types/Cargo.toml @@ -7,6 +7,7 @@ authors = ["Parity Technologies "] [dependencies] rlp = { path = "../../util/rlp" } rlp_derive = { path = "../../util/rlp_derive" } +ethcore-bytes = { path = "../../util/bytes" } ethcore-util = { path = "../../util" } ethcore-bigint = { path = "../../util/bigint" } ethjson = { path = "../../json" } diff --git a/ethcore/types/src/account_diff.rs b/ethcore/types/src/account_diff.rs index b862fb220..c1eb89d92 100644 --- a/ethcore/types/src/account_diff.rs +++ b/ethcore/types/src/account_diff.rs @@ -21,7 +21,7 @@ use std::fmt; use std::collections::BTreeMap; use bigint::prelude::U256; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; #[derive(Debug, PartialEq, Eq, Clone)] /// Diff type for specifying a change (or not). @@ -114,7 +114,7 @@ fn interpreted_hash(u: &H256) -> String { impl fmt::Display for AccountDiff { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use util::bytes::ToPretty; + use bytes::ToPretty; match self.nonce { Diff::Born(ref x) => write!(f, " non {}", x)?, diff --git a/ethcore/types/src/lib.rs b/ethcore/types/src/lib.rs index a3af37a69..85d36b200 100644 --- a/ethcore/types/src/lib.rs +++ b/ethcore/types/src/lib.rs @@ -18,6 +18,7 @@ extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate ethjson; extern crate rlp; #[macro_use] diff --git a/ethcore/types/src/log_entry.rs b/ethcore/types/src/log_entry.rs index 1878c66b9..ca56107b1 100644 --- a/ethcore/types/src/log_entry.rs +++ b/ethcore/types/src/log_entry.rs @@ -19,7 +19,8 @@ use std::ops::Deref; use hash::keccak; use heapsize::HeapSizeOf; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use bigint::hash::H256; use bloomable::Bloomable; diff --git a/ethcore/types/src/snapshot_manifest.rs b/ethcore/types/src/snapshot_manifest.rs index 8b7503bef..9e5f9f646 100644 --- a/ethcore/types/src/snapshot_manifest.rs +++ b/ethcore/types/src/snapshot_manifest.rs @@ -18,7 +18,7 @@ use bigint::hash::H256; use rlp::*; -use util::Bytes; +use bytes::Bytes; /// Manifest data. #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/ethcore/vm/Cargo.toml b/ethcore/vm/Cargo.toml index 6e5c7d3f2..957e6450d 100644 --- a/ethcore/vm/Cargo.toml +++ b/ethcore/vm/Cargo.toml @@ -6,7 +6,9 @@ authors = ["Parity Technologies "] [dependencies] byteorder = "1.0" ethcore-util = { path = "../../util" } +ethcore-bytes = { path = "../../util/bytes" } ethcore-bigint = { path = "../../util/bigint" } +trie = { path = "../../util/trie" } log = "0.3" common-types = { path = "../types" } evmjit = { path = "../../evmjit", optional = true } diff --git a/ethcore/vm/src/action_params.rs b/ethcore/vm/src/action_params.rs index 89e5da801..f87b1e558 100644 --- a/ethcore/vm/src/action_params.rs +++ b/ethcore/vm/src/action_params.rs @@ -17,7 +17,8 @@ //! Evm input params. use bigint::prelude::U256; use bigint::hash::{H256}; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use hash::{keccak, KECCAK_EMPTY}; use ethjson; diff --git a/ethcore/vm/src/error.rs b/ethcore/vm/src/error.rs index e4b199438..2c2c9a38d 100644 --- a/ethcore/vm/src/error.rs +++ b/ethcore/vm/src/error.rs @@ -16,7 +16,7 @@ //! VM errors module -use util::trie; +use trie; use std::fmt; /// VM errors. diff --git a/ethcore/vm/src/ext.rs b/ethcore/vm/src/ext.rs index d292af8d8..a4610b672 100644 --- a/ethcore/vm/src/ext.rs +++ b/ethcore/vm/src/ext.rs @@ -20,6 +20,7 @@ use std::sync::Arc; use bigint::prelude::U256; use bigint::hash::H256; use util::*; +use bytes::Bytes; use call_type::CallType; use env_info::EnvInfo; use schedule::Schedule; diff --git a/ethcore/vm/src/lib.rs b/ethcore/vm/src/lib.rs index ee8873b01..0bbef3702 100644 --- a/ethcore/vm/src/lib.rs +++ b/ethcore/vm/src/lib.rs @@ -18,10 +18,12 @@ extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate common_types as types; extern crate ethjson; extern crate rlp; extern crate hash; +extern crate trie; mod action_params; mod call_type; diff --git a/ethcore/vm/src/tests.rs b/ethcore/vm/src/tests.rs index 923216114..f56975a9e 100644 --- a/ethcore/vm/src/tests.rs +++ b/ethcore/vm/src/tests.rs @@ -19,7 +19,8 @@ use std::collections::{HashMap, HashSet}; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use { CallType, Schedule, EnvInfo, ReturnData, Ext, ContractCreateResult, MessageCallResult, diff --git a/evmbin/Cargo.toml b/evmbin/Cargo.toml index 310a2de25..efb6ba591 100644 --- a/evmbin/Cargo.toml +++ b/evmbin/Cargo.toml @@ -17,6 +17,7 @@ ethcore = { path = "../ethcore" } ethjson = { path = "../json" } ethcore-util = { path = "../util" } ethcore-bigint = { path = "../util/bigint" } +ethcore-bytes = { path = "../util/bytes" } evm = { path = "../ethcore/evm" } vm = { path = "../ethcore/vm" } panic_hook = { path = "../panic_hook" } diff --git a/evmbin/src/display/json.rs b/evmbin/src/display/json.rs index 47e9ccfe5..b36653c78 100644 --- a/evmbin/src/display/json.rs +++ b/evmbin/src/display/json.rs @@ -20,7 +20,7 @@ use ethcore::trace; use std::collections::HashMap; use bigint::prelude::U256; use bigint::hash::H256; -use util::ToPretty; +use bytes::ToPretty; use display; use info as vm; diff --git a/evmbin/src/display/simple.rs b/evmbin/src/display/simple.rs index bb4ecc127..9f6773734 100644 --- a/evmbin/src/display/simple.rs +++ b/evmbin/src/display/simple.rs @@ -17,7 +17,7 @@ //! Simple VM output. use ethcore::trace; -use util::ToPretty; +use bytes::ToPretty; use display; use info as vm; diff --git a/evmbin/src/main.rs b/evmbin/src/main.rs index bb6435ee0..695349db3 100644 --- a/evmbin/src/main.rs +++ b/evmbin/src/main.rs @@ -27,6 +27,7 @@ extern crate serde_derive; extern crate docopt; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate vm; extern crate evm; extern crate panic_hook; @@ -37,7 +38,8 @@ use std::path::PathBuf; use docopt::Docopt; use rustc_hex::FromHex; use bigint::prelude::U256; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; use ethcore::spec; use vm::{ActionParams, CallType}; diff --git a/hash-fetch/Cargo.toml b/hash-fetch/Cargo.toml index d5cec4d47..a063c65ff 100644 --- a/hash-fetch/Cargo.toml +++ b/hash-fetch/Cargo.toml @@ -18,6 +18,7 @@ parking_lot = "0.4" fetch = { path = "../util/fetch" } ethcore-util = { path = "../util" } ethcore-bigint = { path = "../util/bigint" } +ethcore-bytes = { path = "../util/bytes" } parity-reactor = { path = "../util/reactor" } native-contracts = { path = "../ethcore/native_contracts" } hash = { path = "../util/hash" } diff --git a/hash-fetch/src/lib.rs b/hash-fetch/src/lib.rs index ad048f3d9..3279f868f 100644 --- a/hash-fetch/src/lib.rs +++ b/hash-fetch/src/lib.rs @@ -26,6 +26,7 @@ extern crate mime; extern crate ethabi; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate futures; extern crate mime_guess; extern crate native_contracts; diff --git a/hash-fetch/src/urlhint.rs b/hash-fetch/src/urlhint.rs index c41b0b960..95a16511b 100644 --- a/hash-fetch/src/urlhint.rs +++ b/hash-fetch/src/urlhint.rs @@ -24,7 +24,8 @@ use hash::keccak; use futures::{future, BoxFuture, Future}; use native_contracts::{Registry, Urlhint}; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; const COMMIT_LEN: usize = 20; @@ -217,7 +218,8 @@ pub mod tests { use super::*; use super::guess_mime_type; use parking_lot::Mutex; - use util::{Bytes, Address, ToPretty}; + use util::Address; + use bytes::{Bytes, ToPretty}; pub struct FakeRegistrar { pub calls: Arc>>, diff --git a/ipc/tests/Cargo.toml b/ipc/tests/Cargo.toml index 89a4f98c5..3bf5dc316 100644 --- a/ipc/tests/Cargo.toml +++ b/ipc/tests/Cargo.toml @@ -14,6 +14,7 @@ semver = "0.6" nanomsg = { git = "https://github.com/paritytech/nanomsg.rs.git", branch = "parity-1.7" } ethcore-ipc-nano = { path = "../nano" } ethcore-util = { path = "../../util" } +ethcore-bytes = { path = "../../util/bytes" } log = "0.3" [build-dependencies] diff --git a/ipc/tests/binary.rs.in b/ipc/tests/binary.rs.in index dfc020c45..8b04f683b 100644 --- a/ipc/tests/binary.rs.in +++ b/ipc/tests/binary.rs.in @@ -15,7 +15,7 @@ // along with Parity. If not, see . -use util::Bytes; +use bytes::Bytes; #[binary] pub enum Root { diff --git a/ipc/tests/run.rs b/ipc/tests/run.rs index 607e20636..83e502aab 100644 --- a/ipc/tests/run.rs +++ b/ipc/tests/run.rs @@ -22,6 +22,7 @@ extern crate semver; extern crate nanomsg; extern crate ethcore_ipc_nano as nanoipc; extern crate ethcore_util as util; +extern crate ethcore_bytes as bytes; #[macro_use] extern crate log; pub mod service; diff --git a/ipfs/Cargo.toml b/ipfs/Cargo.toml index f56159399..89048081a 100644 --- a/ipfs/Cargo.toml +++ b/ipfs/Cargo.toml @@ -9,6 +9,7 @@ authors = ["Parity Technologies "] ethcore = { path = "../ethcore" } ethcore-util = { path = "../util" } ethcore-bigint = { path = "../util/bigint" } +ethcore-bytes = { path = "../util/bytes" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" } rlp = { path = "../util/rlp" } mime = "0.2" diff --git a/ipfs/src/lib.rs b/ipfs/src/lib.rs index ec065fa48..6a5f93092 100644 --- a/ipfs/src/lib.rs +++ b/ipfs/src/lib.rs @@ -23,6 +23,7 @@ extern crate rlp; extern crate ethcore; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate jsonrpc_http_server as http; pub mod error; diff --git a/ipfs/src/route.rs b/ipfs/src/route.rs index e95552404..37e34f69e 100644 --- a/ipfs/src/route.rs +++ b/ipfs/src/route.rs @@ -20,7 +20,7 @@ use cid::{ToCid, Codec}; use multihash::Hash; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; use ethcore::client::{BlockId, TransactionId}; type Reason = &'static str; diff --git a/parity/blockchain.rs b/parity/blockchain.rs index f21364214..b1bf8d4db 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -24,7 +24,8 @@ use rustc_hex::FromHex; use hash::{keccak, KECCAK_NULL_RLP}; use bigint::prelude::U256; use bigint::hash::H256; -use util::{ToPretty, Address}; +use util::Address; +use bytes::ToPretty; use rlp::PayloadInfo; use ethcore::service::ClientService; use ethcore::client::{Mode, DatabaseCompactionProfile, VMType, BlockImportError, BlockChainClient, BlockId}; diff --git a/parity/configuration.rs b/parity/configuration.rs index 88e5e8d02..856810d3c 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -25,7 +25,8 @@ use cli::{Args, ArgsError}; use hash::keccak; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Bytes, version_data, Address}; +use util::{version_data, Address}; +use bytes::Bytes; use util::journaldb::Algorithm; use ansi_term::Colour; use ethsync::{NetworkConfiguration, is_valid_node_url}; diff --git a/parity/dapps.rs b/parity/dapps.rs index 98eca3459..b23b759d5 100644 --- a/parity/dapps.rs +++ b/parity/dapps.rs @@ -31,7 +31,8 @@ use node_health::{SyncStatus, NodeHealth}; use rpc; use rpc_apis::SignerService; use parity_reactor; -use util::{Bytes, Address}; +use util::Address; +use bytes::Bytes; #[derive(Debug, PartialEq, Clone)] pub struct Configuration { diff --git a/parity/informant.rs b/parity/informant.rs index deb2190d1..a9f7d3636 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -36,7 +36,7 @@ use number_prefix::{binary_prefix, Standalone, Prefixed}; use parity_rpc::{is_major_importing}; use parity_rpc::informant::RpcStats; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; use parking_lot::{RwLock, Mutex}; /// Format byte counts to standard denominations. diff --git a/parity/main.rs b/parity/main.rs index 1f065d838..cd269b00b 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -59,6 +59,7 @@ extern crate ethcore_light as light; extern crate ethcore_logger; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate ethcore_network as network; extern crate ethkey; extern crate ethsync; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index c5b20cf1e..377a75b21 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -40,6 +40,7 @@ ethcore-io = { path = "../util/io" } ethcore-ipc = { path = "../ipc/rpc" } ethcore-util = { path = "../util" } ethcore-bigint = { path = "../util/bigint" } +ethcore-bytes = { path = "../util/bytes" } ethcore = { path = "../ethcore" } ethcrypto = { path = "../ethcrypto" } ethkey = { path = "../ethkey" } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index ba27bf290..caf998334 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -47,6 +47,7 @@ extern crate jsonrpc_pubsub; extern crate ethash; extern crate ethcore; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate ethcore_devtools as devtools; extern crate ethcore_io as io; extern crate ethcore_ipc; diff --git a/rpc/src/v1/helpers/dispatch.rs b/rpc/src/v1/helpers/dispatch.rs index 43386d5fa..c616a70e1 100644 --- a/rpc/src/v1/helpers/dispatch.rs +++ b/rpc/src/v1/helpers/dispatch.rs @@ -29,7 +29,8 @@ use rlp; use hash::keccak; use bigint::prelude::U256; use bigint::hash::{H256, H520}; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use parking_lot::{Mutex, RwLock}; use stats::Corpus; diff --git a/rpc/src/v1/helpers/requests.rs b/rpc/src/v1/helpers/requests.rs index 8c5307f5f..83abf9353 100644 --- a/rpc/src/v1/helpers/requests.rs +++ b/rpc/src/v1/helpers/requests.rs @@ -15,7 +15,8 @@ // along with Parity. If not, see . use bigint::prelude::U256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use v1::types::{Origin, TransactionCondition}; /// Transaction request coming from RPC diff --git a/rpc/src/v1/helpers/secretstore.rs b/rpc/src/v1/helpers/secretstore.rs index 246d0fa3f..b5528c778 100644 --- a/rpc/src/v1/helpers/secretstore.rs +++ b/rpc/src/v1/helpers/secretstore.rs @@ -18,7 +18,7 @@ use std::iter::repeat; use rand::{Rng, OsRng}; use ethkey::{Public, Secret, math}; use crypto; -use util::Bytes; +use bytes::Bytes; use jsonrpc_core::Error; use v1::helpers::errors; @@ -98,7 +98,7 @@ fn decrypt_with_shadow_coefficients(mut decrypted_shadow: Public, mut common_sha #[cfg(test)] mod tests { - use util::Bytes; + use bytes::Bytes; use rustc_hex::FromHex; use super::{encrypt_document, decrypt_document, decrypt_document_with_shadow}; diff --git a/rpc/src/v1/impls/eth_pubsub.rs b/rpc/src/v1/impls/eth_pubsub.rs index f279e2f81..a5770f0e5 100644 --- a/rpc/src/v1/impls/eth_pubsub.rs +++ b/rpc/src/v1/impls/eth_pubsub.rs @@ -40,7 +40,7 @@ use light::on_demand::OnDemand; use light::client::{LightChainClient, LightChainNotify}; use parity_reactor::Remote; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; use parking_lot::{RwLock, Mutex}; type Client = Sink; diff --git a/rpc/src/v1/impls/personal.rs b/rpc/src/v1/impls/personal.rs index b606d3e58..4573b8d1a 100644 --- a/rpc/src/v1/impls/personal.rs +++ b/rpc/src/v1/impls/personal.rs @@ -21,7 +21,8 @@ use ethcore::account_provider::AccountProvider; use ethcore::transaction::PendingTransaction; use bigint::prelude::U128; -use util::{Address, ToPretty}; +use util::Address; +use bytes::ToPretty; use futures::{future, Future, BoxFuture}; use jsonrpc_core::Error; diff --git a/rpc/src/v1/tests/helpers/miner_service.rs b/rpc/src/v1/tests/helpers/miner_service.rs index 65a0c25b7..92d36cf15 100644 --- a/rpc/src/v1/tests/helpers/miner_service.rs +++ b/rpc/src/v1/tests/helpers/miner_service.rs @@ -20,7 +20,8 @@ use std::collections::{BTreeMap, HashMap}; use std::collections::hash_map::Entry; use bigint::prelude::U256; use bigint::hash::H256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use parking_lot::{RwLock, Mutex}; use ethcore::error::Error; use ethcore::client::MiningBlockChainClient; diff --git a/rpc/src/v1/tests/helpers/snapshot_service.rs b/rpc/src/v1/tests/helpers/snapshot_service.rs index b81e05e7e..84202c7f8 100644 --- a/rpc/src/v1/tests/helpers/snapshot_service.rs +++ b/rpc/src/v1/tests/helpers/snapshot_service.rs @@ -16,7 +16,7 @@ use ethcore::snapshot::{ManifestData, RestorationStatus, SnapshotService}; -use util::Bytes; +use bytes::Bytes; use bigint::hash::H256; use parking_lot::Mutex; diff --git a/rpc/src/v1/tests/mocked/parity.rs b/rpc/src/v1/tests/mocked/parity.rs index bb7765446..32280804f 100644 --- a/rpc/src/v1/tests/mocked/parity.rs +++ b/rpc/src/v1/tests/mocked/parity.rs @@ -223,7 +223,7 @@ fn rpc_parity_extra_data() { #[test] fn rpc_parity_default_extra_data() { use util::misc; - use util::ToPretty; + use bytes::ToPretty; let deps = Dependencies::new(); let io = deps.default_client(); diff --git a/rpc/src/v1/tests/mocked/signer.rs b/rpc/src/v1/tests/mocked/signer.rs index 55f2eae77..af84d336a 100644 --- a/rpc/src/v1/tests/mocked/signer.rs +++ b/rpc/src/v1/tests/mocked/signer.rs @@ -17,7 +17,8 @@ use std::sync::Arc; use std::str::FromStr; use bigint::prelude::U256; -use util::{Address, ToPretty}; +use util::Address; +use bytes::ToPretty; use ethcore::account_provider::AccountProvider; use ethcore::client::TestBlockChainClient; diff --git a/rpc/src/v1/tests/mocked/signing.rs b/rpc/src/v1/tests/mocked/signing.rs index ee8787915..02e6e13a7 100644 --- a/rpc/src/v1/tests/mocked/signing.rs +++ b/rpc/src/v1/tests/mocked/signing.rs @@ -29,7 +29,8 @@ use v1::tests::helpers::TestMinerService; use v1::tests::mocked::parity; use bigint::prelude::U256; -use util::{Address, ToPretty}; +use util::Address; +use bytes::ToPretty; use ethkey::Secret; use ethcore::account_provider::AccountProvider; use ethcore::client::TestBlockChainClient; diff --git a/rpc/src/v1/types/confirmations.rs b/rpc/src/v1/types/confirmations.rs index 39bf8d0a1..fc4a0e303 100644 --- a/rpc/src/v1/types/confirmations.rs +++ b/rpc/src/v1/types/confirmations.rs @@ -19,7 +19,7 @@ use std::fmt; use serde::{Serialize, Serializer}; use ansi_term::Colour; -use util::bytes::ToPretty; +use bytes::ToPretty; use v1::types::{U256, TransactionRequest, RichRawTransaction, H160, H256, H520, Bytes, TransactionCondition, Origin}; use v1::helpers; diff --git a/secret_store/Cargo.toml b/secret_store/Cargo.toml index 9143b289a..ab13b9caa 100644 --- a/secret_store/Cargo.toml +++ b/secret_store/Cargo.toml @@ -27,6 +27,7 @@ tokio-proto = "0.1" url = "1.0" ethabi = "2.0" ethcore = { path = "../ethcore" } +ethcore-bytes = { path = "../util/bytes" } ethcore-devtools = { path = "../devtools" } ethcore-util = { path = "../util" } ethcore-bigint = { path = "../util/bigint" } diff --git a/secret_store/src/acl_storage.rs b/secret_store/src/acl_storage.rs index 0a30a1a60..c06929e94 100644 --- a/secret_store/src/acl_storage.rs +++ b/secret_store/src/acl_storage.rs @@ -22,7 +22,8 @@ use ethkey::public_to_address; use ethcore::client::{Client, BlockChainClient, BlockId, ChainNotify}; use native_contracts::SecretStoreAclStorage; use bigint::hash::H256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use types::all::{Error, ServerKeyId, Public}; const ACL_CHECKER_CONTRACT_REGISTRY_NAME: &'static str = "secretstore_acl_checker"; diff --git a/secret_store/src/key_server_set.rs b/secret_store/src/key_server_set.rs index ee959d0ba..8a94e9f42 100644 --- a/secret_store/src/key_server_set.rs +++ b/secret_store/src/key_server_set.rs @@ -24,7 +24,8 @@ use ethcore::client::{Client, BlockChainClient, BlockId, ChainNotify}; use native_contracts::KeyServerSet as KeyServerSetContract; use hash::keccak; use bigint::hash::H256; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use types::all::{Error, Public, NodeAddress}; const KEY_SERVER_SET_CONTRACT_REGISTRY_NAME: &'static str = "secretstore_server_set"; diff --git a/secret_store/src/lib.rs b/secret_store/src/lib.rs index cbad4ffe6..6c592ccc5 100644 --- a/secret_store/src/lib.rs +++ b/secret_store/src/lib.rs @@ -38,6 +38,7 @@ extern crate url; extern crate ethabi; extern crate ethcore; extern crate ethcore_devtools as devtools; +extern crate ethcore_bytes as bytes; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; extern crate ethcore_ipc as ipc; diff --git a/secret_store/src/serialization.rs b/secret_store/src/serialization.rs index caa74ec32..369e647ee 100644 --- a/secret_store/src/serialization.rs +++ b/secret_store/src/serialization.rs @@ -22,7 +22,7 @@ use serde::{Serialize, Deserialize, Serializer, Deserializer}; use serde::de::{Visitor, Error as SerdeError}; use ethkey::{Public, Secret, Signature}; use bigint::hash::H256; -use util::Bytes; +use bytes::Bytes; /// Serializable message hash. pub type SerializableMessageHash = SerializableH256; diff --git a/secret_store/src/types/all.rs b/secret_store/src/types/all.rs index 078d65649..1c4fb5946 100644 --- a/secret_store/src/types/all.rs +++ b/secret_store/src/types/all.rs @@ -19,7 +19,7 @@ use std::collections::BTreeMap; use serde_json; use ethkey; -use util; +use bytes; use bigint; use key_server_cluster; @@ -28,11 +28,11 @@ pub type NodeId = ethkey::Public; /// Server key id. When key is used to encrypt document, it could be document contents hash. pub type ServerKeyId = bigint::hash::H256; /// Encrypted document key type. -pub type EncryptedDocumentKey = util::Bytes; +pub type EncryptedDocumentKey = bytes::Bytes; /// Message hash. pub type MessageHash = bigint::hash::H256; /// Message signature. -pub type EncryptedMessageSignature = util::Bytes; +pub type EncryptedMessageSignature = bytes::Bytes; /// Request signature type. pub type RequestSignature = ethkey::Signature; /// Public key type. diff --git a/sync/Cargo.toml b/sync/Cargo.toml index f9edab512..d5ef8ed3c 100644 --- a/sync/Cargo.toml +++ b/sync/Cargo.toml @@ -13,6 +13,7 @@ ethcore-ipc-codegen = { path = "../ipc/codegen" } [dependencies] ethcore-util = { path = "../util" } +ethcore-bytes = { path = "../util/bytes" } ethcore-bigint = { path = "../util/bigint" } ethcore-network = { path = "../util/network" } ethcore-io = { path = "../util/io" } diff --git a/sync/src/api.rs b/sync/src/api.rs index 0dfe51efd..642b4472c 100644 --- a/sync/src/api.rs +++ b/sync/src/api.rs @@ -17,7 +17,7 @@ use std::sync::Arc; use std::collections::{HashMap, BTreeMap}; use std::io; -use util::Bytes; +use bytes::Bytes; use network::{NetworkProtocolHandler, NetworkService, NetworkContext, HostInfo, PeerId, ProtocolId, NetworkConfiguration as BasicNetworkConfiguration, NonReservedPeerMode, NetworkError, ConnectionFilter}; use bigint::prelude::U256; diff --git a/sync/src/blocks.rs b/sync/src/blocks.rs index 3696cd9d0..f7e616c6f 100644 --- a/sync/src/blocks.rs +++ b/sync/src/blocks.rs @@ -22,6 +22,7 @@ use heapsize::HeapSizeOf; use bigint::hash::H256; use triehash::ordered_trie_root; use util::*; +use bytes::Bytes; use rlp::*; use network::NetworkError; use ethcore::header::Header as BlockHeader; diff --git a/sync/src/chain.rs b/sync/src/chain.rs index f00baf5a6..42781fdc5 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -96,7 +96,7 @@ use heapsize::HeapSizeOf; use bigint::prelude::U256; use bigint::hash::{H256, H256FastMap}; use parking_lot::RwLock; -use util::*; +use bytes::Bytes; use rlp::*; use network::*; use ethcore::header::{BlockNumber, Header as BlockHeader}; @@ -2237,7 +2237,7 @@ mod tests { use bigint::hash::H256; use util::Address; use parking_lot::RwLock; - use util::bytes::Bytes; + use bytes::Bytes; use rlp::{Rlp, RlpStream, UntrustedRlp}; use super::*; use ::SyncConfig; diff --git a/sync/src/lib.rs b/sync/src/lib.rs index 4813bb474..6a65ec663 100644 --- a/sync/src/lib.rs +++ b/sync/src/lib.rs @@ -29,6 +29,7 @@ extern crate ethcore_network as network; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate ethcore_io as io; extern crate ethcore; extern crate env_logger; diff --git a/sync/src/snapshot.rs b/sync/src/snapshot.rs index 3abd47af4..88725929f 100644 --- a/sync/src/snapshot.rs +++ b/sync/src/snapshot.rs @@ -137,7 +137,7 @@ impl Snapshot { #[cfg(test)] mod test { use hash::keccak; - use util::*; + use bytes::Bytes; use super::*; use ethcore::snapshot::ManifestData; diff --git a/sync/src/sync_io.rs b/sync/src/sync_io.rs index 6871a2e20..0c3bd38e6 100644 --- a/sync/src/sync_io.rs +++ b/sync/src/sync_io.rs @@ -16,7 +16,7 @@ use std::collections::HashMap; use network::{NetworkContext, PeerId, PacketId, NetworkError, SessionInfo, ProtocolId}; -use util::Bytes; +use bytes::Bytes; use ethcore::client::BlockChainClient; use ethcore::header::BlockNumber; use ethcore::snapshot::SnapshotService; diff --git a/sync/src/tests/helpers.rs b/sync/src/tests/helpers.rs index e676f5467..6fb104ef7 100644 --- a/sync/src/tests/helpers.rs +++ b/sync/src/tests/helpers.rs @@ -18,7 +18,7 @@ use std::collections::{VecDeque, HashSet, HashMap}; use std::sync::Arc; use bigint::hash::H256; use parking_lot::RwLock; -use util::*; +use bytes::Bytes; use network::*; use tests::snapshot::*; use ethcore::client::{TestBlockChainClient, BlockChainClient, Client as EthcoreClient, ClientConfig, ChainNotify}; diff --git a/sync/src/tests/snapshot.rs b/sync/src/tests/snapshot.rs index a39b3949f..6ed616bae 100644 --- a/sync/src/tests/snapshot.rs +++ b/sync/src/tests/snapshot.rs @@ -19,7 +19,7 @@ use std::sync::Arc; use hash::keccak; use bigint::hash::H256; use parking_lot::Mutex; -use util::*; +use bytes::Bytes; use ethcore::snapshot::{SnapshotService, ManifestData, RestorationStatus}; use ethcore::header::BlockNumber; use ethcore::client::{EachBlockWith}; diff --git a/updater/Cargo.toml b/updater/Cargo.toml index 8dad116d0..0d4b29025 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -17,6 +17,7 @@ ethcore = { path = "../ethcore" } ethsync = { path = "../sync" } ethcore-util = { path = "../util" } ethcore-bigint = { path = "../util/bigint" } +ethcore-bytes = { path = "../util/bytes" } futures = "0.1" parking_lot = "0.4" parity-hash-fetch = { path = "../hash-fetch" } diff --git a/updater/src/lib.rs b/updater/src/lib.rs index 265f8de4e..9ba948d9f 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -19,6 +19,7 @@ #[macro_use] extern crate log; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate ipc_common_types; extern crate parking_lot; extern crate parity_hash_fetch as hash_fetch; diff --git a/updater/src/updater.rs b/updater/src/updater.rs index 325048fab..04fe572a9 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -32,7 +32,8 @@ use service::{Service}; use target_info::Target; use types::all::{ReleaseInfo, OperationsInfo, CapState}; use bigint::hash::{H160, H256}; -use util::{Address, Bytes}; +use util::Address; +use bytes::Bytes; use parking_lot::Mutex; use util::misc; diff --git a/util/Cargo.toml b/util/Cargo.toml index cc684c6cd..cef815099 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -30,6 +30,12 @@ lru-cache = "0.1.0" ethcore-logger = { path = "../logger" } triehash = { path = "triehash" } error-chain = "0.11.0-rc.2" +hashdb = { path = "hashdb" } +trie = { path = "trie" } +nibbleslice = { path = "nibbleslice" } +nibblevec = { path = "nibblevec" } +ethcore-bytes = { path = "bytes" } +memorydb = { path = "memorydb" } [features] default = [] diff --git a/util/benches/trie.rs b/util/benches/trie.rs index fb41c0377..3ec2f9ba0 100644 --- a/util/benches/trie.rs +++ b/util/benches/trie.rs @@ -19,16 +19,19 @@ extern crate test; extern crate triehash; extern crate ethcore_util; +extern crate ethcore_bytes; extern crate ethcore_bigint; +extern crate memorydb; +extern crate trie; #[macro_use] extern crate log; extern crate hash; use test::{Bencher, black_box}; use ethcore_bigint::hash::*; -use ethcore_util::bytes::*; -use ethcore_util::trie::*; -use ethcore_util::memorydb::*; +use ethcore_bytes::*; +use trie::*; +use memorydb::*; use triehash::*; use hash::keccak; diff --git a/util/bytes/Cargo.toml b/util/bytes/Cargo.toml new file mode 100644 index 000000000..96dc0abb1 --- /dev/null +++ b/util/bytes/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "ethcore-bytes" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] diff --git a/util/src/bytes.rs b/util/bytes/src/lib.rs similarity index 100% rename from util/src/bytes.rs rename to util/bytes/src/lib.rs diff --git a/util/hashdb/Cargo.toml b/util/hashdb/Cargo.toml new file mode 100644 index 000000000..d74e47a7e --- /dev/null +++ b/util/hashdb/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "hashdb" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +elastic-array = "0.9" +ethcore-bigint = { path = "../bigint" } diff --git a/util/src/hashdb.rs b/util/hashdb/src/lib.rs similarity index 57% rename from util/src/hashdb.rs rename to util/hashdb/src/lib.rs index 3c149a1a3..9162670e3 100644 --- a/util/src/hashdb.rs +++ b/util/hashdb/src/lib.rs @@ -15,6 +15,9 @@ // along with Parity. If not, see . //! Database of byte-slices keyed to their Keccak hash. +extern crate elastic_array; +extern crate ethcore_bigint as bigint; + use bigint::hash::*; use std::collections::HashMap; use elastic_array::ElasticArray128; @@ -29,59 +32,14 @@ pub trait HashDB: AsHashDB + Send + Sync { /// Look up a given hash into the bytes that hash to it, returning None if the /// hash is not known. - /// - /// # Examples - /// ```rust - /// extern crate ethcore_util; - /// use ethcore_util::hashdb::*; - /// use ethcore_util::memorydb::*; - /// fn main() { - /// let mut m = MemoryDB::new(); - /// let hello_bytes = "Hello world!".as_bytes(); - /// let hash = m.insert(hello_bytes); - /// assert_eq!(m.get(&hash).unwrap(), hello_bytes); - /// } - /// ``` fn get(&self, key: &H256) -> Option; /// Check for the existance of a hash-key. - /// - /// # Examples - /// ```rust - /// extern crate hash; - /// extern crate ethcore_util; - /// use ethcore_util::hashdb::*; - /// use ethcore_util::memorydb::*; - /// use hash::keccak; - /// fn main() { - /// let mut m = MemoryDB::new(); - /// let hello_bytes = "Hello world!".as_bytes(); - /// assert!(!m.contains(&keccak(hello_bytes))); - /// let key = m.insert(hello_bytes); - /// assert!(m.contains(&key)); - /// m.remove(&key); - /// assert!(!m.contains(&key)); - /// } - /// ``` fn contains(&self, key: &H256) -> bool; /// Insert a datum item into the DB and return the datum's hash for a later lookup. Insertions /// are counted and the equivalent number of `remove()`s must be performed before the data /// is considered dead. - /// - /// # Examples - /// ```rust - /// extern crate ethcore_util; - /// extern crate ethcore_bigint; - /// use ethcore_util::hashdb::*; - /// use ethcore_util::memorydb::*; - /// use ethcore_bigint::hash::*; - /// fn main() { - /// let mut m = MemoryDB::new(); - /// let key = m.insert("Hello world!".as_bytes()); - /// assert!(m.contains(&key)); - /// } - /// ``` fn insert(&mut self, value: &[u8]) -> H256; /// Like `insert()` , except you provide the key and the data is all moved. @@ -89,30 +47,6 @@ pub trait HashDB: AsHashDB + Send + Sync { /// Remove a datum previously inserted. Insertions can be "owed" such that the same number of `insert()`s may /// happen without the data being eventually being inserted into the DB. It can be "owed" more than once. - /// - /// # Examples - /// ```rust - /// extern crate ethcore_util; - /// extern crate hash; - /// use ethcore_util::hashdb::*; - /// use ethcore_util::memorydb::*; - /// use hash::keccak; - /// fn main() { - /// let mut m = MemoryDB::new(); - /// let d = "Hello world!".as_bytes(); - /// let key = &keccak(d); - /// m.remove(key); // OK - we now owe an insertion. - /// assert!(!m.contains(key)); - /// m.remove(key); // OK - we now owe two insertions. - /// assert!(!m.contains(key)); - /// m.insert(d); // OK - still owed. - /// assert!(!m.contains(key)); - /// m.insert(d); // OK - now it's "empty" again. - /// assert!(!m.contains(key)); - /// m.insert(d); // OK - now we've - /// assert_eq!(m.get(key).unwrap(), d); - /// } - /// ``` fn remove(&mut self, key: &H256); } diff --git a/util/memorydb/Cargo.toml b/util/memorydb/Cargo.toml new file mode 100644 index 000000000..1df95a049 --- /dev/null +++ b/util/memorydb/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "memorydb" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +bigint = "4.0" +elastic-array = "0.9" +heapsize = "0.4" +ethcore-bigint = { path = "../bigint", features = ["heapsizeof"] } +hash = { path = "../hash" } +hashdb = { path = "../hashdb" } +rlp = { path = "../rlp" } diff --git a/util/src/memorydb.rs b/util/memorydb/src/lib.rs similarity index 96% rename from util/src/memorydb.rs rename to util/memorydb/src/lib.rs index bffb7ea29..041d97250 100644 --- a/util/src/memorydb.rs +++ b/util/memorydb/src/lib.rs @@ -15,6 +15,11 @@ // along with Parity. If not, see . //! Reference-counted memory-based `HashDB` implementation. +extern crate heapsize; +extern crate ethcore_bigint as bigint; +extern crate rlp; +extern crate hash as keccak; +extern crate hashdb; use std::mem; use std::collections::HashMap; @@ -34,9 +39,10 @@ use hashdb::*; /// /// # Example /// ```rust -/// extern crate ethcore_util; -/// use ethcore_util::hashdb::*; -/// use ethcore_util::memorydb::*; +/// extern crate hashdb; +/// extern crate memorydb; +/// use hashdb::*; +/// use memorydb::*; /// fn main() { /// let mut m = MemoryDB::new(); /// let d = "Hello world!".as_bytes(); @@ -85,9 +91,10 @@ impl MemoryDB { /// /// # Examples /// ```rust - /// extern crate ethcore_util; - /// use ethcore_util::hashdb::*; - /// use ethcore_util::memorydb::*; + /// extern crate hashdb; + /// extern crate memorydb; + /// use hashdb::*; + /// use memorydb::*; /// fn main() { /// let mut m = MemoryDB::new(); /// let hello_bytes = "Hello world!".as_bytes(); diff --git a/util/network/Cargo.toml b/util/network/Cargo.toml index f8d1e673b..ba34bfac7 100644 --- a/util/network/Cargo.toml +++ b/util/network/Cargo.toml @@ -25,6 +25,7 @@ rustc-serialize = "0.3" ethcore-io = { path = "../io" } ethcore-util = { path = ".." } ethcore-bigint = { path = "../bigint" } +ethcore-bytes = { path = "../bytes" } ethcore-devtools = { path = "../../devtools" } ethkey = { path = "../../ethkey" } ethcrypto = { path = "../../ethcrypto" } diff --git a/util/network/src/connection.rs b/util/network/src/connection.rs index f30d46838..fd61b4b38 100644 --- a/util/network/src/connection.rs +++ b/util/network/src/connection.rs @@ -23,7 +23,7 @@ use mio::{Token, Ready, PollOpt}; use mio::deprecated::{Handler, EventLoop, TryRead, TryWrite}; use mio::tcp::*; use bigint::hash::*; -use util::bytes::*; +use ethcore_bytes::*; use rlp::*; use std::io::{self, Cursor, Read, Write}; use error::*; @@ -510,7 +510,7 @@ mod tests { use std::io::{Read, Write, Error, Cursor, ErrorKind}; use mio::{Ready}; use std::collections::VecDeque; - use util::bytes::Bytes; + use ethcore_bytes::Bytes; use devtools::*; use io::*; diff --git a/util/network/src/discovery.rs b/util/network/src/discovery.rs index 205f101bf..4ff389b3c 100644 --- a/util/network/src/discovery.rs +++ b/util/network/src/discovery.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::bytes::Bytes; +use ethcore_bytes::Bytes; use std::net::SocketAddr; use std::collections::{HashSet, HashMap, BTreeMap, VecDeque}; use std::mem; diff --git a/util/network/src/handshake.rs b/util/network/src/handshake.rs index 40ad57d6f..bb5a5cb5d 100644 --- a/util/network/src/handshake.rs +++ b/util/network/src/handshake.rs @@ -19,7 +19,7 @@ use rand::random; use hash::write_keccak; use mio::tcp::*; use bigint::hash::*; -use util::bytes::Bytes; +use ethcore_bytes::Bytes; use rlp::*; use connection::{Connection}; use host::{HostInfo}; diff --git a/util/network/src/lib.rs b/util/network/src/lib.rs index beece7ad9..f23998984 100644 --- a/util/network/src/lib.rs +++ b/util/network/src/lib.rs @@ -60,6 +60,7 @@ extern crate ethcore_io as io; extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes; extern crate parking_lot; extern crate mio; extern crate tiny_keccak; diff --git a/util/network/src/tests.rs b/util/network/src/tests.rs index f6c8ed1e8..bf0e08623 100644 --- a/util/network/src/tests.rs +++ b/util/network/src/tests.rs @@ -20,7 +20,7 @@ use std::sync::Arc; use std::thread; use std::time::*; use parking_lot::Mutex; -use util::Bytes; +use ethcore_bytes::Bytes; use io::TimerToken; use ethkey::{Random, Generator}; diff --git a/util/nibbleslice/Cargo.toml b/util/nibbleslice/Cargo.toml new file mode 100644 index 000000000..0d0021d85 --- /dev/null +++ b/util/nibbleslice/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "nibbleslice" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +elastic-array = "0.9" diff --git a/util/src/nibbleslice.rs b/util/nibbleslice/src/lib.rs similarity index 99% rename from util/src/nibbleslice.rs rename to util/nibbleslice/src/lib.rs index d56c5ca48..60fa11227 100644 --- a/util/src/nibbleslice.rs +++ b/util/nibbleslice/src/lib.rs @@ -15,6 +15,8 @@ // along with Parity. If not, see . //! Nibble-orientated view onto byte-slice, allowing nibble-precision offsets. +extern crate elastic_array; + use std::cmp::*; use std::fmt; use elastic_array::ElasticArray36; @@ -25,8 +27,8 @@ use elastic_array::ElasticArray36; /// /// # Example /// ```rust -/// extern crate ethcore_util; -/// use ethcore_util::nibbleslice::*; +/// extern crate nibbleslice; +/// use nibbleslice::*; /// fn main() { /// let d1 = &[0x01u8, 0x23, 0x45]; /// let d2 = &[0x34u8, 0x50, 0x12]; diff --git a/util/nibblevec/Cargo.toml b/util/nibblevec/Cargo.toml new file mode 100644 index 000000000..df8e990d4 --- /dev/null +++ b/util/nibblevec/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "nibblevec" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +elastic-array = "0.9" +nibbleslice = { path = "../nibbleslice" } diff --git a/util/src/nibblevec.rs b/util/nibblevec/src/lib.rs similarity index 98% rename from util/src/nibblevec.rs rename to util/nibblevec/src/lib.rs index b38198593..c33056467 100644 --- a/util/src/nibblevec.rs +++ b/util/nibblevec/src/lib.rs @@ -16,6 +16,8 @@ //! An owning, nibble-oriented byte vector. +extern crate nibbleslice; +extern crate elastic_array; use nibbleslice::NibbleSlice; use elastic_array::ElasticArray36; diff --git a/util/src/journaldb/archivedb.rs b/util/src/journaldb/archivedb.rs index e77c908d3..52f80a39f 100644 --- a/util/src/journaldb/archivedb.rs +++ b/util/src/journaldb/archivedb.rs @@ -21,13 +21,13 @@ use std::collections::hash_map::Entry; use std::sync::Arc; use rlp::*; use hashdb::*; -use memorydb::*; +use super::super::memorydb::*; use super::{DB_PREFIX_LEN, LATEST_ERA_KEY}; use super::traits::JournalDB; use kvdb::{KeyValueDB, DBTransaction}; use bigint::hash::H256; use error::{BaseDataError, UtilError}; -use {Bytes}; +use bytes::Bytes; /// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay /// and latent-removal semantics. diff --git a/util/src/journaldb/earlymergedb.rs b/util/src/journaldb/earlymergedb.rs index 2502fe219..a21a6eedb 100644 --- a/util/src/journaldb/earlymergedb.rs +++ b/util/src/journaldb/earlymergedb.rs @@ -30,7 +30,7 @@ use super::traits::JournalDB; use kvdb::{KeyValueDB, DBTransaction}; use bigint::hash::H256; use error::{BaseDataError, UtilError}; -use {Bytes}; +use bytes::Bytes; #[derive(Clone, PartialEq, Eq)] struct RefInfo { diff --git a/util/src/journaldb/overlayrecentdb.rs b/util/src/journaldb/overlayrecentdb.rs index c450e53d8..687333d67 100644 --- a/util/src/journaldb/overlayrecentdb.rs +++ b/util/src/journaldb/overlayrecentdb.rs @@ -29,7 +29,7 @@ use kvdb::{KeyValueDB, DBTransaction}; use super::JournalDB; use bigint::hash::{H256, H256FastMap}; use error::{BaseDataError, UtilError}; -use {Bytes}; +use bytes::Bytes; /// Implementation of the `JournalDB` trait for a disk-backed database with a memory overlay /// and, possibly, latent-removal semantics. diff --git a/util/src/journaldb/refcounteddb.rs b/util/src/journaldb/refcounteddb.rs index 7b970d640..bcdcdabb5 100644 --- a/util/src/journaldb/refcounteddb.rs +++ b/util/src/journaldb/refcounteddb.rs @@ -27,7 +27,8 @@ use super::{DB_PREFIX_LEN, LATEST_ERA_KEY}; use super::traits::JournalDB; use kvdb::{KeyValueDB, DBTransaction}; use bigint::hash::H256; -use {UtilError, Bytes}; +use UtilError; +use bytes::Bytes; /// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay /// and latent-removal semantics. diff --git a/util/src/journaldb/traits.rs b/util/src/journaldb/traits.rs index b70bbdcd9..c4cd2ad16 100644 --- a/util/src/journaldb/traits.rs +++ b/util/src/journaldb/traits.rs @@ -20,7 +20,8 @@ use std::sync::Arc; use hashdb::*; use kvdb::{self, DBTransaction}; use bigint::hash::H256; -use {Bytes, UtilError}; +use UtilError; +use bytes::Bytes; /// 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 1e2510c0a..4f394b2d4 100644 --- a/util/src/kvdb.rs +++ b/util/src/kvdb.rs @@ -28,7 +28,8 @@ 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}; +use UtilError; +use bytes::Bytes; #[cfg(target_os = "linux")] diff --git a/util/src/lib.rs b/util/src/lib.rs index 00399b823..1866ea54a 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -96,6 +96,7 @@ extern crate ethcore_devtools as devtools; extern crate libc; extern crate target_info; extern crate ethcore_bigint as bigint; +extern crate ethcore_bytes as bytes; extern crate parking_lot; extern crate tiny_keccak; extern crate rlp; @@ -104,6 +105,9 @@ extern crate lru_cache; extern crate heapsize; extern crate ethcore_logger; extern crate hash as keccak; +extern crate hashdb; +extern crate memorydb; +extern crate trie; #[macro_use] extern crate error_chain; @@ -114,17 +118,11 @@ extern crate log as rlog; #[macro_use] pub mod common; pub mod error; -pub mod bytes; pub mod misc; -pub mod hashdb; -pub mod memorydb; pub mod migration; pub mod overlaydb; pub mod journaldb; pub mod kvdb; -pub mod trie; -pub mod nibbleslice; -pub mod nibblevec; pub mod snappy; pub mod cache; @@ -133,10 +131,8 @@ pub use hashdb::*; pub use memorydb::MemoryDB; pub use overlaydb::*; pub use journaldb::JournalDB; -pub use trie::{Trie, TrieMut, TrieDB, TrieDBMut, TrieFactory, TrieError, SecTrieDB, SecTrieDBMut}; pub use kvdb::*; pub use error::UtilError; -pub use bytes::*; /// 160-bit integer representing account address pub type Address = bigint::hash::H160; diff --git a/util/src/misc.rs b/util/src/misc.rs index e33b5e857..6a1a11708 100644 --- a/util/src/misc.rs +++ b/util/src/misc.rs @@ -18,7 +18,7 @@ use rlp::RlpStream; use target_info::Target; -use Bytes; +use bytes::Bytes; include!(concat!(env!("OUT_DIR"), "/version.rs")); include!(concat!(env!("OUT_DIR"), "/rustc_version.rs")); diff --git a/util/trie/Cargo.toml b/util/trie/Cargo.toml new file mode 100644 index 000000000..f3df821e5 --- /dev/null +++ b/util/trie/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "trie" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +elastic-array = "0.9" +log = "0.3" +rand = "0.3" +ethcore-bytes = { path = "../bytes" } +ethcore-bigint = { path = "../bigint" } +hash = { path = "../hash" } +hashdb = { path = "../hashdb" } +rlp = { path = "../rlp" } +nibbleslice = { path = "../nibbleslice" } +nibblevec = { path = "../nibblevec" } +triehash = { path = "../triehash" } +memorydb = { path = "../memorydb" } +ethcore-logger = { path = "../../logger" } + + diff --git a/util/src/trie/fatdb.rs b/util/trie/src/fatdb.rs similarity index 98% rename from util/src/trie/fatdb.rs rename to util/trie/src/fatdb.rs index 0793c1ba5..4602482b1 100644 --- a/util/src/trie/fatdb.rs +++ b/util/trie/src/fatdb.rs @@ -105,7 +105,8 @@ impl<'db> Iterator for FatDBIterator<'db> { fn fatdb_to_trie() { use memorydb::MemoryDB; use hashdb::DBValue; - use trie::{FatDBMut, TrieMut}; + use super::fatdbmut::FatDBMut; + use super::TrieMut; let mut memdb = MemoryDB::new(); let mut root = H256::default(); diff --git a/util/src/trie/fatdbmut.rs b/util/trie/src/fatdbmut.rs similarity index 100% rename from util/src/trie/fatdbmut.rs rename to util/trie/src/fatdbmut.rs diff --git a/util/src/trie/mod.rs b/util/trie/src/lib.rs similarity index 96% rename from util/src/trie/mod.rs rename to util/trie/src/lib.rs index 457cc13e8..b927437d6 100644 --- a/util/src/trie/mod.rs +++ b/util/trie/src/lib.rs @@ -15,6 +15,20 @@ // along with Parity. If not, see . //! Trie interface and implementation. +extern crate rand; +extern crate ethcore_bigint as bigint; +extern crate hash as keccak; +extern crate rlp; +extern crate hashdb; +extern crate ethcore_bytes as bytes; +extern crate nibbleslice; +extern crate nibblevec; +extern crate elastic_array; +extern crate memorydb; +extern crate ethcore_logger; + +#[macro_use] +extern crate log; use std::fmt; use bigint::hash::H256; diff --git a/util/src/trie/lookup.rs b/util/trie/src/lookup.rs similarity index 100% rename from util/src/trie/lookup.rs rename to util/trie/src/lookup.rs diff --git a/util/src/trie/node.rs b/util/trie/src/node.rs similarity index 100% rename from util/src/trie/node.rs rename to util/trie/src/node.rs diff --git a/util/src/trie/recorder.rs b/util/trie/src/recorder.rs similarity index 98% rename from util/src/trie/recorder.rs rename to util/trie/src/recorder.rs index f2b7fd91f..ce52ff780 100644 --- a/util/src/trie/recorder.rs +++ b/util/trie/src/recorder.rs @@ -18,7 +18,7 @@ use keccak::keccak; use bigint::hash::H256; -use Bytes; +use bytes::Bytes; /// A record of a visited node. #[derive(PartialEq, Eq, Debug, Clone)] @@ -136,7 +136,7 @@ mod tests { #[test] fn trie_record() { - use trie::{TrieDB, TrieDBMut, Trie, TrieMut}; + use super::super::{TrieDB, TrieDBMut, Trie, TrieMut}; use memorydb::MemoryDB; let mut db = MemoryDB::new(); diff --git a/util/src/trie/sectriedb.rs b/util/trie/src/sectriedb.rs similarity index 98% rename from util/src/trie/sectriedb.rs rename to util/trie/src/sectriedb.rs index ce617d9d0..2bf55dd92 100644 --- a/util/src/trie/sectriedb.rs +++ b/util/trie/src/sectriedb.rs @@ -71,7 +71,7 @@ fn trie_to_sectrie() { use memorydb::MemoryDB; use hashdb::DBValue; use super::triedbmut::TrieDBMut; - use super::super::TrieMut; + use super::TrieMut; let mut memdb = MemoryDB::new(); let mut root = H256::default(); diff --git a/util/src/trie/sectriedbmut.rs b/util/trie/src/sectriedbmut.rs similarity index 100% rename from util/src/trie/sectriedbmut.rs rename to util/trie/src/sectriedbmut.rs diff --git a/util/src/trie/standardmap.rs b/util/trie/src/standardmap.rs similarity index 100% rename from util/src/trie/standardmap.rs rename to util/trie/src/standardmap.rs diff --git a/util/src/trie/triedb.rs b/util/trie/src/triedb.rs similarity index 98% rename from util/src/trie/triedb.rs rename to util/trie/src/triedb.rs index 208d257bb..6e46b5a7c 100644 --- a/util/src/trie/triedb.rs +++ b/util/trie/src/triedb.rs @@ -22,7 +22,7 @@ use super::node::{Node, OwnedNode}; use super::lookup::Lookup; use super::{Trie, TrieItem, TrieError, TrieIterator, Query}; use bigint::hash::H256; -use {ToPretty, Bytes}; +use bytes::{ToPretty, Bytes}; /// A `Trie` implementation using a generic `HashDB` backing database. /// @@ -31,12 +31,14 @@ use {ToPretty, Bytes}; /// /// # Example /// ``` -/// extern crate ethcore_util as util; +/// extern crate trie; +/// extern crate hashdb; +/// extern crate memorydb; /// extern crate ethcore_bigint as bigint; /// -/// use util::trie::*; -/// use util::hashdb::*; -/// use util::memorydb::*; +/// use trie::*; +/// use hashdb::*; +/// use memorydb::*; /// use bigint::hash::*; /// /// fn main() { diff --git a/util/src/trie/triedbmut.rs b/util/trie/src/triedbmut.rs similarity index 99% rename from util/src/trie/triedbmut.rs rename to util/trie/src/triedbmut.rs index 594bb1380..4ec5d78f9 100644 --- a/util/src/trie/triedbmut.rs +++ b/util/trie/src/triedbmut.rs @@ -21,10 +21,10 @@ use super::lookup::Lookup; use super::node::Node as RlpNode; use super::node::NodeKey; -use ::HashDB; -use ::bytes::ToPretty; -use ::nibbleslice::NibbleSlice; -use ::rlp::{Rlp, RlpStream}; +use hashdb::HashDB; +use bytes::ToPretty; +use nibbleslice::NibbleSlice; +use rlp::{Rlp, RlpStream}; use hashdb::DBValue; use std::collections::{HashSet, VecDeque}; @@ -261,14 +261,16 @@ impl<'a> Index<&'a StorageHandle> for NodeStorage { /// /// # Example /// ``` -/// extern crate ethcore_util as util; +/// extern crate trie; +/// extern crate hashdb; +/// extern crate memorydb; /// extern crate ethcore_bigint as bigint; /// extern crate hash; /// /// use hash::KECCAK_NULL_RLP; -/// use util::trie::*; -/// use util::hashdb::*; -/// use util::memorydb::*; +/// use trie::*; +/// use hashdb::*; +/// use memorydb::*; /// use bigint::hash::*; /// /// fn main() {