diff --git a/Cargo.lock b/Cargo.lock index 9969ce279..7d6d08344 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,7 +270,7 @@ dependencies = [ "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp_derive 0.1.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -543,7 +543,7 @@ dependencies = [ "evm 0.1.0", "fake-hardware-wallet 0.0.1", "hardware-wallet 1.12.0", - "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "journaldb 0.2.0", @@ -557,7 +557,7 @@ dependencies = [ "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "macros 0.1.0", "memory-cache 0.1.0", - "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -565,11 +565,11 @@ dependencies = [ "parity-machine 0.1.0", "parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "patricia-trie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia-trie 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie-ethereum 0.1.0", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp_compress 0.1.0", "rlp_derive 0.1.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -624,7 +624,7 @@ dependencies = [ "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "fastmap 0.1.0", "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -633,13 +633,13 @@ dependencies = [ "kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "memory-cache 0.1.0", - "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "patricia-trie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia-trie 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie-ethereum 0.1.0", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp_derive 0.1.0", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", @@ -687,7 +687,7 @@ dependencies = [ "parity-reactor 0.1.0", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "price-info 1.12.0", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "trace-time 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "transaction-pool 1.13.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -707,7 +707,7 @@ dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "parity-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -735,7 +735,7 @@ dependencies = [ "parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", @@ -770,10 +770,10 @@ dependencies = [ "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "patricia-trie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia-trie 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie-ethereum 0.1.0", "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp_derive 0.1.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", @@ -875,15 +875,18 @@ dependencies = [ "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.3.0", "fastmap 0.1.0", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak-hasher 0.1.1", + "kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "macros 0.1.0", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "trace-time 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "triehash-ethereum 0.2.0", @@ -899,7 +902,7 @@ dependencies = [ "evm 0.1.0", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unexpected 0.1.0", ] @@ -1207,11 +1210,8 @@ dependencies = [ [[package]] name = "hashdb" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "heapsize" @@ -1396,17 +1396,17 @@ dependencies = [ "ethcore-logger 1.12.0", "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "fastmap 0.1.0", - "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.1.1", "kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1519,7 +1519,7 @@ name = "keccak-hasher" version = "0.1.1" dependencies = [ "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1721,14 +1721,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memorydb" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2070,7 +2069,7 @@ dependencies = [ "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "registrar 0.0.1", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rpc-cli 1.4.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2122,7 +2121,7 @@ dependencies = [ "jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", "multihash 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2137,7 +2136,7 @@ dependencies = [ "kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2231,10 +2230,10 @@ dependencies = [ "parity-updater 1.12.0", "parity-version 2.2.0", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "patricia-trie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia-trie 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2332,7 +2331,7 @@ name = "parity-version" version = "2.2.0" dependencies = [ "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2366,7 +2365,7 @@ dependencies = [ "parity-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2411,11 +2410,11 @@ dependencies = [ [[package]] name = "patricia-trie" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2427,13 +2426,13 @@ version = "0.1.0" dependencies = [ "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.1.1", - "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memorydb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "patricia-trie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia-trie 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2779,13 +2778,23 @@ dependencies = [ "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rlp_compress" version = "0.1.0" dependencies = [ "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2794,7 +2803,7 @@ version = "0.1.0" dependencies = [ "proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3502,12 +3511,11 @@ dependencies = [ [[package]] name = "triehash" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3516,7 +3524,7 @@ version = "0.2.0" dependencies = [ "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.1.1", - "triehash 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "triehash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3650,9 +3658,9 @@ dependencies = [ "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "patricia-trie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "patricia-trie 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie-ethereum 0.1.0", - "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3906,7 +3914,7 @@ dependencies = [ "checksum getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0a7292d30132fb5424b354f5dc02512a86e4c516fe544bb7a25e7f266951b797" "checksum globset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "464627f948c3190ae3d04b1bc6d7dca2f785bda0ac01278e6db129ad383dbeb6" "checksum hamming 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65043da274378d68241eb9a8f8f8aa54e349136f7b8e12f63e3ef44043cc30e1" -"checksum hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f1c71fc577cde89b3345d5f2880fecaf462a32e96c619f431279bdaf1ba5ddb1" +"checksum hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d91261ee336dd046ac7df28306cb297b7a7228bd1ae25e9a57f4ed5e0ab628c7" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" "checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" @@ -3958,7 +3966,7 @@ dependencies = [ "checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" -"checksum memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f72c93304ad51e21230ecbd0d2b58a3f94703bf9339d14aed88c3aaf5e8b7a56" +"checksum memorydb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e143fbad9f90d2158bca3c4b09015276a6de6f085a77088943901cb26828780f" "checksum mime 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "4b082692d3f6cf41b453af73839ce3dfc212c4411cbb2441dff80a716e38bd79" "checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" @@ -3996,7 +4004,7 @@ dependencies = [ "checksum parity-wordlist 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf13102febd98f4ad416a526b42deb82daf482626ba6ab10d0ebf8f45327514c" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" -"checksum patricia-trie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46be3bf26e050bcaac60d0a8373f912a4734bb8bd4bf5ecda66ee997b86bddfc" +"checksum patricia-trie 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "10438ba40c2f6e9ceca55277d8e7f6a5dafd58cabd802e6d97e16f02aab83a03" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "cec29da322b242f4c3098852c77a0ca261c9c01b806cae85a5572a1eb94db9a6" @@ -4032,6 +4040,7 @@ dependencies = [ "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum ring 0.12.1 (git+https://github.com/paritytech/ring)" = "" "checksum rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "524c5ad554859785dfc8469df3ed5e0b5784d4d335877ed47c8d90fc0eb238fe" +"checksum rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16d1effe9845d54f90e7be8420ee49e5c94623140b97ee4bc6fb5bfddb745720" "checksum rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b273c91bd242ca03ad6d71c143b6f17a48790e61f21a6c78568fa2b6774a24a4" "checksum rprompt 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1601f32bc5858aae3cbfa1c645c96c4d820cc5c16be0194f089560c00b6eb625" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" @@ -4109,7 +4118,7 @@ dependencies = [ "checksum transient-hashmap 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aeb4b191d033a35edfce392a38cdcf9790b6cebcb30fa690c312c29da4dc433e" "checksum trezor-sys 1.0.0 (git+https://github.com/paritytech/trezor-sys)" = "" "checksum trie-standardmap 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e26f52976a57a0859616d6fcec87092ac35d08eabbd78dc3dabee93b480ea5f" -"checksum triehash 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3da77dc2c88bac48769c53f2c7675d99d522a7fc8130da3fadf29d7c6f94c9ac" +"checksum triehash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9cb3a626dd9a19a1b5f84087143b19409db793d902c5ddee4b6212020713f1" "checksum try-lock 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2aa4715743892880f70885373966c83d73ef1b0838a664ef0c76fffd35e7c2" "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" "checksum uint 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "754ba11732b9161b94c41798e5197e5e75388d012f760c42adb5000353e98646" diff --git a/Cargo.toml b/Cargo.toml index 787e33661..618e41d6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ ethcore-transaction = { path = "ethcore/transaction" } ethereum-types = "0.4" node-filter = { path = "ethcore/node_filter" } ethkey = { path = "ethkey" } -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } rpc-cli = { path = "rpc_cli" } parity-hash-fetch = { path = "hash-fetch" } parity-ipfs-api = { path = "ipfs" } diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index e452f4b7c..93762b4c4 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -16,9 +16,9 @@ crossbeam = "0.3" ethash = { path = "../ethash" } ethcore-bloom-journal = { path = "../util/bloom" } parity-bytes = "0.1" -hashdb = "0.2.1" -memorydb = "0.2.1" -patricia-trie = "0.2" +hashdb = "0.3.0" +memorydb = "0.3.0" +patricia-trie = "0.3.0" patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" } parity-crypto = "0.1" error-chain = { version = "0.12", default-features = false } @@ -47,7 +47,7 @@ parity-machine = { path = "../machine" } parking_lot = "0.6" rayon = "1.0" rand = "0.4" -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } rlp_compress = { path = "../util/rlp_compress" } rlp_derive = { path = "../util/rlp_derive" } kvdb = "0.1" diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml index 8790e2fbd..4d58abaa3 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -12,16 +12,16 @@ ethcore = { path = ".."} parity-bytes = "0.1" ethcore-transaction = { path = "../transaction" } ethereum-types = "0.4" -memorydb = "0.2.1" -patricia-trie = "0.2" +memorydb = "0.3.0" +patricia-trie = "0.3.0" patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" } ethcore-network = { path = "../../util/network" } ethcore-io = { path = "../../util/io" } -hashdb = "0.2.1" +hashdb = "0.3.0" heapsize = "0.4" vm = { path = "../vm" } fastmap = { path = "../../util/fastmap" } -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } rlp_derive = { path = "../../util/rlp_derive" } smallvec = "0.6" futures = "0.1" diff --git a/ethcore/light/src/cht.rs b/ethcore/light/src/cht.rs index a8e57b04a..c6665f857 100644 --- a/ethcore/light/src/cht.rs +++ b/ethcore/light/src/cht.rs @@ -27,6 +27,7 @@ use ethcore::ids::BlockId; use ethereum_types::{H256, U256}; use hashdb::HashDB; use keccak_hasher::KeccakHasher; +use kvdb::DBValue; use memorydb::MemoryDB; use bytes::Bytes; use trie::{TrieMut, Trie, Recorder}; @@ -52,13 +53,13 @@ pub const SIZE: u64 = 2048; /// A canonical hash trie. This is generic over any database it can query. /// See module docs for more details. #[derive(Debug, Clone)] -pub struct CHT> { +pub struct CHT> { db: DB, root: H256, // the root of this CHT. number: u64, } -impl> CHT { +impl> CHT { /// Query the root of the CHT. pub fn root(&self) -> H256 { self.root } @@ -92,10 +93,10 @@ pub struct BlockInfo { /// Build an in-memory CHT from a closure which provides necessary information /// about blocks. If the fetcher ever fails to provide the info, the CHT /// will not be generated. -pub fn build(cht_num: u64, mut fetcher: F) -> Option>> +pub fn build(cht_num: u64, mut fetcher: F) -> Option>> where F: FnMut(BlockId) -> Option { - let mut db = MemoryDB::::new(); + let mut db = MemoryDB::::new(); // start from the last block by number and work backwards. let last_num = start_number(cht_num + 1) - 1; @@ -134,7 +135,7 @@ pub fn compute_root(cht_num: u64, iterable: I) -> Option let start_num = start_number(cht_num) as usize; for (i, (h, td)) in iterable.into_iter().take(SIZE as usize).enumerate() { - v.push((key!(i + start_num).into_vec(), val!(h, td).into_vec())) + v.push((key!(i + start_num), val!(h, td))) } if v.len() == SIZE as usize { @@ -149,7 +150,7 @@ pub fn compute_root(cht_num: u64, iterable: I) -> Option /// verify the given trie branch and extract the canonical hash and total difficulty. // TODO: better support for partially-checked queries. pub fn check_proof(proof: &[Bytes], num: u64, root: H256) -> Option<(H256, U256)> { - let mut db = MemoryDB::::new(); + let mut db = MemoryDB::::new(); for node in proof { db.insert(&node[..]); } let res = match TrieDB::new(&db, &root) { diff --git a/ethcore/light/src/client/header_chain.rs b/ethcore/light/src/client/header_chain.rs index fa42f50da..f6d903176 100644 --- a/ethcore/light/src/client/header_chain.rs +++ b/ethcore/light/src/client/header_chain.rs @@ -218,7 +218,7 @@ impl HeaderChain { ) -> Result { let mut live_epoch_proofs = ::std::collections::HashMap::default(); - let genesis = ::rlp::encode(&spec.genesis_header()).into_vec(); + let genesis = ::rlp::encode(&spec.genesis_header()); let decoded_header = spec.genesis_header(); let chain = if let Some(current) = db.get(col, CURRENT_KEY)? { diff --git a/ethcore/light/src/net/tests/mod.rs b/ethcore/light/src/net/tests/mod.rs index b20349fec..d1939015c 100644 --- a/ethcore/light/src/net/tests/mod.rs +++ b/ethcore/light/src/net/tests/mod.rs @@ -150,7 +150,7 @@ impl Provider for TestProvider { fn storage_proof(&self, req: request::CompleteStorageRequest) -> Option { Some(StorageResponse { - proof: vec![::rlp::encode(&req.key_hash).into_vec()], + proof: vec![::rlp::encode(&req.key_hash)], value: req.key_hash | req.address_hash, }) } diff --git a/ethcore/light/src/on_demand/request.rs b/ethcore/light/src/on_demand/request.rs index 76ecf879d..a0adc5081 100644 --- a/ethcore/light/src/on_demand/request.rs +++ b/ethcore/light/src/on_demand/request.rs @@ -1156,7 +1156,7 @@ mod tests { header.set_number(10_000); header.set_extra_data(b"test_header".to_vec()); let hash = header.hash(); - let raw_header = encoded::Header::new(::rlp::encode(&header).into_vec()); + let raw_header = encoded::Header::new(::rlp::encode(&header)); let cache = Mutex::new(make_cache()); assert!(HeaderByHash(hash.into()).check_response(&cache, &hash.into(), &[raw_header]).is_ok()) @@ -1177,14 +1177,14 @@ mod tests { headers.reverse(); // because responses are in reverse order let raw_headers = headers.iter() - .map(|hdr| encoded::Header::new(::rlp::encode(hdr).into_vec())) + .map(|hdr| encoded::Header::new(::rlp::encode(hdr))) .collect::>(); let mut invalid_successor = Header::new(); invalid_successor.set_number(11); invalid_successor.set_parent_hash(headers[1].hash()); - let raw_invalid_successor = encoded::Header::new(::rlp::encode(&invalid_successor).into_vec()); + let raw_invalid_successor = encoded::Header::new(::rlp::encode(&invalid_successor)); let cache = Mutex::new(make_cache()); @@ -1247,10 +1247,10 @@ mod tests { let mut body_stream = RlpStream::new_list(2); body_stream.begin_list(0).begin_list(0); - let req = Body(encoded::Header::new(::rlp::encode(&header).into_vec()).into()); + let req = Body(encoded::Header::new(::rlp::encode(&header)).into()); let cache = Mutex::new(make_cache()); - let response = encoded::Body::new(body_stream.drain().into_vec()); + let response = encoded::Body::new(body_stream.drain()); assert!(req.check_response(&cache, &response).is_ok()) } @@ -1270,7 +1270,7 @@ mod tests { header.set_receipts_root(receipts_root); - let req = BlockReceipts(encoded::Header::new(::rlp::encode(&header).into_vec()).into()); + let req = BlockReceipts(encoded::Header::new(::rlp::encode(&header)).into()); let cache = Mutex::new(make_cache()); assert!(req.check_response(&cache, &receipts).is_ok()) @@ -1318,7 +1318,7 @@ mod tests { header.set_state_root(root.clone()); let req = Account { - header: encoded::Header::new(::rlp::encode(&header).into_vec()).into(), + header: encoded::Header::new(::rlp::encode(&header)).into(), address: addr, }; @@ -1332,7 +1332,7 @@ mod tests { let code_hash = keccak(&code); let header = Header::new(); let req = Code { - header: encoded::Header::new(::rlp::encode(&header).into_vec()).into(), + header: encoded::Header::new(::rlp::encode(&header)).into(), code_hash: code_hash.into(), }; diff --git a/ethcore/light/src/types/request/mod.rs b/ethcore/light/src/types/request/mod.rs index a6e53bc10..c57e8383e 100644 --- a/ethcore/light/src/types/request/mod.rs +++ b/ethcore/light/src/types/request/mod.rs @@ -1676,7 +1676,7 @@ mod tests { let full_req = Request::Headers(req.clone()); let res = HeadersResponse { headers: vec![ - ::ethcore::encoded::Header::new(::rlp::encode(&Header::default()).into_vec()) + ::ethcore::encoded::Header::new(::rlp::encode(&Header::default())) ] }; let full_res = Response::Headers(res.clone()); diff --git a/ethcore/private-tx/Cargo.toml b/ethcore/private-tx/Cargo.toml index 8f0a7361f..3fdf461e0 100644 --- a/ethcore/private-tx/Cargo.toml +++ b/ethcore/private-tx/Cargo.toml @@ -26,10 +26,10 @@ heapsize = "0.4" keccak-hash = "0.1.2" log = "0.4" parking_lot = "0.6" -patricia-trie = "0.2" +patricia-trie = "0.3.0" patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" } rand = "0.3" -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } rlp_derive = { path = "../../util/rlp_derive" } rustc-hex = "1.0" serde = "1.0" diff --git a/ethcore/private-tx/src/lib.rs b/ethcore/private-tx/src/lib.rs index 92b673056..7b8b24c7c 100644 --- a/ethcore/private-tx/src/lib.rs +++ b/ethcore/private-tx/src/lib.rs @@ -220,7 +220,7 @@ impl Provider where { let private_state_hash = self.calculate_state_hash(&private_state, contract_nonce); trace!(target: "privatetx", "Hashed effective private state for sender: {:?}", private_state_hash); self.transactions_for_signing.write().add_transaction(private.hash(), signed_transaction, contract_validators, private_state, contract_nonce)?; - self.broadcast_private_transaction(private.hash(), private.rlp_bytes().into_vec()); + self.broadcast_private_transaction(private.hash(), private.rlp_bytes()); Ok(Receipt { hash: tx_hash, contract_address: Some(contract), @@ -259,13 +259,13 @@ impl Provider where { match transaction.validator_account { None => { trace!(target: "privatetx", "Propagating transaction further"); - self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes().into_vec()); + self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes()); return Ok(()); } Some(validator_account) => { if !self.validator_accounts.contains(&validator_account) { trace!(target: "privatetx", "Propagating transaction further"); - self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes().into_vec()); + self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes()); return Ok(()); } let tx_action = transaction.transaction.action.clone(); @@ -291,7 +291,7 @@ impl Provider where { let signed_state = signed_state.expect("Error was checked before"); let signed_private_transaction = SignedPrivateTransaction::new(private_hash, signed_state, None); trace!(target: "privatetx", "Sending signature for private transaction: {:?}", signed_private_transaction); - self.broadcast_signed_private_transaction(signed_private_transaction.hash(), signed_private_transaction.rlp_bytes().into_vec()); + self.broadcast_signed_private_transaction(signed_private_transaction.hash(), signed_private_transaction.rlp_bytes()); } else { bail!("Incorrect type of action for the transaction"); } @@ -316,7 +316,7 @@ impl Provider where { let desc = match self.transactions_for_signing.read().get(&private_hash) { None => { // Not our transaction, broadcast further to peers - self.broadcast_signed_private_transaction(signed_tx.hash(), signed_tx.rlp_bytes().into_vec()); + self.broadcast_signed_private_transaction(signed_tx.hash(), signed_tx.rlp_bytes()); return Ok(()); }, Some(desc) => desc, diff --git a/ethcore/src/account_db.rs b/ethcore/src/account_db.rs index dd05d22cb..c028beeb1 100644 --- a/ethcore/src/account_db.rs +++ b/ethcore/src/account_db.rs @@ -58,7 +58,7 @@ impl Default for Factory { impl Factory { /// Create a read-only accountdb. /// This will panic when write operations are called. - pub fn readonly<'db>(&self, db: &'db HashDB, address_hash: H256) -> Box + 'db> { + pub fn readonly<'db>(&self, db: &'db HashDB, address_hash: H256) -> Box + 'db> { match *self { Factory::Mangled => Box::new(AccountDB::from_hash(db, address_hash)), Factory::Plain => Box::new(Wrapping(db)), @@ -66,7 +66,7 @@ impl Factory { } /// Create a new mutable hashdb. - pub fn create<'db>(&self, db: &'db mut HashDB, address_hash: H256) -> Box + 'db> { + pub fn create<'db>(&self, db: &'db mut HashDB, address_hash: H256) -> Box + 'db> { match *self { Factory::Mangled => Box::new(AccountDBMut::from_hash(db, address_hash)), Factory::Plain => Box::new(WrappingMut(db)), @@ -78,19 +78,19 @@ impl Factory { /// DB backend wrapper for Account trie /// Transforms trie node keys for the database pub struct AccountDB<'db> { - db: &'db HashDB, + db: &'db HashDB, address_hash: H256, } impl<'db> AccountDB<'db> { /// Create a new AccountDB from an address. #[cfg(test)] - pub fn new(db: &'db HashDB, address: &Address) -> Self { + pub fn new(db: &'db HashDB, address: &Address) -> Self { Self::from_hash(db, keccak(address)) } /// Create a new AcountDB from an address' hash. - pub fn from_hash(db: &'db HashDB, address_hash: H256) -> Self { + pub fn from_hash(db: &'db HashDB, address_hash: H256) -> Self { AccountDB { db: db, address_hash: address_hash, @@ -98,12 +98,12 @@ impl<'db> AccountDB<'db> { } } -impl<'db> AsHashDB for AccountDB<'db> { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl<'db> AsHashDB for AccountDB<'db> { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -impl<'db> HashDB for AccountDB<'db> { +impl<'db> HashDB for AccountDB<'db> { fn keys(&self) -> HashMap { unimplemented!() } @@ -137,19 +137,19 @@ impl<'db> HashDB for AccountDB<'db> { /// DB backend wrapper for Account trie pub struct AccountDBMut<'db> { - db: &'db mut HashDB, + db: &'db mut HashDB, address_hash: H256, } impl<'db> AccountDBMut<'db> { /// Create a new AccountDB from an address. #[cfg(test)] - pub fn new(db: &'db mut HashDB, address: &Address) -> Self { + pub fn new(db: &'db mut HashDB, address: &Address) -> Self { Self::from_hash(db, keccak(address)) } /// Create a new AcountDB from an address' hash. - pub fn from_hash(db: &'db mut HashDB, address_hash: H256) -> Self { + pub fn from_hash(db: &'db mut HashDB, address_hash: H256) -> Self { AccountDBMut { db: db, address_hash: address_hash, @@ -162,7 +162,7 @@ impl<'db> AccountDBMut<'db> { } } -impl<'db> HashDB for AccountDBMut<'db>{ +impl<'db> HashDB for AccountDBMut<'db>{ fn keys(&self) -> HashMap { unimplemented!() } @@ -208,19 +208,19 @@ impl<'db> HashDB for AccountDBMut<'db>{ } } -impl<'db> AsHashDB for AccountDBMut<'db> { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl<'db> AsHashDB for AccountDBMut<'db> { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -struct Wrapping<'db>(&'db HashDB); +struct Wrapping<'db>(&'db HashDB); -impl<'db> AsHashDB for Wrapping<'db> { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl<'db> AsHashDB for Wrapping<'db> { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -impl<'db> HashDB for Wrapping<'db> { +impl<'db> HashDB for Wrapping<'db> { fn keys(&self) -> HashMap { unimplemented!() } @@ -252,13 +252,13 @@ impl<'db> HashDB for Wrapping<'db> { } } -struct WrappingMut<'db>(&'db mut HashDB); -impl<'db> AsHashDB for WrappingMut<'db> { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +struct WrappingMut<'db>(&'db mut HashDB); +impl<'db> AsHashDB for WrappingMut<'db> { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -impl<'db> HashDB for WrappingMut<'db>{ +impl<'db> HashDB for WrappingMut<'db>{ fn keys(&self) -> HashMap { unimplemented!() } diff --git a/ethcore/src/blockchain/generator.rs b/ethcore/src/blockchain/generator.rs index 44d4e038c..213b394fc 100644 --- a/ethcore/src/blockchain/generator.rs +++ b/ethcore/src/blockchain/generator.rs @@ -51,7 +51,7 @@ impl Block { #[inline] pub fn encoded(&self) -> encoded::Block { - encoded::Block::new(encode(self).into_vec()) + encoded::Block::new(encode(self)) } #[inline] diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 54850374e..127f0f9eb 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -1853,7 +1853,7 @@ impl BlockChainClient for Client { } fn encoded_block_receipts(&self, hash: &H256) -> Option { - self.chain.read().block_receipts(hash).map(|receipts| ::rlp::encode(&receipts).into_vec()) + self.chain.read().block_receipts(hash).map(|receipts| ::rlp::encode(&receipts)) } fn queue_info(&self) -> BlockQueueInfo { diff --git a/ethcore/src/client/traits.rs b/ethcore/src/client/traits.rs index 3104d29d7..ebe70dcd8 100644 --- a/ethcore/src/client/traits.rs +++ b/ethcore/src/client/traits.rs @@ -42,7 +42,7 @@ use engines::EthEngine; use ethereum_types::{H256, U256, Address}; use ethcore_miner::pool::VerifiedTransaction; use bytes::Bytes; -use hashdb::DBValue; +use kvdb::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 577c7b97f..472bb48d5 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -972,7 +972,7 @@ impl Engine for AuthorityRound { let empty_steps_rlp = if header.number() >= self.empty_steps_transition { let empty_steps: Vec<_> = empty_steps.iter().map(|e| e.sealed()).collect(); - Some(::rlp::encode_list(&empty_steps).into_vec()) + Some(::rlp::encode_list(&empty_steps)) } else { None }; @@ -994,8 +994,8 @@ impl Engine for AuthorityRound { } let mut fields = vec![ - encode(&step).into_vec(), - encode(&(&H520::from(signature) as &[u8])).into_vec(), + encode(&step), + encode(&(&H520::from(signature) as &[u8])), ]; if let Some(empty_steps_rlp) = empty_steps_rlp { @@ -1440,7 +1440,7 @@ mod tests { fn can_do_signature_verification_fail() { let engine = Spec::new_test_round().engine; let mut header: Header = Header::default(); - header.set_seal(vec![encode(&H520::default()).into_vec()]); + header.set_seal(vec![encode(&H520::default())]); let verify_result = engine.verify_block_external(&header); assert!(verify_result.is_err()); @@ -1517,7 +1517,7 @@ mod tests { let tap = AccountProvider::transient_provider(); let addr = tap.insert_account(keccak("0").into(), &"0".into()).unwrap(); let mut parent_header: Header = Header::default(); - parent_header.set_seal(vec![encode(&0usize).into_vec()]); + parent_header.set_seal(vec![encode(&0usize)]); parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); header.set_number(1); @@ -1530,12 +1530,12 @@ mod tests { // Spec starts with step 2. header.set_difficulty(calculate_score(U256::from(0), U256::from(2), U256::zero())); let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap(); - header.set_seal(vec![encode(&2usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]); + header.set_seal(vec![encode(&2usize), encode(&(&*signature as &[u8]))]); assert!(engine.verify_block_family(&header, &parent_header).is_ok()); assert!(engine.verify_block_external(&header).is_err()); header.set_difficulty(calculate_score(U256::from(0), U256::from(1), U256::zero())); let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap(); - header.set_seal(vec![encode(&1usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]); + header.set_seal(vec![encode(&1usize), encode(&(&*signature as &[u8]))]); assert!(engine.verify_block_family(&header, &parent_header).is_ok()); assert!(engine.verify_block_external(&header).is_ok()); } @@ -1546,7 +1546,7 @@ mod tests { let addr = tap.insert_account(keccak("0").into(), &"0".into()).unwrap(); let mut parent_header: Header = Header::default(); - parent_header.set_seal(vec![encode(&0usize).into_vec()]); + parent_header.set_seal(vec![encode(&0usize)]); parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); header.set_number(1); @@ -1559,10 +1559,10 @@ mod tests { // Spec starts with step 2. header.set_difficulty(calculate_score(U256::from(0), U256::from(1), U256::zero())); let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap(); - header.set_seal(vec![encode(&1usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]); + header.set_seal(vec![encode(&1usize), encode(&(&*signature as &[u8]))]); assert!(engine.verify_block_family(&header, &parent_header).is_ok()); assert!(engine.verify_block_external(&header).is_ok()); - header.set_seal(vec![encode(&5usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]); + header.set_seal(vec![encode(&5usize), encode(&(&*signature as &[u8]))]); assert!(engine.verify_block_basic(&header).is_err()); } @@ -1572,7 +1572,7 @@ mod tests { let addr = tap.insert_account(keccak("0").into(), &"0".into()).unwrap(); let mut parent_header: Header = Header::default(); - parent_header.set_seal(vec![encode(&4usize).into_vec()]); + parent_header.set_seal(vec![encode(&4usize)]); parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); header.set_number(1); @@ -1584,10 +1584,10 @@ mod tests { let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap(); // Two validators. // Spec starts with step 2. - header.set_seal(vec![encode(&5usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]); + header.set_seal(vec![encode(&5usize), encode(&(&*signature as &[u8]))]); header.set_difficulty(calculate_score(U256::from(4), U256::from(5), U256::zero())); assert!(engine.verify_block_family(&header, &parent_header).is_ok()); - header.set_seal(vec![encode(&3usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]); + header.set_seal(vec![encode(&3usize), encode(&(&*signature as &[u8]))]); header.set_difficulty(calculate_score(U256::from(4), U256::from(3), U256::zero())); assert!(engine.verify_block_family(&header, &parent_header).is_err()); } @@ -1619,12 +1619,12 @@ mod tests { }; let mut parent_header: Header = Header::default(); - parent_header.set_seal(vec![encode(&1usize).into_vec()]); + parent_header.set_seal(vec![encode(&1usize)]); parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); header.set_difficulty(calculate_score(U256::from(1), U256::from(3), U256::zero())); header.set_gas_limit("222222".parse::().unwrap()); - header.set_seal(vec![encode(&3usize).into_vec()]); + header.set_seal(vec![encode(&3usize)]); // Do not report when signer not present. assert!(aura.verify_block_family(&header, &parent_header).is_ok()); @@ -1775,7 +1775,7 @@ mod tests { assert_eq!(engine.generate_seal(b1.block(), &genesis_header), Seal::None); // spec starts with step 2 - let empty_step_rlp = encode(&empty_step(engine, 2, &genesis_header.hash())).into_vec(); + let empty_step_rlp = encode(&empty_step(engine, 2, &genesis_header.hash())); // we've received the message assert!(notify.messages.read().contains(&empty_step_rlp)); @@ -1828,8 +1828,8 @@ mod tests { let empty_step2 = sealed_empty_step(engine, 2, &genesis_header.hash()); let empty_steps = ::rlp::encode_list(&vec![empty_step2]); - assert_eq!(seal[0], encode(&3usize).into_vec()); - assert_eq!(seal[2], empty_steps.into_vec()); + assert_eq!(seal[0], encode(&3usize)); + assert_eq!(seal[2], empty_steps); } } @@ -1882,8 +1882,8 @@ mod tests { let empty_steps = ::rlp::encode_list(&vec![empty_step2, empty_step3]); - assert_eq!(seal[0], encode(&4usize).into_vec()); - assert_eq!(seal[2], empty_steps.into_vec()); + assert_eq!(seal[0], encode(&4usize)); + assert_eq!(seal[2], empty_steps); } } @@ -1932,7 +1932,7 @@ mod tests { let engine = &*spec.engine; let mut parent_header: Header = Header::default(); - parent_header.set_seal(vec![encode(&0usize).into_vec()]); + parent_header.set_seal(vec![encode(&0usize)]); parent_header.set_gas_limit("222222".parse::().unwrap()); let mut header: Header = Header::default(); @@ -1946,9 +1946,9 @@ mod tests { // empty step with invalid step let empty_steps = vec![SealedEmptyStep { signature: 0.into(), step: 2 }]; header.set_seal(vec![ - encode(&2usize).into_vec(), - encode(&(&*signature as &[u8])).into_vec(), - ::rlp::encode_list(&empty_steps).into_vec(), + encode(&2usize), + encode(&(&*signature as &[u8])), + ::rlp::encode_list(&empty_steps), ]); assert!(match engine.verify_block_family(&header, &parent_header) { @@ -1960,9 +1960,9 @@ mod tests { // empty step with invalid signature let empty_steps = vec![SealedEmptyStep { signature: 0.into(), step: 1 }]; header.set_seal(vec![ - encode(&2usize).into_vec(), - encode(&(&*signature as &[u8])).into_vec(), - ::rlp::encode_list(&empty_steps).into_vec(), + encode(&2usize), + encode(&(&*signature as &[u8])), + ::rlp::encode_list(&empty_steps), ]); assert!(match engine.verify_block_family(&header, &parent_header) { @@ -1975,9 +1975,9 @@ mod tests { engine.set_signer(tap.clone(), addr1, "1".into()); let empty_steps = vec![sealed_empty_step(engine, 1, &parent_header.hash())]; header.set_seal(vec![ - encode(&2usize).into_vec(), - encode(&(&*signature as &[u8])).into_vec(), - ::rlp::encode_list(&empty_steps).into_vec(), + encode(&2usize), + encode(&(&*signature as &[u8])), + ::rlp::encode_list(&empty_steps), ]); assert!(match engine.verify_block_family(&header, &parent_header) { @@ -1996,9 +1996,9 @@ mod tests { header.set_difficulty(calculate_score(U256::from(0), U256::from(4), U256::from(2))); let signature = tap.sign(addr1, Some("1".into()), header.bare_hash()).unwrap(); header.set_seal(vec![ - encode(&4usize).into_vec(), - encode(&(&*signature as &[u8])).into_vec(), - ::rlp::encode_list(&empty_steps).into_vec(), + encode(&4usize), + encode(&(&*signature as &[u8])), + ::rlp::encode_list(&empty_steps), ]); assert!(engine.verify_block_family(&header, &parent_header).is_ok()); diff --git a/ethcore/src/engines/basic_authority.rs b/ethcore/src/engines/basic_authority.rs index e73b10461..58eb5ea22 100644 --- a/ethcore/src/engines/basic_authority.rs +++ b/ethcore/src/engines/basic_authority.rs @@ -110,7 +110,7 @@ impl Engine for BasicAuthority { if self.validators.contains(header.parent_hash(), author) { // account should be pernamently unlocked, otherwise sealing will fail if let Ok(signature) = self.sign(header.bare_hash()) { - return Seal::Regular(vec![::rlp::encode(&(&H520::from(signature) as &[u8])).into_vec()]); + return Seal::Regular(vec![::rlp::encode(&(&H520::from(signature) as &[u8]))]); } else { trace!(target: "basicauthority", "generate_seal: FAIL: accounts secret key unavailable"); } @@ -234,7 +234,7 @@ mod tests { fn can_do_signature_verification_fail() { let engine = new_test_authority().engine; let mut header: Header = Header::default(); - header.set_seal(vec![::rlp::encode(&H520::default()).into_vec()]); + header.set_seal(vec![::rlp::encode(&H520::default())]); let verify_result = engine.verify_block_external(&header); assert!(verify_result.is_err()); diff --git a/ethcore/src/engines/instant_seal.rs b/ethcore/src/engines/instant_seal.rs index c1b5de4ab..5a4eaa642 100644 --- a/ethcore/src/engines/instant_seal.rs +++ b/ethcore/src/engines/instant_seal.rs @@ -120,7 +120,7 @@ mod tests { assert!(engine.verify_block_basic(&header).is_ok()); - header.set_seal(vec![::rlp::encode(&H520::default()).into_vec()]); + header.set_seal(vec![::rlp::encode(&H520::default())]); assert!(engine.verify_block_unordered(&header).is_ok()); } diff --git a/ethcore/src/engines/tendermint/message.rs b/ethcore/src/engines/tendermint/message.rs index 7d76c32a2..137148667 100644 --- a/ethcore/src/engines/tendermint/message.rs +++ b/ethcore/src/engines/tendermint/message.rs @@ -231,7 +231,7 @@ mod tests { }, block_hash: Some(keccak("1")), }; - let raw_rlp = ::rlp::encode(&message).into_vec(); + let raw_rlp = ::rlp::encode(&message); let rlp = Rlp::new(&raw_rlp); assert_eq!(Ok(message), rlp.as_val()); @@ -268,8 +268,8 @@ mod tests { fn proposal_message() { let mut header = Header::default(); let seal = vec![ - ::rlp::encode(&0u8).into_vec(), - ::rlp::encode(&H520::default()).into_vec(), + ::rlp::encode(&0u8), + ::rlp::encode(&H520::default()), Vec::new() ]; diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index 70d78147e..d4a76e430 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -407,9 +407,9 @@ impl Tendermint { let precommits = self.votes.round_signatures(vote_step, &bh); trace!(target: "engine", "Collected seal: {:?}", precommits); let seal = vec![ - ::rlp::encode(&vote_step.view).into_vec(), + ::rlp::encode(&vote_step.view), ::rlp::NULL_RLP.to_vec(), - ::rlp::encode_list(&precommits).into_vec() + ::rlp::encode_list(&precommits) ]; self.submit_seal(bh, seal); self.votes.throw_out_old(&vote_step); @@ -491,8 +491,8 @@ impl Engine for Tendermint { *self.proposal.write() = bh; *self.proposal_parent.write() = header.parent_hash().clone(); Seal::Proposal(vec![ - ::rlp::encode(&view).into_vec(), - ::rlp::encode(&signature).into_vec(), + ::rlp::encode(&view), + ::rlp::encode(&signature), ::rlp::EMPTY_LIST_RLP.to_vec() ]) } else { @@ -520,7 +520,7 @@ impl Engine for Tendermint { self.broadcast_message(rlp.as_raw().to_vec()); if let Some(double) = self.votes.vote(message.clone(), sender) { let height = message.vote_step.height as BlockNumber; - self.validators.report_malicious(&sender, height, height, ::rlp::encode(&double).into_vec()); + self.validators.report_malicious(&sender, height, height, ::rlp::encode(&double)); return Err(EngineError::DoubleVote(sender)); } trace!(target: "engine", "Handling a valid {:?} from {}.", message, sender); @@ -823,8 +823,8 @@ mod tests { let vote_info = message_info_rlp(&VoteStep::new(header.number() as Height, view, Step::Propose), Some(header.bare_hash())); let signature = tap.sign(*author, None, keccak(vote_info)).unwrap(); vec![ - ::rlp::encode(&view).into_vec(), - ::rlp::encode(&H520::from(signature)).into_vec(), + ::rlp::encode(&view), + ::rlp::encode(&H520::from(signature)), ::rlp::EMPTY_LIST_RLP.to_vec() ] } @@ -928,7 +928,7 @@ mod tests { let signature1 = tap.sign(proposer, None, keccak(&vote_info)).unwrap(); seal[1] = ::rlp::NULL_RLP.to_vec(); - seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone())]).into_vec(); + seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone())]); header.set_seal(seal.clone()); // One good signature is not enough. @@ -940,7 +940,7 @@ mod tests { let voter = insert_and_unlock(&tap, "0"); let signature0 = tap.sign(voter, None, keccak(&vote_info)).unwrap(); - seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone()), H520::from(signature0.clone())]).into_vec(); + seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone()), H520::from(signature0.clone())]); header.set_seal(seal.clone()); assert!(engine.verify_block_external(&header).is_ok()); @@ -948,7 +948,7 @@ mod tests { let bad_voter = insert_and_unlock(&tap, "101"); let bad_signature = tap.sign(bad_voter, None, keccak(vote_info)).unwrap(); - seal[2] = ::rlp::encode_list(&vec![H520::from(signature1), H520::from(bad_signature)]).into_vec(); + seal[2] = ::rlp::encode_list(&vec![H520::from(signature1), H520::from(bad_signature)]); header.set_seal(seal); // One good and one bad signature. @@ -1084,7 +1084,7 @@ mod tests { let signature0 = tap.sign(voter, None, keccak(&vote_info)).unwrap(); seal[1] = ::rlp::NULL_RLP.to_vec(); - seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone())]).into_vec(); + seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone())]); header.set_seal(seal.clone()); let epoch_verifier = super::EpochVerifier { @@ -1112,7 +1112,7 @@ mod tests { _ => panic!(), } - seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone()), H520::from(signature0.clone())]).into_vec(); + seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone()), H520::from(signature0.clone())]); header.set_seal(seal.clone()); assert!(epoch_verifier.verify_light(&header).is_ok()); @@ -1120,7 +1120,7 @@ mod tests { let bad_voter = insert_and_unlock(&tap, "101"); let bad_signature = tap.sign(bad_voter, None, keccak(&vote_info)).unwrap(); - seal[2] = ::rlp::encode_list(&vec![H520::from(signature1), H520::from(bad_signature)]).into_vec(); + seal[2] = ::rlp::encode_list(&vec![H520::from(signature1), H520::from(bad_signature)]); header.set_seal(seal); // One good and one bad signature. diff --git a/ethcore/src/engines/validator_set/contract.rs b/ethcore/src/engines/validator_set/contract.rs index 637ff046d..80cc690ab 100644 --- a/ethcore/src/engines/validator_set/contract.rs +++ b/ethcore/src/engines/validator_set/contract.rs @@ -172,7 +172,7 @@ mod tests { // Check a block that is a bit in future, reject it but don't report the validator. let mut header = Header::default(); - let seal = vec![encode(&4u8).into_vec(), encode(&(&H520::default() as &[u8])).into_vec()]; + let seal = vec![encode(&4u8), encode(&(&H520::default() as &[u8]))]; header.set_seal(seal); header.set_author(v1); header.set_number(2); @@ -183,7 +183,7 @@ mod tests { // Now create one that is more in future. That one should be rejected and validator should be reported. let mut header = Header::default(); - let seal = vec![encode(&8u8).into_vec(), encode(&(&H520::default() as &[u8])).into_vec()]; + let seal = vec![encode(&8u8), encode(&(&H520::default() as &[u8]))]; header.set_seal(seal); header.set_author(v1); header.set_number(2); diff --git a/ethcore/src/engines/validator_set/safe_contract.rs b/ethcore/src/engines/validator_set/safe_contract.rs index 1814e4ec0..91083c056 100644 --- a/ethcore/src/engines/validator_set/safe_contract.rs +++ b/ethcore/src/engines/validator_set/safe_contract.rs @@ -157,7 +157,7 @@ fn decode_first_proof(rlp: &Rlp) -> Result<(Header, Vec), ::error::Erro fn encode_proof(header: &Header, receipts: &[Receipt]) -> Bytes { let mut stream = RlpStream::new_list(2); stream.append(header).append_list(receipts); - stream.drain().into_vec() + stream.drain() } fn decode_proof(rlp: &Rlp) -> Result<(Header, Vec), ::error::Error> { diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 69cb1e651..5e1df2f14 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -643,7 +643,7 @@ mod tests { fn can_do_difficulty_verification_fail() { let engine = test_spec().engine; let mut header: Header = Header::default(); - header.set_seal(vec![rlp::encode(&H256::zero()).into_vec(), rlp::encode(&H64::zero()).into_vec()]); + header.set_seal(vec![rlp::encode(&H256::zero()), rlp::encode(&H64::zero())]); let verify_result = engine.verify_block_basic(&header); @@ -658,7 +658,7 @@ mod tests { fn can_do_proof_of_work_verification_fail() { let engine = test_spec().engine; let mut header: Header = Header::default(); - header.set_seal(vec![rlp::encode(&H256::zero()).into_vec(), rlp::encode(&H64::zero()).into_vec()]); + header.set_seal(vec![rlp::encode(&H256::zero()), rlp::encode(&H64::zero())]); header.set_difficulty(U256::from_str("ffffffffffffffffffffffffffffffffffffffffffffaaaaaaaaaaaaaaaaaaaa").unwrap()); let verify_result = engine.verify_block_basic(&header); @@ -699,7 +699,7 @@ mod tests { fn can_do_seal256_verification_fail() { let engine = test_spec().engine; let mut header: Header = Header::default(); - header.set_seal(vec![rlp::encode(&H256::zero()).into_vec(), rlp::encode(&H64::zero()).into_vec()]); + header.set_seal(vec![rlp::encode(&H256::zero()), rlp::encode(&H64::zero())]); let verify_result = engine.verify_block_unordered(&header); match verify_result { @@ -713,7 +713,7 @@ mod tests { fn can_do_proof_of_work_unordered_verification_fail() { let engine = test_spec().engine; let mut header: Header = Header::default(); - header.set_seal(vec![rlp::encode(&H256::from("b251bd2e0283d0658f2cadfdc8ca619b5de94eca5742725e2e757dd13ed7503d")).into_vec(), rlp::encode(&H64::zero()).into_vec()]); + header.set_seal(vec![rlp::encode(&H256::from("b251bd2e0283d0658f2cadfdc8ca619b5de94eca5742725e2e757dd13ed7503d")), rlp::encode(&H64::zero())]); header.set_difficulty(U256::from_str("ffffffffffffffffffffffffffffffffffffffffffffaaaaaaaaaaaaaaaaaaaa").unwrap()); let verify_result = engine.verify_block_unordered(&header); @@ -906,7 +906,7 @@ mod tests { let tempdir = TempDir::new("").unwrap(); let ethash = Ethash::new(tempdir.path(), ethparams, machine, None); let mut header = Header::default(); - header.set_seal(vec![rlp::encode(&H256::from("b251bd2e0283d0658f2cadfdc8ca619b5de94eca5742725e2e757dd13ed7503d")).into_vec(), rlp::encode(&H64::zero()).into_vec()]); + header.set_seal(vec![rlp::encode(&H256::from("b251bd2e0283d0658f2cadfdc8ca619b5de94eca5742725e2e757dd13ed7503d")), rlp::encode(&H64::zero())]); let info = ethash.extra_info(&header); assert_eq!(info["nonce"], "0x0000000000000000"); assert_eq!(info["mixHash"], "0xb251bd2e0283d0658f2cadfdc8ca619b5de94eca5742725e2e757dd13ed7503d"); diff --git a/ethcore/src/header.rs b/ethcore/src/header.rs index 7896282fc..100210b70 100644 --- a/ethcore/src/header.rs +++ b/ethcore/src/header.rs @@ -449,7 +449,7 @@ mod tests { let header_rlp = "f901f9a0d405da4e66f1445d455195229624e133f5baafe72b5cf7b3c36c12c8146e98b7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a05fb2b4bfdef7b314451cb138a534d225c922fc0e5fbe25e451142732c3e25c25a088d2ec6b9860aae1a2c3b299f72b6a5d70d7f7ba4722c78f2c49ba96273c2158a007c6fdfa8eea7e86b81f5b0fc0f78f90cc19f4aa60d323151e0cac660199e9a1b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefba82524d84568e932a80a0a0349d8c3df71f1a48a9df7d03fd5f14aeee7d91332c009ecaff0a71ead405bd88ab4e252a7e8c2a23".from_hex().unwrap(); let header: Header = rlp::decode(&header_rlp).expect("error decoding header"); - let encoded_header = rlp::encode(&header).into_vec(); + let encoded_header = rlp::encode(&header); assert_eq!(header_rlp, encoded_header); } diff --git a/ethcore/src/json_tests/trie.rs b/ethcore/src/json_tests/trie.rs index 0466c4de1..2d1f8d1fe 100644 --- a/ethcore/src/json_tests/trie.rs +++ b/ethcore/src/json_tests/trie.rs @@ -20,6 +20,7 @@ use ethtrie::RlpCodec; use ethereum_types::H256; use memorydb::MemoryDB; use keccak_hasher::KeccakHasher; +use kvdb::DBValue; use super::HookType; @@ -36,7 +37,7 @@ fn test_trie(json: &[u8], trie: TrieSpec, start_stop_h for (name, test) in tests.into_iter() { start_stop_hook(&name, HookType::OnStart); - let mut memdb = MemoryDB::::new(); + let mut memdb = MemoryDB::::new(); let mut root = H256::default(); let mut t = factory.create(&mut memdb, &mut root); diff --git a/ethcore/src/miner/stratum.rs b/ethcore/src/miner/stratum.rs index 38c881bb1..65dc7d213 100644 --- a/ethcore/src/miner/stratum.rs +++ b/ethcore/src/miner/stratum.rs @@ -138,7 +138,7 @@ impl JobDispatcher for StratumJobDispatcher { ); self.with_core_result(|client, miner| { - let seal = vec![encode(&payload.mix_hash).into_vec(), encode(&payload.nonce).into_vec()]; + let seal = vec![encode(&payload.mix_hash), encode(&payload.nonce)]; let import = miner.submit_seal(payload.pow_hash, seal) .and_then(|block| client.import_sealed_block(block)); diff --git a/ethcore/src/pod_account.rs b/ethcore/src/pod_account.rs index 3b66705ba..db5d0660c 100644 --- a/ethcore/src/pod_account.rs +++ b/ethcore/src/pod_account.rs @@ -22,6 +22,7 @@ use itertools::Itertools; use hash::{keccak}; use ethereum_types::{H256, U256}; use hashdb::HashDB; +use kvdb::DBValue; use keccak_hasher::KeccakHasher; use triehash::sec_trie_root; use bytes::Bytes; @@ -69,7 +70,7 @@ impl PodAccount { } /// Place additional data into given hash DB. - pub fn insert_additional(&self, db: &mut HashDB, factory: &TrieFactory) { + pub fn insert_additional(&self, db: &mut HashDB, factory: &TrieFactory) { match self.code { Some(ref c) if !c.is_empty() => { db.insert(c); } _ => {} diff --git a/ethcore/src/snapshot/account.rs b/ethcore/src/snapshot/account.rs index 13ab4b227..2ccf910f7 100644 --- a/ethcore/src/snapshot/account.rs +++ b/ethcore/src/snapshot/account.rs @@ -123,7 +123,7 @@ pub fn to_fat_rlps(account_hash: &H256, acc: &BasicAccount, acct_db: &AccountDB, let stream = ::std::mem::replace(&mut account_stream, RlpStream::new_list(2)); chunks.push(stream.out()); target_chunk_size = max_chunk_size; - leftover = Some(pair.into_vec()); + leftover = Some(pair); break; } }, diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index f05719e06..fbe6d6a16 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -34,12 +34,11 @@ use ids::BlockId; use ethereum_types::{H256, U256}; use hashdb::HashDB; use keccak_hasher::KeccakHasher; -use kvdb::DBValue; use snappy; use bytes::Bytes; use parking_lot::Mutex; use journaldb::{self, Algorithm, JournalDB}; -use kvdb::KeyValueDB; +use kvdb::{KeyValueDB, DBValue}; use trie::{Trie, TrieMut}; use ethtrie::{TrieDB, TrieDBMut}; use rlp::{RlpStream, Rlp}; @@ -152,7 +151,7 @@ pub fn take_snapshot( engine: &EthEngine, chain: &BlockChain, block_at: H256, - state_db: &HashDB, + state_db: &HashDB, writer: W, p: &Progress, processing_threads: usize, @@ -322,7 +321,7 @@ impl<'a> StateChunker<'a> { /// /// Returns a list of hashes of chunks created, or any error it may /// have encountered. -pub fn chunk_state<'a>(db: &HashDB, root: &H256, writer: &Mutex, progress: &'a Progress, part: Option) -> Result, Error> { +pub fn chunk_state<'a>(db: &HashDB, root: &H256, writer: &Mutex, progress: &'a Progress, part: Option) -> Result, Error> { let account_trie = TrieDB::new(db, &root)?; let mut chunker = StateChunker { @@ -494,7 +493,7 @@ struct RebuiltStatus { // rebuild a set of accounts and their storage. // returns a status detailing newly-loaded code and accounts missing code. fn rebuild_accounts( - db: &mut HashDB, + db: &mut HashDB, account_fat_rlps: Rlp, out_chunk: &mut [(H256, Bytes)], known_code: &HashMap, @@ -541,7 +540,7 @@ fn rebuild_accounts( } } - ::rlp::encode(&acc).into_vec() + ::rlp::encode(&acc) }; *out = (hash, thin_rlp); diff --git a/ethcore/src/snapshot/tests/helpers.rs b/ethcore/src/snapshot/tests/helpers.rs index 19f50e946..1bcbdb9f4 100644 --- a/ethcore/src/snapshot/tests/helpers.rs +++ b/ethcore/src/snapshot/tests/helpers.rs @@ -62,7 +62,7 @@ impl StateProducer { /// Tick the state producer. This alters the state, writing new data into /// the database. - pub fn tick(&mut self, rng: &mut R, db: &mut HashDB) { + pub fn tick(&mut self, rng: &mut R, db: &mut HashDB) { // modify existing accounts. let mut accounts_to_modify: Vec<_> = { let trie = TrieDB::new(&*db, &self.state_root).unwrap(); @@ -80,7 +80,7 @@ impl StateProducer { let mut account: BasicAccount = ::rlp::decode(&*account_data).expect("error decoding basic account"); let acct_db = AccountDBMut::from_hash(db, *address_hash); fill_storage(acct_db, &mut account.storage_root, &mut self.storage_seed); - *account_data = DBValue::from_vec(::rlp::encode(&account).into_vec()); + *account_data = DBValue::from_vec(::rlp::encode(&account)); } // sweep again to alter account trie. @@ -131,7 +131,7 @@ pub fn fill_storage(mut db: AccountDBMut, root: &mut H256, seed: &mut H256) { } /// Compare two state dbs. -pub fn compare_dbs(one: &HashDB, two: &HashDB) { +pub fn compare_dbs(one: &HashDB, two: &HashDB) { let keys = one.keys(); for key in keys.keys() { diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index a03312ca4..160152fc7 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -213,7 +213,7 @@ impl Account { /// Get (and cache) the contents of the trie's storage at `key`. /// Takes modified storage into account. - pub fn storage_at(&self, db: &HashDB, key: &H256) -> TrieResult { + pub fn storage_at(&self, db: &HashDB, key: &H256) -> TrieResult { if let Some(value) = self.cached_storage_at(key) { return Ok(value); } @@ -226,7 +226,7 @@ impl Account { /// Get (and cache) the contents of the trie's storage at `key`. /// Does not take modified storage into account. - pub fn original_storage_at(&self, db: &HashDB, key: &H256) -> TrieResult { + pub fn original_storage_at(&self, db: &HashDB, key: &H256) -> TrieResult { if let Some(value) = self.cached_original_storage_at(key) { return Ok(value); } @@ -248,7 +248,7 @@ impl Account { } } - fn get_and_cache_storage(storage_root: &H256, storage_cache: &mut LruCache, db: &HashDB, key: &H256) -> TrieResult { + fn get_and_cache_storage(storage_root: &H256, storage_cache: &mut LruCache, db: &HashDB, key: &H256) -> TrieResult { let db = SecTrieDB::new(db, storage_root)?; let panicky_decoder = |bytes:&[u8]| ::rlp::decode(&bytes).expect("decoding db value failed"); let item: U256 = db.get_with(key, panicky_decoder)?.unwrap_or_else(U256::zero); @@ -354,7 +354,7 @@ impl Account { /// Provide a database to get `code_hash`. Should not be called if it is a contract without code. Returns the cached code, if successful. #[must_use] - pub fn cache_code(&mut self, db: &HashDB) -> Option> { + pub fn cache_code(&mut self, db: &HashDB) -> Option> { // TODO: fill out self.code_cache; trace!("Account::cache_code: ic={}; self.code_hash={:?}, self.code_cache={}", self.is_cached(), self.code_hash, self.code_cache.pretty()); @@ -384,7 +384,7 @@ impl Account { /// Provide a database to get `code_size`. Should not be called if it is a contract without code. Returns whether /// the cache succeeds. #[must_use] - pub fn cache_code_size(&mut self, db: &HashDB) -> bool { + pub fn cache_code_size(&mut self, db: &HashDB) -> bool { // TODO: fill out self.code_cache; trace!("Account::cache_code_size: ic={}; self.code_hash={:?}, self.code_cache={}", self.is_cached(), self.code_hash, self.code_cache.pretty()); self.code_size.is_some() || @@ -473,7 +473,7 @@ impl Account { } /// Commit the `storage_changes` to the backing DB and update `storage_root`. - pub fn commit_storage(&mut self, trie_factory: &TrieFactory, db: &mut HashDB) -> TrieResult<()> { + pub fn commit_storage(&mut self, trie_factory: &TrieFactory, db: &mut HashDB) -> TrieResult<()> { let mut t = trie_factory.from_existing(db, &mut self.storage_root)?; for (k, v) in self.storage_changes.drain() { // cast key and value to trait type, @@ -490,7 +490,7 @@ impl Account { } /// Commit any unsaved code. `code_hash` will always return the hash of the `code_cache` after this. - pub fn commit_code(&mut self, db: &mut HashDB) { + pub fn commit_code(&mut self, db: &mut HashDB) { trace!("Commiting code of {:?} - {:?}, {:?}", self, self.code_filth == Filth::Dirty, self.code_cache.is_empty()); match (self.code_filth == Filth::Dirty, self.code_cache.is_empty()) { (true, true) => { @@ -579,7 +579,7 @@ impl Account { /// trie. /// `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) -> TrieResult<(Vec, H256)> { + pub fn prove_storage(&self, db: &HashDB, storage_key: H256) -> TrieResult<(Vec, H256)> { let mut recorder = Recorder::new(); let trie = TrieDB::new(db, &self.storage_root)?; diff --git a/ethcore/src/state/backend.rs b/ethcore/src/state/backend.rs index d07124d8d..df364af92 100644 --- a/ethcore/src/state/backend.rs +++ b/ethcore/src/state/backend.rs @@ -28,16 +28,17 @@ use state::Account; use parking_lot::Mutex; use ethereum_types::{Address, H256}; use memorydb::MemoryDB; -use hashdb::{AsHashDB, HashDB, DBValue}; +use hashdb::{AsHashDB, HashDB}; +use kvdb::DBValue; use keccak_hasher::KeccakHasher; /// State backend. See module docs for more details. pub trait Backend: Send { /// Treat the backend as a read-only hashdb. - fn as_hashdb(&self) -> &HashDB; + fn as_hashdb(&self) -> &HashDB; /// Treat the backend as a writeable hashdb. - fn as_hashdb_mut(&mut self) -> &mut HashDB; + fn as_hashdb_mut(&mut self) -> &mut HashDB; /// Add an account entry to the cache. fn add_to_account_cache(&mut self, addr: Address, data: Option, modified: bool); @@ -76,18 +77,18 @@ pub trait Backend: Send { // TODO: when account lookup moved into backends, this won't rely as tenuously on intended // usage. #[derive(Clone, PartialEq)] -pub struct ProofCheck(MemoryDB); +pub struct ProofCheck(MemoryDB); impl ProofCheck { /// Create a new `ProofCheck` backend from the given state items. pub fn new(proof: &[DBValue]) -> Self { - let mut db = MemoryDB::::new(); + let mut db = MemoryDB::::new(); for item in proof { db.insert(item); } ProofCheck(db) } } -impl HashDB for ProofCheck { +impl HashDB for ProofCheck { fn keys(&self) -> HashMap { self.0.keys() } fn get(&self, key: &H256) -> Option { self.0.get(key) @@ -108,14 +109,14 @@ impl HashDB for ProofCheck { fn remove(&mut self, _key: &H256) { } } -impl AsHashDB for ProofCheck { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl AsHashDB for ProofCheck { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } impl Backend for ProofCheck { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } fn add_to_account_cache(&mut self, _addr: Address, _data: Option, _modified: bool) {} fn cache_code(&self, _hash: H256, _code: Arc>) {} fn get_cached_account(&self, _addr: &Address) -> Option> { None } @@ -134,18 +135,18 @@ impl Backend for ProofCheck { /// The proof-of-execution can be extracted with `extract_proof`. /// /// This doesn't cache anything or rely on the canonical state caches. -pub struct Proving> { +pub struct Proving> { base: H, // state we're proving values from. - changed: MemoryDB, // changed state via insertions. + changed: MemoryDB, // changed state via insertions. proof: Mutex>, } -impl + Send + Sync> AsHashDB for Proving { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl + Send + Sync> AsHashDB for Proving { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -impl + Send + Sync> HashDB for Proving { +impl + Send + Sync> HashDB for Proving { fn keys(&self) -> HashMap { let mut keys = self.base.as_hashdb().keys(); keys.extend(self.changed.keys()); @@ -182,10 +183,10 @@ impl + Send + Sync> HashDB for Proving + Send + Sync> Backend for Proving { - fn as_hashdb(&self) -> &HashDB { self } +impl + Send + Sync> Backend for Proving { + fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } fn add_to_account_cache(&mut self, _: Address, _: Option, _: bool) { } @@ -204,13 +205,13 @@ impl + Send + Sync> Backend for Proving { fn is_known_null(&self, _: &Address) -> bool { false } } -impl> Proving { +impl> Proving { /// Create a new `Proving` over a base database. /// This will store all values ever fetched from that base. pub fn new(base: H) -> Self { Proving { base: base, - changed: MemoryDB::::new(), + changed: MemoryDB::::new(), proof: Mutex::new(HashSet::new()), } } @@ -222,7 +223,7 @@ impl> Proving { } } -impl + Clone> Clone for Proving { +impl + Clone> Clone for Proving { fn clone(&self) -> Self { Proving { base: self.base.clone(), @@ -236,12 +237,12 @@ impl + Clone> Clone for Proving { /// it. Doesn't cache anything. pub struct Basic(pub H); -impl + Send + Sync> Backend for Basic { - fn as_hashdb(&self) -> &HashDB { +impl + Send + Sync> Backend for Basic { + fn as_hashdb(&self) -> &HashDB { self.0.as_hashdb() } - fn as_hashdb_mut(&mut self) -> &mut HashDB { + fn as_hashdb_mut(&mut self) -> &mut HashDB { self.0.as_hashdb_mut() } diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index dddaf7965..1e5af2e9f 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -227,7 +227,7 @@ pub fn check_proof( /// Prove a `virtual` transaction on the given state. /// Returns `None` when the transacion could not be proved, /// and a proof otherwise. -pub fn prove_transaction_virtual + Send + Sync>( +pub fn prove_transaction_virtual + Send + Sync>( db: H, root: H256, transaction: &SignedTransaction, @@ -618,7 +618,7 @@ impl State { &self, address: &Address, key: &H256, f_cached_at: FCachedStorageAt, f_at: FStorageAt, ) -> TrieResult where FCachedStorageAt: Fn(&Account, &H256) -> Option, - FStorageAt: Fn(&Account, &HashDB, &H256) -> TrieResult + FStorageAt: Fn(&Account, &HashDB, &H256) -> TrieResult { // Storage key search and update works like this: // 1. If there's an entry for the account in the local cache check for the key and return it if found. @@ -1014,7 +1014,7 @@ impl State { /// Load required account data from the databases. Returns whether the cache succeeds. #[must_use] - fn update_account_cache(require: RequireCache, account: &mut Account, state_db: &B, db: &HashDB) -> bool { + fn update_account_cache(require: RequireCache, account: &mut Account, state_db: &B, db: &HashDB) -> bool { if let RequireCache::None = require { return true; } diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index d614fe42f..d103f1081 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -29,7 +29,7 @@ use hashdb::HashDB; use keccak_hasher::KeccakHasher; use header::BlockNumber; use journaldb::JournalDB; -use kvdb::{KeyValueDB, DBTransaction}; +use kvdb::{KeyValueDB, DBTransaction, DBValue}; use lru_cache::LruCache; use memory_cache::MemoryLruCache; use parking_lot::Mutex; @@ -312,12 +312,12 @@ impl StateDB { } /// Conversion method to interpret self as `HashDB` reference - pub fn as_hashdb(&self) -> &HashDB { + pub fn as_hashdb(&self) -> &HashDB { self.db.as_hashdb() } /// Conversion method to interpret self as mutable `HashDB` reference - pub fn as_hashdb_mut(&mut self) -> &mut HashDB { + pub fn as_hashdb_mut(&mut self) -> &mut HashDB { self.db.as_hashdb_mut() } @@ -412,9 +412,9 @@ impl StateDB { } impl state::Backend for StateDB { - fn as_hashdb(&self) -> &HashDB { self.db.as_hashdb() } + fn as_hashdb(&self) -> &HashDB { self.db.as_hashdb() } - fn as_hashdb_mut(&mut self) -> &mut HashDB { + fn as_hashdb_mut(&mut self) -> &mut HashDB { self.db.as_hashdb_mut() } diff --git a/ethcore/src/test_helpers.rs b/ethcore/src/test_helpers.rs index 06cfe7030..bf9ab0204 100644 --- a/ethcore/src/test_helpers.rs +++ b/ethcore/src/test_helpers.rs @@ -90,7 +90,7 @@ pub fn create_test_block_with_data(header: &Header, transactions: &[SignedTransa rlp.append(header); rlp.begin_list(transactions.len()); for t in transactions { - rlp.append_raw(&rlp::encode(t).into_vec(), 1); + rlp.append_raw(&rlp::encode(t), 1); } rlp.append_list(&uncles); rlp.out() diff --git a/ethcore/sync/Cargo.toml b/ethcore/sync/Cargo.toml index b5224cb00..c38fa71c0 100644 --- a/ethcore/sync/Cargo.toml +++ b/ethcore/sync/Cargo.toml @@ -17,10 +17,13 @@ ethcore-light = { path = "../light" } ethcore-transaction = { path = "../transaction" } ethcore = { path = ".." } ethereum-types = "0.4" +hashdb = "0.3.0" fastmap = { path = "../../util/fastmap" } -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } keccak-hash = "0.1" +keccak-hasher = { path = "../../util/keccak-hasher" } triehash-ethereum = {version = "0.2", path = "../../util/triehash-ethereum" } +kvdb = "0.1" macros = { path = "../../util/macros" } log = "0.4" env_logger = "0.5" diff --git a/ethcore/sync/src/api.rs b/ethcore/sync/src/api.rs index 6af3c6396..8063ebecb 100644 --- a/ethcore/sync/src/api.rs +++ b/ethcore/sync/src/api.rs @@ -544,7 +544,7 @@ struct TxRelay(Arc); impl LightHandler for TxRelay { fn on_transactions(&self, ctx: &EventContext, relay: &[::transaction::UnverifiedTransaction]) { trace!(target: "pip", "Relaying {} transactions from peer {}", relay.len(), ctx.peer()); - self.0.queue_transactions(relay.iter().map(|tx| ::rlp::encode(tx).into_vec()).collect(), ctx.peer()) + self.0.queue_transactions(relay.iter().map(|tx| ::rlp::encode(tx)).collect(), ctx.peer()) } } diff --git a/ethcore/sync/src/block_sync.rs b/ethcore/sync/src/block_sync.rs index 739523f72..f77117b68 100644 --- a/ethcore/sync/src/block_sync.rs +++ b/ethcore/sync/src/block_sync.rs @@ -795,7 +795,7 @@ mod tests { for i in 0..4 { // Construct the block body let mut uncles = if i > 0 { - encode_list(&[dummy_header(i - 1, H256::random())]).into_vec() + encode_list(&[dummy_header(i - 1, H256::random())]) } else { ::rlp::EMPTY_LIST_RLP.to_vec() }; diff --git a/ethcore/sync/src/chain/handler.rs b/ethcore/sync/src/chain/handler.rs index 8fac9da19..e67029743 100644 --- a/ethcore/sync/src/chain/handler.rs +++ b/ethcore/sync/src/chain/handler.rs @@ -772,9 +772,7 @@ mod tests { let block = Rlp::new(&block_data); - let result = SyncHandler::on_peer_new_block(&mut sync, &mut io, 0, &block); - - assert!(result.is_ok()); + SyncHandler::on_peer_new_block(&mut sync, &mut io, 0, &block).expect("result to be ok"); } #[test] diff --git a/ethcore/sync/src/chain/mod.rs b/ethcore/sync/src/chain/mod.rs index f5a0e30b8..1a0f99b92 100644 --- a/ethcore/sync/src/chain/mod.rs +++ b/ethcore/sync/src/chain/mod.rs @@ -1203,7 +1203,7 @@ pub mod tests { } pub fn get_dummy_blocks(order: u32, parent_hash: H256) -> Bytes { - let mut rlp = RlpStream::new_list(1); + let mut rlp = RlpStream::new_list(2); rlp.append_raw(&get_dummy_block(order, parent_hash), 1); let difficulty: U256 = (100 * order).into(); rlp.append(&difficulty); diff --git a/ethcore/sync/src/light_sync/response.rs b/ethcore/sync/src/light_sync/response.rs index 161461c2a..c3175d6e9 100644 --- a/ethcore/sync/src/light_sync/response.rs +++ b/ethcore/sync/src/light_sync/response.rs @@ -179,7 +179,7 @@ mod tests { parent_hash = Some(header.hash()); - encoded::Header::new(::rlp::encode(&header).into_vec()) + encoded::Header::new(::rlp::encode(&header)) }).collect(); assert!(verify(&headers, &request).is_ok()); @@ -205,7 +205,7 @@ mod tests { parent_hash = Some(header.hash()); - encoded::Header::new(::rlp::encode(&header).into_vec()) + encoded::Header::new(::rlp::encode(&header)) }).collect(); assert!(verify(&headers, &request).is_ok()); @@ -231,7 +231,7 @@ mod tests { parent_hash = Some(header.hash()); - encoded::Header::new(::rlp::encode(&header).into_vec()) + encoded::Header::new(::rlp::encode(&header)) }).collect(); assert_eq!(verify(&headers, &request), Err(BasicError::TooManyHeaders(20, 25))); @@ -250,7 +250,7 @@ mod tests { let mut header = Header::default(); header.set_number(x); - encoded::Header::new(::rlp::encode(&header).into_vec()) + encoded::Header::new(::rlp::encode(&header)) }).collect(); assert_eq!(verify(&headers, &request), Err(BasicError::WrongSkip(5, Some(2)))); diff --git a/ethcore/transaction/Cargo.toml b/ethcore/transaction/Cargo.toml index eaf562fcd..1481f8716 100644 --- a/ethcore/transaction/Cargo.toml +++ b/ethcore/transaction/Cargo.toml @@ -10,7 +10,7 @@ ethkey = { path = "../../ethkey" } evm = { path = "../evm" } heapsize = "0.4" keccak-hash = "0.1" -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } unexpected = { path = "../../util/unexpected" } ethereum-types = "0.4" diff --git a/ethcore/types/Cargo.toml b/ethcore/types/Cargo.toml index 75cf68ad1..1833db871 100644 --- a/ethcore/types/Cargo.toml +++ b/ethcore/types/Cargo.toml @@ -5,7 +5,7 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } rlp_derive = { path = "../../util/rlp_derive" } parity-bytes = "0.1" ethereum-types = "0.4" diff --git a/ethcore/vm/Cargo.toml b/ethcore/vm/Cargo.toml index 4ea807089..20bbea09a 100644 --- a/ethcore/vm/Cargo.toml +++ b/ethcore/vm/Cargo.toml @@ -7,10 +7,10 @@ authors = ["Parity Technologies "] byteorder = "1.0" parity-bytes = "0.1" ethereum-types = "0.4" -patricia-trie = "0.2" +patricia-trie = "0.3.0" patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" } log = "0.4" common-types = { path = "../types" } ethjson = { path = "../../json" } -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } keccak-hash = "0.1" diff --git a/ipfs/Cargo.toml b/ipfs/Cargo.toml index 516694f5f..f7d92c10c 100644 --- a/ipfs/Cargo.toml +++ b/ipfs/Cargo.toml @@ -11,7 +11,7 @@ parity-bytes = "0.1" ethereum-types = "0.4" jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" } -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } cid = "0.2" multihash = "0.7" unicase = "2.0" diff --git a/ipfs/src/route.rs b/ipfs/src/route.rs index 8f57fc4d1..b004c8ebf 100644 --- a/ipfs/src/route.rs +++ b/ipfs/src/route.rs @@ -80,7 +80,7 @@ impl IpfsHandler { fn block_list(&self, hash: H256) -> Result { let uncles = self.client().find_uncles(&hash).ok_or(Error::BlockNotFound)?; - Ok(Out::OctetStream(rlp::encode_list(&uncles).into_vec())) + Ok(Out::OctetStream(rlp::encode_list(&uncles))) } /// Get transaction by hash and return as raw binary. @@ -88,7 +88,7 @@ impl IpfsHandler { let tx_id = TransactionId::Hash(hash); let tx = self.client().transaction(tx_id).ok_or(Error::TransactionNotFound)?; - Ok(Out::OctetStream(rlp::encode(&*tx).into_vec())) + Ok(Out::OctetStream(rlp::encode(&*tx))) } /// Get state trie node by hash and return as raw binary. diff --git a/local-store/Cargo.toml b/local-store/Cargo.toml index 47edcc15b..b92ba4cc4 100644 --- a/local-store/Cargo.toml +++ b/local-store/Cargo.toml @@ -10,7 +10,7 @@ ethcore-io = { path = "../util/io" } ethcore-transaction = { path = "../ethcore/transaction" } kvdb = "0.1" log = "0.4" -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } serde = "1.0" serde_derive = "1.0" serde_json = "1.0" diff --git a/local-store/src/lib.rs b/local-store/src/lib.rs index 13d238ed6..aa75ada8f 100644 --- a/local-store/src/lib.rs +++ b/local-store/src/lib.rs @@ -125,7 +125,7 @@ impl TransactionEntry { impl From for TransactionEntry { fn from(pending: PendingTransaction) -> Self { TransactionEntry { - rlp_bytes: ::rlp::encode(&pending.transaction).into_vec(), + rlp_bytes: ::rlp::encode(&pending.transaction), condition: pending.condition.map(Into::into), } } diff --git a/miner/Cargo.toml b/miner/Cargo.toml index d5839bf82..f94d086e5 100644 --- a/miner/Cargo.toml +++ b/miner/Cargo.toml @@ -27,7 +27,7 @@ linked-hash-map = "0.5" log = "0.4" parking_lot = "0.6" price-info = { path = "../price-info", optional = true } -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } trace-time = "0.1" transaction-pool = "1.13" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 84568391f..f2d319704 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -58,8 +58,8 @@ keccak-hash = "0.1.2" parity-reactor = { path = "../util/reactor" } parity-updater = { path = "../updater" } parity-version = { path = "../util/version" } -patricia-trie = "0.2" -rlp = { version = "0.2.4", features = ["ethereum"] } +patricia-trie = "0.3.0" +rlp = { version = "0.3.0", features = ["ethereum"] } stats = { path = "../util/stats" } vm = { path = "../ethcore/vm" } diff --git a/rpc/src/v1/helpers/work.rs b/rpc/src/v1/helpers/work.rs index c2b7db765..18047e546 100644 --- a/rpc/src/v1/helpers/work.rs +++ b/rpc/src/v1/helpers/work.rs @@ -32,7 +32,7 @@ pub fn submit_work_detail(client: &Arc, let pow_hash: EthcoreH256 = pow_hash.into(); let mix_hash: EthcoreH256 = mix_hash.into(); trace!(target: "miner", "submit_work_detail: Decoded: nonce={}, pow_hash={}, mix_hash={}", nonce, pow_hash, mix_hash); - let seal = vec![rlp::encode(&mix_hash).into_vec(), rlp::encode(&nonce).into_vec()]; + let seal = vec![rlp::encode(&mix_hash), rlp::encode(&nonce)]; let import = miner.submit_seal(pow_hash, seal) .and_then(|block| client.import_sealed_block(block)); match import { diff --git a/rpc/src/v1/impls/personal.rs b/rpc/src/v1/impls/personal.rs index 9def02447..a83fff926 100644 --- a/rpc/src/v1/impls/personal.rs +++ b/rpc/src/v1/impls/personal.rs @@ -175,7 +175,7 @@ impl Personal for PersonalClient { .and_then(|(pending_tx, dispatcher)| { let chain_id = pending_tx.chain_id(); trace!(target: "miner", "send_transaction: dispatching tx: {} for chain ID {:?}", - ::rlp::encode(&*pending_tx).into_vec().pretty(), chain_id); + ::rlp::encode(&*pending_tx).pretty(), chain_id); dispatcher.dispatch_transaction(pending_tx).map(Into::into) }) diff --git a/rpc/src/v1/tests/mocked/eth.rs b/rpc/src/v1/tests/mocked/eth.rs index 2bf8f50e2..ff364cf7f 100644 --- a/rpc/src/v1/tests/mocked/eth.rs +++ b/rpc/src/v1/tests/mocked/eth.rs @@ -981,7 +981,7 @@ fn rpc_eth_send_raw_transaction() { let signature = tester.accounts_provider.sign(address, None, t.hash(None)).unwrap(); let t = t.with_signature(signature, None); - let rlp = rlp::encode(&t).into_vec().to_hex(); + let rlp = rlp::encode(&t).to_hex(); let req = r#"{ "jsonrpc": "2.0", diff --git a/rpc/src/v1/types/transaction.rs b/rpc/src/v1/types/transaction.rs index 8518e1497..4d930159a 100644 --- a/rpc/src/v1/types/transaction.rs +++ b/rpc/src/v1/types/transaction.rs @@ -200,7 +200,7 @@ impl Transaction { Action::Create => Some(contract_address(scheme, &t.sender(), &t.nonce, &t.data).0.into()), Action::Call(_) => None, }, - raw: ::rlp::encode(&t.signed).into_vec().into(), + raw: ::rlp::encode(&t.signed).into(), public_key: t.recover_public().ok().map(Into::into), chain_id: t.chain_id().map(U64::from), standard_v: t.standard_v().into(), @@ -234,7 +234,7 @@ impl Transaction { Action::Create => Some(contract_address(scheme, &t.sender(), &t.nonce, &t.data).0.into()), Action::Call(_) => None, }, - raw: ::rlp::encode(&t).into_vec().into(), + raw: ::rlp::encode(&t).into(), public_key: t.public_key().map(Into::into), chain_id: t.chain_id().map(U64::from), standard_v: t.standard_v().into(), diff --git a/util/journaldb/Cargo.toml b/util/journaldb/Cargo.toml index cd9198408..709664a53 100644 --- a/util/journaldb/Cargo.toml +++ b/util/journaldb/Cargo.toml @@ -8,15 +8,15 @@ license = "GPL3" [dependencies] parity-bytes = "0.1" ethereum-types = "0.4" -hashdb = "0.2.1" +hashdb = "0.3.0" heapsize = "0.4" keccak-hasher = { path = "../keccak-hasher" } kvdb = "0.1" log = "0.4" -memorydb = "0.2.1" +memorydb = "0.3.0" parking_lot = "0.6" fastmap = { path = "../../util/fastmap" } -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } [dev-dependencies] ethcore-logger = { path = "../../logger" } diff --git a/util/journaldb/src/archivedb.rs b/util/journaldb/src/archivedb.rs index 3993887e4..86ed6cf51 100644 --- a/util/journaldb/src/archivedb.rs +++ b/util/journaldb/src/archivedb.rs @@ -25,7 +25,7 @@ use bytes::Bytes; use ethereum_types::H256; use hashdb::*; use keccak_hasher::KeccakHasher; -use kvdb::{KeyValueDB, DBTransaction}; +use kvdb::{KeyValueDB, DBTransaction, DBValue}; use rlp::{encode, decode}; use super::{DB_PREFIX_LEN, LATEST_ERA_KEY, error_key_already_exists, error_negatively_reference_hash}; use super::memorydb::*; @@ -39,7 +39,7 @@ use traits::JournalDB; /// immediately. As this is an "archive" database, nothing is ever removed. This means /// that the states of any block the node has ever processed will be accessible. pub struct ArchiveDB { - overlay: MemoryDB, + overlay: MemoryDB, backing: Arc, latest_era: Option, column: Option, @@ -64,7 +64,7 @@ impl ArchiveDB { } } -impl HashDB for ArchiveDB { +impl HashDB for ArchiveDB { fn keys(&self) -> HashMap { let mut ret: HashMap = self.backing.iter(self.column) .map(|(key, _)| (H256::from_slice(&*key), 1)) @@ -193,7 +193,7 @@ impl JournalDB for ArchiveDB { &self.backing } - fn consolidate(&mut self, with: MemoryDB) { + fn consolidate(&mut self, with: MemoryDB) { self.overlay.consolidate(with); } } @@ -202,7 +202,7 @@ impl JournalDB for ArchiveDB { mod tests { use keccak::keccak; - use hashdb::{HashDB, DBValue}; + use hashdb::HashDB; use super::*; use {kvdb_memorydb, JournalDB}; diff --git a/util/journaldb/src/as_hash_db_impls.rs b/util/journaldb/src/as_hash_db_impls.rs index bd3b0e2d7..648e370a0 100644 --- a/util/journaldb/src/as_hash_db_impls.rs +++ b/util/journaldb/src/as_hash_db_impls.rs @@ -22,28 +22,29 @@ use earlymergedb::EarlyMergeDB; use overlayrecentdb::OverlayRecentDB; use refcounteddb::RefCountedDB; use overlaydb::OverlayDB; +use kvdb::DBValue; -impl AsHashDB for ArchiveDB { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl AsHashDB for ArchiveDB { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -impl AsHashDB for EarlyMergeDB { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl AsHashDB for EarlyMergeDB { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -impl AsHashDB for OverlayRecentDB { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl AsHashDB for OverlayRecentDB { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -impl AsHashDB for RefCountedDB { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +impl AsHashDB for RefCountedDB { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } } -impl AsHashDB for OverlayDB { - fn as_hashdb(&self) -> &HashDB { self } - fn as_hashdb_mut(&mut self) -> &mut HashDB { self } -} \ No newline at end of file +impl AsHashDB for OverlayDB { + fn as_hashdb(&self) -> &HashDB { self } + fn as_hashdb_mut(&mut self) -> &mut HashDB { self } +} diff --git a/util/journaldb/src/earlymergedb.rs b/util/journaldb/src/earlymergedb.rs index 68b8675af..e50df3073 100644 --- a/util/journaldb/src/earlymergedb.rs +++ b/util/journaldb/src/earlymergedb.rs @@ -26,7 +26,7 @@ use ethereum_types::H256; use hashdb::*; use heapsize::HeapSizeOf; use keccak_hasher::KeccakHasher; -use kvdb::{KeyValueDB, DBTransaction}; +use kvdb::{KeyValueDB, DBTransaction, DBValue}; use memorydb::*; use parking_lot::RwLock; use rlp::{encode, decode}; @@ -107,7 +107,7 @@ enum RemoveFrom { /// /// TODO: `store_reclaim_period` pub struct EarlyMergeDB { - overlay: MemoryDB, + overlay: MemoryDB, backing: Arc, refs: Option>>>, latest_era: Option, @@ -287,7 +287,7 @@ impl EarlyMergeDB { } } -impl HashDB for EarlyMergeDB { +impl HashDB for EarlyMergeDB { fn keys(&self) -> HashMap { let mut ret: HashMap = self.backing.iter(self.column) .map(|(key, _)| (H256::from_slice(&*key), 1)) @@ -514,7 +514,7 @@ impl JournalDB for EarlyMergeDB { Ok(ops) } - fn consolidate(&mut self, with: MemoryDB) { + fn consolidate(&mut self, with: MemoryDB) { self.overlay.consolidate(with); } } @@ -523,7 +523,7 @@ impl JournalDB for EarlyMergeDB { mod tests { use keccak::keccak; - use hashdb::{HashDB, DBValue}; + use hashdb::HashDB; use super::*; use super::super::traits::JournalDB; use ethcore_logger::init_log; diff --git a/util/journaldb/src/overlaydb.rs b/util/journaldb/src/overlaydb.rs index f4b20b219..259e756bd 100644 --- a/util/journaldb/src/overlaydb.rs +++ b/util/journaldb/src/overlaydb.rs @@ -26,8 +26,8 @@ use rlp::{Rlp, RlpStream, Encodable, DecoderError, Decodable, encode, decode}; use hashdb::*; use keccak_hasher::KeccakHasher; use memorydb::*; -use kvdb::{KeyValueDB, DBTransaction}; -use super::error_negatively_reference_hash; +use kvdb::{KeyValueDB, DBTransaction, DBValue}; +use super::{error_negatively_reference_hash}; /// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay. /// @@ -39,7 +39,7 @@ use super::error_negatively_reference_hash; /// queries have an immediate effect in terms of these functions. #[derive(Clone)] pub struct OverlayDB { - overlay: MemoryDB, + overlay: MemoryDB, backing: Arc, column: Option, } @@ -140,7 +140,7 @@ impl OverlayDB { fn payload(&self, key: &H256) -> Option { self.backing.get(self.column, key) .expect("Low-level database error. Some issue with your hard disk?") - .map(|d| decode(&d).expect("decoding db value failed")) + .map(|ref d| decode(d).expect("decoding db value failed") ) } /// Put the refs and value of the given key, possibly deleting it from the db. @@ -155,7 +155,7 @@ impl OverlayDB { } } -impl HashDB for OverlayDB { +impl HashDB for OverlayDB { fn keys(&self) -> HashMap { let mut ret: HashMap = self.backing.iter(self.column) .map(|(key, _)| { diff --git a/util/journaldb/src/overlayrecentdb.rs b/util/journaldb/src/overlayrecentdb.rs index 1549d3baa..017447bcc 100644 --- a/util/journaldb/src/overlayrecentdb.rs +++ b/util/journaldb/src/overlayrecentdb.rs @@ -26,7 +26,7 @@ use ethereum_types::H256; use hashdb::*; use heapsize::HeapSizeOf; use keccak_hasher::KeccakHasher; -use kvdb::{KeyValueDB, DBTransaction}; +use kvdb::{KeyValueDB, DBTransaction, DBValue}; use memorydb::*; use parking_lot::RwLock; use fastmap::H256FastMap; @@ -66,7 +66,7 @@ use util::DatabaseKey; /// 7. Delete ancient record from memory and disk. pub struct OverlayRecentDB { - transaction_overlay: MemoryDB, + transaction_overlay: MemoryDB, backing: Arc, journal_overlay: Arc>, column: Option, @@ -120,7 +120,7 @@ impl<'a> Encodable for DatabaseValueRef<'a> { #[derive(PartialEq)] struct JournalOverlay { - backing_overlay: MemoryDB, // Nodes added in the history period + backing_overlay: MemoryDB, // Nodes added in the history period pending_overlay: H256FastMap, // Nodes being transfered from backing_overlay to backing db journal: HashMap>, latest_era: Option, @@ -323,10 +323,10 @@ impl JournalDB for OverlayRecentDB { index, }; - batch.put_vec(self.column, &encode(&db_key), encoded_value.into_vec()); + batch.put_vec(self.column, &encode(&db_key), encoded_value.to_vec()); if journal_overlay.latest_era.map_or(true, |e| now > e) { trace!(target: "journaldb", "Set latest era to {}", now); - batch.put_vec(self.column, &LATEST_ERA_KEY, encode(&now).into_vec()); + batch.put_vec(self.column, &LATEST_ERA_KEY, encode(&now).to_vec()); journal_overlay.latest_era = Some(now); } @@ -434,12 +434,12 @@ impl JournalDB for OverlayRecentDB { Ok(ops) } - fn consolidate(&mut self, with: MemoryDB) { + fn consolidate(&mut self, with: MemoryDB) { self.transaction_overlay.consolidate(with); } } -impl HashDB for OverlayRecentDB { +impl HashDB for OverlayRecentDB { fn keys(&self) -> HashMap { let mut ret: HashMap = self.backing.iter(self.column) .map(|(key, _)| (H256::from_slice(&*key), 1)) @@ -493,7 +493,7 @@ mod tests { use keccak::keccak; use super::*; - use hashdb::{HashDB, DBValue}; + use hashdb::HashDB; use ethcore_logger::init_log; use {kvdb_memorydb, JournalDB}; diff --git a/util/journaldb/src/refcounteddb.rs b/util/journaldb/src/refcounteddb.rs index 7cbe9022d..99b3d8d73 100644 --- a/util/journaldb/src/refcounteddb.rs +++ b/util/journaldb/src/refcounteddb.rs @@ -25,7 +25,7 @@ use ethereum_types::H256; use hashdb::*; use heapsize::HeapSizeOf; use keccak_hasher::KeccakHasher; -use kvdb::{KeyValueDB, DBTransaction}; +use kvdb::{KeyValueDB, DBTransaction, DBValue}; use memorydb::MemoryDB; use overlaydb::OverlayDB; use rlp::{encode, decode}; @@ -80,7 +80,7 @@ impl RefCountedDB { } } -impl HashDB for RefCountedDB { +impl HashDB for RefCountedDB { fn keys(&self) -> HashMap { self.forward.keys() } fn get(&self, key: &H256) -> Option { self.forward.get(key) } fn contains(&self, key: &H256) -> bool { self.forward.contains(key) } @@ -199,7 +199,7 @@ impl JournalDB for RefCountedDB { self.forward.commit_to_batch(batch) } - fn consolidate(&mut self, mut with: MemoryDB) { + fn consolidate(&mut self, mut with: MemoryDB) { for (key, (value, rc)) in with.drain() { for _ in 0..rc { self.emplace(key, value.clone()); @@ -216,7 +216,7 @@ impl JournalDB for RefCountedDB { mod tests { use keccak::keccak; - use hashdb::{HashDB, DBValue}; + use hashdb::HashDB; use super::*; use {JournalDB, kvdb_memorydb}; diff --git a/util/journaldb/src/traits.rs b/util/journaldb/src/traits.rs index 075a54600..1d6aae5f6 100644 --- a/util/journaldb/src/traits.rs +++ b/util/journaldb/src/traits.rs @@ -21,13 +21,13 @@ use std::sync::Arc; use bytes::Bytes; use ethereum_types::H256; -use hashdb::*; +use hashdb::HashDB; use keccak_hasher::KeccakHasher; -use kvdb::{self, DBTransaction}; +use kvdb::{self, DBTransaction, DBValue}; /// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually /// exclusive actions. -pub trait JournalDB: HashDB { +pub trait JournalDB: HashDB { /// Return a copy of ourself, in a box. fn boxed_clone(&self) -> Box; @@ -78,7 +78,7 @@ pub trait JournalDB: HashDB { fn flush(&self) {} /// Consolidate all the insertions and deletions in the given memory overlay. - fn consolidate(&mut self, overlay: ::memorydb::MemoryDB); + fn consolidate(&mut self, overlay: ::memorydb::MemoryDB); /// Commit all changes in a single batch #[cfg(test)] diff --git a/util/keccak-hasher/Cargo.toml b/util/keccak-hasher/Cargo.toml index 027dd5d2c..f61e461e2 100644 --- a/util/keccak-hasher/Cargo.toml +++ b/util/keccak-hasher/Cargo.toml @@ -8,5 +8,5 @@ license = "GPL-3.0" [dependencies] ethereum-types = "0.4" tiny-keccak = "1.4.2" -hashdb = "0.2.1" +hashdb = "0.3.0" plain_hasher = "0.2" diff --git a/util/network-devp2p/Cargo.toml b/util/network-devp2p/Cargo.toml index c45747747..112595ad9 100644 --- a/util/network-devp2p/Cargo.toml +++ b/util/network-devp2p/Cargo.toml @@ -26,7 +26,7 @@ ethcore-logger = { path ="../../logger" } ethcore-network = { path = "../network" } ethereum-types = "0.4" ethkey = { path = "../../ethkey" } -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } parity-path = "0.1" ipnetwork = "0.12.6" keccak-hash = "0.1" diff --git a/util/network-devp2p/src/discovery.rs b/util/network-devp2p/src/discovery.rs index 8ef244cbd..abf6cf4d0 100644 --- a/util/network-devp2p/src/discovery.rs +++ b/util/network-devp2p/src/discovery.rs @@ -435,7 +435,6 @@ impl<'a> Discovery<'a> { let signed = &packet[(32 + 65)..]; let signature = H520::from_slice(&packet[32..(32 + 65)]); let node_id = recover(&signature.into(), &keccak(signed))?; - let packet_id = signed[0]; let rlp = Rlp::new(&signed[1..]); match packet_id { @@ -470,7 +469,6 @@ impl<'a> Discovery<'a> { let ping_to = NodeEndpoint::from_rlp(&rlp.at(2)?)?; let timestamp: u64 = rlp.val_at(3)?; self.check_timestamp(timestamp)?; - let mut response = RlpStream::new_list(3); let pong_to = NodeEndpoint { address: from.clone(), @@ -1063,7 +1061,7 @@ mod tests { 4be2be5a685a80971ddcfa80cb422cdd0101ec04cb847f000001820cfa8215a8d790000000000000\ 000000000000000000018208ae820d058443b9a3550102\ ".from_hex().unwrap(); - assert!(discovery.on_packet(&packet, from.clone()).is_ok()); + let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let packet = "\ 577be4349c4dd26768081f58de4c6f375a7a22f3f7adda654d1428637412c3d7fe917cadc56d4e5e\ @@ -1075,7 +1073,7 @@ mod tests { 7084a95398b6a21eac920fe3dd1345ec0a7ef39367ee69ddf092cbfe5b93e5e568ebc491983c09c7\ 6d922dc3\ ".from_hex().unwrap(); - assert!(discovery.on_packet(&packet, from.clone()).is_ok()); + let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let packet = "\ 09b2428d83348d27cdf7064ad9024f526cebc19e4958f0fdad87c15eb598dd61d08423e0bf66b206\ @@ -1085,7 +1083,7 @@ mod tests { a355c6010203c2040506a0c969a58f6f9095004c0177a6b47f451530cab38966a25cca5cb58f0555 42124e\ ".from_hex().unwrap(); - assert!(discovery.on_packet(&packet, from.clone()).is_ok()); + let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let packet = "\ c7c44041b9f7c7e41934417ebac9a8e1a4c6298f74553f2fcfdcae6ed6fe53163eb3d2b52e39fe91\ @@ -1095,7 +1093,7 @@ mod tests { 7bf5ccd1fc7f8443b9a35582999983999999280dc62cc8255c73471e0a61da0c89acdc0e035e260a\ dd7fc0c04ad9ebf3919644c91cb247affc82b69bd2ca235c71eab8e49737c937a2c396\ ".from_hex().unwrap(); - assert!(discovery.on_packet(&packet, from.clone()).is_ok()); + let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let packet = "\ c679fc8fe0b8b12f06577f2e802d34f6fa257e6137a995f6f4cbfc9ee50ed3710faf6e66f932c4c8\ @@ -1111,7 +1109,7 @@ mod tests { 197101a4b2b47dd2d47295286fc00cc081bb542d760717d1bdd6bec2c37cd72eca367d6dd3b9df73\ 8443b9a355010203b525a138aa34383fec3d2719a0\ ".from_hex().unwrap(); - assert!(discovery.on_packet(&packet, from.clone()).is_ok()); + let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); } #[test] diff --git a/util/network/Cargo.toml b/util/network/Cargo.toml index b6beeb3e0..51c3dc671 100644 --- a/util/network/Cargo.toml +++ b/util/network/Cargo.toml @@ -13,7 +13,7 @@ ethcore-io = { path = "../io" } ethereum-types = "0.4" ethkey = { path = "../../ethkey" } ipnetwork = "0.12.6" -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } libc = "0.2" parity-snappy = "0.1" diff --git a/util/network/src/error.rs b/util/network/src/error.rs index 4233b9e05..e7b0d6eda 100644 --- a/util/network/src/error.rs +++ b/util/network/src/error.rs @@ -85,6 +85,7 @@ error_chain! { foreign_links { SocketIo(IoError) #[doc = "Socket IO error."]; Decompression(snappy::InvalidInput) #[doc = "Decompression error."]; + Rlp(rlp::DecoderError) #[doc = "Rlp decoder error."]; } errors { @@ -172,12 +173,6 @@ impl From for Error { } } -impl From for Error { - fn from(_err: rlp::DecoderError) -> Self { - ErrorKind::Auth.into() - } -} - impl From for Error { fn from(_err: ethkey::Error) -> Self { ErrorKind::Auth.into() @@ -210,7 +205,7 @@ fn test_errors() { assert_eq!(DisconnectReason::Unknown, r); match *>::from(rlp::DecoderError::RlpIsTooBig).kind() { - ErrorKind::Auth => {}, + ErrorKind::Rlp(_) => {}, _ => panic!("Unexpected error"), } diff --git a/util/patricia-trie-ethereum/Cargo.toml b/util/patricia-trie-ethereum/Cargo.toml index a4121a0ba..e6880691a 100644 --- a/util/patricia-trie-ethereum/Cargo.toml +++ b/util/patricia-trie-ethereum/Cargo.toml @@ -6,14 +6,14 @@ description = "Merkle-Patricia Trie (Ethereum Style)" license = "GPL-3.0" [dependencies] -patricia-trie = "0.2" +patricia-trie = "0.3.0" keccak-hasher = { version = "0.1.1", path = "../keccak-hasher" } -hashdb = "0.2" -rlp = { version = "0.2.4", features = ["ethereum"] } +hashdb = "0.3.0" +rlp = "0.3.0" parity-bytes = "0.1" ethereum-types = "0.4" elastic-array = "0.10" [dev-dependencies] -memorydb = "0.2.1" +memorydb = "0.3.0" keccak-hash = "0.1.2" diff --git a/util/patricia-trie-ethereum/src/lib.rs b/util/patricia-trie-ethereum/src/lib.rs index c6a4d36c7..aa83e330c 100644 --- a/util/patricia-trie-ethereum/src/lib.rs +++ b/util/patricia-trie-ethereum/src/lib.rs @@ -48,6 +48,7 @@ pub type RlpCodec = RlpNodeCodec; /// extern crate keccak_hasher; /// extern crate memorydb; /// extern crate ethereum_types; +/// extern crate elastic_array; /// /// use trie::*; /// use hashdb::*; @@ -55,10 +56,12 @@ pub type RlpCodec = RlpNodeCodec; /// use memorydb::*; /// use ethereum_types::H256; /// use ethtrie::{TrieDB, TrieDBMut}; +/// use elastic_array::ElasticArray128; /// +/// type DBValue = ElasticArray128; /// /// fn main() { -/// let mut memdb = MemoryDB::::new(); +/// let mut memdb = MemoryDB::::new(); /// let mut root = H256::new(); /// TrieDBMut::new(&mut memdb, &mut root).insert(b"foo", b"bar").unwrap(); /// let t = TrieDB::new(&memdb, &root).unwrap(); @@ -89,16 +92,19 @@ pub type FatDB<'db> = trie::FatDB<'db, KeccakHasher, RlpCodec>; /// extern crate keccak_hasher; /// extern crate memorydb; /// extern crate ethereum_types; +/// extern crate elastic_array; /// /// use keccak_hash::KECCAK_NULL_RLP; /// use ethtrie::{TrieDBMut, trie::TrieMut}; -/// use hashdb::DBValue; /// use keccak_hasher::KeccakHasher; /// use memorydb::*; /// use ethereum_types::H256; +/// use elastic_array::ElasticArray128; +/// +/// type DBValue = ElasticArray128; /// /// fn main() { -/// let mut memdb = MemoryDB::::new(); +/// let mut memdb = MemoryDB::::new(); /// let mut root = H256::new(); /// let mut t = TrieDBMut::new(&mut memdb, &mut root); /// assert!(t.is_empty()); diff --git a/util/patricia-trie-ethereum/src/rlp_node_codec.rs b/util/patricia-trie-ethereum/src/rlp_node_codec.rs index 414a129ef..50482c47b 100644 --- a/util/patricia-trie-ethereum/src/rlp_node_codec.rs +++ b/util/patricia-trie-ethereum/src/rlp_node_codec.rs @@ -16,7 +16,7 @@ //! `NodeCodec` implementation for Rlp -use elastic_array::{ElasticArray1024, ElasticArray128}; +use elastic_array::ElasticArray128; use ethereum_types::H256; use hashdb::Hasher; use keccak_hasher::KeccakHasher; @@ -72,20 +72,20 @@ impl NodeCodec for RlpNodeCodec { fn is_empty_node(data: &[u8]) -> bool { Rlp::new(data).is_empty() } - fn empty_node() -> ElasticArray1024 { + fn empty_node() -> Vec { let mut stream = RlpStream::new(); stream.append_empty_data(); stream.drain() } - fn leaf_node(partial: &[u8], value: &[u8]) -> ElasticArray1024 { + fn leaf_node(partial: &[u8], value: &[u8]) -> Vec { let mut stream = RlpStream::new_list(2); stream.append(&partial); stream.append(&value); stream.drain() } - fn ext_node(partial: &[u8], child_ref: ChildReference<::Out>) -> ElasticArray1024 { + fn ext_node(partial: &[u8], child_ref: ChildReference<::Out>) -> Vec { let mut stream = RlpStream::new_list(2); stream.append(&partial); match child_ref { @@ -98,7 +98,8 @@ impl NodeCodec for RlpNodeCodec { stream.drain() } - fn branch_node(children: I, value: Option>) -> ElasticArray1024 + // fn branch_node(children: I, value: Option>) -> Vec + fn branch_node(children: I, value: Option>) -> Vec where I: IntoIterator::Out>>> { let mut stream = RlpStream::new_list(17); diff --git a/util/rlp_compress/Cargo.toml b/util/rlp_compress/Cargo.toml index 63a58bc44..4bd34bce1 100644 --- a/util/rlp_compress/Cargo.toml +++ b/util/rlp_compress/Cargo.toml @@ -4,6 +4,6 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -rlp = "0.2.4" +rlp = { version = "0.3.0", features = ["ethereum"] } elastic-array = "0.10" lazy_static = "1.0" diff --git a/util/rlp_compress/src/lib.rs b/util/rlp_compress/src/lib.rs index af5b09aac..38dabcd86 100644 --- a/util/rlp_compress/src/lib.rs +++ b/util/rlp_compress/src/lib.rs @@ -64,7 +64,7 @@ fn map_rlp ElasticArray1024>(rlp: &Rlp, f: F) -> ElasticArray for subrlp in rlp.iter() { stream.append_raw(&f(&subrlp), 1); } - stream.drain() + stream.drain().as_slice().into() } /// Stores RLPs used for compression diff --git a/util/rlp_derive/Cargo.toml b/util/rlp_derive/Cargo.toml index 2c7dfd509..2087f7524 100644 --- a/util/rlp_derive/Cargo.toml +++ b/util/rlp_derive/Cargo.toml @@ -13,4 +13,4 @@ quote = "0.6" proc-macro2 = "0.4" [dev-dependencies] -rlp = "0.2.4" +rlp = { version = "0.3.0", features = ["ethereum"] } diff --git a/util/rlp_derive/tests/rlp.rs b/util/rlp_derive/tests/rlp.rs index 7115b87c9..41cfed17c 100644 --- a/util/rlp_derive/tests/rlp.rs +++ b/util/rlp_derive/tests/rlp.rs @@ -37,7 +37,7 @@ fn test_encode_foo() { }; let expected = vec![0xc4, 0x83, b'c', b'a', b't']; - let out = encode(&foo).into_vec(); + let out = encode(&foo); assert_eq!(out, expected); let decoded = decode(&expected).expect("decode failure"); @@ -51,7 +51,7 @@ fn test_encode_foo_wrapper() { }; let expected = vec![0x83, b'c', b'a', b't']; - let out = encode(&foo).into_vec(); + let out = encode(&foo); assert_eq!(out, expected); let decoded = decode(&expected).expect("decode failure"); diff --git a/util/triehash-ethereum/Cargo.toml b/util/triehash-ethereum/Cargo.toml index 152e9cbdf..e46d5d690 100644 --- a/util/triehash-ethereum/Cargo.toml +++ b/util/triehash-ethereum/Cargo.toml @@ -6,6 +6,6 @@ description = "Trie-root helpers, ethereum style" license = "GPL-3.0" [dependencies] -triehash = { version = "0.2.3", features = ["ethereum"] } +triehash = { version = "0.3.0", features = ["ethereum"] } ethereum-types = "0.4" keccak-hasher = { path = "../keccak-hasher" } diff --git a/util/triehash-ethereum/src/lib.rs b/util/triehash-ethereum/src/lib.rs index 7de77473c..55aa74760 100644 --- a/util/triehash-ethereum/src/lib.rs +++ b/util/triehash-ethereum/src/lib.rs @@ -49,7 +49,7 @@ where I: IntoIterator, V: AsRef<[u8]>, { - triehash::ordered_trie_root::(input) + triehash::ordered_trie_root::(input) } #[cfg(test)] @@ -81,7 +81,7 @@ mod tests { let data = &["cake", "pie", "candy"]; assert_eq!( ordered_trie_root(data), - triehash::ordered_trie_root::(data) + triehash::ordered_trie_root::(data) ); } -} \ No newline at end of file +} diff --git a/util/version/Cargo.toml b/util/version/Cargo.toml index 2e811827b..d5f75df63 100644 --- a/util/version/Cargo.toml +++ b/util/version/Cargo.toml @@ -22,7 +22,7 @@ kovan = { forkBlock = 6600000, critical = false } [dependencies] parity-bytes = "0.1" -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } target_info = "0.1" [build-dependencies] diff --git a/whisper/Cargo.toml b/whisper/Cargo.toml index 4cf837992..2bf371827 100644 --- a/whisper/Cargo.toml +++ b/whisper/Cargo.toml @@ -17,7 +17,7 @@ mem = { path = "../util/mem" } ordered-float = "0.5" parking_lot = "0.6" rand = "0.4" -rlp = { version = "0.2.4", features = ["ethereum"] } +rlp = { version = "0.3.0", features = ["ethereum"] } serde = "1.0" serde_derive = "1.0" serde_json = "1.0"