Update a few parity-common dependencies (#9663)
* Update a few parity-common dependencies * cleanup * cleanup * revert update of ethereum/tests * better reporting of network rlp errors * Use rlp 0.3.0-beta.1 * fix util function get_dummy_blocks * Already a Vec * encode_list returns vec already * Address grumble * No need for betas * Fix double spaces
This commit is contained in:
parent
73db5dda8c
commit
c313039526
117
Cargo.lock
generated
117
Cargo.lock
generated
@ -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)" = "<none>"
|
||||
"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)" = "<none>"
|
||||
"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"
|
||||
|
@ -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" }
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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<DB: HashDB<KeccakHasher>> {
|
||||
pub struct CHT<DB: HashDB<KeccakHasher, DBValue>> {
|
||||
db: DB,
|
||||
root: H256, // the root of this CHT.
|
||||
number: u64,
|
||||
}
|
||||
|
||||
impl<DB: HashDB<KeccakHasher>> CHT<DB> {
|
||||
impl<DB: HashDB<KeccakHasher, DBValue>> CHT<DB> {
|
||||
/// 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<F>(cht_num: u64, mut fetcher: F) -> Option<CHT<MemoryDB<KeccakHasher>>>
|
||||
pub fn build<F>(cht_num: u64, mut fetcher: F) -> Option<CHT<MemoryDB<KeccakHasher, DBValue>>>
|
||||
where F: FnMut(BlockId) -> Option<BlockInfo>
|
||||
{
|
||||
let mut db = MemoryDB::<KeccakHasher>::new();
|
||||
let mut db = MemoryDB::<KeccakHasher, DBValue>::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<I>(cht_num: u64, iterable: I) -> Option<H256>
|
||||
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<I>(cht_num: u64, iterable: I) -> Option<H256>
|
||||
/// 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::<KeccakHasher>::new();
|
||||
let mut db = MemoryDB::<KeccakHasher, DBValue>::new();
|
||||
|
||||
for node in proof { db.insert(&node[..]); }
|
||||
let res = match TrieDB::new(&db, &root) {
|
||||
|
@ -218,7 +218,7 @@ impl HeaderChain {
|
||||
) -> Result<Self, Error> {
|
||||
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)? {
|
||||
|
@ -150,7 +150,7 @@ impl Provider for TestProvider {
|
||||
|
||||
fn storage_proof(&self, req: request::CompleteStorageRequest) -> Option<request::StorageResponse> {
|
||||
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,
|
||||
})
|
||||
}
|
||||
|
@ -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::<Vec<_>>();
|
||||
|
||||
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(),
|
||||
};
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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<KeccakHasher>, address_hash: H256) -> Box<HashDB<KeccakHasher> + 'db> {
|
||||
pub fn readonly<'db>(&self, db: &'db HashDB<KeccakHasher, DBValue>, address_hash: H256) -> Box<HashDB<KeccakHasher, DBValue> + '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<KeccakHasher>, address_hash: H256) -> Box<HashDB<KeccakHasher> + 'db> {
|
||||
pub fn create<'db>(&self, db: &'db mut HashDB<KeccakHasher, DBValue>, address_hash: H256) -> Box<HashDB<KeccakHasher, DBValue> + '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<KeccakHasher>,
|
||||
db: &'db HashDB<KeccakHasher, DBValue>,
|
||||
address_hash: H256,
|
||||
}
|
||||
|
||||
impl<'db> AccountDB<'db> {
|
||||
/// Create a new AccountDB from an address.
|
||||
#[cfg(test)]
|
||||
pub fn new(db: &'db HashDB<KeccakHasher>, address: &Address) -> Self {
|
||||
pub fn new(db: &'db HashDB<KeccakHasher, DBValue>, address: &Address) -> Self {
|
||||
Self::from_hash(db, keccak(address))
|
||||
}
|
||||
|
||||
/// Create a new AcountDB from an address' hash.
|
||||
pub fn from_hash(db: &'db HashDB<KeccakHasher>, address_hash: H256) -> Self {
|
||||
pub fn from_hash(db: &'db HashDB<KeccakHasher, DBValue>, address_hash: H256) -> Self {
|
||||
AccountDB {
|
||||
db: db,
|
||||
address_hash: address_hash,
|
||||
@ -98,12 +98,12 @@ impl<'db> AccountDB<'db> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> AsHashDB<KeccakHasher> for AccountDB<'db> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl<'db> AsHashDB<KeccakHasher, DBValue> for AccountDB<'db> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl<'db> HashDB<KeccakHasher> for AccountDB<'db> {
|
||||
impl<'db> HashDB<KeccakHasher, DBValue> for AccountDB<'db> {
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
unimplemented!()
|
||||
}
|
||||
@ -137,19 +137,19 @@ impl<'db> HashDB<KeccakHasher> for AccountDB<'db> {
|
||||
|
||||
/// DB backend wrapper for Account trie
|
||||
pub struct AccountDBMut<'db> {
|
||||
db: &'db mut HashDB<KeccakHasher>,
|
||||
db: &'db mut HashDB<KeccakHasher, DBValue>,
|
||||
address_hash: H256,
|
||||
}
|
||||
|
||||
impl<'db> AccountDBMut<'db> {
|
||||
/// Create a new AccountDB from an address.
|
||||
#[cfg(test)]
|
||||
pub fn new(db: &'db mut HashDB<KeccakHasher>, address: &Address) -> Self {
|
||||
pub fn new(db: &'db mut HashDB<KeccakHasher, DBValue>, 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<KeccakHasher>, address_hash: H256) -> Self {
|
||||
pub fn from_hash(db: &'db mut HashDB<KeccakHasher, DBValue>, address_hash: H256) -> Self {
|
||||
AccountDBMut {
|
||||
db: db,
|
||||
address_hash: address_hash,
|
||||
@ -162,7 +162,7 @@ impl<'db> AccountDBMut<'db> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> HashDB<KeccakHasher> for AccountDBMut<'db>{
|
||||
impl<'db> HashDB<KeccakHasher, DBValue> for AccountDBMut<'db>{
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
unimplemented!()
|
||||
}
|
||||
@ -208,19 +208,19 @@ impl<'db> HashDB<KeccakHasher> for AccountDBMut<'db>{
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> AsHashDB<KeccakHasher> for AccountDBMut<'db> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl<'db> AsHashDB<KeccakHasher, DBValue> for AccountDBMut<'db> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
struct Wrapping<'db>(&'db HashDB<KeccakHasher>);
|
||||
struct Wrapping<'db>(&'db HashDB<KeccakHasher, DBValue>);
|
||||
|
||||
impl<'db> AsHashDB<KeccakHasher> for Wrapping<'db> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl<'db> AsHashDB<KeccakHasher, DBValue> for Wrapping<'db> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl<'db> HashDB<KeccakHasher> for Wrapping<'db> {
|
||||
impl<'db> HashDB<KeccakHasher, DBValue> for Wrapping<'db> {
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
unimplemented!()
|
||||
}
|
||||
@ -252,13 +252,13 @@ impl<'db> HashDB<KeccakHasher> for Wrapping<'db> {
|
||||
}
|
||||
}
|
||||
|
||||
struct WrappingMut<'db>(&'db mut HashDB<KeccakHasher>);
|
||||
impl<'db> AsHashDB<KeccakHasher> for WrappingMut<'db> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
struct WrappingMut<'db>(&'db mut HashDB<KeccakHasher, DBValue>);
|
||||
impl<'db> AsHashDB<KeccakHasher, DBValue> for WrappingMut<'db> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl<'db> HashDB<KeccakHasher> for WrappingMut<'db>{
|
||||
impl<'db> HashDB<KeccakHasher, DBValue> for WrappingMut<'db>{
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
@ -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]
|
||||
|
@ -1853,7 +1853,7 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn encoded_block_receipts(&self, hash: &H256) -> Option<Bytes> {
|
||||
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 {
|
||||
|
@ -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;
|
||||
|
@ -972,7 +972,7 @@ impl Engine<EthereumMachine> 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<EthereumMachine> 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::<U256>().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::<U256>().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::<U256>().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::<U256>().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::<U256>().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::<U256>().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());
|
||||
|
@ -110,7 +110,7 @@ impl Engine<EthereumMachine> 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());
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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()
|
||||
];
|
||||
|
||||
|
@ -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<EthereumMachine> 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<EthereumMachine> 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.
|
||||
|
@ -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);
|
||||
|
@ -157,7 +157,7 @@ fn decode_first_proof(rlp: &Rlp) -> Result<(Header, Vec<DBValue>), ::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<Receipt>), ::error::Error> {
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<H: FnMut(&str, HookType)>(json: &[u8], trie: TrieSpec, start_stop_h
|
||||
for (name, test) in tests.into_iter() {
|
||||
start_stop_hook(&name, HookType::OnStart);
|
||||
|
||||
let mut memdb = MemoryDB::<KeccakHasher>::new();
|
||||
let mut memdb = MemoryDB::<KeccakHasher, DBValue>::new();
|
||||
let mut root = H256::default();
|
||||
let mut t = factory.create(&mut memdb, &mut root);
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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<KeccakHasher>, factory: &TrieFactory<KeccakHasher, RlpCodec>) {
|
||||
pub fn insert_additional(&self, db: &mut HashDB<KeccakHasher, DBValue>, factory: &TrieFactory<KeccakHasher, RlpCodec>) {
|
||||
match self.code {
|
||||
Some(ref c) if !c.is_empty() => { db.insert(c); }
|
||||
_ => {}
|
||||
|
@ -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;
|
||||
}
|
||||
},
|
||||
|
@ -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<W: SnapshotWriter + Send>(
|
||||
engine: &EthEngine,
|
||||
chain: &BlockChain,
|
||||
block_at: H256,
|
||||
state_db: &HashDB<KeccakHasher>,
|
||||
state_db: &HashDB<KeccakHasher, DBValue>,
|
||||
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<KeccakHasher>, root: &H256, writer: &Mutex<SnapshotWriter + 'a>, progress: &'a Progress, part: Option<usize>) -> Result<Vec<H256>, Error> {
|
||||
pub fn chunk_state<'a>(db: &HashDB<KeccakHasher, DBValue>, root: &H256, writer: &Mutex<SnapshotWriter + 'a>, progress: &'a Progress, part: Option<usize>) -> Result<Vec<H256>, 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<KeccakHasher>,
|
||||
db: &mut HashDB<KeccakHasher, DBValue>,
|
||||
account_fat_rlps: Rlp,
|
||||
out_chunk: &mut [(H256, Bytes)],
|
||||
known_code: &HashMap<H256, H256>,
|
||||
@ -541,7 +540,7 @@ fn rebuild_accounts(
|
||||
}
|
||||
}
|
||||
|
||||
::rlp::encode(&acc).into_vec()
|
||||
::rlp::encode(&acc)
|
||||
};
|
||||
|
||||
*out = (hash, thin_rlp);
|
||||
|
@ -62,7 +62,7 @@ impl StateProducer {
|
||||
|
||||
/// Tick the state producer. This alters the state, writing new data into
|
||||
/// the database.
|
||||
pub fn tick<R: Rng>(&mut self, rng: &mut R, db: &mut HashDB<KeccakHasher>) {
|
||||
pub fn tick<R: Rng>(&mut self, rng: &mut R, db: &mut HashDB<KeccakHasher, DBValue>) {
|
||||
// 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<KeccakHasher>, two: &HashDB<KeccakHasher>) {
|
||||
pub fn compare_dbs(one: &HashDB<KeccakHasher, DBValue>, two: &HashDB<KeccakHasher, DBValue>) {
|
||||
let keys = one.keys();
|
||||
|
||||
for key in keys.keys() {
|
||||
|
@ -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<KeccakHasher>, key: &H256) -> TrieResult<H256> {
|
||||
pub fn storage_at(&self, db: &HashDB<KeccakHasher, DBValue>, key: &H256) -> TrieResult<H256> {
|
||||
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<KeccakHasher>, key: &H256) -> TrieResult<H256> {
|
||||
pub fn original_storage_at(&self, db: &HashDB<KeccakHasher, DBValue>, key: &H256) -> TrieResult<H256> {
|
||||
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<H256, H256>, db: &HashDB<KeccakHasher>, key: &H256) -> TrieResult<H256> {
|
||||
fn get_and_cache_storage(storage_root: &H256, storage_cache: &mut LruCache<H256, H256>, db: &HashDB<KeccakHasher, DBValue>, key: &H256) -> TrieResult<H256> {
|
||||
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<KeccakHasher>) -> Option<Arc<Bytes>> {
|
||||
pub fn cache_code(&mut self, db: &HashDB<KeccakHasher, DBValue>) -> Option<Arc<Bytes>> {
|
||||
// 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<KeccakHasher>) -> bool {
|
||||
pub fn cache_code_size(&mut self, db: &HashDB<KeccakHasher, DBValue>) -> 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<KeccakHasher>) -> TrieResult<()> {
|
||||
pub fn commit_storage(&mut self, trie_factory: &TrieFactory, db: &mut HashDB<KeccakHasher, DBValue>) -> 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<KeccakHasher>) {
|
||||
pub fn commit_code(&mut self, db: &mut HashDB<KeccakHasher, DBValue>) {
|
||||
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<KeccakHasher>, storage_key: H256) -> TrieResult<(Vec<Bytes>, H256)> {
|
||||
pub fn prove_storage(&self, db: &HashDB<KeccakHasher, DBValue>, storage_key: H256) -> TrieResult<(Vec<Bytes>, H256)> {
|
||||
let mut recorder = Recorder::new();
|
||||
|
||||
let trie = TrieDB::new(db, &self.storage_root)?;
|
||||
|
@ -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<KeccakHasher>;
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue>;
|
||||
|
||||
/// Treat the backend as a writeable hashdb.
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher>;
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue>;
|
||||
|
||||
/// Add an account entry to the cache.
|
||||
fn add_to_account_cache(&mut self, addr: Address, data: Option<Account>, 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<KeccakHasher>);
|
||||
pub struct ProofCheck(MemoryDB<KeccakHasher, DBValue>);
|
||||
|
||||
impl ProofCheck {
|
||||
/// Create a new `ProofCheck` backend from the given state items.
|
||||
pub fn new(proof: &[DBValue]) -> Self {
|
||||
let mut db = MemoryDB::<KeccakHasher>::new();
|
||||
let mut db = MemoryDB::<KeccakHasher, DBValue>::new();
|
||||
for item in proof { db.insert(item); }
|
||||
ProofCheck(db)
|
||||
}
|
||||
}
|
||||
|
||||
impl HashDB<KeccakHasher> for ProofCheck {
|
||||
impl HashDB<KeccakHasher, DBValue> for ProofCheck {
|
||||
fn keys(&self) -> HashMap<H256, i32> { self.0.keys() }
|
||||
fn get(&self, key: &H256) -> Option<DBValue> {
|
||||
self.0.get(key)
|
||||
@ -108,14 +109,14 @@ impl HashDB<KeccakHasher> for ProofCheck {
|
||||
fn remove(&mut self, _key: &H256) { }
|
||||
}
|
||||
|
||||
impl AsHashDB<KeccakHasher> for ProofCheck {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl AsHashDB<KeccakHasher, DBValue> for ProofCheck {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl Backend for ProofCheck {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
fn add_to_account_cache(&mut self, _addr: Address, _data: Option<Account>, _modified: bool) {}
|
||||
fn cache_code(&self, _hash: H256, _code: Arc<Vec<u8>>) {}
|
||||
fn get_cached_account(&self, _addr: &Address) -> Option<Option<Account>> { 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<H: AsHashDB<KeccakHasher>> {
|
||||
pub struct Proving<H: AsHashDB<KeccakHasher, DBValue>> {
|
||||
base: H, // state we're proving values from.
|
||||
changed: MemoryDB<KeccakHasher>, // changed state via insertions.
|
||||
changed: MemoryDB<KeccakHasher, DBValue>, // changed state via insertions.
|
||||
proof: Mutex<HashSet<DBValue>>,
|
||||
}
|
||||
|
||||
impl<AH: AsHashDB<KeccakHasher> + Send + Sync> AsHashDB<KeccakHasher> for Proving<AH> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl<AH: AsHashDB<KeccakHasher, DBValue> + Send + Sync> AsHashDB<KeccakHasher, DBValue> for Proving<AH> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl<H: AsHashDB<KeccakHasher> + Send + Sync> HashDB<KeccakHasher> for Proving<H> {
|
||||
impl<H: AsHashDB<KeccakHasher, DBValue> + Send + Sync> HashDB<KeccakHasher, DBValue> for Proving<H> {
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
let mut keys = self.base.as_hashdb().keys();
|
||||
keys.extend(self.changed.keys());
|
||||
@ -182,10 +183,10 @@ impl<H: AsHashDB<KeccakHasher> + Send + Sync> HashDB<KeccakHasher> for Proving<H
|
||||
}
|
||||
}
|
||||
|
||||
impl<H: AsHashDB<KeccakHasher> + Send + Sync> Backend for Proving<H> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
impl<H: AsHashDB<KeccakHasher, DBValue> + Send + Sync> Backend for Proving<H> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
|
||||
fn add_to_account_cache(&mut self, _: Address, _: Option<Account>, _: bool) { }
|
||||
|
||||
@ -204,13 +205,13 @@ impl<H: AsHashDB<KeccakHasher> + Send + Sync> Backend for Proving<H> {
|
||||
fn is_known_null(&self, _: &Address) -> bool { false }
|
||||
}
|
||||
|
||||
impl<H: AsHashDB<KeccakHasher>> Proving<H> {
|
||||
impl<H: AsHashDB<KeccakHasher, DBValue>> Proving<H> {
|
||||
/// 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::<KeccakHasher>::new(),
|
||||
changed: MemoryDB::<KeccakHasher, DBValue>::new(),
|
||||
proof: Mutex::new(HashSet::new()),
|
||||
}
|
||||
}
|
||||
@ -222,7 +223,7 @@ impl<H: AsHashDB<KeccakHasher>> Proving<H> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<H: AsHashDB<KeccakHasher> + Clone> Clone for Proving<H> {
|
||||
impl<H: AsHashDB<KeccakHasher, DBValue> + Clone> Clone for Proving<H> {
|
||||
fn clone(&self) -> Self {
|
||||
Proving {
|
||||
base: self.base.clone(),
|
||||
@ -236,12 +237,12 @@ impl<H: AsHashDB<KeccakHasher> + Clone> Clone for Proving<H> {
|
||||
/// it. Doesn't cache anything.
|
||||
pub struct Basic<H>(pub H);
|
||||
|
||||
impl<H: AsHashDB<KeccakHasher> + Send + Sync> Backend for Basic<H> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> {
|
||||
impl<H: AsHashDB<KeccakHasher, DBValue> + Send + Sync> Backend for Basic<H> {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> {
|
||||
self.0.as_hashdb()
|
||||
}
|
||||
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> {
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> {
|
||||
self.0.as_hashdb_mut()
|
||||
}
|
||||
|
||||
|
@ -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<H: AsHashDB<KeccakHasher> + Send + Sync>(
|
||||
pub fn prove_transaction_virtual<H: AsHashDB<KeccakHasher, DBValue> + Send + Sync>(
|
||||
db: H,
|
||||
root: H256,
|
||||
transaction: &SignedTransaction,
|
||||
@ -618,7 +618,7 @@ impl<B: Backend> State<B> {
|
||||
&self, address: &Address, key: &H256, f_cached_at: FCachedStorageAt, f_at: FStorageAt,
|
||||
) -> TrieResult<H256> where
|
||||
FCachedStorageAt: Fn(&Account, &H256) -> Option<H256>,
|
||||
FStorageAt: Fn(&Account, &HashDB<KeccakHasher>, &H256) -> TrieResult<H256>
|
||||
FStorageAt: Fn(&Account, &HashDB<KeccakHasher, DBValue>, &H256) -> TrieResult<H256>
|
||||
{
|
||||
// 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<B: Backend> State<B> {
|
||||
|
||||
/// 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<KeccakHasher>) -> bool {
|
||||
fn update_account_cache(require: RequireCache, account: &mut Account, state_db: &B, db: &HashDB<KeccakHasher, DBValue>) -> bool {
|
||||
if let RequireCache::None = require {
|
||||
return true;
|
||||
}
|
||||
|
@ -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<KeccakHasher> {
|
||||
pub fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> {
|
||||
self.db.as_hashdb()
|
||||
}
|
||||
|
||||
/// Conversion method to interpret self as mutable `HashDB` reference
|
||||
pub fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> {
|
||||
pub fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> {
|
||||
self.db.as_hashdb_mut()
|
||||
}
|
||||
|
||||
@ -412,9 +412,9 @@ impl StateDB {
|
||||
}
|
||||
|
||||
impl state::Backend for StateDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self.db.as_hashdb() }
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self.db.as_hashdb() }
|
||||
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> {
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> {
|
||||
self.db.as_hashdb_mut()
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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"
|
||||
|
@ -544,7 +544,7 @@ struct TxRelay(Arc<BlockChainClient>);
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
};
|
||||
|
@ -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]
|
||||
|
@ -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);
|
||||
|
@ -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))));
|
||||
|
@ -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"
|
||||
|
||||
|
@ -5,7 +5,7 @@ version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[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"
|
||||
|
@ -7,10 +7,10 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
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"
|
||||
|
@ -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"
|
||||
|
@ -80,7 +80,7 @@ impl IpfsHandler {
|
||||
fn block_list(&self, hash: H256) -> Result<Out> {
|
||||
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.
|
||||
|
@ -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"
|
||||
|
@ -125,7 +125,7 @@ impl TransactionEntry {
|
||||
impl From<PendingTransaction> 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),
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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" }
|
||||
|
||||
|
@ -32,7 +32,7 @@ pub fn submit_work_detail<C: BlockChainClient, M: MinerService>(client: &Arc<C>,
|
||||
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 {
|
||||
|
@ -175,7 +175,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
|
||||
.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)
|
||||
})
|
||||
|
@ -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",
|
||||
|
@ -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(),
|
||||
|
@ -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" }
|
||||
|
@ -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<KeccakHasher>,
|
||||
overlay: MemoryDB<KeccakHasher, DBValue>,
|
||||
backing: Arc<KeyValueDB>,
|
||||
latest_era: Option<u64>,
|
||||
column: Option<u32>,
|
||||
@ -64,7 +64,7 @@ impl ArchiveDB {
|
||||
}
|
||||
}
|
||||
|
||||
impl HashDB<KeccakHasher> for ArchiveDB {
|
||||
impl HashDB<KeccakHasher, DBValue> for ArchiveDB {
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
let mut ret: HashMap<H256, i32> = 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<KeccakHasher>) {
|
||||
fn consolidate(&mut self, with: MemoryDB<KeccakHasher, DBValue>) {
|
||||
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};
|
||||
|
||||
|
@ -22,28 +22,29 @@ use earlymergedb::EarlyMergeDB;
|
||||
use overlayrecentdb::OverlayRecentDB;
|
||||
use refcounteddb::RefCountedDB;
|
||||
use overlaydb::OverlayDB;
|
||||
use kvdb::DBValue;
|
||||
|
||||
impl AsHashDB<KeccakHasher> for ArchiveDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl AsHashDB<KeccakHasher, DBValue> for ArchiveDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl AsHashDB<KeccakHasher> for EarlyMergeDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl AsHashDB<KeccakHasher, DBValue> for EarlyMergeDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl AsHashDB<KeccakHasher> for OverlayRecentDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl AsHashDB<KeccakHasher, DBValue> for OverlayRecentDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl AsHashDB<KeccakHasher> for RefCountedDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl AsHashDB<KeccakHasher, DBValue> for RefCountedDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
||||
|
||||
impl AsHashDB<KeccakHasher> for OverlayDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
|
||||
impl AsHashDB<KeccakHasher, DBValue> for OverlayDB {
|
||||
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
|
||||
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
|
||||
}
|
@ -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<KeccakHasher>,
|
||||
overlay: MemoryDB<KeccakHasher, DBValue>,
|
||||
backing: Arc<KeyValueDB>,
|
||||
refs: Option<Arc<RwLock<HashMap<H256, RefInfo>>>>,
|
||||
latest_era: Option<u64>,
|
||||
@ -287,7 +287,7 @@ impl EarlyMergeDB {
|
||||
}
|
||||
}
|
||||
|
||||
impl HashDB<KeccakHasher> for EarlyMergeDB {
|
||||
impl HashDB<KeccakHasher, DBValue> for EarlyMergeDB {
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
let mut ret: HashMap<H256, i32> = 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<KeccakHasher>) {
|
||||
fn consolidate(&mut self, with: MemoryDB<KeccakHasher, DBValue>) {
|
||||
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;
|
||||
|
@ -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<KeccakHasher>,
|
||||
overlay: MemoryDB<KeccakHasher, DBValue>,
|
||||
backing: Arc<KeyValueDB>,
|
||||
column: Option<u32>,
|
||||
}
|
||||
@ -140,7 +140,7 @@ impl OverlayDB {
|
||||
fn payload(&self, key: &H256) -> Option<Payload> {
|
||||
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<KeccakHasher> for OverlayDB {
|
||||
impl HashDB<KeccakHasher, DBValue> for OverlayDB {
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
let mut ret: HashMap<H256, i32> = self.backing.iter(self.column)
|
||||
.map(|(key, _)| {
|
||||
|
@ -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<KeccakHasher>,
|
||||
transaction_overlay: MemoryDB<KeccakHasher, DBValue>,
|
||||
backing: Arc<KeyValueDB>,
|
||||
journal_overlay: Arc<RwLock<JournalOverlay>>,
|
||||
column: Option<u32>,
|
||||
@ -120,7 +120,7 @@ impl<'a> Encodable for DatabaseValueRef<'a> {
|
||||
|
||||
#[derive(PartialEq)]
|
||||
struct JournalOverlay {
|
||||
backing_overlay: MemoryDB<KeccakHasher>, // Nodes added in the history period
|
||||
backing_overlay: MemoryDB<KeccakHasher, DBValue>, // Nodes added in the history period
|
||||
pending_overlay: H256FastMap<DBValue>, // Nodes being transfered from backing_overlay to backing db
|
||||
journal: HashMap<u64, Vec<JournalEntry>>,
|
||||
latest_era: Option<u64>,
|
||||
@ -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<KeccakHasher>) {
|
||||
fn consolidate(&mut self, with: MemoryDB<KeccakHasher, DBValue>) {
|
||||
self.transaction_overlay.consolidate(with);
|
||||
}
|
||||
}
|
||||
|
||||
impl HashDB<KeccakHasher> for OverlayRecentDB {
|
||||
impl HashDB<KeccakHasher, DBValue> for OverlayRecentDB {
|
||||
fn keys(&self) -> HashMap<H256, i32> {
|
||||
let mut ret: HashMap<H256, i32> = 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};
|
||||
|
||||
|
@ -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<KeccakHasher> for RefCountedDB {
|
||||
impl HashDB<KeccakHasher, DBValue> for RefCountedDB {
|
||||
fn keys(&self) -> HashMap<H256, i32> { self.forward.keys() }
|
||||
fn get(&self, key: &H256) -> Option<DBValue> { 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<KeccakHasher>) {
|
||||
fn consolidate(&mut self, mut with: MemoryDB<KeccakHasher, DBValue>) {
|
||||
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};
|
||||
|
||||
|
@ -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<KeccakHasher> {
|
||||
pub trait JournalDB: HashDB<KeccakHasher, DBValue> {
|
||||
/// Return a copy of ourself, in a box.
|
||||
fn boxed_clone(&self) -> Box<JournalDB>;
|
||||
|
||||
@ -78,7 +78,7 @@ pub trait JournalDB: HashDB<KeccakHasher> {
|
||||
fn flush(&self) {}
|
||||
|
||||
/// Consolidate all the insertions and deletions in the given memory overlay.
|
||||
fn consolidate(&mut self, overlay: ::memorydb::MemoryDB<KeccakHasher>);
|
||||
fn consolidate(&mut self, overlay: ::memorydb::MemoryDB<KeccakHasher, DBValue>);
|
||||
|
||||
/// Commit all changes in a single batch
|
||||
#[cfg(test)]
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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]
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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<io::Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<rlp::DecoderError> for Error {
|
||||
fn from(_err: rlp::DecoderError) -> Self {
|
||||
ErrorKind::Auth.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ethkey::Error> for Error {
|
||||
fn from(_err: ethkey::Error) -> Self {
|
||||
ErrorKind::Auth.into()
|
||||
@ -210,7 +205,7 @@ fn test_errors() {
|
||||
assert_eq!(DisconnectReason::Unknown, r);
|
||||
|
||||
match *<Error as From<rlp::DecoderError>>::from(rlp::DecoderError::RlpIsTooBig).kind() {
|
||||
ErrorKind::Auth => {},
|
||||
ErrorKind::Rlp(_) => {},
|
||||
_ => panic!("Unexpected error"),
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -48,6 +48,7 @@ pub type RlpCodec = RlpNodeCodec<KeccakHasher>;
|
||||
/// 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<KeccakHasher>;
|
||||
/// use memorydb::*;
|
||||
/// use ethereum_types::H256;
|
||||
/// use ethtrie::{TrieDB, TrieDBMut};
|
||||
/// use elastic_array::ElasticArray128;
|
||||
///
|
||||
/// type DBValue = ElasticArray128<u8>;
|
||||
///
|
||||
/// fn main() {
|
||||
/// let mut memdb = MemoryDB::<KeccakHasher>::new();
|
||||
/// let mut memdb = MemoryDB::<KeccakHasher, DBValue>::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<u8>;
|
||||
///
|
||||
/// fn main() {
|
||||
/// let mut memdb = MemoryDB::<KeccakHasher>::new();
|
||||
/// let mut memdb = MemoryDB::<KeccakHasher, DBValue>::new();
|
||||
/// let mut root = H256::new();
|
||||
/// let mut t = TrieDBMut::new(&mut memdb, &mut root);
|
||||
/// assert!(t.is_empty());
|
||||
|
@ -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<KeccakHasher> for RlpNodeCodec<KeccakHasher> {
|
||||
fn is_empty_node(data: &[u8]) -> bool {
|
||||
Rlp::new(data).is_empty()
|
||||
}
|
||||
fn empty_node() -> ElasticArray1024<u8> {
|
||||
fn empty_node() -> Vec<u8> {
|
||||
let mut stream = RlpStream::new();
|
||||
stream.append_empty_data();
|
||||
stream.drain()
|
||||
}
|
||||
|
||||
fn leaf_node(partial: &[u8], value: &[u8]) -> ElasticArray1024<u8> {
|
||||
fn leaf_node(partial: &[u8], value: &[u8]) -> Vec<u8> {
|
||||
let mut stream = RlpStream::new_list(2);
|
||||
stream.append(&partial);
|
||||
stream.append(&value);
|
||||
stream.drain()
|
||||
}
|
||||
|
||||
fn ext_node(partial: &[u8], child_ref: ChildReference<<KeccakHasher as Hasher>::Out>) -> ElasticArray1024<u8> {
|
||||
fn ext_node(partial: &[u8], child_ref: ChildReference<<KeccakHasher as Hasher>::Out>) -> Vec<u8> {
|
||||
let mut stream = RlpStream::new_list(2);
|
||||
stream.append(&partial);
|
||||
match child_ref {
|
||||
@ -98,7 +98,8 @@ impl NodeCodec<KeccakHasher> for RlpNodeCodec<KeccakHasher> {
|
||||
stream.drain()
|
||||
}
|
||||
|
||||
fn branch_node<I>(children: I, value: Option<ElasticArray128<u8>>) -> ElasticArray1024<u8>
|
||||
// fn branch_node<I>(children: I, value: Option<Vec<u8>>) -> Vec<u8>
|
||||
fn branch_node<I>(children: I, value: Option<ElasticArray128<u8>>) -> Vec<u8>
|
||||
where I: IntoIterator<Item=Option<ChildReference<<KeccakHasher as Hasher>::Out>>>
|
||||
{
|
||||
let mut stream = RlpStream::new_list(17);
|
||||
|
@ -4,6 +4,6 @@ version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
rlp = "0.2.4"
|
||||
rlp = { version = "0.3.0", features = ["ethereum"] }
|
||||
elastic-array = "0.10"
|
||||
lazy_static = "1.0"
|
||||
|
@ -64,7 +64,7 @@ fn map_rlp<F: Fn(&Rlp) -> ElasticArray1024<u8>>(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
|
||||
|
@ -13,4 +13,4 @@ quote = "0.6"
|
||||
proc-macro2 = "0.4"
|
||||
|
||||
[dev-dependencies]
|
||||
rlp = "0.2.4"
|
||||
rlp = { version = "0.3.0", features = ["ethereum"] }
|
||||
|
@ -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");
|
||||
|
@ -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" }
|
||||
|
@ -49,7 +49,7 @@ where
|
||||
I: IntoIterator<Item = V>,
|
||||
V: AsRef<[u8]>,
|
||||
{
|
||||
triehash::ordered_trie_root::<KeccakHasher, I, V>(input)
|
||||
triehash::ordered_trie_root::<KeccakHasher, I>(input)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@ -81,7 +81,7 @@ mod tests {
|
||||
let data = &["cake", "pie", "candy"];
|
||||
assert_eq!(
|
||||
ordered_trie_root(data),
|
||||
triehash::ordered_trie_root::<KeccakHasher, _, _>(data)
|
||||
triehash::ordered_trie_root::<KeccakHasher, _>(data)
|
||||
);
|
||||
}
|
||||
}
|
@ -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]
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user