From ade37be25b57d2140b02a1b1368ca2979f3309e7 Mon Sep 17 00:00:00 2001 From: Hawstein Date: Thu, 7 Sep 2017 02:47:45 +0800 Subject: [PATCH 1/2] separate trie from util and make its dependencies into libs: * bytes * hashdb * memorydb * nibbleslice * nibblevec --- Cargo.lock | 87 +++++++++++++++++++ Cargo.toml | 1 + dapps/Cargo.toml | 1 + dapps/src/apps/fetcher/mod.rs | 2 +- dapps/src/lib.rs | 1 + dapps/src/tests/helpers/registrar.rs | 3 +- ethcore/Cargo.toml | 4 + ethcore/light/Cargo.toml | 3 + ethcore/light/src/cht.rs | 5 +- ethcore/light/src/lib.rs | 3 + ethcore/light/src/on_demand/request.rs | 11 +-- ethcore/light/src/types/request/mod.rs | 11 +-- ethcore/node_filter/Cargo.toml | 1 + ethcore/node_filter/src/lib.rs | 4 +- ethcore/res/wasm-tests | 2 +- ethcore/src/block.rs | 3 +- ethcore/src/blockchain/best_block.rs | 2 +- ethcore/src/blockchain/blockchain.rs | 1 + ethcore/src/blockchain/generator/block.rs | 2 +- ethcore/src/blockchain/generator/complete.rs | 2 +- ethcore/src/blockchain/generator/generator.rs | 2 +- ethcore/src/builtin.rs | 4 +- ethcore/src/client/chain_notify.rs | 2 +- ethcore/src/client/client.rs | 9 +- ethcore/src/client/error.rs | 2 +- ethcore/src/client/evm_test_client.rs | 8 +- ethcore/src/client/test_client.rs | 1 + ethcore/src/client/traits.rs | 5 +- ethcore/src/engines/authority_round/mod.rs | 1 + ethcore/src/engines/mod.rs | 2 + ethcore/src/engines/tendermint/message.rs | 1 + ethcore/src/engines/tendermint/mod.rs | 2 + ethcore/src/engines/validator_set/contract.rs | 2 + ethcore/src/engines/validator_set/mod.rs | 3 +- ethcore/src/engines/validator_set/multi.rs | 3 +- .../engines/validator_set/safe_contract.rs | 1 + ethcore/src/engines/validator_set/test.rs | 3 +- ethcore/src/engines/vote_collector.rs | 1 + ethcore/src/error.rs | 1 + ethcore/src/executed.rs | 4 +- ethcore/src/executive.rs | 3 +- ethcore/src/externalities.rs | 1 + ethcore/src/factory.rs | 4 +- ethcore/src/header.rs | 1 + ethcore/src/json_tests/executive.rs | 2 + ethcore/src/json_tests/trie.rs | 8 +- ethcore/src/lib.rs | 4 + ethcore/src/migrations/state/v7.rs | 3 +- ethcore/src/migrations/v10.rs | 4 +- ethcore/src/miner/miner.rs | 1 + ethcore/src/miner/mod.rs | 3 +- ethcore/src/pod_account.rs | 2 + ethcore/src/service.rs | 1 + ethcore/src/snapshot/account.rs | 7 +- ethcore/src/snapshot/block.rs | 5 +- ethcore/src/snapshot/consensus/authority.rs | 3 +- ethcore/src/snapshot/consensus/work.rs | 3 +- ethcore/src/snapshot/error.rs | 2 +- ethcore/src/snapshot/io.rs | 2 +- ethcore/src/snapshot/mod.rs | 5 +- ethcore/src/snapshot/service.rs | 5 +- .../src/snapshot/snapshot_service_trait.rs | 2 +- ethcore/src/snapshot/tests/helpers.rs | 6 +- ethcore/src/snapshot/tests/state.rs | 4 +- ethcore/src/snapshot/watcher.rs | 2 +- ethcore/src/spec/spec.rs | 1 + ethcore/src/state/account.rs | 8 +- ethcore/src/state/backend.rs | 2 +- ethcore/src/state/mod.rs | 7 +- ethcore/src/state_db.rs | 2 +- ethcore/src/tests/evm.rs | 1 + ethcore/src/tests/helpers.rs | 1 + ethcore/src/trace/executive_tracer.rs | 3 +- ethcore/src/trace/mod.rs | 3 +- ethcore/src/trace/noop_tracer.rs | 3 +- ethcore/src/trace/types/trace.rs | 3 +- ethcore/src/transaction.rs | 3 +- ethcore/src/tx_filter.rs | 3 +- ethcore/src/verification/queue/kind.rs | 2 +- ethcore/src/verification/verification.rs | 4 +- ethcore/src/views/block.rs | 2 +- ethcore/src/views/body.rs | 2 +- ethcore/src/views/header.rs | 3 +- ethcore/src/views/transaction.rs | 2 +- ethcore/types/Cargo.toml | 1 + ethcore/types/src/account_diff.rs | 4 +- ethcore/types/src/lib.rs | 1 + ethcore/types/src/log_entry.rs | 3 +- ethcore/types/src/snapshot_manifest.rs | 2 +- ethcore/vm/Cargo.toml | 2 + ethcore/vm/src/action_params.rs | 3 +- ethcore/vm/src/error.rs | 2 +- ethcore/vm/src/ext.rs | 1 + ethcore/vm/src/lib.rs | 2 + ethcore/vm/src/tests.rs | 3 +- evmbin/Cargo.toml | 1 + evmbin/src/display/json.rs | 2 +- evmbin/src/display/simple.rs | 2 +- evmbin/src/main.rs | 4 +- hash-fetch/Cargo.toml | 1 + hash-fetch/src/lib.rs | 1 + hash-fetch/src/urlhint.rs | 6 +- ipc/tests/Cargo.toml | 1 + ipc/tests/binary.rs.in | 2 +- ipc/tests/run.rs | 1 + ipfs/Cargo.toml | 1 + ipfs/src/lib.rs | 1 + ipfs/src/route.rs | 2 +- parity/blockchain.rs | 3 +- parity/configuration.rs | 3 +- parity/dapps.rs | 3 +- parity/informant.rs | 2 +- parity/main.rs | 1 + rpc/Cargo.toml | 1 + rpc/src/lib.rs | 1 + rpc/src/v1/helpers/dispatch.rs | 3 +- rpc/src/v1/helpers/requests.rs | 3 +- rpc/src/v1/helpers/secretstore.rs | 4 +- rpc/src/v1/impls/eth_pubsub.rs | 2 +- rpc/src/v1/impls/personal.rs | 3 +- rpc/src/v1/tests/helpers/miner_service.rs | 3 +- rpc/src/v1/tests/helpers/snapshot_service.rs | 2 +- rpc/src/v1/tests/mocked/parity.rs | 2 +- rpc/src/v1/tests/mocked/signer.rs | 3 +- rpc/src/v1/tests/mocked/signing.rs | 3 +- rpc/src/v1/types/confirmations.rs | 2 +- secret_store/Cargo.toml | 1 + secret_store/src/acl_storage.rs | 3 +- secret_store/src/key_server_set.rs | 3 +- secret_store/src/lib.rs | 1 + secret_store/src/serialization.rs | 2 +- secret_store/src/types/all.rs | 6 +- sync/Cargo.toml | 1 + sync/src/api.rs | 2 +- sync/src/blocks.rs | 1 + sync/src/chain.rs | 4 +- sync/src/lib.rs | 1 + sync/src/snapshot.rs | 2 +- sync/src/sync_io.rs | 2 +- sync/src/tests/helpers.rs | 2 +- sync/src/tests/snapshot.rs | 2 +- updater/Cargo.toml | 1 + updater/src/lib.rs | 1 + updater/src/updater.rs | 3 +- util/Cargo.toml | 6 ++ util/benches/trie.rs | 9 +- util/bytes/Cargo.toml | 6 ++ util/{src/bytes.rs => bytes/src/lib.rs} | 0 util/hashdb/Cargo.toml | 8 ++ util/{src/hashdb.rs => hashdb/src/lib.rs} | 72 +-------------- util/memorydb/Cargo.toml | 13 +++ util/{src/memorydb.rs => memorydb/src/lib.rs} | 19 ++-- util/network/Cargo.toml | 1 + util/network/src/connection.rs | 4 +- util/network/src/discovery.rs | 2 +- util/network/src/handshake.rs | 2 +- util/network/src/lib.rs | 1 + util/network/src/tests.rs | 2 +- util/nibbleslice/Cargo.toml | 7 ++ .../nibbleslice.rs => nibbleslice/src/lib.rs} | 6 +- util/nibblevec/Cargo.toml | 8 ++ .../nibblevec.rs => nibblevec/src/lib.rs} | 2 + util/src/journaldb/archivedb.rs | 4 +- util/src/journaldb/earlymergedb.rs | 2 +- util/src/journaldb/overlayrecentdb.rs | 2 +- util/src/journaldb/refcounteddb.rs | 3 +- util/src/journaldb/traits.rs | 3 +- util/src/kvdb.rs | 3 +- util/src/lib.rs | 12 +-- util/src/misc.rs | 2 +- util/trie/Cargo.toml | 21 +++++ util/{src/trie => trie/src}/fatdb.rs | 3 +- util/{src/trie => trie/src}/fatdbmut.rs | 0 util/{src/trie/mod.rs => trie/src/lib.rs} | 14 +++ util/{src/trie => trie/src}/lookup.rs | 0 util/{src/trie => trie/src}/node.rs | 0 util/{src/trie => trie/src}/recorder.rs | 4 +- util/{src/trie => trie/src}/sectriedb.rs | 2 +- util/{src/trie => trie/src}/sectriedbmut.rs | 0 util/{src/trie => trie/src}/standardmap.rs | 0 util/{src/trie => trie/src}/triedb.rs | 12 +-- util/{src/trie => trie/src}/triedbmut.rs | 18 ++-- 182 files changed, 497 insertions(+), 251 deletions(-) create mode 100644 util/bytes/Cargo.toml rename util/{src/bytes.rs => bytes/src/lib.rs} (100%) create mode 100644 util/hashdb/Cargo.toml rename util/{src/hashdb.rs => hashdb/src/lib.rs} (57%) create mode 100644 util/memorydb/Cargo.toml rename util/{src/memorydb.rs => memorydb/src/lib.rs} (96%) create mode 100644 util/nibbleslice/Cargo.toml rename util/{src/nibbleslice.rs => nibbleslice/src/lib.rs} (99%) create mode 100644 util/nibblevec/Cargo.toml rename util/{src/nibblevec.rs => nibblevec/src/lib.rs} (98%) create mode 100644 util/trie/Cargo.toml rename util/{src/trie => trie/src}/fatdb.rs (98%) rename util/{src/trie => trie/src}/fatdbmut.rs (100%) rename util/{src/trie/mod.rs => trie/src/lib.rs} (96%) rename util/{src/trie => trie/src}/lookup.rs (100%) rename util/{src/trie => trie/src}/node.rs (100%) rename util/{src/trie => trie/src}/recorder.rs (98%) rename util/{src/trie => trie/src}/sectriedb.rs (98%) rename util/{src/trie => trie/src}/sectriedbmut.rs (100%) rename util/{src/trie => trie/src}/standardmap.rs (100%) rename util/{src/trie => trie/src}/triedb.rs (98%) rename util/{src/trie => trie/src}/triedbmut.rs (99%) diff --git a/Cargo.lock b/Cargo.lock index a29e516dc2f..e3fd78eb9fc 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 5f3a6ad73d8..68a28807234 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 2c55b79cb85..cb384d01160 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 fe529d77222..8a11f7a9ba8 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 0cb0833af41..e579439d044 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 41f296f8d11..4df7e31b64a 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 5a2f7327af1..638454aacee 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 a96a7fb76ed..e7cf959ade8 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 d4d1f2294d1..d8a07fab966 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 07f862a1a27..4cf0b3e5848 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 d9afd5582ad..162e2bb3a1d 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 c623ca656cd..c33d8b4cce5 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 2d70c34613e..6043c0e5d5f 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 16a1bdd8f7c..276e6a5d717 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 fcac936bf68..5fd27564f1a 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 d6fa65a413d..63f79335d58 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 fd41f71e8db..baf8819c5e4 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 d44d8ff9bc2..88bed91a3f0 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 d5243dc66b5..4aba039a385 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 be5695d3694..7b9bc572a0f 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 a32e379422d..967fc37fdaa 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 ac272635419..191e04dc6ca 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 977e7b43552..00b744167cd 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 38dce1ffe8c..9fe9a4573f2 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 ff8b6d2ce10..2bb5b46d4b4 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 e6f5e46755c..2c465a24b16 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 b7245b25c15..eb3706e01bc 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 b7616a478e8..b4fc60f1409 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 b50ebbc4f73..4ea032411a1 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 fcf387f8b8e..b48ff2f3ffe 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 baaf9460195..5fec4f737ea 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 ce0a0da242b..6fe00aaabf1 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 24e396c1001..3f035d4241d 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 451abe6f2b8..32060f8bf03 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 043f8aab6db..baf82b88d58 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 c3f82e1814f..3e1279228b7 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 da89880caaa..e2a0c36c792 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 f759cbaf863..413d7538944 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 8b0554e5adf..9c7f7b4e2c4 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 909e1b6cbc0..490681dfbfb 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 c00046e0e56..98ead0b8e8d 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 5fc613844c2..b84fbfe5b8e 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 e283491e16e..e9edfa3bd84 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 8dca493a7fa..5cbd0d22b1c 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 f7b4bbe81d9..f6d3023c989 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 5d2696893f5..f7989bc09d8 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 82b3cfd9629..6edd2261ee0 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 64fa5b27244..4a9d850ad23 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 dd6968bbb51..d2f6952d402 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 b28288570a9..c088a18be17 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 b9bf7859e32..6e1504c2197 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 8f21de2987f..7276c054111 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 4e7e04341eb..ca283b0aa16 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 47598c86ebf..8fb990ca932 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 ed8c130d4f0..8143a49311c 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 28222bfb5f6..0c1d128086f 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 16b8a5c183a..349cce6852b 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 b7a310c0da6..bd0cb227b3c 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 dabb8628320..3f262229686 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 bd9672caf86..9b8cfb72600 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 72ef8ccc175..9cc841782fe 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 9ef7706b442..8208400df70 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 c93409c5184..e5e48bf5884 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 d3bea08dc0b..460dd77b50a 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 e4b236b88af..6c34cf39d6c 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 a807384be52..0cf5e7eb574 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 b46b5ec4c4a..2d9a37e817f 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 c0d0380e706..968d0cfd745 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 eb6deac23ac..8f7259c4b75 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 346312c3bf3..34279a382cb 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 8b51c348786..f8eb178d587 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 ac5669da7bc..80eadcfa5e8 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 fbc8eaee13d..38c134e6b4a 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 06f1afb0b6e..0a255b3577f 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 c39c805fb59..6def53c6ce1 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 a4efcee0e42..8c48e6a4a7c 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 ce767cd0deb..02f77d5f32e 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 b2b7828f1d3..e9863a15474 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 68631157944..47946ef7445 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 4ea0efe510c..80d433950db 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 27906c6c5ce..450b8bafd32 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 c9f78fc1cbd..092732d8a27 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 c3c446e19aa..d308a042dc8 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 25a6fde3a1f..60bcec90e80 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 8e156f41672..73d7b29323a 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 b862fb22078..c1eb89d9258 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 a3af37a69be..85d36b200d6 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 1878c66b97a..ca56107b14e 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 8b7503bef7b..9e5f9f6466c 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 6e5c7d3f20a..957e6450d6b 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 89e5da80162..f87b1e55855 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 e4b19943830..2c2c9a38d0a 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 d292af8d857..a4610b67288 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 ee8873b01af..0bbef370283 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 92321611418..f56975a9e82 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 310a2de25c7..efb6ba59136 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 47e9ccfe56d..b36653c789e 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 bb4ecc12744..9f677373425 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 bb6435ee034..695349db378 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 d5cec4d4708..a063c65ff33 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 ad048f3d9bb..3279f868f87 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 c41b0b960bf..95a16511b08 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 89a4f98c5b5..3bf5dc316ea 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 dfc020c454b..8b04f683b31 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 607e2063673..83e502aab69 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 f5615939997..89048081af2 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 ec065fa485d..6a5f93092f2 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 e955524041b..37e34f69ec7 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 f2136421416..b1bf8d4dbb6 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 88e5e8d028b..856810d3c72 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 98eca345957..b23b759d5c2 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 deb2190d133..a9f7d3636ee 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 1f065d8389a..cd269b00b61 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 c5b20cf1e3f..377a75b2187 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 ba27bf29078..caf9983345e 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 43386d5fa78..c616a70e1c1 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 8c5307f5f4f..83abf9353d7 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 246d0fa3f11..b5528c778c8 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 f279e2f81bc..a5770f0e51d 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 b606d3e58df..4573b8d1a20 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 65a0c25b705..92d36cf15a9 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 b81e05e7e76..84202c7f8d8 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 bb7765446c3..32280804fdf 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 55f2eae775d..af84d336a7b 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 ee878791558..02e6e13a72a 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 39bf8d0a1c8..fc4a0e30347 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 9143b289a0d..ab13b9caaa3 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 0a30a1a60e7..c06929e946e 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 ee959d0baa5..8a94e9f4275 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 cbad4ffe654..6c592ccc5ab 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 caa74ec32da..369e647eec7 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 078d65649ce..1c4fb5946cb 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 f9edab512de..d5ef8ed3cae 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 0dfe51efdee..642b4472c7e 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 3696cd9d0bb..f7e616c6fbd 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 f00baf5a61e..42781fdc58c 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 4813bb47488..6a65ec663d1 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 3abd47af450..88725929fe7 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 6871a2e205d..0c3bd38e62d 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 e676f5467b5..6fb104ef707 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 a39b3949f11..6ed616bae65 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 8dad116d071..0d4b2902599 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 265f8de4eb3..9ba948d9f7d 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 325048fab5c..04fe572a9a7 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 cc684c6cdf3..cef81509921 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 fb41c037713..3ec2f9ba0a7 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 00000000000..96dc0abb14f --- /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 00000000000..d74e47a7ef0 --- /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 3c149a1a327..9162670e3c1 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 00000000000..1df95a04941 --- /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 bffb7ea2933..041d97250a7 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 f8d1e673b8f..ba34bfac783 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 f30d46838df..fd61b4b38d7 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 205f101bfda..4ff389b3cb2 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 40ad57d6fe1..bb5a5cb5daa 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 beece7ad9bc..f2399898454 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 f6c8ed1e897..bf0e086230e 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 00000000000..0d0021d85d6 --- /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 d56c5ca4808..60fa1122777 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 00000000000..df8e990d4c7 --- /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 b38198593b2..c3305646709 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 e77c908d346..52f80a39fa0 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 2502fe21900..a21a6eedb2b 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 c450e53d833..687333d67a3 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 7b970d64057..bcdcdabb5bd 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 b70bbdcd995..c4cd2ad1679 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 1e2510c0a68..4f394b2d42c 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 00399b82364..1866ea54aa8 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 e33b5e85786..6a1a1170865 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 00000000000..f3df821e542 --- /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 0793c1ba545..4602482b1ee 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 457cc13e8ce..b927437d62a 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 f2b7fd91f53..ce52ff78023 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 ce617d9d02c..2bf55dd9249 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 208d257bbf7..6e46b5a7c93 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 594bb1380aa..4ec5d78f9a5 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() { From dd7a60c7a8e8216f0d797ef0e1dfea229a1fb527 Mon Sep 17 00:00:00 2001 From: Hawstein Date: Wed, 13 Sep 2017 01:23:02 +0800 Subject: [PATCH 2/2] rename trie to patricia-trie --- Cargo.lock | 60 +++++++++---------- ethcore/Cargo.toml | 2 +- ethcore/light/Cargo.toml | 2 +- ethcore/light/src/lib.rs | 2 +- ethcore/light/src/types/request/mod.rs | 2 +- ethcore/res/wasm-tests | 2 +- ethcore/src/lib.rs | 2 +- ethcore/vm/Cargo.toml | 2 +- ethcore/vm/src/lib.rs | 2 +- util/Cargo.toml | 2 +- util/benches/trie.rs | 2 +- util/{trie => patricia_trie}/Cargo.toml | 2 +- util/{trie => patricia_trie}/src/fatdb.rs | 0 util/{trie => patricia_trie}/src/fatdbmut.rs | 0 util/{trie => patricia_trie}/src/lib.rs | 0 util/{trie => patricia_trie}/src/lookup.rs | 0 util/{trie => patricia_trie}/src/node.rs | 0 util/{trie => patricia_trie}/src/recorder.rs | 0 util/{trie => patricia_trie}/src/sectriedb.rs | 0 .../src/sectriedbmut.rs | 0 .../src/standardmap.rs | 0 util/{trie => patricia_trie}/src/triedb.rs | 2 +- util/{trie => patricia_trie}/src/triedbmut.rs | 2 +- util/src/lib.rs | 2 +- 24 files changed, 44 insertions(+), 44 deletions(-) rename util/{trie => patricia_trie}/Cargo.toml (95%) rename util/{trie => patricia_trie}/src/fatdb.rs (100%) rename util/{trie => patricia_trie}/src/fatdbmut.rs (100%) rename util/{trie => patricia_trie}/src/lib.rs (100%) rename util/{trie => patricia_trie}/src/lookup.rs (100%) rename util/{trie => patricia_trie}/src/node.rs (100%) rename util/{trie => patricia_trie}/src/recorder.rs (100%) rename util/{trie => patricia_trie}/src/sectriedb.rs (100%) rename util/{trie => patricia_trie}/src/sectriedbmut.rs (100%) rename util/{trie => patricia_trie}/src/standardmap.rs (100%) rename util/{trie => patricia_trie}/src/triedb.rs (99%) rename util/{trie => patricia_trie}/src/triedbmut.rs (99%) diff --git a/Cargo.lock b/Cargo.lock index e3fd78eb9fc..3c88f0cdbea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -576,8 +576,8 @@ dependencies = [ "futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "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", + "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "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)", @@ -589,6 +589,7 @@ dependencies = [ "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)", "parking_lot 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia_trie 0.1.0", "price-info 1.7.0", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -602,7 +603,6 @@ 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", @@ -733,9 +733,10 @@ dependencies = [ "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.1.0", "parking_lot 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia_trie 0.1.0", "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)", @@ -743,7 +744,6 @@ 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", ] @@ -871,23 +871,23 @@ dependencies = [ "ethcore-devtools 1.8.0", "ethcore-logger 1.8.0", "hash 0.1.0", + "hashdb 0.1.0", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (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)", - "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", + "parking_lot 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia_trie 0.1.0", + "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "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)", ] @@ -1580,12 +1580,12 @@ dependencies = [ name = "memorydb" version = "0.1.0" dependencies = [ - "bigint 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bigint 4.2.0 (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)", + "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", ] @@ -2373,6 +2373,25 @@ dependencies = [ name = "path" version = "0.1.0" +[[package]] +name = "patricia_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.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.1.0", + "nibbleslice 0.1.0", + "nibblevec 0.1.0", + "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.2.0", + "triehash 0.1.0", +] + [[package]] name = "percent-encoding" version = "1.0.0" @@ -3304,25 +3323,6 @@ 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" @@ -3464,8 +3464,8 @@ dependencies = [ "hash 0.1.0", "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)", + "patricia_trie 0.1.0", "rlp 0.2.0", - "trie 0.1.0", ] [[package]] diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 638454aacee..9d82efd27d6 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -26,7 +26,7 @@ ethcore-bloom-journal = { path = "../util/bloom" } ethcore-bytes = { path = "../util/bytes" } hashdb = { path = "../util/hashdb" } memorydb = { path = "../util/memorydb" } -trie = { path = "../util/trie" } +patricia_trie = { path = "../util/patricia_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 e7cf959ade8..477b7077a7c 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -17,7 +17,7 @@ ethcore-util = { path = "../../util" } ethcore-bigint = { path = "../../util/bigint" } ethcore-bytes = { path = "../../util/bytes" } memorydb = { path = "../../util/memorydb" } -trie = { path = "../../util/trie" } +patricia_trie = { path = "../../util/patricia_trie" } ethcore-network = { path = "../../util/network" } ethcore-io = { path = "../../util/io" } ethcore-ipc = { path = "../../ipc/rpc", optional = true } diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 4cf0b3e5848..09eade4e768 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -78,7 +78,7 @@ extern crate heapsize; extern crate futures; extern crate itertools; extern crate memorydb; -extern crate trie; +extern crate patricia_trie as trie; extern crate rand; extern crate rlp; extern crate parking_lot; diff --git a/ethcore/light/src/types/request/mod.rs b/ethcore/light/src/types/request/mod.rs index c33d8b4cce5..d96278c2360 100644 --- a/ethcore/light/src/types/request/mod.rs +++ b/ethcore/light/src/types/request/mod.rs @@ -1542,7 +1542,7 @@ pub mod epoch_signal { use super::{Field, NoSuchOutput, OutputKind, Output}; use rlp::{Encodable, Decodable, DecoderError, RlpStream, UntrustedRlp}; use bigint::hash::H256; - use util::Bytes; + use bytes::Bytes; /// Potentially incomplete epoch signal request. #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/ethcore/res/wasm-tests b/ethcore/res/wasm-tests index 5fd27564f1a..fcac936bf68 160000 --- a/ethcore/res/wasm-tests +++ b/ethcore/res/wasm-tests @@ -1 +1 @@ -Subproject commit 5fd27564f1ab49b25bb419bfc0cc68137e1f12f2 +Subproject commit fcac936bf68cc271a6a6ac088efb458f3a08f38a diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 6edd2261ee0..689cc67f8e5 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -109,7 +109,7 @@ extern crate rlp; extern crate hash; extern crate heapsize; extern crate memorydb; -extern crate trie; +extern crate patricia_trie as trie; extern crate triehash; extern crate ansi_term; extern crate semantic_version; diff --git a/ethcore/vm/Cargo.toml b/ethcore/vm/Cargo.toml index 957e6450d6b..ade6750449e 100644 --- a/ethcore/vm/Cargo.toml +++ b/ethcore/vm/Cargo.toml @@ -8,7 +8,7 @@ byteorder = "1.0" ethcore-util = { path = "../../util" } ethcore-bytes = { path = "../../util/bytes" } ethcore-bigint = { path = "../../util/bigint" } -trie = { path = "../../util/trie" } +patricia_trie = { path = "../../util/patricia_trie" } log = "0.3" common-types = { path = "../types" } evmjit = { path = "../../evmjit", optional = true } diff --git a/ethcore/vm/src/lib.rs b/ethcore/vm/src/lib.rs index 0bbef370283..56a380597e6 100644 --- a/ethcore/vm/src/lib.rs +++ b/ethcore/vm/src/lib.rs @@ -23,7 +23,7 @@ extern crate common_types as types; extern crate ethjson; extern crate rlp; extern crate hash; -extern crate trie; +extern crate patricia_trie as trie; mod action_params; mod call_type; diff --git a/util/Cargo.toml b/util/Cargo.toml index cef81509921..28d53c6e565 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -31,7 +31,7 @@ ethcore-logger = { path = "../logger" } triehash = { path = "triehash" } error-chain = "0.11.0-rc.2" hashdb = { path = "hashdb" } -trie = { path = "trie" } +patricia_trie = { path = "patricia_trie" } nibbleslice = { path = "nibbleslice" } nibblevec = { path = "nibblevec" } ethcore-bytes = { path = "bytes" } diff --git a/util/benches/trie.rs b/util/benches/trie.rs index 3ec2f9ba0a7..953c188838b 100644 --- a/util/benches/trie.rs +++ b/util/benches/trie.rs @@ -22,7 +22,7 @@ extern crate ethcore_util; extern crate ethcore_bytes; extern crate ethcore_bigint; extern crate memorydb; -extern crate trie; +extern crate patricia_trie as trie; #[macro_use] extern crate log; extern crate hash; diff --git a/util/trie/Cargo.toml b/util/patricia_trie/Cargo.toml similarity index 95% rename from util/trie/Cargo.toml rename to util/patricia_trie/Cargo.toml index f3df821e542..0dcd74e0969 100644 --- a/util/trie/Cargo.toml +++ b/util/patricia_trie/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "trie" +name = "patricia_trie" version = "0.1.0" authors = ["Parity Technologies "] diff --git a/util/trie/src/fatdb.rs b/util/patricia_trie/src/fatdb.rs similarity index 100% rename from util/trie/src/fatdb.rs rename to util/patricia_trie/src/fatdb.rs diff --git a/util/trie/src/fatdbmut.rs b/util/patricia_trie/src/fatdbmut.rs similarity index 100% rename from util/trie/src/fatdbmut.rs rename to util/patricia_trie/src/fatdbmut.rs diff --git a/util/trie/src/lib.rs b/util/patricia_trie/src/lib.rs similarity index 100% rename from util/trie/src/lib.rs rename to util/patricia_trie/src/lib.rs diff --git a/util/trie/src/lookup.rs b/util/patricia_trie/src/lookup.rs similarity index 100% rename from util/trie/src/lookup.rs rename to util/patricia_trie/src/lookup.rs diff --git a/util/trie/src/node.rs b/util/patricia_trie/src/node.rs similarity index 100% rename from util/trie/src/node.rs rename to util/patricia_trie/src/node.rs diff --git a/util/trie/src/recorder.rs b/util/patricia_trie/src/recorder.rs similarity index 100% rename from util/trie/src/recorder.rs rename to util/patricia_trie/src/recorder.rs diff --git a/util/trie/src/sectriedb.rs b/util/patricia_trie/src/sectriedb.rs similarity index 100% rename from util/trie/src/sectriedb.rs rename to util/patricia_trie/src/sectriedb.rs diff --git a/util/trie/src/sectriedbmut.rs b/util/patricia_trie/src/sectriedbmut.rs similarity index 100% rename from util/trie/src/sectriedbmut.rs rename to util/patricia_trie/src/sectriedbmut.rs diff --git a/util/trie/src/standardmap.rs b/util/patricia_trie/src/standardmap.rs similarity index 100% rename from util/trie/src/standardmap.rs rename to util/patricia_trie/src/standardmap.rs diff --git a/util/trie/src/triedb.rs b/util/patricia_trie/src/triedb.rs similarity index 99% rename from util/trie/src/triedb.rs rename to util/patricia_trie/src/triedb.rs index 6e46b5a7c93..6c1a0da01d9 100644 --- a/util/trie/src/triedb.rs +++ b/util/patricia_trie/src/triedb.rs @@ -31,7 +31,7 @@ use bytes::{ToPretty, Bytes}; /// /// # Example /// ``` -/// extern crate trie; +/// extern crate patricia_trie as trie; /// extern crate hashdb; /// extern crate memorydb; /// extern crate ethcore_bigint as bigint; diff --git a/util/trie/src/triedbmut.rs b/util/patricia_trie/src/triedbmut.rs similarity index 99% rename from util/trie/src/triedbmut.rs rename to util/patricia_trie/src/triedbmut.rs index 4ec5d78f9a5..d0e22d2fb08 100644 --- a/util/trie/src/triedbmut.rs +++ b/util/patricia_trie/src/triedbmut.rs @@ -261,7 +261,7 @@ impl<'a> Index<&'a StorageHandle> for NodeStorage { /// /// # Example /// ``` -/// extern crate trie; +/// extern crate patricia_trie as trie; /// extern crate hashdb; /// extern crate memorydb; /// extern crate ethcore_bigint as bigint; diff --git a/util/src/lib.rs b/util/src/lib.rs index 1866ea54aa8..d4b1e544d02 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -107,7 +107,7 @@ extern crate ethcore_logger; extern crate hash as keccak; extern crate hashdb; extern crate memorydb; -extern crate trie; +extern crate patricia_trie as trie; #[macro_use] extern crate error_chain;