Merge branch 'master' into pip-msg
This commit is contained in:
commit
fe52e969b6
@ -516,6 +516,7 @@ test-coverage:
|
|||||||
# - echo "Coverage:" $COVERAGE
|
# - echo "Coverage:" $COVERAGE
|
||||||
tags:
|
tags:
|
||||||
- kcov
|
- kcov
|
||||||
|
allow_failure: true
|
||||||
test-darwin:
|
test-darwin:
|
||||||
stage: test
|
stage: test
|
||||||
only:
|
only:
|
||||||
|
138
Cargo.lock
generated
138
Cargo.lock
generated
@ -205,7 +205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"integer-encoding 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"integer-encoding 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"multibase 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"multibase 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"multihash 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"multihash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -254,7 +254,7 @@ version = "0.2.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -262,7 +262,7 @@ name = "core-foundation-sys"
|
|||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -285,7 +285,7 @@ version = "1.1.1"
|
|||||||
source = "git+https://github.com/ethcore/rust-ctrlc.git#f4927770f89eca80ec250911eea3adcbf579ac48"
|
source = "git+https://github.com/ethcore/rust-ctrlc.git#f4927770f89eca80ec250911eea3adcbf579ac48"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ name = "daemonize"
|
|||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -349,7 +349,7 @@ source = "git+https://github.com/ethcore/rust-secp256k1#98ad9b9ecae44a563efdd642
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -414,7 +414,7 @@ dependencies = [
|
|||||||
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"stats 0.1.0",
|
"stats 0.1.0",
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"transient-hashmap 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"transient-hashmap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -423,7 +423,7 @@ version = "0.1.2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bigint 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bigint 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -493,7 +493,7 @@ version = "1.7.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ethcore-devtools 1.7.0",
|
"ethcore-devtools 1.7.0",
|
||||||
"ethcore-util 1.7.0",
|
"ethcore-util 1.7.0",
|
||||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)",
|
||||||
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ dependencies = [
|
|||||||
"ethcore-ipc-codegen 1.7.0",
|
"ethcore-ipc-codegen 1.7.0",
|
||||||
"ethcore-ipc-nano 1.7.0",
|
"ethcore-ipc-nano 1.7.0",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)",
|
||||||
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -528,7 +528,7 @@ dependencies = [
|
|||||||
"ethcore-ipc 1.7.0",
|
"ethcore-ipc 1.7.0",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -541,7 +541,7 @@ dependencies = [
|
|||||||
"ethcore-ipc-nano 1.7.0",
|
"ethcore-ipc-nano 1.7.0",
|
||||||
"ethcore-util 1.7.0",
|
"ethcore-util 1.7.0",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)",
|
||||||
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -590,7 +590,7 @@ dependencies = [
|
|||||||
"ethcrypto 0.1.0",
|
"ethcrypto 0.1.0",
|
||||||
"ethkey 0.2.0",
|
"ethkey 0.2.0",
|
||||||
"igd 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"igd 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mio 0.6.1 (git+https://github.com/ethcore/mio)",
|
"mio 0.6.1 (git+https://github.com/ethcore/mio)",
|
||||||
"parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -638,7 +638,7 @@ dependencies = [
|
|||||||
"serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"stats 0.1.0",
|
"stats 0.1.0",
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"transient-hashmap 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"transient-hashmap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -714,7 +714,7 @@ dependencies = [
|
|||||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lru-cache 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lru-cache 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -782,7 +782,7 @@ dependencies = [
|
|||||||
"ethkey 0.2.0",
|
"ethkey 0.2.0",
|
||||||
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -843,7 +843,7 @@ name = "fdlimit"
|
|||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -863,7 +863,7 @@ name = "flate2"
|
|||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -935,7 +935,7 @@ version = "0.3.1"
|
|||||||
source = "git+https://github.com/ethcore/hidapi-rs#9a127c1dca7e327e4fdd428406a76c9f5ef48563"
|
source = "git+https://github.com/ethcore/hidapi-rs#9a127c1dca7e327e4fdd428406a76c9f5ef48563"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1062,7 +1062,7 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1171,7 +1171,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.16"
|
version = "0.2.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1180,7 +1180,7 @@ version = "0.3.0"
|
|||||||
source = "git+https://github.com/ethcore/libusb-rs#32bacf61abd981d5cbd4a8fecca5a2dc0b762a96"
|
source = "git+https://github.com/ethcore/libusb-rs#32bacf61abd981d5cbd4a8fecca5a2dc0b762a96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-set 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bit-set 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libusb-sys 0.2.3 (git+https://github.com/ethcore/libusb-sys)",
|
"libusb-sys 0.2.3 (git+https://github.com/ethcore/libusb-sys)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1190,7 +1190,7 @@ version = "0.2.3"
|
|||||||
source = "git+https://github.com/ethcore/libusb-sys#c10b1180646c9dc3f23a9b6bb825abcd3b7487ce"
|
source = "git+https://github.com/ethcore/libusb-sys#c10b1180646c9dc3f23a9b6bb825abcd3b7487ce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1226,7 +1226,7 @@ name = "memchr"
|
|||||||
version = "0.1.11"
|
version = "0.1.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1254,7 +1254,7 @@ version = "0.1.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1263,7 +1263,7 @@ version = "0.5.1"
|
|||||||
source = "git+https://github.com/ethcore/mio?branch=v0.5.x#3842d3b250ffd7bd9b16f9586b875ddcbac2b0dd"
|
source = "git+https://github.com/ethcore/mio?branch=v0.5.x#3842d3b250ffd7bd9b16f9586b875ddcbac2b0dd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1279,7 +1279,7 @@ version = "0.5.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1295,7 +1295,7 @@ version = "0.6.0-dev"
|
|||||||
source = "git+https://github.com/ethcore/mio?branch=timer-fix#31eccc40ece3d47abaefaf23bb2114033175b972"
|
source = "git+https://github.com/ethcore/mio?branch=timer-fix#31eccc40ece3d47abaefaf23bb2114033175b972"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1311,7 +1311,7 @@ source = "git+https://github.com/ethcore/mio#ef182bae193a9c7457cd2cf661fcaffb226
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1327,7 +1327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
"net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1367,29 +1367,29 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "multihash"
|
name = "multihash"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ring 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ring 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nanomsg"
|
name = "nanomsg"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
source = "git+https://github.com/ethcore/nanomsg.rs.git#c40fe442c9afaea5b38009a3d992ca044dcceb00"
|
source = "git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7#673b79beef6e149273899850d7692335a481a920"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nanomsg-sys 0.5.0 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg-sys 0.5.0 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nanomsg-sys"
|
name = "nanomsg-sys"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "git+https://github.com/ethcore/nanomsg.rs.git#c40fe442c9afaea5b38009a3d992ca044dcceb00"
|
source = "git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7#673b79beef6e149273899850d7692335a481a920"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1411,7 +1411,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1422,7 +1422,7 @@ version = "0.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1432,7 +1432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1445,7 +1445,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1535,7 +1535,7 @@ name = "num_cpus"
|
|||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1567,7 +1567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"openssl-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"openssl-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1577,7 +1577,7 @@ version = "0.9.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1632,7 +1632,7 @@ dependencies = [
|
|||||||
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
|
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
|
||||||
"jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)",
|
"jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)",
|
||||||
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"multihash 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"multihash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.1.0",
|
"rlp 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1696,7 +1696,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-ui-precompiled"
|
name = "parity-ui-precompiled"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
source = "git+https://github.com/ethcore/js-precompiled.git#547a5352d779bc7821a7a2ec14c6d480833aeabb"
|
source = "git+https://github.com/ethcore/js-precompiled.git#7039b5b8e44196718333dc3fcdfcadae2a97c7fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1733,7 +1733,7 @@ version = "0.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1862,7 +1862,7 @@ name = "rand"
|
|||||||
version = "0.3.14"
|
version = "0.3.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1871,7 +1871,7 @@ version = "0.6.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1909,10 +1909,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ring"
|
name = "ring"
|
||||||
version = "0.6.2"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1920,6 +1921,7 @@ dependencies = [
|
|||||||
name = "rlp"
|
name = "rlp"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)",
|
"elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)",
|
||||||
"ethcore-bigint 0.1.2",
|
"ethcore-bigint 0.1.2",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1931,7 +1933,7 @@ name = "rocksdb"
|
|||||||
version = "0.4.5"
|
version = "0.4.5"
|
||||||
source = "git+https://github.com/ethcore/rust-rocksdb#64c63ccbe1f62c2e2b39262486f9ba813793af58"
|
source = "git+https://github.com/ethcore/rust-rocksdb#64c63ccbe1f62c2e2b39262486f9ba813793af58"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rocksdb-sys 0.3.0 (git+https://github.com/ethcore/rust-rocksdb)",
|
"rocksdb-sys 0.3.0 (git+https://github.com/ethcore/rust-rocksdb)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1941,7 +1943,7 @@ version = "0.3.0"
|
|||||||
source = "git+https://github.com/ethcore/rust-rocksdb#64c63ccbe1f62c2e2b39262486f9ba813793af58"
|
source = "git+https://github.com/ethcore/rust-rocksdb#64c63ccbe1f62c2e2b39262486f9ba813793af58"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1962,7 +1964,7 @@ version = "0.2.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1973,7 +1975,7 @@ version = "0.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1996,7 +1998,7 @@ version = "0.2.36"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2058,7 +2060,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"core-foundation-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"security-framework-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"security-framework-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2068,7 +2070,7 @@ version = "0.1.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2274,7 +2276,7 @@ version = "0.33.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2317,7 +2319,7 @@ name = "termios"
|
|||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2326,7 +2328,7 @@ version = "2.0.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2343,7 +2345,7 @@ version = "0.1.35"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2411,7 +2413,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "transient-hashmap"
|
name = "transient-hashmap"
|
||||||
version = "0.1.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2647,7 +2649,7 @@ dependencies = [
|
|||||||
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
|
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
|
||||||
"checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f"
|
"checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f"
|
||||||
"checksum lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce12306c4739d86ee97c23139f3a34ddf0387bbf181bc7929d287025a8c3ef6b"
|
"checksum lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce12306c4739d86ee97c23139f3a34ddf0387bbf181bc7929d287025a8c3ef6b"
|
||||||
"checksum libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "408014cace30ee0f767b1c4517980646a573ec61a57957aeeabcac8ac0a02e8d"
|
"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135"
|
||||||
"checksum libusb 0.3.0 (git+https://github.com/ethcore/libusb-rs)" = "<none>"
|
"checksum libusb 0.3.0 (git+https://github.com/ethcore/libusb-rs)" = "<none>"
|
||||||
"checksum libusb-sys 0.2.3 (git+https://github.com/ethcore/libusb-sys)" = "<none>"
|
"checksum libusb-sys 0.2.3 (git+https://github.com/ethcore/libusb-sys)" = "<none>"
|
||||||
"checksum linked-hash-map 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bda158e0dabeb97ee8a401f4d17e479d6b891a14de0bba79d5cc2d4d325b5e48"
|
"checksum linked-hash-map 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bda158e0dabeb97ee8a401f4d17e479d6b891a14de0bba79d5cc2d4d325b5e48"
|
||||||
@ -2667,9 +2669,9 @@ dependencies = [
|
|||||||
"checksum miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5bfc6782530ac8ace97af10a540054a37126b63b0702ddaaa243b73b5745b9a"
|
"checksum miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5bfc6782530ac8ace97af10a540054a37126b63b0702ddaaa243b73b5745b9a"
|
||||||
"checksum msdos_time 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c04b68cc63a8480fb2550343695f7be72effdec953a9d4508161c3e69041c7d8"
|
"checksum msdos_time 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c04b68cc63a8480fb2550343695f7be72effdec953a9d4508161c3e69041c7d8"
|
||||||
"checksum multibase 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b9c35dac080fd6e16a99924c8dfdef0af89d797dd851adab25feaffacf7850d6"
|
"checksum multibase 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b9c35dac080fd6e16a99924c8dfdef0af89d797dd851adab25feaffacf7850d6"
|
||||||
"checksum multihash 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "755d5a39bee3faaf649437e873beab334990221b2faf1f2e56ca10a9e4600235"
|
"checksum multihash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c9f70f2402fa07c16c40be8fd0a748a39257c5dc3ff5c857cbbde2f39135c505"
|
||||||
"checksum nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)" = "<none>"
|
"checksum nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)" = "<none>"
|
||||||
"checksum nanomsg-sys 0.5.0 (git+https://github.com/ethcore/nanomsg.rs.git)" = "<none>"
|
"checksum nanomsg-sys 0.5.0 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)" = "<none>"
|
||||||
"checksum native-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4e52995154bb6f0b41e4379a279482c9387c1632e3798ba4e511ef8c54ee09"
|
"checksum native-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4e52995154bb6f0b41e4379a279482c9387c1632e3798ba4e511ef8c54ee09"
|
||||||
"checksum net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)" = "6a816012ca11cb47009693c1e0c6130e26d39e4d97ee2a13c50e868ec83e3204"
|
"checksum net2 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)" = "6a816012ca11cb47009693c1e0c6130e26d39e4d97ee2a13c50e868ec83e3204"
|
||||||
"checksum nix 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f05c2fc965fc1cd6b73fa57fa7b89f288178737f2f3ce9e63e4a6a141189000e"
|
"checksum nix 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f05c2fc965fc1cd6b73fa57fa7b89f288178737f2f3ce9e63e4a6a141189000e"
|
||||||
@ -2717,7 +2719,7 @@ dependencies = [
|
|||||||
"checksum regex 0.1.68 (registry+https://github.com/rust-lang/crates.io-index)" = "b4329b8928a284580a1c63ec9d846b12f6d3472317243ff7077aff11f23f2b29"
|
"checksum regex 0.1.68 (registry+https://github.com/rust-lang/crates.io-index)" = "b4329b8928a284580a1c63ec9d846b12f6d3472317243ff7077aff11f23f2b29"
|
||||||
"checksum regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "841591b1e05609a643e3b4d0045fce04f701daba7151ddcd3ad47b080693d5a9"
|
"checksum regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "841591b1e05609a643e3b4d0045fce04f701daba7151ddcd3ad47b080693d5a9"
|
||||||
"checksum reqwest 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bef9ed8fdfcc30947d6b774938dc0c3f369a474efe440df2c7f278180b2d2e6"
|
"checksum reqwest 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bef9ed8fdfcc30947d6b774938dc0c3f369a474efe440df2c7f278180b2d2e6"
|
||||||
"checksum ring 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "87ac4fce2ee4bb10dd106788e90fdfa4c5a7f3f9f6aae29824db77dc57e2767d"
|
"checksum ring 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "595afba2db7545b940ec900dc59b5281f719d327fc0674eeadc9953617e55357"
|
||||||
"checksum rocksdb 0.4.5 (git+https://github.com/ethcore/rust-rocksdb)" = "<none>"
|
"checksum rocksdb 0.4.5 (git+https://github.com/ethcore/rust-rocksdb)" = "<none>"
|
||||||
"checksum rocksdb-sys 0.3.0 (git+https://github.com/ethcore/rust-rocksdb)" = "<none>"
|
"checksum rocksdb-sys 0.3.0 (git+https://github.com/ethcore/rust-rocksdb)" = "<none>"
|
||||||
"checksum rotor 0.6.3 (git+https://github.com/ethcore/rotor)" = "<none>"
|
"checksum rotor 0.6.3 (git+https://github.com/ethcore/rotor)" = "<none>"
|
||||||
@ -2775,7 +2777,7 @@ dependencies = [
|
|||||||
"checksum toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "fcd27a04ca509aff336ba5eb2abc58d456f52c4ff64d9724d88acb85ead560b6"
|
"checksum toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "fcd27a04ca509aff336ba5eb2abc58d456f52c4ff64d9724d88acb85ead560b6"
|
||||||
"checksum toml 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a442dfc13508e603c3f763274361db7f79d7469a0e95c411cde53662ab30fc72"
|
"checksum toml 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a442dfc13508e603c3f763274361db7f79d7469a0e95c411cde53662ab30fc72"
|
||||||
"checksum traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07eaeb7689bb7fca7ce15628319635758eda769fed481ecfe6686ddef2600616"
|
"checksum traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07eaeb7689bb7fca7ce15628319635758eda769fed481ecfe6686ddef2600616"
|
||||||
"checksum transient-hashmap 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15f7cc7116182edca1ed08f6f8c4da92104555ca77addbabea4eaa59b20373d0"
|
"checksum transient-hashmap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "715254c8f0811be1a79ad3ea5e6fa3c8eddec2b03d7f5ba78cf093e56d79c24f"
|
||||||
"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
|
"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
|
||||||
"checksum unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a5906ca2b98c799f4b1ab4557b76367ebd6ae5ef14930ec841c74aed5f3764"
|
"checksum unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a5906ca2b98c799f4b1ab4557b76367ebd6ae5ef14930ec841c74aed5f3764"
|
||||||
"checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f"
|
"checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f"
|
||||||
|
@ -45,7 +45,7 @@ of RPC APIs.
|
|||||||
If you run into an issue while using parity, feel free to file one in this repository
|
If you run into an issue while using parity, feel free to file one in this repository
|
||||||
or hop on our [gitter chat room][gitter-url] to ask a question. We are glad to help!
|
or hop on our [gitter chat room][gitter-url] to ask a question. We are glad to help!
|
||||||
|
|
||||||
Parity's current release is 1.5. You can download it at https://ethcore.io/parity.html or follow the instructions
|
Parity's current release is 1.5. You can download it at https://parity.io or follow the instructions
|
||||||
below to build from source.
|
below to build from source.
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -24,7 +24,7 @@ bit-set = "0.4"
|
|||||||
time = "0.1"
|
time = "0.1"
|
||||||
rand = "0.3"
|
rand = "0.3"
|
||||||
byteorder = "1.0"
|
byteorder = "1.0"
|
||||||
transient-hashmap = "0.1"
|
transient-hashmap = "0.4"
|
||||||
linked-hash-map = "0.3.0"
|
linked-hash-map = "0.3.0"
|
||||||
lru-cache = "0.1.0"
|
lru-cache = "0.1.0"
|
||||||
ethabi = "1.0.0"
|
ethabi = "1.0.0"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
use ethcore::ids::BlockId;
|
use ethcore::ids::BlockId;
|
||||||
use util::{Bytes, H256, U256, HashDB, MemoryDB};
|
use util::{Bytes, H256, U256, HashDB, MemoryDB};
|
||||||
use util::trie::{self, TrieMut, TrieDBMut, Trie, TrieDB, Recorder};
|
use util::trie::{self, TrieMut, TrieDBMut, Trie, TrieDB, Recorder};
|
||||||
use rlp::{Stream, RlpStream, UntrustedRlp, View};
|
use rlp::{RlpStream, UntrustedRlp, View};
|
||||||
|
|
||||||
// encode a key.
|
// encode a key.
|
||||||
macro_rules! key {
|
macro_rules! key {
|
||||||
|
@ -22,7 +22,7 @@ use ethcore::transaction::UnverifiedTransaction;
|
|||||||
|
|
||||||
use io::TimerToken;
|
use io::TimerToken;
|
||||||
use network::{NetworkProtocolHandler, NetworkContext, PeerId};
|
use network::{NetworkProtocolHandler, NetworkContext, PeerId};
|
||||||
use rlp::{RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{RlpStream, UntrustedRlp, View};
|
||||||
use util::hash::H256;
|
use util::hash::H256;
|
||||||
use util::{DBValue, Mutex, RwLock, U256};
|
use util::{DBValue, Mutex, RwLock, U256};
|
||||||
use time::{Duration, SteadyTime};
|
use time::{Duration, SteadyTime};
|
||||||
@ -313,7 +313,7 @@ impl LightProtocol {
|
|||||||
let req_id = ReqId(self.req_id.fetch_add(1, Ordering::SeqCst));
|
let req_id = ReqId(self.req_id.fetch_add(1, Ordering::SeqCst));
|
||||||
io.send(*peer_id, packet::REQUEST, {
|
io.send(*peer_id, packet::REQUEST, {
|
||||||
let mut stream = RlpStream::new_list(2);
|
let mut stream = RlpStream::new_list(2);
|
||||||
stream.append(&req_id.0).append(&requests.requests());
|
stream.append(&req_id.0).append_list(&requests.requests());
|
||||||
stream.out()
|
stream.out()
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -713,7 +713,7 @@ impl LightProtocol {
|
|||||||
io.respond(packet::RESPONSE, {
|
io.respond(packet::RESPONSE, {
|
||||||
let mut stream = RlpStream::new_list(3);
|
let mut stream = RlpStream::new_list(3);
|
||||||
let cur_credits = peer.local_credits.current();
|
let cur_credits = peer.local_credits.current();
|
||||||
stream.append(&req_id).append(&cur_credits).append(&responses);
|
stream.append(&req_id).append(&cur_credits).append_list(&responses);
|
||||||
stream.out()
|
stream.out()
|
||||||
});
|
});
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! Peer status and capabilities.
|
//! Peer status and capabilities.
|
||||||
|
|
||||||
use rlp::{DecoderError, RlpDecodable, RlpEncodable, RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{DecoderError, RlpDecodable, Encodable, RlpStream, UntrustedRlp, View};
|
||||||
use util::{H256, U256};
|
use util::{H256, U256};
|
||||||
|
|
||||||
use super::request_credits::FlowParams;
|
use super::request_credits::FlowParams;
|
||||||
@ -126,7 +126,7 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Helper for encoding a key-value pair
|
// Helper for encoding a key-value pair
|
||||||
fn encode_pair<T: RlpEncodable>(key: Key, val: &T) -> Vec<u8> {
|
fn encode_pair<T: Encodable>(key: Key, val: &T) -> Vec<u8> {
|
||||||
let mut s = RlpStream::new_list(2);
|
let mut s = RlpStream::new_list(2);
|
||||||
s.append(&key.as_str()).append(val);
|
s.append(&key.as_str()).append(val);
|
||||||
s.out()
|
s.out()
|
||||||
@ -374,7 +374,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use super::super::request_credits::FlowParams;
|
use super::super::request_credits::FlowParams;
|
||||||
use util::{U256, H256};
|
use util::{U256, H256};
|
||||||
use rlp::{RlpStream, Stream ,UntrustedRlp, View};
|
use rlp::{RlpStream, UntrustedRlp, View};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn full_handshake() {
|
fn full_handshake() {
|
||||||
|
@ -48,7 +48,7 @@ fn encode_single(request: Request) -> Requests {
|
|||||||
// helper for making a packet out of `Requests`.
|
// helper for making a packet out of `Requests`.
|
||||||
fn make_packet(req_id: usize, requests: &Requests) -> Vec<u8> {
|
fn make_packet(req_id: usize, requests: &Requests) -> Vec<u8> {
|
||||||
let mut stream = RlpStream::new_list(2);
|
let mut stream = RlpStream::new_list(2);
|
||||||
stream.append(&req_id).append(&requests.requests());
|
stream.append(&req_id).append_list(&requests.requests());
|
||||||
stream.out()
|
stream.out()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ fn get_block_headers() {
|
|||||||
})];
|
})];
|
||||||
|
|
||||||
let mut stream = RlpStream::new_list(3);
|
let mut stream = RlpStream::new_list(3);
|
||||||
stream.append(&req_id).append(&new_creds).append(&response);
|
stream.append(&req_id).append(&new_creds).append_list(&response);
|
||||||
|
|
||||||
stream.out()
|
stream.out()
|
||||||
};
|
};
|
||||||
@ -358,7 +358,7 @@ fn get_block_bodies() {
|
|||||||
let new_creds = *flow_params.limit() - flow_params.compute_cost_multi(requests.requests());
|
let new_creds = *flow_params.limit() - flow_params.compute_cost_multi(requests.requests());
|
||||||
|
|
||||||
let mut response_stream = RlpStream::new_list(3);
|
let mut response_stream = RlpStream::new_list(3);
|
||||||
response_stream.append(&req_id).append(&new_creds).append(&bodies);
|
response_stream.append(&req_id).append(&new_creds).append_list(&bodies);
|
||||||
response_stream.out()
|
response_stream.out()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ fn get_block_receipts() {
|
|||||||
let new_creds = *flow_params.limit() - flow_params.compute_cost_multi(requests.requests());
|
let new_creds = *flow_params.limit() - flow_params.compute_cost_multi(requests.requests());
|
||||||
|
|
||||||
let mut response_stream = RlpStream::new_list(3);
|
let mut response_stream = RlpStream::new_list(3);
|
||||||
response_stream.append(&req_id).append(&new_creds).append(&receipts);
|
response_stream.append(&req_id).append(&new_creds).append_list(&receipts);
|
||||||
response_stream.out()
|
response_stream.out()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ fn get_state_proofs() {
|
|||||||
let new_creds = *flow_params.limit() - flow_params.compute_cost_multi(requests.requests());
|
let new_creds = *flow_params.limit() - flow_params.compute_cost_multi(requests.requests());
|
||||||
|
|
||||||
let mut response_stream = RlpStream::new_list(3);
|
let mut response_stream = RlpStream::new_list(3);
|
||||||
response_stream.append(&req_id).append(&new_creds).append(&responses);
|
response_stream.append(&req_id).append(&new_creds).append_list(&responses);
|
||||||
response_stream.out()
|
response_stream.out()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ fn get_contract_code() {
|
|||||||
|
|
||||||
let mut response_stream = RlpStream::new_list(3);
|
let mut response_stream = RlpStream::new_list(3);
|
||||||
|
|
||||||
response_stream.append(&req_id).append(&new_creds).append(&response);
|
response_stream.append(&req_id).append(&new_creds).append_list(&response);
|
||||||
response_stream.out()
|
response_stream.out()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ use ethcore::executed::{Executed, ExecutionError};
|
|||||||
use futures::{Async, Poll, Future};
|
use futures::{Async, Poll, Future};
|
||||||
use futures::sync::oneshot::{self, Sender, Receiver};
|
use futures::sync::oneshot::{self, Sender, Receiver};
|
||||||
use network::PeerId;
|
use network::PeerId;
|
||||||
use rlp::{RlpStream, Stream};
|
use rlp::RlpStream;
|
||||||
use util::{Bytes, RwLock, Mutex, U256, H256};
|
use util::{Bytes, RwLock, Mutex, U256, H256};
|
||||||
use util::sha3::{SHA3_NULL_RLP, SHA3_EMPTY_LIST_RLP};
|
use util::sha3::{SHA3_NULL_RLP, SHA3_EMPTY_LIST_RLP};
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ use ethcore::receipt::Receipt;
|
|||||||
use ethcore::state::{self, ProvedExecution};
|
use ethcore::state::{self, ProvedExecution};
|
||||||
use ethcore::transaction::SignedTransaction;
|
use ethcore::transaction::SignedTransaction;
|
||||||
|
|
||||||
use rlp::{RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{RlpStream, UntrustedRlp, View};
|
||||||
use util::{Address, Bytes, DBValue, HashDB, H256, U256};
|
use util::{Address, Bytes, DBValue, HashDB, H256, U256};
|
||||||
use util::memorydb::MemoryDB;
|
use util::memorydb::MemoryDB;
|
||||||
use util::sha3::Hashable;
|
use util::sha3::Hashable;
|
||||||
@ -310,7 +310,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn check_body() {
|
fn check_body() {
|
||||||
use rlp::{RlpStream, Stream};
|
use rlp::RlpStream;
|
||||||
|
|
||||||
let header = Header::new();
|
let header = Header::new();
|
||||||
let mut body_stream = RlpStream::new_list(2);
|
let mut body_stream = RlpStream::new_list(2);
|
||||||
@ -348,7 +348,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn check_state_proof() {
|
fn check_state_proof() {
|
||||||
use rlp::{RlpStream, Stream};
|
use rlp::RlpStream;
|
||||||
|
|
||||||
let mut root = H256::default();
|
let mut root = H256::default();
|
||||||
let mut db = MemoryDB::new();
|
let mut db = MemoryDB::new();
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! Light protocol request types.
|
//! Light protocol request types.
|
||||||
|
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
use util::H256;
|
use util::H256;
|
||||||
|
|
||||||
mod builder;
|
mod builder;
|
||||||
@ -525,7 +525,7 @@ pub trait IncompleteRequest: Sized {
|
|||||||
pub mod header {
|
pub mod header {
|
||||||
use super::{Field, HashOrNumber, NoSuchOutput, OutputKind, Output};
|
use super::{Field, HashOrNumber, NoSuchOutput, OutputKind, Output};
|
||||||
use ethcore::encoded;
|
use ethcore::encoded;
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
|
|
||||||
/// Potentially incomplete headers request.
|
/// Potentially incomplete headers request.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
@ -655,7 +655,7 @@ pub mod header {
|
|||||||
/// Request and response for header proofs.
|
/// Request and response for header proofs.
|
||||||
pub mod header_proof {
|
pub mod header_proof {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
use util::{Bytes, U256, H256};
|
use util::{Bytes, U256, H256};
|
||||||
|
|
||||||
/// Potentially incomplete header proof request.
|
/// Potentially incomplete header proof request.
|
||||||
@ -751,10 +751,12 @@ pub mod header_proof {
|
|||||||
|
|
||||||
impl Encodable for Response {
|
impl Encodable for Response {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
s.begin_list(3)
|
s.begin_list(3).begin_list(self.proof.len());
|
||||||
.append(&self.proof)
|
for item in &self.proof {
|
||||||
.append(&self.hash)
|
s.append_list(&item);
|
||||||
.append(&self.td);
|
}
|
||||||
|
|
||||||
|
s.append(&self.hash).append(&self.td);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,7 +765,7 @@ pub mod header_proof {
|
|||||||
pub mod block_receipts {
|
pub mod block_receipts {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use ethcore::receipt::Receipt;
|
use ethcore::receipt::Receipt;
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
use util::H256;
|
use util::H256;
|
||||||
|
|
||||||
/// Potentially incomplete block receipts request.
|
/// Potentially incomplete block receipts request.
|
||||||
@ -849,7 +851,7 @@ pub mod block_receipts {
|
|||||||
|
|
||||||
impl Encodable for Response {
|
impl Encodable for Response {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
s.append(&self.receipts);
|
s.append_list(&self.receipts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -858,7 +860,7 @@ pub mod block_receipts {
|
|||||||
pub mod block_body {
|
pub mod block_body {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use ethcore::encoded;
|
use ethcore::encoded;
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
use util::H256;
|
use util::H256;
|
||||||
|
|
||||||
/// Potentially incomplete block body request.
|
/// Potentially incomplete block body request.
|
||||||
@ -959,7 +961,7 @@ pub mod block_body {
|
|||||||
/// A request for an account proof.
|
/// A request for an account proof.
|
||||||
pub mod account {
|
pub mod account {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
use util::{Bytes, U256, H256};
|
use util::{Bytes, U256, H256};
|
||||||
|
|
||||||
/// Potentially incomplete request for an account proof.
|
/// Potentially incomplete request for an account proof.
|
||||||
@ -1083,9 +1085,12 @@ pub mod account {
|
|||||||
|
|
||||||
impl Encodable for Response {
|
impl Encodable for Response {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
s.begin_list(5)
|
s.begin_list(5).begin_list(self.proof.len());
|
||||||
.append(&self.proof)
|
for item in &self.proof {
|
||||||
.append(&self.nonce)
|
s.append_list(&item);
|
||||||
|
}
|
||||||
|
|
||||||
|
s.append(&self.nonce)
|
||||||
.append(&self.balance)
|
.append(&self.balance)
|
||||||
.append(&self.code_hash)
|
.append(&self.code_hash)
|
||||||
.append(&self.storage_root);
|
.append(&self.storage_root);
|
||||||
@ -1096,7 +1101,7 @@ pub mod account {
|
|||||||
/// A request for a storage proof.
|
/// A request for a storage proof.
|
||||||
pub mod storage {
|
pub mod storage {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
use util::{Bytes, H256};
|
use util::{Bytes, H256};
|
||||||
|
|
||||||
/// Potentially incomplete request for an storage proof.
|
/// Potentially incomplete request for an storage proof.
|
||||||
@ -1227,9 +1232,11 @@ pub mod storage {
|
|||||||
|
|
||||||
impl Encodable for Response {
|
impl Encodable for Response {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
s.begin_list(2)
|
s.begin_list(2).begin_list(self.proof.len());
|
||||||
.append(&self.proof)
|
for item in &self.proof {
|
||||||
.append(&self.value);
|
s.append_list(&item);
|
||||||
|
}
|
||||||
|
s.append(&self.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1237,7 +1244,7 @@ pub mod storage {
|
|||||||
/// A request for contract code.
|
/// A request for contract code.
|
||||||
pub mod contract_code {
|
pub mod contract_code {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
use util::{Bytes, H256};
|
use util::{Bytes, H256};
|
||||||
|
|
||||||
/// Potentially incomplete contract code request.
|
/// Potentially incomplete contract code request.
|
||||||
@ -1351,7 +1358,7 @@ pub mod contract_code {
|
|||||||
pub mod execution {
|
pub mod execution {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use ethcore::transaction::Action;
|
use ethcore::transaction::Action;
|
||||||
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, Stream, View};
|
use rlp::{Encodable, Decodable, Decoder, DecoderError, RlpStream, View};
|
||||||
use util::{Bytes, Address, U256, H256, DBValue};
|
use util::{Bytes, Address, U256, H256, DBValue};
|
||||||
|
|
||||||
/// Potentially incomplete execution proof request.
|
/// Potentially incomplete execution proof request.
|
||||||
@ -1722,7 +1729,7 @@ mod tests {
|
|||||||
}).map(Request::Execution).collect();
|
}).map(Request::Execution).collect();
|
||||||
|
|
||||||
let mut stream = RlpStream::new_list(2);
|
let mut stream = RlpStream::new_list(2);
|
||||||
stream.append(&100usize).append(&reqs);
|
stream.append(&100usize).append_list(&reqs);
|
||||||
let out = stream.out();
|
let out = stream.out();
|
||||||
|
|
||||||
let rlp = UntrustedRlp::new(&out);
|
let rlp = UntrustedRlp::new(&out);
|
||||||
|
@ -20,7 +20,7 @@ use std::cmp;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use rlp::{UntrustedRlp, RlpStream, Encodable, Decodable, Decoder, DecoderError, View, Stream};
|
use rlp::{UntrustedRlp, RlpStream, Encodable, Decodable, Decoder, DecoderError, View};
|
||||||
use util::{Bytes, Address, Uint, Hashable, U256, H256, ordered_trie_root, SHA3_NULL_RLP};
|
use util::{Bytes, Address, Uint, Hashable, U256, H256, ordered_trie_root, SHA3_NULL_RLP};
|
||||||
use util::error::{Mismatch, OutOfBounds};
|
use util::error::{Mismatch, OutOfBounds};
|
||||||
|
|
||||||
@ -59,8 +59,8 @@ impl Block {
|
|||||||
pub fn rlp_bytes(&self, seal: Seal) -> Bytes {
|
pub fn rlp_bytes(&self, seal: Seal) -> Bytes {
|
||||||
let mut block_rlp = RlpStream::new_list(3);
|
let mut block_rlp = RlpStream::new_list(3);
|
||||||
self.header.stream_rlp(&mut block_rlp, seal);
|
self.header.stream_rlp(&mut block_rlp, seal);
|
||||||
block_rlp.append(&self.transactions);
|
block_rlp.append_list(&self.transactions);
|
||||||
block_rlp.append(&self.uncles);
|
block_rlp.append_list(&self.uncles);
|
||||||
block_rlp.out()
|
block_rlp.out()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,7 +507,7 @@ impl SealedBlock {
|
|||||||
pub fn rlp_bytes(&self) -> Bytes {
|
pub fn rlp_bytes(&self) -> Bytes {
|
||||||
let mut block_rlp = RlpStream::new_list(3);
|
let mut block_rlp = RlpStream::new_list(3);
|
||||||
self.block.header.stream_rlp(&mut block_rlp, Seal::With);
|
self.block.header.stream_rlp(&mut block_rlp, Seal::With);
|
||||||
block_rlp.append(&self.block.transactions);
|
block_rlp.append_list(&self.block.transactions);
|
||||||
block_rlp.append_raw(&self.uncle_bytes, 1);
|
block_rlp.append_raw(&self.uncle_bytes, 1);
|
||||||
block_rlp.out()
|
block_rlp.out()
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ impl Encodable for BlockDetails {
|
|||||||
s.append(&self.number);
|
s.append(&self.number);
|
||||||
s.append(&self.total_difficulty);
|
s.append(&self.total_difficulty);
|
||||||
s.append(&self.parent);
|
s.append(&self.parent);
|
||||||
s.append(&self.children);
|
s.append_list(&self.children);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ impl Decodable for BlockReceipts {
|
|||||||
|
|
||||||
impl Encodable for BlockReceipts {
|
impl Encodable for BlockReceipts {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
Encodable::rlp_append(&self.receipts, s);
|
s.append_list(&self.receipts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ impl Encodable for Block {
|
|||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
s.begin_list(3);
|
s.begin_list(3);
|
||||||
s.append(&self.header);
|
s.append(&self.header);
|
||||||
s.append(&self.transactions);
|
s.append_list(&self.transactions);
|
||||||
s.append(&self.uncles);
|
s.append_list(&self.uncles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ impl Decodable for BloomGroup {
|
|||||||
|
|
||||||
impl Encodable for BloomGroup {
|
impl Encodable for BloomGroup {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
Encodable::rlp_append(&self.blooms, s)
|
s.append_list(&self.blooms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use util::*;
|
|||||||
use super::{Height, View, BlockHash, Step};
|
use super::{Height, View, BlockHash, Step};
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use header::Header;
|
use header::Header;
|
||||||
use rlp::{Rlp, UntrustedRlp, RlpStream, Stream, RlpEncodable, Encodable, Decodable, Decoder, DecoderError, View as RlpView};
|
use rlp::{Rlp, UntrustedRlp, RlpStream, Encodable, Decodable, Decoder, DecoderError, View as RlpView};
|
||||||
use ethkey::{recover, public_to_address};
|
use ethkey::{recover, public_to_address};
|
||||||
use super::super::vote_collector::Message;
|
use super::super::vote_collector::Message;
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ impl Decodable for Step {
|
|||||||
|
|
||||||
impl Encodable for Step {
|
impl Encodable for Step {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
RlpEncodable::rlp_append(&self.number(), s);
|
s.append_internal(&self.number());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,6 +278,7 @@ mod tests {
|
|||||||
::rlp::encode(&H520::default()).to_vec(),
|
::rlp::encode(&H520::default()).to_vec(),
|
||||||
Vec::new()
|
Vec::new()
|
||||||
];
|
];
|
||||||
|
|
||||||
header.set_seal(seal);
|
header.set_seal(seal);
|
||||||
let message = ConsensusMessage::new_proposal(&header).unwrap();
|
let message = ConsensusMessage::new_proposal(&header).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -243,7 +243,7 @@ impl Tendermint {
|
|||||||
let seal = vec![
|
let seal = vec![
|
||||||
::rlp::encode(&view).to_vec(),
|
::rlp::encode(&view).to_vec(),
|
||||||
::rlp::encode(&seal.proposal).to_vec(),
|
::rlp::encode(&seal.proposal).to_vec(),
|
||||||
::rlp::encode(&seal.votes).to_vec()
|
::rlp::encode_list(&seal.votes).to_vec()
|
||||||
];
|
];
|
||||||
self.submit_seal(block_hash, seal);
|
self.submit_seal(block_hash, seal);
|
||||||
self.to_next_height(height);
|
self.to_next_height(height);
|
||||||
@ -825,7 +825,7 @@ mod tests {
|
|||||||
let vote_info = message_info_rlp(&VoteStep::new(2, 0, Step::Precommit), Some(header.bare_hash()));
|
let vote_info = message_info_rlp(&VoteStep::new(2, 0, Step::Precommit), Some(header.bare_hash()));
|
||||||
let signature1 = tap.sign(proposer, None, vote_info.sha3()).unwrap();
|
let signature1 = tap.sign(proposer, None, vote_info.sha3()).unwrap();
|
||||||
|
|
||||||
seal[2] = ::rlp::encode(&vec![H520::from(signature1.clone())]).to_vec();
|
seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone())]).to_vec();
|
||||||
header.set_seal(seal.clone());
|
header.set_seal(seal.clone());
|
||||||
|
|
||||||
// One good signature is not enough.
|
// One good signature is not enough.
|
||||||
@ -837,7 +837,7 @@ mod tests {
|
|||||||
let voter = insert_and_unlock(&tap, "0");
|
let voter = insert_and_unlock(&tap, "0");
|
||||||
let signature0 = tap.sign(voter, None, vote_info.sha3()).unwrap();
|
let signature0 = tap.sign(voter, None, vote_info.sha3()).unwrap();
|
||||||
|
|
||||||
seal[2] = ::rlp::encode(&vec![H520::from(signature1.clone()), H520::from(signature0.clone())]).to_vec();
|
seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone()), H520::from(signature0.clone())]).to_vec();
|
||||||
header.set_seal(seal.clone());
|
header.set_seal(seal.clone());
|
||||||
|
|
||||||
assert!(engine.verify_block_family(&header, &parent_header, None).is_ok());
|
assert!(engine.verify_block_family(&header, &parent_header, None).is_ok());
|
||||||
@ -845,7 +845,7 @@ mod tests {
|
|||||||
let bad_voter = insert_and_unlock(&tap, "101");
|
let bad_voter = insert_and_unlock(&tap, "101");
|
||||||
let bad_signature = tap.sign(bad_voter, None, vote_info.sha3()).unwrap();
|
let bad_signature = tap.sign(bad_voter, None, vote_info.sha3()).unwrap();
|
||||||
|
|
||||||
seal[2] = ::rlp::encode(&vec![H520::from(signature1), H520::from(bad_signature)]).to_vec();
|
seal[2] = ::rlp::encode_list(&vec![H520::from(signature1), H520::from(bad_signature)]).to_vec();
|
||||||
header.set_seal(seal);
|
header.set_seal(seal);
|
||||||
|
|
||||||
// One good and one bad signature.
|
// One good and one bad signature.
|
||||||
|
@ -36,7 +36,7 @@ const STACK_SIZE_PER_DEPTH: usize = 24*1024;
|
|||||||
|
|
||||||
/// Returns new address created from address and given nonce.
|
/// Returns new address created from address and given nonce.
|
||||||
pub fn contract_address(address: &Address, nonce: &U256) -> Address {
|
pub fn contract_address(address: &Address, nonce: &U256) -> Address {
|
||||||
use rlp::{RlpStream, Stream};
|
use rlp::RlpStream;
|
||||||
|
|
||||||
let mut stream = RlpStream::new_list(2);
|
let mut stream = RlpStream::new_list(2);
|
||||||
stream.append(address);
|
stream.append(address);
|
||||||
|
@ -26,7 +26,7 @@ use util::migration::{Batch, Config, Error, Migration, SimpleMigration, Progress
|
|||||||
use util::sha3::Hashable;
|
use util::sha3::Hashable;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use rlp::{decode, Rlp, RlpStream, Stream, View};
|
use rlp::{decode, Rlp, RlpStream, View};
|
||||||
|
|
||||||
|
|
||||||
// attempt to migrate a key, value pair. None if migration not possible.
|
// attempt to migrate a key, value pair. None if migration not possible.
|
||||||
@ -199,7 +199,7 @@ impl OverlayRecentV7 {
|
|||||||
stream.begin_list(2).append(&k).append(&v);
|
stream.begin_list(2).append(&k).append(&v);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.append(&deleted_keys);
|
stream.append_list(&deleted_keys);
|
||||||
|
|
||||||
// and insert it into the new database.
|
// and insert it into the new database.
|
||||||
batch.insert(entry_key, stream.out(), dest)?;
|
batch.insert(entry_key, stream.out(), dest)?;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
//! This migration consolidates all databases into single one using Column Families.
|
//! This migration consolidates all databases into single one using Column Families.
|
||||||
|
|
||||||
use rlp::{Rlp, RlpStream, View, Stream};
|
use rlp::{Rlp, RlpStream, View};
|
||||||
use util::kvdb::Database;
|
use util::kvdb::Database;
|
||||||
use util::migration::{Batch, Config, Error, Migration, Progress};
|
use util::migration::{Batch, Config, Error, Migration, Progress};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::cell::Cell;
|
|
||||||
use transaction::{SignedTransaction, Action};
|
use transaction::{SignedTransaction, Action};
|
||||||
use transient_hashmap::TransientHashMap;
|
use transient_hashmap::TransientHashMap;
|
||||||
use miner::{TransactionQueue, TransactionQueueDetailsProvider, TransactionImportResult, TransactionOrigin};
|
use miner::{TransactionQueue, TransactionQueueDetailsProvider, TransactionImportResult, TransactionOrigin};
|
||||||
@ -47,15 +46,15 @@ impl Default for Threshold {
|
|||||||
pub struct BanningTransactionQueue {
|
pub struct BanningTransactionQueue {
|
||||||
queue: TransactionQueue,
|
queue: TransactionQueue,
|
||||||
ban_threshold: Threshold,
|
ban_threshold: Threshold,
|
||||||
senders_bans: TransientHashMap<Address, Cell<Count>>,
|
senders_bans: TransientHashMap<Address, Count>,
|
||||||
recipients_bans: TransientHashMap<Address, Cell<Count>>,
|
recipients_bans: TransientHashMap<Address, Count>,
|
||||||
codes_bans: TransientHashMap<H256, Cell<Count>>,
|
codes_bans: TransientHashMap<H256, Count>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BanningTransactionQueue {
|
impl BanningTransactionQueue {
|
||||||
/// Creates new banlisting transaction queue
|
/// Creates new banlisting transaction queue
|
||||||
pub fn new(queue: TransactionQueue, ban_threshold: Threshold, ban_lifetime: Duration) -> Self {
|
pub fn new(queue: TransactionQueue, ban_threshold: Threshold, ban_lifetime: Duration) -> Self {
|
||||||
let ban_lifetime_sec = ban_lifetime.as_secs();
|
let ban_lifetime_sec = ban_lifetime.as_secs() as u32;
|
||||||
assert!(ban_lifetime_sec > 0, "Lifetime has to be specified in seconds.");
|
assert!(ban_lifetime_sec > 0, "Lifetime has to be specified in seconds.");
|
||||||
BanningTransactionQueue {
|
BanningTransactionQueue {
|
||||||
queue: queue,
|
queue: queue,
|
||||||
@ -87,7 +86,7 @@ impl BanningTransactionQueue {
|
|||||||
|
|
||||||
// Check sender
|
// Check sender
|
||||||
let sender = transaction.sender();
|
let sender = transaction.sender();
|
||||||
let count = self.senders_bans.direct().get(&sender).map(|v| v.get()).unwrap_or(0);
|
let count = self.senders_bans.direct().get(&sender).cloned().unwrap_or(0);
|
||||||
if count > threshold {
|
if count > threshold {
|
||||||
debug!(target: "txqueue", "Ignoring transaction {:?} because sender is banned.", transaction.hash());
|
debug!(target: "txqueue", "Ignoring transaction {:?} because sender is banned.", transaction.hash());
|
||||||
return Err(Error::Transaction(TransactionError::SenderBanned));
|
return Err(Error::Transaction(TransactionError::SenderBanned));
|
||||||
@ -95,7 +94,7 @@ impl BanningTransactionQueue {
|
|||||||
|
|
||||||
// Check recipient
|
// Check recipient
|
||||||
if let Action::Call(recipient) = transaction.action {
|
if let Action::Call(recipient) = transaction.action {
|
||||||
let count = self.recipients_bans.direct().get(&recipient).map(|v| v.get()).unwrap_or(0);
|
let count = self.recipients_bans.direct().get(&recipient).cloned().unwrap_or(0);
|
||||||
if count > threshold {
|
if count > threshold {
|
||||||
debug!(target: "txqueue", "Ignoring transaction {:?} because recipient is banned.", transaction.hash());
|
debug!(target: "txqueue", "Ignoring transaction {:?} because recipient is banned.", transaction.hash());
|
||||||
return Err(Error::Transaction(TransactionError::RecipientBanned));
|
return Err(Error::Transaction(TransactionError::RecipientBanned));
|
||||||
@ -105,7 +104,7 @@ impl BanningTransactionQueue {
|
|||||||
// Check code
|
// Check code
|
||||||
if let Action::Create = transaction.action {
|
if let Action::Create = transaction.action {
|
||||||
let code_hash = transaction.data.sha3();
|
let code_hash = transaction.data.sha3();
|
||||||
let count = self.codes_bans.direct().get(&code_hash).map(|v| v.get()).unwrap_or(0);
|
let count = self.codes_bans.direct().get(&code_hash).cloned().unwrap_or(0);
|
||||||
if count > threshold {
|
if count > threshold {
|
||||||
debug!(target: "txqueue", "Ignoring transaction {:?} because code is banned.", transaction.hash());
|
debug!(target: "txqueue", "Ignoring transaction {:?} because code is banned.", transaction.hash());
|
||||||
return Err(Error::Transaction(TransactionError::CodeBanned));
|
return Err(Error::Transaction(TransactionError::CodeBanned));
|
||||||
@ -147,9 +146,9 @@ impl BanningTransactionQueue {
|
|||||||
/// queue.
|
/// queue.
|
||||||
fn ban_sender(&mut self, address: Address) -> bool {
|
fn ban_sender(&mut self, address: Address) -> bool {
|
||||||
let count = {
|
let count = {
|
||||||
let mut count = self.senders_bans.entry(address).or_insert_with(|| Cell::new(0));
|
let mut count = self.senders_bans.entry(address).or_insert_with(|| 0);
|
||||||
*count.get_mut() = count.get().saturating_add(1);
|
*count = count.saturating_add(1);
|
||||||
count.get()
|
*count
|
||||||
};
|
};
|
||||||
match self.ban_threshold {
|
match self.ban_threshold {
|
||||||
Threshold::BanAfter(threshold) if count > threshold => {
|
Threshold::BanAfter(threshold) if count > threshold => {
|
||||||
@ -167,9 +166,9 @@ impl BanningTransactionQueue {
|
|||||||
/// Returns true if bans threshold has been reached.
|
/// Returns true if bans threshold has been reached.
|
||||||
fn ban_recipient(&mut self, address: Address) -> bool {
|
fn ban_recipient(&mut self, address: Address) -> bool {
|
||||||
let count = {
|
let count = {
|
||||||
let mut count = self.recipients_bans.entry(address).or_insert_with(|| Cell::new(0));
|
let mut count = self.recipients_bans.entry(address).or_insert_with(|| 0);
|
||||||
*count.get_mut() = count.get().saturating_add(1);
|
*count = count.saturating_add(1);
|
||||||
count.get()
|
*count
|
||||||
};
|
};
|
||||||
match self.ban_threshold {
|
match self.ban_threshold {
|
||||||
// TODO [ToDr] Consider removing other transactions to the same recipient from the queue?
|
// TODO [ToDr] Consider removing other transactions to the same recipient from the queue?
|
||||||
@ -183,12 +182,12 @@ impl BanningTransactionQueue {
|
|||||||
/// If bans threshold is reached all subsequent transactions to contracts with this codehash will be rejected.
|
/// If bans threshold is reached all subsequent transactions to contracts with this codehash will be rejected.
|
||||||
/// Returns true if bans threshold has been reached.
|
/// Returns true if bans threshold has been reached.
|
||||||
fn ban_codehash(&mut self, code_hash: H256) -> bool {
|
fn ban_codehash(&mut self, code_hash: H256) -> bool {
|
||||||
let mut count = self.codes_bans.entry(code_hash).or_insert_with(|| Cell::new(0));
|
let mut count = self.codes_bans.entry(code_hash).or_insert_with(|| 0);
|
||||||
*count.get_mut() = count.get().saturating_add(1);
|
*count = count.saturating_add(1);
|
||||||
|
|
||||||
match self.ban_threshold {
|
match self.ban_threshold {
|
||||||
// TODO [ToDr] Consider removing other transactions with the same code from the queue?
|
// TODO [ToDr] Consider removing other transactions with the same code from the queue?
|
||||||
Threshold::BanAfter(threshold) if count.get() > threshold => true,
|
Threshold::BanAfter(threshold) if *count > threshold => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ struct SealingWork {
|
|||||||
/// Handles preparing work for "work sealing" or seals "internally" if Engine does not require work.
|
/// Handles preparing work for "work sealing" or seals "internally" if Engine does not require work.
|
||||||
pub struct Miner {
|
pub struct Miner {
|
||||||
// NOTE [ToDr] When locking always lock in this order!
|
// NOTE [ToDr] When locking always lock in this order!
|
||||||
transaction_queue: Arc<Mutex<BanningTransactionQueue>>,
|
transaction_queue: Arc<RwLock<BanningTransactionQueue>>,
|
||||||
sealing_work: Mutex<SealingWork>,
|
sealing_work: Mutex<SealingWork>,
|
||||||
next_allowed_reseal: Mutex<Instant>,
|
next_allowed_reseal: Mutex<Instant>,
|
||||||
next_mandatory_reseal: RwLock<Instant>,
|
next_mandatory_reseal: RwLock<Instant>,
|
||||||
@ -234,7 +234,8 @@ pub struct Miner {
|
|||||||
impl Miner {
|
impl Miner {
|
||||||
/// Push notifier that will handle new jobs
|
/// Push notifier that will handle new jobs
|
||||||
pub fn push_notifier(&self, notifier: Box<NotifyWork>) {
|
pub fn push_notifier(&self, notifier: Box<NotifyWork>) {
|
||||||
self.notifiers.write().push(notifier)
|
self.notifiers.write().push(notifier);
|
||||||
|
self.sealing_work.lock().enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates new instance of miner Arc.
|
/// Creates new instance of miner Arc.
|
||||||
@ -270,7 +271,7 @@ impl Miner {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Miner {
|
Miner {
|
||||||
transaction_queue: Arc::new(Mutex::new(txq)),
|
transaction_queue: Arc::new(RwLock::new(txq)),
|
||||||
next_allowed_reseal: Mutex::new(Instant::now()),
|
next_allowed_reseal: Mutex::new(Instant::now()),
|
||||||
next_mandatory_reseal: RwLock::new(Instant::now() + options.reseal_max_period),
|
next_mandatory_reseal: RwLock::new(Instant::now() + options.reseal_max_period),
|
||||||
sealing_block_last_request: Mutex::new(0),
|
sealing_block_last_request: Mutex::new(0),
|
||||||
@ -303,9 +304,7 @@ impl Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn forced_sealing(&self) -> bool {
|
fn forced_sealing(&self) -> bool {
|
||||||
self.options.force_sealing
|
self.options.force_sealing || !self.notifiers.read().is_empty()
|
||||||
|| !self.options.new_work_notify.is_empty()
|
|
||||||
|| Instant::now() > *self.next_mandatory_reseal.read()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear all pending block states
|
/// Clear all pending block states
|
||||||
@ -329,7 +328,7 @@ impl Miner {
|
|||||||
let _timer = PerfTimer::new("prepare_block");
|
let _timer = PerfTimer::new("prepare_block");
|
||||||
let chain_info = chain.chain_info();
|
let chain_info = chain.chain_info();
|
||||||
let (transactions, mut open_block, original_work_hash) = {
|
let (transactions, mut open_block, original_work_hash) = {
|
||||||
let transactions = {self.transaction_queue.lock().top_transactions_at(chain_info.best_block_number, chain_info.best_block_timestamp)};
|
let transactions = {self.transaction_queue.read().top_transactions_at(chain_info.best_block_number, chain_info.best_block_timestamp)};
|
||||||
let mut sealing_work = self.sealing_work.lock();
|
let mut sealing_work = self.sealing_work.lock();
|
||||||
let last_work_hash = sealing_work.queue.peek_last_ref().map(|pb| pb.block().fields().header.hash());
|
let last_work_hash = sealing_work.queue.peek_last_ref().map(|pb| pb.block().fields().header.hash());
|
||||||
let best_hash = chain_info.best_block_hash;
|
let best_hash = chain_info.best_block_hash;
|
||||||
@ -376,7 +375,7 @@ impl Miner {
|
|||||||
// Check for heavy transactions
|
// Check for heavy transactions
|
||||||
match self.options.tx_queue_banning {
|
match self.options.tx_queue_banning {
|
||||||
Banning::Enabled { ref offend_threshold, .. } if &took > offend_threshold => {
|
Banning::Enabled { ref offend_threshold, .. } if &took > offend_threshold => {
|
||||||
match self.transaction_queue.lock().ban_transaction(&hash) {
|
match self.transaction_queue.write().ban_transaction(&hash) {
|
||||||
true => {
|
true => {
|
||||||
warn!(target: "miner", "Detected heavy transaction. Banning the sender and recipient/code.");
|
warn!(target: "miner", "Detected heavy transaction. Banning the sender and recipient/code.");
|
||||||
},
|
},
|
||||||
@ -429,7 +428,7 @@ impl Miner {
|
|||||||
let fetch_nonce = |a: &Address| chain.latest_nonce(a);
|
let fetch_nonce = |a: &Address| chain.latest_nonce(a);
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut queue = self.transaction_queue.lock();
|
let mut queue = self.transaction_queue.write();
|
||||||
for hash in invalid_transactions {
|
for hash in invalid_transactions {
|
||||||
queue.remove_invalid(&hash, &fetch_nonce);
|
queue.remove_invalid(&hash, &fetch_nonce);
|
||||||
}
|
}
|
||||||
@ -446,13 +445,13 @@ impl Miner {
|
|||||||
let txq = self.transaction_queue.clone();
|
let txq = self.transaction_queue.clone();
|
||||||
self.gas_pricer.lock().recalibrate(move |price| {
|
self.gas_pricer.lock().recalibrate(move |price| {
|
||||||
debug!(target: "miner", "minimal_gas_price: Got gas price! {}", price);
|
debug!(target: "miner", "minimal_gas_price: Got gas price! {}", price);
|
||||||
txq.lock().set_minimal_gas_price(price);
|
txq.write().set_minimal_gas_price(price);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check is reseal is allowed and necessary.
|
/// Check is reseal is allowed and necessary.
|
||||||
fn requires_reseal(&self, best_block: BlockNumber) -> bool {
|
fn requires_reseal(&self, best_block: BlockNumber) -> bool {
|
||||||
let has_local_transactions = self.transaction_queue.lock().has_local_pending_transactions();
|
let has_local_transactions = self.transaction_queue.read().has_local_pending_transactions();
|
||||||
let mut sealing_work = self.sealing_work.lock();
|
let mut sealing_work = self.sealing_work.lock();
|
||||||
if sealing_work.enabled {
|
if sealing_work.enabled {
|
||||||
trace!(target: "miner", "requires_reseal: sealing enabled");
|
trace!(target: "miner", "requires_reseal: sealing enabled");
|
||||||
@ -483,7 +482,7 @@ impl Miner {
|
|||||||
|
|
||||||
/// Attempts to perform internal sealing (one that does not require work) and handles the result depending on the type of Seal.
|
/// Attempts to perform internal sealing (one that does not require work) and handles the result depending on the type of Seal.
|
||||||
fn seal_and_import_block_internally(&self, chain: &MiningBlockChainClient, block: ClosedBlock) -> bool {
|
fn seal_and_import_block_internally(&self, chain: &MiningBlockChainClient, block: ClosedBlock) -> bool {
|
||||||
if !block.transactions().is_empty() || self.forced_sealing() {
|
if !block.transactions().is_empty() || self.forced_sealing() || Instant::now() > *self.next_mandatory_reseal.read() {
|
||||||
trace!(target: "miner", "seal_block_internally: attempting internal seal.");
|
trace!(target: "miner", "seal_block_internally: attempting internal seal.");
|
||||||
match self.engine.generate_seal(block.block()) {
|
match self.engine.generate_seal(block.block()) {
|
||||||
// Save proposal for later seal submission and broadcast it.
|
// Save proposal for later seal submission and broadcast it.
|
||||||
@ -558,7 +557,7 @@ impl Miner {
|
|||||||
|
|
||||||
fn update_gas_limit(&self, client: &MiningBlockChainClient) {
|
fn update_gas_limit(&self, client: &MiningBlockChainClient) {
|
||||||
let gas_limit = client.best_block_header().gas_limit();
|
let gas_limit = client.best_block_header().gas_limit();
|
||||||
let mut queue = self.transaction_queue.lock();
|
let mut queue = self.transaction_queue.write();
|
||||||
queue.set_gas_limit(gas_limit);
|
queue.set_gas_limit(gas_limit);
|
||||||
if let GasLimit::Auto = self.options.tx_queue_gas_limit {
|
if let GasLimit::Auto = self.options.tx_queue_gas_limit {
|
||||||
// Set total tx queue gas limit to be 20x the block gas limit.
|
// Set total tx queue gas limit to be 20x the block gas limit.
|
||||||
@ -680,7 +679,7 @@ const SEALING_TIMEOUT_IN_BLOCKS : u64 = 5;
|
|||||||
impl MinerService for Miner {
|
impl MinerService for Miner {
|
||||||
|
|
||||||
fn clear_and_reset(&self, chain: &MiningBlockChainClient) {
|
fn clear_and_reset(&self, chain: &MiningBlockChainClient) {
|
||||||
self.transaction_queue.lock().clear();
|
self.transaction_queue.write().clear();
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// | NOTE Code below requires transaction_queue and sealing_work locks. |
|
// | NOTE Code below requires transaction_queue and sealing_work locks. |
|
||||||
// | Make sure to release the locks before calling that method. |
|
// | Make sure to release the locks before calling that method. |
|
||||||
@ -689,7 +688,7 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn status(&self) -> MinerStatus {
|
fn status(&self) -> MinerStatus {
|
||||||
let status = self.transaction_queue.lock().status();
|
let status = self.transaction_queue.read().status();
|
||||||
let sealing_work = self.sealing_work.lock();
|
let sealing_work = self.sealing_work.lock();
|
||||||
MinerStatus {
|
MinerStatus {
|
||||||
transactions_in_pending_queue: status.pending,
|
transactions_in_pending_queue: status.pending,
|
||||||
@ -819,16 +818,16 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn set_minimal_gas_price(&self, min_gas_price: U256) {
|
fn set_minimal_gas_price(&self, min_gas_price: U256) {
|
||||||
self.transaction_queue.lock().set_minimal_gas_price(min_gas_price);
|
self.transaction_queue.write().set_minimal_gas_price(min_gas_price);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn minimal_gas_price(&self) -> U256 {
|
fn minimal_gas_price(&self) -> U256 {
|
||||||
*self.transaction_queue.lock().minimal_gas_price()
|
*self.transaction_queue.read().minimal_gas_price()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sensible_gas_price(&self) -> U256 {
|
fn sensible_gas_price(&self) -> U256 {
|
||||||
// 10% above our minimum.
|
// 10% above our minimum.
|
||||||
*self.transaction_queue.lock().minimal_gas_price() * 110.into() / 100.into()
|
*self.transaction_queue.read().minimal_gas_price() * 110.into() / 100.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sensible_gas_limit(&self) -> U256 {
|
fn sensible_gas_limit(&self) -> U256 {
|
||||||
@ -836,15 +835,15 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn transactions_limit(&self) -> usize {
|
fn transactions_limit(&self) -> usize {
|
||||||
self.transaction_queue.lock().limit()
|
self.transaction_queue.read().limit()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_transactions_limit(&self, limit: usize) {
|
fn set_transactions_limit(&self, limit: usize) {
|
||||||
self.transaction_queue.lock().set_limit(limit)
|
self.transaction_queue.write().set_limit(limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_tx_gas_limit(&self, limit: U256) {
|
fn set_tx_gas_limit(&self, limit: U256) {
|
||||||
self.transaction_queue.lock().set_tx_gas_limit(limit)
|
self.transaction_queue.write().set_tx_gas_limit(limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the author that we will seal blocks as.
|
/// Get the author that we will seal blocks as.
|
||||||
@ -874,7 +873,7 @@ impl MinerService for Miner {
|
|||||||
) -> Vec<Result<TransactionImportResult, Error>> {
|
) -> Vec<Result<TransactionImportResult, Error>> {
|
||||||
trace!(target: "external_tx", "Importing external transactions");
|
trace!(target: "external_tx", "Importing external transactions");
|
||||||
let results = {
|
let results = {
|
||||||
let mut transaction_queue = self.transaction_queue.lock();
|
let mut transaction_queue = self.transaction_queue.write();
|
||||||
self.add_transactions_to_queue(
|
self.add_transactions_to_queue(
|
||||||
chain, transactions, TransactionOrigin::External, None, &mut transaction_queue
|
chain, transactions, TransactionOrigin::External, None, &mut transaction_queue
|
||||||
)
|
)
|
||||||
@ -901,7 +900,7 @@ impl MinerService for Miner {
|
|||||||
|
|
||||||
let imported = {
|
let imported = {
|
||||||
// Be sure to release the lock before we call prepare_work_sealing
|
// Be sure to release the lock before we call prepare_work_sealing
|
||||||
let mut transaction_queue = self.transaction_queue.lock();
|
let mut transaction_queue = self.transaction_queue.write();
|
||||||
// We need to re-validate transactions
|
// We need to re-validate transactions
|
||||||
let import = self.add_transactions_to_queue(
|
let import = self.add_transactions_to_queue(
|
||||||
chain, vec![pending.transaction.into()], TransactionOrigin::Local, pending.condition, &mut transaction_queue
|
chain, vec![pending.transaction.into()], TransactionOrigin::Local, pending.condition, &mut transaction_queue
|
||||||
@ -938,12 +937,12 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn pending_transactions(&self) -> Vec<PendingTransaction> {
|
fn pending_transactions(&self) -> Vec<PendingTransaction> {
|
||||||
let queue = self.transaction_queue.lock();
|
let queue = self.transaction_queue.read();
|
||||||
queue.pending_transactions(BlockNumber::max_value(), u64::max_value())
|
queue.pending_transactions(BlockNumber::max_value(), u64::max_value())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn local_transactions(&self) -> BTreeMap<H256, LocalTransactionStatus> {
|
fn local_transactions(&self) -> BTreeMap<H256, LocalTransactionStatus> {
|
||||||
let queue = self.transaction_queue.lock();
|
let queue = self.transaction_queue.read();
|
||||||
queue.local_transactions()
|
queue.local_transactions()
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(hash, status)| (*hash, status.clone()))
|
.map(|(hash, status)| (*hash, status.clone()))
|
||||||
@ -951,11 +950,11 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn future_transactions(&self) -> Vec<PendingTransaction> {
|
fn future_transactions(&self) -> Vec<PendingTransaction> {
|
||||||
self.transaction_queue.lock().future_transactions()
|
self.transaction_queue.read().future_transactions()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ready_transactions(&self, best_block: BlockNumber, best_block_timestamp: u64) -> Vec<PendingTransaction> {
|
fn ready_transactions(&self, best_block: BlockNumber, best_block_timestamp: u64) -> Vec<PendingTransaction> {
|
||||||
let queue = self.transaction_queue.lock();
|
let queue = self.transaction_queue.read();
|
||||||
match self.options.pending_set {
|
match self.options.pending_set {
|
||||||
PendingSet::AlwaysQueue => queue.pending_transactions(best_block, best_block_timestamp),
|
PendingSet::AlwaysQueue => queue.pending_transactions(best_block, best_block_timestamp),
|
||||||
PendingSet::SealingOrElseQueue => {
|
PendingSet::SealingOrElseQueue => {
|
||||||
@ -976,7 +975,7 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn pending_transactions_hashes(&self, best_block: BlockNumber) -> Vec<H256> {
|
fn pending_transactions_hashes(&self, best_block: BlockNumber) -> Vec<H256> {
|
||||||
let queue = self.transaction_queue.lock();
|
let queue = self.transaction_queue.read();
|
||||||
match self.options.pending_set {
|
match self.options.pending_set {
|
||||||
PendingSet::AlwaysQueue => queue.pending_hashes(),
|
PendingSet::AlwaysQueue => queue.pending_hashes(),
|
||||||
PendingSet::SealingOrElseQueue => {
|
PendingSet::SealingOrElseQueue => {
|
||||||
@ -997,7 +996,7 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<PendingTransaction> {
|
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<PendingTransaction> {
|
||||||
let queue = self.transaction_queue.lock();
|
let queue = self.transaction_queue.read();
|
||||||
match self.options.pending_set {
|
match self.options.pending_set {
|
||||||
PendingSet::AlwaysQueue => queue.find(hash),
|
PendingSet::AlwaysQueue => queue.find(hash),
|
||||||
PendingSet::SealingOrElseQueue => {
|
PendingSet::SealingOrElseQueue => {
|
||||||
@ -1017,6 +1016,16 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn remove_pending_transaction(&self, chain: &MiningBlockChainClient, hash: &H256) -> Option<PendingTransaction> {
|
||||||
|
let mut queue = self.transaction_queue.write();
|
||||||
|
let tx = queue.find(hash);
|
||||||
|
if tx.is_some() {
|
||||||
|
let fetch_nonce = |a: &Address| chain.latest_nonce(a);
|
||||||
|
queue.remove_invalid(hash, &fetch_nonce);
|
||||||
|
}
|
||||||
|
tx
|
||||||
|
}
|
||||||
|
|
||||||
fn pending_receipt(&self, best_block: BlockNumber, hash: &H256) -> Option<RichReceipt> {
|
fn pending_receipt(&self, best_block: BlockNumber, hash: &H256) -> Option<RichReceipt> {
|
||||||
self.from_pending_block(
|
self.from_pending_block(
|
||||||
best_block,
|
best_block,
|
||||||
@ -1068,7 +1077,7 @@ impl MinerService for Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn last_nonce(&self, address: &Address) -> Option<U256> {
|
fn last_nonce(&self, address: &Address) -> Option<U256> {
|
||||||
self.transaction_queue.lock().last_nonce(address)
|
self.transaction_queue.read().last_nonce(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update sealing if required.
|
/// Update sealing if required.
|
||||||
@ -1158,7 +1167,7 @@ impl MinerService for Miner {
|
|||||||
// Then import all transactions...
|
// Then import all transactions...
|
||||||
{
|
{
|
||||||
|
|
||||||
let mut transaction_queue = self.transaction_queue.lock();
|
let mut transaction_queue = self.transaction_queue.write();
|
||||||
for hash in retracted {
|
for hash in retracted {
|
||||||
let block = chain.block(BlockId::Hash(*hash))
|
let block = chain.block(BlockId::Hash(*hash))
|
||||||
.expect("Client is sending message after commit to db and inserting to chain; the block is available; qed");
|
.expect("Client is sending message after commit to db and inserting to chain; the block is available; qed");
|
||||||
@ -1176,7 +1185,7 @@ impl MinerService for Miner {
|
|||||||
balance: chain.latest_balance(a),
|
balance: chain.latest_balance(a),
|
||||||
};
|
};
|
||||||
let time = chain.chain_info().best_block_number;
|
let time = chain.chain_info().best_block_number;
|
||||||
let mut transaction_queue = self.transaction_queue.lock();
|
let mut transaction_queue = self.transaction_queue.write();
|
||||||
transaction_queue.remove_old(&fetch_account, time);
|
transaction_queue.remove_old(&fetch_account, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,6 +150,10 @@ pub trait MinerService : Send + Sync {
|
|||||||
/// Query pending transactions for hash.
|
/// Query pending transactions for hash.
|
||||||
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<PendingTransaction>;
|
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<PendingTransaction>;
|
||||||
|
|
||||||
|
/// Removes transaction from the queue.
|
||||||
|
/// NOTE: The transaction is not removed from pending block if mining.
|
||||||
|
fn remove_pending_transaction(&self, chain: &MiningBlockChainClient, hash: &H256) -> Option<PendingTransaction>;
|
||||||
|
|
||||||
/// Get a list of all pending transactions in the queue.
|
/// Get a list of all pending transactions in the queue.
|
||||||
fn pending_transactions(&self) -> Vec<PendingTransaction>;
|
fn pending_transactions(&self) -> Vec<PendingTransaction>;
|
||||||
|
|
||||||
|
@ -211,6 +211,8 @@ impl From<AddrParseError> for Error {
|
|||||||
|
|
||||||
impl super::work_notify::NotifyWork for Stratum {
|
impl super::work_notify::NotifyWork for Stratum {
|
||||||
fn notify(&self, pow_hash: H256, difficulty: U256, number: u64) {
|
fn notify(&self, pow_hash: H256, difficulty: U256, number: u64) {
|
||||||
|
trace!(target: "stratum", "Notify work");
|
||||||
|
|
||||||
self.service.push_work_all(
|
self.service.push_work_all(
|
||||||
self.dispatcher.payload(pow_hash, difficulty, number)
|
self.dispatcher.payload(pow_hash, difficulty, number)
|
||||||
).unwrap_or_else(
|
).unwrap_or_else(
|
||||||
|
@ -19,7 +19,7 @@ use state::Account;
|
|||||||
use account_db::AccountDBMut;
|
use account_db::AccountDBMut;
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use types::account_diff::*;
|
use types::account_diff::*;
|
||||||
use rlp::{self, RlpStream, Stream};
|
use rlp::{self, RlpStream};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
/// An account, expressed as Plain-Old-Data (hence the name).
|
/// An account, expressed as Plain-Old-Data (hence the name).
|
||||||
|
@ -22,7 +22,7 @@ use snapshot::Error;
|
|||||||
|
|
||||||
use util::{U256, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP};
|
use util::{U256, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP};
|
||||||
use util::trie::{TrieDB, Trie};
|
use util::trie::{TrieDB, Trie};
|
||||||
use rlp::{RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{RlpStream, UntrustedRlp, View};
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use block::Block;
|
|||||||
use header::Header;
|
use header::Header;
|
||||||
|
|
||||||
use views::BlockView;
|
use views::BlockView;
|
||||||
use rlp::{DecoderError, RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{DecoderError, RlpStream, UntrustedRlp, View};
|
||||||
use util::{Bytes, Hashable, H256};
|
use util::{Bytes, Hashable, H256};
|
||||||
use util::triehash::ordered_trie_root;
|
use util::triehash::ordered_trie_root;
|
||||||
|
|
||||||
@ -69,7 +69,9 @@ impl AbridgedBlock {
|
|||||||
.append(&header.extra_data());
|
.append(&header.extra_data());
|
||||||
|
|
||||||
// write block values.
|
// write block values.
|
||||||
stream.append(&block_view.transactions()).append(&block_view.uncles());
|
stream
|
||||||
|
.append_list(&block_view.transactions())
|
||||||
|
.append_list(&block_view.uncles());
|
||||||
|
|
||||||
// write seal fields.
|
// write seal fields.
|
||||||
for field in seal_fields {
|
for field in seal_fields {
|
||||||
@ -108,7 +110,7 @@ impl AbridgedBlock {
|
|||||||
header.set_receipts_root(receipts_root);
|
header.set_receipts_root(receipts_root);
|
||||||
|
|
||||||
let mut uncles_rlp = RlpStream::new();
|
let mut uncles_rlp = RlpStream::new();
|
||||||
uncles_rlp.append(&uncles);
|
uncles_rlp.append_list(&uncles);
|
||||||
header.set_uncles_hash(uncles_rlp.as_raw().sha3());
|
header.set_uncles_hash(uncles_rlp.as_raw().sha3());
|
||||||
|
|
||||||
let mut seal_fields = Vec::new();
|
let mut seal_fields = Vec::new();
|
||||||
|
@ -27,7 +27,7 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
use util::Bytes;
|
use util::Bytes;
|
||||||
use util::hash::H256;
|
use util::hash::H256;
|
||||||
use rlp::{self, Encodable, RlpStream, UntrustedRlp, Stream, View};
|
use rlp::{self, Encodable, RlpStream, UntrustedRlp, View};
|
||||||
|
|
||||||
use super::ManifestData;
|
use super::ManifestData;
|
||||||
|
|
||||||
@ -122,8 +122,8 @@ impl SnapshotWriter for PackedWriter {
|
|||||||
// they are consistent with ours.
|
// they are consistent with ours.
|
||||||
let mut stream = RlpStream::new_list(5);
|
let mut stream = RlpStream::new_list(5);
|
||||||
stream
|
stream
|
||||||
.append(&self.state_hashes)
|
.append_list(&self.state_hashes)
|
||||||
.append(&self.block_hashes)
|
.append_list(&self.block_hashes)
|
||||||
.append(&manifest.state_root)
|
.append(&manifest.state_root)
|
||||||
.append(&manifest.block_number)
|
.append(&manifest.block_number)
|
||||||
.append(&manifest.block_hash);
|
.append(&manifest.block_hash);
|
||||||
|
@ -37,7 +37,7 @@ use util::journaldb::{self, Algorithm, JournalDB};
|
|||||||
use util::kvdb::Database;
|
use util::kvdb::Database;
|
||||||
use util::trie::{TrieDB, TrieDBMut, Trie, TrieMut};
|
use util::trie::{TrieDB, TrieDBMut, Trie, TrieMut};
|
||||||
use util::sha3::SHA3_NULL_RLP;
|
use util::sha3::SHA3_NULL_RLP;
|
||||||
use rlp::{RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{RlpStream, UntrustedRlp, View};
|
||||||
use bloom_journal::Bloom;
|
use bloom_journal::Bloom;
|
||||||
|
|
||||||
use self::block::AbridgedBlock;
|
use self::block::AbridgedBlock;
|
||||||
|
@ -99,7 +99,7 @@ fn chunk_and_restore_40k() { chunk_and_restore(40000) }
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn checks_flag() {
|
fn checks_flag() {
|
||||||
use ::rlp::{RlpStream, Stream};
|
use rlp::RlpStream;
|
||||||
use util::H256;
|
use util::H256;
|
||||||
|
|
||||||
let mut stream = RlpStream::new_list(5);
|
let mut stream = RlpStream::new_list(5);
|
||||||
|
@ -95,7 +95,7 @@ fn snap_and_restore() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn get_code_from_prev_chunk() {
|
fn get_code_from_prev_chunk() {
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use rlp::{RlpStream, Stream};
|
use rlp::RlpStream;
|
||||||
use util::{HashDB, H256, U256, Hashable};
|
use util::{HashDB, H256, U256, Hashable};
|
||||||
|
|
||||||
use account_db::{AccountDBMut, AccountDB};
|
use account_db::{AccountDBMut, AccountDB};
|
||||||
|
@ -64,9 +64,12 @@ impl Into<Generic> for AuthorityRound {
|
|||||||
|
|
||||||
impl Into<Generic> for Tendermint {
|
impl Into<Generic> for Tendermint {
|
||||||
fn into(self) -> Generic {
|
fn into(self) -> Generic {
|
||||||
let mut s = RlpStream::new_list(3);
|
let mut stream = RlpStream::new_list(3);
|
||||||
s.append(&self.round).append(&self.proposal).append(&self.precommits);
|
stream
|
||||||
Generic(s.out())
|
.append(&self.round)
|
||||||
|
.append(&self.proposal)
|
||||||
|
.append_list(&self.precommits);
|
||||||
|
Generic(stream.out())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ use super::genesis::Genesis;
|
|||||||
use super::seal::Generic as GenericSeal;
|
use super::seal::Generic as GenericSeal;
|
||||||
use ethereum;
|
use ethereum;
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use rlp::{Rlp, RlpStream, View, Stream};
|
use rlp::{Rlp, RlpStream, View};
|
||||||
|
|
||||||
/// Parameters common to all engines.
|
/// Parameters common to all engines.
|
||||||
#[derive(Debug, PartialEq, Clone, Default)]
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
|
@ -34,7 +34,7 @@ use devtools::*;
|
|||||||
use miner::Miner;
|
use miner::Miner;
|
||||||
use header::Header;
|
use header::Header;
|
||||||
use transaction::{Action, Transaction, SignedTransaction};
|
use transaction::{Action, Transaction, SignedTransaction};
|
||||||
use rlp::{self, RlpStream, Stream};
|
use rlp::{self, RlpStream};
|
||||||
use views::BlockView;
|
use views::BlockView;
|
||||||
|
|
||||||
#[cfg(feature = "json-tests")]
|
#[cfg(feature = "json-tests")]
|
||||||
@ -129,7 +129,7 @@ pub fn create_test_block_with_data(header: &Header, transactions: &[SignedTransa
|
|||||||
for t in transactions {
|
for t in transactions {
|
||||||
rlp.append_raw(&rlp::encode(t).to_vec(), 1);
|
rlp.append_raw(&rlp::encode(t).to_vec(), 1);
|
||||||
}
|
}
|
||||||
rlp.append(&uncles);
|
rlp.append_list(&uncles);
|
||||||
rlp.out()
|
rlp.out()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ impl Decodable for BlockTracesBloomGroup {
|
|||||||
|
|
||||||
impl Encodable for BlockTracesBloomGroup {
|
impl Encodable for BlockTracesBloomGroup {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
Encodable::rlp_append(&self.blooms, s)
|
s.append_list(&self.blooms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ impl Encodable for LogEntry {
|
|||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
s.begin_list(3);
|
s.begin_list(3);
|
||||||
s.append(&self.address);
|
s.append(&self.address);
|
||||||
s.append(&self.topics);
|
s.append_list(&self.topics);
|
||||||
s.append(&self.data);
|
s.append(&self.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ impl Encodable for Receipt {
|
|||||||
}
|
}
|
||||||
s.append(&self.gas_used);
|
s.append(&self.gas_used);
|
||||||
s.append(&self.log_bloom);
|
s.append(&self.log_bloom);
|
||||||
s.append(&self.logs);
|
s.append_list(&self.logs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ impl ManifestData {
|
|||||||
/// Encode the manifest data to rlp.
|
/// Encode the manifest data to rlp.
|
||||||
pub fn into_rlp(self) -> Bytes {
|
pub fn into_rlp(self) -> Bytes {
|
||||||
let mut stream = RlpStream::new_list(5);
|
let mut stream = RlpStream::new_list(5);
|
||||||
stream.append(&self.state_hashes);
|
stream.append_list(&self.state_hashes);
|
||||||
stream.append(&self.block_hashes);
|
stream.append_list(&self.block_hashes);
|
||||||
stream.append(&self.state_root);
|
stream.append(&self.state_root);
|
||||||
stream.append(&self.block_number);
|
stream.append(&self.block_number);
|
||||||
stream.append(&self.block_hash);
|
stream.append(&self.block_hash);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
//! Trace errors.
|
//! Trace errors.
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use rlp::{RlpEncodable, Encodable, RlpStream, Decodable, Decoder, DecoderError, View};
|
use rlp::{Encodable, RlpStream, Decodable, Decoder, DecoderError, View};
|
||||||
use evm::Error as EvmError;
|
use evm::Error as EvmError;
|
||||||
|
|
||||||
/// Trace evm errors.
|
/// Trace evm errors.
|
||||||
@ -85,7 +85,8 @@ impl Encodable for Error {
|
|||||||
OutOfStack => 4,
|
OutOfStack => 4,
|
||||||
Internal => 5,
|
Internal => 5,
|
||||||
};
|
};
|
||||||
RlpEncodable::rlp_append(&value, s);
|
|
||||||
|
s.append_internal(&value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ impl Encodable for FlatTrace {
|
|||||||
s.append(&self.action);
|
s.append(&self.action);
|
||||||
s.append(&self.result);
|
s.append(&self.result);
|
||||||
s.append(&self.subtraces);
|
s.append(&self.subtraces);
|
||||||
s.append(&self.trace_address.clone().into_iter().collect::<Vec<_>>());
|
s.append_list::<usize, &usize>(&self.trace_address.iter().collect::<Vec<_>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ impl FlatTransactionTraces {
|
|||||||
|
|
||||||
impl Encodable for FlatTransactionTraces {
|
impl Encodable for FlatTransactionTraces {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
Encodable::rlp_append(&self.0, s);
|
s.append_list(&self.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ impl FlatBlockTraces {
|
|||||||
|
|
||||||
impl Encodable for FlatBlockTraces {
|
impl Encodable for FlatBlockTraces {
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
Encodable::rlp_append(&self.0, s);
|
s.append_list(&self.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ impl Encodable for VMExecutedOperation {
|
|||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
s.begin_list(4);
|
s.begin_list(4);
|
||||||
s.append(&self.gas_used);
|
s.append(&self.gas_used);
|
||||||
s.append(&self.stack_push);
|
s.append_list(&self.stack_push);
|
||||||
s.append(&self.mem_diff);
|
s.append(&self.mem_diff);
|
||||||
s.append(&self.store_diff);
|
s.append(&self.store_diff);
|
||||||
}
|
}
|
||||||
@ -551,8 +551,8 @@ impl Encodable for VMTrace {
|
|||||||
s.begin_list(4);
|
s.begin_list(4);
|
||||||
s.append(&self.parent_step);
|
s.append(&self.parent_step);
|
||||||
s.append(&self.code);
|
s.append(&self.code);
|
||||||
s.append(&self.operations);
|
s.append_list(&self.operations);
|
||||||
s.append(&self.subs);
|
s.append_list(&self.subs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(feature="dev", allow(similar_names))]
|
#[cfg_attr(feature="dev", allow(similar_names))]
|
||||||
fn test_verify_block() {
|
fn test_verify_block() {
|
||||||
use rlp::{RlpStream, Stream};
|
use rlp::RlpStream;
|
||||||
|
|
||||||
// Test against morden
|
// Test against morden
|
||||||
let mut good = Header::new();
|
let mut good = Header::new();
|
||||||
@ -460,7 +460,7 @@ mod tests {
|
|||||||
|
|
||||||
let good_uncles = vec![ good_uncle1.clone(), good_uncle2.clone() ];
|
let good_uncles = vec![ good_uncle1.clone(), good_uncle2.clone() ];
|
||||||
let mut uncles_rlp = RlpStream::new();
|
let mut uncles_rlp = RlpStream::new();
|
||||||
uncles_rlp.append(&good_uncles);
|
uncles_rlp.append_list(&good_uncles);
|
||||||
let good_uncles_hash = uncles_rlp.as_raw().sha3();
|
let good_uncles_hash = uncles_rlp.as_raw().sha3();
|
||||||
let good_transactions_root = ordered_trie_root(good_transactions.iter().map(|t| ::rlp::encode::<UnverifiedTransaction>(t).to_vec()));
|
let good_transactions_root = ordered_trie_root(good_transactions.iter().map(|t| ::rlp::encode::<UnverifiedTransaction>(t).to_vec()));
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ impl Manager {
|
|||||||
chunk_size += size;
|
chunk_size += size;
|
||||||
}
|
}
|
||||||
trace!("writing {:?}", &hid_chunk[..]);
|
trace!("writing {:?}", &hid_chunk[..]);
|
||||||
let n = handle.write(&hid_chunk[0..chunk_size])?;
|
let n = handle.write(&hid_chunk[..])?;
|
||||||
if n < chunk_size {
|
if n < chunk_size {
|
||||||
return Err(Error::Protocol("Write data size mismatch"));
|
return Err(Error::Protocol("Write data size mismatch"));
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ build = "build.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethcore-ipc = { path = "../rpc" }
|
ethcore-ipc = { path = "../rpc" }
|
||||||
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git" }
|
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git", branch = "parity-1.7" }
|
||||||
ethcore-ipc-nano = { path = "../nano" }
|
ethcore-ipc-nano = { path = "../nano" }
|
||||||
semver = "0.5"
|
semver = "0.5"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
|
@ -8,6 +8,6 @@ license = "GPL-3.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethcore-ipc = { path = "../rpc" }
|
ethcore-ipc = { path = "../rpc" }
|
||||||
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git" }
|
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git", branch = "parity-1.7" }
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
|
@ -8,6 +8,6 @@ license = "GPL-3.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethcore-devtools = { path = "../../devtools" }
|
ethcore-devtools = { path = "../../devtools" }
|
||||||
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git" }
|
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git", branch = "parity-1.7" }
|
||||||
ethcore-util = { path = "../../util" }
|
ethcore-util = { path = "../../util" }
|
||||||
semver = "0.5"
|
semver = "0.5"
|
||||||
|
@ -11,7 +11,7 @@ path = "run.rs"
|
|||||||
ethcore-ipc = { path = "../rpc" }
|
ethcore-ipc = { path = "../rpc" }
|
||||||
ethcore-devtools = { path = "../../devtools" }
|
ethcore-devtools = { path = "../../devtools" }
|
||||||
semver = "0.5"
|
semver = "0.5"
|
||||||
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git" }
|
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git", branch = "parity-1.7" }
|
||||||
ethcore-ipc-nano = { path = "../nano" }
|
ethcore-ipc-nano = { path = "../nano" }
|
||||||
ethcore-util = { path = "../../util" }
|
ethcore-util = { path = "../../util" }
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
|
@ -79,7 +79,7 @@ impl IpfsHandler {
|
|||||||
fn block_list(&self, hash: H256) -> Result<Out> {
|
fn block_list(&self, hash: H256) -> Result<Out> {
|
||||||
let uncles = self.client().find_uncles(&hash).ok_or(Error::BlockNotFound)?;
|
let uncles = self.client().find_uncles(&hash).ok_or(Error::BlockNotFound)?;
|
||||||
|
|
||||||
Ok(Out::OctetStream(rlp::encode(&uncles).to_vec()))
|
Ok(Out::OctetStream(rlp::encode_list(&uncles).to_vec()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get transaction by hash and return as raw binary.
|
/// Get transaction by hash and return as raw binary.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "parity.js",
|
"name": "parity.js",
|
||||||
"version": "1.7.18",
|
"version": "1.7.19",
|
||||||
"main": "release/index.js",
|
"main": "release/index.js",
|
||||||
"jsnext:main": "src/index.js",
|
"jsnext:main": "src/index.js",
|
||||||
"author": "Parity Team <admin@parity.io>",
|
"author": "Parity Team <admin@parity.io>",
|
||||||
|
@ -120,20 +120,22 @@ export default class HardwareStore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createAccountInfo (entry) {
|
createAccountInfo (entry, original = {}) {
|
||||||
const { address, manufacturer, name } = entry;
|
const { address, manufacturer, name } = entry;
|
||||||
|
|
||||||
return Promise
|
return Promise
|
||||||
.all([
|
.all([
|
||||||
this._api.parity.setAccountName(address, name),
|
original.name
|
||||||
this._api.parity.setAccountMeta(address, {
|
? Promise.resolve(true)
|
||||||
|
: this._api.parity.setAccountName(address, name),
|
||||||
|
this._api.parity.setAccountMeta(address, Object.assign({
|
||||||
description: `${manufacturer} ${name}`,
|
description: `${manufacturer} ${name}`,
|
||||||
hardware: {
|
hardware: {
|
||||||
manufacturer
|
manufacturer
|
||||||
},
|
},
|
||||||
tags: ['hardware'],
|
tags: ['hardware'],
|
||||||
timestamp: Date.now()
|
timestamp: Date.now()
|
||||||
})
|
}, original.meta || {}))
|
||||||
])
|
])
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('HardwareStore::createEntry', error);
|
console.warn('HardwareStore::createEntry', error);
|
||||||
|
@ -130,25 +130,58 @@ describe('mobx/HardwareStore', () => {
|
|||||||
|
|
||||||
describe('operations', () => {
|
describe('operations', () => {
|
||||||
describe('createAccountInfo', () => {
|
describe('createAccountInfo', () => {
|
||||||
beforeEach(() => {
|
describe('when not existing', () => {
|
||||||
return store.createAccountInfo({
|
beforeEach(() => {
|
||||||
address: 'testAddr',
|
return store.createAccountInfo({
|
||||||
manufacturer: 'testMfg',
|
address: 'testAddr',
|
||||||
name: 'testName'
|
manufacturer: 'testMfg',
|
||||||
|
name: 'testName'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('calls into parity_setAccountName', () => {
|
||||||
|
expect(api.parity.setAccountName).to.have.been.calledWith('testAddr', 'testName');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('calls into parity_setAccountMeta', () => {
|
||||||
|
expect(api.parity.setAccountMeta).to.have.been.calledWith('testAddr', sinon.match({
|
||||||
|
description: 'testMfg testName',
|
||||||
|
hardware: {
|
||||||
|
manufacturer: 'testMfg'
|
||||||
|
},
|
||||||
|
tags: ['hardware']
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls into parity_setAccountName', () => {
|
describe('when already exists', () => {
|
||||||
expect(api.parity.setAccountName).to.have.been.calledWith('testAddr', 'testName');
|
beforeEach(() => {
|
||||||
});
|
return store.createAccountInfo({
|
||||||
|
address: 'testAddr',
|
||||||
|
manufacturer: 'testMfg',
|
||||||
|
name: 'testName'
|
||||||
|
}, {
|
||||||
|
name: 'originalName',
|
||||||
|
meta: {
|
||||||
|
description: 'originalDescription',
|
||||||
|
tags: ['tagA', 'tagB']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('calls into parity_setAccountMeta', () => {
|
it('does not call into parity_setAccountName', () => {
|
||||||
expect(api.parity.setAccountMeta).to.have.been.calledWith('testAddr', sinon.match({
|
expect(api.parity.setAccountName).not.to.have.been.called;
|
||||||
description: 'testMfg testName',
|
});
|
||||||
hardware: {
|
|
||||||
manufacturer: 'testMfg'
|
it('calls into parity_setAccountMeta', () => {
|
||||||
}
|
expect(api.parity.setAccountMeta).to.have.been.calledWith('testAddr', sinon.match({
|
||||||
}));
|
description: 'originalDescription',
|
||||||
|
hardware: {
|
||||||
|
manufacturer: 'testMfg'
|
||||||
|
},
|
||||||
|
tags: ['tagA', 'tagB']
|
||||||
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -68,12 +68,13 @@ $popoverZ: 3600;
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.modal {
|
&.modal {
|
||||||
|
z-index: $modalZ;
|
||||||
|
|
||||||
&:not(.small) {
|
&:not(.small) {
|
||||||
bottom: $modalBottom;
|
bottom: $modalBottom;
|
||||||
left: $modalLeft;
|
left: $modalLeft;
|
||||||
right: $modalRight;
|
right: $modalRight;
|
||||||
top: $modalTop;
|
top: $modalTop;
|
||||||
z-index: $modalZ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Small Portals don't adjust their overall height like we have with the
|
/* TODO: Small Portals don't adjust their overall height like we have with the
|
||||||
|
@ -394,8 +394,12 @@ class Accounts extends Component {
|
|||||||
|
|
||||||
Object
|
Object
|
||||||
.keys(wallets)
|
.keys(wallets)
|
||||||
.filter((address) => !accountsInfo[address])
|
.filter((address) => {
|
||||||
.forEach((address) => this.hwstore.createAccountInfo(wallets[address]));
|
const account = accountsInfo[address];
|
||||||
|
|
||||||
|
return !account || !account.meta || !account.meta.hardware;
|
||||||
|
})
|
||||||
|
.forEach((address) => this.hwstore.createAccountInfo(wallets[address], accountsInfo[address]));
|
||||||
|
|
||||||
this.setVisibleAccounts();
|
this.setVisibleAccounts();
|
||||||
}
|
}
|
||||||
|
122
js/src/views/Accounts/accounts.spec.js
Normal file
122
js/src/views/Accounts/accounts.spec.js
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
|
import React from 'react';
|
||||||
|
import sinon from 'sinon';
|
||||||
|
|
||||||
|
import Accounts from './';
|
||||||
|
|
||||||
|
let api;
|
||||||
|
let component;
|
||||||
|
let hwstore;
|
||||||
|
let instance;
|
||||||
|
let redux;
|
||||||
|
|
||||||
|
function createApi () {
|
||||||
|
api = {};
|
||||||
|
|
||||||
|
return api;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createHwStore (walletAddress = '0x456') {
|
||||||
|
hwstore = {
|
||||||
|
wallets: {
|
||||||
|
[walletAddress]: {
|
||||||
|
address: walletAddress
|
||||||
|
}
|
||||||
|
},
|
||||||
|
createAccountInfo: sinon.stub()
|
||||||
|
};
|
||||||
|
|
||||||
|
return hwstore;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createRedux () {
|
||||||
|
redux = {
|
||||||
|
dispatch: sinon.stub(),
|
||||||
|
subscribe: sinon.stub(),
|
||||||
|
getState: () => {
|
||||||
|
return {
|
||||||
|
personal: {
|
||||||
|
accounts: {},
|
||||||
|
accountsInfo: {
|
||||||
|
'0x123': { meta: '1' },
|
||||||
|
'0x999': { meta: { hardware: {} } }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
balances: {
|
||||||
|
balances: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return redux;
|
||||||
|
}
|
||||||
|
|
||||||
|
function render (props = {}) {
|
||||||
|
component = shallow(
|
||||||
|
<Accounts { ...props } />,
|
||||||
|
{
|
||||||
|
context: {
|
||||||
|
store: createRedux()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).find('Accounts').shallow({
|
||||||
|
context: {
|
||||||
|
api: createApi()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
instance = component.instance();
|
||||||
|
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('views/Accounts', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
render();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders defaults', () => {
|
||||||
|
expect(component).to.be.ok;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('instance event methods', () => {
|
||||||
|
describe('onHardwareChange', () => {
|
||||||
|
it('detects completely new entries', () => {
|
||||||
|
instance.hwstore = createHwStore();
|
||||||
|
instance.onHardwareChange();
|
||||||
|
|
||||||
|
expect(hwstore.createAccountInfo).to.have.been.calledWith({ address: '0x456' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('detects addressbook entries', () => {
|
||||||
|
instance.hwstore = createHwStore('0x123');
|
||||||
|
instance.onHardwareChange();
|
||||||
|
|
||||||
|
expect(hwstore.createAccountInfo).to.have.been.calledWith({ address: '0x123' }, { meta: '1' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('ignores existing hardware entries', () => {
|
||||||
|
instance.hwstore = createHwStore('0x999');
|
||||||
|
instance.onHardwareChange();
|
||||||
|
|
||||||
|
expect(hwstore.createAccountInfo).not.to.have.been.called;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -40,7 +40,6 @@ export default class Queries extends Component {
|
|||||||
if (!contract) {
|
if (!contract) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const queries = contract.functions
|
const queries = contract.functions
|
||||||
.filter((fn) => fn.constant)
|
.filter((fn) => fn.constant)
|
||||||
.sort(this._sortEntries);
|
.sort(this._sortEntries);
|
||||||
@ -113,7 +112,12 @@ export default class Queries extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderQuery (fn) {
|
renderQuery (fn) {
|
||||||
const { values } = this.props;
|
const { abi } = fn;
|
||||||
|
let values = this.props.values[fn.name] || [];
|
||||||
|
|
||||||
|
if (values && typeof values.slice === 'function') {
|
||||||
|
values = values.slice();
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.container } key={ fn.signature }>
|
<div className={ styles.container } key={ fn.signature }>
|
||||||
@ -125,40 +129,59 @@ export default class Queries extends Component {
|
|||||||
<CardText
|
<CardText
|
||||||
className={ styles.methodContent }
|
className={ styles.methodContent }
|
||||||
>
|
>
|
||||||
{ this.renderValue(values[fn.name], fn.outputs[0].kind.type) }
|
{
|
||||||
|
abi.outputs
|
||||||
|
.map((output, index) => this.renderValue(values[index], output, index))
|
||||||
|
}
|
||||||
</CardText>
|
</CardText>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderValue (value, type) {
|
renderValue (tokenValue, output, key) {
|
||||||
if (typeof value === 'undefined') {
|
if (typeof tokenValue === 'undefined') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { api } = this.context;
|
|
||||||
const { accountsInfo } = this.props;
|
const { accountsInfo } = this.props;
|
||||||
|
const { name, type } = output;
|
||||||
|
const label = `${name ? `${name}: ` : ''}${type}`;
|
||||||
|
const value = this.getTokenValue(tokenValue);
|
||||||
|
|
||||||
let valueToDisplay = value;
|
|
||||||
|
|
||||||
if (api.util.isArray(value)) {
|
|
||||||
valueToDisplay = api.util.bytesToHex(value);
|
|
||||||
} else if (typeof value === 'boolean') {
|
|
||||||
valueToDisplay = value ? 'true' : 'false';
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<TypedInput
|
<TypedInput
|
||||||
accounts={ accountsInfo }
|
accounts={ accountsInfo }
|
||||||
allowCopy
|
allowCopy
|
||||||
|
key={ key }
|
||||||
isEth={ false }
|
isEth={ false }
|
||||||
param={ type }
|
label={ label }
|
||||||
|
param={ output.type }
|
||||||
readOnly
|
readOnly
|
||||||
value={ valueToDisplay }
|
value={ value }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTokenValue (token) {
|
||||||
|
const { api } = this.context;
|
||||||
|
const { type, value } = token;
|
||||||
|
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return 'no data';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'array' || type === 'fixedArray') {
|
||||||
|
return value.map((tok) => this.getTokenValue(tok));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return api.util.bytesToHex(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
_sortEntries (a, b) {
|
_sortEntries (a, b) {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
}
|
}
|
||||||
|
@ -363,12 +363,15 @@ class Contract extends Component {
|
|||||||
.filter((fn) => !fn.inputs.length);
|
.filter((fn) => !fn.inputs.length);
|
||||||
|
|
||||||
Promise
|
Promise
|
||||||
.all(queries.map((query) => query.call()))
|
.all(queries.map((query) => query.call({ rawTokens: true })))
|
||||||
.then(results => {
|
.then(results => {
|
||||||
const values = queries.reduce((object, fn, idx) => {
|
const values = queries.reduce((object, fn, idx) => {
|
||||||
const key = fn.name;
|
const key = fn.name;
|
||||||
|
|
||||||
object[key] = results[idx];
|
object[key] = fn.outputs.length === 1
|
||||||
|
? [ results[idx] ]
|
||||||
|
: results[idx];
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ serde_json = "0.9"
|
|||||||
serde_derive = "0.9"
|
serde_derive = "0.9"
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
time = "0.1"
|
time = "0.1"
|
||||||
transient-hashmap = "0.1"
|
transient-hashmap = "0.4"
|
||||||
order-stat = "0.1"
|
order-stat = "0.1"
|
||||||
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch = "parity-1.6" }
|
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git", branch = "parity-1.6" }
|
||||||
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git", branch = "parity-1.6" }
|
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git", branch = "parity-1.6" }
|
||||||
|
@ -25,7 +25,7 @@ use light::cache::Cache as LightDataCache;
|
|||||||
use light::client::LightChainClient;
|
use light::client::LightChainClient;
|
||||||
use light::on_demand::{request, OnDemand};
|
use light::on_demand::{request, OnDemand};
|
||||||
use light::TransactionQueue as LightTransactionQueue;
|
use light::TransactionQueue as LightTransactionQueue;
|
||||||
use rlp::{self, Stream as StreamRlp};
|
use rlp;
|
||||||
use util::{Address, H520, H256, U256, Uint, Bytes, Mutex, RwLock};
|
use util::{Address, H520, H256, U256, Uint, Bytes, Mutex, RwLock};
|
||||||
use util::sha3::Hashable;
|
use util::sha3::Hashable;
|
||||||
use stats::Corpus;
|
use stats::Corpus;
|
||||||
|
@ -38,5 +38,6 @@ pub use self::requests::{
|
|||||||
};
|
};
|
||||||
pub use self::signing_queue::{
|
pub use self::signing_queue::{
|
||||||
ConfirmationsQueue, ConfirmationPromise, ConfirmationResult, SigningQueue, QueueEvent, DefaultAccount,
|
ConfirmationsQueue, ConfirmationPromise, ConfirmationResult, SigningQueue, QueueEvent, DefaultAccount,
|
||||||
|
QUEUE_LIMIT as SIGNING_QUEUE_LIMIT,
|
||||||
};
|
};
|
||||||
pub use self::signer::SignerService;
|
pub use self::signer::SignerService;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
use transient_hashmap::{TransientHashMap, Timer, StandardTimer};
|
use transient_hashmap::{TransientHashMap, Timer, StandardTimer};
|
||||||
|
|
||||||
/// Lifetime of poll (in seconds).
|
/// Lifetime of poll (in seconds).
|
||||||
const POLL_LIFETIME: u64 = 60;
|
const POLL_LIFETIME: u32 = 60;
|
||||||
|
|
||||||
pub type PollId = usize;
|
pub type PollId = usize;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use ethstore::random_string;
|
|||||||
|
|
||||||
use v1::helpers::signing_queue::{ConfirmationsQueue};
|
use v1::helpers::signing_queue::{ConfirmationsQueue};
|
||||||
|
|
||||||
const TOKEN_LIFETIME_SECS: u64 = 3600;
|
const TOKEN_LIFETIME_SECS: u32 = 3600;
|
||||||
|
|
||||||
/// Manages communication with Signer crate
|
/// Manages communication with Signer crate
|
||||||
pub struct SignerService {
|
pub struct SignerService {
|
||||||
|
@ -77,7 +77,7 @@ pub enum QueueAddError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO [todr] to consider: timeout instead of limit?
|
// TODO [todr] to consider: timeout instead of limit?
|
||||||
const QUEUE_LIMIT: usize = 50;
|
pub const QUEUE_LIMIT: usize = 50;
|
||||||
|
|
||||||
/// A queue of transactions awaiting to be confirmed and signed.
|
/// A queue of transactions awaiting to be confirmed and signed.
|
||||||
pub trait SigningQueue: Send + Sync {
|
pub trait SigningQueue: Send + Sync {
|
||||||
|
@ -28,7 +28,7 @@ use util::sha3;
|
|||||||
use jsonrpc_core::Error;
|
use jsonrpc_core::Error;
|
||||||
use v1::helpers::errors;
|
use v1::helpers::errors;
|
||||||
use v1::traits::ParitySet;
|
use v1::traits::ParitySet;
|
||||||
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo};
|
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction};
|
||||||
|
|
||||||
/// Parity-specific rpc interface for operations altering the settings.
|
/// Parity-specific rpc interface for operations altering the settings.
|
||||||
pub struct ParitySetClient<F> {
|
pub struct ParitySetClient<F> {
|
||||||
@ -139,4 +139,8 @@ impl<F: Fetch> ParitySet for ParitySetClient<F> {
|
|||||||
fn execute_upgrade(&self) -> Result<bool, Error> {
|
fn execute_upgrade(&self) -> Result<bool, Error> {
|
||||||
Err(errors::light_unimplemented(None))
|
Err(errors::light_unimplemented(None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn remove_transaction(&self, _hash: H256) -> Result<Option<Transaction>, Error> {
|
||||||
|
Err(errors::light_unimplemented(None))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,10 @@ use updater::{Service as UpdateService};
|
|||||||
use jsonrpc_core::Error;
|
use jsonrpc_core::Error;
|
||||||
use v1::helpers::errors;
|
use v1::helpers::errors;
|
||||||
use v1::traits::ParitySet;
|
use v1::traits::ParitySet;
|
||||||
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo};
|
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction};
|
||||||
|
|
||||||
/// Parity-specific rpc interface for operations altering the settings.
|
/// Parity-specific rpc interface for operations altering the settings.
|
||||||
pub struct ParitySetClient<C, M, U, F=fetch::Client> where
|
pub struct ParitySetClient<C, M, U, F = fetch::Client> {
|
||||||
C: MiningBlockChainClient,
|
|
||||||
M: MinerService,
|
|
||||||
U: UpdateService,
|
|
||||||
F: Fetch,
|
|
||||||
{
|
|
||||||
client: Weak<C>,
|
client: Weak<C>,
|
||||||
miner: Weak<M>,
|
miner: Weak<M>,
|
||||||
updater: Weak<U>,
|
updater: Weak<U>,
|
||||||
@ -46,12 +41,7 @@ pub struct ParitySetClient<C, M, U, F=fetch::Client> where
|
|||||||
fetch: F,
|
fetch: F,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, M, U, F> ParitySetClient<C, M, U, F> where
|
impl<C, M, U, F> ParitySetClient<C, M, U, F> {
|
||||||
C: MiningBlockChainClient,
|
|
||||||
M: MinerService,
|
|
||||||
U: UpdateService,
|
|
||||||
F: Fetch,
|
|
||||||
{
|
|
||||||
/// Creates new `ParitySetClient` with given `Fetch`.
|
/// Creates new `ParitySetClient` with given `Fetch`.
|
||||||
pub fn new(client: &Arc<C>, miner: &Arc<M>, updater: &Arc<U>, net: &Arc<ManageNetwork>, fetch: F) -> Self {
|
pub fn new(client: &Arc<C>, miner: &Arc<M>, updater: &Arc<U>, net: &Arc<ManageNetwork>, fetch: F) -> Self {
|
||||||
ParitySetClient {
|
ParitySetClient {
|
||||||
@ -181,4 +171,12 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
|
|||||||
let updater = take_weak!(self.updater);
|
let updater = take_weak!(self.updater);
|
||||||
Ok(updater.execute_upgrade())
|
Ok(updater.execute_upgrade())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn remove_transaction(&self, hash: H256) -> Result<Option<Transaction>, Error> {
|
||||||
|
let miner = take_weak!(self.miner);
|
||||||
|
let client = take_weak!(self.client);
|
||||||
|
let hash = hash.into();
|
||||||
|
|
||||||
|
Ok(miner.remove_pending_transaction(&*client, &hash).map(Into::into))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ use jsonrpc_core::Error;
|
|||||||
use v1::helpers::{
|
use v1::helpers::{
|
||||||
errors,
|
errors,
|
||||||
DefaultAccount,
|
DefaultAccount,
|
||||||
SigningQueue, ConfirmationPromise, ConfirmationResult, SignerService
|
SIGNING_QUEUE_LIMIT, SigningQueue, ConfirmationPromise, ConfirmationResult, SignerService
|
||||||
};
|
};
|
||||||
use v1::helpers::dispatch::{self, Dispatcher};
|
use v1::helpers::dispatch::{self, Dispatcher};
|
||||||
use v1::metadata::Metadata;
|
use v1::metadata::Metadata;
|
||||||
@ -42,7 +42,10 @@ use v1::types::{
|
|||||||
Origin,
|
Origin,
|
||||||
};
|
};
|
||||||
|
|
||||||
const MAX_PENDING_DURATION: u64 = 60 * 60;
|
/// After 60s entries that are not queried with `check_request` will get garbage collected.
|
||||||
|
const MAX_PENDING_DURATION_SEC: u32 = 60;
|
||||||
|
/// Max number of total requests pending and completed, before we start garbage collecting them.
|
||||||
|
const MAX_TOTAL_REQUESTS: usize = SIGNING_QUEUE_LIMIT;
|
||||||
|
|
||||||
enum DispatchResult {
|
enum DispatchResult {
|
||||||
Promise(ConfirmationPromise),
|
Promise(ConfirmationPromise),
|
||||||
@ -71,6 +74,21 @@ fn handle_dispatch<OnResponse>(res: Result<DispatchResult, Error>, on_response:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn collect_garbage(map: &mut TransientHashMap<U256, ConfirmationPromise>) {
|
||||||
|
map.prune();
|
||||||
|
if map.len() > MAX_TOTAL_REQUESTS {
|
||||||
|
// Remove all non-waiting entries.
|
||||||
|
let non_waiting: Vec<_> = map
|
||||||
|
.iter()
|
||||||
|
.filter(|&(_, val)| val.result() != ConfirmationResult::Waiting)
|
||||||
|
.map(|(key, _)| *key)
|
||||||
|
.collect();
|
||||||
|
for k in non_waiting {
|
||||||
|
map.remove(&k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<D: Dispatcher + 'static> SigningQueueClient<D> {
|
impl<D: Dispatcher + 'static> SigningQueueClient<D> {
|
||||||
/// Creates a new signing queue client given shared signing queue.
|
/// Creates a new signing queue client given shared signing queue.
|
||||||
pub fn new(signer: &Arc<SignerService>, dispatcher: D, accounts: &Arc<AccountProvider>) -> Self {
|
pub fn new(signer: &Arc<SignerService>, dispatcher: D, accounts: &Arc<AccountProvider>) -> Self {
|
||||||
@ -78,7 +96,7 @@ impl<D: Dispatcher + 'static> SigningQueueClient<D> {
|
|||||||
signer: Arc::downgrade(signer),
|
signer: Arc::downgrade(signer),
|
||||||
accounts: Arc::downgrade(accounts),
|
accounts: Arc::downgrade(accounts),
|
||||||
dispatcher: dispatcher,
|
dispatcher: dispatcher,
|
||||||
pending: Arc::new(Mutex::new(TransientHashMap::new(MAX_PENDING_DURATION))),
|
pending: Arc::new(Mutex::new(TransientHashMap::new(MAX_PENDING_DURATION_SEC))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +142,10 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
|
|||||||
DispatchResult::Value(v) => RpcEither::Or(v),
|
DispatchResult::Value(v) => RpcEither::Or(v),
|
||||||
DispatchResult::Promise(promise) => {
|
DispatchResult::Promise(promise) => {
|
||||||
let id = promise.id();
|
let id = promise.id();
|
||||||
pending.lock().insert(id, promise);
|
let mut pending = pending.lock();
|
||||||
|
collect_garbage(&mut pending);
|
||||||
|
pending.insert(id, promise);
|
||||||
|
|
||||||
RpcEither::Either(id.into())
|
RpcEither::Either(id.into())
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -138,7 +159,10 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
|
|||||||
DispatchResult::Value(v) => RpcEither::Or(v),
|
DispatchResult::Value(v) => RpcEither::Or(v),
|
||||||
DispatchResult::Promise(promise) => {
|
DispatchResult::Promise(promise) => {
|
||||||
let id = promise.id();
|
let id = promise.id();
|
||||||
pending.lock().insert(id, promise);
|
let mut pending = pending.lock();
|
||||||
|
collect_garbage(&mut pending);
|
||||||
|
pending.insert(id, promise);
|
||||||
|
|
||||||
RpcEither::Either(id.into())
|
RpcEither::Either(id.into())
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -146,18 +170,15 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_request(&self, id: RpcU256) -> Result<Option<RpcConfirmationResponse>, Error> {
|
fn check_request(&self, id: RpcU256) -> Result<Option<RpcConfirmationResponse>, Error> {
|
||||||
let mut pending = self.pending.lock();
|
|
||||||
let id: U256 = id.into();
|
let id: U256 = id.into();
|
||||||
let res = match pending.get(&id) {
|
match self.pending.lock().get(&id) {
|
||||||
Some(ref promise) => match promise.result() {
|
Some(ref promise) => match promise.result() {
|
||||||
ConfirmationResult::Waiting => { return Ok(None); }
|
ConfirmationResult::Waiting => Ok(None),
|
||||||
ConfirmationResult::Rejected => Err(errors::request_rejected()),
|
ConfirmationResult::Rejected => Err(errors::request_rejected()),
|
||||||
ConfirmationResult::Confirmed(rpc_response) => rpc_response.map(Some),
|
ConfirmationResult::Confirmed(rpc_response) => rpc_response.map(Some),
|
||||||
},
|
},
|
||||||
_ => { return Err(errors::request_not_found()); }
|
_ => Err(errors::request_not_found()),
|
||||||
};
|
}
|
||||||
pending.remove(&id);
|
|
||||||
res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decrypt_message(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes, Error> {
|
fn decrypt_message(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes, Error> {
|
||||||
|
@ -221,6 +221,10 @@ impl MinerService for TestMinerService {
|
|||||||
self.pending_transactions.lock().get(hash).cloned().map(Into::into)
|
self.pending_transactions.lock().get(hash).cloned().map(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn remove_pending_transaction(&self, _chain: &MiningBlockChainClient, hash: &H256) -> Option<PendingTransaction> {
|
||||||
|
self.pending_transactions.lock().remove(hash).map(Into::into)
|
||||||
|
}
|
||||||
|
|
||||||
fn pending_transactions(&self) -> Vec<PendingTransaction> {
|
fn pending_transactions(&self) -> Vec<PendingTransaction> {
|
||||||
self.pending_transactions.lock().values().cloned().map(Into::into).collect()
|
self.pending_transactions.lock().values().cloned().map(Into::into).collect()
|
||||||
}
|
}
|
||||||
|
@ -204,3 +204,31 @@ fn rpc_parity_set_hash_content() {
|
|||||||
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
|
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rpc_parity_remove_transaction() {
|
||||||
|
use ethcore::transaction::{Transaction, Action};
|
||||||
|
|
||||||
|
let miner = miner_service();
|
||||||
|
let client = client_service();
|
||||||
|
let network = network_service();
|
||||||
|
let updater = updater_service();
|
||||||
|
let mut io = IoHandler::new();
|
||||||
|
io.extend_with(parity_set_client(&client, &miner, &updater, &network).to_delegate());
|
||||||
|
|
||||||
|
let tx = Transaction {
|
||||||
|
nonce: 1.into(),
|
||||||
|
gas_price: 0x9184e72a000u64.into(),
|
||||||
|
gas: 0x76c0.into(),
|
||||||
|
action: Action::Call(5.into()),
|
||||||
|
value: 0x9184e72au64.into(),
|
||||||
|
data: vec![]
|
||||||
|
};
|
||||||
|
let signed = tx.fake_sign(2.into());
|
||||||
|
let hash = signed.hash();
|
||||||
|
|
||||||
|
let request = r#"{"jsonrpc": "2.0", "method": "parity_removeTransaction", "params":[""#.to_owned() + &format!("0x{:?}", hash) + r#""], "id": 1}"#;
|
||||||
|
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"condition":null,"creates":null,"from":"0x0000000000000000000000000000000000000002","gas":"0x76c0","gasPrice":"0x9184e72a000","hash":"0x0072c69d780cdfbfc02fed5c7d184151f9a166971d045e55e27695aaa5bcb55e","input":"0x","networkId":null,"nonce":"0x1","publicKey":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","r":"0x0","raw":"0xe9018609184e72a0008276c0940000000000000000000000000000000000000005849184e72a80808080","s":"0x0","standardV":"0x4","to":"0x0000000000000000000000000000000000000005","transactionIndex":null,"v":"0x0","value":"0x9184e72a"},"id":1}"#;
|
||||||
|
|
||||||
|
miner.pending_transactions.lock().insert(hash, signed);
|
||||||
|
assert_eq!(io.handle_request_sync(&request), Some(response.to_owned()));
|
||||||
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
use jsonrpc_core::Error;
|
use jsonrpc_core::Error;
|
||||||
use futures::BoxFuture;
|
use futures::BoxFuture;
|
||||||
|
|
||||||
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo};
|
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction};
|
||||||
|
|
||||||
build_rpc_trait! {
|
build_rpc_trait! {
|
||||||
/// Parity-specific rpc interface for operations altering the settings.
|
/// Parity-specific rpc interface for operations altering the settings.
|
||||||
@ -103,5 +103,14 @@ build_rpc_trait! {
|
|||||||
/// Execute a release which is ready according to upgrade_ready().
|
/// Execute a release which is ready according to upgrade_ready().
|
||||||
#[rpc(name = "parity_executeUpgrade")]
|
#[rpc(name = "parity_executeUpgrade")]
|
||||||
fn execute_upgrade(&self) -> Result<bool, Error>;
|
fn execute_upgrade(&self) -> Result<bool, Error>;
|
||||||
|
|
||||||
|
/// Removes transaction from transaction queue.
|
||||||
|
/// Makes sense only for transactions that were not propagated to other peers yet
|
||||||
|
/// like scheduled transactions or transactions in future.
|
||||||
|
/// It might also work for some local transactions with to low gas price
|
||||||
|
/// or excessive gas limit that are not accepted by other peers whp.
|
||||||
|
/// Returns `true` when transaction was removed, `false` if it was not found.
|
||||||
|
#[rpc(name = "parity_removeTransaction")]
|
||||||
|
fn remove_transaction(&self, H256) -> Result<Option<Transaction>, Error>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Parity Daemon
|
Description=Parity Daemon
|
||||||
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=%h/.parity/parity.conf
|
EnvironmentFile=%h/.parity/parity.conf
|
||||||
|
@ -2177,7 +2177,7 @@ mod tests {
|
|||||||
use util::sha3::Hashable;
|
use util::sha3::Hashable;
|
||||||
use util::hash::H256;
|
use util::hash::H256;
|
||||||
use util::bytes::Bytes;
|
use util::bytes::Bytes;
|
||||||
use rlp::{Rlp, RlpStream, UntrustedRlp, View, Stream};
|
use rlp::{Rlp, RlpStream, UntrustedRlp, View};
|
||||||
use super::*;
|
use super::*;
|
||||||
use ::SyncConfig;
|
use ::SyncConfig;
|
||||||
use super::{PeerInfo, PeerAsking};
|
use super::{PeerInfo, PeerAsking};
|
||||||
|
@ -213,7 +213,7 @@ impl Discovery {
|
|||||||
let nearest = Discovery::nearest_node_entries(&self.discovery_id, &self.node_buckets).into_iter();
|
let nearest = Discovery::nearest_node_entries(&self.discovery_id, &self.node_buckets).into_iter();
|
||||||
let nearest = nearest.filter(|x| !self.discovery_nodes.contains(&x.id)).take(ALPHA).collect::<Vec<_>>();
|
let nearest = nearest.filter(|x| !self.discovery_nodes.contains(&x.id)).take(ALPHA).collect::<Vec<_>>();
|
||||||
for r in nearest {
|
for r in nearest {
|
||||||
let rlp = encode(&(&[self.discovery_id.clone()][..]));
|
let rlp = encode_list(&(&[self.discovery_id.clone()][..]));
|
||||||
self.send_packet(PACKET_FIND_NODE, &r.endpoint.udp_address(), &rlp);
|
self.send_packet(PACKET_FIND_NODE, &r.endpoint.udp_address(), &rlp);
|
||||||
self.discovery_nodes.insert(r.id.clone());
|
self.discovery_nodes.insert(r.id.clone());
|
||||||
tried_count += 1;
|
tried_count += 1;
|
||||||
|
@ -463,7 +463,7 @@ impl Session {
|
|||||||
rlp.begin_list(5)
|
rlp.begin_list(5)
|
||||||
.append(&host.protocol_version)
|
.append(&host.protocol_version)
|
||||||
.append(&host.client_version)
|
.append(&host.client_version)
|
||||||
.append(&host.capabilities)
|
.append_list(&host.capabilities)
|
||||||
.append(&host.local_endpoint.address.port())
|
.append(&host.local_endpoint.address.port())
|
||||||
.append(host.id());
|
.append(host.id());
|
||||||
self.send(io, rlp)
|
self.send(io, rlp)
|
||||||
|
@ -10,3 +10,4 @@ elastic-array = { git = "https://github.com/ethcore/elastic-array" }
|
|||||||
ethcore-bigint = { path = "../bigint" }
|
ethcore-bigint = { path = "../bigint" }
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
|
byteorder = "1.0"
|
||||||
|
@ -17,152 +17,9 @@
|
|||||||
//! Unified interfaces for RLP bytes operations on basic types
|
//! Unified interfaces for RLP bytes operations on basic types
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use std::mem;
|
use std::{mem, fmt, cmp};
|
||||||
use std::fmt;
|
|
||||||
use std::cmp::Ordering;
|
|
||||||
use std::error::Error as StdError;
|
use std::error::Error as StdError;
|
||||||
use bigint::prelude::{Uint, U128, U256, H64, H128, H160, H256, H512, H520, H2048};
|
use bigint::prelude::{U128, U256, H64, H128, H160, H256, H512, H520, H2048};
|
||||||
use elastic_array::*;
|
|
||||||
|
|
||||||
/// Vector like object
|
|
||||||
pub trait VecLike<T> {
|
|
||||||
/// Add an element to the collection
|
|
||||||
fn vec_push(&mut self, value: T);
|
|
||||||
|
|
||||||
/// Add a slice to the collection
|
|
||||||
fn vec_extend(&mut self, slice: &[T]);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> VecLike<T> for Vec<T> where T: Copy {
|
|
||||||
fn vec_push(&mut self, value: T) {
|
|
||||||
Vec::<T>::push(self, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn vec_extend(&mut self, slice: &[T]) {
|
|
||||||
Vec::<T>::extend_from_slice(self, slice)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! impl_veclike_for_elastic_array {
|
|
||||||
($from: ident) => {
|
|
||||||
impl<T> VecLike<T> for $from<T> where T: Copy {
|
|
||||||
fn vec_push(&mut self, value: T) {
|
|
||||||
$from::<T>::push(self, value)
|
|
||||||
}
|
|
||||||
fn vec_extend(&mut self, slice: &[T]) {
|
|
||||||
$from::<T>::append_slice(self, slice)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_veclike_for_elastic_array!(ElasticArray16);
|
|
||||||
impl_veclike_for_elastic_array!(ElasticArray32);
|
|
||||||
impl_veclike_for_elastic_array!(ElasticArray1024);
|
|
||||||
|
|
||||||
/// Converts given type to its shortest representation in bytes
|
|
||||||
///
|
|
||||||
/// TODO: optimise some conversations
|
|
||||||
pub trait ToBytes {
|
|
||||||
/// Serialize self to byte array
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V);
|
|
||||||
/// Get length of serialized data in bytes
|
|
||||||
fn to_bytes_len(&self) -> usize;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl <'a> ToBytes for &'a str {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
out.vec_extend(self.as_bytes());
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_bytes_len(&self) -> usize {
|
|
||||||
self.as_bytes().len()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToBytes for String {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
out.vec_extend(self.as_bytes());
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_bytes_len(&self) -> usize {
|
|
||||||
self.len()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToBytes for u64 {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
let count = self.to_bytes_len();
|
|
||||||
for i in 0..count {
|
|
||||||
let j = count - 1 - i;
|
|
||||||
out.vec_push((*self >> (j * 8)) as u8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_bytes_len(&self) -> usize { 8 - self.leading_zeros() as usize / 8 }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToBytes for bool {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
out.vec_push(if *self { 1u8 } else { 0u8 })
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_bytes_len(&self) -> usize { 1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! impl_map_to_bytes {
|
|
||||||
($from: ident, $to: ty) => {
|
|
||||||
impl ToBytes for $from {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
(*self as $to).to_bytes(out)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_bytes_len(&self) -> usize { (*self as $to).to_bytes_len() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_map_to_bytes!(usize, u64);
|
|
||||||
impl_map_to_bytes!(u16, u64);
|
|
||||||
impl_map_to_bytes!(u32, u64);
|
|
||||||
|
|
||||||
macro_rules! impl_uint_to_bytes {
|
|
||||||
($name: ident) => {
|
|
||||||
impl ToBytes for $name {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
let count = self.to_bytes_len();
|
|
||||||
for i in 0..count {
|
|
||||||
let j = count - 1 - i;
|
|
||||||
out.vec_push(self.byte(j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn to_bytes_len(&self) -> usize { (self.bits() + 7) / 8 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_uint_to_bytes!(U256);
|
|
||||||
impl_uint_to_bytes!(U128);
|
|
||||||
|
|
||||||
macro_rules! impl_hash_to_bytes {
|
|
||||||
($name: ident) => {
|
|
||||||
impl ToBytes for $name {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
out.vec_extend(&self);
|
|
||||||
}
|
|
||||||
fn to_bytes_len(&self) -> usize { self.len() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_hash_to_bytes!(H64);
|
|
||||||
impl_hash_to_bytes!(H128);
|
|
||||||
impl_hash_to_bytes!(H160);
|
|
||||||
impl_hash_to_bytes!(H256);
|
|
||||||
impl_hash_to_bytes!(H512);
|
|
||||||
impl_hash_to_bytes!(H520);
|
|
||||||
impl_hash_to_bytes!(H2048);
|
|
||||||
|
|
||||||
/// Error returned when `FromBytes` conversation goes wrong
|
/// Error returned when `FromBytes` conversation goes wrong
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
@ -268,9 +125,9 @@ macro_rules! impl_hash_from_bytes {
|
|||||||
impl FromBytes for $name {
|
impl FromBytes for $name {
|
||||||
fn from_bytes(bytes: &[u8]) -> FromBytesResult<$name> {
|
fn from_bytes(bytes: &[u8]) -> FromBytesResult<$name> {
|
||||||
match bytes.len().cmp(&$size) {
|
match bytes.len().cmp(&$size) {
|
||||||
Ordering::Less => Err(FromBytesError::DataIsTooShort),
|
cmp::Ordering::Less => Err(FromBytesError::DataIsTooShort),
|
||||||
Ordering::Greater => Err(FromBytesError::DataIsTooLong),
|
cmp::Ordering::Greater => Err(FromBytesError::DataIsTooLong),
|
||||||
Ordering::Equal => {
|
cmp::Ordering::Equal => {
|
||||||
let mut t = [0u8; $size];
|
let mut t = [0u8; $size];
|
||||||
t.copy_from_slice(bytes);
|
t.copy_from_slice(bytes);
|
||||||
Ok($name(t))
|
Ok($name(t))
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! Contains RLPs used for compression.
|
//! Contains RLPs used for compression.
|
||||||
|
|
||||||
use rlpcompression::InvalidRlpSwapper;
|
use compression::InvalidRlpSwapper;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// Swapper for snapshot compression.
|
/// Swapper for snapshot compression.
|
@ -14,11 +14,10 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use ::{UntrustedRlp, View, Compressible, encode, Stream, RlpStream};
|
|
||||||
use commonrlps::{BLOCKS_RLP_SWAPPER, SNAPSHOT_RLP_SWAPPER};
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use elastic_array::ElasticArray1024;
|
use elastic_array::ElasticArray1024;
|
||||||
|
use common::{BLOCKS_RLP_SWAPPER, SNAPSHOT_RLP_SWAPPER};
|
||||||
|
use {UntrustedRlp, View, Compressible, encode, RlpStream};
|
||||||
|
|
||||||
/// Stores RLPs used for compression
|
/// Stores RLPs used for compression
|
||||||
pub struct InvalidRlpSwapper<'a> {
|
pub struct InvalidRlpSwapper<'a> {
|
||||||
@ -149,8 +148,6 @@ fn deep_decompress(rlp: &UntrustedRlp, swapper: &InvalidRlpSwapper) -> Option<El
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl<'a> Compressible for UntrustedRlp<'a> {
|
impl<'a> Compressible for UntrustedRlp<'a> {
|
||||||
type DataType = RlpType;
|
type DataType = RlpType;
|
||||||
|
|
||||||
@ -171,8 +168,8 @@ impl<'a> Compressible for UntrustedRlp<'a> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ::{UntrustedRlp, Compressible, View, RlpType};
|
use compression::InvalidRlpSwapper;
|
||||||
use rlpcompression::InvalidRlpSwapper;
|
use {UntrustedRlp, Compressible, View, RlpType};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn invalid_rlp_swapper() {
|
fn invalid_rlp_swapper() {
|
120
util/rlp/src/impls.rs
Normal file
120
util/rlp/src/impls.rs
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
use byteorder::{ByteOrder, BigEndian};
|
||||||
|
use bigint::prelude::{Uint, U128, U256, H64, H128, H160, H256, H512, H520, H2048};
|
||||||
|
use traits::Encodable;
|
||||||
|
use stream::RlpStream;
|
||||||
|
|
||||||
|
impl Encodable for bool {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
if *self {
|
||||||
|
s.encoder().encode_value(&[1]);
|
||||||
|
} else {
|
||||||
|
s.encoder().encode_value(&[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Encodable for &'a [u8] {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.encoder().encode_value(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Encodable for Vec<u8> {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.encoder().encode_value(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Encodable for Option<T> where T: Encodable {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
match *self {
|
||||||
|
None => {
|
||||||
|
s.begin_list(0);
|
||||||
|
},
|
||||||
|
Some(ref value) => {
|
||||||
|
s.begin_list(1);
|
||||||
|
s.append(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Encodable for u8 {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
if *self != 0 {
|
||||||
|
s.encoder().encode_value(&[*self]);
|
||||||
|
} else {
|
||||||
|
s.encoder().encode_value(&[]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! impl_encodable_for_u {
|
||||||
|
($name: ident, $func: ident, $size: expr) => {
|
||||||
|
impl Encodable for $name {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
let leading_empty_bytes = self.leading_zeros() as usize / 8;
|
||||||
|
let mut buffer = [0u8; $size];
|
||||||
|
BigEndian::$func(&mut buffer, *self);
|
||||||
|
s.encoder().encode_value(&buffer[leading_empty_bytes..]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_encodable_for_u!(u16, write_u16, 2);
|
||||||
|
impl_encodable_for_u!(u32, write_u32, 4);
|
||||||
|
impl_encodable_for_u!(u64, write_u64, 8);
|
||||||
|
|
||||||
|
impl Encodable for usize {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
(*self as u64).rlp_append(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! impl_encodable_for_hash {
|
||||||
|
($name: ident) => {
|
||||||
|
impl Encodable for $name {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.encoder().encode_value(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_encodable_for_hash!(H64);
|
||||||
|
impl_encodable_for_hash!(H128);
|
||||||
|
impl_encodable_for_hash!(H160);
|
||||||
|
impl_encodable_for_hash!(H256);
|
||||||
|
impl_encodable_for_hash!(H512);
|
||||||
|
impl_encodable_for_hash!(H520);
|
||||||
|
impl_encodable_for_hash!(H2048);
|
||||||
|
|
||||||
|
macro_rules! impl_encodable_for_uint {
|
||||||
|
($name: ident, $size: expr) => {
|
||||||
|
impl Encodable for $name {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
let leading_empty_bytes = $size - (self.bits() + 7) / 8;
|
||||||
|
let mut buffer = [0u8; $size];
|
||||||
|
self.to_big_endian(&mut buffer);
|
||||||
|
s.encoder().encode_value(&buffer[leading_empty_bytes..]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_encodable_for_uint!(U256, 32);
|
||||||
|
impl_encodable_for_uint!(U128, 16);
|
||||||
|
|
||||||
|
impl<'a> Encodable for &'a str {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.encoder().encode_value(self.as_bytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Encodable for String {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.encoder().encode_value(self.as_bytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -46,25 +46,7 @@
|
|||||||
//! * You want to get view onto rlp-slice.
|
//! * You want to get view onto rlp-slice.
|
||||||
//! * You don't want to decode whole rlp at once.
|
//! * You don't want to decode whole rlp at once.
|
||||||
|
|
||||||
pub mod rlptraits;
|
extern crate byteorder;
|
||||||
mod rlperrors;
|
|
||||||
mod rlpin;
|
|
||||||
mod untrusted_rlp;
|
|
||||||
mod rlpstream;
|
|
||||||
mod rlpcompression;
|
|
||||||
mod commonrlps;
|
|
||||||
mod bytes;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests;
|
|
||||||
|
|
||||||
pub use self::rlperrors::DecoderError;
|
|
||||||
pub use self::rlptraits::{Decoder, Decodable, View, Stream, Encodable, Encoder, RlpEncodable, RlpDecodable, Compressible};
|
|
||||||
pub use self::untrusted_rlp::{UntrustedRlp, UntrustedRlpIterator, PayloadInfo, Prototype};
|
|
||||||
pub use self::rlpin::{Rlp, RlpIterator};
|
|
||||||
pub use self::rlpstream::RlpStream;
|
|
||||||
pub use self::rlpcompression::RlpType;
|
|
||||||
|
|
||||||
extern crate ethcore_bigint as bigint;
|
extern crate ethcore_bigint as bigint;
|
||||||
extern crate elastic_array;
|
extern crate elastic_array;
|
||||||
extern crate rustc_serialize;
|
extern crate rustc_serialize;
|
||||||
@ -72,8 +54,29 @@ extern crate rustc_serialize;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
|
||||||
|
mod traits;
|
||||||
|
mod error;
|
||||||
|
mod rlpin;
|
||||||
|
mod untrusted_rlp;
|
||||||
|
mod stream;
|
||||||
|
mod compression;
|
||||||
|
mod common;
|
||||||
|
mod bytes;
|
||||||
|
mod impls;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
|
|
||||||
|
use std::borrow::Borrow;
|
||||||
use elastic_array::ElasticArray1024;
|
use elastic_array::ElasticArray1024;
|
||||||
|
|
||||||
|
pub use error::DecoderError;
|
||||||
|
pub use traits::{Decoder, Decodable, View, Encodable, RlpDecodable, Compressible};
|
||||||
|
pub use untrusted_rlp::{UntrustedRlp, UntrustedRlpIterator, PayloadInfo, Prototype};
|
||||||
|
pub use rlpin::{Rlp, RlpIterator};
|
||||||
|
pub use stream::RlpStream;
|
||||||
|
pub use compression::RlpType;
|
||||||
|
|
||||||
/// The RLP encoded empty data (used to mean "null value").
|
/// The RLP encoded empty data (used to mean "null value").
|
||||||
pub const NULL_RLP: [u8; 1] = [0x80; 1];
|
pub const NULL_RLP: [u8; 1] = [0x80; 1];
|
||||||
/// The RLP encoded empty list.
|
/// The RLP encoded empty list.
|
||||||
@ -106,8 +109,14 @@ pub fn decode<T>(bytes: &[u8]) -> T where T: RlpDecodable {
|
|||||||
/// assert_eq!(out, vec![0x83, b'c', b'a', b't']);
|
/// assert_eq!(out, vec![0x83, b'c', b'a', b't']);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn encode<E>(object: &E) -> ElasticArray1024<u8> where E: RlpEncodable {
|
pub fn encode<E>(object: &E) -> ElasticArray1024<u8> where E: Encodable {
|
||||||
let mut stream = RlpStream::new();
|
let mut stream = RlpStream::new();
|
||||||
stream.append(object);
|
stream.append(object);
|
||||||
stream.drain()
|
stream.drain()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn encode_list<E, K>(object: &[K]) -> ElasticArray1024<u8> where E: Encodable, K: Borrow<E> {
|
||||||
|
let mut stream = RlpStream::new();
|
||||||
|
stream.append_list(object);
|
||||||
|
stream.drain()
|
||||||
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use rustc_serialize::hex::ToHex;
|
use rustc_serialize::hex::ToHex;
|
||||||
use ::{View, DecoderError, UntrustedRlp, PayloadInfo, Prototype, RlpDecodable};
|
use {View, DecoderError, UntrustedRlp, PayloadInfo, Prototype, RlpDecodable};
|
||||||
|
|
||||||
impl<'a> From<UntrustedRlp<'a>> for Rlp<'a> {
|
impl<'a> From<UntrustedRlp<'a>> for Rlp<'a> {
|
||||||
fn from(rlp: UntrustedRlp<'a>) -> Rlp<'a> {
|
fn from(rlp: UntrustedRlp<'a>) -> Rlp<'a> {
|
||||||
|
@ -1,357 +0,0 @@
|
|||||||
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity.
|
|
||||||
|
|
||||||
// Parity is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use elastic_array::*;
|
|
||||||
|
|
||||||
use ::{Stream, Encoder, Encodable};
|
|
||||||
use bytes::{ToBytes, VecLike};
|
|
||||||
use rlptraits::{ByteEncodable, RlpEncodable};
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
|
||||||
struct ListInfo {
|
|
||||||
position: usize,
|
|
||||||
current: usize,
|
|
||||||
max: usize,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ListInfo {
|
|
||||||
fn new(position: usize, max: usize) -> ListInfo {
|
|
||||||
ListInfo {
|
|
||||||
position: position,
|
|
||||||
current: 0,
|
|
||||||
max: max,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Appendable rlp encoder.
|
|
||||||
pub struct RlpStream {
|
|
||||||
unfinished_lists: ElasticArray16<ListInfo>,
|
|
||||||
encoder: BasicEncoder,
|
|
||||||
finished_list: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for RlpStream {
|
|
||||||
fn default() -> Self {
|
|
||||||
RlpStream::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Stream for RlpStream {
|
|
||||||
fn new() -> Self {
|
|
||||||
RlpStream {
|
|
||||||
unfinished_lists: ElasticArray16::new(),
|
|
||||||
encoder: BasicEncoder::new(),
|
|
||||||
finished_list: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn new_list(len: usize) -> Self {
|
|
||||||
let mut stream = RlpStream::new();
|
|
||||||
stream.begin_list(len);
|
|
||||||
stream
|
|
||||||
}
|
|
||||||
|
|
||||||
fn append<'a, E>(&'a mut self, value: &E) -> &'a mut Self where E: RlpEncodable {
|
|
||||||
self.finished_list = false;
|
|
||||||
value.rlp_append(self);
|
|
||||||
if !self.finished_list {
|
|
||||||
self.note_appended(1);
|
|
||||||
}
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn begin_list(&mut self, len: usize) -> &mut RlpStream {
|
|
||||||
self.finished_list = false;
|
|
||||||
match len {
|
|
||||||
0 => {
|
|
||||||
// we may finish, if the appended list len is equal 0
|
|
||||||
self.encoder.bytes.push(0xc0u8);
|
|
||||||
self.note_appended(1);
|
|
||||||
self.finished_list = true;
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
let position = self.encoder.bytes.len();
|
|
||||||
self.unfinished_lists.push(ListInfo::new(position, len));
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// return chainable self
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn append_empty_data(&mut self) -> &mut RlpStream {
|
|
||||||
// self push raw item
|
|
||||||
self.encoder.bytes.push(0x80);
|
|
||||||
|
|
||||||
// try to finish and prepend the length
|
|
||||||
self.note_appended(1);
|
|
||||||
|
|
||||||
// return chainable self
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn append_raw<'a>(&'a mut self, bytes: &[u8], item_count: usize) -> &'a mut RlpStream {
|
|
||||||
// push raw items
|
|
||||||
self.encoder.bytes.append_slice(bytes);
|
|
||||||
|
|
||||||
// try to finish and prepend the length
|
|
||||||
self.note_appended(item_count);
|
|
||||||
|
|
||||||
// return chainable self
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn clear(&mut self) {
|
|
||||||
// clear bytes
|
|
||||||
self.encoder.bytes.clear();
|
|
||||||
|
|
||||||
// clear lists
|
|
||||||
self.unfinished_lists.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_finished(&self) -> bool {
|
|
||||||
self.unfinished_lists.len() == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_raw(&self) -> &[u8] {
|
|
||||||
&self.encoder.bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
fn out(self) -> Vec<u8> {
|
|
||||||
match self.is_finished() {
|
|
||||||
true => self.encoder.out().to_vec(),
|
|
||||||
false => panic!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RlpStream {
|
|
||||||
|
|
||||||
/// Appends primitive value to the end of stream
|
|
||||||
fn append_value<E>(&mut self, object: &E) where E: ByteEncodable {
|
|
||||||
// encode given value and add it at the end of the stream
|
|
||||||
self.encoder.emit_value(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn append_internal<'a, E>(&'a mut self, value: &E) -> &'a mut Self where E: Encodable {
|
|
||||||
self.finished_list = false;
|
|
||||||
value.rlp_append(self);
|
|
||||||
if !self.finished_list {
|
|
||||||
self.note_appended(1);
|
|
||||||
}
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Try to finish lists
|
|
||||||
fn note_appended(&mut self, inserted_items: usize) -> () {
|
|
||||||
if self.unfinished_lists.len() == 0 {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let back = self.unfinished_lists.len() - 1;
|
|
||||||
let should_finish = match self.unfinished_lists.get_mut(back) {
|
|
||||||
None => false,
|
|
||||||
Some(ref mut x) => {
|
|
||||||
x.current += inserted_items;
|
|
||||||
if x.current > x.max {
|
|
||||||
panic!("You cannot append more items then you expect!");
|
|
||||||
}
|
|
||||||
x.current == x.max
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if should_finish {
|
|
||||||
let x = self.unfinished_lists.pop().unwrap();
|
|
||||||
let len = self.encoder.bytes.len() - x.position;
|
|
||||||
self.encoder.insert_list_len_at_pos(len, x.position);
|
|
||||||
self.note_appended(1);
|
|
||||||
}
|
|
||||||
self.finished_list = should_finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Drain the object and return the underlying ElasticArray.
|
|
||||||
pub fn drain(self) -> ElasticArray1024<u8> {
|
|
||||||
match self.is_finished() {
|
|
||||||
true => self.encoder.bytes,
|
|
||||||
false => panic!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct BasicEncoder {
|
|
||||||
bytes: ElasticArray1024<u8>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for BasicEncoder {
|
|
||||||
fn default() -> Self {
|
|
||||||
BasicEncoder::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BasicEncoder {
|
|
||||||
fn new() -> Self {
|
|
||||||
BasicEncoder { bytes: ElasticArray1024::new() }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// inserts list prefix at given position
|
|
||||||
/// TODO: optimise it further?
|
|
||||||
fn insert_list_len_at_pos(&mut self, len: usize, pos: usize) -> () {
|
|
||||||
let mut res = ElasticArray16::new();
|
|
||||||
match len {
|
|
||||||
0...55 => res.push(0xc0u8 + len as u8),
|
|
||||||
_ => {
|
|
||||||
res.push(0xf7u8 + len.to_bytes_len() as u8);
|
|
||||||
ToBytes::to_bytes(&len, &mut res);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self.bytes.insert_slice(pos, &res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// get encoded value
|
|
||||||
fn out(self) -> ElasticArray1024<u8> {
|
|
||||||
self.bytes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Encoder for BasicEncoder {
|
|
||||||
fn emit_value<E: ByteEncodable>(&mut self, value: &E) {
|
|
||||||
match value.bytes_len() {
|
|
||||||
// just 0
|
|
||||||
0 => self.bytes.push(0x80u8),
|
|
||||||
// byte is its own encoding if < 0x80
|
|
||||||
1 => {
|
|
||||||
value.to_bytes(&mut self.bytes);
|
|
||||||
let len = self.bytes.len();
|
|
||||||
let last_byte = self.bytes[len - 1];
|
|
||||||
if last_byte >= 0x80 {
|
|
||||||
self.bytes.push(last_byte);
|
|
||||||
self.bytes[len - 1] = 0x81;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// (prefix + length), followed by the string
|
|
||||||
len @ 2 ... 55 => {
|
|
||||||
self.bytes.push(0x80u8 + len as u8);
|
|
||||||
value.to_bytes(&mut self.bytes);
|
|
||||||
}
|
|
||||||
// (prefix + length of length), followed by the length, followd by the string
|
|
||||||
len => {
|
|
||||||
self.bytes.push(0xb7 + len.to_bytes_len() as u8);
|
|
||||||
ToBytes::to_bytes(&len, &mut self.bytes);
|
|
||||||
value.to_bytes(&mut self.bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn emit_raw(&mut self, bytes: &[u8]) -> () {
|
|
||||||
self.bytes.append_slice(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> ByteEncodable for T where T: ToBytes {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
ToBytes::to_bytes(self, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bytes_len(&self) -> usize {
|
|
||||||
ToBytes::to_bytes_len(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct U8Slice<'a>(&'a [u8]);
|
|
||||||
|
|
||||||
impl<'a> ByteEncodable for U8Slice<'a> {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
out.vec_extend(self.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bytes_len(&self) -> usize {
|
|
||||||
self.0.len()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Encodable for &'a[u8] {
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
|
||||||
s.append_value(&U8Slice(self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Encodable for Vec<u8> {
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
|
||||||
s.append_value(&U8Slice(self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Encodable for T where T: ByteEncodable {
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
|
||||||
s.append_value(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct EncodableU8 (u8);
|
|
||||||
|
|
||||||
impl ByteEncodable for EncodableU8 {
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
|
||||||
if self.0 != 0 {
|
|
||||||
out.vec_push(self.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bytes_len(&self) -> usize {
|
|
||||||
match self.0 { 0 => 0, _ => 1 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RlpEncodable for u8 {
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
|
||||||
s.append_value(&EncodableU8(*self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, T> Encodable for &'a[T] where T: Encodable {
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
|
||||||
s.begin_list(self.len());
|
|
||||||
for el in self.iter() {
|
|
||||||
s.append_internal(el);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Encodable for Vec<T> where T: Encodable {
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
|
||||||
Encodable::rlp_append(&self.as_slice(), s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Encodable for Option<T> where T: Encodable {
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
|
||||||
match *self {
|
|
||||||
None => { s.begin_list(0); },
|
|
||||||
Some(ref x) => {
|
|
||||||
s.begin_list(1);
|
|
||||||
s.append_internal(x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> RlpEncodable for T where T: Encodable {
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream) {
|
|
||||||
Encodable::rlp_append(self, s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
335
util/rlp/src/stream.rs
Normal file
335
util/rlp/src/stream.rs
Normal file
@ -0,0 +1,335 @@
|
|||||||
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use std::borrow::Borrow;
|
||||||
|
use byteorder::{ByteOrder, BigEndian};
|
||||||
|
use elastic_array::{ElasticArray16, ElasticArray1024};
|
||||||
|
use traits::Encodable;
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
struct ListInfo {
|
||||||
|
position: usize,
|
||||||
|
current: usize,
|
||||||
|
max: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ListInfo {
|
||||||
|
fn new(position: usize, max: usize) -> ListInfo {
|
||||||
|
ListInfo {
|
||||||
|
position: position,
|
||||||
|
current: 0,
|
||||||
|
max: max,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Appendable rlp encoder.
|
||||||
|
pub struct RlpStream {
|
||||||
|
unfinished_lists: ElasticArray16<ListInfo>,
|
||||||
|
buffer: ElasticArray1024<u8>,
|
||||||
|
finished_list: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for RlpStream {
|
||||||
|
fn default() -> Self {
|
||||||
|
RlpStream::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RlpStream {
|
||||||
|
/// Initializes instance of empty `Stream`.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
RlpStream {
|
||||||
|
unfinished_lists: ElasticArray16::new(),
|
||||||
|
buffer: ElasticArray1024::new(),
|
||||||
|
finished_list: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes the `Stream` as a list.
|
||||||
|
pub fn new_list(len: usize) -> Self {
|
||||||
|
let mut stream = RlpStream::new();
|
||||||
|
stream.begin_list(len);
|
||||||
|
stream
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Appends value to the end of stream, chainable.
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// extern crate rlp;
|
||||||
|
/// use rlp::*;
|
||||||
|
///
|
||||||
|
/// fn main () {
|
||||||
|
/// let mut stream = RlpStream::new_list(2);
|
||||||
|
/// stream.append(&"cat").append(&"dog");
|
||||||
|
/// let out = stream.out();
|
||||||
|
/// assert_eq!(out, vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g']);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
pub fn append<'a, E>(&'a mut self, value: &E) -> &'a mut Self where E: Encodable {
|
||||||
|
self.finished_list = false;
|
||||||
|
value.rlp_append(self);
|
||||||
|
if !self.finished_list {
|
||||||
|
self.note_appended(1);
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Appends list of values to the end of stream, chainable.
|
||||||
|
pub fn append_list<'a, E, K>(&'a mut self, values: &[K]) -> &'a mut Self where E: Encodable, K: Borrow<E> {
|
||||||
|
self.begin_list(values.len());
|
||||||
|
for value in values {
|
||||||
|
self.append(value.borrow());
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Appends value to the end of stream, but do not count it as an appended item.
|
||||||
|
/// It's useful for wrapper types
|
||||||
|
pub fn append_internal<'a, E>(&'a mut self, value: &E) -> &'a mut Self where E: Encodable {
|
||||||
|
value.rlp_append(self);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Declare appending the list of given size, chainable.
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// extern crate rlp;
|
||||||
|
/// use rlp::*;
|
||||||
|
///
|
||||||
|
/// fn main () {
|
||||||
|
/// let mut stream = RlpStream::new_list(2);
|
||||||
|
/// stream.begin_list(2).append(&"cat").append(&"dog");
|
||||||
|
/// stream.append(&"");
|
||||||
|
/// let out = stream.out();
|
||||||
|
/// assert_eq!(out, vec![0xca, 0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g', 0x80]);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
pub fn begin_list(&mut self, len: usize) -> &mut RlpStream {
|
||||||
|
self.finished_list = false;
|
||||||
|
match len {
|
||||||
|
0 => {
|
||||||
|
// we may finish, if the appended list len is equal 0
|
||||||
|
self.buffer.push(0xc0u8);
|
||||||
|
self.note_appended(1);
|
||||||
|
self.finished_list = true;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
// payload is longer than 1 byte only for lists > 55 bytes
|
||||||
|
// by pushing always this 1 byte we may avoid unnecessary shift of data
|
||||||
|
self.buffer.push(0);
|
||||||
|
|
||||||
|
let position = self.buffer.len();
|
||||||
|
self.unfinished_lists.push(ListInfo::new(position, len));
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// return chainable self
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Apends null to the end of stream, chainable.
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// extern crate rlp;
|
||||||
|
/// use rlp::*;
|
||||||
|
///
|
||||||
|
/// fn main () {
|
||||||
|
/// let mut stream = RlpStream::new_list(2);
|
||||||
|
/// stream.append_empty_data().append_empty_data();
|
||||||
|
/// let out = stream.out();
|
||||||
|
/// assert_eq!(out, vec![0xc2, 0x80, 0x80]);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
pub fn append_empty_data(&mut self) -> &mut RlpStream {
|
||||||
|
// self push raw item
|
||||||
|
self.buffer.push(0x80);
|
||||||
|
|
||||||
|
// try to finish and prepend the length
|
||||||
|
self.note_appended(1);
|
||||||
|
|
||||||
|
// return chainable self
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Appends raw (pre-serialised) RLP data. Use with caution. Chainable.
|
||||||
|
pub fn append_raw<'a>(&'a mut self, bytes: &[u8], item_count: usize) -> &'a mut RlpStream {
|
||||||
|
// push raw items
|
||||||
|
self.buffer.append_slice(bytes);
|
||||||
|
|
||||||
|
// try to finish and prepend the length
|
||||||
|
self.note_appended(item_count);
|
||||||
|
|
||||||
|
// return chainable self
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Clear the output stream so far.
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// extern crate rlp;
|
||||||
|
/// use rlp::*;
|
||||||
|
///
|
||||||
|
/// fn main () {
|
||||||
|
/// let mut stream = RlpStream::new_list(3);
|
||||||
|
/// stream.append(&"cat");
|
||||||
|
/// stream.clear();
|
||||||
|
/// stream.append(&"dog");
|
||||||
|
/// let out = stream.out();
|
||||||
|
/// assert_eq!(out, vec![0x83, b'd', b'o', b'g']);
|
||||||
|
/// }
|
||||||
|
pub fn clear(&mut self) {
|
||||||
|
// clear bytes
|
||||||
|
self.buffer.clear();
|
||||||
|
|
||||||
|
// clear lists
|
||||||
|
self.unfinished_lists.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns true if stream doesnt expect any more items.
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// extern crate rlp;
|
||||||
|
/// use rlp::*;
|
||||||
|
///
|
||||||
|
/// fn main () {
|
||||||
|
/// let mut stream = RlpStream::new_list(2);
|
||||||
|
/// stream.append(&"cat");
|
||||||
|
/// assert_eq!(stream.is_finished(), false);
|
||||||
|
/// stream.append(&"dog");
|
||||||
|
/// assert_eq!(stream.is_finished(), true);
|
||||||
|
/// let out = stream.out();
|
||||||
|
/// assert_eq!(out, vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g']);
|
||||||
|
/// }
|
||||||
|
pub fn is_finished(&self) -> bool {
|
||||||
|
self.unfinished_lists.len() == 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get raw encoded bytes
|
||||||
|
pub fn as_raw(&self) -> &[u8] {
|
||||||
|
//&self.encoder.bytes
|
||||||
|
&self.buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Streams out encoded bytes.
|
||||||
|
///
|
||||||
|
/// panic! if stream is not finished.
|
||||||
|
pub fn out(self) -> Vec<u8> {
|
||||||
|
match self.is_finished() {
|
||||||
|
//true => self.encoder.out().to_vec(),
|
||||||
|
true => self.buffer.to_vec(),
|
||||||
|
false => panic!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Try to finish lists
|
||||||
|
fn note_appended(&mut self, inserted_items: usize) -> () {
|
||||||
|
if self.unfinished_lists.len() == 0 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let back = self.unfinished_lists.len() - 1;
|
||||||
|
let should_finish = match self.unfinished_lists.get_mut(back) {
|
||||||
|
None => false,
|
||||||
|
Some(ref mut x) => {
|
||||||
|
x.current += inserted_items;
|
||||||
|
if x.current > x.max {
|
||||||
|
panic!("You cannot append more items then you expect!");
|
||||||
|
}
|
||||||
|
x.current == x.max
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if should_finish {
|
||||||
|
let x = self.unfinished_lists.pop().unwrap();
|
||||||
|
let len = self.buffer.len() - x.position;
|
||||||
|
self.encoder().insert_list_payload(len, x.position);
|
||||||
|
self.note_appended(1);
|
||||||
|
}
|
||||||
|
self.finished_list = should_finish;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn encoder(&mut self) -> BasicEncoder {
|
||||||
|
BasicEncoder::new(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Drain the object and return the underlying ElasticArray.
|
||||||
|
pub fn drain(self) -> ElasticArray1024<u8> {
|
||||||
|
match self.is_finished() {
|
||||||
|
true => self.buffer,
|
||||||
|
false => panic!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct BasicEncoder<'a> {
|
||||||
|
buffer: &'a mut ElasticArray1024<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> BasicEncoder<'a> {
|
||||||
|
fn new(stream: &'a mut RlpStream) -> Self {
|
||||||
|
BasicEncoder {
|
||||||
|
buffer: &mut stream.buffer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn insert_size(&mut self, size: usize, position: usize) -> u8 {
|
||||||
|
let size = size as u32;
|
||||||
|
let leading_empty_bytes = size.leading_zeros() as usize / 8;
|
||||||
|
let size_bytes = 4 - leading_empty_bytes as u8;
|
||||||
|
let mut buffer = [0u8; 4];
|
||||||
|
BigEndian::write_u32(&mut buffer, size);
|
||||||
|
self.buffer.insert_slice(position, &buffer[leading_empty_bytes..]);
|
||||||
|
size_bytes as u8
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Inserts list prefix at given position
|
||||||
|
fn insert_list_payload(&mut self, len: usize, pos: usize) {
|
||||||
|
// 1 byte was already reserved for payload earlier
|
||||||
|
match len {
|
||||||
|
0...55 => {
|
||||||
|
self.buffer[pos - 1] = 0xc0u8 + len as u8;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
let inserted_bytes = self.insert_size(len, pos);
|
||||||
|
self.buffer[pos - 1] = 0xf7u8 + inserted_bytes;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pushes encoded value to the end of buffer
|
||||||
|
pub fn encode_value(&mut self, value: &[u8]) {
|
||||||
|
match value.len() {
|
||||||
|
// just 0
|
||||||
|
0 => self.buffer.push(0x80u8),
|
||||||
|
// byte is its own encoding if < 0x80
|
||||||
|
1 if value[0] < 0x80 => self.buffer.push(value[0]),
|
||||||
|
// (prefix + length), followed by the string
|
||||||
|
len @ 1 ... 55 => {
|
||||||
|
self.buffer.push(0x80u8 + len as u8);
|
||||||
|
self.buffer.append_slice(value);
|
||||||
|
}
|
||||||
|
// (prefix + length of length), followed by the length, followd by the string
|
||||||
|
len => {
|
||||||
|
self.buffer.push(0);
|
||||||
|
let position = self.buffer.len();
|
||||||
|
let inserted_bytes = self.insert_size(len, position);
|
||||||
|
self.buffer[position - 1] = 0xb7 + inserted_bytes;
|
||||||
|
self.buffer.append_slice(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -15,9 +15,8 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use std::{fmt, cmp};
|
use std::{fmt, cmp};
|
||||||
use std::str::FromStr;
|
|
||||||
use ::{Encodable, RlpDecodable, UntrustedRlp, RlpStream, View, Stream, DecoderError};
|
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
|
use {Encodable, RlpDecodable, UntrustedRlp, RlpStream, View, DecoderError};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rlp_at() {
|
fn rlp_at() {
|
||||||
@ -95,6 +94,17 @@ fn run_encode_tests<T>(tests: Vec<ETestPair<T>>)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct VETestPair<T>(Vec<T>, Vec<u8>) where T: Encodable;
|
||||||
|
|
||||||
|
fn run_encode_tests_list<T>(tests: Vec<VETestPair<T>>)
|
||||||
|
where T: Encodable
|
||||||
|
{
|
||||||
|
for t in &tests {
|
||||||
|
let res = super::encode_list(&t.0);
|
||||||
|
assert_eq!(&res[..], &t.1[..]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn encode_u16() {
|
fn encode_u16() {
|
||||||
let tests = vec![
|
let tests = vec![
|
||||||
@ -131,9 +141,8 @@ fn encode_u256() {
|
|||||||
ETestPair(U256::from(0x1000000u64), vec![0x84, 0x01, 0x00, 0x00, 0x00]),
|
ETestPair(U256::from(0x1000000u64), vec![0x84, 0x01, 0x00, 0x00, 0x00]),
|
||||||
ETestPair(U256::from(0xffffffffu64),
|
ETestPair(U256::from(0xffffffffu64),
|
||||||
vec![0x84, 0xff, 0xff, 0xff, 0xff]),
|
vec![0x84, 0xff, 0xff, 0xff, 0xff]),
|
||||||
ETestPair(U256::from_str("8090a0b0c0d0e0f00910203040506077000000000000\
|
ETestPair(("8090a0b0c0d0e0f00910203040506077000000000000\
|
||||||
000100000000000012f0")
|
000100000000000012f0").into(),
|
||||||
.unwrap(),
|
|
||||||
vec![0xa0, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0,
|
vec![0xa0, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0,
|
||||||
0x09, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x77, 0x00,
|
0x09, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x77, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||||
@ -186,19 +195,19 @@ fn encode_vector_u8() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn encode_vector_u64() {
|
fn encode_vector_u64() {
|
||||||
let tests = vec![
|
let tests = vec![
|
||||||
ETestPair(vec![], vec![0xc0]),
|
VETestPair(vec![], vec![0xc0]),
|
||||||
ETestPair(vec![15u64], vec![0xc1, 0x0f]),
|
VETestPair(vec![15u64], vec![0xc1, 0x0f]),
|
||||||
ETestPair(vec![1, 2, 3, 7, 0xff], vec![0xc6, 1, 2, 3, 7, 0x81, 0xff]),
|
VETestPair(vec![1, 2, 3, 7, 0xff], vec![0xc6, 1, 2, 3, 7, 0x81, 0xff]),
|
||||||
ETestPair(vec![0xffffffff, 1, 2, 3, 7, 0xff], vec![0xcb, 0x84, 0xff, 0xff, 0xff, 0xff, 1, 2, 3, 7, 0x81, 0xff]),
|
VETestPair(vec![0xffffffff, 1, 2, 3, 7, 0xff], vec![0xcb, 0x84, 0xff, 0xff, 0xff, 0xff, 1, 2, 3, 7, 0x81, 0xff]),
|
||||||
];
|
];
|
||||||
run_encode_tests(tests);
|
run_encode_tests_list(tests);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn encode_vector_str() {
|
fn encode_vector_str() {
|
||||||
let tests = vec![ETestPair(vec!["cat", "dog"],
|
let tests = vec![VETestPair(vec!["cat", "dog"],
|
||||||
vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'])];
|
vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g'])];
|
||||||
run_encode_tests(tests);
|
run_encode_tests_list(tests);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DTestPair<T>(T, Vec<u8>) where T: RlpDecodable + fmt::Debug + cmp::Eq;
|
struct DTestPair<T>(T, Vec<u8>) where T: RlpDecodable + fmt::Debug + cmp::Eq;
|
||||||
@ -265,9 +274,8 @@ fn decode_untrusted_u256() {
|
|||||||
DTestPair(U256::from(0x1000000u64), vec![0x84, 0x01, 0x00, 0x00, 0x00]),
|
DTestPair(U256::from(0x1000000u64), vec![0x84, 0x01, 0x00, 0x00, 0x00]),
|
||||||
DTestPair(U256::from(0xffffffffu64),
|
DTestPair(U256::from(0xffffffffu64),
|
||||||
vec![0x84, 0xff, 0xff, 0xff, 0xff]),
|
vec![0x84, 0xff, 0xff, 0xff, 0xff]),
|
||||||
DTestPair(U256::from_str("8090a0b0c0d0e0f00910203040506077000000000000\
|
DTestPair(("8090a0b0c0d0e0f00910203040506077000000000000\
|
||||||
000100000000000012f0")
|
000100000000000012f0").into(),
|
||||||
.unwrap(),
|
|
||||||
vec![0xa0, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0,
|
vec![0xa0, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0,
|
||||||
0x09, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x77, 0x00,
|
0x09, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x77, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||||
@ -335,7 +343,7 @@ fn decode_untrusted_vector_of_vectors_str() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_decoding_array() {
|
fn test_decoding_array() {
|
||||||
let v = vec![5u16, 2u16];
|
let v = vec![5u16, 2u16];
|
||||||
let res = super::encode(&v);
|
let res = super::encode_list(&v);
|
||||||
let arr: [u16; 2] = super::decode(&res);
|
let arr: [u16; 2] = super::decode(&res);
|
||||||
assert_eq!(arr[0], 5);
|
assert_eq!(arr[0], 5);
|
||||||
assert_eq!(arr[1], 2);
|
assert_eq!(arr[1], 2);
|
||||||
@ -396,7 +404,7 @@ fn test_rlp_2bytes_data_length_check()
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_rlp_nested_empty_list_encode() {
|
fn test_rlp_nested_empty_list_encode() {
|
||||||
let mut stream = RlpStream::new_list(2);
|
let mut stream = RlpStream::new_list(2);
|
||||||
stream.append(&(Vec::new() as Vec<u32>));
|
stream.append_list(&(Vec::new() as Vec<u32>));
|
||||||
stream.append(&40u32);
|
stream.append(&40u32);
|
||||||
assert_eq!(stream.drain()[..], [0xc2u8, 0xc0u8, 40u8][..]);
|
assert_eq!(stream.drain()[..], [0xc2u8, 0xc0u8, 40u8][..]);
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,9 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Common RLP traits
|
//! Common RLP traits
|
||||||
use ::{DecoderError, UntrustedRlp};
|
|
||||||
use bytes::VecLike;
|
|
||||||
use rlpstream::RlpStream;
|
|
||||||
|
|
||||||
use elastic_array::ElasticArray1024;
|
use elastic_array::ElasticArray1024;
|
||||||
|
use stream::RlpStream;
|
||||||
|
use {DecoderError, UntrustedRlp};
|
||||||
|
|
||||||
/// Type is able to decode RLP.
|
/// Type is able to decode RLP.
|
||||||
pub trait Decoder: Sized {
|
pub trait Decoder: Sized {
|
||||||
@ -226,23 +224,7 @@ pub trait View<'a, 'view>: Sized {
|
|||||||
fn val_at<T>(&self, index: usize) -> Result<T, DecoderError> where T: RlpDecodable;
|
fn val_at<T>(&self, index: usize) -> Result<T, DecoderError> where T: RlpDecodable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Raw RLP encoder
|
/// Structure encodable to RLP
|
||||||
pub trait Encoder {
|
|
||||||
/// Write a value represented as bytes
|
|
||||||
fn emit_value<E: ByteEncodable>(&mut self, value: &E);
|
|
||||||
/// Write raw preencoded data to the output
|
|
||||||
fn emit_raw(&mut self, bytes: &[u8]) -> ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Primitive data type encodable to RLP
|
|
||||||
pub trait ByteEncodable {
|
|
||||||
/// Serialize this object to given byte container
|
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V);
|
|
||||||
/// Get size of serialised data in bytes
|
|
||||||
fn bytes_len(&self) -> usize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Structure encodable to RLP. Implement this trait for
|
|
||||||
pub trait Encodable {
|
pub trait Encodable {
|
||||||
/// Append a value to the stream
|
/// Append a value to the stream
|
||||||
fn rlp_append(&self, s: &mut RlpStream);
|
fn rlp_append(&self, s: &mut RlpStream);
|
||||||
@ -255,112 +237,6 @@ pub trait Encodable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Encodable wrapper trait required to handle special case of encoding a &[u8] as string and not as list
|
|
||||||
pub trait RlpEncodable {
|
|
||||||
/// Append a value to the stream
|
|
||||||
fn rlp_append(&self, s: &mut RlpStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RLP encoding stream
|
|
||||||
pub trait Stream: Sized {
|
|
||||||
|
|
||||||
/// Initializes instance of empty `Stream`.
|
|
||||||
fn new() -> Self;
|
|
||||||
|
|
||||||
/// Initializes the `Stream` as a list.
|
|
||||||
fn new_list(len: usize) -> Self;
|
|
||||||
|
|
||||||
/// Apends value to the end of stream, chainable.
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// extern crate rlp;
|
|
||||||
/// use rlp::*;
|
|
||||||
///
|
|
||||||
/// fn main () {
|
|
||||||
/// let mut stream = RlpStream::new_list(2);
|
|
||||||
/// stream.append(&"cat").append(&"dog");
|
|
||||||
/// let out = stream.out();
|
|
||||||
/// assert_eq!(out, vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g']);
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
fn append<'a, E>(&'a mut self, value: &E) -> &'a mut Self where E: RlpEncodable;
|
|
||||||
|
|
||||||
/// Declare appending the list of given size, chainable.
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// extern crate rlp;
|
|
||||||
/// use rlp::*;
|
|
||||||
///
|
|
||||||
/// fn main () {
|
|
||||||
/// let mut stream = RlpStream::new_list(2);
|
|
||||||
/// stream.begin_list(2).append(&"cat").append(&"dog");
|
|
||||||
/// stream.append(&"");
|
|
||||||
/// let out = stream.out();
|
|
||||||
/// assert_eq!(out, vec![0xca, 0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g', 0x80]);
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
fn begin_list(&mut self, len: usize) -> &mut Self;
|
|
||||||
|
|
||||||
/// Apends null to the end of stream, chainable.
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// extern crate rlp;
|
|
||||||
/// use rlp::*;
|
|
||||||
///
|
|
||||||
/// fn main () {
|
|
||||||
/// let mut stream = RlpStream::new_list(2);
|
|
||||||
/// stream.append_empty_data().append_empty_data();
|
|
||||||
/// let out = stream.out();
|
|
||||||
/// assert_eq!(out, vec![0xc2, 0x80, 0x80]);
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
fn append_empty_data(&mut self) -> &mut Self;
|
|
||||||
|
|
||||||
/// Appends raw (pre-serialised) RLP data. Use with caution. Chainable.
|
|
||||||
fn append_raw<'a>(&'a mut self, bytes: &[u8], item_count: usize) -> &'a mut Self;
|
|
||||||
|
|
||||||
/// Clear the output stream so far.
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// extern crate rlp;
|
|
||||||
/// use rlp::*;
|
|
||||||
///
|
|
||||||
/// fn main () {
|
|
||||||
/// let mut stream = RlpStream::new_list(3);
|
|
||||||
/// stream.append(&"cat");
|
|
||||||
/// stream.clear();
|
|
||||||
/// stream.append(&"dog");
|
|
||||||
/// let out = stream.out();
|
|
||||||
/// assert_eq!(out, vec![0x83, b'd', b'o', b'g']);
|
|
||||||
/// }
|
|
||||||
fn clear(&mut self);
|
|
||||||
|
|
||||||
/// Returns true if stream doesnt expect any more items.
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// extern crate rlp;
|
|
||||||
/// use rlp::*;
|
|
||||||
///
|
|
||||||
/// fn main () {
|
|
||||||
/// let mut stream = RlpStream::new_list(2);
|
|
||||||
/// stream.append(&"cat");
|
|
||||||
/// assert_eq!(stream.is_finished(), false);
|
|
||||||
/// stream.append(&"dog");
|
|
||||||
/// assert_eq!(stream.is_finished(), true);
|
|
||||||
/// let out = stream.out();
|
|
||||||
/// assert_eq!(out, vec![0xc8, 0x83, b'c', b'a', b't', 0x83, b'd', b'o', b'g']);
|
|
||||||
/// }
|
|
||||||
fn is_finished(&self) -> bool;
|
|
||||||
|
|
||||||
/// Get raw encoded bytes
|
|
||||||
fn as_raw(&self) -> &[u8];
|
|
||||||
|
|
||||||
/// Streams out encoded bytes.
|
|
||||||
///
|
|
||||||
/// panic! if stream is not finished.
|
|
||||||
fn out(self) -> Vec<u8>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Trait for compressing and decompressing RLP by replacement of common terms.
|
/// Trait for compressing and decompressing RLP by replacement of common terms.
|
||||||
pub trait Compressible: Sized {
|
pub trait Compressible: Sized {
|
||||||
/// Indicates the origin of RLP to be compressed.
|
/// Indicates the origin of RLP to be compressed.
|
@ -427,7 +427,7 @@ impl JournalDB for EarlyMergeDB {
|
|||||||
|
|
||||||
r.begin_list(inserts.len());
|
r.begin_list(inserts.len());
|
||||||
inserts.iter().foreach(|&(k, _)| {r.append(&k);});
|
inserts.iter().foreach(|&(k, _)| {r.append(&k);});
|
||||||
r.append(&removes);
|
r.append_list(&removes);
|
||||||
Self::insert_keys(&inserts, &*self.backing, self.column, &mut refs, batch, trace);
|
Self::insert_keys(&inserts, &*self.backing, self.column, &mut refs, batch, trace);
|
||||||
|
|
||||||
let ins = inserts.iter().map(|&(k, _)| k).collect::<Vec<_>>();
|
let ins = inserts.iter().map(|&(k, _)| k).collect::<Vec<_>>();
|
||||||
|
@ -278,7 +278,7 @@ impl JournalDB for OverlayRecentDB {
|
|||||||
|
|
||||||
journal_overlay.backing_overlay.emplace(short_key, v);
|
journal_overlay.backing_overlay.emplace(short_key, v);
|
||||||
}
|
}
|
||||||
r.append(&removed_keys);
|
r.append_list(&removed_keys);
|
||||||
|
|
||||||
let mut k = RlpStream::new_list(3);
|
let mut k = RlpStream::new_list(3);
|
||||||
let index = journal_overlay.journal.get(&now).map_or(0, |j| j.len());
|
let index = journal_overlay.journal.get(&now).map_or(0, |j| j.len());
|
||||||
|
@ -136,8 +136,8 @@ impl JournalDB for RefCountedDB {
|
|||||||
|
|
||||||
let mut r = RlpStream::new_list(3);
|
let mut r = RlpStream::new_list(3);
|
||||||
r.append(id);
|
r.append(id);
|
||||||
r.append(&self.inserts);
|
r.append_list(&self.inserts);
|
||||||
r.append(&self.removes);
|
r.append_list(&self.removes);
|
||||||
batch.put(self.column, &last, r.as_raw());
|
batch.put(self.column, &last, r.as_raw());
|
||||||
|
|
||||||
let ops = self.inserts.len() + self.removes.len();
|
let ops = self.inserts.len() + self.removes.len();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
//! Diff misc.
|
//! Diff misc.
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use rlp::{Stream, RlpStream};
|
use rlp::RlpStream;
|
||||||
use target_info::Target;
|
use target_info::Target;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
||||||
|
@ -24,7 +24,7 @@ use super::node::NodeKey;
|
|||||||
use ::{HashDB, H256};
|
use ::{HashDB, H256};
|
||||||
use ::bytes::ToPretty;
|
use ::bytes::ToPretty;
|
||||||
use ::nibbleslice::NibbleSlice;
|
use ::nibbleslice::NibbleSlice;
|
||||||
use ::rlp::{Rlp, RlpStream, View, Stream};
|
use ::rlp::{Rlp, RlpStream, View};
|
||||||
use ::sha3::SHA3_NULL_RLP;
|
use ::sha3::SHA3_NULL_RLP;
|
||||||
use hashdb::DBValue;
|
use hashdb::DBValue;
|
||||||
|
|
||||||
@ -931,7 +931,6 @@ impl<'a> Drop for TrieDBMut<'a> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use triehash::trie_root;
|
use triehash::trie_root;
|
||||||
use hash::*;
|
|
||||||
use hashdb::*;
|
use hashdb::*;
|
||||||
use memorydb::*;
|
use memorydb::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -23,7 +23,7 @@ use std::cmp;
|
|||||||
use hash::*;
|
use hash::*;
|
||||||
use sha3::*;
|
use sha3::*;
|
||||||
use rlp;
|
use rlp;
|
||||||
use rlp::{RlpStream, Stream};
|
use rlp::RlpStream;
|
||||||
use vector::SharedPrefix;
|
use vector::SharedPrefix;
|
||||||
|
|
||||||
/// Generates a trie root hash for a vector of values
|
/// Generates a trie root hash for a vector of values
|
||||||
|
Loading…
Reference in New Issue
Block a user