diff --git a/Cargo.lock b/Cargo.lock index 59c703471d513..5c6634ce61e59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,11 @@ +[[package]] +name = "MacTypes-sys" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "aes-ctr" version = "0.1.0" @@ -34,7 +42,7 @@ name = "aho-corasick" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -45,9 +53,9 @@ dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -71,7 +79,7 @@ dependencies = [ "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "shell32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -81,7 +89,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "arrayvec" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -105,48 +113,46 @@ name = "assert_matches" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "aster" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "autocfg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "backtrace" -version = "0.3.9" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.24" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "base-x" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -183,29 +189,23 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.29.1" +version = "0.37.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "clang-sys 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clang-sys 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "bitflags" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "bitflags" version = "0.9.1" @@ -231,7 +231,7 @@ name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -274,7 +274,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bytes" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -288,7 +288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.25" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -323,17 +323,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clang-sys" -version = "0.21.2" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libloading 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -356,7 +356,7 @@ name = "clear_on_drop" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -372,7 +372,7 @@ name = "cmake" version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -383,7 +383,7 @@ dependencies = [ "ascii 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -398,7 +398,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -406,7 +406,7 @@ name = "core-foundation-sys" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -417,14 +417,14 @@ dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-stats 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", "simplelog 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -452,8 +452,29 @@ dependencies = [ [[package]] name = "crossbeam" -version = "0.2.12" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-channel" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "crossbeam-deque" @@ -466,11 +487,11 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -478,7 +499,7 @@ name = "crossbeam-epoch" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -489,12 +510,12 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -510,12 +531,7 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crossbeam-utils" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -582,20 +598,20 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "datastore" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "base64 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "chashmap 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -629,7 +645,7 @@ dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -662,9 +678,9 @@ version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -678,7 +694,7 @@ name = "error-chain" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -686,8 +702,8 @@ name = "eth-secp256k1" version = "0.5.7" source = "git+https://github.com/paritytech/rust-secp256k1#ccc06e7480148b723eb44ac56cf4d20eec380b6f" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -699,30 +715,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "exit-future" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure_derive" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -736,7 +752,7 @@ name = "fdlimit" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -759,7 +775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -789,7 +805,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -819,7 +835,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -840,7 +856,7 @@ name = "getset" version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -858,8 +874,8 @@ dependencies = [ "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -868,7 +884,7 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -876,7 +892,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "string 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -902,7 +918,7 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -944,7 +960,7 @@ name = "http" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -956,7 +972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "humantime" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -972,8 +988,8 @@ dependencies = [ "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -985,7 +1001,7 @@ name = "hyper" version = "0.12.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "h2 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -995,14 +1011,14 @@ dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1016,6 +1032,23 @@ dependencies = [ "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "impl-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "impl-serde" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "indexmap" version = "1.0.2" @@ -1036,7 +1069,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1046,8 +1079,8 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1072,19 +1105,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "jsonrpc-core" version = "9.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#cd27b905868d7919bed6ec8113e846c459e93831" +source = "git+https://github.com/paritytech/jsonrpc.git#24b9befa3389d9aa64b49b2573d1250143f17743" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-http-server" version = "9.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#cd27b905868d7919bed6ec8113e846c459e93831" +source = "git+https://github.com/paritytech/jsonrpc.git#24b9befa3389d9aa64b49b2573d1250143f17743" dependencies = [ "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", @@ -1097,35 +1130,35 @@ dependencies = [ [[package]] name = "jsonrpc-macros" version = "9.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#cd27b905868d7919bed6ec8113e846c459e93831" +source = "git+https://github.com/paritytech/jsonrpc.git#24b9befa3389d9aa64b49b2573d1250143f17743" dependencies = [ "jsonrpc-core 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", "jsonrpc-pubsub 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-pubsub" version = "9.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#cd27b905868d7919bed6ec8113e846c459e93831" +source = "git+https://github.com/paritytech/jsonrpc.git#24b9befa3389d9aa64b49b2573d1250143f17743" dependencies = [ "jsonrpc-core 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-server-utils" version = "9.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#cd27b905868d7919bed6ec8113e846c459e93831" +source = "git+https://github.com/paritytech/jsonrpc.git#24b9befa3389d9aa64b49b2573d1250143f17743" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1133,13 +1166,13 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" version = "9.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#cd27b905868d7919bed6ec8113e846c459e93831" +source = "git+https://github.com/paritytech/jsonrpc.git#24b9befa3389d9aa64b49b2573d1250143f17743" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", "jsonrpc-server-utils 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "ws 0.7.9 (git+https://github.com/tomusdrw/ws-rs)", ] @@ -1191,10 +1224,10 @@ dependencies = [ "interleaved-ordered 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rocksdb 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rocksdb 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1202,11 +1235,6 @@ name = "language-tags" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "lazy_static" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "lazy_static" version = "1.2.0" @@ -1214,139 +1242,129 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazycell" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.43" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libloading" -version = "0.4.3" +version = "0.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "libloading" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-dns 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-floodsub 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-identify 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-kad 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-mplex 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-peerstore 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-ping 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-ratelimit 0.1.1 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-relay 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-secio 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-tcp-transport 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-transport-timeout 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-uds 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-websocket 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-yamux 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "multihash 0.8.1-pre (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-dns 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-floodsub 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-kad 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-mplex 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-ratelimit 0.1.1 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-relay 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-secio 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-tcp-transport 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-transport-timeout 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-uds 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-websocket 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-yamux 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "multihash 0.8.1-pre (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "multistream-select 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rw-stream-sink 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-dns" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "tokio-dns-unofficial 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-floodsub" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-identify" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-peerstore 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1354,216 +1372,221 @@ dependencies = [ [[package]] name = "libp2p-kad" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "datastore 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-identify 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-ping 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "multihash 0.8.1-pre (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mplex" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-peerstore" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "datastore 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ping" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "multistream-select 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ratelimit" version = "0.1.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "aio-limited 0.1.0 (git+https://github.com/paritytech/aio-limited.git)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-relay" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "libp2p-peerstore 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "protobuf 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "protobuf 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-secio" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "aes-ctr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "asn1_der 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "ctr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "ed25519-dalek 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rw-stream-sink 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "twofish 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-tcp-transport" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "tk-listen 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-transport-timeout" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-uds" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-websocket" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "rw-stream-sink 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "websocket 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-yamux" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "yamux 0.1.0 (git+https://github.com/paritytech/yamux)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "yamux 0.1.6 (git+https://github.com/paritytech/yamux)", ] [[package]] name = "librocksdb-sys" -version = "5.11.3" +version = "5.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bindgen 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "bindgen 0.37.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "linked-hash-map" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "linked-hash-map" version = "0.5.1" @@ -1571,10 +1594,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lock_api" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1599,6 +1622,14 @@ name = "lru" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lru-cache" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "make-cmd" version = "0.1.0" @@ -1632,16 +1663,16 @@ name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1681,8 +1712,8 @@ dependencies = [ "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.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 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1695,7 +1726,7 @@ name = "mio-extras" version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1707,7 +1738,7 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1725,21 +1756,21 @@ dependencies = [ [[package]] name = "multiaddr" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "data-encoding 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "multihash 0.8.1-pre (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "multihash" version = "0.8.1-pre" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ "blake2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1751,14 +1782,14 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1776,15 +1807,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1793,7 +1824,7 @@ version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1803,9 +1834,9 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1814,7 +1845,7 @@ name = "node-cli" version = "0.1.0" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1825,7 +1856,8 @@ dependencies = [ "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", - "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-basic-authorship 0.1.0", "substrate-cli 0.3.0", "substrate-client 0.1.0", "substrate-consensus-aura 0.1.0", @@ -1837,7 +1869,7 @@ dependencies = [ "substrate-service 0.3.0", "substrate-service-test 0.3.0", "substrate-transaction-pool 0.1.0", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1866,7 +1898,7 @@ dependencies = [ "substrate-state-machine 0.1.0", "substrate-trie 0.4.0", "trie-root 0.9.0 (git+https://github.com/paritytech/trie)", - "wabt 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1876,8 +1908,8 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "sr-std 0.1.0", "substrate-primitives 0.1.0", @@ -1895,7 +1927,7 @@ dependencies = [ "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "sr-std 0.1.0", "sr-version 0.1.0", @@ -1909,6 +1941,7 @@ dependencies = [ "srml-grandpa 0.1.0", "srml-session 0.1.0", "srml-staking 0.1.0", + "srml-sudo 0.1.0", "srml-support 0.1.0", "srml-system 0.1.0", "srml-timestamp 0.1.0", @@ -1927,7 +1960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "nohash-hasher" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1964,15 +1997,15 @@ name = "num_cpus" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num_cpus" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1996,15 +2029,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.10.15" +version = "0.10.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2014,11 +2047,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.39" +version = "0.9.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2037,22 +2070,25 @@ dependencies = [ ] [[package]] -name = "parity-bytes" -version = "0.1.0" -source = "git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6#616b40150ded71f57f650067fcbc5c99d7c343e6" +name = "owning_ref" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "parity-bytes" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6#616b40150ded71f57f650067fcbc5c99d7c343e6" [[package]] name = "parity-codec" version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2067,11 +2103,11 @@ dependencies = [ [[package]] name = "parity-crypto" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2117,18 +2153,27 @@ name = "parking_lot" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2137,10 +2182,22 @@ name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2177,6 +2234,18 @@ dependencies = [ "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "primitive-types" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro-hack" version = "0.4.1" @@ -2192,7 +2261,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro2" -version = "0.3.8" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2208,7 +2277,7 @@ dependencies = [ [[package]] name = "protobuf" -version = "2.1.4" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2221,26 +2290,6 @@ dependencies = [ "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "quasi" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quasi_codegen" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quick-error" version = "0.1.4" @@ -2256,7 +2305,7 @@ name = "quote" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2273,7 +2322,7 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2283,7 +2332,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2294,36 +2343,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.6.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_isaac 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2349,35 +2397,39 @@ dependencies = [ [[package]] name = "rand_isaac" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_pcg" -version = "0.1.1" +name = "rand_os" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_xorshift" -version = "0.1.0" +name = "rand_pcg" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rayon" -version = "0.8.2" +name = "rand_xorshift" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2397,8 +2449,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2406,20 +2458,20 @@ name = "redis" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "combine 3.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" -version = "0.1.40" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2427,7 +2479,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2436,7 +2488,7 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2444,12 +2496,12 @@ dependencies = [ [[package]] name = "regex" -version = "1.0.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2459,15 +2511,15 @@ name = "regex-syntax" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2492,23 +2544,22 @@ dependencies = [ [[package]] name = "ring" -version = "0.12.1" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rocksdb" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "librocksdb-sys 5.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "librocksdb-sys 5.14.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2517,15 +2568,15 @@ version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-demangle" -version = "0.1.9" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2554,11 +2605,11 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5#d961e656a74d1bab5366d371a06f9e10d5f4a6c5" +source = "git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec#997d0163bc8a7e11559524ad8466bc3b1850c8ec" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2610,17 +2661,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "security-framework-sys" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "MacTypes-sys 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2638,27 +2690,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.80" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.80" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2698,7 +2750,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2723,28 +2775,28 @@ dependencies = [ [[package]] name = "slog-json" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "slog-scope" -version = "4.0.1" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2762,7 +2814,7 @@ dependencies = [ "substrate-client 0.1.0", "substrate-primitives 0.1.0", "substrate-test-client 0.1.0", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2788,9 +2840,9 @@ dependencies = [ "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-std 0.1.0", "substrate-primitives 0.1.0", @@ -2805,8 +2857,8 @@ dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", "substrate-primitives 0.1.0", - "wabt 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2822,8 +2874,8 @@ version = "0.1.0" dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "sr-std 0.1.0", ] @@ -2835,7 +2887,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -2852,8 +2904,8 @@ dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -2873,7 +2925,7 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -2890,7 +2942,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -2908,7 +2960,7 @@ dependencies = [ "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-sandbox 0.1.0", @@ -2917,7 +2969,7 @@ dependencies = [ "srml-support 0.1.0", "srml-system 0.1.0", "substrate-primitives 0.1.0", - "wabt 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2928,7 +2980,7 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -2947,7 +2999,7 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -2964,7 +3016,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -2981,7 +3033,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -2998,8 +3050,8 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3016,8 +3068,8 @@ version = "0.1.0" dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", "substrate-primitives 0.1.0", ] @@ -3030,7 +3082,7 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3049,7 +3101,7 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3063,6 +3115,24 @@ dependencies = [ "substrate-primitives 0.1.0", ] +[[package]] +name = "srml-sudo" +version = "0.1.0" +dependencies = [ + "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 0.1.0", + "sr-primitives 0.1.0", + "sr-std 0.1.0", + "srml-consensus 0.1.0", + "srml-support 0.1.0", + "srml-support-procedural 0.1.0", + "srml-system 0.1.0", + "substrate-primitives 0.1.0", +] + [[package]] name = "srml-support" version = "0.1.0" @@ -3075,11 +3145,11 @@ dependencies = [ "once_cell 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "redis 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3095,7 +3165,7 @@ dependencies = [ "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 0.1.0", "srml-support-procedural-tools 0.1.0", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3105,7 +3175,7 @@ dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "srml-support-procedural-tools-derive 0.1.0", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3114,7 +3184,7 @@ version = "0.1.0" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3125,7 +3195,7 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3139,7 +3209,7 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3156,7 +3226,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3173,7 +3243,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3201,14 +3271,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "stdweb" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-macros 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-runtime 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3218,29 +3288,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "stdweb-internal-macros" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base-x 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "stdweb-internal-runtime" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -3263,22 +3333,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "structopt" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3292,7 +3362,7 @@ dependencies = [ [[package]] name = "substrate" -version = "0.9.1" +version = "0.10.0" dependencies = [ "ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3301,6 +3371,20 @@ dependencies = [ "vergen 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "substrate-basic-authorship" +version = "0.1.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 0.1.0", + "substrate-client 0.1.0", + "substrate-consensus-aura-primitives 0.1.0", + "substrate-consensus-common 0.1.0", + "substrate-primitives 0.1.0", + "substrate-transaction-pool 0.1.0", +] + [[package]] name = "substrate-cli" version = "0.3.0" @@ -3308,29 +3392,29 @@ dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "srml-support 0.1.0", - "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-client 0.1.0", "substrate-network 0.1.0", "substrate-primitives 0.1.0", "substrate-service 0.3.0", "substrate-telemetry 0.3.0", "sysinfo 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3347,7 +3431,7 @@ dependencies = [ "kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 0.1.0", "sr-primitives 0.1.0", @@ -3372,9 +3456,10 @@ dependencies = [ "kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)", "kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "substrate-client 0.1.0", "substrate-executor 0.1.0", @@ -3395,7 +3480,7 @@ dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-version 0.1.0", @@ -3410,7 +3495,7 @@ dependencies = [ "substrate-primitives 0.1.0", "substrate-service 0.3.0", "substrate-test-client 0.1.0", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3432,12 +3517,15 @@ version = "0.1.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "sr-version 0.1.0", "substrate-primitives 0.1.0", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-test-client 0.1.0", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3445,12 +3533,12 @@ name = "substrate-consensus-rhd" version = "0.1.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rhododendron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", @@ -3464,7 +3552,7 @@ dependencies = [ "substrate-keyring 0.1.0", "substrate-primitives 0.1.0", "substrate-transaction-pool 0.1.0", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3478,17 +3566,17 @@ dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-version 0.1.0", "substrate-primitives 0.1.0", "substrate-serializer 0.1.0", "substrate-state-machine 0.1.0", "substrate-trie 0.4.0", - "wabt 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3501,8 +3589,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "substrate-client 0.1.0", "substrate-consensus-common 0.1.0", @@ -3512,7 +3600,7 @@ dependencies = [ "substrate-primitives 0.1.0", "substrate-service 0.3.0", "substrate-test-client 0.1.0", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3542,13 +3630,13 @@ version = "0.1.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-crypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0", - "subtle 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3564,7 +3652,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", @@ -3574,7 +3662,7 @@ dependencies = [ "substrate-network-libp2p 0.1.0", "substrate-primitives 0.1.0", "substrate-test-client 0.1.0", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3582,22 +3670,22 @@ name = "substrate-network-libp2p" version = "0.1.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3608,25 +3696,24 @@ dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", "substrate-serializer 0.1.0", - "twox-hash 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3641,11 +3728,11 @@ dependencies = [ "jsonrpc-pubsub 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "sr-version 0.1.0", "substrate-client 0.1.0", @@ -3655,7 +3742,7 @@ dependencies = [ "substrate-primitives 0.1.0", "substrate-test-client 0.1.0", "substrate-transaction-pool 0.1.0", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3666,7 +3753,7 @@ dependencies = [ "jsonrpc-pubsub 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", "jsonrpc-ws-server 9.0.0 (git+https://github.com/paritytech/jsonrpc.git)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "substrate-rpc 0.1.0", ] @@ -3675,8 +3762,8 @@ dependencies = [ name = "substrate-serializer" version = "0.1.0" dependencies = [ - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3684,21 +3771,20 @@ name = "substrate-service" version = "0.3.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "substrate-client 0.1.0", "substrate-client-db 0.1.0", - "substrate-consensus-aura-primitives 0.1.0", "substrate-consensus-common 0.1.0", "substrate-executor 0.1.0", "substrate-keystore 0.1.0", @@ -3708,7 +3794,7 @@ dependencies = [ "substrate-test-client 0.1.0", "substrate-transaction-pool 0.1.0", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3726,7 +3812,7 @@ dependencies = [ "substrate-primitives 0.1.0", "substrate-service 0.3.0", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3737,7 +3823,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0", ] @@ -3750,7 +3836,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0", "substrate-trie 0.4.0", "trie-db 0.9.0 (git+https://github.com/paritytech/trie)", @@ -3763,11 +3849,11 @@ version = "0.3.0" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-scope 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3794,8 +3880,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -3803,6 +3889,7 @@ dependencies = [ "srml-support 0.1.0", "substrate-client 0.1.0", "substrate-consensus-aura-primitives 0.1.0", + "substrate-executor 0.1.0", "substrate-keyring 0.1.0", "substrate-primitives 0.1.0", ] @@ -3815,9 +3902,9 @@ dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "substrate-test-runtime 0.1.0", ] @@ -3830,7 +3917,7 @@ dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "substrate-client 0.1.0", "substrate-keyring 0.1.0", @@ -3858,12 +3945,12 @@ dependencies = [ [[package]] name = "subtle" -version = "0.5.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "subtle" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -3871,7 +3958,7 @@ name = "syn" version = "0.13.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3888,7 +3975,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.22" +version = "0.15.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3903,59 +3990,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "syntex" -version = "0.58.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_errors" -version = "0.58.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_pos" -version = "0.58.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_syntax" -version = "0.58.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "sysinfo" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3981,13 +4026,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.0.4" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4014,8 +4059,8 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4032,8 +4077,8 @@ name = "thread-id" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4052,11 +4097,11 @@ dependencies = [ [[package]] name = "time" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4070,34 +4115,35 @@ dependencies = [ [[package]] name = "tk-listen" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio" -version = "0.1.11" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-current-thread 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-udp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4105,9 +4151,9 @@ name = "tokio-codec" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4115,26 +4161,26 @@ name = "tokio-core" version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-current-thread" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4145,130 +4191,133 @@ dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-executor" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-fs" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-io" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-reactor" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-tcp" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-threadpool" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-deque 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-timer" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-tls" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-udp" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-uds" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4337,10 +4386,10 @@ dependencies = [ [[package]] name = "twox-hash" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4355,7 +4404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ucd-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -4365,6 +4414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4407,11 +4457,6 @@ name = "unicode-width" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" version = "0.1.0" @@ -4438,13 +4483,13 @@ name = "unsigned-varint" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "untrusted" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -4495,21 +4540,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wabt" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "wabt-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt-sys 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wabt-sys" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4526,7 +4571,7 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4542,19 +4587,27 @@ dependencies = [ "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tls 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "which" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi" version = "0.2.8" @@ -4607,7 +4660,7 @@ version = "0.7.9" source = "git+https://github.com/tomusdrw/ws-rs#4baef2dc1abc8e216559af51cfc120bbcc777e21" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4624,12 +4677,12 @@ version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4647,7 +4700,7 @@ dependencies = [ [[package]] name = "xdg" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -4657,20 +4710,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "yamux" -version = "0.1.0" -source = "git+https://github.com/paritytech/yamux#8f3d16e7645447645d3552a52159d56c8a01de27" +version = "0.1.6" +source = "git+https://github.com/paritytech/yamux#957bccae409e827db4be05abb67d1d6246d5f5c8" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "nohash-hasher 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nohash-hasher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] +"checksum MacTypes-sys 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7dbbe033994ae2198a18517c7132d952a29fb1db44249a1234779da7c50f4698" "checksum aes-ctr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f65958ff3692041c36fc009261ccd63f24cd8e0dc1164266f068c2387e8b4e4f" "checksum aes-soft 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67cc03b0a090a05cb01e96998a01905d7ceedce1bc23b756c0bb7faa0682ccb1" "checksum aesni 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6810b7fb9f2bb4f76f05ac1c170b8dde285b6308955dc3afd89710268c958d9e" @@ -4680,21 +4735,20 @@ dependencies = [ "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" -"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" +"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum ascii 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a5fc969a8ce2c9c0c4b0429bb8431544f6658283c8326ba5ff8c762b75369335" "checksum asn1_der 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "766afdc5c6d7c15de1abe4c9c15e360be3aa972c363ba5b606be3c4271235886" "checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" -"checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" -"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" -"checksum base-x 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5cda5d0f5584d129112ad8bf4775b9fd2b9f1e30738c7b1a25314ba2244d6a51" +"checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" +"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum base64 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5032d51da2741729bfdaeb2664d9b8c6d9fd1e2b90715c660b6def36628499c2" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecac13b3c745150d7b6c3ea7572d372f09d627c2077e893bf26c5c7f70d282" -"checksum bindgen 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ba610cba0c1727ed837316540068b51349b8268c073906067b7c3948598929bd" -"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" +"checksum bindgen 0.37.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1b25ab82877ea8fe6ce1ce1f8ac54361f0218bad900af9eb11803994bf67c221" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum blake2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73b77e29dbd0115e43938be2d5128ecf81c0353e00acaa65339a1242586951d9" @@ -4705,14 +4759,14 @@ dependencies = [ "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96c8b41881888cc08af32d47ac4edd52bc7fa27fef774be47a92443756451304" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" -"checksum bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0ce55bd354b095246fc34caf4e9e242f5297a7fd938b090cadfea6eee614aa62" +"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" "checksum cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "011941fb53da1a8ac3e4132a1becc367c44fe13f630769f3143d8c66c91c6cb6" -"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" +"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42aac45e9567d97474a834efdee3081b3c942b2205be932092f53354ce503d6c" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chashmap 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "47e651a8c1eb0cbbaa730f705e2531e75276c6f2bbe2eb12662cfd305213dff8" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" -"checksum clang-sys 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e414af9726e1d11660801e73ccc7fb81803fb5f49e5903a25b348b2b3b480d2e" +"checksum clang-sys 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7f7c04e52c35222fffcc3a115b5daf5f7e2bfb71c13c4e2321afe1fc71859c2" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -4724,14 +4778,14 @@ dependencies = [ "checksum criterion 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f58b0200bf321214bdda8c797cf0071bcc638171c40ec198c3f652a4edaacde3" "checksum criterion-plot 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "885431f7865f9d4956b466126674e5ea40a0f193d42157e56630c356c5501957" "checksum criterion-stats 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c71521cb4c7b7eac76b540e75447fb0172c4234d6333729001b886aaa21d6da4" -"checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" +"checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" +"checksum crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "137bc235f622ffaa0428e3854e24acb53291fc0b3ff6fb2cb75a8be6fb02f06b" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" -"checksum crossbeam-deque 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe1b6f945f824c7a25afe44f62e25d714c0cc523f8e99d8db5cd1026e1269d3" +"checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" -"checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8" +"checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" -"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" -"checksum crossbeam-utils 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c55913cc2799171a550e307918c0a360e8c16004820291bf3b638969b4a01816" +"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" "checksum crypto-mac 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0999b4ff4d3446d4ddb19a63e9e00c1876e75cd7000d20e57a693b4b3f08d958" @@ -4739,8 +4793,8 @@ dependencies = [ "checksum ctr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4b669fcb8e20124db86dbd9b01e74ec0e9e420e65381311ce5249864fc7ff0c0" "checksum ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "630391922b1b893692c6334369ff528dcc3a9d8061ccf4c803aa8f83cb13db5e" "checksum curve25519-dalek 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3eacf6ff1b911e3170a8c400b402e10c86dc3cb166bd69034ebbc2b785fea4c2" -"checksum data-encoding 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "67df0571a74bf0d97fb8b2ed22abdd9a48475c96bd327db968b7d9cace99655e" -"checksum datastore 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" +"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" +"checksum datastore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" "checksum difference 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3304d19798a8e067e48d8e69b2c37f0b5e9b4e462504ad9e27e9f3fce02bba8" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" @@ -4754,9 +4808,9 @@ dependencies = [ "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)" = "" "checksum etrace 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f17311e68ea07046ee809b8513f6c259518bc10173681d98c21f8c3926f56f40" -"checksum exit-future 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9aa7b56cef68c4182db7212dece19cc9f6e2916cf9412e57e6cea53ec02f316d" -"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" -"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" +"checksum exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "87559b08e99a81a92bbb867d237543e43495857749f688e0773390a20d56c61c" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa" "checksum finality-grandpa 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a1dffe3c9d4c59d964f25cea31880e56c20414cdae7efe2269411238f850ad39" @@ -4778,17 +4832,19 @@ dependencies = [ "checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" -"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4da5f0e01bd8a71a224a4eedecaacfcabda388dbb7a80faf04d3514287572d95" "checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" "checksum hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a" "checksum http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "02096a6d2c55e63f7fcb800690e4f889a25f6ec342e3adb4594e293b625215ab" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" -"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" +"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "df0caae6b71d266b91b4a83111a61d2b94ed2e2bea024c532b933dcff867e58c" "checksum hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)" = "f1ebec079129e43af5e234ef36ee3d7e6085687d145b7ea653b262d16c6b65f1" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +"checksum impl-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c88568d828291c50eed30cd7fb9f8e688ad0013620186fa3e777b9f206c79f2" +"checksum impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5158079de9d4158e0ce1de3ae0bd7be03904efc40b3d7dd8b8c301cbf6b52b56" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ea155abb3ba6f382a75f1418988c05fe82959ed9ce727de427f9cfd425b0c903" "checksum interleaved-ordered 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "141340095b15ed7491bd3d4ced9d20cebfb826174b6bb03386381f62b01e3d77" @@ -4809,41 +4865,41 @@ dependencies = [ "checksum kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)" = "" "checksum kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)" = "" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" -"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" -"checksum libloading 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fd38073de8f7965d0c17d30546d4bb6da311ab428d1c7a3fc71dff7f9d4979b9" +"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" -"checksum libp2p 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-core 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-dns 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-floodsub 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-identify 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-kad 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-mplex 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-peerstore 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-ping 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-ratelimit 0.1.1 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-relay 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-secio 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-tcp-transport 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-transport-timeout 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-uds 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-websocket 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum libp2p-yamux 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum librocksdb-sys 5.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1b0fa7f4ca5ceff76237db63802cb073d84e64a327e38478e79a669093fb7fa5" +"checksum libp2p 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-core 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-dns 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-floodsub 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-identify 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-kad 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-mplex 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-peerstore 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-ping 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-ratelimit 0.1.1 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-relay 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-secio 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-tcp-transport 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-transport-timeout 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-uds 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-websocket 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum libp2p-yamux 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum librocksdb-sys 5.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "474d805d72e23a06310fa5201dfe182dc4b80ab1f18bb2823c1ac17ff9dcbaa2" +"checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" "checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" -"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" +"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6f5fb2abee91622dfb5fbcf2f277dc8c421c9259c6ce5484eee46ab7ae2282d6" +"checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" "checksum make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8ca8afbe8af1785e09636acb5a41e08a765f5f0340568716c18a8700ba3c0d3" "checksum mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f2d82b34c7fb11bb41719465c060589e291d505ca4735ea30016a91f6fc79c3b" "checksum mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "aa607bfb674b4efb310512527d64266b065de3f894fc52f84efcbf7eaa5965fb" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" +"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memory-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" @@ -4852,54 +4908,55 @@ dependencies = [ "checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum multiaddr 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum multihash 0.8.1-pre (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" -"checksum multistream-select 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" +"checksum multiaddr 0.3.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum multihash 0.8.1-pre (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" +"checksum multistream-select 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" "checksum names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef320dab323286b50fb5cdda23f61c796a72a89998ab565ca32525c5c556f2da" "checksum native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8e08de0070bbf4c31f452ea2a70db092f36f6f2e4d897adf5674477d488fb2" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum nohash-hasher 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "27593c72432b8cec9ae79e92792a73c38341064d525b6b612a9fccf8b7d17407" +"checksum nohash-hasher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d138afcce92d219ccb6eb53d9b1e8a96ac0d633cfd3c53cd9856d96d1741bb8" "checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "cee7e88156f3f9e19bdd598f8d6c9db7bf4078f99f8381f43a55b09648d1a6e3" -"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" "checksum once_cell 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d7ce3535d54560c937c1652ba4a0da66bfc63e0f8e07bed127483afb6e5ee925" "checksum opaque-debug 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d620c9c26834b34f039489ac0dfdb12c7ac15ccaf818350a64c9b5334a452ad7" -"checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" +"checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" +"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" "checksum owning_ref 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9d52571ddcb42e9c900c901a18d8d67e393df723fcd51dd59c5b1a85d0acb6cc" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)" = "" -"checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c" "checksum parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dca389ea5e1632c89b2ce54f7e2b4a8a8c9d278042222a91e0bf95451218cb4c" "checksum parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffa42c2cb493b60b12c75b26e8c94cb734af4df4d7f2cc229dc04c1953dac189" -"checksum parity-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c1117f6574377d21309bfa1f7d69ff734120685d92b02c3f362b122585758840" +"checksum parity-crypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8adf489acb31f1922db0ce43803b6f48a425241a8473611be3cc625a8e4a4c47" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" "checksum parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fa12d706797d42551663426a45e2db2e0364bd1dbf6aeada87e89c5f981f43e9" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" "checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" +"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum pretty_assertions 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "28ea5118e2f41bfbc974b28d88c07621befd1fa5d6ec23549be96302a1a59dd2" "checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" +"checksum primitive-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f47c18b4601125931d69fcf7b000c2c16a304e4f84d58218d6470b4502e00b58" "checksum proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c725b36c99df7af7bf9324e9c999b9e37d92c8f8caf106d82e1d7953218d2d8" "checksum proc-macro-hack-impl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2b753ad9ed99dd8efeaa7d2fb8453c8f6bc3e54b97966d35f1bc77ca6865254a" -"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" +"checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" -"checksum protobuf 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "671a9cce836bd3635b40b2b0a72783481755ee988c493891f4e974b45264cc9d" +"checksum protobuf 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eae0479da11de87d371fa47eb033059715ffa8f714748da20aa364d56ec5bee2" "checksum pwasm-utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "efd695333cfae6e9dbe2703a6d040e252b57a6fc3b9a65c712615ac042b2e0c5" -"checksum quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18c45c4854d6d1cf5d531db97c75880feb91c958b0720f4ec1057135fec358b3" -"checksum quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9e25fa23c044c1803f43ca59c98dac608976dd04ce799411edd58ece776d4" "checksum quick-error 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5fb6ccf8db7bbcb9c2eae558db5ab4f3da1c2a87e4e597ed394726bc8ea6ca1d" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" @@ -4907,35 +4964,35 @@ dependencies = [ "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" -"checksum rand 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de3f08319b5395bd19b70e73c4c465329495db02dafeb8ca711a20f1c2bd058c" -"checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a" +"checksum rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b65e163105a6284f841bd23100a015895f54340e88a5ffc9ca7b8b33827cfce0" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -"checksum rand_isaac 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6ecfe9ebf36acd47a49d150990b047a5f7db0a7236ee2414b7ff5cc1097c7b" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_os 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de5ac4de1c2973e1391dc305cb0fbf8788cb58068e98255439b7485a77022273" "checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" -"checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" -"checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum redis 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c747d743d48233f9bc3ed3fb00cb84c1d98d8c7f54ed2d4cca9adf461a7ef3" -"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" +"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -"checksum regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -"checksum regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fbc557aac2b708fe84121caf261346cc2eed71978024337e42eb46b8a252ac6e" +"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum rhododendron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a09bc21b21795c366c8bf0e87afb71175f5f736b3a5b279b6f4e81839d0a877b" -"checksum ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7d28b30a72c01b458428e0ae988d4149c20d902346902be881e3edc4bb325c" -"checksum rocksdb 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a806011ca1d26f37729ed4dc78afd607cc86d37ee913718108b0b267e768d46f" +"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" +"checksum rocksdb 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39be726e556e6f21d54d21cdf1be9f6df30c0411a5856c1abf3f4bb12498f2ed" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" -"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" +"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum rw-stream-sink 0.1.0 (git+https://github.com/libp2p/rust-libp2p?rev=d961e656a74d1bab5366d371a06f9e10d5f4a6c5)" = "" +"checksum rw-stream-sink 0.1.0 (git+https://github.com/tomaka/libp2p-rs?rev=997d0163bc8a7e11559524ad8466bc3b1850c8ec)" = "" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f7bf422d23a88c16d5090d455f182bc99c60af4df6a345c63428acf5129e347" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" @@ -4944,12 +5001,12 @@ dependencies = [ "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "697d3f3c23a618272ead9e1fb259c1411102b31c6af8b93f1d64cca9c3b0e8e0" -"checksum security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab01dfbe5756785b5b4d46e0289e5a18071dfa9a7c2b24213ea00b9ef9b665bf" +"checksum security-framework-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "40d95f3d7da09612affe897f320d78264f0d2320f3e8eea27d12bd1bd94445e2" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" -"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" -"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" +"checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" +"checksum serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d6115a3ca25c224e409185325afc16a0d5aaaabc15c42b09587d6f1ba39a5b" +"checksum serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "bdf540260cfee6da923831f4776ddc495ada940c30117977c70f1313a6130545" "checksum sha1 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "171698ce4ec7cbb93babeb3190021b4d72e96ccb98e33d277ae4ea959d6f2d9e" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" @@ -4958,36 +5015,32 @@ dependencies = [ "checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" "checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" -"checksum slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddd14b8df2df39378b3e933c79784350bf715b11444d99f903df0253bbe524e5" -"checksum slog-scope 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "053344c94c0e2b22da6305efddb698d7c485809427cf40555dc936085f67a9df" -"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" +"checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" +"checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" +"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" -"checksum stdweb 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "22203527a18dc1c5c83bbd247fb005f5877d040783b6626571d6b7ed7a6f5e75" +"checksum stdweb 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "b84f9c829ef7d2e6abf1965393b231c0fd495f0293d612f32dbadd637e91fd0d" "checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" -"checksum stdweb-internal-macros 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bcbc9155af9606d44c740197d7d6672b49c4ee93a176c7cecde8b49322677604" -"checksum stdweb-internal-runtime 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b74fe9de4c0d07e91987f4d798b95f27f3cb7769fbc222fa951fa386908297b5" +"checksum stdweb-internal-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d60e306bddd5d213f86f7b417b6cdcefbf742917414ac9dda6e9750ef4553dce" +"checksum stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2f4a2eb556337b2d1a302630bbddf989ae383c70393e89b48152b9896cbda" "checksum stream-cipher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30dc6118470d69ce0fdcf7e6f95e95853f7f4f72f80d835d4519577c323814ab" "checksum string 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98998cced76115b1da46f63388b909d118a37ae0be0f82ad35773d4a4bc9d18d" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "41c4a2479a078509940d82773d90ff824a8c89533ab3b59cd3ce8b0c0e369c02" -"checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2" -"checksum subtle 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc7f6353c2ee5407358d063a14cccc1630804527090a6fb5a9489ce4924280fb" +"checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3" +"checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" +"checksum subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "702662512f3ddeb74a64ce2fbbf3707ee1b6bb663d28bb054e0779bbc720d926" "checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" "checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" -"checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" +"checksum syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)" = "734ecc29cd36e8123850d9bf21dfd62ef8300aaa8f879aabaa899721808be37c" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a8f5e3aaa79319573d19938ea38d068056b826db9883a5d47f86c1cecc688f0e" -"checksum syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "867cc5c2d7140ae7eaad2ae9e8bf39cb18a67ca651b7834f88d46ca98faadb9c" -"checksum syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13ad4762fe52abc9f4008e85c4fb1b1fe3aa91ccb99ff4826a439c7c598e1047" -"checksum syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e0e4dbae163dd98989464c23dd503161b338790640e11537686f2ef0f25c791" "checksum sysinfo 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c747a1fbe091faa7bf76c19f40099f9f12495384c811485d81cf3d60c0eae62" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -"checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" +"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" @@ -4995,24 +5048,24 @@ dependencies = [ "checksum thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" "checksum thread-scoped 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bcbb6aa301e5d3b0b5ef639c9a9c7e2f1c944f177b460c04dc24c69b1fa2bd99" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" +"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c" "checksum tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e9175261fbdb60781fcd388a4d6cc7e14764a2b629a7ad94abb439aed223a44f" -"checksum tk-listen 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dec7ba6a80b7695fc2abb21af18bed445a362ffd80b64704771ce142d6d2151d" -"checksum tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6e93c78d23cc61aa245a8acd2c4a79c4d7fa7fb5c3ca90d5737029f043a84895" +"checksum tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5462b0f968c0457efe38fcd2df7e487096b992419e4f5337b06775a614bbda4b" +"checksum tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4790d0be6f4ba6ae4f48190efa2ed7780c9e3567796abdb285003cf39840d9c5" "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" "checksum tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "aeeffbbb94209023feaef3c196a41cbcdafa06b4a6f893f68779bb5e53796f71" -"checksum tokio-current-thread 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f90fcd90952f0a496d438a976afba8e5c205fb12123f813d8ab3aa1c8436638c" +"checksum tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "331c8acc267855ec06eb0c94618dcbbfea45bed2d20b77252940095273fb58f6" "checksum tokio-dns-unofficial 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bf62ca2c53bf2f2faec3e48a98b6d8c9577c27011cb0203a4beacdc8ab328" -"checksum tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c117b6cf86bb730aab4834f10df96e4dd586eff2c3c27d3781348da49e255bde" -"checksum tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "60ae25f6b17d25116d2cba342083abe5255d3c2c79cb21ea11aa049c53bf7c75" -"checksum tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7392fe0a70d5ce0c882c4778116c519bd5dbaa8a7c3ae3d04578b3afafdcda21" -"checksum tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4b26fd37f1125738b2170c80b551f69ff6fecb277e6e5ca885e53eec2b005018" -"checksum tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ad235e9dadd126b2d47f6736f65aa1fdcd6420e66ca63f44177bc78df89f912" -"checksum tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3929aee321c9220ed838ed6c3928be7f9b69986b0e3c22c972a66dbf8a298c68" -"checksum tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3a52f00c97fedb6d535d27f65cccb7181c8dd4c6edc3eda9ea93f6d45d05168e" -"checksum tokio-tls 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e53fdbf3156f588be1676022fe794232b24922d426e8c14f4e46891c1e31c440" -"checksum tokio-udp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "da941144b816d0dcda4db3a1ba87596e4df5e860a72b70783fe435891f80601c" -"checksum tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df195376b43508f01570bacc73e13a1de0854dc59e79d1ec09913e8db6dd2a70" +"checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" +"checksum tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9cbbc8a3698b7ab652340f46633364f9eaa928ddaaee79d8b8f356dd79a09d" +"checksum tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b53aeb9d3f5ccf2ebb29e19788f96987fa1355f8fe45ea193928eaaaf3ae820f" +"checksum tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "afbcdb0f0d2a1e4c440af82d7bbf0bf91a8a8c0575bcd20c05d15be7e9d3a02f" +"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" +"checksum tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "17465013014410310f9f61fa10bf4724803c149ea1d51efece131c38efca93aa" +"checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" +"checksum tokio-tls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "354b8cd83825b3c20217a9dc174d6a0c67441a2fae5c41bcb1ea6679f6ae0f7c" +"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" +"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum trie-bench 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum trie-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" @@ -5020,10 +5073,10 @@ dependencies = [ "checksum trie-standardmap 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum twofish 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eef327f05b0d0ec1b9d7d119d8f4d9f602ceee37e0540aff8071e8e66c2e22e" -"checksum twox-hash 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f85be565a110ed72ed7048cf56570db04ce0a592c98aa59b7dacde3e5718750" +"checksum twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "555cd4909480122bbbf21e34faac4cb08a171f324775670447ed116726c474af" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0f8bfa9ff0cadcd210129ad9d2c5f145c13e9ced3d3e5d948a6213487d52444" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "082df6964410f6aa929a61ddfafc997e4f32c62c22490e439ac351cec827f436" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3218ea14b4edcaccfa0df0a64a3792a2c32cc706f1b336e48867f9d3147f90" @@ -5031,12 +5084,11 @@ dependencies = [ "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum unsigned-varint 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5c1441164e5da61f00acd15f5a9e61939693c2c6e8b9fae36a220b82de7e212" "checksum unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5fb8abc4b7d8158bdfbbaaccc35331ed3c30c2673e99000d7ae665a2eb6576f4" -"checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae" +"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" @@ -5044,11 +5096,12 @@ dependencies = [ "checksum vergen 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "93fb2d57fbc535fcd45548c99b141d2d960995daaf04b864c4d9fe1ea011c819" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum wabt 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff1f0f87e467255240c1faf5cf13a04410723407840d7733e75967224e191a5" -"checksum wabt-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cc8982bfe0a923f152e96d991e50a6f97fe73ca4af6d9d84d76634f03051fa2" +"checksum wabt 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0246aa1834c47c5f3dd87c0932a2c78edd1e9318ced5e92a41f30a0ab4e3a91f" +"checksum wabt-sys 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "462336bb61096e64761730e0dea1bc8b777bd4e3689c7e813c81f1cfdf4e8a51" "checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3" -"checksum wasmi 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a60b9508cff2b7c27ed41200dd668806280740fadc8c88440e9c88625e84f1a" +"checksum wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21ef487a11df1ed468cf613c78798c26282da5c30e9d49f824872d4c77b47d1d" "checksum websocket 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c9faed2bff8af2ea6b9f8b917d3d00b467583f6781fe3def174a9e33c879703" +"checksum which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e84a603e7e0b1ce1aa1ee2b109c7be00155ce52df5081590d1ffb93f4f515cb2" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" @@ -5059,6 +5112,6 @@ dependencies = [ "checksum ws 0.7.9 (git+https://github.com/tomusdrw/ws-rs)" = "" "checksum ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61" +"checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" "checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" -"checksum yamux 0.1.0 (git+https://github.com/paritytech/yamux)" = "" +"checksum yamux 0.1.6 (git+https://github.com/paritytech/yamux)" = "" diff --git a/Cargo.toml b/Cargo.toml index 3725ce9bb271a..1823986573f17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "node/src/main.rs" [package] name = "substrate" -version = "0.9.1" +version = "0.10.0" authors = ["Parity Technologies "] build = "build.rs" @@ -57,6 +57,7 @@ members = [ "core/sr-primitives", "srml/session", "srml/staking", + "srml/sudo", "srml/system", "srml/timestamp", "srml/treasury", diff --git a/README.adoc b/README.adoc index 4525a86b038f1..90b5f49a980c9 100644 --- a/README.adoc +++ b/README.adoc @@ -48,38 +48,35 @@ Other examples include the parachain-heads extrinsic in Polkadot and the "note-m === Runtime and API -Substrate chains all have a runtime. The runtime is a WebAssembly "blob" that includes a number of entry-points. Some entry-points are required as part of the underlying Substrate specification. Others are merely convention and required for the default implementation of the Substrate client to be able to author blocks. In short these two sets are: +Substrate chains all have a runtime. The runtime is a WebAssembly "blob" that includes a number of entry-points. Some entry-points are required as part of the underlying Substrate specification. Others are merely convention and required for the default implementation of the Substrate client to be able to author blocks. -The runtime is API entry points are expected to be in the runtime's `api` module. There is a specific ABI based upon the Substrate Simple Codec (`codec`), which is used to encode and decode the arguments for these functions and specify where and how they should be passed. A special macro is provided called `impl_stubs`, which prepares all functionality for marshalling arguments and basically just allows you to write the functions as you would normally (except for the fact that there must be example one argument - tuples are allowed to workaround). +If you want to develop a chain with Substrate, you will need to implement the `Core` trait. This `Core` trait generates an API with the minimum necessary functionality to interact with your runtime. A special macro is provided called `impl_runtime_apis!` that help you implement runtime API traits. All runtime API trait implementations need to be done in one call of the `impl_runtime_apis!` macro. All parameters and return values need to implement https://crates.io/crates/parity-codec[`parity-codec`] to be encodable and decodable. -Here's the Polkadot API implementation as of PoC-2: +Here's a snippet of the Polkadot API implementation as of PoC-3: ```rust -pub mod api { - impl_stubs!( - - // Standard: Required. - version => |()| super::Version::version(), - authorities => |()| super::Consensus::authorities(), - execute_block => |block| super::Executive::execute_block(block), - - // Conventional: Needed for Substrate client's reference block authoring logic to work. - initialise_block => |header| super::Executive::initialise_block(&header), - apply_extrinsic => |extrinsic| super::Executive::apply_extrinsic(extrinsic), - finalise_block => |()| super::Executive::finalise_block(), - inherent_extrinsics => |inherent| super::inherent_extrinsics(inherent), - - // Non-standard (Polkadot-specific). This just exposes some stuff that Polkadot client - // finds useful. - validator_count => |()| super::Session::validator_count(), - validators => |()| super::Session::validators() - ); +impl_runtime_apis! { + impl client_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn authorities() -> Vec { + Consensus::authorities() + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialise_block(header: ::Header) { + Executive::initialise_block(&header) + } + } + // ---snip--- } ``` -As you can see, at the minimum there are only three API calls to implement. If you want to reuse as much of Substrate's reference block authoring client code, then you'll want to provide the next four entrypoints (though three of them you probably already implemented as part of `execute_block`). - -Of the first three, there is `execute_block`, which contains the actions to be taken to execute a block and pretty much defines the blockchain. Then there is `authorities` which tells the AfG consensus algorithm sitting in the Substrate client who the given authorities (known as "validators" in some contexts) are that can finalise the next block. Finally, there is `version`, which is a fairly sophisticated version identifier. This includes a key distinction between *specification version* and *authoring version*, with the former essentially versioning the logic of `execute_block` and the latter versioning only the logic of `inherent_extrinsics` and core aspects of extrinsic validity. === Inherent Extrinsics @@ -175,7 +172,7 @@ You can distribute `mychain.json` so that everyone can synchronise and (dependin === Hacking on Substrate -If you'd actually like hack on Substrate, you can just grab the source code and +If you'd actually like to hack on Substrate, you can just grab the source code and build it. Ensure you have Rust and the support software installed: [source, shell] @@ -223,8 +220,7 @@ You can start a development chain with: [source, shell] cargo run -- --dev - -Detailed logs may be shown by running the node with the following environment variables set: `RUST_LOG=debug RUST_BACKTRACE=1 cargo run -- --dev`. +Detailed logs may be shown by running the node with the following environment variables set: `RUST_LOG=debug RUST_BACKTRACE=1 cargo run \-- --dev`. If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet with two validator nodes for Alice and Bob, who are the initial authorities of the genesis chain specification that have been endowed with a testnet DOTs. We'll give each node a name and expose them so they are listed on [Telemetry](https://telemetry.polkadot.io/#/Local%20Testnet). You'll need two terminals windows open. @@ -253,7 +249,40 @@ cargo run -- \ --telemetry-url ws://telemetry.polkadot.io:1024 \ --validator -Additional Substate CLI usage options are available and may be shown by running `cargo run -- --help`. +Additional Substate CLI usage options are available and may be shown by running `cargo run \-- --help`. + +=== Joining the Charred Cherry Testnet + +Charred Cherry is the new testnet for Substrate 1.0 beta. Please note that 1.0 beta is not compatible with the BBQ-Birch testnet. Ensure you have the dependencies listed above before compiling. + +[source, shell] +---- +git clone https://github.com/paritytech/substrate.git +cd substrate +---- + +You can run the tests if you like: + +[source, shell] +cargo test --all + +Start your node: + +[source, shell] +cargo run --release + +To see a list of command line options, enter: + +[source, shell] +cargo run --release -- --help + +For example, you can choose a custom node name: + +[source, shell] +cargo run --release -- --name my_custom_name + +If you are successful, you will see your node syncing at https://telemetry.polkadot.io/#/Charred%20Cherry + == Documentation diff --git a/core/basic-authorship/Cargo.toml b/core/basic-authorship/Cargo.toml new file mode 100644 index 0000000000000..00c50781fde04 --- /dev/null +++ b/core/basic-authorship/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "substrate-basic-authorship" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +log = "0.4" +parity-codec = "2.1" +sr-primitives = { path = "../../core/sr-primitives" } +substrate-client = { path = "../../core/client" } +substrate-consensus-aura-primitives = { path = "../../core/consensus/aura/primitives" } +substrate-consensus-common = { path = "../../core/consensus/common" } +substrate-primitives = { path = "../../core/primitives" } +substrate-transaction-pool = { path = "../../core/transaction-pool" } diff --git a/core/service/src/consensus.rs b/core/basic-authorship/src/basic_authorship.rs similarity index 98% rename from core/service/src/consensus.rs rename to core/basic-authorship/src/basic_authorship.rs index 5f8d1898785bb..d4d39c4541f65 100644 --- a/core/service/src/consensus.rs +++ b/core/basic-authorship/src/basic_authorship.rs @@ -26,8 +26,8 @@ use client::{self, error, Client as SubstrateClient, CallExecutor}; use client::{block_builder::api::BlockBuilder as BlockBuilderApi, runtime_api::Core}; use codec::{Decode, Encode}; use consensus_common::{self, evaluation}; -use primitives::{H256, AuthorityId, ed25519, Blake2Hasher}; -use runtime_primitives::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, ProvideRuntimeApi}; +use primitives::{H256, Blake2Hasher}; +use runtime_primitives::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, ProvideRuntimeApi, AuthorityIdFor}; use runtime_primitives::generic::BlockId; use runtime_primitives::BasicInherentData; use transaction_pool::txpool::{self, Pool as TransactionPool}; @@ -125,8 +125,7 @@ impl consensus_common::Environment<::Blo fn init( &self, parent_header: &<::Block as BlockT>::Header, - _: &[AuthorityId], - _: Arc, + _: &[AuthorityIdFor<::Block>], ) -> Result { let parent_hash = parent_header.hash(); diff --git a/core/basic-authorship/src/lib.rs b/core/basic-authorship/src/lib.rs new file mode 100644 index 0000000000000..0d7e31075084e --- /dev/null +++ b/core/basic-authorship/src/lib.rs @@ -0,0 +1,34 @@ +// Copyright 2017-2018 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate 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. + +// Substrate 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 Substrate. If not, see . + +//! Basic implementation of block-authoring logic. + +#![warn(unused_extern_crates)] + +extern crate substrate_consensus_aura_primitives as aura_primitives; +extern crate substrate_primitives as primitives; +extern crate sr_primitives as runtime_primitives; +extern crate substrate_consensus_common as consensus_common; +extern crate substrate_client as client; +extern crate parity_codec as codec; +extern crate substrate_transaction_pool as transaction_pool; + +#[macro_use] +extern crate log; + +mod basic_authorship; + +pub use basic_authorship::{ProposerFactory, BlockBuilder, AuthoringApi, Proposer}; diff --git a/core/cli/src/informant.rs b/core/cli/src/informant.rs index 5912da81262cf..0f24f5f6e69f7 100644 --- a/core/cli/src/informant.rs +++ b/core/cli/src/informant.rs @@ -24,7 +24,9 @@ use tokio::runtime::TaskExecutor; use tokio::timer::Interval; use sysinfo::{get_current_pid, ProcessExt, System, SystemExt}; use network::{SyncState, SyncProvider}; -use client::BlockchainEvents; +use client::{backend::Backend, BlockchainEvents}; + +use runtime_primitives::generic::BlockId; use runtime_primitives::traits::{Header, As}; const TIMER_INTERVAL_MS: u64 = 5000; @@ -46,10 +48,10 @@ pub fn start(service: &Service, exit: ::exit_future::Exit, handle: TaskExe let display_notifications = interval.map_err(|e| debug!("Timer error: {:?}", e)).for_each(move |_| { let sync_status = network.status(); - if let Ok(best_block) = client.best_block_header() { - let hash = best_block.hash(); + if let Ok(info) = client.info() { + let best_number: u64 = info.chain.best_number.as_(); + let best_hash = info.chain.best_hash; let num_peers = sync_status.num_peers; - let best_number: u64 = best_block.number().as_(); let speed = move || speed(best_number, last_number); let (status, target) = match (sync_status.sync.state, sync_status.sync.best_seen_block) { (SyncState::Idle, _) => ("Idle".into(), "".into()), @@ -58,14 +60,17 @@ pub fn start(service: &Service, exit: ::exit_future::Exit, handle: TaskExe }; last_number = Some(best_number); let txpool_status = txpool.status(); + let finalized_number: u64 = info.chain.finalized_number.as_(); info!( target: "substrate", - "{}{} ({} peers), best: #{} ({})", + "{}{} ({} peers), best: #{} ({}), finalized #{} ({})", Colour::White.bold().paint(&status), target, Colour::White.bold().paint(format!("{}", sync_status.num_peers)), Colour::White.paint(format!("{}", best_number)), - hash + best_hash, + Colour::White.paint(format!("{}", finalized_number)), + info.chain.finalized_hash, ); // get cpu usage and memory usage of this process @@ -79,10 +84,12 @@ pub fn start(service: &Service, exit: ::exit_future::Exit, handle: TaskExe "status" => format!("{}{}", status, target), "peers" => num_peers, "height" => best_number, - "best" => ?hash, + "best" => ?best_hash, "txcount" => txpool_status.ready, "cpu" => cpu_usage, - "memory" => memory + "memory" => memory, + "finalized_height" => finalized_number, + "finalized_hash" => ?info.chain.finalized_hash, ); } else { warn!("Error getting best block information"); @@ -92,7 +99,36 @@ pub fn start(service: &Service, exit: ::exit_future::Exit, handle: TaskExe }); let client = service.client(); - let display_block_import = client.import_notification_stream().for_each(|n| { + let mut last = match client.info() { + Ok(info) => Some((info.chain.best_number, info.chain.best_hash)), + Err(e) => { warn!("Error getting best block information: {:?}", e); None } + }; + + let display_block_import = client.import_notification_stream().for_each(move |n| { + // detect and log reorganizations. + if let Some((ref last_num, ref last_hash)) = last { + if n.header.parent_hash() != last_hash { + let tree_route = ::client::blockchain::tree_route( + client.backend().blockchain(), + BlockId::Hash(last_hash.clone()), + BlockId::Hash(n.hash), + ); + + match tree_route { + Ok(ref t) if !t.retracted().is_empty() => info!( + "Reorg from #{},{} to #{},{}, common ancestor #{},{}", + last_num, last_hash, + n.header.number(), n.hash, + t.common_block().number, t.common_block().hash, + ), + Ok(_) => {}, + Err(e) => warn!("Error computing tree route: {}", e), + } + } + } + + last = Some((n.header.number().clone(), n.hash.clone())); + info!(target: "substrate", "Imported #{} ({})", n.header.number(), n.hash); Ok(()) }); diff --git a/core/cli/src/params.rs b/core/cli/src/params.rs index 3ce7de79dedfe..8a7ee082b69d6 100644 --- a/core/cli/src/params.rs +++ b/core/cli/src/params.rs @@ -97,21 +97,17 @@ pub struct CoreParams { /// Specify the pruning mode, a number of blocks to keep or 'archive'. Default is 256. #[structopt(long = "pruning", value_name = "PRUNING_MODE")] - pruning: Option, + pruning: Option, /// The human-readable name for this node, as reported to the telemetry server, if enabled #[structopt(long = "name", value_name = "NAME")] name: Option, - /// Should connect to the Substrate telemetry server (telemetry is off by default on local chains) - #[structopt(short = "t", long = "telemetry")] - telemetry: bool, - /// Should not connect to the Substrate telemetry server (telemetry is on by default on global chains) #[structopt(long = "no-telemetry")] no_telemetry: bool, - /// The URL of the telemetry server. Implies --telemetry + /// The URL of the telemetry server to connect to #[structopt(long = "telemetry-url", value_name = "TELEMETRY_URL")] telemetry_url: Option, diff --git a/core/client/Cargo.toml b/core/client/Cargo.toml index 1da261cb4bc69..82a72920dad00 100644 --- a/core/client/Cargo.toml +++ b/core/client/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] error-chain = { version = "0.12", optional = true } fnv = { version = "1.0", optional = true } log = { version = "0.4", optional = true } -parking_lot = { version = "0.4", optional = true } +parking_lot = { version = "0.7.1", optional = true } hex-literal = { version = "0.1", optional = true } futures = { version = "0.1.17", optional = true } slog = { version = "^2", optional = true } diff --git a/core/client/db/Cargo.toml b/core/client/db/Cargo.toml index 9536fe803af0c..77dd4d9bf8d94 100644 --- a/core/client/db/Cargo.toml +++ b/core/client/db/Cargo.toml @@ -4,10 +4,11 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -parking_lot = "0.4" +parking_lot = "0.7.1" log = "0.4" kvdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" } kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" } +lru-cache = "0.1" hash-db = { git = "https://github.com/paritytech/trie" } substrate-primitives = { path = "../../primitives" } sr-primitives = { path = "../../sr-primitives" } diff --git a/core/client/db/src/cache/mod.rs b/core/client/db/src/cache/mod.rs index db2a1762db575..11fbd93392ce7 100644 --- a/core/client/db/src/cache/mod.rs +++ b/core/client/db/src/cache/mod.rs @@ -24,9 +24,8 @@ use kvdb::{KeyValueDB, DBTransaction}; use client::blockchain::Cache as BlockchainCache; use client::error::Result as ClientResult; use codec::{Encode, Decode}; -use primitives::AuthorityId; use runtime_primitives::generic::BlockId; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, As}; +use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, As, AuthorityIdFor}; use utils::{self, COLUMN_META}; use self::list_cache::ListCache; @@ -65,7 +64,7 @@ impl CacheItemT for T where T: Clone + Decode + Encode + PartialEq {} /// Database-backed blockchain data cache. pub struct DbCache { - authorities_at: ListCache, self::list_storage::DbStorage>, + authorities_at: ListCache>, self::list_storage::DbStorage>, } impl DbCache { @@ -112,14 +111,14 @@ impl DbCache { /// Cache operations that are to be committed after database transaction is committed. pub struct DbCacheTransactionOps { - authorities_at_op: Option>>, + authorities_at_op: Option>>>, } /// Database-backed blockchain data cache transaction valid for single block import. pub struct DbCacheTransaction<'a, Block: BlockT> { cache: &'a mut DbCache, tx: &'a mut DBTransaction, - authorities_at_op: Option>>, + authorities_at_op: Option>>>, } impl<'a, Block: BlockT> DbCacheTransaction<'a, Block> { @@ -135,7 +134,7 @@ impl<'a, Block: BlockT> DbCacheTransaction<'a, Block> { mut self, parent: ComplexBlockId, block: ComplexBlockId, - authorities_at: Option>, + authorities_at: Option>>, is_final: bool, ) -> ClientResult { assert!(self.authorities_at_op.is_none()); @@ -179,7 +178,7 @@ impl<'a, Block: BlockT> DbCacheTransaction<'a, Block> { pub struct DbCacheSync(pub RwLock>); impl BlockchainCache for DbCacheSync { - fn authorities_at(&self, at: BlockId) -> Option> { + fn authorities_at(&self, at: BlockId) -> Option>> { let cache = self.0.read(); let storage = cache.authorities_at.storage(); let db = storage.db(); diff --git a/core/client/db/src/lib.rs b/core/client/db/src/lib.rs index 6fa16f3d9a6bc..f663cc0834d33 100644 --- a/core/client/db/src/lib.rs +++ b/core/client/db/src/lib.rs @@ -29,6 +29,7 @@ extern crate kvdb_rocksdb; extern crate kvdb; extern crate hash_db; extern crate parking_lot; +extern crate lru_cache; extern crate substrate_state_machine as state_machine; extern crate substrate_primitives as primitives; extern crate sr_primitives as runtime_primitives; @@ -52,6 +53,7 @@ extern crate kvdb_memorydb; pub mod light; mod cache; +mod storage_cache; mod utils; use std::sync::Arc; @@ -64,10 +66,10 @@ use hash_db::Hasher; use kvdb::{KeyValueDB, DBTransaction}; use trie::MemoryDB; use parking_lot::RwLock; -use primitives::{H256, AuthorityId, Blake2Hasher, ChangesTrieConfiguration, convert_hash}; +use primitives::{H256, Blake2Hasher, ChangesTrieConfiguration, convert_hash}; use primitives::storage::well_known_keys; use runtime_primitives::{generic::BlockId, Justification, StorageMap, ChildrenStorageMap}; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, As, NumberFor, Zero, Digest, DigestItem}; +use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, As, NumberFor, Zero, Digest, DigestItem, AuthorityIdFor}; use runtime_primitives::BuildStorage; use state_machine::backend::Backend as StateBackend; use executor::RuntimeInfo; @@ -75,10 +77,12 @@ use state_machine::{CodeExecutor, DBValue, ExecutionStrategy}; use utils::{Meta, db_err, meta_keys, open_database, read_db, block_id_to_lookup_key, read_meta}; use client::LeafSet; use state_db::StateDb; +use storage_cache::{CachingState, SharedCache, new_shared_cache}; pub use state_db::PruningMode; const CANONICALIZATION_DELAY: u64 = 256; const MIN_BLOCKS_TO_KEEP_CHANGES_TRIES_FOR: u64 = 32768; +const STATE_CACHE_SIZE_BYTES: usize = 16 * 1024 * 1024; /// DB-backed patricia trie state, transaction type is an overlay of changes to commit. pub type DbState = state_machine::TrieBackend>, Blake2Hasher>; @@ -270,8 +274,9 @@ impl client::blockchain::Backend for BlockchainDb { /// Database transaction pub struct BlockImportOperation { - old_state: DbState, - updates: MemoryDB, + old_state: CachingState, + db_updates: MemoryDB, + storage_updates: Vec<(Vec, Option>)>, changes_trie_updates: MemoryDB, pending_block: Option>, aux_ops: Vec<(Vec, Option>)>, @@ -292,7 +297,7 @@ impl client::backend::BlockImportOperation for BlockImportOperation where Block: BlockT, { - type State = DbState; + type State = CachingState; fn state(&self) -> Result, client::error::Error> { Ok(Some(&self.old_state)) @@ -315,12 +320,12 @@ where Block: BlockT, Ok(()) } - fn update_authorities(&mut self, _authorities: Vec) { + fn update_authorities(&mut self, _authorities: Vec>) { // currently authorities are not cached on full nodes } - fn update_storage(&mut self, update: MemoryDB) -> Result<(), client::error::Error> { - self.updates = update; + fn update_db_storage(&mut self, update: MemoryDB) -> Result<(), client::error::Error> { + self.db_updates = update; Ok(()) } @@ -349,7 +354,7 @@ where Block: BlockT, let (root, update) = self.old_state.storage_root(top.into_iter().map(|(k, v)| (k, Some(v)))); transaction.consolidate(update); - self.updates = transaction; + self.db_updates = transaction; Ok(root) } @@ -364,6 +369,11 @@ where Block: BlockT, self.aux_ops = ops.into_iter().collect(); Ok(()) } + + fn update_storage(&mut self, update: Vec<(Vec, Option>)>) -> Result<(), client::error::Error> { + self.storage_updates = update; + Ok(()) + } } struct StorageDb { @@ -503,6 +513,7 @@ pub struct Backend { changes_tries_storage: DbChangesTrieStorage, blockchain: BlockchainDb, canonicalization_delay: u64, + shared_cache: SharedCache, } impl Backend { @@ -550,6 +561,7 @@ impl Backend { changes_tries_storage, blockchain, canonicalization_delay, + shared_cache: new_shared_cache(STATE_CACHE_SIZE_BYTES), }) } @@ -669,7 +681,7 @@ impl client::backend::AuxStore for Backend where Block: BlockT client::backend::Backend for Backend where Block: BlockT { type BlockImportOperation = BlockImportOperation; type Blockchain = BlockchainDb; - type State = DbState; + type State = CachingState; type ChangesTrieStorage = DbChangesTrieStorage; fn begin_operation(&self, block: BlockId) -> Result { @@ -677,7 +689,8 @@ impl client::backend::Backend for Backend whe Ok(BlockImportOperation { pending_block: None, old_state: state, - updates: MemoryDB::default(), + db_updates: MemoryDB::default(), + storage_updates: Default::default(), changes_trie_updates: MemoryDB::default(), aux_ops: Vec::new(), }) @@ -697,6 +710,9 @@ impl client::backend::Backend for Backend whe // blocks are keyed by number + hash. let lookup_key = ::utils::number_and_hash_to_lookup_key(number, hash); + let mut enacted = Vec::default(); + let mut retracted = Vec::default(); + if pending_block.leaf_state.is_best() { let meta = self.blockchain.meta.read(); @@ -710,10 +726,11 @@ impl client::backend::Backend for Backend whe // uncanonicalize: check safety violations and ensure the numbers no longer // point to these block hashes in the key mapping. - for retracted in tree_route.retracted() { - if retracted.hash == meta.finalized_hash { + for r in tree_route.retracted() { + retracted.push(r.hash.clone()); + if r.hash == meta.finalized_hash { warn!("Potential safety failure: reverting finalized block {:?}", - (&retracted.number, &retracted.hash)); + (&r.number, &r.hash)); return Err(::client::error::ErrorKind::NotInFinalizedChain.into()); } @@ -721,17 +738,18 @@ impl client::backend::Backend for Backend whe ::utils::remove_number_to_key_mapping( &mut transaction, columns::KEY_LOOKUP, - retracted.number + r.number ); } // canonicalize: set the number lookup to map to this block's hash. - for enacted in tree_route.enacted() { + for e in tree_route.enacted() { + enacted.push(e.hash.clone()); ::utils::insert_number_to_key_mapping( &mut transaction, columns::KEY_LOOKUP, - enacted.number, - enacted.hash + e.number, + e.hash ); } } @@ -766,7 +784,7 @@ impl client::backend::Backend for Backend whe } let mut changeset: state_db::ChangeSet = state_db::ChangeSet::default(); - for (key, (val, rc)) in operation.updates.drain() { + for (key, (val, rc)) in operation.db_updates.drain() { if rc > 0 { changeset.inserted.push((key, val.to_vec())); } else if rc < 0 { @@ -792,8 +810,8 @@ impl client::backend::Backend for Backend whe self.force_delayed_canonicalize(&mut transaction, hash, *pending_block.header.number())? } - debug!(target: "db", "DB Commit {:?} ({}), best = {}", hash, number, - pending_block.leaf_state.is_best()); + let is_best = pending_block.leaf_state.is_best(); + debug!(target: "db", "DB Commit {:?} ({}), best = {}", hash, number, is_best); { let mut leaves = self.blockchain.leaves.write(); @@ -817,6 +835,16 @@ impl client::backend::Backend for Backend whe pending_block.leaf_state.is_best(), finalized, ); + + // sync canonical state cache + operation.old_state.sync_cache( + &enacted, + &retracted, + operation.storage_updates, + Some(hash), + Some(number), + || is_best + ); } Ok(()) } @@ -865,7 +893,6 @@ impl client::backend::Backend for Backend whe match self.storage.state_db.revert_one() { Some(commit) => { apply_state_commit(&mut transaction, commit); - let removed = self.blockchain.header(BlockId::Number(best))?.ok_or_else( || client::error::ErrorKind::UnknownBlock( format!("Error reverting to {}. Block hash not found.", best)))?; @@ -880,18 +907,6 @@ impl client::backend::Backend for Backend whe self.storage.db.write(transaction).map_err(db_err)?; self.blockchain.update_meta(hash, best, true, false); self.blockchain.leaves.write().revert(removed.hash().clone(), removed.number().clone(), removed.parent_hash().clone()); -// let _removed = best.clone(); -// best -= As::sa(1); -// let header = self.blockchain.header(BlockId::Number(best))?.ok_or_else( -// || client::error::ErrorKind::UnknownBlock( -// format!("Error reverting to {}. Block header not found.", best)))?; -// -// let lookup_key = ::utils::number_and_hash_to_lookup_key(header.number().clone(), header.hash().clone()); -// transaction.put(columns::META, meta_keys::BEST_BLOCK, &lookup_key); -// transaction.delete(columns::KEY_LOOKUP, header.hash().as_ref()); -// self.storage.db.write(transaction).map_err(db_err)?; -// self.blockchain.update_meta(header.hash().clone(), best.clone(), true, false); -// self.blockchain.leaves.write().revert(header.hash().clone(), header.number().clone(), header.parent_hash().clone()); } None => return Ok(As::sa(c)) } @@ -911,7 +926,8 @@ impl client::backend::Backend for Backend whe BlockId::Hash(h) if h == Default::default() => { let genesis_storage = DbGenesisStorage::new(); let root = genesis_storage.0.clone(); - return Ok(DbState::new(Arc::new(genesis_storage), root)); + let state = DbState::new(Arc::new(genesis_storage), root); + return Ok(CachingState::new(state, self.shared_cache.clone(), None)); }, _ => {} } @@ -919,12 +935,21 @@ impl client::backend::Backend for Backend whe match self.blockchain.header(block) { Ok(Some(ref hdr)) if !self.storage.state_db.is_pruned(hdr.number().as_()) => { let root = H256::from_slice(hdr.state_root().as_ref()); - Ok(DbState::new(self.storage.clone(), root)) + let state = DbState::new(self.storage.clone(), root); + Ok(CachingState::new(state, self.shared_cache.clone(), Some(hdr.hash()))) }, Err(e) => Err(e), _ => Err(client::error::ErrorKind::UnknownBlock(format!("{:?}", block)).into()), } } + + fn destroy_state(&self, mut state: Self::State) -> Result<(), client::error::Error> { + if let Some(hash) = state.parent_hash.clone() { + let is_best = || self.blockchain.meta.read().best_hash == hash; + state.sync_cache(&[], &[], vec![], None, None, is_best); + } + Ok(()) + } } impl client::backend::LocalBackend for Backend @@ -1105,7 +1130,7 @@ mod tests { ]; let (root, overlay) = op.old_state.storage_root(storage.iter().cloned()); - op.update_storage(overlay).unwrap(); + op.update_db_storage(overlay).unwrap(); header.state_root = root.into(); op.set_block_data( @@ -1151,7 +1176,7 @@ mod tests { op.reset_storage(storage.iter().cloned().collect(), Default::default()).unwrap(); - key = op.updates.insert(b"hello"); + key = op.db_updates.insert(b"hello"); op.set_block_data( header, Some(vec![]), @@ -1184,8 +1209,8 @@ mod tests { ).0.into(); let hash = header.hash(); - op.updates.insert(b"hello"); - op.updates.remove(&key); + op.db_updates.insert(b"hello"); + op.db_updates.remove(&key); op.set_block_data( header, Some(vec![]), @@ -1217,7 +1242,7 @@ mod tests { .map(|(x, y)| (x, Some(y))) ).0.into(); - op.updates.remove(&key); + op.db_updates.remove(&key); op.set_block_data( header, Some(vec![]), diff --git a/core/client/db/src/light.rs b/core/client/db/src/light.rs index 729519020c34e..cbed1348a93a2 100644 --- a/core/client/db/src/light.rs +++ b/core/client/db/src/light.rs @@ -28,10 +28,10 @@ use client::{cht, LeafSet}; use client::error::{ErrorKind as ClientErrorKind, Result as ClientResult}; use client::light::blockchain::Storage as LightBlockchainStorage; use codec::{Decode, Encode}; -use primitives::{AuthorityId, Blake2Hasher}; +use primitives::Blake2Hasher; use runtime_primitives::generic::BlockId; use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, - Zero, One, As, NumberFor, Digest, DigestItem}; + Zero, One, As, NumberFor, Digest, DigestItem, AuthorityIdFor}; use cache::{DbCacheSync, DbCache, ComplexBlockId}; use utils::{meta_keys, Meta, db_err, open_database, read_db, block_id_to_lookup_key, read_meta}; @@ -306,7 +306,7 @@ impl LightBlockchainStorage for LightStorage fn import_header( &self, header: Block::Header, - authorities: Option>, + authorities: Option>>, leaf_state: NewBlockState, aux_ops: Vec<(Vec, Option>)>, ) -> ClientResult<()> { @@ -510,7 +510,7 @@ pub(crate) mod tests { pub fn insert_block Header>( db: &LightStorage, - authorities: Option>, + authorities: Option>>, header: F, ) -> Hash { let header = header(); @@ -521,7 +521,7 @@ pub(crate) mod tests { fn insert_final_block Header>( db: &LightStorage, - authorities: Option>, + authorities: Option>>, header: F, ) -> Hash { let header = header(); @@ -532,7 +532,7 @@ pub(crate) mod tests { fn insert_non_best_block Header>( db: &LightStorage, - authorities: Option>, + authorities: Option>>, header: F, ) -> Hash { let header = header(); @@ -762,7 +762,7 @@ pub(crate) mod tests { fn authorites_are_cached() { let db = LightStorage::new_test(); - fn run_checks(db: &LightStorage, max: u64, checks: &[(u64, Option>)]) { + fn run_checks(db: &LightStorage, max: u64, checks: &[(u64, Option>>)]) { for (at, expected) in checks.iter().take_while(|(at, _)| *at <= max) { let actual = db.cache().authorities_at(BlockId::Number(*at)); assert_eq!(*expected, actual); diff --git a/core/client/db/src/storage_cache.rs b/core/client/db/src/storage_cache.rs new file mode 100644 index 0000000000000..27d5cec088769 --- /dev/null +++ b/core/client/db/src/storage_cache.rs @@ -0,0 +1,416 @@ +// Copyright 2019 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate 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. + +// Substrate 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 Substrate. If not, see . + +//! Global cache state. + +use std::collections::{VecDeque, HashSet, HashMap}; +use std::sync::Arc; +use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard}; +use lru_cache::LruCache; +use hash_db::Hasher; +use runtime_primitives::traits::{Block, Header}; +use state_machine::{backend::Backend as StateBackend, TrieBackend}; + +const STATE_CACHE_BLOCKS: usize = 12; + +type StorageKey = Vec; +type StorageValue = Vec; + +/// Shared canonical state cache. +pub struct Cache { + /// Storage cache. `None` indicates that key is known to be missing. + storage: LruCache>, + /// Storage hashes cache. `None` indicates that key is known to be missing. + hashes: LruCache>, + /// Information on the modifications in recently committed blocks; specifically which keys + /// changed in which block. Ordered by block number. + modifications: VecDeque>, +} + +pub type SharedCache = Arc>>; + +/// Create new shared cache instance with given max memory usage. +pub fn new_shared_cache(shared_cache_size: usize) -> SharedCache { + let cache_items = shared_cache_size / 100; // Estimated average item size. TODO: more accurate tracking + Arc::new(Mutex::new(Cache { + storage: LruCache::new(cache_items), + hashes: LruCache::new(cache_items), + modifications: VecDeque::new(), + })) +} + +#[derive(Debug)] +/// Accumulates a list of storage changed in a block. +struct BlockChanges { + /// Block number. + number: B::Number, + /// Block hash. + hash: B::Hash, + /// Parent block hash. + parent: B::Hash, + /// A set of modified storage keys. + storage: HashSet, + /// Block is part of the canonical chain. + is_canon: bool, +} + +/// Cached values specific to a state. +struct LocalCache { + /// Storage cache. `None` indicates that key is known to be missing. + storage: HashMap>, + /// Storage hashes cache. `None` indicates that key is known to be missing. + hashes: HashMap>, +} + +/// State abstraction. +/// Manages shared global state cache which reflects the canonical +/// state as it is on the disk. +/// A instance of `CachingState` may be created as canonical or not. +/// For canonical instances local cache is accumulated and applied +/// in `sync_cache` along with the change overlay. +/// For non-canonical clones local cache and changes are dropped. +pub struct CachingState, B: Block> { + /// Backing state. + state: S, + /// Shared canonical state cache. + shared_cache: SharedCache, + /// Local cache of values for this state. + local_cache: RwLock>, + /// Hash of the block on top of which this instance was created or + /// `None` if cache is disabled + pub parent_hash: Option, +} + +impl, B: Block> CachingState { + /// Create a new instance wrapping generic State and shared cache. + pub fn new(state: S, shared_cache: SharedCache, parent_hash: Option) -> CachingState { + CachingState { + state, + shared_cache, + local_cache: RwLock::new(LocalCache { + storage: Default::default(), + hashes: Default::default(), + }), + parent_hash: parent_hash, + } + } + + /// Propagate local cache into the shared cache and synchonize + /// the shared cache with the best block state. + /// This function updates the shared cache by removing entries + /// that are invalidated by chain reorganization. `sync_cache` + /// should be called after the block has been committed and the + /// blockchain route has been calculated. + pub fn sync_cache bool> ( + &mut self, + enacted: &[B::Hash], + retracted: &[B::Hash], + changes: Vec<(StorageKey, Option)>, + commit_hash: Option, + commit_number: Option<::Number>, + is_best: F, + ) { + let mut cache = self.shared_cache.lock(); + let is_best = is_best(); + trace!("Syncing cache, id = (#{:?}, {:?}), parent={:?}, best={}", commit_number, commit_hash, self.parent_hash, is_best); + let cache = &mut *cache; + + // Purge changes from re-enacted and retracted blocks. + // Filter out commiting block if any. + let mut clear = false; + for block in enacted.iter().filter(|h| commit_hash.as_ref().map_or(true, |p| *h != p)) { + clear = clear || { + if let Some(ref mut m) = cache.modifications.iter_mut().find(|m| &m.hash == block) { + trace!("Reverting enacted block {:?}", block); + m.is_canon = true; + for a in &m.storage { + trace!("Reverting enacted key {:?}", a); + cache.storage.remove(a); + } + false + } else { + true + } + }; + } + + for block in retracted { + clear = clear || { + if let Some(ref mut m) = cache.modifications.iter_mut().find(|m| &m.hash == block) { + trace!("Retracting block {:?}", block); + m.is_canon = false; + for a in &m.storage { + trace!("Retracted key {:?}", a); + cache.storage.remove(a); + } + false + } else { + true + } + }; + } + if clear { + // We don't know anything about the block; clear everything + trace!("Wiping cache"); + cache.storage.clear(); + cache.modifications.clear(); + } + + // Propagate cache only if committing on top of the latest canonical state + // blocks are ordered by number and only one block with a given number is marked as canonical + // (contributed to canonical state cache) + if let Some(_) = self.parent_hash { + let mut local_cache = self.local_cache.write(); + if is_best { + trace!("Committing {} local, {} hashes, {} modified entries", local_cache.storage.len(), local_cache.hashes.len(), changes.len()); + for (k, v) in local_cache.storage.drain() { + cache.storage.insert(k, v); + } + for (k, v) in local_cache.hashes.drain() { + cache.hashes.insert(k, v); + } + } + } + + if let ( + Some(ref number), Some(ref hash), Some(ref parent)) + = (commit_number, commit_hash, self.parent_hash) + { + if cache.modifications.len() == STATE_CACHE_BLOCKS { + cache.modifications.pop_back(); + } + let mut modifications = HashSet::new(); + for (k, v) in changes.into_iter() { + modifications.insert(k.clone()); + if is_best { + cache.hashes.remove(&k); + cache.storage.insert(k, v); + } + } + // Save modified storage. These are ordered by the block number. + let block_changes = BlockChanges { + storage: modifications, + number: *number, + hash: hash.clone(), + is_canon: is_best, + parent: parent.clone(), + }; + let insert_at = cache.modifications.iter() + .enumerate() + .find(|&(_, m)| m.number < *number) + .map(|(i, _)| i); + trace!("Inserting modifications at {:?}", insert_at); + if let Some(insert_at) = insert_at { + cache.modifications.insert(insert_at, block_changes); + } else { + cache.modifications.push_back(block_changes); + } + } + } + + /// Check if the key can be returned from cache by matching current block parent hash against canonical + /// state and filtering out entries modified in later blocks. + fn is_allowed( + key: &[u8], + parent_hash: &Option, + modifications: + &VecDeque> + ) -> bool + { + let mut parent = match *parent_hash { + None => { + trace!("Cache lookup skipped for {:?}: no parent hash", key); + return false; + } + Some(ref parent) => parent, + }; + if modifications.is_empty() { + trace!("Cache lookup allowed for {:?}", key); + return true; + } + // Ignore all storage modified in later blocks + // Modifications contains block ordered by the number + // We search for our parent in that list first and then for + // all its parent until we hit the canonical block, + // checking against all the intermediate modifications. + for m in modifications { + if &m.hash == parent { + if m.is_canon { + return true; + } + parent = &m.parent; + } + if m.storage.contains(key) { + trace!("Cache lookup skipped for {:?}: modified in a later block", key); + return false; + } + } + trace!("Cache lookup skipped for {:?}: parent hash is unknown", key); + false + } +} + +impl, B:Block> StateBackend for CachingState { + type Error = S::Error; + type Transaction = S::Transaction; + type TrieBackendStorage = S::TrieBackendStorage; + + fn storage(&self, key: &[u8]) -> Result>, Self::Error> { + let local_cache = self.local_cache.upgradable_read(); + if let Some(entry) = local_cache.storage.get(key).cloned() { + trace!("Found in local cache: {:?}", key); + return Ok(entry) + } + let mut cache = self.shared_cache.lock(); + if Self::is_allowed(key, &self.parent_hash, &cache.modifications) { + if let Some(entry) = cache.storage.get_mut(key).map(|a| a.clone()) { + trace!("Found in shared cache: {:?}", key); + return Ok(entry) + } + } + trace!("Cache miss: {:?}", key); + let value = self.state.storage(key)?; + RwLockUpgradableReadGuard::upgrade(local_cache).storage.insert(key.to_vec(), value.clone()); + Ok(value) + } + + fn storage_hash(&self, key: &[u8]) -> Result, Self::Error> { + let local_cache = self.local_cache.upgradable_read(); + if let Some(entry) = local_cache.hashes.get(key).cloned() { + trace!("Found hash in local cache: {:?}", key); + return Ok(entry) + } + let mut cache = self.shared_cache.lock(); + if Self::is_allowed(key, &self.parent_hash, &cache.modifications) { + if let Some(entry) = cache.hashes.get_mut(key).map(|a| a.clone()) { + trace!("Found hash in shared cache: {:?}", key); + return Ok(entry) + } + } + trace!("Cache hash miss: {:?}", key); + let hash = self.state.storage_hash(key)?; + RwLockUpgradableReadGuard::upgrade(local_cache).hashes.insert(key.to_vec(), hash.clone()); + Ok(hash) + } + + fn child_storage(&self, storage_key: &[u8], key: &[u8]) -> Result>, Self::Error> { + self.state.child_storage(storage_key, key) + } + + fn exists_storage(&self, key: &[u8]) -> Result { + Ok(self.storage(key)?.is_some()) + } + + fn exists_child_storage(&self, storage_key: &[u8], key: &[u8]) -> Result { + self.state.exists_child_storage(storage_key, key) + } + + fn for_keys_with_prefix(&self, prefix: &[u8], f: F) { + self.state.for_keys_with_prefix(prefix, f) + } + + fn for_keys_in_child_storage(&self, storage_key: &[u8], f: F) { + self.state.for_keys_in_child_storage(storage_key, f) + } + + fn storage_root(&self, delta: I) -> (H::Out, Self::Transaction) + where + I: IntoIterator, Option>)>, + H::Out: Ord + { + self.state.storage_root(delta) + } + + fn child_storage_root(&self, storage_key: &[u8], delta: I) -> (Vec, bool, Self::Transaction) + where + I: IntoIterator, Option>)>, + H::Out: Ord + { + self.state.child_storage_root(storage_key, delta) + } + + fn pairs(&self) -> Vec<(Vec, Vec)> { + self.state.pairs() + } + + fn try_into_trie_backend(self) -> Option> { + self.state.try_into_trie_backend() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use runtime_primitives::testing::{H256, Block as RawBlock, ExtrinsicWrapper}; + use state_machine::backend::InMemory; + use primitives::Blake2Hasher; + + type Block = RawBlock>; + #[test] + fn smoke() { + //init_log(); + let root_parent = H256::random(); + let key = H256::random()[..].to_vec(); + let h0 = H256::random(); + let h1a = H256::random(); + let h1b = H256::random(); + let h2a = H256::random(); + let h2b = H256::random(); + let h3a = H256::random(); + let h3b = H256::random(); + + let shared = new_shared_cache::(256*1024); + + // blocks [ 3a(c) 2a(c) 2b 1b 1a(c) 0 ] + // state [ 5 5 4 3 2 2 ] + let mut s = CachingState::new(InMemory::::default(), shared.clone(), Some(root_parent.clone())); + s.sync_cache(&[], &[], vec![(key.clone(), Some(vec![2]))], Some(h0.clone()), Some(0), || true); + + let mut s = CachingState::new(InMemory::::default(), shared.clone(), Some(h0.clone())); + s.sync_cache(&[], &[], vec![], Some(h1a.clone()), Some(1), || true); + + let mut s = CachingState::new(InMemory::::default(), shared.clone(), Some(h0.clone())); + s.sync_cache(&[], &[], vec![(key.clone(), Some(vec![3]))], Some(h1b.clone()), Some(1), || false); + + let mut s = CachingState::new(InMemory::::default(), shared.clone(), Some(h1b.clone())); + s.sync_cache(&[], &[], vec![(key.clone(), Some(vec![4]))], Some(h2b.clone()), Some(2), || false); + + let mut s = CachingState::new(InMemory::::default(), shared.clone(), Some(h1a.clone())); + s.sync_cache(&[], &[], vec![(key.clone(), Some(vec![5]))], Some(h2a.clone()), Some(2), || true); + + let mut s = CachingState::new(InMemory::::default(), shared.clone(), Some(h2a.clone())); + s.sync_cache(&[], &[], vec![], Some(h3a.clone()), Some(3), || true); + + let s = CachingState::new(InMemory::::default(), shared.clone(), Some(h3a.clone())); + assert_eq!(s.storage(&key).unwrap().unwrap(), vec![5]); + + let s = CachingState::new(InMemory::::default(), shared.clone(), Some(h1a.clone())); + assert!(s.storage(&key).unwrap().is_none()); + + let s = CachingState::new(InMemory::::default(), shared.clone(), Some(h2b.clone())); + assert!(s.storage(&key).unwrap().is_none()); + + let s = CachingState::new(InMemory::::default(), shared.clone(), Some(h1b.clone())); + assert!(s.storage(&key).unwrap().is_none()); + + // reorg to 3b + // blocks [ 3b(c) 3a 2a 2b(c) 1b 1a 0 ] + let mut s = CachingState::new(InMemory::::default(), shared.clone(), Some(h2b.clone())); + s.sync_cache(&[h1b.clone(), h2b.clone(), h3b.clone()], &[h1a.clone(), h2a.clone(), h3a.clone()], vec![], Some(h3b.clone()), Some(3), || true); + let s = CachingState::new(InMemory::::default(), shared.clone(), Some(h3a.clone())); + assert!(s.storage(&key).unwrap().is_none()); + } +} diff --git a/core/client/src/backend.rs b/core/client/src/backend.rs index 290159bdc5be8..88e97c7ec400c 100644 --- a/core/client/src/backend.rs +++ b/core/client/src/backend.rs @@ -17,9 +17,8 @@ //! Substrate Client data backend use error; -use primitives::AuthorityId; use runtime_primitives::{generic::BlockId, Justification, StorageMap, ChildrenStorageMap}; -use runtime_primitives::traits::{Block as BlockT, NumberFor}; +use runtime_primitives::traits::{AuthorityIdFor, Block as BlockT, NumberFor}; use state_machine::backend::Backend as StateBackend; use state_machine::ChangesTrieStorage as StateChangesTrieStorage; use hash_db::Hasher; @@ -67,11 +66,13 @@ pub trait BlockImportOperation where /// Append authorities set to the transaction. This is a set of parent block (set which /// has been used to check justification of this block). - fn update_authorities(&mut self, authorities: Vec); + fn update_authorities(&mut self, authorities: Vec>); /// Inject storage data into the database. - fn update_storage(&mut self, update: >::Transaction) -> error::Result<()>; + fn update_db_storage(&mut self, update: >::Transaction) -> error::Result<()>; /// Inject storage data into the database replacing any existing data. fn reset_storage(&mut self, top: StorageMap, children: ChildrenStorageMap) -> error::Result; + /// Set top level storage changes. + fn update_storage(&mut self, update: Vec<(Vec, Option>)>) -> error::Result<()>; /// Inject changes trie data into the database. fn update_changes_trie(&mut self, update: MemoryDB) -> error::Result<()>; /// Update auxiliary keys. Values are `None` if should be deleted. @@ -128,6 +129,10 @@ pub trait Backend: AuxStore + Send + Sync where fn changes_trie_storage(&self) -> Option<&Self::ChangesTrieStorage>; /// Returns state backend with post-state of given block. fn state_at(&self, block: BlockId) -> error::Result; + /// Destroy state and save any useful data, such as cache. + fn destroy_state(&self, _state: Self::State) -> error::Result<()> { + Ok(()) + } /// Attempts to revert the chain by `n` blocks. Returns the number of blocks that were /// successfully reverted. fn revert(&self, n: NumberFor) -> error::Result>; diff --git a/core/client/src/blockchain.rs b/core/client/src/blockchain.rs index ddc8ba866ae96..7ff395113be19 100644 --- a/core/client/src/blockchain.rs +++ b/core/client/src/blockchain.rs @@ -16,8 +16,7 @@ //! Substrate blockchain trait -use primitives::AuthorityId; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor}; +use runtime_primitives::traits::{AuthorityIdFor, Block as BlockT, Header as HeaderT, NumberFor}; use runtime_primitives::generic::BlockId; use runtime_primitives::Justification; @@ -90,7 +89,7 @@ pub trait Backend: HeaderBackend { /// Blockchain optional data cache. pub trait Cache: Send + Sync { /// Returns the set of authorities, that was active at given block or None if there's no entry in the cache. - fn authorities_at(&self, block: BlockId) -> Option>; + fn authorities_at(&self, block: BlockId) -> Option>>; } /// Block import outcome diff --git a/core/client/src/call_executor.rs b/core/client/src/call_executor.rs index 8cbb40dfa2a3b..62104d4aa0e5a 100644 --- a/core/client/src/call_executor.rs +++ b/core/client/src/call_executor.rs @@ -24,22 +24,11 @@ use state_machine::{self, OverlayedChanges, Ext, use executor::{RuntimeVersion, RuntimeInfo, NativeVersion}; use hash_db::Hasher; use trie::MemoryDB; -use codec::Decode; use primitives::{H256, Blake2Hasher}; -use primitives::storage::well_known_keys; use backend; use error; -/// Information regarding the result of a call. -#[derive(Debug, Clone)] -pub struct CallResult { - /// The data that was returned from the call. - pub return_data: Vec, - /// The changes made to the state by the call. - pub changes: OverlayedChanges, -} - /// Method call executor. pub trait CallExecutor where @@ -58,7 +47,7 @@ where id: &BlockId, method: &str, call_data: &[u8], - ) -> Result; + ) -> Result, error::Error>; /// Execute a contextual call on top of state in a block of a given hash. /// @@ -163,16 +152,22 @@ where id: &BlockId, method: &str, call_data: &[u8], - ) -> error::Result { + ) -> error::Result> { let mut changes = OverlayedChanges::default(); - let (return_data, _, _) = self.call_at_state( - &self.backend.state_at(*id)?, + let state = self.backend.state_at(*id)?; + let return_data = state_machine::execute_using_consensus_failure_handler( + &state, + self.backend.changes_trie_storage(), &mut changes, + &self.executor, method, call_data, native_when_possible(), - )?; - Ok(CallResult { return_data, changes }) + false, + ) + .map(|(result, _, _)| result)?; + self.backend.destroy_state(state)?; + Ok(return_data) } fn contextual_call< @@ -192,28 +187,40 @@ where //TODO: Find a better way to prevent double block initialization if method != "Core_initialise_block" && initialised_block.map(|id| id != *at).unwrap_or(true) { let header = prepare_environment_block()?; - self.call_at_state(&state, changes, "Core_initialise_block", &header.encode(), manager.clone())?; + state_machine::execute_using_consensus_failure_handler( + &state, + self.backend.changes_trie_storage(), + changes, + &self.executor, + "Core_initialise_block", + &header.encode(), + manager.clone(), + false, + )?; *initialised_block = Some(*at); } - self.call_at_state(&state, changes, method, call_data, manager).map(|cr| cr.0) + let result = state_machine::execute_using_consensus_failure_handler( + &state, + self.backend.changes_trie_storage(), + changes, + &self.executor, + method, + call_data, + manager, + false, + ) + .map(|(result, _, _)| result)?; + + self.backend.destroy_state(state)?; + Ok(result) } fn runtime_version(&self, id: &BlockId) -> error::Result { let mut overlay = OverlayedChanges::default(); let state = self.backend.state_at(*id)?; - use state_machine::Backend; - let code = state.storage(well_known_keys::CODE) - .map_err(|e| error::ErrorKind::Execution(Box::new(e)))? - .ok_or(error::ErrorKind::VersionInvalid)? - .to_vec(); - let heap_pages = state.storage(well_known_keys::HEAP_PAGES) - .map_err(|e| error::ErrorKind::Execution(Box::new(e)))? - .and_then(|v| u64::decode(&mut &v[..])) - .unwrap_or(1024) as usize; - let mut ext = Ext::new(&mut overlay, &state, self.backend.changes_trie_storage()); - self.executor.runtime_version(&mut ext, heap_pages, &code) + self.executor.runtime_version(&mut ext) .ok_or(error::ErrorKind::VersionInvalid.into()) } diff --git a/core/client/src/client.rs b/core/client/src/client.rs index a37bd163b2548..f02e25f78c07e 100644 --- a/core/client/src/client.rs +++ b/core/client/src/client.rs @@ -20,15 +20,14 @@ use std::{marker::PhantomData, collections::{HashSet, BTreeMap}, sync::Arc}; use error::Error; use futures::sync::mpsc; use parking_lot::{Mutex, RwLock}; -use primitives::AuthorityId; use runtime_primitives::{ Justification, generic::{BlockId, SignedBlock}, }; -use consensus::{ImportBlock, ImportResult, BlockOrigin}; +use consensus::{Error as ConsensusError, ErrorKind as ConsensusErrorKind, ImportBlock, ImportResult, BlockOrigin, ForkChoiceStrategy}; use runtime_primitives::traits::{ Block as BlockT, Header as HeaderT, Zero, As, NumberFor, CurrentHeight, BlockNumberToHash, - ApiRef, ProvideRuntimeApi, Digest, DigestItem, + ApiRef, ProvideRuntimeApi, Digest, DigestItem, AuthorityIdFor }; use runtime_primitives::BuildStorage; use runtime_api::{Core as CoreAPI, CallRuntimeAt, ConstructRuntimeApi}; @@ -231,7 +230,6 @@ impl Client where let (genesis_storage, children_genesis_storage) = build_genesis_storage.build_storage()?; let mut op = backend.begin_operation(BlockId::Hash(Default::default()))?; let state_root = op.reset_storage(genesis_storage, children_genesis_storage)?; - let genesis_block = genesis::construct_genesis_block::(state_root.into()); info!("Initialising Genesis block/state (state: {}, header-hash: {})", genesis_block.header().state_root(), genesis_block.header().hash()); op.set_block_data( @@ -281,12 +279,12 @@ impl Client where } /// Get the set of authorities at a given block. - pub fn authorities_at(&self, id: &BlockId) -> error::Result> { + pub fn authorities_at(&self, id: &BlockId) -> error::Result>> { match self.backend.blockchain().cache().and_then(|cache| cache.authorities_at(*id)) { Some(cached_value) => Ok(cached_value), - None => self.executor.call(id, "Core_authorities",&[]) - .and_then(|r| Vec::::decode(&mut &r.return_data[..]) - .ok_or(error::ErrorKind::InvalidAuthoritiesSet.into())) + None => self.executor.call(id, "Core_authorities", &[]) + .and_then(|r| Vec::>::decode(&mut &r[..]) + .ok_or_else(|| error::ErrorKind::InvalidAuthoritiesSet.into())) } } @@ -541,9 +539,10 @@ impl Client where import_headers: PrePostHeader, justification: Option, body: Option>, - authorities: Option>, + authorities: Option>>, finalized: bool, aux: Vec<(Vec, Option>)>, + fork_choice: ForkChoiceStrategy, ) -> error::Result where E: CallExecutor + Send + Sync + Clone, { @@ -602,13 +601,16 @@ impl Client where ); let (_, storage_update, changes_update) = r?; overlay.commit_prospective(); - (Some(storage_update), Some(changes_update), Some(overlay.into_committed())) + (Some(storage_update), Some(changes_update), Some(overlay.into_committed().collect())) }, None => (None, None, None) }; // TODO: non longest-chain rule. - let is_new_best = finalized || import_headers.post().number() > &last_best_number; + let is_new_best = finalized || match fork_choice { + ForkChoiceStrategy::LongestChain => import_headers.post().number() > &last_best_number, + ForkChoiceStrategy::Custom(v) => v, + }; let leaf_state = if finalized { ::backend::NewBlockState::Final } else if is_new_best { @@ -630,7 +632,10 @@ impl Client where transaction.update_authorities(authorities); } if let Some(storage_update) = storage_update { - transaction.update_storage(storage_update)?; + transaction.update_db_storage(storage_update)?; + } + if let Some(storage_changes) = storage_changes.clone() { + transaction.update_storage(storage_changes)?; } if let Some(Some(changes_update)) = changes_update { transaction.update_changes_trie(changes_update)?; @@ -643,7 +648,7 @@ impl Client where if let Some(storage_changes) = storage_changes { // TODO [ToDr] How to handle re-orgs? Should we re-emit all storage changes? self.storage_notifications.lock() - .trigger(&hash, storage_changes); + .trigger(&hash, storage_changes.into_iter()); } if finalized { @@ -1019,14 +1024,14 @@ impl consensus::BlockImport for Client E: CallExecutor + Clone + Send + Sync, Block: BlockT, { - type Error = Error; + type Error = ConsensusError; /// Import a checked and validated block. If a justification is provided in /// `ImportBlock` then `finalized` *must* be true. fn import_block( &self, import_block: ImportBlock, - new_authorities: Option>, + new_authorities: Option>>, ) -> Result { use runtime_primitives::traits::Digest; @@ -1038,15 +1043,17 @@ impl consensus::BlockImport for Client body, finalized, auxiliary, + fork_choice, } = import_block; assert!(justification.is_some() && finalized || justification.is_none()); let parent_hash = header.parent_hash().clone(); - match self.backend.blockchain().status(BlockId::Hash(parent_hash))? { - blockchain::BlockStatus::InChain => {}, - blockchain::BlockStatus::Unknown => return Ok(ImportResult::UnknownParent), + match self.backend.blockchain().status(BlockId::Hash(parent_hash)) { + Ok(blockchain::BlockStatus::InChain) => {}, + Ok(blockchain::BlockStatus::Unknown) => return Ok(ImportResult::UnknownParent), + Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()) } let import_headers = if post_digests.is_empty() { @@ -1073,6 +1080,7 @@ impl consensus::BlockImport for Client new_authorities, finalized, auxiliary, + fork_choice, ); *self.importing_block.write() = None; @@ -1081,7 +1089,7 @@ impl consensus::BlockImport for Client "best" => ?hash, "origin" => ?origin ); - result.map_err(|e| e.into()) + result.map_err(|e| ConsensusErrorKind::ClientImport(e.to_string()).into()) } } @@ -1091,7 +1099,7 @@ impl consensus::Authorities for Client Block: BlockT, { type Error = Error; - fn authorities(&self, at: &BlockId) -> Result, Self::Error> { + fn authorities(&self, at: &BlockId) -> Result>, Self::Error> { self.authorities_at(at).map_err(|e| e.into()) } } diff --git a/core/client/src/in_mem.rs b/core/client/src/in_mem.rs index 1bf50d715d62a..606f03d870d31 100644 --- a/core/client/src/in_mem.rs +++ b/core/client/src/in_mem.rs @@ -22,10 +22,10 @@ use parking_lot::RwLock; use error; use backend::{self, NewBlockState}; use light; -use primitives::{AuthorityId, storage::well_known_keys}; +use primitives::storage::well_known_keys; use runtime_primitives::generic::BlockId; use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, - NumberFor, As, Digest, DigestItem}; + NumberFor, As, Digest, DigestItem, AuthorityIdFor}; use runtime_primitives::{Justification, StorageMap, ChildrenStorageMap}; use blockchain::{self, BlockStatus, HeaderBackend}; use state_machine::backend::{Backend as StateBackend, InMemory, Consolidate}; @@ -108,7 +108,7 @@ pub struct Blockchain { struct Cache { storage: Arc>>, - authorities_at: RwLock>>>, + authorities_at: RwLock>>>>, } impl Clone for Blockchain { @@ -368,7 +368,7 @@ impl light::blockchain::Storage for Blockchain fn import_header( &self, header: Block::Header, - authorities: Option>, + authorities: Option>>, state: NewBlockState, aux_ops: Vec<(Vec, Option>)>, ) -> error::Result<()> { @@ -409,7 +409,7 @@ impl light::blockchain::Storage for Blockchain /// In-memory operation. pub struct BlockImportOperation { pending_block: Option>, - pending_authorities: Option>, + pending_authorities: Option>>, old_state: InMemory, new_state: Option>, changes_trie_update: Option>, @@ -444,11 +444,11 @@ where Ok(()) } - fn update_authorities(&mut self, authorities: Vec) { + fn update_authorities(&mut self, authorities: Vec>) { self.pending_authorities = Some(authorities); } - fn update_storage(&mut self, update: as StateBackend>::Transaction) -> error::Result<()> { + fn update_db_storage(&mut self, update: as StateBackend>::Transaction) -> error::Result<()> { self.new_state = Some(self.old_state.update(update)); Ok(()) } @@ -491,6 +491,10 @@ where self.aux = Some(ops.into_iter().collect()); Ok(()) } + + fn update_storage(&mut self, _update: Vec<(Vec, Option>)>) -> error::Result<()> { + Ok(()) + } } /// In-memory backend. Keeps all states and blocks in memory. Useful for testing. @@ -632,13 +636,13 @@ where {} impl Cache { - fn insert(&self, at: Block::Hash, authorities: Option>) { + fn insert(&self, at: Block::Hash, authorities: Option>>) { self.authorities_at.write().insert(at, authorities); } } impl blockchain::Cache for Cache { - fn authorities_at(&self, block: BlockId) -> Option> { + fn authorities_at(&self, block: BlockId) -> Option>> { let hash = match block { BlockId::Hash(hash) => hash, BlockId::Number(number) => self.storage.read().hashes.get(&number).cloned()?, @@ -652,7 +656,7 @@ impl blockchain::Cache for Cache { pub fn cache_authorities_at( blockchain: &Blockchain, at: Block::Hash, - authorities: Option> + authorities: Option>> ) { blockchain.cache.insert(at, authorities); } diff --git a/core/client/src/leaves.rs b/core/client/src/leaves.rs index a41f91933c076..bc1551e6fadc6 100644 --- a/core/client/src/leaves.rs +++ b/core/client/src/leaves.rs @@ -64,6 +64,8 @@ pub struct DisplacedLeaf { #[derive(Debug, Clone, PartialEq, Eq)] pub struct LeafSet { storage: BTreeSet>, + pending_added: Vec>, + pending_removed: Vec, } impl LeafSet where @@ -73,7 +75,9 @@ impl LeafSet where /// Construct a new, blank leaf set. pub fn new() -> Self { Self { - storage: BTreeSet::new() + storage: BTreeSet::new(), + pending_added: Vec::new(), + pending_removed: Vec::new(), } } @@ -94,7 +98,11 @@ impl LeafSet where }; storage.insert(LeafSetItem { hash, number }); } - Ok(Self { storage }) + Ok(Self { + storage, + pending_added: Vec::new(), + pending_removed: Vec::new(), + }) } /// update the leaf list on import. returns a displaced leaf if there was one. @@ -102,12 +110,13 @@ impl LeafSet where // avoid underflow for genesis. let displaced = if number != N::zero() { let displaced = LeafSetItem { - hash: parent_hash, + hash: parent_hash.clone(), number: number.clone() - N::one(), }; let was_displaced = self.storage.remove(&displaced); if was_displaced { + self.pending_removed.push(parent_hash); Some(DisplacedLeaf { new_hash: hash.clone(), displaced, @@ -119,7 +128,9 @@ impl LeafSet where None }; - self.storage.insert(LeafSetItem { hash, number }); + let item = LeafSetItem { hash, number }; + self.storage.insert(item.clone()); + self.pending_added.push(item); displaced } @@ -128,6 +139,8 @@ impl LeafSet where let new_number = displaced.displaced.number.clone() + N::one(); self.storage.remove(&LeafSetItem { hash: displaced.new_hash, number: new_number }); self.storage.insert(displaced.displaced); + self.pending_added.clear(); + self.pending_removed.clear(); } /// currently since revert only affects the canonical chain @@ -148,13 +161,18 @@ impl LeafSet where } /// Write the leaf list to the database transaction. - pub fn prepare_transaction(&self, tx: &mut DBTransaction, column: Option, prefix: &[u8]) { + pub fn prepare_transaction(&mut self, tx: &mut DBTransaction, column: Option, prefix: &[u8]) { let mut buf = prefix.to_vec(); - for &LeafSetItem { ref hash, ref number } in &self.storage { + for LeafSetItem { hash, number } in self.pending_added.drain(..) { hash.using_encoded(|s| buf.extend(s)); tx.put_vec(column, &buf[..], number.encode()); buf.truncate(prefix.len()); // reuse allocation. } + for hash in self.pending_removed.drain(..) { + hash.using_encoded(|s| buf.extend(s)); + tx.delete(column, &buf[..]); + buf.truncate(prefix.len()); // reuse allocation. + } } } diff --git a/core/client/src/lib.rs b/core/client/src/lib.rs index fb07c130b25ff..3bb65df9d184e 100644 --- a/core/client/src/lib.rs +++ b/core/client/src/lib.rs @@ -102,7 +102,7 @@ mod notifications; #[cfg(feature = "std")] pub use blockchain::Info as ChainInfo; #[cfg(feature = "std")] -pub use call_executor::{CallResult, CallExecutor, LocalCallExecutor}; +pub use call_executor::{CallExecutor, LocalCallExecutor}; #[cfg(feature = "std")] pub use client::{ new_with_backend, diff --git a/core/client/src/light/backend.rs b/core/client/src/light/backend.rs index 185b7cfa06971..6beaf1271bf4b 100644 --- a/core/client/src/light/backend.rs +++ b/core/client/src/light/backend.rs @@ -21,10 +21,9 @@ use std::sync::{Arc, Weak}; use futures::{Future, IntoFuture}; use parking_lot::RwLock; -use primitives::AuthorityId; use runtime_primitives::{generic::BlockId, Justification, StorageMap, ChildrenStorageMap}; use state_machine::{Backend as StateBackend, InMemoryChangesTrieStorage, TrieBackend}; -use runtime_primitives::traits::{Block as BlockT, NumberFor}; +use runtime_primitives::traits::{Block as BlockT, NumberFor, AuthorityIdFor}; use in_mem; use backend::{AuxStore, Backend as ClientBackend, BlockImportOperation, RemoteBackend, NewBlockState}; @@ -44,7 +43,7 @@ pub struct Backend { /// Light block (header and justification) import operation. pub struct ImportOperation { header: Option, - authorities: Option>, + authorities: Option>>, leaf_state: NewBlockState, aux_ops: Vec<(Vec, Option>)>, _phantom: ::std::marker::PhantomData<(S, F)>, @@ -185,11 +184,11 @@ where Ok(()) } - fn update_authorities(&mut self, authorities: Vec) { + fn update_authorities(&mut self, authorities: Vec>) { self.authorities = Some(authorities); } - fn update_storage(&mut self, _update: >::Transaction) -> ClientResult<()> { + fn update_db_storage(&mut self, _update: >::Transaction) -> ClientResult<()> { // we're not storing anything locally => ignore changes Ok(()) } @@ -211,6 +210,11 @@ where self.aux_ops = ops.into_iter().collect(); Ok(()) } + + fn update_storage(&mut self, _update: Vec<(Vec, Option>)>) -> ClientResult<()> { + // we're not storing anything locally => ignore changes + Ok(()) + } } impl StateBackend for OnDemandState diff --git a/core/client/src/light/blockchain.rs b/core/client/src/light/blockchain.rs index ed75043164956..62e40c579e213 100644 --- a/core/client/src/light/blockchain.rs +++ b/core/client/src/light/blockchain.rs @@ -21,9 +21,8 @@ use std::sync::Weak; use futures::{Future, IntoFuture}; use parking_lot::Mutex; -use primitives::AuthorityId; use runtime_primitives::{Justification, generic::BlockId}; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT,NumberFor, Zero}; +use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero, AuthorityIdFor}; use backend::{AuxStore, NewBlockState}; use blockchain::{Backend as BlockchainBackend, BlockStatus, Cache as BlockchainCache, @@ -41,7 +40,7 @@ pub trait Storage: AuxStore + BlockchainHeaderBackend { fn import_header( &self, header: Block::Header, - authorities: Option>, + authorities: Option>>, state: NewBlockState, aux_ops: Vec<(Vec, Option>)>, ) -> ClientResult<()>; @@ -227,7 +226,7 @@ pub mod tests { fn import_header( &self, _header: Header, - _authorities: Option>, + _authorities: Option>>, _state: NewBlockState, _aux_ops: Vec<(Vec, Option>)>, ) -> ClientResult<()> { diff --git a/core/client/src/light/call_executor.rs b/core/client/src/light/call_executor.rs index d30e45921538d..84d7545d6f0f4 100644 --- a/core/client/src/light/call_executor.rs +++ b/core/client/src/light/call_executor.rs @@ -31,7 +31,7 @@ use state_machine::{self, Backend as StateBackend, CodeExecutor, OverlayedChange use hash_db::Hasher; use blockchain::Backend as ChainBackend; -use call_executor::{CallExecutor, CallResult}; +use call_executor::CallExecutor; use error::{Error as ClientError, ErrorKind as ClientErrorKind, Result as ClientResult}; use light::fetcher::{Fetcher, RemoteCallRequest}; use executor::{RuntimeVersion, NativeVersion}; @@ -74,7 +74,7 @@ where { type Error = ClientError; - fn call(&self, id: &BlockId, method: &str, call_data: &[u8]) -> ClientResult { + fn call(&self, id: &BlockId, method: &str, call_data: &[u8]) -> ClientResult> { let block_hash = self.blockchain.expect_block_hash_from_id(id)?; let block_header = self.blockchain.expect_header(id.clone())?; @@ -105,12 +105,12 @@ where return Err(ClientErrorKind::NotAvailableOnLightClient.into()); } - self.call(at, method, call_data).map(|cr| cr.return_data) + self.call(at, method, call_data) } fn runtime_version(&self, id: &BlockId) -> ClientResult { let call_result = self.call(id, "version", &[])?; - RuntimeVersion::decode(&mut call_result.return_data.as_slice()) + RuntimeVersion::decode(&mut call_result.as_slice()) .ok_or_else(|| ClientErrorKind::VersionInvalid.into()) } @@ -189,7 +189,7 @@ pub fn check_execution_proof( executor: &E, request: &RemoteCallRequest
, remote_proof: Vec> -) -> ClientResult +) -> ClientResult> where Header: HeaderT, E: CodeExecutor, @@ -226,7 +226,7 @@ pub fn check_execution_proof( &request.call_data, )?; - Ok(CallResult { return_data: local_result, changes }) + Ok(local_result) } #[cfg(test)] @@ -273,7 +273,7 @@ mod tests { retry_count: None, }, remote_execution_proof).unwrap(); - (remote_result, local_result.return_data) + (remote_result, local_result) } // prepare remote client diff --git a/core/client/src/light/fetcher.rs b/core/client/src/light/fetcher.rs index 1171e15f49d6a..5f9aed2fe1632 100644 --- a/core/client/src/light/fetcher.rs +++ b/core/client/src/light/fetcher.rs @@ -28,7 +28,6 @@ use runtime_primitives::traits::{As, Block as BlockT, Header as HeaderT, NumberF use state_machine::{CodeExecutor, ChangesTrieRootsStorage, ChangesTrieAnchorBlockId, TrieBackend, read_proof_check, key_changes_proof_check, create_proof_check_backend_storage}; -use call_executor::CallResult; use cht; use error::{Error as ClientError, ErrorKind as ClientErrorKind, Result as ClientResult}; use light::blockchain::{Blockchain, Storage as BlockchainStorage}; @@ -118,7 +117,7 @@ pub trait Fetcher: Send + Sync { /// Remote storage read future. type RemoteReadResult: IntoFuture>, Error=ClientError>; /// Remote call result future. - type RemoteCallResult: IntoFuture; + type RemoteCallResult: IntoFuture, Error=ClientError>; /// Remote changes result future. type RemoteChangesResult: IntoFuture, u32)>, Error=ClientError>; @@ -156,7 +155,7 @@ pub trait FetchChecker: Send + Sync { &self, request: &RemoteCallRequest, remote_proof: Vec> - ) -> ClientResult; + ) -> ClientResult>; /// Check remote changes query proof. fn check_changes_proof( &self, @@ -344,7 +343,7 @@ impl FetchChecker for LightDataChecker, remote_proof: Vec> - ) -> ClientResult { + ) -> ClientResult> { check_execution_proof::<_, _, H>(&self.executor, request, remote_proof) } @@ -392,7 +391,6 @@ pub mod tests { use futures::future::{ok, err, FutureResult}; use parking_lot::Mutex; use keyring::Keyring; - use call_executor::CallResult; use client::tests::prepare_client_with_key_changes; use executor::{self, NativeExecutionDispatch}; use error::Error as ClientError; @@ -410,12 +408,12 @@ pub mod tests { use state_machine::Backend; use super::*; - pub type OkCallFetcher = Mutex; + pub type OkCallFetcher = Mutex>; impl Fetcher for OkCallFetcher { type RemoteHeaderResult = FutureResult; type RemoteReadResult = FutureResult>, ClientError>; - type RemoteCallResult = FutureResult; + type RemoteCallResult = FutureResult, ClientError>; type RemoteChangesResult = FutureResult, u32)>, ClientError>; fn remote_header(&self, _request: RemoteHeaderRequest
) -> Self::RemoteHeaderResult { diff --git a/core/client/src/runtime_api.rs b/core/client/src/runtime_api.rs index 9ad92fb493c5b..596b355ddf2f4 100644 --- a/core/client/src/runtime_api.rs +++ b/core/client/src/runtime_api.rs @@ -21,7 +21,7 @@ pub use state_machine::OverlayedChanges; #[doc(hidden)] pub use runtime_primitives::{ - traits::{Block as BlockT, GetNodeBlockType, GetRuntimeBlockType, ApiRef, RuntimeApiInfo}, + traits::{AuthorityIdFor, Block as BlockT, GetNodeBlockType, GetRuntimeBlockType, ApiRef, RuntimeApiInfo}, generic::BlockId, transaction_validity::TransactionValidity }; #[doc(hidden)] @@ -34,7 +34,7 @@ pub use codec::{Encode, Decode}; #[cfg(feature = "std")] use error; use rstd::vec::Vec; -use primitives::{AuthorityId, OpaqueMetadata}; +use primitives::OpaqueMetadata; /// Something that can be constructed to a runtime api. @@ -91,7 +91,7 @@ decl_runtime_apis! { /// Returns the version of the runtime. fn version() -> RuntimeVersion; /// Returns the authorities. - fn authorities() -> Vec; + fn authorities() -> Vec>; /// Execute the given block. fn execute_block(block: Block); /// Initialise a block with the given header. diff --git a/core/consensus/aura/Cargo.toml b/core/consensus/aura/Cargo.toml index 7994afc9848fd..f1b569c91f0dc 100644 --- a/core/consensus/aura/Cargo.toml +++ b/core/consensus/aura/Cargo.toml @@ -17,18 +17,15 @@ substrate-consensus-aura-primitives = { path = "primitives" } srml-consensus = { path = "../../../srml/consensus" } futures = "0.1.17" tokio = "0.1.7" -parking_lot = "0.4" +parking_lot = "0.7.1" error-chain = "0.12" log = "0.3" substrate-consensus-common = { path = "../common" } -substrate-network = { path = "../../network" } [dev-dependencies] substrate-keyring = { path = "../../keyring" } substrate-executor = { path = "../../executor" } +substrate-network = { path = "../../network", features = ["test-helpers"]} substrate-service = { path = "../../service" } substrate-test-client = { path = "../../test-client" } env_logger = "0.4" - -[target.'cfg(test)'.dependencies] -substrate-network = { path = "../../network", features = ["test-helpers"], optional = true } diff --git a/core/consensus/aura/src/lib.rs b/core/consensus/aura/src/lib.rs index f22e20930c0fd..f544c2f0e7357 100644 --- a/core/consensus/aura/src/lib.rs +++ b/core/consensus/aura/src/lib.rs @@ -37,42 +37,45 @@ extern crate substrate_consensus_aura_primitives as aura_primitives; extern crate substrate_consensus_common as consensus_common; extern crate tokio; extern crate sr_version as runtime_version; -extern crate substrate_network as network; -extern crate futures; extern crate parking_lot; #[macro_use] extern crate log; +#[macro_use] +extern crate futures; #[cfg(test)] extern crate substrate_keyring as keyring; #[cfg(test)] +extern crate substrate_network as network; +#[cfg(test)] extern crate substrate_service as service; #[cfg(test)] extern crate substrate_test_client as test_client; #[cfg(test)] extern crate env_logger; -pub use aura_primitives::*; +mod slots; use std::sync::Arc; -use std::time::{Duration, Instant}; +use std::time::Duration; use codec::Encode; -use consensus_common::{Authorities, BlockImport, Environment, Proposer}; +use consensus_common::{Authorities, BlockImport, Environment, Error as ConsensusError, Proposer, ForkChoiceStrategy}; +use consensus_common::import_queue::{Verifier, BasicQueue}; use client::ChainHead; use client::block_builder::api::BlockBuilder as BlockBuilderApi; use consensus_common::{ImportBlock, BlockOrigin}; use runtime_primitives::{generic, generic::BlockId, Justification, BasicInherentData}; -use runtime_primitives::traits::{Block, Header, Digest, DigestItemFor, ProvideRuntimeApi}; -use network::import_queue::{Verifier, BasicQueue}; -use primitives::{AuthorityId, ed25519}; +use runtime_primitives::traits::{Block, Header, Digest, DigestItemFor, DigestItem, ProvideRuntimeApi}; +use primitives::{Ed25519AuthorityId, ed25519}; use futures::{Stream, Future, IntoFuture, future::{self, Either}}; -use tokio::timer::{Delay, Timeout}; +use tokio::timer::Timeout; use api::AuraApi; +use slots::Slots; -pub use aura_primitives::AuraConsensusData; +pub use aura_primitives::*; pub use consensus_common::SyncOracle; /// A handle to the network. This is generally implemented by providing some @@ -88,7 +91,7 @@ pub trait Network: Clone { } /// Get slot author for given block along with authorities. -fn slot_author(slot_num: u64, authorities: &[AuthorityId]) -> Option { +fn slot_author(slot_num: u64, authorities: &[Ed25519AuthorityId]) -> Option { if authorities.is_empty() { return None } let idx = slot_num % (authorities.len() as u64); @@ -165,7 +168,7 @@ pub fn start_aura_thread( I: BlockImport + Send + Sync + 'static, Error: From + From + 'static, SO: SyncOracle + Send + Clone + 'static, - DigestItemFor: CompatibleDigestItem + 'static, + DigestItemFor: CompatibleDigestItem + DigestItem + 'static, Error: ::std::error::Error + Send + From<::consensus_common::Error> + 'static, { use tokio::runtime::current_thread::Runtime; @@ -179,16 +182,15 @@ pub fn start_aura_thread( } }; - runtime.spawn(start_aura( + let _ = runtime.block_on(start_aura( slot_duration, local_key, client, block_import, env, sync_oracle, + on_exit, )); - - runtime.block_on(on_exit).expect("Exit future should not fail"); }); } @@ -200,6 +202,7 @@ pub fn start_aura( block_import: Arc, env: Arc, sync_oracle: SO, + on_exit: impl Future, ) -> impl Future where B: Block, C: Authorities + ChainHead, @@ -208,11 +211,10 @@ pub fn start_aura( I: BlockImport, Error: From + From, SO: SyncOracle + Send + Clone, - DigestItemFor: CompatibleDigestItem, + DigestItemFor: CompatibleDigestItem + DigestItem, Error: ::std::error::Error + Send + 'static + From<::consensus_common::Error>, { let make_authorship = move || { - use futures::future; let client = client.clone(); let pair = local_key.clone(); @@ -221,138 +223,121 @@ pub fn start_aura( let sync_oracle = sync_oracle.clone(); let SlotDuration(slot_duration) = slot_duration; - fn time_until_next(now: Duration, slot_duration: u64) -> Duration { - let remaining_full_secs = slot_duration - (now.as_secs() % slot_duration) - 1; - let remaining_nanos = 1_000_000_000 - now.subsec_nanos(); - Duration::new(remaining_full_secs, remaining_nanos) - }; + // rather than use a timer interval, we schedule our waits ourselves + Slots::new(slot_duration) + .map_err(|e| debug!(target: "aura", "Faulty timer: {:?}", e)) + .for_each(move |slot_info| { + let client = client.clone(); + let pair = pair.clone(); + let block_import = block_import.clone(); + let env = env.clone(); + let sync_oracle = sync_oracle.clone(); + let public_key = pair.public(); + + // only propose when we are not syncing. + if sync_oracle.is_major_syncing() { + debug!(target: "aura", "Skipping proposal slot due to sync."); + return Either::B(future::ok(())); + } + + let (timestamp, slot_num) = (slot_info.timestamp, slot_info.number); + let chain_head = match client.best_block_header() { + Ok(x) => x, + Err(e) => { + warn!(target:"aura", "Unable to author block in slot {}. \ + no best block header: {:?}", slot_num, e); + return Either::B(future::ok(())) + } + }; - // rather than use an interval, we schedule our waits ourselves - future::loop_fn((), move |()| { - let next_slot_start = duration_now() - .map(|now| Instant::now() + time_until_next(now, slot_duration)) - .unwrap_or_else(|| Instant::now()); - - let client = client.clone(); - let pair = pair.clone(); - let block_import = block_import.clone(); - let env = env.clone(); - let sync_oracle = sync_oracle.clone(); - let public_key = pair.public(); - - Delay::new(next_slot_start) - .map_err(|e| debug!(target: "aura", "Faulty timer: {:?}", e)) - .and_then(move |_| { - // only propose when we are not syncing. - if sync_oracle.is_major_syncing() { - debug!(target: "aura", "Skipping proposal slot due to sync."); + let authorities = match client.authorities(&BlockId::Hash(chain_head.hash())) { + Ok(authorities) => authorities, + Err(e) => { + warn!("Unable to fetch authorities at\ + block {:?}: {:?}", chain_head.hash(), e); return Either::B(future::ok(())); } + }; - let pair = pair.clone(); - let (timestamp, slot_num) = match timestamp_and_slot_now(slot_duration) { - Some(n) => n, - None => return Either::B(future::err(())), - }; - - let chain_head = match client.best_block_header() { - Ok(x) => x, - Err(e) => { - warn!(target:"aura", "Unable to author block in slot {}. \ - no best block header: {:?}", slot_num, e); - return Either::B(future::ok(())) - } - }; - - let authorities = match client.authorities(&BlockId::Hash(chain_head.hash())) { - Ok(authorities) => authorities, - Err(e) => { - warn!("Unable to fetch authorities at\ - block {:?}: {:?}", chain_head.hash(), e); - return Either::B(future::ok(())); - } - }; - - let proposal_work = match slot_author(slot_num, &authorities) { - None => return Either::B(future::ok(())), - Some(author) => if author.0 == public_key.0 { - debug!(target: "aura", "Starting authorship at slot {}; timestamp = {}", - slot_num, timestamp); - - // we are the slot author. make a block and sign it. - let proposer = match env.init(&chain_head, &authorities, pair.clone()) { - Ok(p) => p, - Err(e) => { - warn!("Unable to author block in slot {:?}: {:?}", slot_num, e); - return Either::B(future::ok(())) - } - }; - - let consensus_data = AuraConsensusData { - timestamp, - slot: slot_num, - slot_duration, - }; - - // deadline our production to approx. the end of the - // slot - Timeout::new( - proposer.propose(consensus_data).into_future(), - time_until_next(Duration::from_secs(timestamp), slot_duration), - ) - } else { - return Either::B(future::ok(())); - } - }; - - let block_import = block_import.clone(); - Either::A(proposal_work - .map(move |b| { - // minor hack since we don't have access to the timestamp - // that is actually set by the proposer. - let slot_after_building = slot_now(slot_duration); - if slot_after_building != Some(slot_num) { - info!("Discarding proposal for slot {}; block production took too long", - slot_num); - return + let proposal_work = match slot_author(slot_num, &authorities) { + None => return Either::B(future::ok(())), + Some(author) => if author.0 == public_key.0 { + debug!(target: "aura", "Starting authorship at slot {}; timestamp = {}", + slot_num, timestamp); + + // we are the slot author. make a block and sign it. + let proposer = match env.init(&chain_head, &authorities) { + Ok(p) => p, + Err(e) => { + warn!("Unable to author block in slot {:?}: {:?}", slot_num, e); + return Either::B(future::ok(())) } + }; + + let consensus_data = AuraConsensusData { + timestamp, + slot: slot_num, + slot_duration, + }; + + // deadline our production to approx. the end of the + // slot + Timeout::new( + proposer.propose(consensus_data).into_future(), + slot_info.remaining_duration(), + ) + } else { + return Either::B(future::ok(())); + } + }; - let (header, body) = b.deconstruct(); - let pre_hash = header.hash(); - let parent_hash = header.parent_hash().clone(); - - // sign the pre-sealed hash of the block and then - // add it to a digest item. - let to_sign = (slot_num, pre_hash).encode(); - let signature = pair.sign(&to_sign[..]); - let item = as CompatibleDigestItem>::aura_seal( - slot_num, - signature, - ); - - let import_block = ImportBlock { - origin: BlockOrigin::Own, - header, - justification: None, - post_digests: vec![item], - body: Some(body), - finalized: false, - auxiliary: Vec::new(), - }; - - if let Err(e) = block_import.import_block(import_block, None) { - warn!(target: "aura", "Error with block built on {:?}: {:?}", - parent_hash, e); - } - }) - .map_err(|e| warn!("Failed to construct block: {:?}", e)) - ) - }) - .map(|_| future::Loop::Continue(())) - }) + let block_import = block_import.clone(); + Either::A(proposal_work + .map(move |b| { + // minor hack since we don't have access to the timestamp + // that is actually set by the proposer. + let slot_after_building = slot_now(slot_duration); + if slot_after_building != Some(slot_num) { + info!("Discarding proposal for slot {}; block production took too long", + slot_num); + return + } + + let (header, body) = b.deconstruct(); + let pre_hash = header.hash(); + let parent_hash = header.parent_hash().clone(); + + // sign the pre-sealed hash of the block and then + // add it to a digest item. + let to_sign = (slot_num, pre_hash).encode(); + let signature = pair.sign(&to_sign[..]); + let item = as CompatibleDigestItem>::aura_seal( + slot_num, + signature, + ); + + let import_block = ImportBlock { + origin: BlockOrigin::Own, + header, + justification: None, + post_digests: vec![item], + body: Some(body), + finalized: false, + auxiliary: Vec::new(), + fork_choice: ForkChoiceStrategy::LongestChain, + }; + + if let Err(e) = block_import.import_block(import_block, None) { + warn!(target: "aura", "Error with block built on {:?}: {:?}", + parent_hash, e); + } + }) + .map_err(|e| warn!("Failed to construct block: {:?}", e)) + ) + }) }; - future::loop_fn((), move |()| { + let work = future::loop_fn((), move |()| { let authorship_task = ::std::panic::AssertUnwindSafe(make_authorship()); authorship_task.catch_unwind().then(|res| { match res { @@ -369,7 +354,9 @@ pub fn start_aura( Ok(future::Loop::Continue(())) }) - }) + }); + + work.select(on_exit).then(|_| Ok(())) } // a header which has been checked @@ -386,7 +373,7 @@ enum CheckedHeader { /// if it's successful, returns the pre-header, the slot number, and the signat. // // FIXME: needs misbehavior types - https://github.com/paritytech/substrate/issues/1018 -fn check_header(slot_now: u64, mut header: B::Header, hash: B::Hash, authorities: &[AuthorityId]) +fn check_header(slot_now: u64, mut header: B::Header, hash: B::Hash, authorities: &[Ed25519AuthorityId]) -> Result, String> where DigestItemFor: CompatibleDigestItem { @@ -459,7 +446,7 @@ impl ExtraVerification for NothingExtra { impl Verifier for AuraVerifier where C: Authorities + BlockImport + ProvideRuntimeApi + Send + Sync, C::Api: BlockBuilderApi, - DigestItemFor: CompatibleDigestItem, + DigestItemFor: CompatibleDigestItem + DigestItem, E: ExtraVerification, MakeInherent: Fn(u64, u64) -> Inherent + Send + Sync, { @@ -469,7 +456,7 @@ impl Verifier for AuraVerifier, mut body: Option>, - ) -> Result<(ImportBlock, Option>), String> { + ) -> Result<(ImportBlock, Option>), String> { use runtime_primitives::CheckInherentError; const MAX_TIMESTAMP_DRIFT_SECS: u64 = 60; @@ -538,6 +525,7 @@ impl Verifier for AuraVerifier( make_inherent: MakeInherent, ) -> AuraImportQueue where B: Block, - C: Authorities + BlockImport + ProvideRuntimeApi + Send + Sync, + C: Authorities + BlockImport + ProvideRuntimeApi + Send + Sync, C::Api: BlockBuilderApi, - DigestItemFor: CompatibleDigestItem, + DigestItemFor: CompatibleDigestItem + DigestItem, E: ExtraVerification, MakeInherent: Fn(u64, u64) -> Inherent + Send + Sync, { @@ -645,7 +633,7 @@ mod tests { type Proposer = DummyProposer; type Error = Error; - fn init(&self, parent_header: &::Header, _authorities: &[AuthorityId], _sign_with: Arc) + fn init(&self, parent_header: &::Header, _authorities: &[Ed25519AuthorityId]) -> Result { Ok(DummyProposer(parent_header.number + 1, self.0.clone())) @@ -760,6 +748,7 @@ mod tests { client, environ.clone(), DummyOracle, + futures::empty(), ); runtime.spawn(aura); diff --git a/core/consensus/aura/src/slots.rs b/core/consensus/aura/src/slots.rs new file mode 100644 index 0000000000000..37db3b17636b4 --- /dev/null +++ b/core/consensus/aura/src/slots.rs @@ -0,0 +1,122 @@ +// Copyright 2018 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate 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. + +// Substrate 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 Substrate. If not, see . + +//! Utility stream for yielding slots in a loop. +//! +//! This is used instead of `tokio_timer::Interval` because it was unreliable. + +use std::time::{Instant, Duration}; +use tokio::timer::Delay; +use futures::prelude::*; + +/// Returns the duration until the next slot, based on current duration since +pub(crate) fn time_until_next(now: Duration, slot_duration: u64) -> Duration { + let remaining_full_secs = slot_duration - (now.as_secs() % slot_duration) - 1; + let remaining_nanos = 1_000_000_000 - now.subsec_nanos(); + Duration::new(remaining_full_secs, remaining_nanos) +} + +/// Information about a slot. +#[derive(Debug, Clone)] +pub(crate) struct SlotInfo { + /// The slot number. + pub(crate) number: u64, + /// Current timestamp. + pub(crate) timestamp: u64, + /// The instant at which the slot ends. + pub(crate) ends_at: Instant, +} + +impl SlotInfo { + /// Yields the remaining duration in the slot. + pub(crate) fn remaining_duration(&self) -> Duration { + let now = Instant::now(); + if now < self.ends_at { + self.ends_at.duration_since(now) + } else { + Duration::from_secs(0) + } + } +} + +/// A stream that returns every time there is a new slot. +pub(crate) struct Slots { + last_slot: u64, + slot_duration: u64, + inner_delay: Option, +} + +impl Slots { + /// Create a new `slots` stream. + pub(crate) fn new(slot_duration: u64) -> Self { + Slots { + last_slot: 0, + slot_duration, + inner_delay: None, + } + } +} + +impl Stream for Slots { + type Item = SlotInfo; + type Error = tokio::timer::Error; + + fn poll(&mut self) -> Poll, Self::Error> { + let slot_duration = self.slot_duration; + self.inner_delay = match self.inner_delay.take() { + None => { + // schedule wait. + let wait_until = match ::duration_now() { + None => return Ok(Async::Ready(None)), + Some(now) => Instant::now() + time_until_next(now, slot_duration), + }; + + Some(Delay::new(wait_until)) + } + Some(d) => Some(d), + }; + + if let Some(ref mut inner_delay) = self.inner_delay { + try_ready!(inner_delay.poll()); + } + + // timeout has fired. + + let (timestamp, slot_num) = match ::timestamp_and_slot_now(slot_duration) { + None => return Ok(Async::Ready(None)), + Some(x) => x, + }; + + // reschedule delay for next slot. + let ends_at = Instant::now() + + time_until_next(Duration::from_secs(timestamp), slot_duration); + self.inner_delay = Some(Delay::new(ends_at)); + + // never yield the same slot twice. + if slot_num > self.last_slot { + self.last_slot = slot_num; + + Ok(Async::Ready(Some(SlotInfo { + number: slot_num, + timestamp, + ends_at, + }))) + } else { + // re-poll until we get a new slot. + self.poll() + } + } +} diff --git a/core/consensus/common/Cargo.toml b/core/consensus/common/Cargo.toml index 08689721a03fc..e204e7c36d33a 100644 --- a/core/consensus/common/Cargo.toml +++ b/core/consensus/common/Cargo.toml @@ -5,6 +5,8 @@ authors = ["Parity Technologies "] description = "Common utilities for substrate consensus" [dependencies] +log = "0.4" +parking_lot = "0.7.1" substrate-primitives = { path= "../../primitives" } error-chain = "0.12" futures = "0.1" @@ -13,3 +15,6 @@ sr-primitives = { path = "../../sr-primitives" } tokio = "0.1.7" parity-codec = "2.1" parity-codec-derive = "2.0" + +[dev-dependencies] +substrate-test-client = { path = "../../test-client" } diff --git a/core/consensus/common/src/block_import.rs b/core/consensus/common/src/block_import.rs index 1f7f814a8ea43..f4a60d435db8f 100644 --- a/core/consensus/common/src/block_import.rs +++ b/core/consensus/common/src/block_import.rs @@ -16,8 +16,7 @@ //! Block import helpers. -use primitives::AuthorityId; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, DigestItemFor}; +use runtime_primitives::traits::{AuthorityIdFor, Block as BlockT, Header as HeaderT, DigestItemFor}; use runtime_primitives::Justification; use std::borrow::Cow; @@ -53,6 +52,15 @@ pub enum BlockOrigin { File, } +/// Fork choice strategy. +#[derive(Debug, PartialEq, Eq, Clone, Copy)] +pub enum ForkChoiceStrategy { + /// Longest chain fork choice. + LongestChain, + /// Custom fork choice rule, where true indicates the new block should be the best block. + Custom(bool), +} + /// Data required to import a Block pub struct ImportBlock { /// Origin of the Block @@ -83,6 +91,8 @@ pub struct ImportBlock { /// Contains a list of key-value pairs. If values are `None`, the keys /// will be deleted. pub auxiliary: Vec<(Vec, Option>)>, + /// Fork choice strategy of this import. + pub fork_choice: ForkChoiceStrategy, } impl ImportBlock { @@ -135,6 +145,6 @@ pub trait BlockImport { /// Import a Block alongside the new authorities valid form this block forward fn import_block(&self, block: ImportBlock, - new_authorities: Option> + new_authorities: Option>> ) -> Result; } diff --git a/core/consensus/common/src/error.rs b/core/consensus/common/src/error.rs index ccf57adb9f1be..ec378d24cbd48 100644 --- a/core/consensus/common/src/error.rs +++ b/core/consensus/common/src/error.rs @@ -44,13 +44,13 @@ error_chain! { } /// Error checking signature - InvalidSignature(s: ::primitives::ed25519::Signature, a: ::primitives::AuthorityId) { + InvalidSignature(s: ::primitives::ed25519::Signature, a: ::primitives::Ed25519AuthorityId) { description("Message signature is invalid"), display("Message signature {:?} by {:?} is invalid.", s, a), } /// Account is not an authority. - InvalidAuthority(a: ::primitives::AuthorityId) { + InvalidAuthority(a: ::primitives::Ed25519AuthorityId) { description("Message sender is not a valid authority"), display("Message sender {:?} is not a valid authority.", a), } @@ -84,5 +84,11 @@ error_chain! { description("Other error") display("Other error: {}", e.description()) } + + /// Error from the client while importing + ClientImport(reason: String) { + description("Import failed"), + display("Import failed: {}", reason), + } } } diff --git a/core/network/src/import_queue.rs b/core/consensus/common/src/import_queue.rs similarity index 50% rename from core/network/src/import_queue.rs rename to core/consensus/common/src/import_queue.rs index 58919ea75a789..5264b29cef792 100644 --- a/core/network/src/import_queue.rs +++ b/core/consensus/common/src/import_queue.rs @@ -24,30 +24,37 @@ //! The `BasicQueue` and `BasicVerifier` traits allow serial queues to be //! instantiated simply. +use block_import::{ImportBlock, BlockImport, ImportResult, BlockOrigin}; use std::collections::{HashSet, VecDeque}; -use std::sync::{Arc, Weak}; +use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use parking_lot::{Condvar, Mutex, RwLock}; -use network_libp2p::{NodeIndex, Severity}; -use primitives::AuthorityId; use runtime_primitives::Justification; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero}; +use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero, AuthorityIdFor}; -pub use blocks::BlockData; -use client::error::Error as ClientError; -use error::{ErrorKind, Error}; -use protocol::Context; -use service::ExecuteInContext; -use sync::ChainSync; - -pub use consensus::{ImportBlock, BlockImport, ImportResult, BlockOrigin}; +use error::Error as ConsensusError; /// Shared block import struct used by the queue. -pub type SharedBlockImport = Arc + Send + Sync>; - -#[cfg(any(test, feature = "test-helpers"))] -use std::cell::RefCell; +pub type SharedBlockImport = Arc + Send + Sync>; + +/// Maps to the Origin used by the network. +pub type Origin = usize; + +/// Block data used by the queue. +#[derive(Debug, PartialEq, Eq, Clone)] +pub struct IncomingBlock { + /// Block header hash. + pub hash: ::Hash, + /// Block header if requested. + pub header: Option<::Header>, + /// Block body if requested. + pub body: Option::Extrinsic>>, + /// Justification if requested. + pub justification: Option, + /// The peer, we received this from + pub origin: Option, +} /// Verify a justification of a block pub trait Verifier: Send + Sync + Sized { @@ -60,7 +67,7 @@ pub trait Verifier: Send + Sync + Sized { header: B::Header, justification: Option, body: Option> - ) -> Result<(ImportBlock, Option>), String>; + ) -> Result<(ImportBlock, Option>>), String>; } /// Blocks import queue API. @@ -69,7 +76,7 @@ pub trait ImportQueue: Send + Sync { /// /// This is called automatically by the network service when synchronization /// begins. - fn start(&self, _link: L) -> Result<(), Error> where + fn start(&self, _link: L) -> Result<(), std::io::Error> where Self: Sized, L: 'static + Link, { @@ -84,7 +91,7 @@ pub trait ImportQueue: Send + Sync { /// Is block with given hash currently in the queue. fn is_importing(&self, hash: &B::Hash) -> bool; /// Import bunch of blocks. - fn import_blocks(&self, origin: BlockOrigin, blocks: Vec>); + fn import_blocks(&self, origin: BlockOrigin, blocks: Vec>); } /// Import queue status. It isn't completely accurate. @@ -105,9 +112,9 @@ pub struct BasicQueue> { } /// Locks order: queue, queue_blocks, best_importing_number -struct AsyncImportQueueData { +pub struct AsyncImportQueueData { signal: Condvar, - queue: Mutex>)>>, + queue: Mutex>)>>, queue_blocks: RwLock>, best_importing_number: RwLock<<::Header as HeaderT>::Number>, is_stopping: AtomicBool, @@ -126,7 +133,8 @@ impl> BasicQueue { } impl AsyncImportQueueData { - fn new() -> Self { + /// Instantiate a new async import queue data. + pub fn new() -> Self { Self { signal: Default::default(), queue: Mutex::new(VecDeque::new()), @@ -135,13 +143,18 @@ impl AsyncImportQueueData { is_stopping: Default::default(), } } + + // Signals to stop importing new blocks. + pub fn stop(&self) { + self.is_stopping.store(true, Ordering::SeqCst); + } } impl> ImportQueue for BasicQueue { fn start>( &self, link: L, - ) -> Result<(), Error> { + ) -> Result<(), std::io::Error> { debug_assert!(self.handle.lock().is_none()); let qdata = self.data.clone(); @@ -149,7 +162,7 @@ impl> ImportQueue for BasicQueue { let block_import = self.block_import.clone(); *self.handle.lock() = Some(::std::thread::Builder::new().name("ImportQueue".into()).spawn(move || { import_thread(block_import, link, qdata, verifier) - }).map_err(|err| Error::from(ErrorKind::Io(err)))?); + })?); Ok(()) } @@ -168,7 +181,7 @@ impl> ImportQueue for BasicQueue { { // Perform storing the stop flag and signalling under a single lock. let _queue_lock = self.data.queue.lock(); - self.data.is_stopping.store(true, Ordering::SeqCst); + self.data.stop(); self.data.signal.notify_one(); } @@ -187,7 +200,7 @@ impl> ImportQueue for BasicQueue { self.data.queue_blocks.read().contains(hash) } - fn import_blocks(&self, origin: BlockOrigin, blocks: Vec>) { + fn import_blocks(&self, origin: BlockOrigin, blocks: Vec>) { if blocks.is_empty() { return; } @@ -197,8 +210,8 @@ impl> ImportQueue for BasicQueue { let mut queue = self.data.queue.lock(); let mut queue_blocks = self.data.queue_blocks.write(); let mut best_importing_number = self.data.best_importing_number.write(); - let new_best_importing_number = blocks.last().and_then(|b| b.block.header.as_ref().map(|h| h.number().clone())).unwrap_or_else(|| Zero::zero()); - queue_blocks.extend(blocks.iter().map(|b| b.block.hash.clone())); + let new_best_importing_number = blocks.last().and_then(|b| b.header.as_ref().map(|h| h.number().clone())).unwrap_or_else(|| Zero::zero()); + queue_blocks.extend(blocks.iter().map(|b| b.hash.clone())); if new_best_importing_number > *best_importing_number { *best_importing_number = new_best_importing_number; } @@ -241,7 +254,7 @@ fn import_thread, V: Verifier>( } }; - let blocks_hashes: Vec = new_blocks.1.iter().map(|b| b.block.hash.clone()).collect(); + let blocks_hashes: Vec = new_blocks.1.iter().map(|b| b.hash.clone()).collect(); if !import_many_blocks( &*block_import, &link, @@ -269,68 +282,16 @@ pub trait Link: Send { /// Maintain sync. fn maintain_sync(&self) { } /// Disconnect from peer. - fn useless_peer(&self, _who: NodeIndex, _reason: &str) { } + fn useless_peer(&self, _who: Origin, _reason: &str) { } /// Disconnect from peer and restart sync. - fn note_useless_and_restart_sync(&self, _who: NodeIndex, _reason: &str) { } + fn note_useless_and_restart_sync(&self, _who: Origin, _reason: &str) { } /// Restart sync. fn restart(&self) { } } -/// A link implementation that does nothing. -pub struct NoopLink; - -impl Link for NoopLink { } - -/// A link implementation that connects to the network. -pub struct NetworkLink> { - /// The chain-sync handle - pub(crate) sync: Weak>>, - /// Network context. - pub(crate) context: Weak, -} - -impl> NetworkLink { - /// Execute closure with locked ChainSync. - fn with_sync, &mut Context)>(&self, closure: F) { - if let (Some(sync), Some(service)) = (self.sync.upgrade(), self.context.upgrade()) { - service.execute_in_context(move |protocol| { - let mut sync = sync.write(); - closure(&mut *sync, protocol) - }); - } - } -} - -impl> Link for NetworkLink { - fn block_imported(&self, hash: &B::Hash, number: NumberFor) { - self.with_sync(|sync, _| sync.block_imported(&hash, number)) - } - - fn maintain_sync(&self) { - self.with_sync(|sync, protocol| sync.maintain_sync(protocol)) - } - - fn useless_peer(&self, who: NodeIndex, reason: &str) { - trace!(target:"sync", "Useless peer {}, {}", who, reason); - self.with_sync(|_, protocol| protocol.report_peer(who, Severity::Useless(reason))) - } - - fn note_useless_and_restart_sync(&self, who: NodeIndex, reason: &str) { - trace!(target:"sync", "Bad peer {}, {}", who, reason); - self.with_sync(|sync, protocol| { - protocol.report_peer(who, Severity::Useless(reason)); // is this actually malign or just useless? - sync.restart(protocol); - }) - } - - fn restart(&self) { - self.with_sync(|sync, protocol| sync.restart(protocol)) - } -} - /// Block import successful result. #[derive(Debug, PartialEq)] -enum BlockImportResult { +pub enum BlockImportResult { /// Imported known block. ImportedKnown(H, N), /// Imported unknown block. @@ -339,13 +300,13 @@ enum BlockImportResult), + IncompleteHeader(Option), /// Block verification failed, can't be imported - VerificationFailed(Option, String), + VerificationFailed(Option, String), /// Block is known to be Bad - BadBlock(Option), + BadBlock(Option), /// Block has an unknown parent UnknownParent, /// Other Error. @@ -353,11 +314,11 @@ enum BlockImportError { } /// Import a bunch of blocks. -fn import_many_blocks<'a, B: BlockT, V: Verifier>( - import_handle: &BlockImport, +pub fn import_many_blocks<'a, B: BlockT, V: Verifier>( + import_handle: &BlockImport, link: &Link, qdata: Option<&AsyncImportQueueData>, - blocks: (BlockOrigin, Vec>), + blocks: (BlockOrigin, Vec>), verifier: Arc ) -> bool { @@ -366,8 +327,8 @@ fn import_many_blocks<'a, B: BlockT, V: Verifier>( let mut imported = 0; let blocks_range = match ( - blocks.first().and_then(|b| b.block.header.as_ref().map(|h| h.number())), - blocks.last().and_then(|b| b.block.header.as_ref().map(|h| h.number())), + blocks.first().and_then(|b| b.header.as_ref().map(|h| h.number())), + blocks.last().and_then(|b| b.header.as_ref().map(|h| h.number())), ) { (Some(first), Some(last)) if first != last => format!(" ({}..{})", first, last), (Some(first), Some(_)) => format!(" ({})", first), @@ -401,15 +362,14 @@ fn import_many_blocks<'a, B: BlockT, V: Verifier>( } /// Single block import function. -fn import_single_block>( - import_handle: &BlockImport, +pub fn import_single_block>( + import_handle: &BlockImport, block_origin: BlockOrigin, - block: BlockData, + block: IncomingBlock, verifier: Arc ) -> Result::Header as HeaderT>::Number>, BlockImportError> { let peer = block.origin; - let block = block.block; let (header, justification) = match (block.header, block.justification) { (Some(header), justification) => (header, justification), @@ -465,7 +425,7 @@ fn import_single_block>( } /// Process single block import result. -fn process_import_result( +pub fn process_import_result( link: &Link, result: Result::Header as HeaderT>::Number>, BlockImportError> ) -> usize @@ -503,291 +463,3 @@ fn process_import_result( }, } } - - -#[cfg(any(test, feature = "test-helpers"))] -struct ImportCB(RefCell>) -> bool>>>); - -#[cfg(any(test, feature = "test-helpers"))] -impl ImportCB { - fn new() -> Self { - ImportCB(RefCell::new(None)) - } - fn set(&self, cb: Box) - where F: 'static + Fn(BlockOrigin, Vec>) -> bool - { - *self.0.borrow_mut() = Some(cb); - } - fn call(&self, origin: BlockOrigin, data: Vec>) -> bool { - let b = self.0.borrow(); - b.as_ref().expect("The Callback has been set before. qed.")(origin, data) - } -} - -#[cfg(any(test, feature = "test-helpers"))] -unsafe impl Send for ImportCB {} -#[cfg(any(test, feature = "test-helpers"))] -unsafe impl Sync for ImportCB {} - - -#[cfg(any(test, feature = "test-helpers"))] -/// A Verifier that accepts all blocks and passes them on with the configured -/// finality to be imported. -pub struct PassThroughVerifier(pub bool); - -#[cfg(any(test, feature = "test-helpers"))] -/// This Verifiyer accepts all data as valid -impl Verifier for PassThroughVerifier { - fn verify( - &self, - origin: BlockOrigin, - header: B::Header, - justification: Option, - body: Option> - ) -> Result<(ImportBlock, Option>), String> { - Ok((ImportBlock { - origin, - header, - body, - finalized: self.0, - justification, - post_digests: vec![], - auxiliary: Vec::new(), - }, None)) - } -} - -/// Blocks import queue that is importing blocks in the same thread. -/// The boolean value indicates whether blocks should be imported without instant finality. -#[cfg(any(test, feature = "test-helpers"))] -pub struct SyncImportQueue> { - verifier: Arc, - link: ImportCB, - block_import: SharedBlockImport, -} - -#[cfg(any(test, feature = "test-helpers"))] -impl> SyncImportQueue { - /// Create a new SyncImportQueue wrapping the given Verifier and block import - /// handle. - pub fn new(verifier: Arc, block_import: SharedBlockImport) -> Self { - let queue = SyncImportQueue { - verifier, - link: ImportCB::new(), - block_import, - }; - - let v = queue.verifier.clone(); - let import_handle = queue.block_import.clone(); - queue.link.set(Box::new(move |origin, new_blocks| { - let verifier = v.clone(); - import_many_blocks( - &*import_handle, - &NoopLink, - None, - (origin, new_blocks), - verifier, - ) - })); - - queue - } -} - -#[cfg(any(test, feature = "test-helpers"))] -impl> ImportQueue for SyncImportQueue -{ - fn start>( - &self, - link: L, - ) -> Result<(), Error> { - let v = self.verifier.clone(); - let import_handle = self.block_import.clone(); - self.link.set(Box::new(move |origin, new_blocks| { - let verifier = v.clone(); - import_many_blocks( - &*import_handle, - &link, - None, - (origin, new_blocks), - verifier, - ) - })); - Ok(()) - } - fn clear(&self) { } - - fn stop(&self) { } - - fn status(&self) -> ImportQueueStatus { - ImportQueueStatus { - importing_count: 0, - best_importing_number: Zero::zero(), - } - } - - fn is_importing(&self, _hash: &B::Hash) -> bool { - false - } - - fn import_blocks(&self, origin: BlockOrigin, blocks: Vec>) { - self.link.call(origin, blocks); - } -} - -#[cfg(test)] -pub mod tests { - use client; - use message; - use test_client::{self, TestClient}; - use test_client::runtime::{Block, Hash}; - use runtime_primitives::generic::BlockId; - use std::cell::Cell; - use super::*; - - struct TestLink { - imported: Cell, - maintains: Cell, - disconnects: Cell, - restarts: Cell, - } - - impl TestLink { - fn new() -> TestLink { - TestLink { - imported: Cell::new(0), - maintains: Cell::new(0), - disconnects: Cell::new(0), - restarts: Cell::new(0), - } - } - - fn total(&self) -> usize { - self.imported.get() + self.maintains.get() + self.disconnects.get() + self.restarts.get() - } - } - - impl Link for TestLink { - fn block_imported(&self, _hash: &Hash, _number: NumberFor) { - self.imported.set(self.imported.get() + 1); - } - fn maintain_sync(&self) { - self.maintains.set(self.maintains.get() + 1); - } - fn useless_peer(&self, _: NodeIndex, _: &str) { - self.disconnects.set(self.disconnects.get() + 1); - } - fn note_useless_and_restart_sync(&self, id: NodeIndex, r: &str) { - self.useless_peer(id, r); - self.restart(); - } - fn restart(&self) { - self.restarts.set(self.restarts.get() + 1); - } - } - - fn prepare_good_block() -> (client::Client, Hash, u64, BlockData) { - let client = test_client::new(); - let block = client.new_block().unwrap().bake().unwrap(); - client.import(BlockOrigin::File, block).unwrap(); - - let (hash, number) = (client.block_hash(1).unwrap().unwrap(), 1); - let block = message::BlockData:: { - hash: client.block_hash(1).unwrap().unwrap(), - header: client.header(&BlockId::Number(1)).unwrap(), - body: None, - receipt: None, - message_queue: None, - justification: client.justification(&BlockId::Number(1)).unwrap(), - }; - - (client, hash, number, BlockData { block, origin: Some(0) }) - } - - #[test] - fn import_single_good_block_works() { - let (_, hash, number, block) = prepare_good_block(); - assert_eq!( - import_single_block(&test_client::new(), BlockOrigin::File, block, Arc::new(PassThroughVerifier(true))), - Ok(BlockImportResult::ImportedUnknown(hash, number)) - ); - } - - #[test] - fn import_single_good_known_block_is_ignored() { - let (client, hash, number, block) = prepare_good_block(); - assert_eq!( - import_single_block(&client, BlockOrigin::File, block, Arc::new(PassThroughVerifier(true))), - Ok(BlockImportResult::ImportedKnown(hash, number)) - ); - } - - #[test] - fn import_single_good_block_without_header_fails() { - let (_, _, _, mut block) = prepare_good_block(); - block.block.header = None; - assert_eq!( - import_single_block(&test_client::new(), BlockOrigin::File, block, Arc::new(PassThroughVerifier(true))), - Err(BlockImportError::IncompleteHeader(Some(0))) - ); - } - - #[test] - fn process_import_result_works() { - let link = TestLink::new(); - assert_eq!(process_import_result::(&link, Ok(BlockImportResult::ImportedKnown(Default::default(), 0))), 1); - assert_eq!(link.total(), 1); - - let link = TestLink::new(); - assert_eq!(process_import_result::(&link, Ok(BlockImportResult::ImportedKnown(Default::default(), 0))), 1); - assert_eq!(link.total(), 1); - assert_eq!(link.imported.get(), 1); - - let link = TestLink::new(); - assert_eq!(process_import_result::(&link, Ok(BlockImportResult::ImportedUnknown(Default::default(), 0))), 1); - assert_eq!(link.total(), 1); - assert_eq!(link.imported.get(), 1); - - let link = TestLink::new(); - assert_eq!(process_import_result::(&link, Err(BlockImportError::IncompleteHeader(Some(0)))), 0); - assert_eq!(link.total(), 1); - assert_eq!(link.disconnects.get(), 1); - - let link = TestLink::new(); - assert_eq!(process_import_result::(&link, Err(BlockImportError::UnknownParent)), 0); - assert_eq!(link.total(), 1); - assert_eq!(link.restarts.get(), 1); - - let link = TestLink::new(); - assert_eq!(process_import_result::(&link, Err(BlockImportError::Error)), 0); - assert_eq!(link.total(), 1); - assert_eq!(link.restarts.get(), 1); - } - - #[test] - fn import_many_blocks_stops_when_stopping() { - let (_, _, _, block) = prepare_good_block(); - let qdata = AsyncImportQueueData::new(); - let verifier = Arc::new(PassThroughVerifier(true)); - qdata.is_stopping.store(true, Ordering::SeqCst); - let client = test_client::new(); - assert!(!import_many_blocks( - &client, - &mut TestLink::new(), - Some(&qdata), - (BlockOrigin::File, vec![block.clone(), block]), - verifier - )); - } - - #[test] - fn async_import_queue_drops() { - // Perform this test multiple times since it exhibits non-deterministic behavior. - for _ in 0..100 { - let verifier = Arc::new(PassThroughVerifier(true)); - let queue = BasicQueue::new(verifier, Arc::new(test_client::new())); - queue.start(TestLink::new()).unwrap(); - drop(queue); - } - } -} diff --git a/core/consensus/common/src/lib.rs b/core/consensus/common/src/lib.rs index 76c370effddb0..23bde0c0568be 100644 --- a/core/consensus/common/src/lib.rs +++ b/core/consensus/common/src/lib.rs @@ -24,8 +24,11 @@ extern crate substrate_primitives as primitives; extern crate futures; +extern crate parking_lot; extern crate sr_version as runtime_version; extern crate sr_primitives as runtime_primitives; +#[cfg(any(test, feature = "test-helpers"))] +extern crate substrate_test_client as test_client; extern crate tokio; extern crate parity_codec as codec; @@ -33,29 +36,30 @@ extern crate parity_codec_derive; #[macro_use] extern crate error_chain; +#[macro_use] extern crate log; use std::sync::Arc; -use primitives::{ed25519, AuthorityId}; use runtime_primitives::generic::BlockId; -use runtime_primitives::traits::Block; +use runtime_primitives::traits::{AuthorityIdFor, Block}; use futures::prelude::*; pub mod offline_tracker; pub mod error; mod block_import; +pub mod import_queue; pub mod evaluation; // block size limit. const MAX_TRANSACTIONS_SIZE: usize = 4 * 1024 * 1024; pub use self::error::{Error, ErrorKind}; -pub use block_import::{BlockImport, ImportBlock, BlockOrigin, ImportResult}; +pub use block_import::{BlockImport, ImportBlock, BlockOrigin, ImportResult, ForkChoiceStrategy}; /// Trait for getting the authorities at a given block. pub trait Authorities { type Error: ::std::error::Error + Send + 'static; /// Get the authorities at the given block. - fn authorities(&self, at: &BlockId) -> Result, Self::Error>; + fn authorities(&self, at: &BlockId) -> Result>, Self::Error>; } /// Environment producer for a Consensus instance. Creates proposer instance and communication streams. @@ -66,9 +70,8 @@ pub trait Environment { type Error: From; /// Initialize the proposal logic on top of a specific header. Provide - /// the authorities at that header, and a local key to sign any additional - /// consensus messages with as well. - fn init(&self, parent_header: &B::Header, authorities: &[AuthorityId], sign_with: Arc) + /// the authorities at that header. + fn init(&self, parent_header: &B::Header, authorities: &[AuthorityIdFor]) -> Result; } diff --git a/core/consensus/common/src/offline_tracker.rs b/core/consensus/common/src/offline_tracker.rs index bd8eab8b1bb51..1ed923da2c590 100644 --- a/core/consensus/common/src/offline_tracker.rs +++ b/core/consensus/common/src/offline_tracker.rs @@ -16,8 +16,6 @@ //! Tracks offline validators. -use primitives::AuthorityId; - use std::collections::HashMap; use std::time::{Instant, Duration}; @@ -55,11 +53,11 @@ impl Observed { } /// Tracks offline validators and can issue a report for those offline. -pub struct OfflineTracker { +pub struct OfflineTracker { observed: HashMap, } -impl OfflineTracker { +impl OfflineTracker { /// Create a new tracker. pub fn new() -> Self { OfflineTracker { observed: HashMap::new() } @@ -114,10 +112,11 @@ impl OfflineTracker { #[cfg(test)] mod tests { use super::*; + use primitives::Ed25519AuthorityId; #[test] fn validator_offline() { - let mut tracker = OfflineTracker::new(); + let mut tracker = OfflineTracker::::new(); let v = [0; 32].into(); let v2 = [1; 32].into(); let v3 = [2; 32].into(); diff --git a/core/consensus/rhd/Cargo.toml b/core/consensus/rhd/Cargo.toml index dce6a6d7f445a..3aae924115181 100644 --- a/core/consensus/rhd/Cargo.toml +++ b/core/consensus/rhd/Cargo.toml @@ -19,7 +19,7 @@ sr-primitives = { path = "../../sr-primitives" } sr-version = { path = "../../sr-version" } sr-io = { path = "../../sr-io" } tokio = "0.1.7" -parking_lot = "0.4" +parking_lot = "0.7.1" error-chain = "0.12" log = "0.4" rhododendron = { version = "0.4.0", features = ["codec"] } diff --git a/core/executor/Cargo.toml b/core/executor/Cargo.toml index dcea860163e71..594a34f964153 100644 --- a/core/executor/Cargo.toml +++ b/core/executor/Cargo.toml @@ -17,7 +17,7 @@ serde_derive = "1.0" wasmi = { version = "0.4.2" } byteorder = "1.1" lazy_static = "1.0" -parking_lot = "*" +parking_lot = "0.7.1" log = "0.4" [dev-dependencies] diff --git a/core/executor/src/lib.rs b/core/executor/src/lib.rs index 5f05b33f53852..ae2b383ae7ecd 100644 --- a/core/executor/src/lib.rs +++ b/core/executor/src/lib.rs @@ -44,9 +44,6 @@ extern crate parking_lot; #[macro_use] extern crate log; -#[macro_use] -extern crate lazy_static; - #[macro_use] extern crate error_chain; @@ -84,7 +81,5 @@ pub trait RuntimeInfo { fn runtime_version> ( &self, ext: &mut E, - heap_pages: usize, - code: &[u8] ) -> Option; } diff --git a/core/executor/src/native_executor.rs b/core/executor/src/native_executor.rs index 15cc8abac3edc..09606bc904f7b 100644 --- a/core/executor/src/native_executor.rs +++ b/core/executor/src/native_executor.rs @@ -14,38 +14,34 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . +use std::borrow::BorrowMut; +use std::cell::{RefMut, RefCell}; use error::{Error, ErrorKind, Result}; use state_machine::{CodeExecutor, Externalities}; use wasm_executor::WasmExecutor; -use wasmi::Module as WasmModule; +use wasmi::{Module as WasmModule, ModuleRef as WasmModuleInstanceRef}; use runtime_version::{NativeVersion, RuntimeVersion}; use std::collections::HashMap; use codec::Decode; -use primitives::hashing::blake2_256; -use parking_lot::{Mutex, MutexGuard}; use RuntimeInfo; use primitives::Blake2Hasher; +use primitives::storage::well_known_keys; + +/// Default num of pages for the heap +const DEFAULT_HEAP_PAGES :u64 = 1024; // For the internal Runtime Cache: // Is it compatible enough to run this natively or do we need to fall back on the WasmModule enum RuntimePreproc { InvalidCode, - ValidCode(WasmModule, Option), + ValidCode(WasmModuleInstanceRef, Option), } type CacheType = HashMap<[u8; 32], RuntimePreproc>; -lazy_static! { - static ref RUNTIMES_CACHE: Mutex = Mutex::new(HashMap::new()); -} - -// helper function to generate low-over-head caching_keys -// it is asserted that part of the audit process that any potential on-chain code change -// will have done is to ensure that the two-x hash is different to that of any other -// :code value from the same chain -fn gen_cache_key(code: &[u8]) -> [u8; 32] { - blake2_256(code) +thread_local! { + static RUNTIMES_CACHE: RefCell = RefCell::new(HashMap::new()); } /// fetch a runtime version from the cache or if there is no cached version yet, create @@ -53,27 +49,48 @@ fn gen_cache_key(code: &[u8]) -> [u8; 32] { /// can be used by comparing returned RuntimeVersion to `ref_version` fn fetch_cached_runtime_version<'a, E: Externalities>( wasm_executor: &WasmExecutor, - cache: &'a mut MutexGuard, + cache: &'a mut RefMut, ext: &mut E, - heap_pages: usize, - code: &[u8] -) -> Result<(&'a WasmModule, &'a Option)> { - let maybe_runtime_preproc = cache.entry(gen_cache_key(code)) - .or_insert_with(|| match WasmModule::from_buffer(code) { - Ok(module) => { - let version = wasm_executor.call_in_wasm_module(ext, heap_pages, &module, "Core_version", &[]) - .ok() - .and_then(|v| RuntimeVersion::decode(&mut v.as_slice())); - RuntimePreproc::ValidCode(module, version) - } - Err(e) => { - trace!(target: "executor", "Invalid code presented to executor ({:?})", e); - RuntimePreproc::InvalidCode +) -> Result<(&'a WasmModuleInstanceRef, &'a Option)> { + + let code_hash = match ext.storage_hash(well_known_keys::CODE) { + Some(code_hash) => code_hash, + None => return Err(ErrorKind::InvalidCode(vec![]).into()), + }; + let maybe_runtime_preproc = cache.borrow_mut().entry(code_hash.into()) + .or_insert_with(|| { + let code = match ext.storage(well_known_keys::CODE) { + Some(code) => code, + None => return RuntimePreproc::InvalidCode, + }; + let heap_pages = match ext.storage(well_known_keys::HEAP_PAGES) { + Some(pages) => u64::decode(&mut &pages[..]).unwrap_or(DEFAULT_HEAP_PAGES), + None => DEFAULT_HEAP_PAGES, + }; + match WasmModule::from_buffer(code) + .map_err(|_| ErrorKind::InvalidCode(vec![]).into()) + .and_then(|module| wasm_executor.prepare_module(ext, heap_pages as usize, &module)) + { + Ok(module) => { + let version = wasm_executor.call_in_wasm_module(ext, &module, "Core_version", &[]) + .ok() + .and_then(|v| RuntimeVersion::decode(&mut v.as_slice())); + RuntimePreproc::ValidCode(module, version) + } + Err(e) => { + trace!(target: "executor", "Invalid code presented to executor ({:?})", e); + RuntimePreproc::InvalidCode + } } }); match maybe_runtime_preproc { - RuntimePreproc::InvalidCode => Err(ErrorKind::InvalidCode(code.into()).into()), - RuntimePreproc::ValidCode(m, v) => Ok((m, v)), + RuntimePreproc::InvalidCode => { + let code = ext.storage(well_known_keys::CODE).unwrap_or(vec![]); + Err(ErrorKind::InvalidCode(code).into()) + }, + RuntimePreproc::ValidCode(m, v) => { + Ok((m, v)) + } } } @@ -154,10 +171,10 @@ impl RuntimeInfo for NativeExecutor { fn runtime_version>( &self, ext: &mut E, - heap_pages: usize, - code: &[u8], ) -> Option { - fetch_cached_runtime_version(&self.fallback, &mut RUNTIMES_CACHE.lock(), ext, heap_pages, code).ok()?.1.clone() + RUNTIMES_CACHE.with(|c| + fetch_cached_runtime_version(&self.fallback, &mut c.borrow_mut(), ext).ok()?.1.clone() + ) } } @@ -167,30 +184,30 @@ impl CodeExecutor for NativeExecutor>( &self, ext: &mut E, - heap_pages: usize, - code: &[u8], method: &str, data: &[u8], use_native: bool, ) -> (Result>, bool) { - let mut c = RUNTIMES_CACHE.lock(); - let (module, onchain_version) = match fetch_cached_runtime_version(&self.fallback, &mut c, ext, heap_pages, code) { - Ok((module, onchain_version)) => (module, onchain_version), - Err(_) => return (Err(ErrorKind::InvalidCode(code.into()).into()), false), - }; - match (use_native, onchain_version.as_ref().map_or(false, |v| v.can_call_with(&self.native_version.runtime_version))) { - (_, false) => { - trace!(target: "executor", "Request for native execution failed (native: {}, chain: {})", self.native_version.runtime_version, onchain_version.as_ref().map_or_else(||"".into(), |v| format!("{}", v))); - (self.fallback.call_in_wasm_module(ext, heap_pages, module, method, data), false) - } - (false, _) => { - (self.fallback.call_in_wasm_module(ext, heap_pages, module, method, data), false) + RUNTIMES_CACHE.with(|c| { + let mut c = c.borrow_mut(); + let (module, onchain_version) = match fetch_cached_runtime_version(&self.fallback, &mut c, ext) { + Ok((module, onchain_version)) => (module, onchain_version), + Err(e) => return (Err(e), false), + }; + match (use_native, onchain_version.as_ref().map_or(false, |v| v.can_call_with(&self.native_version.runtime_version))) { + (_, false) => { + trace!(target: "executor", "Request for native execution failed (native: {}, chain: {})", self.native_version.runtime_version, onchain_version.as_ref().map_or_else(||"".into(), |v| format!("{}", v))); + (self.fallback.call_in_wasm_module(ext, module, method, data), false) + } + (false, _) => { + (self.fallback.call_in_wasm_module(ext, module, method, data), false) + } + _ => { + trace!(target: "executor", "Request for native execution succeeded (native: {}, chain: {})", self.native_version.runtime_version, onchain_version.as_ref().map_or_else(||"".into(), |v| format!("{}", v))); + (D::dispatch(ext, method, data), true) + } } - _ => { - trace!(target: "executor", "Request for native execution succeeded (native: {}, chain: {})", self.native_version.runtime_version, onchain_version.as_ref().map_or_else(||"".into(), |v| format!("{}", v))); - (D::dispatch(ext, method, data), true) - } - } + }) } } diff --git a/core/executor/src/wasm_executor.rs b/core/executor/src/wasm_executor.rs index 7480b6195014a..60e2c84b1eb5a 100644 --- a/core/executor/src/wasm_executor.rs +++ b/core/executor/src/wasm_executor.rs @@ -19,10 +19,10 @@ use std::collections::HashMap; use wasmi::{ - Module, ModuleInstance, MemoryInstance, MemoryRef, TableRef, ImportsBuilder + Module, ModuleInstance, MemoryInstance, MemoryRef, TableRef, ImportsBuilder, ModuleRef, }; use wasmi::RuntimeValue::{I32, I64}; -use wasmi::memory_units::{Pages, Bytes}; +use wasmi::memory_units::Pages; use state_machine::Externalities; use error::{Error, ErrorKind, Result}; use wasm_utils::UserError; @@ -39,19 +39,17 @@ struct Heap { } impl Heap { - /// Construct new `Heap` struct with a given number of pages. + /// Construct new `Heap` struct. /// /// Returns `Err` if the heap couldn't allocate required /// number of pages. /// /// This could mean that wasm binary specifies memory /// limit and we are trying to allocate beyond that limit. - fn new(memory: &MemoryRef, pages: usize) -> Result { - let prev_page_count = memory.initial(); - memory.grow(Pages(pages)).map_err(|_| Error::from(ErrorKind::Runtime))?; - Ok(Heap { - end: Bytes::from(prev_page_count).0 as u32, - }) + fn new(memory: &MemoryRef) -> Self { + Heap { + end: memory.used_size().0 as u32, + } } fn allocate(&mut self, size: u32) -> u32 { @@ -83,10 +81,10 @@ struct FunctionExecutor<'e, E: Externalities + 'e> { } impl<'e, E: Externalities> FunctionExecutor<'e, E> { - fn new(m: MemoryRef, heap_pages: usize, t: Option, e: &'e mut E) -> Result { + fn new(m: MemoryRef, t: Option, e: &'e mut E) -> Result { Ok(FunctionExecutor { sandbox_store: sandbox::Store::new(), - heap: Heap::new(&m, heap_pages)?, + heap: Heap::new(&m), memory: m, table: t, ext: e, @@ -638,51 +636,43 @@ impl WasmExecutor { method: &str, data: &[u8], ) -> Result> { - let module = ::wasmi::Module::from_buffer(code).expect("all modules compiled with rustc are valid wasm code; qed"); - self.call_in_wasm_module(ext, heap_pages, &module, method, data) + let module = ::wasmi::Module::from_buffer(code)?; + let module = self.prepare_module(ext, heap_pages, &module)?; + self.call_in_wasm_module(ext, &module, method, data) + } + + fn get_mem_instance(module: &ModuleRef) -> Result { + Ok(module + .export_by_name("memory") + .ok_or_else(|| Error::from(ErrorKind::InvalidMemoryReference))? + .as_memory() + .ok_or_else(|| Error::from(ErrorKind::InvalidMemoryReference))? + .clone()) } /// Call a given method in the given wasm-module runtime. pub fn call_in_wasm_module>( &self, ext: &mut E, - heap_pages: usize, - module: &Module, + module_instance: &ModuleRef, method: &str, data: &[u8], ) -> Result> { - // start module instantiation. Don't run 'start' function yet. - let intermediate_instance = ModuleInstance::new( - module, - &ImportsBuilder::new() - .with_resolver("env", FunctionExecutor::::resolver()) - )?; - // extract a reference to a linear memory, optional reference to a table // and then initialize FunctionExecutor. - let memory = intermediate_instance - .not_started_instance() - .export_by_name("memory") - // TODO: with code coming from the blockchain it isn't strictly been compiled with rustc anymore. - // these assumptions are probably not true anymore - .expect("all modules compiled with rustc should have an export named 'memory'; qed") - .as_memory() - .expect("in module generated by rustc export named 'memory' should be a memory; qed") - .clone(); - let table: Option = intermediate_instance - .not_started_instance() + let memory = Self::get_mem_instance(module_instance)?; + let table: Option = module_instance .export_by_name("__indirect_function_table") .and_then(|e| e.as_table().cloned()); - let mut fec = FunctionExecutor::new(memory.clone(), heap_pages, table, ext)?; - - // finish instantiation by running 'start' function (if any). - let instance = intermediate_instance.run_start(&mut fec)?; + let low = memory.lowest_used(); + let used_mem = memory.used_size(); + let mut fec = FunctionExecutor::new(memory.clone(), table, ext)?; let size = data.len() as u32; let offset = fec.heap.allocate(size); memory.set(offset, &data)?; - let result = instance.invoke_export( + let result = module_instance.invoke_export( method, &[ I32(offset as i32), @@ -690,22 +680,57 @@ impl WasmExecutor { ], &mut fec ); - let returned = match result { - Ok(x) => x, + let result = match result { + Ok(Some(I64(r))) => { + let offset = r as u32; + let length = (r >> 32) as u32 as usize; + memory.get(offset, length) + .map_err(|_| ErrorKind::Runtime.into()) + }, + Ok(_) => Err(ErrorKind::InvalidReturn.into()), Err(e) => { - trace!(target: "wasm-executor", "Failed to execute code with {} pages", heap_pages); - return Err(e.into()) + trace!(target: "wasm-executor", "Failed to execute code with {} pages", memory.current_size().0); + Err(e.into()) }, }; - if let Some(I64(r)) = returned { - let offset = r as u32; - let length = (r >> 32) as u32 as usize; - memory.get(offset, length) - .map_err(|_| ErrorKind::Runtime.into()) - } else { - Err(ErrorKind::InvalidReturn.into()) + // cleanup module instance for next use + let new_low = memory.lowest_used(); + if new_low < low { + memory.zero(new_low as usize, (low - new_low) as usize)?; + memory.reset_lowest_used(low); } + memory.with_direct_access_mut(|buf| buf.resize(used_mem.0, 0)); + result + } + + /// Prepare module instance + pub fn prepare_module>( + &self, + ext: &mut E, + heap_pages: usize, + module: &Module, + ) -> Result + { + // start module instantiation. Don't run 'start' function yet. + let intermediate_instance = ModuleInstance::new( + module, + &ImportsBuilder::new() + .with_resolver("env", FunctionExecutor::::resolver()) + )?; + + // extract a reference to a linear memory, optional reference to a table + // and then initialize FunctionExecutor. + let memory = Self::get_mem_instance(intermediate_instance.not_started_instance())?; + memory.grow(Pages(heap_pages)).map_err(|_| Error::from(ErrorKind::Runtime))?; + let table: Option = intermediate_instance + .not_started_instance() + .export_by_name("__indirect_function_table") + .and_then(|e| e.as_table().cloned()); + let mut fec = FunctionExecutor::new(memory.clone(), table, ext)?; + + // finish instantiation by running 'start' function (if any). + Ok(intermediate_instance.run_start(&mut fec)?) } } @@ -733,6 +758,9 @@ mod tests { let output = WasmExecutor::new().call(&mut ext, 8, &test_code[..], "test_panic", &[]); assert!(output.is_err()); + let output = WasmExecutor::new().call(&mut ext, 8, &test_code[..], "test_conditional_panic", &[]); + assert_eq!(output.unwrap(), vec![0u8; 0]); + let output = WasmExecutor::new().call(&mut ext, 8, &test_code[..], "test_conditional_panic", &[2]); assert!(output.is_err()); } diff --git a/core/executor/wasm/Cargo.lock b/core/executor/wasm/Cargo.lock index d5f2b2cacb54e..97ac5c5d6f1db 100644 --- a/core/executor/wasm/Cargo.lock +++ b/core/executor/wasm/Cargo.lock @@ -42,6 +42,14 @@ dependencies = [ "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "impl-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.12" @@ -65,6 +73,17 @@ dependencies = [ "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "primitive-types" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro2" version = "0.4.19" @@ -159,16 +178,14 @@ name = "substrate-primitives" version = "0.1.0" dependencies = [ "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", - "uint 0.5.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -183,7 +200,7 @@ dependencies = [ [[package]] name = "uint" -version = "0.5.0-beta.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -204,9 +221,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a557e80084b05c32b455963ff565a9de6f2866da023d6671705c6aff6f65e01c" "checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)" = "" +"checksum impl-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c88568d828291c50eed30cd7fb9f8e688ad0013620186fa3e777b9f206c79f2" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" "checksum parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dca389ea5e1632c89b2ce54f7e2b4a8a8c9d278042222a91e0bf95451218cb4c" "checksum parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffa42c2cb493b60b12c75b26e8c94cb734af4df4d7f2cc229dc04c1953dac189" +"checksum primitive-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f47c18b4601125931d69fcf7b000c2c16a304e4f84d58218d6470b4502e00b58" "checksum proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901" "checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" @@ -216,5 +235,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" -"checksum uint 0.5.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4630460173a57c0af94b8306091e018025d988473f641a4af754b6cde980e1e3" +"checksum uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "082df6964410f6aa929a61ddfafc997e4f32c62c22490e439ac351cec827f436" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" diff --git a/core/finality-grandpa/Cargo.toml b/core/finality-grandpa/Cargo.toml index 017eca9449c36..2bef01f193d3e 100644 --- a/core/finality-grandpa/Cargo.toml +++ b/core/finality-grandpa/Cargo.toml @@ -14,7 +14,7 @@ substrate-client = { path = "../client" } substrate-network = { path = "../network" } substrate-service = { path = "../service", optional = true } log = "0.4" -parking_lot = "0.4" +parking_lot = "0.7.1" tokio = "0.1.7" substrate-finality-grandpa-primitives = { path = "primitives" } rand = "0.6" diff --git a/core/finality-grandpa/primitives/src/lib.rs b/core/finality-grandpa/primitives/src/lib.rs index df224fa9d4ad1..15e4a027f6c24 100644 --- a/core/finality-grandpa/primitives/src/lib.rs +++ b/core/finality-grandpa/primitives/src/lib.rs @@ -34,7 +34,7 @@ extern crate substrate_client as client; extern crate sr_std as rstd; -use substrate_primitives::AuthorityId; +use substrate_primitives::Ed25519AuthorityId; use sr_primitives::traits::{DigestFor, NumberFor}; use rstd::vec::Vec; @@ -43,7 +43,7 @@ use rstd::vec::Vec; #[derive(Clone, Encode, Decode)] pub struct ScheduledChange { /// The new authorities after the change, along with their respective weights. - pub next_authorities: Vec<(AuthorityId, u64)>, + pub next_authorities: Vec<(Ed25519AuthorityId, u64)>, /// The number of blocks to delay. pub delay: N, } @@ -97,6 +97,6 @@ decl_runtime_apis! { /// Get the current GRANDPA authorities and weights. This should not change except /// for when changes are scheduled and the corresponding delay has passed. - fn grandpa_authorities() -> Vec<(AuthorityId, u64)>; + fn grandpa_authorities() -> Vec<(Ed25519AuthorityId, u64)>; } } diff --git a/core/finality-grandpa/src/authorities.rs b/core/finality-grandpa/src/authorities.rs index 64e9f3690634b..ca9bd61a88390 100644 --- a/core/finality-grandpa/src/authorities.rs +++ b/core/finality-grandpa/src/authorities.rs @@ -17,7 +17,7 @@ //! Utilities for dealing with authorities, authority sets, and handoffs. use parking_lot::RwLock; -use substrate_primitives::AuthorityId; +use substrate_primitives::Ed25519AuthorityId; use std::cmp::Ord; use std::collections::HashMap; @@ -38,7 +38,7 @@ impl Clone for SharedAuthoritySet { impl SharedAuthoritySet { /// The genesis authority set. - pub(crate) fn genesis(initial: Vec<(AuthorityId, u64)>) -> Self { + pub(crate) fn genesis(initial: Vec<(Ed25519AuthorityId, u64)>) -> Self { SharedAuthoritySet { inner: Arc::new(RwLock::new(AuthoritySet::genesis(initial))) } @@ -66,7 +66,7 @@ where } /// Get the current authorities and their weights (for the current set ID). - pub(crate) fn current_authorities(&self) -> HashMap { + pub(crate) fn current_authorities(&self) -> HashMap { self.inner.read().current_authorities.iter().cloned().collect() } } @@ -89,14 +89,14 @@ pub(crate) struct Status { /// A set of authorities. #[derive(Debug, Clone, Encode, Decode)] pub(crate) struct AuthoritySet { - current_authorities: Vec<(AuthorityId, u64)>, + current_authorities: Vec<(Ed25519AuthorityId, u64)>, set_id: u64, pending_changes: Vec>, } impl AuthoritySet { /// Get a genesis set with given authorities. - pub(crate) fn genesis(initial: Vec<(AuthorityId, u64)>) -> Self { + pub(crate) fn genesis(initial: Vec<(Ed25519AuthorityId, u64)>) -> Self { AuthoritySet { current_authorities: initial, set_id: 0, @@ -105,7 +105,7 @@ impl AuthoritySet { } /// Get the current set id and a reference to the current authority set. - pub(crate) fn current(&self) -> (u64, &[(AuthorityId, u64)]) { + pub(crate) fn current(&self) -> (u64, &[(Ed25519AuthorityId, u64)]) { (self.set_id, &self.current_authorities[..]) } } @@ -249,7 +249,7 @@ where #[derive(Debug, Clone, Encode, Decode, PartialEq)] pub(crate) struct PendingChange { /// The new authorities and weights to apply. - pub(crate) next_authorities: Vec<(AuthorityId, u64)>, + pub(crate) next_authorities: Vec<(Ed25519AuthorityId, u64)>, /// How deep in the finalized chain the announcing block must be /// before the change is applied. pub(crate) finalization_depth: N, diff --git a/core/finality-grandpa/src/communication.rs b/core/finality-grandpa/src/communication.rs index 02a079b909448..b8435cef6cc84 100644 --- a/core/finality-grandpa/src/communication.rs +++ b/core/finality-grandpa/src/communication.rs @@ -20,7 +20,7 @@ use futures::prelude::*; use futures::sync::mpsc; use codec::{Encode, Decode}; -use substrate_primitives::{ed25519, AuthorityId}; +use substrate_primitives::{ed25519, Ed25519AuthorityId}; use runtime_primitives::traits::Block as BlockT; use {Error, Network, Message, SignedMessage, Commit, CompactCommit}; @@ -34,7 +34,7 @@ fn localized_payload(round: u64, set_id: u64, message: &E) -> Vec // check a message. pub(crate) fn check_message_sig( message: &Message, - id: &AuthorityId, + id: &Ed25519AuthorityId, signature: &ed25519::Signature, round: u64, set_id: u64, @@ -55,7 +55,7 @@ pub(crate) fn checked_message_stream( round: u64, set_id: u64, inner: S, - voters: Arc>, + voters: Arc>, ) -> impl Stream,Error=Error> where S: Stream,Error=()> @@ -92,7 +92,7 @@ pub(crate) fn checked_message_stream( struct OutgoingMessages { round: u64, set_id: u64, - locals: Option<(Arc, AuthorityId)>, + locals: Option<(Arc, Ed25519AuthorityId)>, sender: mpsc::UnboundedSender>, network: N, } @@ -143,7 +143,7 @@ pub(crate) fn outgoing_messages( round: u64, set_id: u64, local_key: Option>, - voters: Arc>, + voters: Arc>, network: N, ) -> ( impl Stream,Error=Error>, @@ -151,7 +151,7 @@ pub(crate) fn outgoing_messages( ) { let locals = local_key.and_then(|pair| { let public = pair.public(); - let id = AuthorityId(public.0); + let id = Ed25519AuthorityId(public.0); if voters.contains_key(&id) { Some((pair, id)) } else { @@ -177,7 +177,7 @@ pub(crate) fn outgoing_messages( fn check_compact_commit( msg: CompactCommit, - voters: &HashMap, + voters: &HashMap, round: u64, set_id: u64, ) -> Option> { @@ -216,7 +216,7 @@ fn check_compact_commit( pub(crate) fn checked_commit_stream( set_id: u64, inner: S, - voters: Arc>, + voters: Arc>, ) -> impl Stream),Error=Error> where S: Stream,Error=()> diff --git a/core/finality-grandpa/src/lib.rs b/core/finality-grandpa/src/lib.rs index dfbea1fe8135a..00ea6734af56d 100644 --- a/core/finality-grandpa/src/lib.rs +++ b/core/finality-grandpa/src/lib.rs @@ -89,13 +89,14 @@ use client::{ }; use client::blockchain::HeaderBackend; use codec::{Encode, Decode}; -use consensus_common::{BlockImport, ImportBlock, ImportResult, Authorities}; +use consensus_common::{BlockImport, Error as ConsensusError, ErrorKind as ConsensusErrorKind, ImportBlock, ImportResult, Authorities}; use runtime_primitives::traits::{ NumberFor, Block as BlockT, Header as HeaderT, DigestFor, ProvideRuntimeApi, Hash as HashT, + DigestItemFor, DigestItem, }; use fg_primitives::GrandpaApi; use runtime_primitives::generic::BlockId; -use substrate_primitives::{ed25519, H256, AuthorityId, Blake2Hasher}; +use substrate_primitives::{ed25519, H256, Ed25519AuthorityId, Blake2Hasher}; use tokio::timer::Delay; use grandpa::Error as GrandpaError; @@ -138,7 +139,7 @@ pub type SignedMessage = grandpa::SignedMessage< ::Hash, NumberFor, ed25519::Signature, - AuthorityId, + Ed25519AuthorityId, >; /// A prevote message for this chain's block type. pub type Prevote = grandpa::Prevote<::Hash, NumberFor>; @@ -149,14 +150,14 @@ pub type Commit = grandpa::Commit< ::Hash, NumberFor, ed25519::Signature, - AuthorityId + Ed25519AuthorityId >; /// A compact commit message for this chain's block type. pub type CompactCommit = grandpa::CompactCommit< ::Hash, NumberFor, ed25519::Signature, - AuthorityId + Ed25519AuthorityId >; /// Configuration for the GRANDPA service. @@ -306,7 +307,7 @@ impl, RA> BlockStatus for Arc { inner: Arc>, - voters: Arc>, + voters: Arc>, config: Config, authority_set: SharedAuthoritySet>, network: N, @@ -381,7 +382,7 @@ struct NewAuthoritySet { canon_number: N, canon_hash: H, set_id: u64, - authorities: Vec<(AuthorityId, u64)>, + authorities: Vec<(Ed25519AuthorityId, u64)>, } /// Signals either an early exit of a voter or an error. @@ -432,7 +433,7 @@ impl, N, RA> voter::Environment: BlockNumberOps, { type Timer = Box + Send>; - type Id = AuthorityId; + type Id = Ed25519AuthorityId; type Signature = ed25519::Signature; // regular round message streams @@ -611,7 +612,7 @@ impl> GrandpaJustification { fn decode_and_verify( encoded: Vec, set_id: u64, - voters: &HashMap, + voters: &HashMap, ) -> Result, ClientError> where NumberFor: grandpa::BlockNumberOps, { @@ -830,13 +831,14 @@ impl, RA, PRA> BlockImport B: Backend + 'static, E: CallExecutor + 'static + Clone + Send + Sync, DigestFor: Encode, + DigestItemFor: DigestItem, RA: Send + Sync, PRA: ProvideRuntimeApi, PRA::Api: GrandpaApi, { - type Error = ClientError; + type Error = ConsensusError; - fn import_block(&self, mut block: ImportBlock, new_authorities: Option>) + fn import_block(&self, mut block: ImportBlock, new_authorities: Option>) -> Result { use authorities::PendingChange; @@ -847,7 +849,12 @@ impl, RA, PRA> BlockImport let maybe_change = self.api.runtime_api().grandpa_pending_change( &BlockId::hash(*block.header.parent_hash()), &block.header.digest().clone(), - )?; + ); + + let maybe_change = match maybe_change { + Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Ok(maybe) => maybe, + }; // when we update the authorities, we need to hold the lock // until the block is written to prevent a race if we need to restore @@ -858,11 +865,9 @@ impl, RA, PRA> BlockImport let mut authorities = self.authority_set.inner().write(); let old_set = authorities.clone(); - let is_equal_or_descendent_of = |base: &Block::Hash| -> Result<(), ClientError> { + let is_equal_or_descendent_of = |base: &Block::Hash| -> Result<(), ConsensusError> { let error = || { - Err(ClientErrorKind::Backend( - "invalid authority set change: multiple pending changes on the same chain".to_string() - ).into()) + Err(ConsensusErrorKind::ClientImport("Incorrect base hash".to_string()).into()) }; if *base == hash { return error(); } @@ -872,7 +877,12 @@ impl, RA, PRA> BlockImport self.inner.backend().blockchain(), BlockId::Hash(parent_hash), BlockId::Hash(*base), - )?; + ); + + let tree_route = match tree_route { + Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Ok(route) => route, + }; if tree_route.common_block().hash == *base { return error(); @@ -905,18 +915,25 @@ impl, RA, PRA> BlockImport *authorities = old_set; } e - })?; + }); - if import_result != ImportResult::Queued { - return Ok(import_result); - } + let import_result = match import_result { + Ok(ImportResult::Queued) => ImportResult::Queued, + Ok(r) => return Ok(r), + Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + }; let enacts_change = self.authority_set.inner().read().enacts_change(number, |canon_number| { canonical_at_height(&self.inner, (hash, number), canon_number) - })?; + }); - if !enacts_change { - return Ok(import_result); + match enacts_change { + Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Ok(enacted) => { + if !enacted { + return Ok(import_result); + } + } } match justification { @@ -925,7 +942,12 @@ impl, RA, PRA> BlockImport justification, self.authority_set.set_id(), &self.authority_set.current_authorities(), - )?; + ); + + let justification = match justification { + Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Ok(justification) => justification, + }; let result = finalize_block( &*self.inner, @@ -943,16 +965,18 @@ impl, RA, PRA> BlockImport }, Err(ExitOrError::AuthoritiesChanged(new)) => { debug!(target: "finality", "Imported justified block #{} that enacts authority set change, signalling voter.", number); - if let Err(_) = self.authority_set_change.unbounded_send(new) { - return Err(ClientErrorKind::Backend( - "imported and finalized change block but grandpa voter is no longer running".to_string() - ).into()); + if let Err(e) = self.authority_set_change.unbounded_send(new) { + return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()); } }, - Err(ExitOrError::Error(_)) => { - return Err(ClientErrorKind::Backend( - "imported change block but failed to finalize it, node may be in an inconsistent state".to_string() - ).into()); + Err(ExitOrError::Error(e)) => { + match e { + Error::Grandpa(error) => return Err(ConsensusErrorKind::ClientImport(error.to_string()).into()), + Error::Network(error) => return Err(ConsensusErrorKind::ClientImport(error).into()), + Error::Blockchain(error) => return Err(ConsensusErrorKind::ClientImport(error).into()), + Error::Client(error) => return Err(ConsensusErrorKind::ClientImport(error.to_string()).into()), + Error::Timer(error) => return Err(ConsensusErrorKind::ClientImport(error.to_string()).into()), + } }, } }, @@ -1008,10 +1032,11 @@ impl, RA, PRA> Authorities for GrandpaBloc where B: Backend + 'static, E: CallExecutor + 'static + Clone + Send + Sync, + DigestItemFor: DigestItem, { type Error = as Authorities>::Error; - fn authorities(&self, at: &BlockId) -> Result, Self::Error> { + fn authorities(&self, at: &BlockId) -> Result, Self::Error> { self.inner.authorities_at(at) } } @@ -1136,16 +1161,16 @@ pub fn block_import, RA, PRA>( fn committer_communication, B, E, N, RA>( set_id: u64, - voters: &Arc>, + voters: &Arc>, client: &Arc>, network: &N, ) -> ( impl Stream< - Item = (u64, ::grandpa::CompactCommit, ed25519::Signature, AuthorityId>), + Item = (u64, ::grandpa::CompactCommit, ed25519::Signature, Ed25519AuthorityId>), Error = ExitOrError>, >, impl Sink< - SinkItem = (u64, ::grandpa::Commit, ed25519::Signature, AuthorityId>), + SinkItem = (u64, ::grandpa::Commit, ed25519::Signature, Ed25519AuthorityId>), SinkError = ExitOrError>, >, ) where @@ -1154,6 +1179,7 @@ fn committer_communication, B, E, N, RA>( N: Network, RA: Send + Sync, NumberFor: BlockNumberOps, + DigestItemFor: DigestItem, { // verification stream let commit_in = ::communication::checked_commit_stream::( @@ -1186,6 +1212,7 @@ pub fn run_grandpa, N, RA>( config: Config, link: LinkHalf, network: N, + on_exit: impl Future + Send + 'static, ) -> ::client::error::Result + Send + 'static> where Block::Hash: Ord, B: Backend + 'static, @@ -1194,6 +1221,7 @@ pub fn run_grandpa, N, RA>( N::In: Send + 'static, NumberFor: BlockNumberOps, DigestFor: Encode, + DigestItemFor: DigestItem, RA: Send + Sync + 'static, { use futures::future::{self, Loop as FutureLoop}; @@ -1312,5 +1340,5 @@ pub fn run_grandpa, N, RA>( })) }).map_err(|e| warn!("GRANDPA Voter failed: {:?}", e)); - Ok(voter_work) + Ok(voter_work.select(on_exit).then(|_| Ok(()))) } diff --git a/core/finality-grandpa/src/tests.rs b/core/finality-grandpa/src/tests.rs index d01a48d62f3b7..18bfaef1a5ff2 100644 --- a/core/finality-grandpa/src/tests.rs +++ b/core/finality-grandpa/src/tests.rs @@ -18,7 +18,7 @@ use super::*; use network::test::{Block, Hash, TestNetFactory, Peer, PeersClient}; -use network::import_queue::{PassThroughVerifier}; +use network::test::{PassThroughVerifier}; use network::config::{ProtocolConfig, Roles}; use parking_lot::Mutex; use tokio::runtime::current_thread; @@ -29,7 +29,7 @@ use client::{ }; use test_client::{self, runtime::BlockNumber}; use codec::Decode; -use consensus_common::BlockOrigin; +use consensus_common::{BlockOrigin, Error as ConsensusError}; use std::{collections::HashSet, result}; use runtime_primitives::traits::{ApiRef, ProvideRuntimeApi, RuntimeApiInfo}; use runtime_primitives::generic::BlockId; @@ -99,7 +99,7 @@ impl TestNetFactory for GrandpaTestNet { } fn make_block_import(&self, client: Arc) - -> (Arc + Send + Sync>, PeerData) + -> (Arc + Send + Sync>, PeerData) { let (import, link) = block_import( client, @@ -230,12 +230,12 @@ impl Network for MessageRouting { #[derive(Default, Clone)] struct TestApi { - genesis_authorities: Vec<(AuthorityId, u64)>, + genesis_authorities: Vec<(Ed25519AuthorityId, u64)>, scheduled_changes: Arc>>>, } impl TestApi { - fn new(genesis_authorities: Vec<(AuthorityId, u64)>) -> Self { + fn new(genesis_authorities: Vec<(Ed25519AuthorityId, u64)>) -> Self { TestApi { genesis_authorities, scheduled_changes: Arc::new(Mutex::new(HashMap::new())), @@ -260,7 +260,7 @@ impl Core for RuntimeApi { unimplemented!("Not required for testing!") } - fn authorities(&self, _: &BlockId) -> Result> { + fn authorities(&self, _: &BlockId) -> Result> { unimplemented!("Not required for testing!") } @@ -300,7 +300,7 @@ impl GrandpaApi for RuntimeApi { fn grandpa_authorities( &self, at: &BlockId - ) -> Result> { + ) -> Result> { if at == &BlockId::Number(0) { Ok(self.inner.genesis_authorities.clone()) } else { @@ -325,9 +325,9 @@ impl GrandpaApi for RuntimeApi { const TEST_GOSSIP_DURATION: Duration = Duration::from_millis(500); const TEST_ROUTING_INTERVAL: Duration = Duration::from_millis(50); -fn make_ids(keys: &[Keyring]) -> Vec<(AuthorityId, u64)> { +fn make_ids(keys: &[Keyring]) -> Vec<(Ed25519AuthorityId, u64)> { keys.iter() - .map(|key| AuthorityId(key.to_raw_public())) + .map(|key| Ed25519AuthorityId(key.to_raw_public())) .map(|id| (id, 1)) .collect() } @@ -376,6 +376,7 @@ fn finalize_3_voters_no_observers() { }, link, MessageRouting::new(net.clone(), peer_id), + futures::empty(), ).expect("all in order with client and network"); assert_send(&voter); @@ -436,6 +437,7 @@ fn finalize_3_voters_1_observer() { }, link, MessageRouting::new(net.clone(), peer_id), + futures::empty(), ).expect("all in order with client and network"); runtime.spawn(voter); @@ -592,6 +594,7 @@ fn transition_3_voters_twice_1_observer() { }, link, MessageRouting::new(net.clone(), peer_id), + futures::empty(), ).expect("all in order with client and network"); runtime.spawn(voter); diff --git a/core/finality-grandpa/src/until_imported.rs b/core/finality-grandpa/src/until_imported.rs index 028b710acb7e1..8cb825ac84c3b 100644 --- a/core/finality-grandpa/src/until_imported.rs +++ b/core/finality-grandpa/src/until_imported.rs @@ -27,7 +27,7 @@ use futures::prelude::*; use futures::stream::Fuse; use parking_lot::Mutex; use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor}; -use substrate_primitives::AuthorityId; +use substrate_primitives::Ed25519AuthorityId; use tokio::timer::Interval; use std::collections::{HashMap, VecDeque}; @@ -181,7 +181,7 @@ impl Stream for UntilImported } } -fn warn_authority_wrong_target(hash: H, id: AuthorityId) { +fn warn_authority_wrong_target(hash: H, id: Ed25519AuthorityId) { warn!( target: "afg", "Authority {:?} signed GRANDPA message with \ diff --git a/core/keystore/Cargo.toml b/core/keystore/Cargo.toml index 760e064158ac2..9d31557b420d7 100644 --- a/core/keystore/Cargo.toml +++ b/core/keystore/Cargo.toml @@ -5,14 +5,14 @@ authors = ["Parity Technologies "] [dependencies] substrate-primitives = { path = "../primitives" } -parity-crypto = { version = "0.1", default-features = false } +parity-crypto = { version = "0.2", default-features = false } error-chain = "0.12" hex = "0.3" rand = "0.4" serde_json = "1.0" serde = "1.0" serde_derive = "1.0" -subtle = "0.5" +subtle = "2.0" [dev-dependencies] tempdir = "0.3" diff --git a/core/keystore/src/lib.rs b/core/keystore/src/lib.rs index 6d8e3b3ae9f23..baeeab27556d7 100644 --- a/core/keystore/src/lib.rs +++ b/core/keystore/src/lib.rs @@ -110,7 +110,7 @@ impl EncryptedKey { let mac = blake2_256(&crypto::derive_mac(&derived_right_bits, &self.ciphertext)); - if subtle::slices_equal(&mac[..], &self.mac[..]) != 1 { + if subtle::ConstantTimeEq::ct_eq(&mac[..], &self.mac[..]).unwrap_u8() != 1 { return Err(ErrorKind::InvalidPassword.into()); } diff --git a/core/network-libp2p/Cargo.toml b/core/network-libp2p/Cargo.toml index 6b0fb9af40177..12f92bc9a1331 100644 --- a/core/network-libp2p/Cargo.toml +++ b/core/network-libp2p/Cargo.toml @@ -11,8 +11,8 @@ bytes = "0.4" error-chain = { version = "0.12", default-features = false } fnv = "1.0" futures = "0.1" -libp2p = { git = "https://github.com/libp2p/rust-libp2p", rev = "d961e656a74d1bab5366d371a06f9e10d5f4a6c5", default-features = false, features = ["secio-rsa", "secio-secp256k1"] } -parking_lot = "0.5" +libp2p = { git = "https://github.com/tomaka/libp2p-rs", rev = "997d0163bc8a7e11559524ad8466bc3b1850c8ec", default-features = false, features = ["secio-rsa", "secio-secp256k1"] } +parking_lot = "0.7.1" libc = "0.2" log = "0.4" rand = "0.5.0" @@ -26,4 +26,4 @@ unsigned-varint = { version = "0.2.1", features = ["codec"] } [dev-dependencies] assert_matches = "1.2" -parity-bytes = "0.1" +parity-bytes = { git = "https://github.com/paritytech/parity-common", rev = "616b40150ded71f57f650067fcbc5c99d7c343e6" } diff --git a/core/network-libp2p/src/lib.rs b/core/network-libp2p/src/lib.rs index 8c5df15c4954e..6890450763140 100644 --- a/core/network-libp2p/src/lib.rs +++ b/core/network-libp2p/src/lib.rs @@ -53,7 +53,7 @@ mod transport; pub use custom_proto::RegisteredProtocol; pub use error::{Error, ErrorKind, DisconnectReason}; -pub use libp2p::{Multiaddr, multiaddr::{Protocol}, multiaddr, PeerId}; +pub use libp2p::{Multiaddr, multiaddr::{Protocol}, multiaddr, PeerId, core::PublicKey}; pub use secret::obtain_private_key; pub use service_task::{start_service, Service, ServiceEvent}; pub use traits::{NetworkConfiguration, NodeIndex, NodeId, NonReservedPeerMode}; diff --git a/core/network/Cargo.toml b/core/network/Cargo.toml index 7eadefb3637f3..221036032eb3d 100644 --- a/core/network/Cargo.toml +++ b/core/network/Cargo.toml @@ -9,7 +9,7 @@ authors = ["Parity Technologies "] [dependencies] log = "0.4" -parking_lot = "0.4" +parking_lot = "0.7.1" error-chain = "0.12" bitflags = "1.0" futures = "0.1.17" diff --git a/core/network/src/chain.rs b/core/network/src/chain.rs index 8547f9006e3b4..457f8852b2cb6 100644 --- a/core/network/src/chain.rs +++ b/core/network/src/chain.rs @@ -19,18 +19,18 @@ use client::{self, Client as SubstrateClient, ClientInfo, BlockStatus, CallExecutor}; use client::error::Error; use client::light::fetcher::ChangesProof; -use consensus::BlockImport; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT}; +use consensus::{BlockImport, Error as ConsensusError}; +use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, AuthorityIdFor}; use runtime_primitives::generic::{BlockId}; use consensus::{ImportBlock, ImportResult}; use runtime_primitives::Justification; -use primitives::{H256, Blake2Hasher, AuthorityId}; +use primitives::{H256, Blake2Hasher}; /// Local client abstraction for the network. pub trait Client: Send + Sync { /// Import a new block. Parent is supposed to be existing in the blockchain. - fn import(&self, block: ImportBlock, new_authorities: Option>) - -> Result; + fn import(&self, block: ImportBlock, new_authorities: Option>>) + -> Result; /// Get blockchain info. fn info(&self) -> Result, Error>; @@ -73,12 +73,12 @@ pub trait Client: Send + Sync { impl Client for SubstrateClient where B: client::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + 'static, - Self: BlockImport, + Self: BlockImport, Block: BlockT, RA: Send + Sync { - fn import(&self, block: ImportBlock, new_authorities: Option>) - -> Result + fn import(&self, block: ImportBlock, new_authorities: Option>>) + -> Result { (self as &SubstrateClient).import_block(block, new_authorities) } diff --git a/core/network/src/lib.rs b/core/network/src/lib.rs index b6ba3f78836e0..95b6d68113d4a 100644 --- a/core/network/src/lib.rs +++ b/core/network/src/lib.rs @@ -55,7 +55,6 @@ mod chain; mod blocks; mod on_demand; pub mod config; -pub mod import_queue; pub mod consensus_gossip; pub mod error; pub mod message; @@ -70,7 +69,7 @@ pub use protocol::{ProtocolStatus, PeerInfo, Context}; pub use sync::{Status as SyncStatus, SyncState}; pub use network_libp2p::{ NodeIndex, ProtocolId, Severity, Protocol, Multiaddr, - obtain_private_key, multiaddr, + obtain_private_key, multiaddr, PeerId, PublicKey }; pub use message::{generic as generic_message, RequestId, Status as StatusMessage}; pub use error::Error; diff --git a/core/network/src/on_demand.rs b/core/network/src/on_demand.rs index 59a5333a47802..d71352e86ea48 100644 --- a/core/network/src/on_demand.rs +++ b/core/network/src/on_demand.rs @@ -24,7 +24,7 @@ use futures::sync::oneshot::{channel, Receiver, Sender}; use linked_hash_map::LinkedHashMap; use linked_hash_map::Entry; use parking_lot::Mutex; -use client::{self, error::{Error as ClientError, ErrorKind as ClientErrorKind}}; +use client::{error::{Error as ClientError, ErrorKind as ClientErrorKind}}; use client::light::fetcher::{Fetcher, FetchChecker, RemoteHeaderRequest, RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest, ChangesProof}; use io::SyncIo; @@ -107,7 +107,7 @@ struct Request { enum RequestData { RemoteHeader(RemoteHeaderRequest, Sender>), RemoteRead(RemoteReadRequest, Sender>, ClientError>>), - RemoteCall(RemoteCallRequest, Sender>), + RemoteCall(RemoteCallRequest, Sender, ClientError>>), RemoteChanges(RemoteChangesRequest, Sender, u32)>, ClientError>>), } @@ -312,7 +312,7 @@ impl Fetcher for OnDemand where { type RemoteHeaderResult = RemoteResponse; type RemoteReadResult = RemoteResponse>>; - type RemoteCallResult = RemoteResponse; + type RemoteCallResult = RemoteResponse>; type RemoteChangesResult = RemoteResponse, u32)>>; fn remote_header(&self, request: RemoteHeaderRequest) -> Self::RemoteHeaderResult { @@ -413,16 +413,24 @@ impl OnDemandCore where None => return, }; - let last_peer = self.idle_peers.back().cloned(); - while !self.pending_requests.is_empty() { + let mut last_peer = self.idle_peers.back().cloned(); + let mut unhandled_requests = VecDeque::new(); + + loop { let peer = match self.idle_peers.pop_front() { Some(peer) => peer, - None => return, + None => break, }; // check if request can (optimistically) be processed by the peer let can_be_processed_by_peer = { - let request = self.pending_requests.front().expect("checked in loop condition; qed"); + let request = match self.pending_requests.front() { + Some(r) => r, + None => { + self.idle_peers.push_front(peer); + break; + }, + }; let peer_best_block = self.best_blocks.get(&peer) .expect("entries are inserted into best_blocks when peer is connected; entries are removed from best_blocks when peer is disconnected; @@ -436,12 +444,16 @@ impl OnDemandCore where // we have enumerated all peers and noone can handle request if Some(peer) == last_peer { - break; + let request = self.pending_requests.pop_front().expect("checked in loop condition; qed"); + unhandled_requests.push_back(request); + last_peer = self.idle_peers.back().cloned(); } continue; } + last_peer = self.idle_peers.back().cloned(); + let mut request = self.pending_requests.pop_front().expect("checked in loop condition; qed"); request.timestamp = Instant::now(); trace!(target: "sync", "Dispatching remote request {} to peer {}", request.id, peer); @@ -449,6 +461,8 @@ impl OnDemandCore where service.execute_in_context(|ctx| ctx.send_message(peer, request.message())); self.active_peers.insert(peer, request); } + + self.pending_requests.append(&mut unhandled_requests); } } @@ -515,7 +529,7 @@ pub mod tests { use futures::Future; use parking_lot::RwLock; use runtime_primitives::traits::NumberFor; - use client::{self, error::{ErrorKind as ClientErrorKind, Result as ClientResult}}; + use client::{error::{ErrorKind as ClientErrorKind, Result as ClientResult}}; use client::light::fetcher::{Fetcher, FetchChecker, RemoteHeaderRequest, RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest, ChangesProof}; use config::Roles; @@ -553,12 +567,9 @@ pub mod tests { } } - fn check_execution_proof(&self, _: &RemoteCallRequest
, _: Vec>) -> ClientResult { + fn check_execution_proof(&self, _: &RemoteCallRequest
, _: Vec>) -> ClientResult> { match self.ok { - true => Ok(client::CallResult { - return_data: vec![42], - changes: Default::default(), - }), + true => Ok(vec![42]), false => Err(ClientErrorKind::Backend("Test error".into()).into()), } } @@ -782,7 +793,7 @@ pub mod tests { }); let thread = ::std::thread::spawn(move || { let result = response.wait().unwrap(); - assert_eq!(result.return_data, vec![42]); + assert_eq!(result, vec![42]); }); receive_call_response(&*on_demand, &mut network, 0, 0); @@ -928,4 +939,55 @@ pub mod tests { assert!(!on_demand.core.lock().idle_peers.iter().any(|_| true)); assert_eq!(on_demand.core.lock().pending_requests.len(), 0); } + + #[test] + fn does_not_loop_forever_after_dispatching_request_to_last_peer() { + // this test is a regression for a bug where the dispatch function would + // loop forever after dispatching a request to the last peer, since the + // last peer was not updated + let (_x, on_demand) = dummy(true); + let queue = RwLock::new(VecDeque::new()); + let _network = TestIo::new(&queue, None); + + on_demand.remote_header(RemoteHeaderRequest { + cht_root: Default::default(), + block: 250, + retry_count: None, + }); + on_demand.remote_header(RemoteHeaderRequest { + cht_root: Default::default(), + block: 250, + retry_count: None, + }); + + on_demand.on_connect(1, Roles::FULL, 200); + on_demand.on_connect(2, Roles::FULL, 200); + on_demand.on_connect(3, Roles::FULL, 250); + + assert_eq!(vec![1, 2], on_demand.core.lock().idle_peers.iter().cloned().collect::>()); + assert_eq!(on_demand.core.lock().pending_requests.len(), 1); + } + + #[test] + fn tries_to_send_all_pending_requests() { + let (_x, on_demand) = dummy(true); + let queue = RwLock::new(VecDeque::new()); + let _network = TestIo::new(&queue, None); + + on_demand.remote_header(RemoteHeaderRequest { + cht_root: Default::default(), + block: 300, + retry_count: None, + }); + on_demand.remote_header(RemoteHeaderRequest { + cht_root: Default::default(), + block: 250, + retry_count: None, + }); + + on_demand.on_connect(1, Roles::FULL, 250); + + assert!(on_demand.core.lock().idle_peers.iter().cloned().collect::>().is_empty()); + assert_eq!(on_demand.core.lock().pending_requests.len(), 1); + } } diff --git a/core/network/src/protocol.rs b/core/network/src/protocol.rs index 60133b25c144e..41612c788d7c4 100644 --- a/core/network/src/protocol.rs +++ b/core/network/src/protocol.rs @@ -24,14 +24,13 @@ use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, use runtime_primitives::generic::BlockId; use network_libp2p::{NodeIndex, Severity}; use codec::{Encode, Decode}; - +use consensus::import_queue::ImportQueue; use message::{self, Message}; use message::generic::Message as GenericMessage; use consensus_gossip::ConsensusGossip; use specialization::NetworkSpecialization; use sync::{ChainSync, Status as SyncStatus, SyncState}; use service::{TransactionPool, ExHashT}; -use import_queue::ImportQueue; use config::{ProtocolConfig, Roles}; use chain::Client; use client::light::fetcher::ChangesProof; @@ -196,7 +195,9 @@ impl, H: ExHashT> Protocol { on_demand: Option>>, transaction_pool: Arc>, specialization: S, - ) -> error::Result { + ) -> error::Result + where I: ImportQueue + { let info = chain.info()?; let sync = ChainSync::new(config.roles, &info, import_queue); let protocol = Protocol { @@ -239,6 +240,20 @@ impl, H: ExHashT> Protocol { } } + pub fn peers(&self) -> Vec<(NodeIndex, PeerInfo)> { + self.context_data.peers.read().iter().map(|(idx, p)| { + ( + *idx, + PeerInfo { + roles: p.roles, + protocol_version: p.protocol_version, + best_hash: p.best_hash, + best_number: p.best_number, + } + ) + }).collect() + } + pub fn handle_packet(&self, io: &mut SyncIo, who: NodeIndex, mut data: &[u8]) { let message: Message = match Decode::decode(&mut data) { Some(m) => m, diff --git a/core/network/src/service.rs b/core/network/src/service.rs index d633e0397de00..501b5d6eb39bf 100644 --- a/core/network/src/service.rs +++ b/core/network/src/service.rs @@ -20,17 +20,19 @@ use std::{io, thread}; use std::time::Duration; use futures::{self, Future, Stream, stream, sync::oneshot}; use parking_lot::{Mutex, RwLock}; -use network_libp2p::{ProtocolId, PeerId, NetworkConfiguration, ErrorKind}; +use network_libp2p::{ProtocolId, PeerId, NetworkConfiguration, NodeIndex, ErrorKind, Severity}; use network_libp2p::{start_service, Service as NetworkService, ServiceEvent as NetworkServiceEvent}; use network_libp2p::{RegisteredProtocol, parse_str_addr, Protocol as Libp2pProtocol}; use io::NetSyncIo; +use consensus::import_queue::{ImportQueue, Link}; use consensus_gossip::ConsensusGossip; -use protocol::{self, Protocol, ProtocolContext, Context, ProtocolStatus}; +use protocol::{self, Protocol, ProtocolContext, Context, ProtocolStatus, PeerInfo}; use config::Params; use error::Error; use specialization::NetworkSpecialization; -use import_queue::ImportQueue; -use runtime_primitives::traits::{Block as BlockT}; +use runtime_primitives::traits::{Block as BlockT, NumberFor}; +use sync::ChainSync; +use std::sync::Weak; use tokio::{runtime::Runtime, timer::Interval}; /// Type that represents fetch completion future. @@ -43,6 +45,8 @@ const PROPAGATE_TIMEOUT: Duration = Duration::from_millis(5000); pub trait SyncProvider: Send + Sync { /// Get sync status fn status(&self) -> ProtocolStatus; + /// Get currently connected peers + fn peers(&self) -> Vec<(NodeIndex, Option, PeerInfo)>; } /// Minimum Requirements for a Hash within Networking @@ -65,6 +69,53 @@ pub trait ExecuteInContext: Send + Sync { fn execute_in_context)>(&self, closure: F); } +/// A link implementation that connects to the network. +pub struct NetworkLink> { + /// The chain-sync handle + pub(crate) sync: Weak>>, + /// Network context. + pub(crate) context: Weak, +} + +impl> NetworkLink { + /// Execute closure with locked ChainSync. + fn with_sync, &mut Context)>(&self, closure: F) { + if let (Some(sync), Some(service)) = (self.sync.upgrade(), self.context.upgrade()) { + service.execute_in_context(move |protocol| { + let mut sync = sync.write(); + closure(&mut *sync, protocol) + }); + } + } +} + +impl> Link for NetworkLink { + fn block_imported(&self, hash: &B::Hash, number: NumberFor) { + self.with_sync(|sync, _| sync.block_imported(&hash, number)) + } + + fn maintain_sync(&self) { + self.with_sync(|sync, protocol| sync.maintain_sync(protocol)) + } + + fn useless_peer(&self, who: NodeIndex, reason: &str) { + trace!(target:"sync", "Useless peer {}, {}", who, reason); + self.with_sync(|_, protocol| protocol.report_peer(who, Severity::Useless(reason))) + } + + fn note_useless_and_restart_sync(&self, who: NodeIndex, reason: &str) { + trace!(target:"sync", "Bad peer {}, {}", who, reason); + self.with_sync(|sync, protocol| { + protocol.report_peer(who, Severity::Useless(reason)); // is this actually malign or just useless? + sync.restart(protocol); + }) + } + + fn restart(&self) { + self.with_sync(|sync, protocol| sync.restart(protocol)) + } +} + /// Substrate network service. Handles network IO and manages connectivity. pub struct Service, H: ExHashT> { /// Network service @@ -85,7 +136,9 @@ impl, H: ExHashT> Service, protocol_id: ProtocolId, import_queue: Arc, - ) -> Result>, Error> { + ) -> Result>, Error> + where I: ImportQueue + { let handler = Arc::new(Protocol::new( params.config, params.chain, @@ -106,7 +159,7 @@ impl, H: ExHashT> Service, H: ExHashT> SyncProvider< fn status(&self) -> ProtocolStatus { self.handler.status() } + + fn peers(&self) -> Vec<(NodeIndex, Option, PeerInfo)> { + let peers = self.handler.peers(); + let network = self.network.lock(); + peers.into_iter().map(|(idx, info)| { + (idx, network.peer_id_of_node(idx).map(|p| p.clone()), info) + }).collect::>() + } } /// Trait for managing network diff --git a/core/network/src/sync.rs b/core/network/src/sync.rs index dd67b915d8dad..54da778266fbf 100644 --- a/core/network/src/sync.rs +++ b/core/network/src/sync.rs @@ -20,21 +20,22 @@ use protocol::Context; use network_libp2p::{Severity, NodeIndex}; use client::{BlockStatus, ClientInfo}; use consensus::BlockOrigin; +use consensus::import_queue::{ImportQueue, IncomingBlock}; use client::error::Error as ClientError; -use blocks::{self, BlockCollection}; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, As, NumberFor}; +use blocks::BlockCollection; +use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, As, NumberFor, Zero}; use runtime_primitives::generic::BlockId; use message::{self, generic::Message as GenericMessage}; use config::Roles; -use import_queue::ImportQueue; // Maximum blocks to request in a single packet. const MAX_BLOCKS_TO_REQUEST: usize = 128; // Maximum blocks to store in the import queue. const MAX_IMPORTING_BLOCKS: usize = 2048; +// Number of blocks in the queue that prevents ancestry search. +const MAJOR_SYNC_BLOCKS: usize = 5; struct PeerSync { - pub common_hash: B::Hash, pub common_number: NumberFor, pub best_hash: B::Hash, pub best_number: NumberFor, @@ -141,16 +142,25 @@ impl ChainSync { (Ok(BlockStatus::KnownBad), _) => { protocol.report_peer(who, Severity::Bad(&format!("New peer with known bad best block {} ({}).", info.best_hash, info.best_number))); }, - (Ok(BlockStatus::Unknown), b) if b == As::sa(0) => { + (Ok(BlockStatus::Unknown), b) if b.is_zero() => { protocol.report_peer(who, Severity::Bad(&format!("New peer with unknown genesis hash {} ({}).", info.best_hash, info.best_number))); }, + (Ok(BlockStatus::Unknown), _) if self.import_queue.status().importing_count > MAJOR_SYNC_BLOCKS => { + // when actively syncing the common point moves too fast. + debug!(target:"sync", "New peer with unknown best hash {} ({}), assuming common block.", self.best_queued_hash, self.best_queued_number); + self.peers.insert(who, PeerSync { + common_number: self.best_queued_number, + best_hash: info.best_hash, + best_number: info.best_number, + state: PeerSyncState::Available, + }); + } (Ok(BlockStatus::Unknown), _) => { let our_best = self.best_queued_number; if our_best > As::sa(0) { let common_best = ::std::cmp::min(our_best, info.best_number); debug!(target:"sync", "New peer with unknown best hash {} ({}), searching for common ancestor.", info.best_hash, info.best_number); self.peers.insert(who, PeerSync { - common_hash: self.genesis_hash, common_number: As::sa(0), best_hash: info.best_hash, best_number: info.best_number, @@ -161,7 +171,6 @@ impl ChainSync { // We are at genesis, just start downloading debug!(target:"sync", "New peer with best hash {} ({}).", info.best_hash, info.best_number); self.peers.insert(who, PeerSync { - common_hash: self.genesis_hash, common_number: As::sa(0), best_hash: info.best_hash, best_number: info.best_number, @@ -173,7 +182,6 @@ impl ChainSync { (Ok(BlockStatus::Queued), _) | (Ok(BlockStatus::InChain), _) => { debug!(target:"sync", "New peer with known best hash {} ({}).", info.best_hash, info.best_number); self.peers.insert(who, PeerSync { - common_hash: info.best_hash, common_number: info.best_number, best_hash: info.best_hash, best_number: info.best_number, @@ -190,21 +198,37 @@ impl ChainSync { who: NodeIndex, _request: message::BlockRequest, response: message::BlockResponse - ) -> Option<(BlockOrigin, Vec>)> { - let new_blocks = if let Some(ref mut peer) = self.peers.get_mut(&who) { + ) -> Option<(BlockOrigin, Vec>)> { + let new_blocks: Vec> = if let Some(ref mut peer) = self.peers.get_mut(&who) { match peer.state { PeerSyncState::DownloadingNew(start_block) => { self.blocks.clear_peer_download(who); peer.state = PeerSyncState::Available; self.blocks.insert(start_block, response.blocks, who); - self.blocks.drain(self.best_queued_number + As::sa(1)) + self.blocks + .drain(self.best_queued_number + As::sa(1)) + .into_iter() + .map(|block_data| { + IncomingBlock { + hash: block_data.block.hash, + header: block_data.block.header, + body: block_data.block.body, + justification: block_data.block.justification, + origin: block_data.origin, + } + }).collect() }, PeerSyncState::DownloadingStale(_) => { peer.state = PeerSyncState::Available; - response.blocks.into_iter().map(|b| blocks::BlockData { - origin: Some(who), - block: b + response.blocks.into_iter().map(|b| { + IncomingBlock { + hash: b.hash, + header: b.header, + body: b.body, + justification: b.justification, + origin: Some(who), + } }).collect() }, PeerSyncState::AncestorSearch(n) => { @@ -214,7 +238,6 @@ impl ChainSync { match protocol.client().block_hash(n) { Ok(Some(block_hash)) if block_hash == block.hash => { if peer.common_number < n { - peer.common_hash = block.hash; peer.common_number = n; } peer.state = PeerSyncState::Available; @@ -253,11 +276,11 @@ impl ChainSync { }; let best_seen = self.best_seen_block(); - let is_best = new_blocks.first().and_then(|b| b.block.header.as_ref()).map(|h| best_seen.as_ref().map_or(false, |n| h.number() >= n)); + let is_best = new_blocks.first().and_then(|b| b.header.as_ref()).map(|h| best_seen.as_ref().map_or(false, |n| h.number() >= n)); let origin = if is_best.unwrap_or_default() { BlockOrigin::NetworkBroadcast } else { BlockOrigin::NetworkInitialSync }; if let Some((hash, number)) = new_blocks.last() - .and_then(|b| b.block.header.as_ref().map(|h| (b.block.hash.clone(), *h.number()))) + .and_then(|b| b.header.as_ref().map(|h| (b.hash.clone(), *h.number()))) { self.block_queued(&hash, number); } @@ -284,15 +307,14 @@ impl ChainSync { // Update common blocks for (n, peer) in self.peers.iter_mut() { if let PeerSyncState::AncestorSearch(_) = peer.state { - continue; + // Abort search. + peer.state = PeerSyncState::Available; } trace!(target: "sync", "Updating peer {} info, ours={}, common={}, their best={}", n, number, peer.common_number, peer.best_number); if peer.best_number >= number { peer.common_number = number; - peer.common_hash = *hash; } else { peer.common_number = peer.best_number; - peer.common_hash = peer.best_hash; } } } @@ -363,10 +385,6 @@ impl ChainSync { pub(crate) fn restart(&mut self, protocol: &mut Context) { self.import_queue.clear(); self.blocks.clear(); - let ids: Vec = self.peers.keys().map(|p| *p).collect(); - for id in ids { - self.new_peer(protocol, id); - } match protocol.client().info() { Ok(info) => { self.best_queued_hash = info.best_queued_hash.unwrap_or(info.chain.best_hash); @@ -379,6 +397,10 @@ impl ChainSync { self.best_queued_number = As::sa(0); } } + let ids: Vec = self.peers.drain().map(|(id, _)| id).collect(); + for id in ids { + self.new_peer(protocol, id); + } } pub(crate) fn clear(&mut self) { diff --git a/core/network/src/test/block_import.rs b/core/network/src/test/block_import.rs new file mode 100644 index 0000000000000..6104be87f0e32 --- /dev/null +++ b/core/network/src/test/block_import.rs @@ -0,0 +1,171 @@ +// Copyright 2017-2018 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate 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. + +// Substrate 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 Substrate. If not, see . + +//! Testing block import logic. + +use consensus::import_queue::{import_single_block, process_import_result}; +use consensus::import_queue::{AsyncImportQueueData, BasicQueue, BlockImportError, BlockImportResult}; +use test_client::{self, TestClient}; +use test_client::runtime::{Block, Hash}; +use runtime_primitives::generic::BlockId; +use runtime_primitives::traits::NumberFor; +use std::cell::Cell; +use super::*; + +struct TestLink { + imported: Cell, + maintains: Cell, + disconnects: Cell, + restarts: Cell, +} + +impl TestLink { + fn new() -> TestLink { + TestLink { + imported: Cell::new(0), + maintains: Cell::new(0), + disconnects: Cell::new(0), + restarts: Cell::new(0), + } + } + + fn total(&self) -> usize { + self.imported.get() + self.maintains.get() + self.disconnects.get() + self.restarts.get() + } +} + +impl Link for TestLink { + fn block_imported(&self, _hash: &Hash, _number: NumberFor) { + self.imported.set(self.imported.get() + 1); + } + fn maintain_sync(&self) { + self.maintains.set(self.maintains.get() + 1); + } + fn useless_peer(&self, _: NodeIndex, _: &str) { + self.disconnects.set(self.disconnects.get() + 1); + } + fn note_useless_and_restart_sync(&self, id: NodeIndex, r: &str) { + self.useless_peer(id, r); + self.restart(); + } + fn restart(&self) { + self.restarts.set(self.restarts.get() + 1); + } +} + +fn prepare_good_block() -> (client::Client, Hash, u64, IncomingBlock) { + let client = test_client::new(); + let block = client.new_block().unwrap().bake().unwrap(); + client.import(BlockOrigin::File, block).unwrap(); + + let (hash, number) = (client.block_hash(1).unwrap().unwrap(), 1); + let header = client.header(&BlockId::Number(1)).unwrap(); + let justification = client.justification(&BlockId::Number(1)).unwrap(); + (client, hash, number, IncomingBlock { + hash, + header, + body: None, + justification, + origin: Some(0) + }) +} + +#[test] +fn import_single_good_block_works() { + let (_, hash, number, block) = prepare_good_block(); + assert_eq!( + import_single_block(&test_client::new(), BlockOrigin::File, block, Arc::new(PassThroughVerifier(true))), + Ok(BlockImportResult::ImportedUnknown(hash, number)) + ); +} + +#[test] +fn import_single_good_known_block_is_ignored() { + let (client, hash, number, block) = prepare_good_block(); + assert_eq!( + import_single_block(&client, BlockOrigin::File, block, Arc::new(PassThroughVerifier(true))), + Ok(BlockImportResult::ImportedKnown(hash, number)) + ); +} + +#[test] +fn import_single_good_block_without_header_fails() { + let (_, _, _, mut block) = prepare_good_block(); + block.header = None; + assert_eq!( + import_single_block(&test_client::new(), BlockOrigin::File, block, Arc::new(PassThroughVerifier(true))), + Err(BlockImportError::IncompleteHeader(Some(0))) + ); +} + +#[test] +fn process_import_result_works() { + let link = TestLink::new(); + assert_eq!(process_import_result::(&link, Ok(BlockImportResult::ImportedKnown(Default::default(), 0))), 1); + assert_eq!(link.total(), 1); + + let link = TestLink::new(); + assert_eq!(process_import_result::(&link, Ok(BlockImportResult::ImportedKnown(Default::default(), 0))), 1); + assert_eq!(link.total(), 1); + assert_eq!(link.imported.get(), 1); + + let link = TestLink::new(); + assert_eq!(process_import_result::(&link, Ok(BlockImportResult::ImportedUnknown(Default::default(), 0))), 1); + assert_eq!(link.total(), 1); + assert_eq!(link.imported.get(), 1); + + let link = TestLink::new(); + assert_eq!(process_import_result::(&link, Err(BlockImportError::IncompleteHeader(Some(0)))), 0); + assert_eq!(link.total(), 1); + assert_eq!(link.disconnects.get(), 1); + + let link = TestLink::new(); + assert_eq!(process_import_result::(&link, Err(BlockImportError::UnknownParent)), 0); + assert_eq!(link.total(), 1); + assert_eq!(link.restarts.get(), 1); + + let link = TestLink::new(); + assert_eq!(process_import_result::(&link, Err(BlockImportError::Error)), 0); + assert_eq!(link.total(), 1); + assert_eq!(link.restarts.get(), 1); +} + +#[test] +fn import_many_blocks_stops_when_stopping() { + let (_, _, _, block) = prepare_good_block(); + let qdata = AsyncImportQueueData::new(); + let verifier = Arc::new(PassThroughVerifier(true)); + qdata.stop(); + let client = test_client::new(); + assert!(!import_many_blocks( + &client, + &mut TestLink::new(), + Some(&qdata), + (BlockOrigin::File, vec![block.clone(), block]), + verifier + )); +} + +#[test] +fn async_import_queue_drops() { + // Perform this test multiple times since it exhibits non-deterministic behavior. + for _ in 0..100 { + let verifier = Arc::new(PassThroughVerifier(true)); + let queue = BasicQueue::new(verifier, Arc::new(test_client::new())); + queue.start(TestLink::new()).unwrap(); + drop(queue); + } +} diff --git a/core/network/src/test/mod.rs b/core/network/src/test/mod.rs index f8b67051646ab..48b401b21ae1a 100644 --- a/core/network/src/test/mod.rs +++ b/core/network/src/test/mod.rs @@ -18,33 +18,176 @@ #[cfg(test)] mod sync; +#[cfg(test)] +mod block_import; use std::collections::{VecDeque, HashSet, HashMap}; use std::sync::Arc; use parking_lot::RwLock; use client; -use client::error::Error as ClientError; use client::block_builder::BlockBuilder; +use runtime_primitives::Justification; use runtime_primitives::generic::BlockId; +use runtime_primitives::traits::{Block as BlockT, Zero, AuthorityIdFor}; use io::SyncIo; use protocol::{Context, Protocol, ProtocolContext}; use config::ProtocolConfig; -use service::TransactionPool; +use service::{NetworkLink, TransactionPool}; use network_libp2p::{NodeIndex, PeerId, Severity}; use keyring::Keyring; use codec::Encode; -use import_queue::{SyncImportQueue, PassThroughVerifier, Verifier}; -use consensus::BlockOrigin; +use consensus::{BlockImport, BlockOrigin, ImportBlock, ForkChoiceStrategy}; +use consensus::Error as ConsensusError; +use consensus::import_queue::{import_many_blocks, ImportQueue, ImportQueueStatus, IncomingBlock}; +use consensus::import_queue::{Link, SharedBlockImport, Verifier}; use specialization::NetworkSpecialization; use consensus_gossip::ConsensusGossip; -use import_queue::{BlockImport, ImportQueue}; use service::ExecuteInContext; use test_client; pub use test_client::runtime::{Block, Hash, Transfer, Extrinsic}; pub use test_client::TestClient; +#[cfg(any(test, feature = "test-helpers"))] +use std::cell::RefCell; + +#[cfg(any(test, feature = "test-helpers"))] +struct ImportCB(RefCell>) -> bool>>>); + +#[cfg(any(test, feature = "test-helpers"))] +impl ImportCB { + fn new() -> Self { + ImportCB(RefCell::new(None)) + } + fn set(&self, cb: Box) + where F: 'static + Fn(BlockOrigin, Vec>) -> bool + { + *self.0.borrow_mut() = Some(cb); + } + fn call(&self, origin: BlockOrigin, data: Vec>) -> bool { + let b = self.0.borrow(); + b.as_ref().expect("The Callback has been set before. qed.")(origin, data) + } +} + +#[cfg(any(test, feature = "test-helpers"))] +unsafe impl Send for ImportCB {} +#[cfg(any(test, feature = "test-helpers"))] +unsafe impl Sync for ImportCB {} + + +#[cfg(any(test, feature = "test-helpers"))] +/// A Verifier that accepts all blocks and passes them on with the configured +/// finality to be imported. +pub struct PassThroughVerifier(pub bool); + +#[cfg(any(test, feature = "test-helpers"))] +/// This Verifiyer accepts all data as valid +impl Verifier for PassThroughVerifier { + fn verify( + &self, + origin: BlockOrigin, + header: B::Header, + justification: Option, + body: Option> + ) -> Result<(ImportBlock, Option>>), String> { + Ok((ImportBlock { + origin, + header, + body, + finalized: self.0, + justification, + post_digests: vec![], + auxiliary: Vec::new(), + fork_choice: ForkChoiceStrategy::LongestChain, + }, None)) + } +} + +/// A link implementation that does nothing. +pub struct NoopLink; + +impl Link for NoopLink { } + +/// Blocks import queue that is importing blocks in the same thread. +/// The boolean value indicates whether blocks should be imported without instant finality. +#[cfg(any(test, feature = "test-helpers"))] +pub struct SyncImportQueue> { + verifier: Arc, + link: ImportCB, + block_import: SharedBlockImport, +} + +#[cfg(any(test, feature = "test-helpers"))] +impl> SyncImportQueue { + /// Create a new SyncImportQueue wrapping the given Verifier and block import + /// handle. + pub fn new(verifier: Arc, block_import: SharedBlockImport) -> Self { + let queue = SyncImportQueue { + verifier, + link: ImportCB::new(), + block_import, + }; + + let v = queue.verifier.clone(); + let import_handle = queue.block_import.clone(); + queue.link.set(Box::new(move |origin, new_blocks| { + let verifier = v.clone(); + import_many_blocks( + &*import_handle, + &NoopLink, + None, + (origin, new_blocks), + verifier, + ) + })); + + queue + } +} + +#[cfg(any(test, feature = "test-helpers"))] +impl> ImportQueue for SyncImportQueue +{ + fn start>( + &self, + link: L, + ) -> Result<(), std::io::Error> { + let v = self.verifier.clone(); + let import_handle = self.block_import.clone(); + self.link.set(Box::new(move |origin, new_blocks| { + let verifier = v.clone(); + import_many_blocks( + &*import_handle, + &link, + None, + (origin, new_blocks), + verifier, + ) + })); + Ok(()) + } + fn clear(&self) { } + + fn stop(&self) { } + + fn status(&self) -> ImportQueueStatus { + ImportQueueStatus { + importing_count: 0, + best_importing_number: Zero::zero(), + } + } + + fn is_importing(&self, _hash: &B::Hash) -> bool { + false + } + + fn import_blocks(&self, origin: BlockOrigin, blocks: Vec>) { + self.link.call(origin, blocks); + } +} + struct DummyContextExecutor(Arc>, Arc>>); unsafe impl Send for DummyContextExecutor {} unsafe impl Sync for DummyContextExecutor {} @@ -157,7 +300,7 @@ impl, D> Peer { // Update the sync state to the latest chain state. let info = self.client.info().expect("In-mem client does not fail"); let header = self.client.header(&BlockId::Hash(info.chain.best_hash)).unwrap().unwrap(); - let network_link = ::import_queue::NetworkLink { + let network_link = NetworkLink { sync: Arc::downgrade(self.sync.sync()), context: Arc::downgrade(&self.executor), }; @@ -237,8 +380,6 @@ impl, D> Peer { pub fn generate_blocks(&self, count: usize, origin: BlockOrigin, mut edit_block: F) where F: FnMut(BlockBuilder) -> Block { - use blocks::BlockData; - for _ in 0..count { let builder = self.client.new_block().unwrap(); let block = edit_block(builder); @@ -248,17 +389,15 @@ impl, D> Peer { // NOTE: if we use a non-synchronous queue in the test-net in the future, // this may not work. - self.import_queue.import_blocks(origin, vec![BlockData { + self.import_queue.import_blocks(origin, vec![ + IncomingBlock { origin: None, - block: ::message::BlockData:: { hash, header: Some(header), body: Some(block.extrinsics), - receipt: None, - message_queue: None, justification: None, }, - }]); + ]); } } @@ -330,7 +469,7 @@ pub trait TestNetFactory: Sized { /// Get custom block import handle for fresh client, along with peer data. fn make_block_import(&self, client: Arc) - -> (Arc + Send + Sync>, Self::PeerData) + -> (Arc + Send + Sync>, Self::PeerData) { (client, Default::default()) } diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 1489b046ba370..edd0f3731bceb 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -4,22 +4,21 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -crunchy = { version = "0.2", default-features = false } sr-std = { path = "../sr-std", default-features = false } parity-codec = { version = "2.1", default-features = false } parity-codec-derive = { version = "2.1", default-features = false } -fixed-hash = { version = "0.3.0", default-features = false } rustc-hex = { version = "2.0", default-features = false } serde = { version = "1.0", default-features = false } serde_derive = { version = "1.0", optional = true } -uint = { version = "0.5.0-beta", default-features = false } twox-hash = { version = "1.1.0", optional = true } byteorder = { version = "1.1", default-features = false } +primitive-types = { version = "0.1", default-features = false, features = ["codec"] } +impl-serde = { version = "0.1", optional = true } wasmi = { version = "0.4.2", optional = true } hash-db = { git = "https://github.com/paritytech/trie", default-features = false } hash256-std-hasher = { git = "https://github.com/paritytech/trie", default-features = false } -ring = { version = "0.12", optional = true } -untrusted = { version = "0.5", optional = true } +ring = { version = "0.13", optional = true } +untrusted = { version = "0.6", optional = true } hex-literal = { version = "0.1", optional = true } base58 = { version = "0.1", optional = true } blake2-rfc = { version = "0.2.18", optional = true } @@ -32,14 +31,14 @@ heapsize = "0.4" [features] default = ["std"] std = [ - "crunchy/std", "wasmi", - "uint/std", - "fixed-hash/std", - "fixed-hash/heapsize", - "fixed-hash/byteorder", - "fixed-hash/rustc-hex", - "fixed-hash/libc", + "primitive-types/std", + "primitive-types/serde", + "primitive-types/heapsize", + "primitive-types/byteorder", + "primitive-types/rustc-hex", + "primitive-types/libc", + "impl-serde", "parity-codec/std", "hash256-std-hasher/std", "hash-db/std", diff --git a/core/primitives/src/authority_id.rs b/core/primitives/src/authority_id.rs index 9f5e3c26ac234..7773e1a930711 100644 --- a/core/primitives/src/authority_id.rs +++ b/core/primitives/src/authority_id.rs @@ -14,24 +14,23 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . - #[cfg(feature = "std")] use serde::{Serialize, Serializer, Deserialize, Deserializer}; use H256; /// An identifier for an authority in the consensus algorithm. The same size as ed25519::Public. #[derive(Clone, Copy, PartialEq, Eq, Default, Encode, Decode)] -pub struct AuthorityId(pub [u8; 32]); +pub struct Ed25519AuthorityId(pub [u8; 32]); #[cfg(feature = "std")] -impl ::std::fmt::Display for AuthorityId { +impl ::std::fmt::Display for Ed25519AuthorityId { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { write!(f, "{}", ::ed25519::Public(self.0).to_ss58check()) } } #[cfg(feature = "std")] -impl ::std::fmt::Debug for AuthorityId { +impl ::std::fmt::Debug for Ed25519AuthorityId { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { let h = format!("{}", ::hexdisplay::HexDisplay::from(&self.0)); write!(f, "{} ({}…{})", ::ed25519::Public(self.0).to_ss58check(), &h[0..8], &h[60..]) @@ -39,57 +38,57 @@ impl ::std::fmt::Debug for AuthorityId { } #[cfg(feature = "std")] -impl ::std::hash::Hash for AuthorityId { +impl ::std::hash::Hash for Ed25519AuthorityId { fn hash(&self, state: &mut H) { self.0.hash(state); } } -impl AsRef<[u8; 32]> for AuthorityId { +impl AsRef<[u8; 32]> for Ed25519AuthorityId { fn as_ref(&self) -> &[u8; 32] { &self.0 } } -impl AsRef<[u8]> for AuthorityId { +impl AsRef<[u8]> for Ed25519AuthorityId { fn as_ref(&self) -> &[u8] { &self.0[..] } } -impl Into<[u8; 32]> for AuthorityId { +impl Into<[u8; 32]> for Ed25519AuthorityId { fn into(self) -> [u8; 32] { self.0 } } -impl From<[u8; 32]> for AuthorityId { +impl From<[u8; 32]> for Ed25519AuthorityId { fn from(a: [u8; 32]) -> Self { - AuthorityId(a) + Ed25519AuthorityId(a) } } -impl AsRef for AuthorityId { - fn as_ref(&self) -> &AuthorityId { +impl AsRef for Ed25519AuthorityId { + fn as_ref(&self) -> &Ed25519AuthorityId { &self } } -impl Into for AuthorityId { +impl Into for Ed25519AuthorityId { fn into(self) -> H256 { self.0.into() } } #[cfg(feature = "std")] -impl Serialize for AuthorityId { +impl Serialize for Ed25519AuthorityId { fn serialize(&self, serializer: S) -> Result where S: Serializer { ::ed25519::serialize(&self, serializer) } } #[cfg(feature = "std")] -impl<'de> Deserialize<'de> for AuthorityId { +impl<'de> Deserialize<'de> for Ed25519AuthorityId { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de> { ::ed25519::deserialize(deserializer) } diff --git a/core/primitives/src/bytes.rs b/core/primitives/src/bytes.rs deleted file mode 100644 index ea375a2530094..0000000000000 --- a/core/primitives/src/bytes.rs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2017-2018 Parity Technologies (UK) Ltd. -// This file is part of Substrate. - -// Substrate 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. - -// Substrate 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 Substrate. If not, see . - -//! Simple type for representing Vec with regards to serde. - -use core::fmt; - -use serde::{de, Serializer, Deserializer}; - -#[cfg(not(feature = "std"))] -mod alloc_types { - pub use ::alloc::string::String; - pub use ::alloc::vec::Vec; -} - -#[cfg(feature = "std")] -mod alloc_types { - pub use ::std::vec::Vec; - pub use ::std::string::String; -} - -pub use self::alloc_types::*; - -/// Serializes a slice of bytes. -pub fn serialize(bytes: &[u8], serializer: S) -> Result where - S: Serializer, -{ - let hex: String = ::rustc_hex::ToHex::to_hex(bytes); - serializer.serialize_str(&format!("0x{}", hex)) -} - -/// Serialize a slice of bytes as uint. -/// -/// The representation will have all leading zeros trimmed. -pub fn serialize_uint(bytes: &[u8], serializer: S) -> Result where - S: Serializer, -{ - let non_zero = bytes.iter().take_while(|b| **b == 0).count(); - let bytes = &bytes[non_zero..]; - if bytes.is_empty() { - return serializer.serialize_str("0x0"); - } - - let hex: String = ::rustc_hex::ToHex::to_hex(bytes); - let has_leading_zero = !hex.is_empty() && &hex[0..1] == "0"; - serializer.serialize_str( - &format!("0x{}", if has_leading_zero { &hex[1..] } else { &hex }) - ) -} - -/// Expected length of bytes vector. -#[derive(PartialEq, Eq)] -#[cfg_attr(feature = "std", derive(Debug))] -pub enum ExpectedLen { - /// Any length in bytes. - #[cfg_attr(not(feature = "std"), allow(unused))] - Any, - /// Exact length in bytes. - Exact(usize), - /// A bytes length between (min; max]. - Between(usize, usize), -} - -impl fmt::Display for ExpectedLen { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - match *self { - ExpectedLen::Any => write!(fmt, "even length"), - ExpectedLen::Exact(v) => write!(fmt, "length of {}", v * 2), - ExpectedLen::Between(min, max) => write!(fmt, "length between ({}; {}]", min * 2, max * 2), - } - } -} - -/// Deserialize into vector of bytes. -#[cfg(feature = "std")] -pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> where - D: Deserializer<'de>, -{ - deserialize_check_len(deserializer, ExpectedLen::Any) -} - -/// Deserialize into vector of bytes with additional size check. -pub fn deserialize_check_len<'de, D>(deserializer: D, len: ExpectedLen) -> Result, D::Error> where - D: Deserializer<'de>, -{ - struct Visitor { - len: ExpectedLen, - } - - impl<'a> de::Visitor<'a> for Visitor { - type Value = Vec; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "a 0x-prefixed hex string with {}", self.len) - } - - fn visit_str(self, v: &str) -> Result { - if v.len() < 2 || &v[0..2] != "0x" { - return Err(E::custom("prefix is missing")) - } - - let is_len_valid = match self.len { - // just make sure that we have all nibbles - ExpectedLen::Any => v.len() % 2 == 0, - ExpectedLen::Exact(len) => v.len() == 2 * len + 2, - ExpectedLen::Between(min, max) => v.len() <= 2 * max + 2 && v.len() > 2 * min + 2, - }; - - if !is_len_valid { - return Err(E::invalid_length(v.len() - 2, &self)) - } - - let bytes = match self.len { - ExpectedLen::Between(..) if v.len() % 2 != 0 => { - ::rustc_hex::FromHex::from_hex(&*format!("0{}", &v[2..])) - }, - _ => ::rustc_hex::FromHex::from_hex(&v[2..]) - }; - - #[cfg(feature = "std")] - fn format_err(e: ::rustc_hex::FromHexError) -> String { - format!("invalid hex value: {:?}", e) - } - - #[cfg(not(feature = "std"))] - fn format_err(e: ::rustc_hex::FromHexError) -> String { - match e { - ::rustc_hex::InvalidHexLength => format!("invalid hex value: invalid length"), - ::rustc_hex::InvalidHexCharacter(c, p) => - format!("invalid hex value: invalid character {} at position {}", c, p), - } - } - - bytes.map_err(|e| E::custom(format_err(e))) - } - - #[cfg(feature = "std")] - fn visit_string(self, v: String) -> Result { - self.visit_str(&v) - } - } - // TODO [ToDr] Use raw bytes if we switch to RLP / binencoding - // (visit_bytes, visit_bytes_buf) - deserializer.deserialize_str(Visitor { len }) -} diff --git a/core/primitives/src/ed25519.rs b/core/primitives/src/ed25519.rs index c6f28c64c1177..05077fbd37e80 100644 --- a/core/primitives/src/ed25519.rs +++ b/core/primitives/src/ed25519.rs @@ -21,7 +21,7 @@ use untrusted; use blake2_rfc; use ring::{rand, signature}; -use {hash::H512, AuthorityId}; +use {hash::H512, Ed25519AuthorityId}; use base58::{ToBase58, FromBase58}; #[cfg(feature = "std")] @@ -169,14 +169,14 @@ impl AsRef for Pair { } } -impl Into for Public { - fn into(self) -> AuthorityId { - AuthorityId(self.0) +impl Into for Public { + fn into(self) -> Ed25519AuthorityId { + Ed25519AuthorityId(self.0) } } -impl From for Public { - fn from(id: AuthorityId) -> Self { +impl From for Public { + fn from(id: Ed25519AuthorityId) -> Self { Public(id.0) } } diff --git a/core/primitives/src/hash.rs b/core/primitives/src/hash.rs index 8d04df26844db..98a906861fff5 100644 --- a/core/primitives/src/hash.rs +++ b/core/primitives/src/hash.rs @@ -16,65 +16,7 @@ //! A fixed hash type. -#[cfg(feature = "std")] -use serde::{Serialize, Serializer, Deserialize, Deserializer}; - -#[cfg(feature = "std")] -use bytes; - -macro_rules! impl_rest { - ($name: ident, $len: expr) => { - #[cfg(feature = "std")] - impl Serialize for $name { - fn serialize(&self, serializer: S) -> Result where S: Serializer { - bytes::serialize(&self.0, serializer) - } - } - - #[cfg(feature = "std")] - impl<'de> Deserialize<'de> for $name { - fn deserialize(deserializer: D) -> Result where D: Deserializer<'de> { - bytes::deserialize_check_len(deserializer, bytes::ExpectedLen::Exact($len)) - .map(|x| $name::from_slice(&x)) - } - } - - impl ::codec::Encode for $name { - fn using_encoded R>(&self, f: F) -> R { - self.0.using_encoded(f) - } - } - impl ::codec::Decode for $name { - fn decode(input: &mut I) -> Option { - <[u8; $len] as ::codec::Decode>::decode(input).map($name) - } - } - - #[cfg(feature = "std")] - impl From for $name { - fn from(val: u64) -> Self { - Self::from_low_u64_be(val) - } - } - } -} - -construct_fixed_hash!{ - /// Fixed-size uninterpreted hash type with 20 bytes (160 bits) size. - pub struct H160(20); -} -construct_fixed_hash!{ - /// Fixed-size uninterpreted hash type with 32 bytes (256 bits) size. - pub struct H256(32); -} -construct_fixed_hash!{ - /// Fixed-size uninterpreted hash type with 64 bytes (512 bits) size. - pub struct H512(64); -} - -impl_rest!(H160, 20); -impl_rest!(H256, 32); -impl_rest!(H512, 64); +pub use primitive_types::{H160, H256, H512}; /// Hash conversion. Used to convert between unbound associated hash types in traits, /// implemented by the same hash type. diff --git a/core/primitives/src/hexdisplay.rs b/core/primitives/src/hexdisplay.rs index f02b0f19b705f..b202fdf2e3fa9 100644 --- a/core/primitives/src/hexdisplay.rs +++ b/core/primitives/src/hexdisplay.rs @@ -57,7 +57,7 @@ impl AsBytesRef for [u8] { fn as_bytes_ref(&self) -> &[u8] { &self } } -impl AsBytesRef for ::bytes::Vec { +impl AsBytesRef for Vec { fn as_bytes_ref(&self) -> &[u8] { &self } } @@ -91,4 +91,3 @@ pub fn ascii_format(asciish: &[u8]) -> String { } r } - diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 1bbfaafb24138..98289ddc18939 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -21,12 +21,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), feature(alloc))] -#[macro_use] -extern crate crunchy; -#[macro_use] -extern crate fixed_hash; -#[macro_use] -extern crate uint as uint_crate; +extern crate primitive_types; #[macro_use] extern crate parity_codec_derive; @@ -51,6 +46,10 @@ extern crate untrusted; #[macro_use] extern crate hex_literal; +#[cfg(feature = "std")] +#[macro_use] +extern crate impl_serde; + #[cfg(feature = "std")] #[macro_use] extern crate serde_derive; @@ -84,7 +83,8 @@ use rstd::prelude::*; use rstd::ops::Deref; #[cfg(feature = "std")] -pub mod bytes; +pub use impl_serde::serialize as bytes; + #[cfg(feature = "std")] pub mod hashing; #[cfg(feature = "std")] @@ -109,7 +109,7 @@ mod tests; pub use self::hash::{H160, H256, H512, convert_hash}; pub use self::uint::U256; -pub use authority_id::AuthorityId; +pub use authority_id::Ed25519AuthorityId; pub use changes_trie::ChangesTrieConfiguration; pub use hash_db::Hasher; diff --git a/core/primitives/src/uint.rs b/core/primitives/src/uint.rs index 4727ed54bd069..0d46e81effc55 100644 --- a/core/primitives/src/uint.rs +++ b/core/primitives/src/uint.rs @@ -16,55 +16,7 @@ //! An unsigned fixed-size integer. -#[cfg(feature = "std")] -use serde::{Serialize, Serializer, Deserialize, Deserializer}; - -#[cfg(feature = "std")] -use bytes; - -macro_rules! impl_serde { - ($name: ident, $len: expr) => { - #[cfg(feature = "std")] - impl Serialize for $name { - fn serialize(&self, serializer: S) -> Result where S: Serializer { - let mut bytes = [0u8; $len * 8]; - self.to_big_endian(&mut bytes); - bytes::serialize_uint(&bytes, serializer) - } - } - - #[cfg(feature = "std")] - impl<'de> Deserialize<'de> for $name { - fn deserialize(deserializer: D) -> Result where D: Deserializer<'de> { - bytes::deserialize_check_len(deserializer, bytes::ExpectedLen::Between(0, $len * 8)) - .map(|x| (&*x).into()) - } - } - } -} - -macro_rules! impl_codec { - ($name: ident, $len: expr) => { - impl ::codec::Encode for $name { - fn using_encoded R>(&self, f: F) -> R { - let mut bytes = [0u8; $len * 8]; - self.to_little_endian(&mut bytes); - bytes.using_encoded(f) - } - } - - impl ::codec::Decode for $name { - fn decode(input: &mut I) -> Option { - <[u8; $len * 8] as ::codec::Decode>::decode(input) - .map(|b| $name::from_little_endian(&b)) - } - } - } -} - -construct_uint!(U256, 4); -impl_serde!(U256, 4); -impl_codec!(U256, 4); +pub use primitive_types::U256; #[cfg(test)] mod tests { diff --git a/core/service/Cargo.toml b/core/service/Cargo.toml index 2eb3e9bc85bd0..f8f2589c2c504 100644 --- a/core/service/Cargo.toml +++ b/core/service/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] [dependencies] futures = "0.1.17" -parking_lot = "0.4" +parking_lot = "0.7.1" error-chain = "0.12" lazy_static = "1.0" log = "0.4" @@ -21,7 +21,6 @@ sr-io = { path = "../../core/sr-io" } sr-primitives = { path = "../../core/sr-primitives" } substrate-primitives = { path = "../../core/primitives" } substrate-consensus-common = { path = "../../core/consensus/common" } -substrate-consensus-aura-primitives = { path = "../../core/consensus/aura/primitives" } substrate-network = { path = "../../core/network" } substrate-client = { path = "../../core/client" } substrate-client-db = { path = "../../core/client/db" } diff --git a/core/service/src/chain_ops.rs b/core/service/src/chain_ops.rs index 6d6dc558f41f8..15a4deb42a041 100644 --- a/core/service/src/chain_ops.rs +++ b/core/service/src/chain_ops.rs @@ -21,7 +21,7 @@ use futures::Future; use runtime_primitives::generic::{SignedBlock, BlockId}; use runtime_primitives::traits::{As, Block, Header}; -use network::import_queue::{ImportQueue, Link, BlockData}; +use consensus_common::import_queue::{ImportQueue, IncomingBlock, Link}; use network::message; use consensus_common::BlockOrigin; @@ -123,7 +123,15 @@ pub fn import_blocks(mut config: FactoryFullConfiguration, exit: E, message_queue: None }; // import queue handles verification and importing it into the client - queue.import_blocks(BlockOrigin::File, vec![BlockData:: { block, origin: None }]); + queue.import_blocks(BlockOrigin::File, vec![ + IncomingBlock::{ + hash: block.hash, + header: block.header, + body: block.body, + justification: block.justification, + origin: None, + } + ]); } else { warn!("Error reading block data at {}.", b); break; diff --git a/core/service/src/components.rs b/core/service/src/components.rs index 343a71563d6be..45c90109f6be4 100644 --- a/core/service/src/components.rs +++ b/core/service/src/components.rs @@ -23,10 +23,11 @@ use chain_spec::ChainSpec; use client_db; use client::{self, Client, runtime_api::{/*Metadata,*/ TaggedTransactionQueue}}; use {error, Service/*, maybe_start_server*/}; -use network::{self, OnDemand, import_queue::ImportQueue}; +use network::{self, OnDemand}; +use consensus_common::import_queue::ImportQueue; use substrate_executor::{NativeExecutor, NativeExecutionDispatch}; use transaction_pool::txpool::{self, Options as TransactionPoolOptions, Pool as TransactionPool}; -use runtime_primitives::{BuildStorage, traits::{Block as BlockT, Header as HeaderT, ProvideRuntimeApi}, generic::{BlockId, /*SignedBlock*/}}; +use runtime_primitives::{BuildStorage, traits::{Block as BlockT, Header as HeaderT, ProvideRuntimeApi}, generic::BlockId}; use config::Configuration; use primitives::{Blake2Hasher, H256}; //use rpc::{self, apis::system::SystemInfo}; @@ -136,7 +137,6 @@ pub trait StartRPC { impl StartRPC for C where C::RuntimeApi: Metadata>, - for<'de> SignedBlock>: ::serde::Deserialize<'de>, { type ServersHandle = (Option, Option>); @@ -281,9 +281,9 @@ pub trait ServiceFactory: 'static + Sized { /// Extended light service type. type LightService: ServiceTrait>; /// ImportQueue for full client - type FullImportQueue: network::import_queue::ImportQueue + 'static; + type FullImportQueue: consensus_common::import_queue::ImportQueue + 'static; /// ImportQueue for light clients - type LightImportQueue: network::import_queue::ImportQueue + 'static; + type LightImportQueue: consensus_common::import_queue::ImportQueue + 'static; //TODO: replace these with a constructor trait. that TransactionPool implements. (#1242) /// Extrinsic pool constructor for the full client. diff --git a/core/service/src/lib.rs b/core/service/src/lib.rs index c64308270bef1..18097e87e071a 100644 --- a/core/service/src/lib.rs +++ b/core/service/src/lib.rs @@ -34,7 +34,7 @@ extern crate substrate_client as client; extern crate substrate_client_db as client_db; extern crate parity_codec as codec; extern crate substrate_transaction_pool as transaction_pool; -extern crate substrate_consensus_aura_primitives as aura_primitives; +//extern crate substrate_consensus_aura_primitives as aura_primitives; //extern crate substrate_rpc_servers as rpc; extern crate target_info; extern crate tokio; @@ -58,7 +58,6 @@ mod error; mod chain_spec; pub mod config; pub mod chain_ops; -pub mod consensus; //use std::io; //use std::net::SocketAddr; @@ -82,7 +81,6 @@ pub use chain_spec::{ChainSpec, Properties}; pub use transaction_pool::txpool::{self, Pool as TransactionPool, Options as TransactionPoolOptions, ChainApi, IntoPoolError}; pub use client::ExecutionStrategy; -pub use consensus::ProposerFactory; pub use components::{ServiceFactory, FullBackend, FullExecutor, LightBackend, LightExecutor, Components, PoolApi, ComponentClient, ComponentBlock, FullClient, LightClient, FullComponents, LightComponents, @@ -108,7 +106,7 @@ pub struct Service { /// Configuration of this Service pub config: FactoryFullConfiguration, //_rpc: Box<::std::any::Any + Send + Sync>, - _telemetry: Option, + _telemetry: Option>, } /// Creates bare client without any networking. @@ -257,31 +255,28 @@ impl Service { )?; */ // Telemetry - let telemetry = match config.telemetry_url.clone() { - Some(url) => { - let is_authority = config.roles == Roles::AUTHORITY; - let pubkey = format!("{}", public_key); - let name = config.name.clone(); - let impl_name = config.impl_name.to_owned(); - let version = version.clone(); - let chain_name = config.chain_spec.name().to_owned(); - Some(tel::init_telemetry(tel::TelemetryConfig { - url: url, - on_connect: Box::new(move || { - telemetry!("system.connected"; - "name" => name.clone(), - "implementation" => impl_name.clone(), - "version" => version.clone(), - "config" => "", - "chain" => chain_name.clone(), - "pubkey" => &pubkey, - "authority" => is_authority - ); - }), - })) - }, - None => None, - }; + let telemetry = config.telemetry_url.clone().map(|url| { + let is_authority = config.roles == Roles::AUTHORITY; + let pubkey = format!("{}", public_key); + let name = config.name.clone(); + let impl_name = config.impl_name.to_owned(); + let version = version.clone(); + let chain_name = config.chain_spec.name().to_owned(); + Arc::new(tel::init_telemetry(tel::TelemetryConfig { + url: url, + on_connect: Box::new(move || { + telemetry!("system.connected"; + "name" => name.clone(), + "implementation" => impl_name.clone(), + "version" => version.clone(), + "config" => "", + "chain" => chain_name.clone(), + "pubkey" => &pubkey, + "authority" => is_authority + ); + }), + })) + }); Ok(Service { client, @@ -308,6 +303,10 @@ impl Service { None } } + + pub fn telemetry(&self) -> Option> { + self._telemetry.as_ref().map(|t| t.clone()) + } } impl Service where Components: components::Components { diff --git a/core/service/test/src/lib.rs b/core/service/test/src/lib.rs index d5aafbe675606..4335bffe86551 100644 --- a/core/service/test/src/lib.rs +++ b/core/service/test/src/lib.rs @@ -33,7 +33,7 @@ use std::iter; use std::sync::Arc; use std::net::Ipv4Addr; use std::time::Duration; -use futures::Stream; +use futures::{Future, Stream}; use tempdir::TempDir; use tokio::runtime::Runtime; use tokio::timer::Interval; @@ -188,7 +188,7 @@ pub fn connectivity(spec: FactoryChainSpec) wher const NUM_NODES: u32 = 10; { let temp = TempDir::new("substrate-connectivity-test").expect("Error creating test dir"); - { + let runtime = { let mut network = TestNet::::new(&temp, spec.clone(), NUM_NODES, 0, vec![], 30400); info!("Checking star topology"); let first_address = network.full_nodes[0].1.network().node_id().expect("No node address"); @@ -198,13 +198,17 @@ pub fn connectivity(spec: FactoryChainSpec) wher network.run_until_all_full(|_index, service| service.network().status().num_peers == NUM_NODES as usize - 1 ); - } + network.runtime + }; + + runtime.shutdown_on_idle().wait().expect("Error shutting down runtime"); + temp.close().expect("Error removing temp dir"); } { let temp = TempDir::new("substrate-connectivity-test").expect("Error creating test dir"); { - let mut network = TestNet::::new(&temp, spec, NUM_NODES, 0, vec![], 30500); + let mut network = TestNet::::new(&temp, spec, NUM_NODES, 0, vec![], 30400); info!("Checking linked topology"); let mut address = network.full_nodes[0].1.network().node_id().expect("No node address"); for (_, service) in network.full_nodes.iter().skip(1) { diff --git a/core/sr-api-macros/tests/decl_and_impl.rs b/core/sr-api-macros/tests/decl_and_impl.rs index 47822e538beb3..699c8c01cf315 100644 --- a/core/sr-api-macros/tests/decl_and_impl.rs +++ b/core/sr-api-macros/tests/decl_and_impl.rs @@ -4,9 +4,8 @@ extern crate sr_primitives as runtime_primitives; extern crate substrate_primitives as primitives; extern crate substrate_test_client as test_client; -use runtime_primitives::traits::{GetNodeBlockType, Block as BlockT}; +use runtime_primitives::traits::{GetNodeBlockType, Block as BlockT, AuthorityIdFor}; use runtime_primitives::generic::BlockId; -use primitives::AuthorityId; use substrate_client::runtime_api::{self, RuntimeApiInfo}; use substrate_client::error::Result; use test_client::runtime::Block; @@ -57,7 +56,7 @@ impl_runtime_apis! { fn version() -> runtime_api::RuntimeVersion { unimplemented!() } - fn authorities() -> Vec { + fn authorities() -> Vec> { unimplemented!() } fn execute_block(_: Block) { diff --git a/core/sr-io/without_std.rs b/core/sr-io/without_std.rs index d0f112b76e8bf..6cc5a15d7f280 100644 --- a/core/sr-io/without_std.rs +++ b/core/sr-io/without_std.rs @@ -53,11 +53,23 @@ pub extern fn oom(_: ::core::alloc::Layout) -> ! { } } +/// Host functions, provided by the executor. +/// A WebAssembly runtime module would "import" these to access the execution environment +/// (most importantly, storage) or perform heavy hash calculations. +/// See also "ext_" functions in sr-sandbox and sr-std extern "C" { + /// Most of the functions below return fixed-size arrays (e.g. hashes) by writing them into + /// memory regions that should be preallocated by module. + /// Functions that return variable-sized data use host-side allocations. These should be + /// manually freed by the module. fn ext_free(addr: *mut u8); + + /// Printing, useful for debugging fn ext_print_utf8(utf8_data: *const u8, utf8_len: u32); fn ext_print_hex(data: *const u8, len: u32); fn ext_print_num(value: u64); + + /// Host storage access and verification fn ext_set_storage(key_data: *const u8, key_len: u32, value_data: *const u8, value_len: u32); fn ext_set_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32, value_data: *const u8, value_len: u32); fn ext_clear_storage(key_data: *const u8, key_len: u32); @@ -66,18 +78,26 @@ extern "C" { fn ext_exists_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32) -> u32; fn ext_clear_prefix(prefix_data: *const u8, prefix_len: u32); fn ext_kill_child_storage(storage_key_data: *const u8, storage_key_len: u32); + /// Host-side result allocation fn ext_get_allocated_storage(key_data: *const u8, key_len: u32, written_out: *mut u32) -> *mut u8; + /// Host-side result allocation fn ext_get_allocated_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32, written_out: *mut u32) -> *mut u8; fn ext_get_storage_into(key_data: *const u8, key_len: u32, value_data: *mut u8, value_len: u32, value_offset: u32) -> u32; fn ext_get_child_storage_into(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32, value_data: *mut u8, value_len: u32, value_offset: u32) -> u32; fn ext_storage_root(result: *mut u8); - fn ext_child_storage_root(storage_key_data: *const u8, storage_key_len: u32, written_out: *mut u32) -> *mut u8; + /// Host-side result allocation + fn ext_child_storage_root(storage_key_data: *const u8, storage_key_len: u32, written_out: *mut u32) -> *mut u8; fn ext_storage_changes_root(parent_hash_data: *const u8, parent_hash_len: u32, parent_num: u64, result: *mut u8) -> u32; - fn ext_blake2_256_enumerated_trie_root(values_data: *const u8, lens_data: *const u32, lens_len: u32, result: *mut u8); + + /// The current relay chain identifier. fn ext_chain_id() -> u64; + + /// Hash calculation and verification + fn ext_blake2_256_enumerated_trie_root(values_data: *const u8, lens_data: *const u32, lens_len: u32, result: *mut u8); fn ext_blake2_256(data: *const u8, len: u32, out: *mut u8); fn ext_twox_128(data: *const u8, len: u32, out: *mut u8); fn ext_twox_256(data: *const u8, len: u32, out: *mut u8); + /// Note: ext_ed25519_verify returns 0 if the signature is correct, nonzero otherwise. fn ext_ed25519_verify(msg_data: *const u8, msg_len: u32, sig_data: *const u8, pubkey_data: *const u8) -> u32; } diff --git a/core/sr-primitives/src/generic/block.rs b/core/sr-primitives/src/generic/block.rs index df9f656513edb..390bd22af5995 100644 --- a/core/sr-primitives/src/generic/block.rs +++ b/core/sr-primitives/src/generic/block.rs @@ -19,10 +19,6 @@ #[cfg(feature = "std")] use std::fmt; -#[cfg(feature = "std")] -use serde::{Deserialize, Deserializer}; -#[cfg(feature = "std")] -use codec::Decode; use rstd::prelude::*; use codec::Codec; use traits::{self, Member, Block as BlockT, Header as HeaderT, MaybeSerialize}; @@ -73,17 +69,6 @@ pub struct Block { pub extrinsics: Vec, } -// TODO: Remove Deserialize for Block once RPC no longer needs it #1098 -#[cfg(feature = "std")] -impl<'a, Header: 'a, Extrinsic: 'a + MaybeSerialize> Deserialize<'a> for Block where - Block: Decode, -{ - fn deserialize>(de: D) -> Result { - let r = >::deserialize(de)?; - Decode::decode(&mut &r[..]).ok_or(::serde::de::Error::custom("Invalid value passed into decode")) - } -} - impl traits::Block for Block where Header: HeaderT, @@ -118,16 +103,3 @@ pub struct SignedBlock { /// Block justification. pub justification: Option, } - -// TODO: Remove Deserialize for SignedBlock once RPC no longer needs it #1098 -#[cfg(feature = "std")] -impl<'a, Block: BlockT,> Deserialize<'a> for SignedBlock where - Block::Header: 'a, - Block::Extrinsic: 'a + Codec + MaybeSerialize, - SignedBlock: Decode, -{ - fn deserialize>(de: D) -> Result { - let r = >::deserialize(de)?; - Decode::decode(&mut &r[..]).ok_or(::serde::de::Error::custom("Invalid value passed into decode")) - } -} diff --git a/core/sr-primitives/src/generic/digest.rs b/core/sr-primitives/src/generic/digest.rs index ea2dafb758411..f2185c23dbdd5 100644 --- a/core/sr-primitives/src/generic/digest.rs +++ b/core/sr-primitives/src/generic/digest.rs @@ -19,7 +19,7 @@ use rstd::prelude::*; use codec::{Decode, Encode, Codec, Input}; -use traits::{self, Member, DigestItem as DigestItemT, MaybeSerializeDebug}; +use traits::{self, Member, DigestItem as DigestItemT, MaybeSerializeDebug, MaybeHash}; use substrate_primitives::hash::H512 as Signature; @@ -124,7 +124,7 @@ impl DigestItem { impl< Hash: Codec + Member + MaybeSerializeDebug, - AuthorityId: Codec + Member + MaybeSerializeDebug + AuthorityId: Codec + Member + MaybeSerializeDebug + MaybeHash > traits::DigestItem for DigestItem { type Hash = Hash; type AuthorityId = AuthorityId; @@ -133,7 +133,7 @@ impl< self.dref().as_authorities_change() } - fn as_changes_trie_root(&self) -> Option<&Hash> { + fn as_changes_trie_root(&self) -> Option<&Self::Hash> { self.dref().as_changes_trie_root() } } diff --git a/core/sr-primitives/src/generic/header.rs b/core/sr-primitives/src/generic/header.rs index ec70d5d66ba5f..3fed9e600dc18 100644 --- a/core/sr-primitives/src/generic/header.rs +++ b/core/sr-primitives/src/generic/header.rs @@ -16,9 +16,6 @@ //! Generic implementation of a block header. -#[cfg(feature = "std")] -use serde::{Deserialize, Deserializer}; - use codec::{Decode, Encode, Codec, Input, Output, HasCompact}; use traits::{self, Member, SimpleArithmetic, SimpleBitOps, MaybeDisplay, Hash as HashT, DigestItem as DigestItemT, MaybeSerializeDebug, MaybeSerializeDebugButNotDeserialize}; @@ -42,17 +39,6 @@ pub struct Header { pub digest: Digest, } -// TODO: Remove Deserialize for Header once RPC no longer needs it #1098 -#[cfg(feature = "std")] -impl<'a, Number: 'a, Hash: 'a + HashT, DigestItem: 'a> Deserialize<'a> for Header where - Header: Decode, -{ - fn deserialize>(de: D) -> Result { - let r = >::deserialize(de)?; - Decode::decode(&mut &r[..]).ok_or(::serde::de::Error::custom("Invalid value passed into decode")) - } -} - impl Decode for Header where Number: HasCompact, Hash: HashT, diff --git a/core/sr-primitives/src/generic/mod.rs b/core/sr-primitives/src/generic/mod.rs index 69b317f6eeade..1e1778204ab16 100644 --- a/core/sr-primitives/src/generic/mod.rs +++ b/core/sr-primitives/src/generic/mod.rs @@ -20,6 +20,7 @@ mod unchecked_extrinsic; mod unchecked_mortal_extrinsic; +mod unchecked_mortal_compact_extrinsic; mod era; mod checked_extrinsic; mod header; @@ -30,6 +31,7 @@ mod tests; pub use self::unchecked_extrinsic::UncheckedExtrinsic; pub use self::unchecked_mortal_extrinsic::UncheckedMortalExtrinsic; +pub use self::unchecked_mortal_compact_extrinsic::UncheckedMortalCompactExtrinsic; pub use self::era::Era; pub use self::checked_extrinsic::CheckedExtrinsic; pub use self::header::Header; diff --git a/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs b/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs new file mode 100644 index 0000000000000..9ffac3d3f9a6c --- /dev/null +++ b/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs @@ -0,0 +1,290 @@ +// Copyright 2017-2018 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate 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. + +// Substrate 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 Substrate. If not, see . + +//! Generic implementation of an unchecked (pre-verification) extrinsic. + +#[cfg(feature = "std")] +use std::fmt; + +use rstd::prelude::*; +use codec::{Decode, Encode, Input, Compact}; +use traits::{self, Member, SimpleArithmetic, MaybeDisplay, CurrentHeight, BlockNumberToHash, Lookup, + Checkable, Extrinsic}; +use super::{CheckedExtrinsic, Era}; + +const TRANSACTION_VERSION: u8 = 1; + +/// A extrinsic right from the external world. This is unchecked and so +/// can contain a signature. +#[derive(PartialEq, Eq, Clone)] +pub struct UncheckedMortalCompactExtrinsic { + /// The signature, address, number of extrinsics have come before from + /// the same signer and an era describing the longevity of this transaction, + /// if this is a signed extrinsic. + pub signature: Option<(Address, Signature, Compact, Era)>, + /// The function that should be called. + pub function: Call, +} + +impl UncheckedMortalCompactExtrinsic { + /// New instance of a signed extrinsic aka "transaction". + pub fn new_signed(index: Index, function: Call, signed: Address, signature: Signature, era: Era) -> Self { + UncheckedMortalCompactExtrinsic { + signature: Some((signed, signature, index.into(), era)), + function, + } + } + + /// New instance of an unsigned extrinsic aka "inherent". + pub fn new_unsigned(function: Call) -> Self { + UncheckedMortalCompactExtrinsic { + signature: None, + function, + } + } +} + +impl Extrinsic for UncheckedMortalCompactExtrinsic { + fn is_signed(&self) -> Option { + Some(self.signature.is_some()) + } +} + +impl Checkable + for UncheckedMortalCompactExtrinsic +where + Address: Member + MaybeDisplay, + Index: Member + MaybeDisplay + SimpleArithmetic, + Compact: Encode, + Call: Encode + Member, + Signature: Member + traits::Verify, + AccountId: Member + MaybeDisplay, + BlockNumber: SimpleArithmetic, + Hash: Encode, + Context: Lookup + + CurrentHeight + + BlockNumberToHash, +{ + type Checked = CheckedExtrinsic; + + fn check(self, context: &Context) -> Result { + Ok(match self.signature { + Some((signed, signature, index, era)) => { + let h = context.block_number_to_hash(BlockNumber::sa(era.birth(context.current_height().as_()))) + .ok_or("transaction birth block ancient")?; + let payload = (index, self.function, era, h); + let signed = context.lookup(signed)?; + if !::verify_encoded_lazy(&signature, &payload, &signed) { + return Err("bad signature in extrinsic") + } + CheckedExtrinsic { + signed: Some((signed, (payload.0).0)), + function: payload.1, + } + } + None => CheckedExtrinsic { + signed: None, + function: self.function, + }, + }) + } +} + +impl Decode + for UncheckedMortalCompactExtrinsic +where + Address: Decode, + Signature: Decode, + Compact: Decode, + Call: Decode, +{ + fn decode(input: &mut I) -> Option { + // This is a little more complicated than usual since the binary format must be compatible + // with substrate's generic `Vec` type. Basically this just means accepting that there + // will be a prefix of vector length (we don't need + // to use this). + let _length_do_not_remove_me_see_above: Vec<()> = Decode::decode(input)?; + + let version = input.read_byte()?; + + let is_signed = version & 0b1000_0000 != 0; + let version = version & 0b0111_1111; + if version != TRANSACTION_VERSION { + return None + } + + Some(UncheckedMortalCompactExtrinsic { + signature: if is_signed { Some(Decode::decode(input)?) } else { None }, + function: Decode::decode(input)?, + }) + } +} + +impl Encode + for UncheckedMortalCompactExtrinsic +where + Address: Encode, + Signature: Encode, + Compact: Encode, + Call: Encode, +{ + fn encode(&self) -> Vec { + super::encode_with_vec_prefix::(|v| { + // 1 byte version id. + match self.signature.as_ref() { + Some(s) => { + v.push(TRANSACTION_VERSION | 0b1000_0000); + s.encode_to(v); + } + None => { + v.push(TRANSACTION_VERSION & 0b0111_1111); + } + } + self.function.encode_to(v); + }) + } +} + +#[cfg(feature = "std")] +impl serde::Serialize + for UncheckedMortalCompactExtrinsic + where Compact: Encode +{ + fn serialize(&self, seq: S) -> Result where S: ::serde::Serializer { + self.using_encoded(|bytes| seq.serialize_bytes(bytes)) + } +} + +/// TODO: use derive when possible. +#[cfg(feature = "std")] +impl fmt::Debug for UncheckedMortalCompactExtrinsic where + Address: fmt::Debug, + Index: fmt::Debug, + Call: fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "UncheckedMortalCompactExtrinsic({:?}, {:?})", self.signature.as_ref().map(|x| (&x.0, &x.2)), self.function) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + struct TestContext; + impl Lookup for TestContext { + type Source = u64; + type Target = u64; + fn lookup(&self, s: u64) -> Result { Ok(s) } + } + impl CurrentHeight for TestContext { + type BlockNumber = u64; + fn current_height(&self) -> u64 { 42 } + } + impl BlockNumberToHash for TestContext { + type BlockNumber = u64; + type Hash = u64; + fn block_number_to_hash(&self, n: u64) -> Option { Some(n) } + } + + #[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Encode, Decode)] + struct TestSig(u64, Vec); + impl traits::Verify for TestSig { + type Signer = u64; + fn verify>(&self, mut msg: L, signer: &Self::Signer) -> bool { + *signer == self.0 && msg.get() == &self.1[..] + } + } + + const DUMMY_FUNCTION: u64 = 0; + const DUMMY_ACCOUNTID: u64 = 0; + + type Ex = UncheckedMortalCompactExtrinsic; + type CEx = CheckedExtrinsic; + + #[test] + fn unsigned_codec_should_work() { + let ux = Ex::new_unsigned(DUMMY_FUNCTION); + let encoded = ux.encode(); + assert_eq!(Ex::decode(&mut &encoded[..]), Some(ux)); + } + + #[test] + fn signed_codec_should_work() { + let ux = Ex::new_signed(0, DUMMY_FUNCTION, DUMMY_ACCOUNTID, TestSig(DUMMY_ACCOUNTID, (DUMMY_ACCOUNTID, DUMMY_FUNCTION, Era::immortal(), 0u64).encode()), Era::immortal()); + let encoded = ux.encode(); + assert_eq!(Ex::decode(&mut &encoded[..]), Some(ux)); + } + + #[test] + fn unsigned_check_should_work() { + let ux = Ex::new_unsigned(DUMMY_FUNCTION); + assert!(!ux.is_signed().unwrap_or(false)); + assert!(>::check(ux, &TestContext).is_ok()); + } + + #[test] + fn badly_signed_check_should_fail() { + let ux = Ex::new_signed(0, DUMMY_FUNCTION, DUMMY_ACCOUNTID, TestSig(DUMMY_ACCOUNTID, vec![0u8]), Era::immortal()); + assert!(ux.is_signed().unwrap_or(false)); + assert_eq!(>::check(ux, &TestContext), Err("bad signature in extrinsic")); + } + + #[test] + fn immortal_signed_check_should_work() { + let ux = Ex::new_signed(0, DUMMY_FUNCTION, DUMMY_ACCOUNTID, TestSig(DUMMY_ACCOUNTID, (Compact::from(DUMMY_ACCOUNTID), DUMMY_FUNCTION, Era::immortal(), 0u64).encode()), Era::immortal()); + assert!(ux.is_signed().unwrap_or(false)); + assert_eq!(>::check(ux, &TestContext), Ok(CEx { signed: Some((DUMMY_ACCOUNTID, 0)), function: DUMMY_FUNCTION })); + } + + #[test] + fn mortal_signed_check_should_work() { + let ux = Ex::new_signed(0, DUMMY_FUNCTION, DUMMY_ACCOUNTID, TestSig(DUMMY_ACCOUNTID, (Compact::from(DUMMY_ACCOUNTID), DUMMY_FUNCTION, Era::mortal(32, 42), 42u64).encode()), Era::mortal(32, 42)); + assert!(ux.is_signed().unwrap_or(false)); + assert_eq!(>::check(ux, &TestContext), Ok(CEx { signed: Some((DUMMY_ACCOUNTID, 0)), function: DUMMY_FUNCTION })); + } + + #[test] + fn later_mortal_signed_check_should_work() { + let ux = Ex::new_signed(0, DUMMY_FUNCTION, DUMMY_ACCOUNTID, TestSig(DUMMY_ACCOUNTID, (Compact::from(DUMMY_ACCOUNTID), DUMMY_FUNCTION, Era::mortal(32, 11), 11u64).encode()), Era::mortal(32, 11)); + assert!(ux.is_signed().unwrap_or(false)); + assert_eq!(>::check(ux, &TestContext), Ok(CEx { signed: Some((DUMMY_ACCOUNTID, 0)), function: DUMMY_FUNCTION })); + } + + #[test] + fn too_late_mortal_signed_check_should_fail() { + let ux = Ex::new_signed(0, DUMMY_FUNCTION, DUMMY_ACCOUNTID, TestSig(DUMMY_ACCOUNTID, (DUMMY_ACCOUNTID, DUMMY_FUNCTION, Era::mortal(32, 10), 10u64).encode()), Era::mortal(32, 10)); + assert!(ux.is_signed().unwrap_or(false)); + assert_eq!(>::check(ux, &TestContext), Err("bad signature in extrinsic")); + } + + #[test] + fn too_early_mortal_signed_check_should_fail() { + let ux = Ex::new_signed(0, DUMMY_FUNCTION, DUMMY_ACCOUNTID, TestSig(DUMMY_ACCOUNTID, (DUMMY_ACCOUNTID, DUMMY_FUNCTION, Era::mortal(32, 43), 43u64).encode()), Era::mortal(32, 43)); + assert!(ux.is_signed().unwrap_or(false)); + assert_eq!(>::check(ux, &TestContext), Err("bad signature in extrinsic")); + } + + #[test] + fn encoding_matches_vec() { + let ex = Ex::new_unsigned(DUMMY_FUNCTION); + let encoded = ex.encode(); + let decoded = Ex::decode(&mut encoded.as_slice()).unwrap(); + assert_eq!(decoded, ex); + let as_vec: Vec = Decode::decode(&mut encoded.as_slice()).unwrap(); + assert_eq!(as_vec.encode(), encoded); + } +} diff --git a/core/sr-primitives/src/testing.rs b/core/sr-primitives/src/testing.rs index acbcd9241dc4f..f552600de9100 100644 --- a/core/sr-primitives/src/testing.rs +++ b/core/sr-primitives/src/testing.rs @@ -19,12 +19,30 @@ use serde::{Serialize, Serializer, Deserialize, de::Error as DeError, Deserializer}; use std::{fmt::Debug, ops::Deref, fmt}; use codec::{Codec, Encode, Decode}; -use traits::{self, Checkable, Applyable, BlakeTwo256}; +use traits::{self, Checkable, Applyable, BlakeTwo256, Convert}; use generic::DigestItem as GenDigestItem; -pub use substrate_primitives::{H256, AuthorityId}; +pub use substrate_primitives::{H256, Ed25519AuthorityId}; +use substrate_primitives::U256; -pub type DigestItem = GenDigestItem; +#[derive(Default, PartialEq, Eq, Clone, Decode, Encode, Debug)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct UintAuthorityId(pub u64); +impl Into for UintAuthorityId { + fn into(self) -> Ed25519AuthorityId { + let bytes: [u8; 32] = U256::from(self.0).into(); + Ed25519AuthorityId(bytes) + } +} + +pub struct ConvertUintAuthorityId; +impl Convert for ConvertUintAuthorityId { + fn convert(a: u64) -> UintAuthorityId { + UintAuthorityId(a) + } +} + +pub type DigestItem = GenDigestItem; #[derive(Default, PartialEq, Eq, Clone, Serialize, Debug, Encode, Decode)] pub struct Digest { diff --git a/core/sr-primitives/src/traits.rs b/core/sr-primitives/src/traits.rs index 8bdfd7eda6e10..67e441c792447 100644 --- a/core/sr-primitives/src/traits.rs +++ b/core/sr-primitives/src/traits.rs @@ -413,6 +413,16 @@ pub trait MaybeDisplay {} #[cfg(not(feature = "std"))] impl MaybeDisplay for T {} +#[cfg(feature = "std")] +pub trait MaybeHash: ::rstd::hash::Hash {} +#[cfg(feature = "std")] +impl MaybeHash for T {} + +#[cfg(not(feature = "std"))] +pub trait MaybeHash {} +#[cfg(not(feature = "std"))] +impl MaybeHash for T {} + #[cfg(feature = "std")] pub trait MaybeDecode: ::codec::Decode {} #[cfg(feature = "std")] @@ -431,7 +441,7 @@ impl Mem /// `parent_hash`, as well as a `digest` and a block `number`. /// /// You can also create a `new` one from those fields. -pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebug + 'static { +pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebugButNotDeserialize + 'static { type Number: Member + MaybeSerializeDebug + ::rstd::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec; type Hash: Member + MaybeSerializeDebug + ::rstd::hash::Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>; type Hashing: Hash; @@ -471,7 +481,7 @@ pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebug + 'stat /// `Extrinsic` piece of information as well as a `Header`. /// /// You can get an iterator over each of the `extrinsics` and retrieve the `header`. -pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebug + 'static { +pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebugButNotDeserialize + 'static { type Extrinsic: Member + Codec + Extrinsic + MaybeSerialize; type Header: Header; type Hash: Member + MaybeSerializeDebug + ::rstd::hash::Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>; @@ -500,6 +510,8 @@ pub type NumberFor = <::Header as Header>::Number; pub type DigestFor = <::Header as Header>::Digest; /// Extract the digest item type for a block. pub type DigestItemFor = as Digest>::Item; +/// Extract the authority ID type for a block. +pub type AuthorityIdFor = as DigestItem>::AuthorityId; /// A "checkable" piece of information, used by the standard Substrate Executive in order to /// check the validity of a piece of extrinsic information, usually by verifying the signature. @@ -575,7 +587,7 @@ pub trait Digest: Member + MaybeSerializeDebugButNotDeserialize + Default { /// If the runtime does not supports some 'system' items, use `()` as a stub. pub trait DigestItem: Codec + Member + MaybeSerializeDebugButNotDeserialize { type Hash: Member + MaybeSerializeDebugButNotDeserialize; - type AuthorityId: Member + MaybeSerializeDebugButNotDeserialize; + type AuthorityId: Member + MaybeSerializeDebugButNotDeserialize + MaybeHash + codec::Encode + codec::Decode; /// Returns Some if the entry is the `AuthoritiesChange` entry. fn as_authorities_change(&self) -> Option<&[Self::AuthorityId]>; diff --git a/core/state-db/Cargo.toml b/core/state-db/Cargo.toml index bef12d1ae6a61..1806bce40385d 100644 --- a/core/state-db/Cargo.toml +++ b/core/state-db/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -parking_lot = "0.5" +parking_lot = "0.7.1" log = "0.4" substrate-primitives = { path = "../../core/primitives" } parity-codec = "2.1" diff --git a/core/state-machine/Cargo.toml b/core/state-machine/Cargo.toml index c0254116feee8..6ae2ae1655ba5 100644 --- a/core/state-machine/Cargo.toml +++ b/core/state-machine/Cargo.toml @@ -7,7 +7,7 @@ description = "Substrate State Machine" [dependencies] hex-literal = "0.1.0" log = "0.4" -parking_lot = "0.4" +parking_lot = "0.7.1" heapsize = "0.4" hash-db = { git = "https://github.com/paritytech/trie" } trie-db = { git = "https://github.com/paritytech/trie" } diff --git a/core/state-machine/src/backend.rs b/core/state-machine/src/backend.rs index f9949deae9db1..ea1d19859ea42 100644 --- a/core/state-machine/src/backend.rs +++ b/core/state-machine/src/backend.rs @@ -40,10 +40,15 @@ pub trait Backend { /// Type of trie backend storage. type TrieBackendStorage: TrieBackendStorage; - /// Get keyed storage associated with specific address, or None if there is nothing associated. + /// Get keyed storage or None if there is nothing associated. fn storage(&self, key: &[u8]) -> Result>, Self::Error>; - /// Get keyed child storage associated with specific address, or None if there is nothing associated. + /// Get keyed storage value hash or None if there is nothing associated. + fn storage_hash(&self, key: &[u8]) -> Result, Self::Error> { + self.storage(key).map(|v| v.map(|v| H::hash(&v))) + } + + /// Get keyed child storage or None if there is nothing associated. fn child_storage(&self, storage_key: &[u8], key: &[u8]) -> Result>, Self::Error>; /// true if a key exists in storage. diff --git a/core/state-machine/src/ext.rs b/core/state-machine/src/ext.rs index 1bcb3fb732b1f..6274eef720593 100644 --- a/core/state-machine/src/ext.rs +++ b/core/state-machine/src/ext.rs @@ -184,6 +184,11 @@ where self.backend.storage(key).expect(EXT_NOT_ALLOWED_TO_FAIL)) } + fn storage_hash(&self, key: &[u8]) -> Option { + self.overlay.storage(key).map(|x| x.map(|x| H::hash(x))).unwrap_or_else(|| + self.backend.storage_hash(key).expect(EXT_NOT_ALLOWED_TO_FAIL)) + } + fn child_storage(&self, storage_key: &[u8], key: &[u8]) -> Option> { self.overlay.child_storage(storage_key, key).map(|x| x.map(|x| x.to_vec())).unwrap_or_else(|| self.backend.child_storage(storage_key, key).expect(EXT_NOT_ALLOWED_TO_FAIL)) diff --git a/core/state-machine/src/lib.rs b/core/state-machine/src/lib.rs index 5f9757bd55cd6..bc0189d398716 100644 --- a/core/state-machine/src/lib.rs +++ b/core/state-machine/src/lib.rs @@ -65,9 +65,6 @@ pub use proving_backend::{create_proof_check_backend, create_proof_check_backend pub use trie_backend_essence::{TrieBackendStorage, Storage}; pub use trie_backend::TrieBackend; -/// Default num of pages for the heap -const DEFAULT_HEAP_PAGES :u64 = 1024; - /// State Machine Error bound. /// /// This should reflect WASM error type bound for future compatibility. @@ -98,10 +95,15 @@ impl fmt::Display for ExecutionError { /// Externalities: pinned to specific active address. pub trait Externalities { - /// Read storage of current contract being called. + /// Read runtime storage. fn storage(&self, key: &[u8]) -> Option>; - /// Read child storage of current contract being called. + /// Get storage value hash. This may be optimized for large values. + fn storage_hash(&self, key: &[u8]) -> Option { + self.storage(key).map(|v| H::hash(&v)) + } + + /// Read child runtime storage. fn child_storage(&self, storage_key: &[u8], key: &[u8]) -> Option>; /// Set storage entry `key` of current contract being called (effective immediately). @@ -171,8 +173,6 @@ pub trait CodeExecutor: Sized + Send + Sync { fn call>( &self, ext: &mut E, - heap_pages: usize, - code: &[u8], method: &str, data: &[u8], use_native: bool @@ -297,14 +297,6 @@ where { let strategy: ExecutionStrategy = (&manager).into(); - // make a copy. - let code = try_read_overlay_value(overlay, backend, well_known_keys::CODE)? - .ok_or_else(|| Box::new(ExecutionError::CodeEntryDoesNotExist) as Box)? - .to_vec(); - - let heap_pages = try_read_overlay_value(overlay, backend, well_known_keys::HEAP_PAGES)? - .and_then(|v| u64::decode(&mut &v[..])).unwrap_or(DEFAULT_HEAP_PAGES) as usize; - // read changes trie configuration. The reason why we're doing it here instead of the // `OverlayedChanges` constructor is that we need proofs for this read as a part of // proof-of-execution on light clients. And the proof is recorded by the backend which @@ -328,8 +320,6 @@ where let mut externalities = ext::Ext::new(overlay, backend, changes_trie_storage); let retval = exec.call( &mut externalities, - heap_pages, - &code, method, call_data, // attempt to run native first, if we're not directed to run wasm only @@ -357,8 +347,6 @@ where let mut externalities = ext::Ext::new(overlay, backend, changes_trie_storage); let retval = exec.call( &mut externalities, - heap_pages, - &code, method, call_data, false, @@ -614,8 +602,6 @@ mod tests { fn call>( &self, ext: &mut E, - _heap_pages: usize, - _code: &[u8], _method: &str, _data: &[u8], use_native: bool diff --git a/core/state-machine/src/overlayed_changes.rs b/core/state-machine/src/overlayed_changes.rs index 29ff7262da2e8..3a208ad3e2c01 100644 --- a/core/state-machine/src/overlayed_changes.rs +++ b/core/state-machine/src/overlayed_changes.rs @@ -44,7 +44,7 @@ pub struct OverlayedValue { /// Current value. None if value has been deleted. pub value: Option>, /// The set of extinsic indices where the values has been changed. - /// Is filled only if runtime ahs announced changes trie support. + /// Is filled only if runtime has announced changes trie support. pub extrinsics: Option>, } diff --git a/core/state-machine/src/testing.rs b/core/state-machine/src/testing.rs index 876a190a966a9..b9f14f18e5a0f 100644 --- a/core/state-machine/src/testing.rs +++ b/core/state-machine/src/testing.rs @@ -23,7 +23,8 @@ use heapsize::HeapSizeOf; use trie::trie_root; use backend::InMemory; use changes_trie::{compute_changes_trie_root, InMemoryStorage as ChangesTrieInMemoryStorage, AnchorBlockId}; -use primitives::storage::well_known_keys::CHANGES_TRIE_CONFIG; +use primitives::storage::well_known_keys::{CHANGES_TRIE_CONFIG, CODE, HEAP_PAGES}; +use codec::Encode; use super::{Externalities, OverlayedChanges}; /// Simple HashMap-based Externalities impl. @@ -31,11 +32,17 @@ pub struct TestExternalities where H::Out: HeapSizeOf { inner: HashMap, Vec>, changes_trie_storage: ChangesTrieInMemoryStorage, changes: OverlayedChanges, + code: Vec, } impl TestExternalities where H::Out: HeapSizeOf { /// Create a new instance of `TestExternalities` pub fn new(inner: HashMap, Vec>) -> Self { + Self::new_with_code(&[], inner) + } + + /// Create a new instance of `TestExternalities` + pub fn new_with_code(code: &[u8], inner: HashMap, Vec>) -> Self { let mut overlay = OverlayedChanges::default(); super::set_changes_trie_config( &mut overlay, @@ -47,6 +54,7 @@ impl TestExternalities where H::Out: HeapSizeOf { inner, changes_trie_storage: ChangesTrieInMemoryStorage::new(), changes: overlay, + code: code.to_vec(), } } @@ -94,13 +102,18 @@ impl From< HashMap, Vec> > for TestExternalities where inner: hashmap, changes_trie_storage: ChangesTrieInMemoryStorage::new(), changes: Default::default(), + code: Default::default(), } } } impl Externalities for TestExternalities where H::Out: Ord + HeapSizeOf { fn storage(&self, key: &[u8]) -> Option> { - self.inner.get(key).map(|x| x.to_vec()) + match key { + CODE => Some(self.code.clone()), + HEAP_PAGES => Some(8u64.encode()), + _ => self.inner.get(key).map(|x| x.to_vec()), + } } fn child_storage(&self, _storage_key: &[u8], _key: &[u8]) -> Option> { diff --git a/core/telemetry/Cargo.toml b/core/telemetry/Cargo.toml index c74cb956d7ed2..7dda91279254c 100644 --- a/core/telemetry/Cargo.toml +++ b/core/telemetry/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] description = "Telemetry utils" [dependencies] -parking_lot = "0.4" +parking_lot = "0.7.1" lazy_static = "1.0" log = "0.4" slog = "^2" diff --git a/core/telemetry/src/lib.rs b/core/telemetry/src/lib.rs index 927994cca5172..ab7964ed1644f 100644 --- a/core/telemetry/src/lib.rs +++ b/core/telemetry/src/lib.rs @@ -66,7 +66,7 @@ pub fn init_telemetry(config: TelemetryConfig) -> slog_scope::GlobalLoggerGuard thread::spawn(move || { loop { - trace!(target: "telemetry", "Connecting to Telemetry..."); + trace!(target: "telemetry", "Connecting to Telemetry... {:?}", config.url); let _ = ws::connect(config.url.as_str(), |out| Connection::new(out, &*out_sync, &config)); thread::sleep(time::Duration::from_millis(5000)); diff --git a/core/test-client/src/client_ext.rs b/core/test-client/src/client_ext.rs index d4ca6361ee3ac..f766f427cd724 100644 --- a/core/test-client/src/client_ext.rs +++ b/core/test-client/src/client_ext.rs @@ -17,7 +17,7 @@ //! Client extension for tests. use client::{self, Client}; -use consensus::{ImportBlock, BlockImport, BlockOrigin}; +use consensus::{ImportBlock, BlockImport, BlockOrigin, Error as ConsensusError, ForkChoiceStrategy}; use runtime_primitives::Justification; use runtime_primitives::generic::BlockId; use primitives::Blake2Hasher; @@ -27,11 +27,11 @@ use runtime; pub trait TestClient: Sized { /// Import block to the chain. No finality. fn import(&self, origin: BlockOrigin, block: runtime::Block) - -> client::error::Result<()>; + -> Result<(), ConsensusError>; /// Import block with justification, finalizes block. fn import_justified(&self, origin: BlockOrigin, block: runtime::Block, justification: Justification) - -> client::error::Result<()>; + -> Result<(), ConsensusError>; /// Finalize a block. fn finalize_block(&self, id: BlockId, justification: Option) -> client::error::Result<()>; @@ -44,10 +44,10 @@ impl TestClient for Client where B: client::backend::Backend, E: client::CallExecutor, - Self: BlockImport, + Self: BlockImport, { fn import(&self, origin: BlockOrigin, block: runtime::Block) - -> client::error::Result<()> + -> Result<(), ConsensusError> { let import = ImportBlock { origin, @@ -57,13 +57,14 @@ impl TestClient for Client body: Some(block.extrinsics), finalized: false, auxiliary: Vec::new(), + fork_choice: ForkChoiceStrategy::LongestChain, }; self.import_block(import, None).map(|_| ()) } fn import_justified(&self, origin: BlockOrigin, block: runtime::Block, justification: Justification) - -> client::error::Result<()> + -> Result<(), ConsensusError> { let import = ImportBlock { origin, @@ -73,6 +74,7 @@ impl TestClient for Client body: Some(block.extrinsics), finalized: true, auxiliary: Vec::new(), + fork_choice: ForkChoiceStrategy::LongestChain, }; self.import_block(import, None).map(|_| ()) diff --git a/core/test-runtime/Cargo.toml b/core/test-runtime/Cargo.toml index d43cb5d0cf1c8..49389a0b5107a 100644 --- a/core/test-runtime/Cargo.toml +++ b/core/test-runtime/Cargo.toml @@ -20,6 +20,9 @@ sr-primitives = { path = "../sr-primitives", default-features = false } sr-version = { path = "../sr-version", default-features = false } srml-support = { path = "../../srml/support", default-features = false } +[dev-dependencies] +substrate-executor = { path = "../executor" } + [features] default = ["std"] std = [ diff --git a/core/test-runtime/src/genesismap.rs b/core/test-runtime/src/genesismap.rs index 5e6adec86aff5..82e9423f05f01 100644 --- a/core/test-runtime/src/genesismap.rs +++ b/core/test-runtime/src/genesismap.rs @@ -19,23 +19,23 @@ use std::collections::HashMap; use runtime_io::twox_128; use codec::{Encode, KeyedVec, Joiner}; -use primitives::{AuthorityId, ChangesTrieConfiguration}; +use primitives::{Ed25519AuthorityId, ChangesTrieConfiguration}; use primitives::storage::well_known_keys; use runtime_primitives::traits::Block; /// Configuration of a general Substrate test genesis block. pub struct GenesisConfig { pub changes_trie_config: Option, - pub authorities: Vec, - pub balances: Vec<(AuthorityId, u64)>, + pub authorities: Vec, + pub balances: Vec<(Ed25519AuthorityId, u64)>, } impl GenesisConfig { - pub fn new_simple(authorities: Vec, balance: u64) -> Self { + pub fn new_simple(authorities: Vec, balance: u64) -> Self { Self::new(false, authorities, balance) } - pub fn new(support_changes_trie: bool, authorities: Vec, balance: u64) -> Self { + pub fn new(support_changes_trie: bool, authorities: Vec, balance: u64) -> Self { GenesisConfig { changes_trie_config: match support_changes_trie { true => Some(super::changes_trie_config()), diff --git a/core/test-runtime/src/lib.rs b/core/test-runtime/src/lib.rs index cceeee74d114d..eb5efdf684afb 100644 --- a/core/test-runtime/src/lib.rs +++ b/core/test-runtime/src/lib.rs @@ -45,6 +45,8 @@ extern crate substrate_keyring as keyring; #[cfg_attr(any(feature = "std", test), macro_use)] extern crate substrate_primitives as primitives; +#[cfg(test)] extern crate substrate_executor; + #[cfg(feature = "std")] pub mod genesismap; pub mod system; @@ -61,8 +63,7 @@ use runtime_primitives::{ }; use runtime_version::RuntimeVersion; pub use primitives::hash::H256; -use primitives::AuthorityId; -use primitives::OpaqueMetadata; +use primitives::{Ed25519AuthorityId, OpaqueMetadata}; #[cfg(any(feature = "std", test))] use runtime_version::NativeVersion; use consensus_aura::api as aura_api; @@ -143,7 +144,7 @@ pub type BlockNumber = u64; /// Index of a transaction. pub type Index = u64; /// The item of a block digest. -pub type DigestItem = runtime_primitives::generic::DigestItem; +pub type DigestItem = runtime_primitives::generic::DigestItem; /// The digest of a block. pub type Digest = runtime_primitives::generic::Digest; /// A test block. @@ -197,7 +198,7 @@ impl_runtime_apis! { version() } - fn authorities() -> Vec { + fn authorities() -> Vec { system::authorities() } diff --git a/core/test-runtime/src/system.rs b/core/test-runtime/src/system.rs index 3703fb553e685..19739b21cb2a0 100644 --- a/core/test-runtime/src/system.rs +++ b/core/test-runtime/src/system.rs @@ -25,7 +25,7 @@ use runtime_primitives::generic; use runtime_primitives::{ApplyError, ApplyOutcome, ApplyResult, transaction_validity::TransactionValidity}; use codec::{KeyedVec, Encode}; use super::{AccountId, BlockNumber, Extrinsic, H256 as Hash, Block, Header, Digest}; -use primitives::{Blake2Hasher}; +use primitives::{Ed25519AuthorityId, Blake2Hasher}; use primitives::storage::well_known_keys; const NONCE_OF: &[u8] = b"nonce:"; @@ -51,7 +51,7 @@ pub fn nonce_of(who: AccountId) -> u64 { } /// Get authorities ar given block. -pub fn authorities() -> Vec<::primitives::AuthorityId> { +pub fn authorities() -> Vec { let len: u32 = storage::unhashed::get(well_known_keys::AUTHORITY_COUNT) .expect("There are always authorities in test-runtime"); (0..len) @@ -94,7 +94,7 @@ pub fn execute_block(block: Block) { // check digest let mut digest = Digest::default(); if let Some(storage_changes_root) = storage_changes_root(header.parent_hash.into(), header.number - 1) { - digest.push(generic::DigestItem::ChangesTrieRoot::(storage_changes_root.into())); + digest.push(generic::DigestItem::ChangesTrieRoot(storage_changes_root.into())); } assert!(digest == header.digest, "Header digest items must match that calculated."); } @@ -164,7 +164,7 @@ pub fn finalise_block() -> Header { let mut digest = Digest::default(); if let Some(storage_changes_root) = storage_changes_root { - digest.push(generic::DigestItem::ChangesTrieRoot::(storage_changes_root)); + digest.push(generic::DigestItem::ChangesTrieRoot(storage_changes_root)); } Header { @@ -248,6 +248,10 @@ mod tests { use ::{Header, Digest, Extrinsic, Transfer}; use primitives::{Blake2Hasher}; use primitives::storage::well_known_keys; + use substrate_executor::WasmExecutor; + + const WASM_CODE: &'static [u8] = + include_bytes!("../wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm"); fn new_test_ext() -> TestExternalities { TestExternalities::new(map![ @@ -265,8 +269,7 @@ mod tests { Extrinsic { transfer: tx, signature } } - #[test] - fn block_import_works() { + fn block_import_works(block_executor: F) where F: Fn(Block, &mut TestExternalities) { let mut t = new_test_ext(); let h = Header { @@ -282,13 +285,27 @@ mod tests { extrinsics: vec![], }; - with_externalities(&mut t, || { - execute_block(b); + block_executor(b, &mut t); + + } + + #[test] + fn block_import_works_native() { + block_import_works(|b, ext| { + with_externalities(ext, || { + execute_block(b); + }); }); } #[test] - fn block_import_with_transaction_works() { + fn block_import_works_wasm() { + block_import_works(|b, ext| { + WasmExecutor::new().call(ext, 8, &WASM_CODE, "Core_execute_block", &b.encode()).unwrap(); + }) + } + + fn block_import_with_transaction_works(block_executor: F) where F: Fn(Block, &mut TestExternalities) { let mut t = new_test_ext(); with_externalities(&mut t, || { @@ -345,12 +362,29 @@ mod tests { ], }; + block_executor(b, &mut t); + with_externalities(&mut t, || { - execute_block(b); assert_eq!(balance_of(Keyring::Alice.to_raw_public().into()), 0); assert_eq!(balance_of(Keyring::Bob.to_raw_public().into()), 42); assert_eq!(balance_of(Keyring::Charlie.to_raw_public().into()), 69); }); } + + #[test] + fn block_import_with_transaction_works_native() { + block_import_with_transaction_works(|b, ext| { + with_externalities(ext, || { + execute_block(b); + }); + }); + } + + #[test] + fn block_import_with_transaction_works_wasm() { + block_import_with_transaction_works(|b, ext| { + WasmExecutor::new().call(ext, 8, &WASM_CODE, "Core_execute_block", &b.encode()).unwrap(); + }) + } } diff --git a/core/test-runtime/wasm/Cargo.lock b/core/test-runtime/wasm/Cargo.lock index 8791d2c1ff974..6bd62383c2d39 100644 --- a/core/test-runtime/wasm/Cargo.lock +++ b/core/test-runtime/wasm/Cargo.lock @@ -98,15 +98,6 @@ name = "crossbeam" version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "crossbeam-deque" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-deque" version = "0.6.2" @@ -116,20 +107,6 @@ dependencies = [ "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-epoch" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-epoch" version = "0.6.1" @@ -143,14 +120,6 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-utils" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-utils" version = "0.6.2" @@ -240,11 +209,6 @@ name = "futures" version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "gcc" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "hash-db" version = "0.9.0" @@ -298,6 +262,23 @@ dependencies = [ "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "impl-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "impl-serde" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "integer-sqrt" version = "0.1.2" @@ -515,7 +496,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.10.15" +version = "0.10.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -523,12 +504,12 @@ dependencies = [ "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.39" +version = "0.9.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -537,14 +518,6 @@ dependencies = [ "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "owning_ref" version = "0.4.0" @@ -585,15 +558,6 @@ dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot" version = "0.6.4" @@ -605,24 +569,13 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot_core" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot_core" version = "0.3.1" @@ -657,6 +610,18 @@ name = "pkg-config" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "primitive-types" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro-hack" version = "0.4.1" @@ -781,25 +746,6 @@ dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rayon" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon-core" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "redox_syscall" version = "0.1.43" @@ -807,14 +753,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ring" -version = "0.12.1" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1078,7 +1023,7 @@ dependencies = [ "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 0.1.0", "sr-primitives 0.1.0", @@ -1112,8 +1057,10 @@ version = "0.1.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "sr-version 0.1.0", "substrate-primitives 0.1.0", @@ -1129,7 +1076,7 @@ dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -1157,21 +1104,20 @@ dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", "twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1192,7 +1138,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0", "substrate-trie 0.4.0", "trie-db 0.9.0 (git+https://github.com/paritytech/trie)", @@ -1205,7 +1151,7 @@ version = "0.3.0" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1484,6 +1430,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1515,7 +1462,7 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1588,7 +1535,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1619,11 +1566,8 @@ dependencies = [ "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" -"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" "checksum crossbeam-deque 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe1b6f945f824c7a25afe44f62e25d714c0cc523f8e99d8db5cd1026e1269d3" -"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" "checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8" -"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e07fc155212827475223f0bcfae57e945e694fc90950ddf3f6695bbfd5555c72" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" @@ -1637,7 +1581,6 @@ dependencies = [ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" -"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" @@ -1645,6 +1588,8 @@ dependencies = [ "checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +"checksum impl-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c88568d828291c50eed30cd7fb9f8e688ad0013620186fa3e777b9f206c79f2" +"checksum impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5158079de9d4158e0ce1de3ae0bd7be03904efc40b3d7dd8b8c301cbf6b52b56" "checksum integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ea155abb3ba6f382a75f1418988c05fe82959ed9ce727de427f9cfd425b0c903" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" @@ -1673,22 +1618,20 @@ dependencies = [ "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" "checksum once_cell 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d7ce3535d54560c937c1652ba4a0da66bfc63e0f8e07bed127483afb6e5ee925" -"checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" -"checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" +"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)" = "" "checksum parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dca389ea5e1632c89b2ce54f7e2b4a8a8c9d278042222a91e0bf95451218cb4c" "checksum parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffa42c2cb493b60b12c75b26e8c94cb734af4df4d7f2cc229dc04c1953dac189" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" -"checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" -"checksum parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9723236a9525c757d9725b993511e3fc941e33f27751942232f0058298297edf" -"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum primitive-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f47c18b4601125931d69fcf7b000c2c16a304e4f84d58218d6470b4502e00b58" "checksum proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c725b36c99df7af7bf9324e9c999b9e37d92c8f8caf106d82e1d7953218d2d8" "checksum proc-macro-hack-impl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2b753ad9ed99dd8efeaa7d2fb8453c8f6bc3e54b97966d35f1bc77ca6865254a" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" @@ -1703,10 +1646,8 @@ dependencies = [ "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" "checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" -"checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" -"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d" -"checksum ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7d28b30a72c01b458428e0ae988d4149c20d902346902be881e3edc4bb325c" +"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" @@ -1751,7 +1692,7 @@ dependencies = [ "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae" +"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" diff --git a/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm b/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm index e7d060ff3b4d2..451cac0489f46 100644 Binary files a/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm and b/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm differ diff --git a/core/transaction-pool/Cargo.toml b/core/transaction-pool/Cargo.toml index 93768f16d2264..e2f19b839a81d 100644 --- a/core/transaction-pool/Cargo.toml +++ b/core/transaction-pool/Cargo.toml @@ -8,7 +8,7 @@ error-chain = "0.12" futures = "0.1" log = "0.4" parity-codec = "2.1" -parking_lot = "0.4" +parking_lot = "0.7.1" sr-primitives = { path = "../sr-primitives" } substrate-client = { path = "../client" } substrate-primitives = { path = "../primitives" } diff --git a/core/transaction-pool/graph/Cargo.toml b/core/transaction-pool/graph/Cargo.toml index 9c154d4b3a405..7910e10d9fd75 100644 --- a/core/transaction-pool/graph/Cargo.toml +++ b/core/transaction-pool/graph/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] error-chain = "0.12" futures = "0.1" log = "0.4" -parking_lot = "0.4" +parking_lot = "0.7.1" serde = "1.0" serde_derive = "1.0" sr-primitives = { path = "../../sr-primitives" } diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index 47bd651ca8ac6..3a20fb3c8fea2 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -19,6 +19,7 @@ substrate-primitives = { path = "../../core/primitives" } node-runtime = { path = "../runtime" } node-primitives = { path = "../primitives" } hex-literal = "0.1" +substrate-basic-authorship = { path = "../../core/basic-authorship" } substrate-service = { path = "../../core/service" } substrate-transaction-pool = { path = "../../core/transaction-pool" } substrate-network = { path = "../../core/network" } diff --git a/node/cli/res/charred-cherry.json b/node/cli/res/charred-cherry.json index 4f9905f720bbf..11f64f098d42e 100644 --- a/node/cli/res/charred-cherry.json +++ b/node/cli/res/charred-cherry.json @@ -2,7 +2,6 @@ "name": "Charred Cherry", "id": "charred-cherry", "properties": { - "networkId": 68, "tokenDecimals": 15, "tokenSymbol": "CHR" }, diff --git a/node/cli/src/chain_spec.rs b/node/cli/src/chain_spec.rs index b06cc974518a6..ebf35a7491db5 100644 --- a/node/cli/src/chain_spec.rs +++ b/node/cli/src/chain_spec.rs @@ -16,11 +16,11 @@ //! Substrate chain configurations. -use primitives::{AuthorityId, ed25519}; +use primitives::{Ed25519AuthorityId, ed25519}; use node_primitives::AccountId; use node_runtime::{ConsensusConfig, CouncilSeatsConfig, CouncilVotingConfig, DemocracyConfig, SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, TreasuryConfig, - UpgradeKeyConfig, ContractConfig, GrandpaConfig, Permill, Perbill}; + SudoConfig, ContractConfig, GrandpaConfig, Permill, Perbill}; pub use node_runtime::GenesisConfig; use substrate_service; @@ -86,6 +86,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig { bonding_duration: 60 * MINUTES, offline_slash_grace: 4, minimum_validator_count: 4, + invulnerables: initial_authorities.iter().cloned().map(Into::into).collect(), }), democracy: Some(DemocracyConfig { launch_period: 10 * MINUTES, // 1 day per public referendum @@ -129,7 +130,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig { block_gas_limit: 10_000_000, current_schedule: Default::default(), }), - upgrade_key: Some(UpgradeKeyConfig { + sudo: Some(SudoConfig { key: endowed_accounts[0].clone(), }), grandpa: Some(GrandpaConfig { @@ -154,7 +155,7 @@ pub fn staging_testnet_config() -> ChainSpec { } /// Helper function to generate AuthorityID from seed -pub fn get_authority_id_from_seed(seed: &str) -> AuthorityId { +pub fn get_authority_id_from_seed(seed: &str) -> Ed25519AuthorityId { let padded_seed = pad_seed(seed); // NOTE from ed25519 impl: // prefer pkcs#8 unless security doesn't matter -- this is used primarily for tests. @@ -163,9 +164,9 @@ pub fn get_authority_id_from_seed(seed: &str) -> AuthorityId { /// Helper function to create GenesisConfig for testing pub fn testnet_genesis( - initial_authorities: Vec, - upgrade_key: AccountId, - endowed_accounts: Option>, + initial_authorities: Vec, + root_key: AccountId, + endowed_accounts: Option>, ) -> GenesisConfig { let endowed_accounts = endowed_accounts.unwrap_or_else(|| { vec![ @@ -208,6 +209,7 @@ pub fn testnet_genesis( current_offline_slash: 0, current_session_reward: 0, offline_slash_grace: 0, + invulnerables: initial_authorities.iter().cloned().map(Into::into).collect(), }), democracy: Some(DemocracyConfig { launch_period: 9, @@ -253,8 +255,8 @@ pub fn testnet_genesis( block_gas_limit: 10_000_000, current_schedule: Default::default(), }), - upgrade_key: Some(UpgradeKeyConfig { - key: upgrade_key, + sudo: Some(SudoConfig { + key: root_key, }), grandpa: Some(GrandpaConfig { authorities: initial_authorities.clone().into_iter().map(|k| (k, 1)).collect(), diff --git a/node/cli/src/lib.rs b/node/cli/src/lib.rs index d0c02ed941d4c..e084b448cf56e 100644 --- a/node/cli/src/lib.rs +++ b/node/cli/src/lib.rs @@ -52,6 +52,7 @@ mod service; mod params; mod native_rpc; +use tokio::prelude::Future; use tokio::runtime::Runtime; pub use cli::{VersionInfo, IntoExit}; use substrate_service::{ServiceFactory, Roles as ServiceRoles}; @@ -122,21 +123,10 @@ pub fn run(args: I, exit: E, version: cli::VersionInfo) -> error::Resul Err(e) => e.exit(), }; - let (spec, mut config) = cli::parse_matches::( + let (spec, config) = cli::parse_matches::( load_spec, version, "substrate-node", &matches )?; - if matches.is_present("grandpa_authority_only") { - config.custom.grandpa_authority = true; - config.custom.grandpa_authority_only = true; - // Authority Setup is only called if validator is set as true - config.roles = ServiceRoles::AUTHORITY; - } else if matches.is_present("grandpa_authority") { - config.custom.grandpa_authority = true; - // Authority Setup is only called if validator is set as true - config.roles = ServiceRoles::AUTHORITY; - } - match cli::execute_default::(spec, exit, &matches, &config)? { cli::Action::ExecutedInternally => (), cli::Action::RunService(exit) => { @@ -149,8 +139,8 @@ pub fn run(args: I, exit: E, version: cli::VersionInfo) -> error::Resul let mut runtime = Runtime::new()?; let executor = runtime.executor(); match config.roles == ServiceRoles::LIGHT { - true => run_until_exit(&mut runtime, service::Factory::new_light(config, executor)?, exit)?, - false => run_until_exit(&mut runtime, service::Factory::new_full(config, executor)?, exit)?, + true => run_until_exit(runtime, service::Factory::new_light(config, executor)?, exit)?, + false => run_until_exit(runtime, service::Factory::new_full(config, executor)?, exit)?, } } } @@ -158,7 +148,7 @@ pub fn run(args: I, exit: E, version: cli::VersionInfo) -> error::Resul } fn run_until_exit( - runtime: &mut Runtime, + mut runtime: Runtime, service: T, e: E, ) -> error::Result<()> @@ -175,5 +165,14 @@ fn run_until_exit( let _ = runtime.block_on(e.into_exit()); exit_send.fire(); + + // we eagerly drop the service so that the internal exit future is fired, + // but we need to keep holding a reference to the global telemetry guard + let _telemetry = service.telemetry(); + drop(service); + + // TODO [andre]: timeout this future #1318 + let _ = runtime.shutdown_on_idle().wait(); + Ok(()) } diff --git a/node/cli/src/service.rs b/node/cli/src/service.rs index 393b2a480ceb7..89dbd02319d00 100644 --- a/node/cli/src/service.rs +++ b/node/cli/src/service.rs @@ -19,19 +19,20 @@ //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. use std::sync::Arc; -use transaction_pool::{self, txpool::{Pool as TransactionPool}}; -use node_runtime::{GenesisConfig, RuntimeApi}; +use std::time::Duration; + +use client; +use consensus::{import_queue, start_aura, AuraImportQueue, SlotDuration, NothingExtra}; +use grandpa; +use node_executor; +use primitives::ed25519::Pair; use node_primitives::{Block, InherentData}; +use node_runtime::{GenesisConfig, RuntimeApi}; use substrate_service::{ FactoryFullConfiguration, LightComponents, FullComponents, FullBackend, FullClient, LightClient, LightBackend, FullExecutor, LightExecutor, TaskExecutor }; -use node_executor; -use consensus::{import_queue, start_aura, AuraImportQueue, SlotDuration, NothingExtra}; -use primitives::ed25519::Pair; -use client; -use std::time::Duration; -use grandpa; +use transaction_pool::{self, txpool::{Pool as TransactionPool}}; construct_simple_protocol! { /// Demo protocol attachment for substrate. @@ -40,12 +41,7 @@ construct_simple_protocol! { /// Node specific configuration pub struct NodeConfig { - /// should run as a grandpa authority - pub grandpa_authority: bool, - /// should run as a grandpa authority only, don't validate as usual - pub grandpa_authority_only: bool, /// grandpa connection to import block - // FIXME: rather than putting this on the config, let's have an actual intermediate setup state // https://github.com/paritytech/substrate/issues/1134 pub grandpa_import_setup: Option<(Arc>, grandpa::LinkHalfForService)>, @@ -54,8 +50,6 @@ pub struct NodeConfig { impl Default for NodeConfig where F: substrate_service::ServiceFactory { fn default() -> NodeConfig { NodeConfig { - grandpa_authority: false, - grandpa_authority_only: false, grandpa_import_setup: None, } } @@ -77,40 +71,32 @@ construct_service_factory! { { |config: FactoryFullConfiguration, executor: TaskExecutor| FullComponents::::new(config, executor) }, AuthoritySetup = { - |mut service: Self::FullService, executor: TaskExecutor, key: Option>| { + |mut service: Self::FullService, executor: TaskExecutor, local_key: Option>| { let (block_import, link_half) = service.config.custom.grandpa_import_setup.take() .expect("Link Half and Block Import are present for Full Services or setup failed before. qed"); - let local_key = if let Some(key) = key { - if !service.config.custom.grandpa_authority_only { - info!("Using authority key {}", key.public()); - let proposer = Arc::new(substrate_service::ProposerFactory { - client: service.client(), - transaction_pool: service.transaction_pool(), - }); - - let client = service.client(); - executor.spawn(start_aura( - SlotDuration::get_or_compute(&*client)?, - key.clone(), - client, - block_import.clone(), - proposer, - service.network(), - )); - } - - if service.config.custom.grandpa_authority { - info!("Running Grandpa session as Authority {}", key.public()); - Some(key) - } else { - None - } - } else { - None - }; - - let voter = grandpa::run_grandpa( + if let Some(ref key) = local_key { + info!("Using authority key {}", key.public()); + let proposer = Arc::new(substrate_basic_authorship::ProposerFactory { + client: service.client(), + transaction_pool: service.transaction_pool(), + }); + + let client = service.client(); + executor.spawn(start_aura( + SlotDuration::get_or_compute(&*client)?, + key.clone(), + client, + block_import.clone(), + proposer, + service.network(), + service.on_exit(), + )); + + info!("Running Grandpa session as Authority {}", key.public()); + } + + executor.spawn(grandpa::run_grandpa( grandpa::Config { local_key, gossip_duration: Duration::new(4, 0), // FIXME: make this available through chainspec? @@ -118,9 +104,8 @@ construct_service_factory! { }, link_half, grandpa::NetworkBridge::new(service.network()), - )?; - - executor.spawn(voter); + service.on_exit(), + )?); Ok(service) } diff --git a/node/executor/src/lib.rs b/node/executor/src/lib.rs index 632230133a3d4..b8d459689b618 100644 --- a/node/executor/src/lib.rs +++ b/node/executor/src/lib.rs @@ -90,7 +90,7 @@ mod tests { match xt.signed { Some((signed, index)) => { let era = Era::mortal(256, 0); - let payload = (index, xt.function, era, GENESIS_HASH); + let payload = (index.into(), xt.function, era, GENESIS_HASH); let pair = Pair::from(Keyring::from_public(Public::from_raw(signed.clone().into())).unwrap()); let signature = pair.sign(&payload.encode()).into(); UncheckedExtrinsic { @@ -122,7 +122,7 @@ mod tests { #[test] fn panic_execution_with_foreign_code_gives_error() { - let mut t = TestExternalities::::new(map![ + let mut t = TestExternalities::::new_with_code(BLOATY_CODE, map![ twox_128(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![70u8; 16], @@ -134,16 +134,16 @@ mod tests { twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32] ]); - let r = executor().call(&mut t, 8, BLOATY_CODE, "Core_initialise_block", &vec![].and(&from_block_number(1u64)), true).0; + let r = executor().call(&mut t, "Core_initialise_block", &vec![].and(&from_block_number(1u64)), true).0; assert!(r.is_ok()); - let v = executor().call(&mut t, 8, BLOATY_CODE, "BlockBuilder_apply_extrinsic", &vec![].and(&xt()), true).0.unwrap(); + let v = executor().call(&mut t, "BlockBuilder_apply_extrinsic", &vec![].and(&xt()), true).0.unwrap(); let r = ApplyResult::decode(&mut &v[..]).unwrap(); assert_eq!(r, Err(ApplyError::CantPay)); } #[test] fn bad_extrinsic_with_native_equivalent_code_gives_error() { - let mut t = TestExternalities::::new(map![ + let mut t = TestExternalities::::new_with_code(COMPACT_CODE, map![ twox_128(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![70u8; 16], @@ -155,16 +155,16 @@ mod tests { twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32] ]); - let r = executor().call(&mut t, 8, COMPACT_CODE, "Core_initialise_block", &vec![].and(&from_block_number(1u64)), true).0; + let r = executor().call(&mut t, "Core_initialise_block", &vec![].and(&from_block_number(1u64)), true).0; assert!(r.is_ok()); - let v = executor().call(&mut t, 8, COMPACT_CODE, "BlockBuilder_apply_extrinsic", &vec![].and(&xt()), true).0.unwrap(); + let v = executor().call(&mut t, "BlockBuilder_apply_extrinsic", &vec![].and(&xt()), true).0.unwrap(); let r = ApplyResult::decode(&mut &v[..]).unwrap(); assert_eq!(r, Err(ApplyError::CantPay)); } #[test] fn successful_execution_with_native_equivalent_code_gives_ok() { - let mut t = TestExternalities::::new(map![ + let mut t = TestExternalities::::new_with_code(COMPACT_CODE, map![ twox_128(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], @@ -176,9 +176,9 @@ mod tests { twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32] ]); - let r = executor().call(&mut t, 8, COMPACT_CODE, "Core_initialise_block", &vec![].and(&from_block_number(1u64)), true).0; + let r = executor().call(&mut t, "Core_initialise_block", &vec![].and(&from_block_number(1u64)), true).0; assert!(r.is_ok()); - let r = executor().call(&mut t, 8, COMPACT_CODE, "BlockBuilder_apply_extrinsic", &vec![].and(&xt()), true).0; + let r = executor().call(&mut t, "BlockBuilder_apply_extrinsic", &vec![].and(&xt()), true).0; assert!(r.is_ok()); runtime_io::with_externalities(&mut t, || { @@ -189,7 +189,7 @@ mod tests { #[test] fn successful_execution_with_foreign_code_gives_ok() { - let mut t = TestExternalities::::new(map![ + let mut t = TestExternalities::::new_with_code(BLOATY_CODE, map![ twox_128(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], @@ -201,9 +201,9 @@ mod tests { twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32] ]); - let r = executor().call(&mut t, 8, BLOATY_CODE, "Core_initialise_block", &vec![].and(&from_block_number(1u64)), true).0; + let r = executor().call(&mut t, "Core_initialise_block", &vec![].and(&from_block_number(1u64)), true).0; assert!(r.is_ok()); - let r = executor().call(&mut t, 8, BLOATY_CODE, "BlockBuilder_apply_extrinsic", &vec![].and(&xt()), true).0; + let r = executor().call(&mut t, "BlockBuilder_apply_extrinsic", &vec![].and(&xt()), true).0; assert!(r.is_ok()); runtime_io::with_externalities(&mut t, || { @@ -212,10 +212,10 @@ mod tests { }); } - fn new_test_ext(support_changes_trie: bool) -> TestExternalities { + fn new_test_ext(code: &[u8], support_changes_trie: bool) -> TestExternalities { use keyring::Keyring::*; let three = [3u8; 32].into(); - TestExternalities::new(GenesisConfig { + TestExternalities::new_with_code(code, GenesisConfig { consensus: Some(Default::default()), system: Some(SystemConfig { changes_trie_config: if support_changes_trie { Some(ChangesTrieConfiguration { @@ -252,6 +252,7 @@ mod tests { current_offline_slash: 0, current_session_reward: 0, offline_slash_grace: 0, + invulnerables: vec![alice(), bob(), Charlie.to_raw_public().into()], }), democracy: Some(Default::default()), council_seats: Some(Default::default()), @@ -259,7 +260,7 @@ mod tests { timestamp: Some(Default::default()), treasury: Some(Default::default()), contract: Some(Default::default()), - upgrade_key: Some(Default::default()), + sudo: Some(Default::default()), grandpa: Some(GrandpaConfig { authorities: vec![ // set these so no GRANDPA events fire when session changes (Alice.to_raw_public().into(), 1), @@ -311,9 +312,9 @@ mod tests { 1, GENESIS_HASH.into(), if support_changes_trie { - hex!("1a7758d96d7353732f3054a3dacb18f04f42fc48f6706378d6f7be744c6022f1").into() + hex!("22e7fc466d555b9dce285425081d89751b2063243684979df3840b3ac7e8ecdc").into() } else { - hex!("1cf270c8a484df4931af562f7afdc9f44d99ae1bd35fe30fbd2cf3c1be2e933b").into() + hex!("7395363e53e682984f817fb1d5a862c5ce8b817375c06270d7a39be7097ad953").into() }, if support_changes_trie { vec![changes_trie_log( @@ -339,7 +340,7 @@ mod tests { construct_block( 2, block1(false).1, - hex!("a208e27269f8a17e7f7cf9513396d3579066df10a853e030345847ec96593c2e").into(), + hex!("66b9625c9c824de867815215528fe43014d50af7fb95c8da120910c220a46f6b").into(), vec![ // session changes here, so we add a grandpa change signal log. Log::from(::grandpa::RawLog::AuthoritiesChangeSignal(0, vec![ (Keyring::One.to_raw_public().into(), 1), @@ -368,7 +369,7 @@ mod tests { construct_block( 1, GENESIS_HASH.into(), - hex!("a506a69fefa4dc1be6838b68dc6e5799bd5fec545ef890cadac20edc0254d37a").into(), + hex!("66dfdf3a0ef93ec49ec36c0a65fe328d085a865c2382397b2cd6468e391f2f51").into(), vec![], vec![ CheckedExtrinsic { @@ -385,9 +386,9 @@ mod tests { #[test] fn full_native_block_import_works() { - let mut t = new_test_ext(false); + let mut t = new_test_ext(COMPACT_CODE, false); - executor().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block1(false).0, true).0.unwrap(); + executor().call(&mut t, "Core_execute_block", &block1(false).0, true).0.unwrap(); runtime_io::with_externalities(&mut t, || { assert_eq!(Balances::total_balance(&alice()), 41); @@ -429,7 +430,7 @@ mod tests { ]); }); - executor().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block2().0, true).0.unwrap(); + executor().call(&mut t, "Core_execute_block", &block2().0, true).0.unwrap(); runtime_io::with_externalities(&mut t, || { assert_eq!(Balances::total_balance(&alice()), 30); @@ -503,7 +504,7 @@ mod tests { #[test] fn full_wasm_block_import_works() { - let mut t = new_test_ext(false); + let mut t = new_test_ext(COMPACT_CODE, false); WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block1(false).0).unwrap(); @@ -644,7 +645,7 @@ mod tests { #[test] fn deploying_wasm_contract_should_work() { - let mut t = new_test_ext(false); + let mut t = new_test_ext(COMPACT_CODE, false); let code_transfer = wabt::wat2wasm(CODE_TRANSFER).unwrap(); let code_ctor_transfer = wabt::wat2wasm(&code_ctor(&code_transfer)).unwrap(); @@ -658,7 +659,7 @@ mod tests { let b = construct_block( 1, GENESIS_HASH.into(), - hex!("3af4e1ba0769122b1e92b138fecf7ce8bb2fe4f2a65fba3b423f87942f1ba8c8").into(), + hex!("8197608e90fff1f7d92b35381169242d081779b1718c910689f2589a8ac09b44").into(), vec![], vec![ CheckedExtrinsic { @@ -680,7 +681,7 @@ mod tests { ] ); - WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &b.0).unwrap(); + WasmExecutor::new().call(&mut t, 8, COMPACT_CODE,"Core_execute_block", &b.0).unwrap(); runtime_io::with_externalities(&mut t, || { // Verify that the contract constructor worked well and code of TRANSFER contract is actually deployed. @@ -690,7 +691,7 @@ mod tests { #[test] fn wasm_big_block_import_fails() { - let mut t = new_test_ext(false); + let mut t = new_test_ext(COMPACT_CODE, false); assert!( WasmExecutor::new().call( @@ -705,12 +706,10 @@ mod tests { #[test] fn native_big_block_import_succeeds() { - let mut t = new_test_ext(false); + let mut t = new_test_ext(COMPACT_CODE, false); Executor::new().call( &mut t, - 8, - COMPACT_CODE, "Core_execute_block", &block1big().0, true @@ -719,13 +718,11 @@ mod tests { #[test] fn native_big_block_import_fails_on_fallback() { - let mut t = new_test_ext(false); + let mut t = new_test_ext(COMPACT_CODE, false); assert!( Executor::new().call( &mut t, - 8, - COMPACT_CODE, "Core_execute_block", &block1big().0, false @@ -735,7 +732,8 @@ mod tests { #[test] fn panic_execution_gives_error() { - let mut t = TestExternalities::::new(map![ + let foreign_code = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.wasm"); + let mut t = TestExternalities::::new_with_code(foreign_code, map![ twox_128(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![70u8; 16], @@ -747,17 +745,17 @@ mod tests { twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32] ]); - let foreign_code = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.wasm"); - let r = WasmExecutor::new().call(&mut t, 8, &foreign_code[..], "Core_initialise_block", &vec![].and(&from_block_number(1u64))); + let r = WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_initialise_block", &vec![].and(&from_block_number(1u64))); assert!(r.is_ok()); - let r = WasmExecutor::new().call(&mut t, 8, &foreign_code[..], "BlockBuilder_apply_extrinsic", &vec![].and(&xt())).unwrap(); + let r = WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "BlockBuilder_apply_extrinsic", &vec![].and(&xt())).unwrap(); let r = ApplyResult::decode(&mut &r[..]).unwrap(); assert_eq!(r, Err(ApplyError::CantPay)); } #[test] fn successful_execution_gives_ok() { - let mut t = TestExternalities::::new(map![ + let foreign_code = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm"); + let mut t = TestExternalities::::new_with_code(foreign_code, map![ twox_128(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], @@ -769,10 +767,9 @@ mod tests { twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32] ]); - let foreign_code = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm"); - let r = WasmExecutor::new().call(&mut t, 8, &foreign_code[..], "Core_initialise_block", &vec![].and(&from_block_number(1u64))); + let r = WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_initialise_block", &vec![].and(&from_block_number(1u64))); assert!(r.is_ok()); - let r = WasmExecutor::new().call(&mut t, 8, &foreign_code[..], "BlockBuilder_apply_extrinsic", &vec![].and(&xt())).unwrap(); + let r = WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "BlockBuilder_apply_extrinsic", &vec![].and(&xt())).unwrap(); let r = ApplyResult::decode(&mut &r[..]).unwrap(); assert_eq!(r, Ok(ApplyOutcome::Success)); @@ -784,15 +781,15 @@ mod tests { #[test] fn full_native_block_import_works_with_changes_trie() { - let mut t = new_test_ext(true); - Executor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block1(true).0, true).0.unwrap(); + let mut t = new_test_ext(COMPACT_CODE, true); + Executor::new().call(&mut t, "Core_execute_block", &block1(true).0, true).0.unwrap(); assert!(t.storage_changes_root(Default::default(), 0).is_some()); } #[test] fn full_wasm_block_import_works_with_changes_trie() { - let mut t = new_test_ext(true); + let mut t = new_test_ext(COMPACT_CODE, true); WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block1(true).0).unwrap(); assert!(t.storage_changes_root(Default::default(), 0).is_some()); @@ -806,9 +803,9 @@ mod tests { #[bench] fn wasm_execute_block(b: &mut Bencher) { b.iter(|| { - let mut t = new_test_ext(false); - WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block1(false).0).unwrap(); - WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block2().0).unwrap(); + let mut t = new_test_ext(COMPACT_CODE, false); + WasmExecutor::new().call(&mut t, "Core_execute_block", &block1(false).0).unwrap(); + WasmExecutor::new().call(&mut t, "Core_execute_block", &block2().0).unwrap(); }); } } diff --git a/node/primitives/src/lib.rs b/node/primitives/src/lib.rs index e2336acafdc48..967b0d775c040 100644 --- a/node/primitives/src/lib.rs +++ b/node/primitives/src/lib.rs @@ -56,7 +56,7 @@ pub type Balance = u128; /// The Ed25519 pub key of an session that belongs to an authority of the chain. This is /// exactly equivalent to what the substrate calls an "authority". -pub type SessionKey = primitives::AuthorityId; +pub type SessionKey = primitives::Ed25519AuthorityId; /// Index of a transaction in the chain. pub type Index = u64; diff --git a/node/rpc-servers/src/lib.rs b/node/rpc-servers/src/lib.rs index ec823b15fd2b7..fb09799ef5c63 100644 --- a/node/rpc-servers/src/lib.rs +++ b/node/rpc-servers/src/lib.rs @@ -49,11 +49,10 @@ pub fn rpc_handler( ) -> RpcHandler where Block: BlockT + 'static, ExHash: Send + Sync + 'static + sr_primitives::Serialize + sr_primitives::DeserializeOwned, - SignedBlock: serde::Serialize + sr_primitives::DeserializeOwned, S: apis::state::StateApi, - C: apis::chain::ChainApi, SignedBlock, Metadata=Metadata>, + C: apis::chain::ChainApi, Block::Hash, Block::Header, SignedBlock, Metadata=Metadata>, A: apis::author::AuthorApi, - Y: apis::system::SystemApi, + Y: apis::system::SystemApi>, { let mut io = pubsub::PubSubHandler::default(); io.extend_with(state.to_delegate()); diff --git a/node/rpc/Cargo.toml b/node/rpc/Cargo.toml index e6d39f709325e..1e4ea9896b51b 100644 --- a/node/rpc/Cargo.toml +++ b/node/rpc/Cargo.toml @@ -9,7 +9,7 @@ jsonrpc-core = { git="https://github.com/paritytech/jsonrpc.git" } jsonrpc-macros = { git="https://github.com/paritytech/jsonrpc.git" } jsonrpc-pubsub = { git="https://github.com/paritytech/jsonrpc.git" } log = "0.4" -parking_lot = "0.4" +parking_lot = "0.7.1" parity-codec = "2.1" serde = "1.0" serde_derive = "1.0" diff --git a/node/rpc/src/author/mod.rs b/node/rpc/src/author/mod.rs index 7e2603552533e..be8648750994f 100644 --- a/node/rpc/src/author/mod.rs +++ b/node/rpc/src/author/mod.rs @@ -64,7 +64,7 @@ build_rpc_trait! { /// Unsubscribe from extrinsic watching. #[rpc(name = "author_unwatchExtrinsic")] - fn unwatch_extrinsic(&self, Self::Metadata, SubscriptionId) -> Result; + fn unwatch_extrinsic(&self, Option, SubscriptionId) -> Result; } } @@ -149,7 +149,7 @@ impl AuthorApi, BlockHash

> for Author whe }) } - fn unwatch_extrinsic(&self, _metadata: Self::Metadata, id: SubscriptionId) -> Result { + fn unwatch_extrinsic(&self, _metadata: Option, id: SubscriptionId) -> Result { Ok(self.subscriptions.cancel(id)) } } diff --git a/node/rpc/src/chain/mod.rs b/node/rpc/src/chain/mod.rs index c4e0899fa17cd..7675f42e221b0 100644 --- a/node/rpc/src/chain/mod.rs +++ b/node/rpc/src/chain/mod.rs @@ -26,6 +26,7 @@ use rpc::Result as RpcResult; use rpc::futures::{stream, Future, Sink, Stream}; use runtime_primitives::generic::{BlockId, SignedBlock}; use runtime_primitives::traits::{Block as BlockT, Header, NumberFor}; +use serde::Serialize; use subscriptions::Subscriptions; @@ -37,7 +38,10 @@ use self::error::Result; build_rpc_trait! { /// Substrate blockchain API - pub trait ChainApi { + pub trait ChainApi where + Header: Serialize, + SignedBlock: Serialize, + { type Metadata; /// Get header of a relay chain block. @@ -65,7 +69,7 @@ build_rpc_trait! { /// Unsubscribe from new head subscription. #[rpc(name = "chain_unsubscribeNewHead", alias = ["unsubscribe_newHead", ])] - fn unsubscribe_new_head(&self, Self::Metadata, SubscriptionId) -> RpcResult; + fn unsubscribe_new_head(&self, Option, SubscriptionId) -> RpcResult; } #[pubsub(name = "chain_finalisedHead")] { @@ -75,7 +79,7 @@ build_rpc_trait! { /// Unsubscribe from new head subscription. #[rpc(name = "chain_unsubscribeFinalisedHeads")] - fn unsubscribe_finalised_heads(&self, Self::Metadata, SubscriptionId) -> RpcResult; + fn unsubscribe_finalised_heads(&self, Option, SubscriptionId) -> RpcResult; } } } @@ -148,7 +152,7 @@ impl Chain where } } -impl ChainApi, SignedBlock> for Chain where +impl ChainApi, Block::Hash, Block::Header, SignedBlock> for Chain where Block: BlockT + 'static, B: client::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static, @@ -189,7 +193,7 @@ impl ChainApi, Sig ) } - fn unsubscribe_new_head(&self, _metadata: Self::Metadata, id: SubscriptionId) -> RpcResult { + fn unsubscribe_new_head(&self, _metadata: Option, id: SubscriptionId) -> RpcResult { Ok(self.subscriptions.cancel(id)) } @@ -202,7 +206,7 @@ impl ChainApi, Sig ) } - fn unsubscribe_finalised_heads(&self, _metadata: Self::Metadata, id: SubscriptionId) -> RpcResult { + fn unsubscribe_finalised_heads(&self, _metadata: Option, id: SubscriptionId) -> RpcResult { Ok(self.subscriptions.cancel(id)) } } diff --git a/node/rpc/src/lib.rs b/node/rpc/src/lib.rs index e96078ff6e33c..90caaaf291f5f 100644 --- a/node/rpc/src/lib.rs +++ b/node/rpc/src/lib.rs @@ -22,6 +22,7 @@ extern crate jsonrpc_core as rpc; extern crate jsonrpc_pubsub; extern crate parity_codec as codec; extern crate parking_lot; +extern crate serde; extern crate serde_json; extern crate sr_primitives as runtime_primitives; extern crate sr_version as runtime_version; @@ -37,7 +38,6 @@ extern crate error_chain; extern crate jsonrpc_macros; #[macro_use] extern crate log; -#[macro_use] extern crate serde_derive; #[cfg(test)] diff --git a/node/rpc/src/state/mod.rs b/node/rpc/src/state/mod.rs index d044962f0a09e..209fe5bb3a504 100644 --- a/node/rpc/src/state/mod.rs +++ b/node/rpc/src/state/mod.rs @@ -85,7 +85,7 @@ build_rpc_trait! { /// Unsubscribe from runtime version subscription #[rpc(name = "state_unsubscribeRuntimeVersion", alias = ["chain_unsubscribeRuntimeVersion", ])] - fn unsubscribe_runtime_version(&self, Self::Metadata, SubscriptionId) -> RpcResult; + fn unsubscribe_runtime_version(&self, Option, SubscriptionId) -> RpcResult; } #[pubsub(name = "state_storage")] { @@ -95,7 +95,7 @@ build_rpc_trait! { /// Unsubscribe from storage subscription #[rpc(name = "state_unsubscribeStorage")] - fn unsubscribe_storage(&self, Self::Metadata, SubscriptionId) -> RpcResult; + fn unsubscribe_storage(&self, Option, SubscriptionId) -> RpcResult; } } } @@ -144,8 +144,7 @@ impl StateApi for State where .call( &BlockId::Hash(block), &method, &data.0 - )? - .return_data; + )?; Ok(Bytes(return_data)) } @@ -282,7 +281,7 @@ impl StateApi for State where }) } - fn unsubscribe_storage(&self, _meta: Self::Metadata, id: SubscriptionId) -> RpcResult { + fn unsubscribe_storage(&self, _meta: Option, id: SubscriptionId) -> RpcResult { Ok(self.subscriptions.cancel(id)) } @@ -334,7 +333,7 @@ impl StateApi for State where }); } - fn unsubscribe_runtime_version(&self, _meta: Self::Metadata, id: SubscriptionId) -> RpcResult { + fn unsubscribe_runtime_version(&self, _meta: Option, id: SubscriptionId) -> RpcResult { Ok(self.subscriptions.cancel(id)) } } diff --git a/node/rpc/src/system/helpers.rs b/node/rpc/src/system/helpers.rs index 0d3b7e56cd81e..3ab75fb50e091 100644 --- a/node/rpc/src/system/helpers.rs +++ b/node/rpc/src/system/helpers.rs @@ -43,6 +43,25 @@ pub struct Health { pub peers: usize, /// Is the node syncing pub is_syncing: bool, + /// Should this node have any peers + pub should_have_peers: bool, +} + +/// Network Peer information +#[derive(Debug, PartialEq, Serialize)] +pub struct PeerInfo { + /// Peer Node Index + pub index: usize, + /// Peer ID + pub peer_id: String, + /// Roles + pub roles: String, + /// Protocol version + pub protocol_version: u32, + /// Peer best block hash + pub best_hash: Hash, + /// Peer best block number + pub best_number: Number, } impl fmt::Display for Health { diff --git a/node/rpc/src/system/mod.rs b/node/rpc/src/system/mod.rs index 634dd1c0639d6..a06aaaad2384b 100644 --- a/node/rpc/src/system/mod.rs +++ b/node/rpc/src/system/mod.rs @@ -24,14 +24,14 @@ mod tests; use std::sync::Arc; use network; -use runtime_primitives::traits; +use runtime_primitives::traits::{self, Header as HeaderT}; use self::error::Result; -pub use self::helpers::{Properties, SystemInfo, Health}; +pub use self::helpers::{Properties, SystemInfo, Health, PeerInfo}; build_rpc_trait! { /// Substrate system RPC API - pub trait SystemApi { + pub trait SystemApi { /// Get the node's implementation name. Plain old string. #[rpc(name = "system_name")] fn system_name(&self) -> Result; @@ -55,6 +55,10 @@ build_rpc_trait! { /// - not performing a major sync #[rpc(name = "system_health")] fn system_health(&self) -> Result; + + /// Returns currently connected peers + #[rpc(name = "system_peers")] + fn system_peers(&self) -> Result>>; } } @@ -80,7 +84,7 @@ impl System { } } -impl SystemApi for System { +impl SystemApi::Number> for System { fn system_name(&self) -> Result { Ok(self.info.impl_name.clone()) } @@ -99,20 +103,21 @@ impl SystemApi for System { fn system_health(&self) -> Result { let status = self.sync.status(); + Ok(Health { + peers: status.num_peers, + is_syncing: status.sync.is_major_syncing(), + should_have_peers: self.should_have_peers, + }) + } - let is_syncing = status.sync.is_major_syncing(); - let peers = status.num_peers; - - let health = Health { - peers, - is_syncing, - }; - - let has_no_peers = peers == 0 && self.should_have_peers; - if has_no_peers || is_syncing { - Err(error::ErrorKind::NotHealthy(health))? - } else { - Ok(health) - } + fn system_peers(&self) -> Result::Number>>> { + Ok(self.sync.peers().into_iter().map(|(idx, peer_id, p)| PeerInfo { + index: idx, + peer_id: peer_id.map_or_else(Default::default, |p| p.to_base58()), + roles: format!("{:?}", p.roles), + protocol_version: p.protocol_version, + best_hash: p.best_hash, + best_number: p.best_number, + }).collect()) } } diff --git a/node/rpc/src/system/tests.rs b/node/rpc/src/system/tests.rs index 5c8f0b9058d72..169d5b914b000 100644 --- a/node/rpc/src/system/tests.rs +++ b/node/rpc/src/system/tests.rs @@ -16,8 +16,10 @@ use super::*; -use network::{self, SyncState, SyncStatus, ProtocolStatus}; +use network::{self, SyncState, SyncStatus, ProtocolStatus, NodeIndex, PeerId, PeerInfo as NetworkPeerInfo, PublicKey}; +use network::config::Roles; use test_client::runtime::Block; +use primitives::H256; #[derive(Default)] struct Status { @@ -37,6 +39,15 @@ impl network::SyncProvider for Status { num_active_peers: 0, } } + + fn peers(&self) -> Vec<(NodeIndex, Option, NetworkPeerInfo)> { + vec![(1, Some(PublicKey::Ed25519((0 .. 32).collect::>()).into()), NetworkPeerInfo { + roles: Roles::FULL, + protocol_version: 1, + best_hash: Default::default(), + best_number: 1 + })] + } } @@ -86,11 +97,12 @@ fn system_properties_works() { #[test] fn system_health() { assert_matches!( - api(None).system_health().unwrap_err().kind(), - error::ErrorKind::NotHealthy(Health { + api(None).system_health().unwrap(), + Health { peers: 0, is_syncing: false, - }) + should_have_peers: true, + } ); assert_matches!( @@ -98,11 +110,12 @@ fn system_health() { peers: 5, is_syncing: true, is_dev: true, - }).system_health().unwrap_err().kind(), - error::ErrorKind::NotHealthy(Health { + }).system_health().unwrap(), + Health { peers: 5, is_syncing: true, - }) + should_have_peers: false, + } ); assert_eq!( @@ -114,6 +127,7 @@ fn system_health() { Health { peers: 5, is_syncing: false, + should_have_peers: true, } ); @@ -126,6 +140,22 @@ fn system_health() { Health { peers: 0, is_syncing: false, + should_have_peers: false, } ); } + +#[test] +fn system_peers() { + assert_eq!( + api(None).system_peers().unwrap(), + vec![PeerInfo { + index: 1, + peer_id: "QmS5oyTmdjwBowwAH1D9YQnoe2HyWpVemH8qHiU5RqWPh4".into(), + roles: "FULL".into(), + protocol_version: 1, + best_hash: Default::default(), + best_number: 1u64, + }] + ); +} diff --git a/node/runtime/Cargo.toml b/node/runtime/Cargo.toml index 09f533373f470..a400609f83436 100644 --- a/node/runtime/Cargo.toml +++ b/node/runtime/Cargo.toml @@ -25,6 +25,7 @@ srml-staking = { path = "../../srml/staking", default-features = false } srml-system = { path = "../../srml/system", default-features = false } srml-timestamp = { path = "../../srml/timestamp", default-features = false } srml-treasury = { path = "../../srml/treasury", default-features = false } +srml-sudo = { path = "../../srml/sudo", default-features = false } srml-upgrade-key = { path = "../../srml/upgrade-key", default-features = false } srml-grandpa = { path = "../../srml/grandpa", default-features = false } sr-version = { path = "../../core/sr-version", default-features = false } @@ -55,6 +56,7 @@ std = [ "srml-system/std", "srml-timestamp/std", "srml-treasury/std", + "srml-sudo/std", "srml-upgrade-key/std", "sr-version/std", "node-primitives/std", diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index 27b9d48de3037..3567edbbf6f04 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -47,10 +47,10 @@ extern crate srml_executive as executive; extern crate srml_grandpa as grandpa; extern crate srml_session as session; extern crate srml_staking as staking; +extern crate srml_sudo as sudo; extern crate srml_system as system; extern crate srml_timestamp as timestamp; extern crate srml_treasury as treasury; -extern crate srml_upgrade_key as upgrade_key; #[macro_use] extern crate sr_version as version; extern crate node_primitives; @@ -96,8 +96,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("node"), impl_name: create_runtime_str!("substrate-node"), authoring_version: 10, - spec_version: 10, - impl_version: 0, + spec_version: 15, + impl_version: 15, apis: RUNTIME_API_VERSIONS, }; @@ -201,8 +201,9 @@ impl contract::Trait for Runtime { type Event = Event; } -impl upgrade_key::Trait for Runtime { +impl sudo::Trait for Runtime { type Event = Event; + type Proposal = Call; } impl grandpa::Trait for Runtime { @@ -232,7 +233,7 @@ construct_runtime!( Grandpa: grandpa::{Module, Call, Storage, Config, Log(), Event}, Treasury: treasury, Contract: contract::{Module, Call, Config, Event}, - UpgradeKey: upgrade_key, + Sudo: sudo, } ); @@ -250,7 +251,7 @@ pub type SignedBlock = generic::SignedBlock; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedMortalExtrinsic; +pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic; /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. diff --git a/node/runtime/wasm/Cargo.lock b/node/runtime/wasm/Cargo.lock index 6ecac5384e2ff..f1987f32d23e8 100644 --- a/node/runtime/wasm/Cargo.lock +++ b/node/runtime/wasm/Cargo.lock @@ -98,15 +98,6 @@ name = "crossbeam" version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "crossbeam-deque" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-deque" version = "0.6.2" @@ -116,20 +107,6 @@ dependencies = [ "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-epoch" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-epoch" version = "0.6.1" @@ -143,14 +120,6 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-utils" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-utils" version = "0.6.2" @@ -240,11 +209,6 @@ name = "futures" version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "gcc" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "hash-db" version = "0.9.0" @@ -298,6 +262,23 @@ dependencies = [ "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "impl-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "impl-serde" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "integer-sqrt" version = "0.1.2" @@ -520,6 +501,7 @@ dependencies = [ "srml-grandpa 0.1.0", "srml-session 0.1.0", "srml-staking 0.1.0", + "srml-sudo 0.1.0", "srml-support 0.1.0", "srml-system 0.1.0", "srml-timestamp 0.1.0", @@ -571,7 +553,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.10.15" +version = "0.10.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -579,12 +561,12 @@ dependencies = [ "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.39" +version = "0.9.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -593,14 +575,6 @@ dependencies = [ "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "owning_ref" version = "0.4.0" @@ -641,15 +615,6 @@ dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot" version = "0.6.4" @@ -661,24 +626,13 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot_core" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot_core" version = "0.3.1" @@ -713,6 +667,18 @@ name = "pkg-config" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "primitive-types" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro-hack" version = "0.4.1" @@ -847,25 +813,6 @@ dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rayon" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon-core" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "redox_syscall" version = "0.1.43" @@ -873,14 +820,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ring" -version = "0.12.1" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1282,6 +1228,24 @@ dependencies = [ "substrate-primitives 0.1.0", ] +[[package]] +name = "srml-sudo" +version = "0.1.0" +dependencies = [ + "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 0.1.0", + "sr-primitives 0.1.0", + "sr-std 0.1.0", + "srml-consensus 0.1.0", + "srml-support 0.1.0", + "srml-support-procedural 0.1.0", + "srml-system 0.1.0", + "substrate-primitives 0.1.0", +] + [[package]] name = "srml-support" version = "0.1.0" @@ -1419,7 +1383,7 @@ dependencies = [ "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 0.1.0", "sr-primitives 0.1.0", @@ -1453,8 +1417,10 @@ version = "0.1.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "sr-version 0.1.0", "substrate-primitives 0.1.0", @@ -1470,7 +1436,7 @@ dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -1510,21 +1476,20 @@ dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", "twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1545,7 +1510,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0", "substrate-trie 0.4.0", "trie-db 0.9.0 (git+https://github.com/paritytech/trie)", @@ -1558,7 +1523,7 @@ version = "0.3.0" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1809,6 +1774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1840,7 +1806,7 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1913,7 +1879,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1944,11 +1910,8 @@ dependencies = [ "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" -"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" "checksum crossbeam-deque 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe1b6f945f824c7a25afe44f62e25d714c0cc523f8e99d8db5cd1026e1269d3" -"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" "checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8" -"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e07fc155212827475223f0bcfae57e945e694fc90950ddf3f6695bbfd5555c72" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" @@ -1962,7 +1925,6 @@ dependencies = [ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" -"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" @@ -1970,6 +1932,8 @@ dependencies = [ "checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +"checksum impl-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c88568d828291c50eed30cd7fb9f8e688ad0013620186fa3e777b9f206c79f2" +"checksum impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5158079de9d4158e0ce1de3ae0bd7be03904efc40b3d7dd8b8c301cbf6b52b56" "checksum integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ea155abb3ba6f382a75f1418988c05fe82959ed9ce727de427f9cfd425b0c903" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" @@ -1998,22 +1962,20 @@ dependencies = [ "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" "checksum once_cell 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d7ce3535d54560c937c1652ba4a0da66bfc63e0f8e07bed127483afb6e5ee925" -"checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" -"checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" +"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)" = "" "checksum parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dca389ea5e1632c89b2ce54f7e2b4a8a8c9d278042222a91e0bf95451218cb4c" "checksum parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffa42c2cb493b60b12c75b26e8c94cb734af4df4d7f2cc229dc04c1953dac189" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" -"checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" -"checksum parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9723236a9525c757d9725b993511e3fc941e33f27751942232f0058298297edf" -"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum primitive-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f47c18b4601125931d69fcf7b000c2c16a304e4f84d58218d6470b4502e00b58" "checksum proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c725b36c99df7af7bf9324e9c999b9e37d92c8f8caf106d82e1d7953218d2d8" "checksum proc-macro-hack-impl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2b753ad9ed99dd8efeaa7d2fb8453c8f6bc3e54b97966d35f1bc77ca6865254a" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" @@ -2029,10 +1991,8 @@ dependencies = [ "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" "checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" -"checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" -"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d" -"checksum ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7d28b30a72c01b458428e0ae988d4149c20d902346902be881e3edc4bb325c" +"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" @@ -2079,7 +2039,7 @@ dependencies = [ "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae" +"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" diff --git a/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm b/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm index 7df5b21ce835b..4319fbc77cfdf 100644 Binary files a/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm and b/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm differ diff --git a/srml/assets/src/lib.rs b/srml/assets/src/lib.rs index c84620f4e763e..dd6446c958541 100644 --- a/srml/assets/src/lib.rs +++ b/srml/assets/src/lib.rs @@ -62,7 +62,7 @@ type AssetId = u32; decl_module! { // Simple declaration of the `Module` type. Lets the macro know what its working on. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Issue a new class of fungible assets. There are, and will only ever be, `total` /// such assets and they'll all belong to the `origin` initially. It will have an /// identifier `AssetId` instance: this will be specified in the `Issued` event. diff --git a/srml/aura/Cargo.toml b/srml/aura/Cargo.toml index 2c8ea28eb8a87..6d9e8dd35e508 100644 --- a/srml/aura/Cargo.toml +++ b/srml/aura/Cargo.toml @@ -20,7 +20,7 @@ srml-staking = { path = "../staking", default-features = false } [dev-dependencies] lazy_static = "1.0" -parking_lot = "0.6" +parking_lot = "0.7.1" [features] default = ["std"] diff --git a/srml/aura/src/mock.rs b/srml/aura/src/mock.rs index 125466c9c048a..eb1fc9756bfa4 100644 --- a/srml/aura/src/mock.rs +++ b/srml/aura/src/mock.rs @@ -18,7 +18,7 @@ #![cfg(test)] -use primitives::{BuildStorage, testing::{Digest, DigestItem, Header}}; +use primitives::{BuildStorage, testing::{Digest, DigestItem, Header, UintAuthorityId}}; use runtime_io; use substrate_primitives::{H256, Blake2Hasher}; use {Trait, Module, consensus, system, timestamp}; @@ -34,7 +34,7 @@ pub struct Test; impl consensus::Trait for Test { const NOTE_OFFLINE_POSITION: u32 = 1; type Log = DigestItem; - type SessionKey = u64; + type SessionKey = UintAuthorityId; type InherentOfflineReport = (); } @@ -66,7 +66,7 @@ pub fn new_test_ext(authorities: Vec) -> runtime_io::TestExternalities::default().build_storage().unwrap().0; t.extend(consensus::GenesisConfig::{ code: vec![], - authorities, + authorities: authorities.into_iter().map(|a| UintAuthorityId(a)).collect(), }.build_storage().unwrap().0); t.extend(timestamp::GenesisConfig::{ period: 1, diff --git a/srml/balances/src/lib.rs b/srml/balances/src/lib.rs index deadbfd656523..c6e5d7729a722 100644 --- a/srml/balances/src/lib.rs +++ b/srml/balances/src/lib.rs @@ -136,7 +136,7 @@ pub trait Trait: system::Trait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Transfer some liquid free balance to another staker. pub fn transfer( diff --git a/srml/consensus/src/lib.rs b/srml/consensus/src/lib.rs index 2c72642cf680e..2a55ac9e1968f 100644 --- a/srml/consensus/src/lib.rs +++ b/srml/consensus/src/lib.rs @@ -143,12 +143,12 @@ impl RawLog { // Implementation for tests outside of this crate. #[cfg(any(feature = "std", test))] -impl From> for primitives::testing::DigestItem where N: Into { +impl From> for primitives::testing::DigestItem where N: Into { fn from(log: RawLog) -> primitives::testing::DigestItem { match log { RawLog::AuthoritiesChange(authorities) => - primitives::generic::DigestItem::AuthoritiesChange - ::(authorities.into_iter() + primitives::generic::DigestItem::AuthoritiesChange( + authorities.into_iter() .map(Into::into).collect()), } } diff --git a/srml/consensus/src/mock.rs b/srml/consensus/src/mock.rs index 5945a89018a2d..78351309acd16 100644 --- a/srml/consensus/src/mock.rs +++ b/srml/consensus/src/mock.rs @@ -18,7 +18,7 @@ #![cfg(test)] -use primitives::{BuildStorage, testing::{Digest, DigestItem, Header}}; +use primitives::{BuildStorage, testing::{Digest, DigestItem, Header, UintAuthorityId}}; use runtime_io; use substrate_primitives::{H256, Blake2Hasher}; use {GenesisConfig, Trait, Module, system}; @@ -33,7 +33,7 @@ pub struct Test; impl Trait for Test { const NOTE_OFFLINE_POSITION: u32 = 1; type Log = DigestItem; - type SessionKey = u64; + type SessionKey = UintAuthorityId; type InherentOfflineReport = ::InstantFinalityReportVec<()>; } impl system::Trait for Test { @@ -53,7 +53,7 @@ pub fn new_test_ext(authorities: Vec) -> runtime_io::TestExternalities::default().build_storage().unwrap().0; t.extend(GenesisConfig::{ code: vec![], - authorities, + authorities: authorities.into_iter().map(|a| UintAuthorityId(a)).collect(), }.build_storage().unwrap().0); t.into() } diff --git a/srml/consensus/src/tests.rs b/srml/consensus/src/tests.rs index 9c57739fbc856..9dc65136fbc28 100644 --- a/srml/consensus/src/tests.rs +++ b/srml/consensus/src/tests.rs @@ -18,21 +18,20 @@ #![cfg(test)] -use primitives::{generic, testing, traits::{OnFinalise, ProvideInherent}}; +use primitives::{generic, testing::{self, UintAuthorityId}, traits::{OnFinalise, ProvideInherent}}; use runtime_io::with_externalities; -use substrate_primitives::H256; use mock::{Consensus, System, new_test_ext}; #[test] fn authorities_change_logged() { with_externalities(&mut new_test_ext(vec![1, 2, 3]), || { System::initialise(&1, &Default::default(), &Default::default()); - Consensus::set_authorities(&[4, 5, 6]); + Consensus::set_authorities(&[UintAuthorityId(4), UintAuthorityId(5), UintAuthorityId(6)]); Consensus::on_finalise(1); let header = System::finalise(); assert_eq!(header.digest, testing::Digest { logs: vec![ - generic::DigestItem::AuthoritiesChange::(vec![4, 5, 6]), + generic::DigestItem::AuthoritiesChange(vec![UintAuthorityId(4).into(), UintAuthorityId(5).into(), UintAuthorityId(6).into()]), ], }); }); @@ -54,8 +53,8 @@ fn authorities_change_is_not_logged_when_not_changed() { fn authorities_change_is_not_logged_when_changed_back_to_original() { with_externalities(&mut new_test_ext(vec![1, 2, 3]), || { System::initialise(&1, &Default::default(), &Default::default()); - Consensus::set_authorities(&[4, 5, 6]); - Consensus::set_authorities(&[1, 2, 3]); + Consensus::set_authorities(&[UintAuthorityId(4), UintAuthorityId(5), UintAuthorityId(6)]); + Consensus::set_authorities(&[UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(3)]); Consensus::on_finalise(1); let header = System::finalise(); assert_eq!(header.digest, testing::Digest { diff --git a/srml/contract/src/lib.rs b/srml/contract/src/lib.rs index e87c289ed82fa..cf1d2ac1db617 100644 --- a/srml/contract/src/lib.rs +++ b/srml/contract/src/lib.rs @@ -147,7 +147,7 @@ where decl_module! { /// Contracts module. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; // TODO: Change AccountId to staking::Address /// Make a call to a specified account, optionally transferring some balance. /// Make a call to a specified account, optionally transferring some balance. diff --git a/srml/council/src/motions.rs b/srml/council/src/motions.rs index 5316d5c68127d..ad0f5032cf1cf 100644 --- a/srml/council/src/motions.rs +++ b/srml/council/src/motions.rs @@ -67,7 +67,7 @@ decl_event!( decl_module! { pub struct Module for enum Call where origin: ::Origin { - fn deposit_event() = default; + fn deposit_event() = default; fn propose(origin, threshold: Compact, proposal: Box<::Proposal>) { let who = ensure_signed(origin)?; let threshold = threshold.into(); diff --git a/srml/council/src/seats.rs b/srml/council/src/seats.rs index 7fef771d38b84..54579e356e3b5 100644 --- a/srml/council/src/seats.rs +++ b/srml/council/src/seats.rs @@ -87,16 +87,23 @@ pub trait Trait: democracy::Trait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Set candidate approvals. Approval slots stay valid as long as candidates in those slots /// are registered. fn set_approvals(origin, votes: Vec, index: Compact) { let who = ensure_signed(origin)?; let index: VoteIndex = index.into(); + let candidates = Self::candidates(); ensure!(!Self::presentation_active(), "no approval changes during presentation period"); ensure!(index == Self::vote_index(), "incorrect vote index"); + ensure!(!candidates.len().is_zero(), "amount of candidates to receive approval votes should be non-zero"); + // Prevent a vote from voters that provide a list of votes that exceeds the candidates length + // since otherise an attacker may be able to submit a very long list of `votes` that far exceeds + // the amount of candidates and waste more computation than a reasonable voting bond would cover. + ensure!(candidates.len() >= votes.len(), "amount of candidate approval votes cannot exceed amount of candidates"); + if !>::exists(&who) { // not yet a voter - deduct bond. // NOTE: this must be the last potential bailer, since it changes state. @@ -132,7 +139,7 @@ decl_module! { ensure!(Self::voter_last_active(&reporter).is_some(), "reporter must be a voter"); let last_active = Self::voter_last_active(&who).ok_or("target for inactivity cleanup must be active")?; ensure!(assumed_vote_index == Self::vote_index(), "vote index not current"); - ensure!(last_active < assumed_vote_index - Self::inactivity_grace_period(), "cannot reap during grace perid"); + ensure!(assumed_vote_index > last_active + Self::inactivity_grace_period(), "cannot reap during grace period"); let voters = Self::voters(); let reporter_index: u32 = reporter_index.into(); let reporter_index = reporter_index as usize; @@ -157,7 +164,7 @@ decl_module! { voters ); if valid { - // This only fails if `who` doesn't exist, which it clearly must do since its the origin. + // This only fails if `reporter` doesn't exist, which it clearly must do since its the origin. // Still, it's no more harmful to propagate any error at this point. >::repatriate_reserved(&who, &reporter, Self::voting_bond())?; Self::deposit_event(RawEvent::VoterReaped(who, reporter)); @@ -225,6 +232,7 @@ decl_module! { ) -> Result { let who = ensure_signed(origin)?; let total = total.into(); + ensure!(!total.is_zero(), "stake deposited to present winner and be added to leaderboard should be non-zero"); let index: VoteIndex = index.into(); let candidate = >::lookup(candidate)?; @@ -324,7 +332,7 @@ decl_storage! { pub CarryCount get(carry_count) config(): u32 = 2; /// How long to give each top candidate to present themselves after the vote ends. pub PresentationDuration get(presentation_duration) config(): T::BlockNumber = T::BlockNumber::sa(1000); - /// How many votes need to go by after a voter's last vote before they can be reaped if their + /// How many vote indexes need to go by after a target voter's last vote before they can be reaped if their /// approvals are moot. pub InactiveGracePeriod get(inactivity_grace_period) config(inactive_grace_period): VoteIndex = 1; /// How often (in blocks) to check for new votes. @@ -336,13 +344,16 @@ decl_storage! { // permanent state (always relevant, changes only at the finalisation of voting) /// The current council. When there's a vote going on, this should still be used for executive - /// matters. + /// matters. The block number (second element in the tuple) is the block that their position is + /// active until (calculated by the sum of the block number when the council member was elected + /// and their term duration). pub ActiveCouncil get(active_council) config(): Vec<(T::AccountId, T::BlockNumber)>; /// The total number of votes that have happened or are in progress. pub VoteCount get(vote_index): VoteIndex; // persistent state (always relevant, changes constantly) - /// The last cleared vote index that this voter was last active at. + /// A list of votes for each voter, respecting the last cleared vote index that this voter was + /// last active at. pub ApprovalsOf get(approvals_of): map T::AccountId => Vec; /// The vote index and list slot that the candidate `who` was registered or `None` if they are not /// currently registered. @@ -459,8 +470,9 @@ impl Module { let desired_seats = Self::desired_seats() as usize; let number = >::block_number(); let expiring = active_council.iter().take_while(|i| i.1 == number).map(|i| i.0.clone()).collect::>(); - if active_council.len() - expiring.len() < desired_seats { - let empty_seats = desired_seats - (active_council.len() - expiring.len()); + let retaining_seats = active_council.len() - expiring.len(); + if retaining_seats < desired_seats { + let empty_seats = desired_seats - retaining_seats; >::put((number + Self::presentation_duration(), empty_seats as u32, expiring)); let voters = Self::voters(); @@ -558,6 +570,7 @@ mod tests { assert_eq!(Council::voting_bond(), 3); assert_eq!(Council::present_slash_per_voter(), 1); assert_eq!(Council::presentation_duration(), 2); + assert_eq!(Council::inactivity_grace_period(), 1); assert_eq!(Council::voting_period(), 4); assert_eq!(Council::term_duration(), 5); assert_eq!(Council::desired_seats(), 2); @@ -723,6 +736,29 @@ mod tests { }); } + #[test] + fn setting_any_approval_vote_count_without_any_candidate_count_should_not_work() { + with_externalities(&mut new_test_ext(false), || { + System::set_block_number(1); + + assert_eq!(Council::candidates().len(), 0); + + assert_noop!(Council::set_approvals(Origin::signed(4), vec![], 0.into()), "amount of candidates to receive approval votes should be non-zero"); + }); + } + + #[test] + fn setting_an_approval_vote_count_more_than_candidate_count_should_not_work() { + with_externalities(&mut new_test_ext(false), || { + System::set_block_number(1); + + assert_ok!(Council::submit_candidacy(Origin::signed(5), 0.into())); + assert_eq!(Council::candidates().len(), 1); + + assert_noop!(Council::set_approvals(Origin::signed(4), vec![true, true], 0.into()), "amount of candidate approval votes cannot exceed amount of candidates"); + }); + } + #[test] fn resubmitting_voting_should_work() { with_externalities(&mut new_test_ext(false), || { @@ -735,6 +771,7 @@ mod tests { assert_ok!(Council::submit_candidacy(Origin::signed(2), 1.into())); assert_ok!(Council::submit_candidacy(Origin::signed(3), 2.into())); + assert_eq!(Council::candidates().len(), 3); assert_ok!(Council::set_approvals(Origin::signed(4), vec![true, false, true], 0.into())); assert_eq!(Council::approvals_of(4), vec![true, false, true]); @@ -749,6 +786,7 @@ mod tests { assert_ok!(Council::submit_candidacy(Origin::signed(5), 0.into())); assert_ok!(Council::submit_candidacy(Origin::signed(2), 1.into())); assert_ok!(Council::submit_candidacy(Origin::signed(3), 2.into())); + assert_eq!(Council::candidates().len(), 3); assert_ok!(Council::set_approvals(Origin::signed(1), vec![true], 0.into())); assert_ok!(Council::set_approvals(Origin::signed(2), vec![false, true, true], 0.into())); @@ -853,6 +891,19 @@ mod tests { }); } + #[test] + fn presentations_with_zero_staked_deposit_should_not_work() { + with_externalities(&mut new_test_ext(false), || { + System::set_block_number(4); + assert_ok!(Council::submit_candidacy(Origin::signed(2), 0.into())); + assert_ok!(Council::set_approvals(Origin::signed(2), vec![true], 0.into())); + assert_ok!(Council::end_block(System::block_number())); + + System::set_block_number(6); + assert_noop!(Council::present_winner(Origin::signed(4), 2.into(), 0.into(), 0.into()), "stake deposited to present winner and be added to leaderboard should be non-zero"); + }); + } + #[test] fn double_presentations_should_be_punished() { with_externalities(&mut new_test_ext(false), || { @@ -1057,9 +1108,15 @@ mod tests { assert_ok!(Council::present_winner(Origin::signed(4), 3.into(), 30.into(), 1.into())); assert_ok!(Council::end_block(System::block_number())); + assert_eq!(Council::vote_index(), 2); + assert_eq!(Council::inactivity_grace_period(), 1); + assert_eq!(Council::voting_period(), 4); + assert_eq!(Council::voter_last_active(4), Some(0)); + assert_ok!(Council::reap_inactive_voter(Origin::signed(4), (Council::voters().iter().position(|&i| i == 4).unwrap() as u32).into(), - 2.into(), (Council::voters().iter().position(|&i| i == 2).unwrap() as u32).into(), + 2.into(), + (Council::voters().iter().position(|&i| i == 2).unwrap() as u32).into(), 2.into() )); @@ -1119,6 +1176,14 @@ mod tests { assert_ok!(Council::present_winner(Origin::signed(4), 3.into(), 30.into(), 0.into())); assert_ok!(Council::present_winner(Origin::signed(4), 4.into(), 40.into(), 0.into())); assert_ok!(Council::present_winner(Origin::signed(4), 5.into(), 50.into(), 0.into())); + + assert_eq!(Council::leaderboard(), Some(vec![ + (30, 3), + (40, 4), + (50, 5), + (60, 1) + ])); + assert_noop!(Council::present_winner(Origin::signed(4), 2.into(), 20.into(), 0.into()), "candidate not worthy of leaderboard"); }); } @@ -1240,6 +1305,8 @@ mod tests { System::set_block_number(6); assert!(Council::presentation_active()); assert_ok!(Council::present_winner(Origin::signed(4), 1.into(), 60.into(), 0.into())); + // leaderboard length is the empty seats plus the carry count (i.e. 5 + 2), where those + // to be carried are the lowest and stored in lowest indexes assert_eq!(Council::leaderboard(), Some(vec![ (0, 0), (0, 0), diff --git a/srml/council/src/voting.rs b/srml/council/src/voting.rs index 9536fe5d35029..ffc340e4f9da4 100644 --- a/srml/council/src/voting.rs +++ b/srml/council/src/voting.rs @@ -33,7 +33,7 @@ pub trait Trait: CouncilTrait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; fn propose(origin, proposal: Box) { let who = ensure_signed(origin)?; diff --git a/srml/democracy/src/lib.rs b/srml/democracy/src/lib.rs index 2bf9e21ae74f4..599e15b0c08b9 100644 --- a/srml/democracy/src/lib.rs +++ b/srml/democracy/src/lib.rs @@ -87,7 +87,7 @@ pub trait Trait: balances::Trait + Sized { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Propose a sensitive action to be taken. fn propose( @@ -376,7 +376,7 @@ impl Module { .map(|a| (a.clone(), Self::vote_of((index, a)))) // ^^^ defensive only: all items come from `voters`; for an item to be in `voters` there must be a vote registered; qed .filter(|&(_, vote)| vote.is_aye() == approved) // Just the winning coins - { + { // now plus: the base lock period multiplied by the number of periods this voter offered to // lock should they win... let locked_until = now + lock_period * T::BlockNumber::sa((vote.multiplier()) as u64); diff --git a/srml/example/src/lib.rs b/srml/example/src/lib.rs index 31baac20f72e5..8b14aae6ee534 100644 --- a/srml/example/src/lib.rs +++ b/srml/example/src/lib.rs @@ -98,7 +98,9 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { /// Deposit one of this module's events by using the default implementation. /// It is also possible to provide a custom implementation. - fn deposit_event() = default; + /// For non-generic events, the generic parameter just needs to be dropped, so that it + /// looks like: `fn deposit_event() = default;`. + fn deposit_event() = default; /// This is your public interface. Be extremely careful. /// This is just a simple example of how to interact with the module from the external /// world. diff --git a/srml/grandpa/src/lib.rs b/srml/grandpa/src/lib.rs index de2d10b0f1b72..1a0d0f7c31dea 100644 --- a/srml/grandpa/src/lib.rs +++ b/srml/grandpa/src/lib.rs @@ -61,7 +61,7 @@ use runtime_support::dispatch::Result; use runtime_support::storage::StorageValue; use runtime_support::storage::unhashed::StorageVec; use primitives::traits::{CurrentHeight, Convert}; -use substrate_primitives::AuthorityId; +use substrate_primitives::Ed25519AuthorityId; use system::ensure_signed; use primitives::traits::MaybeSerializeDebug; @@ -105,7 +105,7 @@ impl RawLog { } impl GrandpaChangeSignal for RawLog - where N: Clone, SessionKey: Clone + Into, + where N: Clone, SessionKey: Clone + Into, { fn as_signal(&self) -> Option> { RawLog::as_signal(self).map(|(delay, next_authorities)| ScheduledChange { @@ -176,7 +176,7 @@ decl_storage! { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Report some misbehaviour. fn report_misbehavior(origin, _report: Vec) { @@ -243,7 +243,7 @@ impl Module { } } -impl Module where AuthorityId: core::convert::From<::SessionKey> { +impl Module where Ed25519AuthorityId: core::convert::From<::SessionKey> { /// See if the digest contains any scheduled change. pub fn scrape_digest_change(log: &Log) -> Option> diff --git a/srml/session/src/lib.rs b/srml/session/src/lib.rs index 8fc58feab2b30..ea33395021346 100644 --- a/srml/session/src/lib.rs +++ b/srml/session/src/lib.rs @@ -42,6 +42,7 @@ use primitives::traits::{As, Zero, One, Convert}; use codec::HasCompact; use runtime_support::{StorageValue, StorageMap}; use runtime_support::dispatch::Result; +use runtime_support::for_each_tuple; use system::ensure_signed; use rstd::ops::Mul; @@ -51,17 +52,6 @@ pub trait OnSessionChange { fn on_session_change(time_elapsed: T, should_reward: bool); } -macro_rules! for_each_tuple { - ($m:ident) => { - for_each_tuple! { @IMPL $m !! A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, } - }; - (@IMPL $m:ident !!) => { $m! { } }; - (@IMPL $m:ident !! $h:ident, $($t:ident,)*) => { - $m! { $h $($t)* } - for_each_tuple! { @IMPL $m !! $($t,)* } - } -} - macro_rules! impl_session_change { () => ( impl OnSessionChange for () { @@ -80,7 +70,6 @@ macro_rules! impl_session_change { for_each_tuple!(impl_session_change); - pub trait Trait: timestamp::Trait { type ConvertAccountIdToSessionKey: Convert; type OnSessionChange: OnSessionChange; @@ -89,7 +78,7 @@ pub trait Trait: timestamp::Trait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Sets the session key of `_validator` to `_key`. This doesn't take effect until the next /// session. @@ -248,8 +237,8 @@ mod tests { use runtime_io::with_externalities; use substrate_primitives::{H256, Blake2Hasher}; use primitives::BuildStorage; - use primitives::traits::{Identity, BlakeTwo256}; - use primitives::testing::{Digest, DigestItem, Header}; + use primitives::traits::BlakeTwo256; + use primitives::testing::{Digest, DigestItem, Header, UintAuthorityId, ConvertUintAuthorityId}; impl_outer_origin!{ pub enum Origin for Test {} @@ -260,7 +249,7 @@ mod tests { impl consensus::Trait for Test { const NOTE_OFFLINE_POSITION: u32 = 1; type Log = DigestItem; - type SessionKey = u64; + type SessionKey = UintAuthorityId; type InherentOfflineReport = (); } impl system::Trait for Test { @@ -281,7 +270,7 @@ mod tests { type OnTimestampSet = (); } impl Trait for Test { - type ConvertAccountIdToSessionKey = Identity; + type ConvertAccountIdToSessionKey = ConvertUintAuthorityId; type OnSessionChange = (); type Event = (); } @@ -294,7 +283,7 @@ mod tests { let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; t.extend(consensus::GenesisConfig::{ code: vec![], - authorities: vec![1, 2, 3], + authorities: vec![UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(3)], }.build_storage().unwrap().0); t.extend(timestamp::GenesisConfig::{ period: 5, @@ -309,7 +298,7 @@ mod tests { #[test] fn simple_setup_should_work() { with_externalities(&mut new_test_ext(), || { - assert_eq!(Consensus::authorities(), vec![1, 2, 3]); + assert_eq!(Consensus::authorities(), vec![UintAuthorityId(1).into(), UintAuthorityId(2).into(), UintAuthorityId(3).into()]); assert_eq!(Session::length(), 2); assert_eq!(Session::validators(), vec![1, 2, 3]); }); @@ -405,25 +394,25 @@ mod tests { // Block 1: No change System::set_block_number(1); Session::check_rotate_session(1); - assert_eq!(Consensus::authorities(), vec![1, 2, 3]); + assert_eq!(Consensus::authorities(), vec![UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(3)]); // Block 2: Session rollover, but no change. System::set_block_number(2); Session::check_rotate_session(2); - assert_eq!(Consensus::authorities(), vec![1, 2, 3]); + assert_eq!(Consensus::authorities(), vec![UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(3)]); // Block 3: Set new key for validator 2; no visible change. System::set_block_number(3); - assert_ok!(Session::set_key(Origin::signed(2), 5)); - assert_eq!(Consensus::authorities(), vec![1, 2, 3]); + assert_ok!(Session::set_key(Origin::signed(2), UintAuthorityId(5))); + assert_eq!(Consensus::authorities(), vec![UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(3)]); Session::check_rotate_session(3); - assert_eq!(Consensus::authorities(), vec![1, 2, 3]); + assert_eq!(Consensus::authorities(), vec![UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(3)]); // Block 4: Session rollover, authority 2 changes. System::set_block_number(4); Session::check_rotate_session(4); - assert_eq!(Consensus::authorities(), vec![1, 5, 3]); + assert_eq!(Consensus::authorities(), vec![UintAuthorityId(1), UintAuthorityId(5), UintAuthorityId(3)]); }); } } diff --git a/srml/staking/src/lib.rs b/srml/staking/src/lib.rs index 208c14fc0f1bf..70f71de152780 100644 --- a/srml/staking/src/lib.rs +++ b/srml/staking/src/lib.rs @@ -100,7 +100,7 @@ pub trait Trait: balances::Trait + session::Trait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Declare the desire to stake for the transactor. /// @@ -224,6 +224,11 @@ decl_module! { let new: u32 = new.into(); >::put(new); } + + /// Set the validators who cannot be slashed (if any). + fn set_invulnerables(validators: Vec) { + >::put(validators); + } } } @@ -260,6 +265,10 @@ decl_storage! { /// The length of the bonding duration in blocks. pub BondingDuration get(bonding_duration) config(): T::BlockNumber = T::BlockNumber::sa(1000); + /// Any validators that may never be slashed or forcible kicked. It's a Vec since they're easy to initialise + /// and the performance hit is minimal (we expect no more than four invulnerables) and restricted to testnets. + pub Invulerables get(invulnerables) config(): Vec; + /// The current era index. pub CurrentEra get(current_era) config(): T::BlockNumber; /// Preferences that a validator has. @@ -499,50 +508,68 @@ impl Module { /// Call when a validator is determined to be offline. `count` is the /// number of offences the validator has committed. pub fn on_offline_validator(v: T::AccountId, count: usize) { - use primitives::traits::CheckedShl; + use primitives::traits::{CheckedAdd, CheckedShl}; + + // Early exit if validator is invulnerable. + if Self::invulnerables().contains(&v) { + return + } - for _ in 0..count { - let slash_count = Self::slash_count(&v); - >::insert(v.clone(), slash_count + 1); - let grace = Self::offline_slash_grace(); + let slash_count = Self::slash_count(&v); + let new_slash_count = slash_count + count as u32; + >::insert(v.clone(), new_slash_count); + let grace = Self::offline_slash_grace(); - let event = if slash_count >= grace { + let event = if new_slash_count > grace { + let slash = { + let base_slash = Self::current_offline_slash(); let instances = slash_count - grace; - let base_slash = Self::current_offline_slash(); - let slash = match base_slash.checked_shl(instances) { - Some(slash) => slash, - None => { - // freeze at last maximum valid slash if this starts - // to overflow. - >::insert(v.clone(), slash_count); - base_slash.checked_shl(instances - 1) - .expect("slash count no longer incremented after overflow; \ - prior check only fails with instances >= 1; \ - thus instances - 1 always works and is a valid amount of bits; qed") + let mut total_slash = T::Balance::default(); + for i in instances..(instances + count as u32) { + if let Some(total) = base_slash.checked_shl(i) + .and_then(|slash| total_slash.checked_add(&slash)) { + total_slash = total; + } else { + // reset slash count only up to the current + // instance. the total slash overflows the unit for + // balance in the system therefore we can slash all + // the slashable balance for the account + >::insert(v.clone(), slash_count + i); + total_slash = Self::slashable_balance(&v); + break; } - }; - - let next_slash = slash << 1; - - let _ = Self::slash_validator(&v, slash); - if instances >= Self::validator_preferences(&v).unstake_threshold - || Self::slashable_balance(&v) < next_slash - { - if let Some(pos) = Self::intentions().into_iter().position(|x| &x == &v) { - Self::apply_unstake(&v, pos) - .expect("pos derived correctly from Self::intentions(); \ - apply_unstake can only fail if pos wrong; \ - Self::intentions() doesn't change; qed"); - } - let _ = Self::apply_force_new_era(false); } - RawEvent::OfflineSlash(v.clone(), slash) - } else { - RawEvent::OfflineWarning(v.clone(), slash_count) + + total_slash }; - Self::deposit_event(event); - } + + let _ = Self::slash_validator(&v, slash); + + let next_slash = match slash.checked_shl(1) { + Some(slash) => slash, + None => Self::slashable_balance(&v), + }; + + let instances = new_slash_count - grace; + if instances > Self::validator_preferences(&v).unstake_threshold + || Self::slashable_balance(&v) < next_slash + || next_slash <= slash + { + if let Some(pos) = Self::intentions().into_iter().position(|x| &x == &v) { + Self::apply_unstake(&v, pos) + .expect("pos derived correctly from Self::intentions(); \ + apply_unstake can only fail if pos wrong; \ + Self::intentions() doesn't change; qed"); + } + let _ = Self::apply_force_new_era(false); + } + RawEvent::OfflineSlash(v.clone(), slash) + } else { + RawEvent::OfflineWarning(v.clone(), slash_count) + }; + + Self::deposit_event(event); } } diff --git a/srml/staking/src/mock.rs b/srml/staking/src/mock.rs index a434b4510be8f..b6efce154d085 100644 --- a/srml/staking/src/mock.rs +++ b/srml/staking/src/mock.rs @@ -19,8 +19,8 @@ #![cfg(test)] use primitives::BuildStorage; -use primitives::{Perbill, traits::Identity}; -use primitives::testing::{Digest, DigestItem, Header}; +use primitives::Perbill; +use primitives::testing::{Digest, DigestItem, Header, UintAuthorityId, ConvertUintAuthorityId}; use substrate_primitives::{H256, Blake2Hasher}; use runtime_io; use {GenesisConfig, Module, Trait, consensus, session, system, timestamp, balances}; @@ -35,7 +35,7 @@ pub struct Test; impl consensus::Trait for Test { const NOTE_OFFLINE_POSITION: u32 = 1; type Log = DigestItem; - type SessionKey = u64; + type SessionKey = UintAuthorityId; type InherentOfflineReport = (); } impl system::Trait for Test { @@ -58,7 +58,7 @@ impl balances::Trait for Test { type Event = (); } impl session::Trait for Test { - type ConvertAccountIdToSessionKey = Identity; + type ConvertAccountIdToSessionKey = ConvertUintAuthorityId; type OnSessionChange = Staking; type Event = (); } @@ -123,6 +123,7 @@ pub fn new_test_ext( current_session_reward: reward, current_offline_slash: 20, offline_slash_grace: 0, + invulnerables: vec![], }.build_storage().unwrap().0); t.extend(timestamp::GenesisConfig::{ period: 5, diff --git a/srml/staking/src/tests.rs b/srml/staking/src/tests.rs index 88ce66c8d79e1..fc3209bae3480 100644 --- a/srml/staking/src/tests.rs +++ b/srml/staking/src/tests.rs @@ -35,6 +35,22 @@ fn note_null_offline_should_work() { }); } +#[test] +fn invulnerability_should_work() { + with_externalities(&mut new_test_ext(0, 3, 3, 0, true, 10), || { + Staking::set_invulnerables(vec![10]); + Balances::set_free_balance(&10, 70); + assert_eq!(Staking::offline_slash_grace(), 0); + assert_eq!(Staking::slash_count(&10), 0); + assert_eq!(Balances::free_balance(&10), 70); + System::set_extrinsic_index(1); + Staking::on_offline_validator(10, 1); + assert_eq!(Staking::slash_count(&10), 0); + assert_eq!(Balances::free_balance(&10), 70); + assert!(Staking::forcing_new_era().is_none()); + }); +} + #[test] fn note_offline_should_work() { with_externalities(&mut new_test_ext(0, 3, 3, 0, true, 10), || { @@ -541,3 +557,42 @@ fn slash_value_calculation_does_not_overflow() { Staking::on_offline_validator(10, 100); }); } + +#[test] +fn next_slash_value_calculation_does_not_overflow() { + with_externalities(&mut new_test_ext(0, 3, 3, 0, true, 10), || { + assert_eq!(Staking::era_length(), 9); + assert_eq!(Staking::sessions_per_era(), 3); + assert_eq!(Staking::last_era_length_change(), 0); + assert_eq!(Staking::current_era(), 0); + assert_eq!(Session::current_index(), 0); + assert_eq!(Balances::total_balance(&10), 1); + assert_eq!(Staking::intentions(), vec![10, 20]); + assert_eq!(Staking::offline_slash_grace(), 0); + + // set validator preferences so the validator doesn't back down after + // slashing. + >::insert(10, ValidatorPrefs { + unstake_threshold: u32::max_value(), + validator_payment: 0, + }); + + // we have enough balance to cover the last slash before overflow + Balances::set_free_balance(&10, u64::max_value()); + assert_eq!(Balances::total_balance(&10), u64::max_value()); + + // the balance type is u64, so after slashing 64 times, + // the slash value should have overflowed. add a couple extra for + // good measure with the slash grace. + trait TypeEq {} + impl TypeEq for (A, A) {} + fn assert_type_eq() {} + assert_type_eq::<(u64, ::Balance)>(); + + // the total slash value should overflow the balance type + // therefore the total validator balance should be slashed + Staking::on_offline_validator(10, 100); + + assert_eq!(Balances::total_balance(&10), 0); + }); +} diff --git a/srml/sudo/Cargo.toml b/srml/sudo/Cargo.toml new file mode 100644 index 0000000000000..9cdd75c7569e3 --- /dev/null +++ b/srml/sudo/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "srml-sudo" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +hex-literal = "0.1.0" +serde = { version = "1.0", default-features = false } +parity-codec = { version = "2.1", default-features = false } +parity-codec-derive = { version = "2.1", default-features = false } +substrate-primitives = { path = "../../core/primitives", default-features = false } +sr-std = { path = "../../core/sr-std", default-features = false } +sr-io = { path = "../../core/sr-io", default-features = false } +sr-primitives = { path = "../../core/sr-primitives", default-features = false } +srml-support = { path = "../support", default-features = false } +srml-support-procedural = { path = "../support/procedural" } +srml-system = { path = "../system", default-features = false } +srml-consensus = { path = "../consensus", default-features = false } + +[features] +default = ["std"] +std = [ + "serde/std", + "parity-codec/std", + "parity-codec-derive/std", + "sr-std/std", + "sr-io/std", + "sr-primitives/std", + "substrate-primitives/std", + "srml-support/std", + "srml-system/std", + "srml-consensus/std", +] diff --git a/srml/sudo/src/lib.rs b/srml/sudo/src/lib.rs new file mode 100644 index 0000000000000..ca4859a4d3671 --- /dev/null +++ b/srml/sudo/src/lib.rs @@ -0,0 +1,88 @@ +// Copyright 2017-2018 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate 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. + +// Substrate 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 Substrate. If not, see . + +//! The Example: A simple example of a runtime module demonstrating +//! concepts, APIs and structures common to most runtime modules. + +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate sr_std; +#[cfg(test)] +extern crate sr_io; +#[cfg(test)] +extern crate substrate_primitives; +extern crate sr_primitives; +#[macro_use] +extern crate parity_codec_derive; +extern crate parity_codec as codec; +#[macro_use] +extern crate srml_support as support; + +extern crate srml_system as system; +extern crate srml_consensus as consensus; + +use sr_std::prelude::*; +use support::{StorageValue, Parameter, Dispatchable}; +use system::ensure_signed; + +pub trait Trait: consensus::Trait + system::Trait { + /// The overarching event type. + type Event: From> + Into<::Event>; + + /// A sudo-able call. + type Proposal: Parameter + Dispatchable; +} + +decl_module! { + // Simple declaration of the `Module` type. Lets the macro know what its working on. + pub struct Module for enum Call where origin: T::Origin { + fn deposit_event() = default; + + fn sudo(origin, proposal: Box) { + // This is a public call, so we ensure that the origin is some signed account. + let sender = ensure_signed(origin)?; + ensure!(sender == Self::key(), "only the current sudo key can sudo"); + + let ok = proposal.dispatch(system::RawOrigin::Root.into()).is_ok(); + Self::deposit_event(RawEvent::Sudid(ok)); + } + + fn set_key(origin, new: T::AccountId) { + // This is a public call, so we ensure that the origin is some signed account. + let sender = ensure_signed(origin)?; + ensure!(sender == Self::key(), "only the current sudo key can change the sudo key"); + + Self::deposit_event(RawEvent::KeyChanged(Self::key())); + >::put(new); + } + } +} + +/// An event in this module. +decl_event!( + pub enum Event where AccountId = ::AccountId { + /// A sudo just took place. + Sudid(bool), + /// The sudoer just switched identity; the old key is supplied. + KeyChanged(AccountId), + } +); + +decl_storage! { + trait Store for Module as Sudo { + Key get(key) config(): T::AccountId; + } +} diff --git a/srml/support/procedural/src/storage/transformation.rs b/srml/support/procedural/src/storage/transformation.rs index 2a2179e0ec18f..104c5c830c895 100644 --- a/srml/support/procedural/src/storage/transformation.rs +++ b/srml/support/procedural/src/storage/transformation.rs @@ -169,7 +169,7 @@ fn decl_store_extra_genesis( .. } = sline; - let is_simple = if let DeclStorageType::Simple(..) = storage_type { true } else { false }; + let type_infos = get_type_infos(storage_type); let mut opt_build; // need build line @@ -180,20 +180,16 @@ fn decl_store_extra_genesis( let ident = &getter.getfn.content; quote!( #ident ) }; - let option_extracteed = if let DeclStorageType::Simple(ref st) = storage_type { - if ext::has_parametric_type(st, traitinstance) { - is_trait_needed = true; - has_trait_field = true; - } - ext::extract_type_option(st) - } else { None }; - let is_option = option_extracteed.is_some(); - let storage_type = option_extracteed.unwrap_or_else(|| quote!( #storage_type )); + if type_infos.is_simple && ext::has_parametric_type(type_infos.full_type, traitinstance) { + is_trait_needed = true; + has_trait_field = true; + } + let storage_type = type_infos.typ.clone(); config_field.extend(quote!( pub #ident: #storage_type, )); opt_build = Some(build.as_ref().map(|b| &b.expr.content).map(|b|quote!( #b )) .unwrap_or_else(|| quote!( (|config: &GenesisConfig<#traitinstance>| config.#ident.clone()) ))); let fielddefault = default_value.inner.get(0).as_ref().map(|d| &d.expr).map(|d| - if is_option { + if type_infos.is_option { quote!( #d.unwrap_or_default() ) } else { quote!( #d ) @@ -204,20 +200,25 @@ fn decl_store_extra_genesis( opt_build = build.as_ref().map(|b| &b.expr.content).map(|b| quote!( #b )); } + let typ = type_infos.typ; if let Some(builder) = opt_build { is_trait_needed = true; - if is_simple { + if type_infos.is_simple { builders.extend(quote!{{ use #scrate::codec::Encode; let v = (#builder)(&self); - r.insert(Self::hash(<#name<#traitinstance>>::key()).to_vec(), v.encode()); + r.insert(Self::hash( + <#name<#traitinstance> as #scrate::storage::generator::StorageValue<#typ>>::key() + ).to_vec(), v.encode()); }}); } else { + let kty = type_infos.map_key.clone().expect("is not simple; qed"); builders.extend(quote!{{ use #scrate::codec::Encode; let data = (#builder)(&self); for (k, v) in data.into_iter() { - r.insert(Self::hash(&<#name<#traitinstance>>::key_for(k)).to_vec(), v.encode()); + let key = <#name<#traitinstance> as #scrate::storage::generator::StorageMap<#kty, #typ>>::key_for(&k); + r.insert(Self::hash(&key[..]).to_vec(), v.encode()); } }}); } @@ -361,25 +362,22 @@ fn decl_storage_items( .. } = sline; - let (is_simple, extracted_opt, stk, gettype) = match storage_type { - DeclStorageType::Simple(ref st) => (true, ext::extract_type_option(st), None, st), - DeclStorageType::Map(ref map) => (false, ext::extract_type_option(&map.value), Some(&map.key), &map.value), - }; - let is_option = extracted_opt.is_some(); + let type_infos = get_type_infos(storage_type); + let gettype = type_infos.full_type; let fielddefault = default_value.inner.get(0).as_ref().map(|d| &d.expr).map(|d| quote!( #d )) .unwrap_or_else(|| quote!{ Default::default() }); - let typ = extracted_opt.unwrap_or(quote!( #gettype )); + let typ = type_infos.typ; - let option_simple_1 = if !is_option { + let option_simple_1 = if !type_infos.is_option { // raw type case quote!( unwrap_or_else ) } else { // Option<> type case quote!( or_else ) }; - let implementation = if is_simple { - let mutate_impl = if !is_option { + let implementation = if type_infos.is_simple { + let mutate_impl = if !type_infos.is_option { quote!{ >::put(&val, storage) } @@ -430,8 +428,8 @@ fn decl_storage_items( } } else { - let kty = stk.expect("is not simple; qed"); - let mutate_impl = if !is_option { + let kty = type_infos.map_key.expect("is not simple; qed"); + let mutate_impl = if !type_infos.is_option { quote!{ >::insert(key, &val, storage) } @@ -531,20 +529,19 @@ fn impl_store_fns( if let Some(getter) = getter { let get_fn = &getter.getfn.content; - let (is_simple, extracted_opt, stk, gettype) = match storage_type { - DeclStorageType::Simple(ref st) => (true, ext::extract_type_option(st), None, st), - DeclStorageType::Map(ref map) => (false, ext::extract_type_option(&map.value), Some(&map.key), &map.value), - }; - let typ = extracted_opt.unwrap_or(quote!(#gettype)); - let item = if is_simple { + let type_infos = get_type_infos(storage_type); + let gettype = type_infos.full_type; + + let typ = type_infos.typ; + let item = if type_infos.is_simple { quote!{ pub fn #get_fn() -> #gettype { <#name<#traitinstance> as #scrate::storage::generator::StorageValue<#typ>> :: get(&#scrate::storage::RuntimeStorage) } } } else { - let kty = stk.expect("is not simple; qed"); + let kty = type_infos.map_key.expect("is not simple; qed"); // map quote!{ pub fn #get_fn>(key: K) -> #gettype { @@ -576,14 +573,11 @@ fn store_functions_to_metadata ( .. } = sline; - let (is_simple, extracted_opt, stk, gettype) = match storage_type { - DeclStorageType::Simple(ref st) => (true, ext::extract_type_option(st), None, st), - DeclStorageType::Map(ref map) => (false, ext::extract_type_option(&map.value), Some(&map.key), &map.value), - }; + let type_infos = get_type_infos(storage_type); + let gettype = type_infos.full_type; - let is_option = extracted_opt.is_some(); - let typ = extracted_opt.unwrap_or(quote!( #gettype )); - let stype = if is_simple { + let typ = type_infos.typ; + let stype = if type_infos.is_simple { let styp = clean_type_string(&typ.to_string()); quote!{ #scrate::storage::generator::StorageFunctionType::Plain( @@ -591,7 +585,7 @@ fn store_functions_to_metadata ( ) } } else { - let kty = stk.expect("is not simple; qed"); + let kty = type_infos.map_key.expect("is not simple; qed"); let kty = clean_type_string("e!(#kty).to_string()); let styp = clean_type_string(&typ.to_string()); quote!{ @@ -601,13 +595,13 @@ fn store_functions_to_metadata ( } } }; - let modifier = if !is_option { + let modifier = if type_infos.is_option { quote!{ - #scrate::storage::generator::StorageFunctionModifier::Default + #scrate::storage::generator::StorageFunctionModifier::Optional } } else { quote!{ - #scrate::storage::generator::StorageFunctionModifier::Optional + #scrate::storage::generator::StorageFunctionModifier::Default } }; let default = default_value.inner.get(0).as_ref().map(|d| &d.expr) @@ -647,10 +641,10 @@ fn store_functions_to_metadata ( let def_get = quote! { pub struct #struct_name<#traitinstance>(pub #scrate::rstd::marker::PhantomData<#traitinstance>); #[cfg(feature = "std")] - static #cache_name: #scrate::once_cell::sync::OnceCell> = #scrate::once_cell::sync::OnceCell::INIT; + static #cache_name: #scrate::once_cell::sync::OnceCell<#scrate::rstd::vec::Vec> = #scrate::once_cell::sync::OnceCell::INIT; #[cfg(feature = "std")] impl<#traitinstance: #traittype> #scrate::storage::generator::DefaultByte for #struct_name<#traitinstance> { - fn default_byte(&self) -> Vec { + fn default_byte(&self) -> #scrate::rstd::vec::Vec { use #scrate::codec::Encode; #cache_name.get_or_init(|| { let def_val: #gettype = #default; @@ -660,7 +654,7 @@ fn store_functions_to_metadata ( } #[cfg(not(feature = "std"))] impl<#traitinstance: #traittype> #scrate::storage::generator::DefaultByte for #struct_name<#traitinstance> { - fn default_byte(&self) -> Vec { + fn default_byte(&self) -> #scrate::rstd::vec::Vec { use #scrate::codec::Encode; let def_val: #gettype = #default; <#gettype as Encode>::encode(&def_val) @@ -677,3 +671,29 @@ fn store_functions_to_metadata ( } }) } + + +struct DeclStorageTypeInfos<'a> { + pub is_simple: bool, + pub full_type: &'a syn::Type, + pub is_option: bool, + pub typ: TokenStream2, + pub map_key: Option<&'a syn::Type>, +} + +fn get_type_infos(storage_type: &DeclStorageType) -> DeclStorageTypeInfos { + let (is_simple, extracted_type, map_key, full_type) = match storage_type { + DeclStorageType::Simple(ref st) => (true, ext::extract_type_option(st), None, st), + DeclStorageType::Map(ref map) => (false, ext::extract_type_option(&map.value), Some(&map.key), &map.value), + }; + let is_option = extracted_type.is_some(); + let typ = extracted_type.unwrap_or(quote!( #full_type )); + DeclStorageTypeInfos { + is_simple, + full_type, + is_option, + typ, + map_key, + } +} + diff --git a/srml/support/src/dispatch.rs b/srml/support/src/dispatch.rs index 4d0815c41f5a1..f751a5293eedf 100644 --- a/srml/support/src/dispatch.rs +++ b/srml/support/src/dispatch.rs @@ -104,14 +104,14 @@ macro_rules! decl_module { { $( $on_finalise:tt )* } [ $($t:tt)* ] $(#[doc = $doc_attr:tt])* - $vis:vis fn deposit_event() = default; + $vis:vis fn deposit_event $(<$dpeg:ident>)* () = default; $($rest:tt)* ) => { decl_module!(@normalize $(#[$attr])* pub struct $mod_type<$trait_instance: $trait_name> for enum $call_type where origin: $origin_type, system = $system - { $vis fn deposit_event() = default; } + { $vis fn deposit_event $(<$dpeg>)* () = default; } { $( $on_finalise )* } [ $($t)* ] $($rest)* @@ -125,14 +125,16 @@ macro_rules! decl_module { { $( $on_finalise:tt )* } [ $($t:tt)* ] $(#[doc = $doc_attr:tt])* - $vis:vis fn deposit_event($($param_name:ident : $param:ty),* ) { $( $impl:tt )* } + $vis:vis fn deposit_event $(<$dpeg:ident>)* ( + $($param_name:ident : $param:ty),* + ) { $( $impl:tt )* } $($rest:tt)* ) => { decl_module!(@normalize $(#[$attr])* pub struct $mod_type<$trait_instance: $trait_name> for enum $call_type where origin: $origin_type, system = $system - { $vis fn deposit_event($( $param_name: $param ),* ) { $( $impl )* } } + { $vis fn deposit_event $(<$dpeg>)* ($( $param_name: $param ),* ) { $( $impl )* } } { $( $on_finalise )* } [ $($t)* ] $($rest)* @@ -296,10 +298,26 @@ macro_rules! decl_module { $system:ident; ) => {}; + // Non-generic event (@impl_deposit_event $module:ident<$trait_instance:ident: $trait_name:ident>; $system:ident; $vis:vis fn deposit_event() = default; + ) => { + impl<$trait_instance: $trait_name> $module<$trait_instance> { + $vis fn deposit_event(event: Event) { + <$system::Module<$trait_instance>>::deposit_event( + <$trait_instance as $trait_name>::Event::from(event).into() + ); + } + } + }; + + // Generic event + (@impl_deposit_event + $module:ident<$trait_instance:ident: $trait_name:ident>; + $system:ident; + $vis:vis fn deposit_event<$ignore:ident>() = default; ) => { impl<$trait_instance: $trait_name> $module<$trait_instance> { $vis fn deposit_event(event: Event<$trait_instance>) { diff --git a/srml/support/src/lib.rs b/srml/support/src/lib.rs index 291ebc8e740d8..b28d9f3131dec 100644 --- a/srml/support/src/lib.rs +++ b/srml/support/src/lib.rs @@ -142,3 +142,18 @@ pub use mashup::*; #[cfg(feature = "std")] #[doc(hidden)] pub use serde_derive::*; + +/// Programatically create derivations for tuples of up to 19 elements. You provide a second macro +/// which is called once per tuple size, along with a number of identifiers, one for each element +/// of the tuple. +#[macro_export] +macro_rules! for_each_tuple { + ($m:ident) => { + for_each_tuple! { @IMPL $m !! A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, } + }; + (@IMPL $m:ident !!) => { $m! { } }; + (@IMPL $m:ident !! $h:ident, $($t:ident,)*) => { + $m! { $h $($t)* } + for_each_tuple! { @IMPL $m !! $($t,)* } + } +} diff --git a/srml/support/src/runtime.rs b/srml/support/src/runtime.rs index 5fcd8c565b261..11e2f667a724b 100644 --- a/srml/support/src/runtime.rs +++ b/srml/support/src/runtime.rs @@ -31,11 +31,11 @@ /// ) /// ``` /// -/// The module `System: system` will expand to `System: system::{Module, Call, Storage, Event, Config}`. +/// The module `System: system` will expand to `System: system::{Module, Call, Storage, Event, Config}`. /// The identifier `System` is the name of the module and the lower case identifier `system` is the /// name of the rust module for this module. /// The module `Test: test::{default, Log(Test)}` will expand to -/// `Test: test::{Module, Call, Storage, Event, Config, Log(Test)}`. +/// `Test: test::{Module, Call, Storage, Event, Config, Log(Test)}`. /// The module `Test2: test_with_long_module::{Module}` will expand to /// `Test2: test_with_long_module::{Module}`. /// diff --git a/srml/support/src/storage/generator.rs b/srml/support/src/storage/generator.rs index e28dbda89e24d..7cf5e28dedf9a 100644 --- a/srml/support/src/storage/generator.rs +++ b/srml/support/src/storage/generator.rs @@ -946,3 +946,29 @@ mod test2 { type BlockNumber = u32; } } + +#[cfg(test)] +#[allow(dead_code)] +mod test3 { + pub trait Trait { + type Origin; + type BlockNumber; + } + decl_module! { + pub struct Module for enum Call where origin: T::Origin {} + } + decl_storage! { + trait Store for Module as Test { + Foo get(foo) config(initial_foo): u32; + } + } + + type PairOf = (T, T); + + struct TraitImpl {} + + impl Trait for TraitImpl { + type Origin = u32; + type BlockNumber = u32; + } +} diff --git a/srml/system/src/lib.rs b/srml/system/src/lib.rs index ec080219ceadf..68dcfad8efbd6 100644 --- a/srml/system/src/lib.rs +++ b/srml/system/src/lib.rs @@ -178,8 +178,7 @@ impl RawLog { impl From> for primitives::testing::DigestItem { fn from(log: RawLog) -> primitives::testing::DigestItem { match log { - RawLog::ChangesTrieRoot(root) => primitives::generic::DigestItem::ChangesTrieRoot - ::(root), + RawLog::ChangesTrieRoot(root) => primitives::generic::DigestItem::ChangesTrieRoot(root), } } } diff --git a/srml/timestamp/src/lib.rs b/srml/timestamp/src/lib.rs index d89bb50a648ac..27dcc81babbec 100644 --- a/srml/timestamp/src/lib.rs +++ b/srml/timestamp/src/lib.rs @@ -55,25 +55,31 @@ use runtime_primitives::traits::{ }; use system::ensure_inherent; use rstd::{result, ops::{Mul, Div}, vec::Vec}; +use runtime_support::for_each_tuple; /// A trait which is called when the timestamp is set. pub trait OnTimestampSet { fn on_timestamp_set(moment: Moment); } -impl OnTimestampSet for () { - fn on_timestamp_set(_moment: Moment) { } -} +macro_rules! impl_timestamp_set { + () => ( + impl OnTimestampSet for () { + fn on_timestamp_set(_: Moment) {} + } + ); -impl OnTimestampSet for (A, B) - where A: OnTimestampSet, B: OnTimestampSet -{ - fn on_timestamp_set(moment: Moment) { - A::on_timestamp_set(moment.clone()); - B::on_timestamp_set(moment); + ( $($t:ident)* ) => { + impl),*> OnTimestampSet for ($($t,)*) { + fn on_timestamp_set(moment: Moment) { + $($t::on_timestamp_set(moment.clone());)* + } + } } } +for_each_tuple!(impl_timestamp_set); + pub trait Trait: consensus::Trait + system::Trait { /// The position of the required timestamp-set extrinsic. const TIMESTAMP_SET_POSITION: u32; @@ -190,7 +196,7 @@ mod tests { use substrate_primitives::H256; use runtime_primitives::BuildStorage; use runtime_primitives::traits::BlakeTwo256; - use runtime_primitives::testing::{Digest, DigestItem, Header}; + use runtime_primitives::testing::{Digest, DigestItem, Header, UintAuthorityId}; impl_outer_origin! { pub enum Origin for Test {} @@ -213,7 +219,7 @@ mod tests { impl consensus::Trait for Test { const NOTE_OFFLINE_POSITION: u32 = 1; type Log = DigestItem; - type SessionKey = u64; + type SessionKey = UintAuthorityId; type InherentOfflineReport = (); } impl Trait for Test { diff --git a/srml/treasury/src/lib.rs b/srml/treasury/src/lib.rs index abbe0e78995e5..c919c5e959973 100644 --- a/srml/treasury/src/lib.rs +++ b/srml/treasury/src/lib.rs @@ -68,7 +68,7 @@ type ProposalIndex = u32; decl_module! { // Simple declaration of the `Module` type. Lets the macro know what its working on. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Put forward a suggestion for spending. A deposit proportional to the value /// is reserved and slashed if the proposal is rejected. It is returned once the /// proposal is awarded. diff --git a/srml/upgrade-key/src/lib.rs b/srml/upgrade-key/src/lib.rs index 3957b080d382a..2b4470a9f38e1 100644 --- a/srml/upgrade-key/src/lib.rs +++ b/srml/upgrade-key/src/lib.rs @@ -46,7 +46,7 @@ pub trait Trait: consensus::Trait + system::Trait { decl_module! { // Simple declaration of the `Module` type. Lets the macro know what its working on. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; fn upgrade(origin, new: Vec) { // This is a public call, so we ensure that the origin is some signed account. let _sender = ensure_signed(origin)?;