diff --git a/Cargo.lock b/Cargo.lock index 50da5b08fdc9..8e3da61b8cf4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2375,7 +2375,7 @@ dependencies = [ "substrate-inherents 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-service 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", - "substrate-telemetry 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", + "substrate-telemetry 0.3.1 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-transaction-pool 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3031,7 +3031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sr-api-macros" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3043,7 +3043,7 @@ dependencies = [ [[package]] name = "sr-io" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3060,7 +3060,7 @@ dependencies = [ [[package]] name = "sr-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "integer-sqrt 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)", @@ -3077,7 +3077,7 @@ dependencies = [ [[package]] name = "sr-std" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3085,7 +3085,7 @@ dependencies = [ [[package]] name = "sr-version" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3099,7 +3099,7 @@ dependencies = [ [[package]] name = "srml-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3117,7 +3117,7 @@ dependencies = [ [[package]] name = "srml-balances" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3134,7 +3134,7 @@ dependencies = [ [[package]] name = "srml-consensus" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3152,7 +3152,7 @@ dependencies = [ [[package]] name = "srml-council" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3170,7 +3170,7 @@ dependencies = [ [[package]] name = "srml-democracy" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3188,7 +3188,7 @@ dependencies = [ [[package]] name = "srml-executive" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3202,7 +3202,7 @@ dependencies = [ [[package]] name = "srml-grandpa" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3220,7 +3220,7 @@ dependencies = [ [[package]] name = "srml-indices" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3239,7 +3239,7 @@ dependencies = [ [[package]] name = "srml-metadata" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3252,7 +3252,7 @@ dependencies = [ [[package]] name = "srml-session" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3270,7 +3270,7 @@ dependencies = [ [[package]] name = "srml-staking" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3289,7 +3289,7 @@ dependencies = [ [[package]] name = "srml-sudo" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3305,7 +3305,7 @@ dependencies = [ [[package]] name = "srml-support" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3325,7 +3325,7 @@ dependencies = [ [[package]] name = "srml-support-procedural" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3337,7 +3337,7 @@ dependencies = [ [[package]] name = "srml-support-procedural-tools" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3349,7 +3349,7 @@ dependencies = [ [[package]] name = "srml-support-procedural-tools-derive" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3359,7 +3359,7 @@ dependencies = [ [[package]] name = "srml-system" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3377,7 +3377,7 @@ dependencies = [ [[package]] name = "srml-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3394,7 +3394,7 @@ dependencies = [ [[package]] name = "srml-treasury" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3411,7 +3411,7 @@ dependencies = [ [[package]] name = "srml-upgrade-key" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3522,7 +3522,7 @@ dependencies = [ [[package]] name = "substrate-cli" version = "0.3.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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)", @@ -3545,7 +3545,7 @@ dependencies = [ "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-service 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-state-machine 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", - "substrate-telemetry 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", + "substrate-telemetry 0.3.1 (git+https://github.com/paritytech/substrate?branch=v0.10)", "sysinfo 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3554,7 +3554,7 @@ dependencies = [ [[package]] name = "substrate-client" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "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)", @@ -3577,14 +3577,14 @@ dependencies = [ "substrate-keyring 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-state-machine 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", - "substrate-telemetry 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", + "substrate-telemetry 0.3.1 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-trie 0.4.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", ] [[package]] name = "substrate-client-db" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", @@ -3606,7 +3606,7 @@ dependencies = [ [[package]] name = "substrate-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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)", @@ -3625,13 +3625,14 @@ dependencies = [ "substrate-consensus-common 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-inherents 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", + "substrate-telemetry 0.3.1 (git+https://github.com/paritytech/substrate?branch=v0.10)", "tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-consensus-aura-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "substrate-client 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", ] @@ -3639,7 +3640,7 @@ dependencies = [ [[package]] name = "substrate-consensus-aura-slots" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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)", @@ -3658,7 +3659,7 @@ dependencies = [ [[package]] name = "substrate-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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)", @@ -3676,7 +3677,7 @@ dependencies = [ [[package]] name = "substrate-executor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3701,7 +3702,7 @@ dependencies = [ [[package]] name = "substrate-finality-grandpa" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "finality-grandpa 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3717,13 +3718,14 @@ dependencies = [ "substrate-network 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-service 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", + "substrate-telemetry 0.3.1 (git+https://github.com/paritytech/substrate?branch=v0.10)", "tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-finality-grandpa-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3736,7 +3738,7 @@ dependencies = [ [[package]] name = "substrate-inherents" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3748,7 +3750,7 @@ dependencies = [ [[package]] name = "substrate-keyring" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3758,7 +3760,7 @@ dependencies = [ [[package]] name = "substrate-keystore" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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)", @@ -3774,7 +3776,7 @@ dependencies = [ [[package]] name = "substrate-network" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3799,7 +3801,7 @@ dependencies = [ [[package]] name = "substrate-network-libp2p" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "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)", @@ -3824,7 +3826,7 @@ dependencies = [ [[package]] name = "substrate-panic-handler" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3833,7 +3835,7 @@ dependencies = [ [[package]] name = "substrate-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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)", @@ -3861,7 +3863,7 @@ dependencies = [ [[package]] name = "substrate-rpc" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3887,7 +3889,7 @@ dependencies = [ [[package]] name = "substrate-rpc-servers" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "jsonrpc-http-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-pubsub 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3901,7 +3903,7 @@ dependencies = [ [[package]] name = "substrate-serializer" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3910,7 +3912,7 @@ dependencies = [ [[package]] name = "substrate-service" version = "0.3.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3933,7 +3935,7 @@ dependencies = [ "substrate-network 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-rpc-servers 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", - "substrate-telemetry 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", + "substrate-telemetry 0.3.1 (git+https://github.com/paritytech/substrate?branch=v0.10)", "substrate-transaction-pool 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3942,7 +3944,7 @@ dependencies = [ [[package]] name = "substrate-state-db" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3954,7 +3956,7 @@ dependencies = [ [[package]] name = "substrate-state-machine" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3971,12 +3973,15 @@ dependencies = [ [[package]] name = "substrate-telemetry" -version = "0.3.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +version = "0.3.1" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.87 (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)", @@ -3987,7 +3992,7 @@ dependencies = [ [[package]] name = "substrate-transaction-graph" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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)", @@ -4001,7 +4006,7 @@ dependencies = [ [[package]] name = "substrate-transaction-pool" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" 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)", @@ -4017,7 +4022,7 @@ dependencies = [ [[package]] name = "substrate-trie" version = "0.4.0" -source = "git+https://github.com/paritytech/substrate?branch=v0.10#71fb444830ad8bebb0fb7fd0bbaa9ac9c67092bb" +source = "git+https://github.com/paritytech/substrate?branch=v0.10#e3065f28042985fa8e197cf8568ede4d9422f747" dependencies = [ "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5059,7 +5064,7 @@ dependencies = [ "checksum substrate-service 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)" = "" "checksum substrate-state-db 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)" = "" "checksum substrate-state-machine 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)" = "" -"checksum substrate-telemetry 0.3.0 (git+https://github.com/paritytech/substrate?branch=v0.10)" = "" +"checksum substrate-telemetry 0.3.1 (git+https://github.com/paritytech/substrate?branch=v0.10)" = "" "checksum substrate-transaction-graph 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)" = "" "checksum substrate-transaction-pool 0.1.0 (git+https://github.com/paritytech/substrate?branch=v0.10)" = "" "checksum substrate-trie 0.4.0 (git+https://github.com/paritytech/substrate?branch=v0.10)" = "" diff --git a/network/src/consensus.rs b/network/src/consensus.rs index 2d87f9da073f..ec11a8a73bc4 100644 --- a/network/src/consensus.rs +++ b/network/src/consensus.rs @@ -19,9 +19,10 @@ //! This fulfills the `polkadot_consensus::Network` trait, providing a hook to be called //! each time consensus begins on a new chain head. -use sr_primitives::traits::ProvideRuntimeApi; -use substrate_network::consensus_gossip::ConsensusMessage; -use polkadot_consensus::{Network, SharedTable, Collators, Statement, GenericStatement}; +use sr_primitives::traits::{BlakeTwo256, Hash as HashT, ProvideRuntimeApi}; +use polkadot_consensus::{ + Network, SharedTable, Collators, Statement, GenericStatement, +}; use polkadot_primitives::{AccountId, Block, Hash, SessionKey}; use polkadot_primitives::parachain::{Id as ParaId, Collation, Extrinsic, ParachainHost, BlockData}; use codec::Decode; @@ -39,12 +40,20 @@ use parking_lot::Mutex; use super::NetworkService; use router::Router; +use gossip::{POLKADOT_ENGINE_ID, GossipMessage, RegisteredMessageValidator, MessageValidationData}; + +/// Compute the gossip topic used for attestations on this relay parent hash. +pub(crate) fn attestation_topic(parent_hash: Hash) -> Hash { + let mut v = parent_hash.as_ref().to_vec(); + v.extend(b"attestations"); + + BlakeTwo256::hash(&v[..]) +} // task that processes all gossipped consensus messages, // checking signatures struct MessageProcessTask { - inner_stream: mpsc::UnboundedReceiver, - parent_hash: Hash, + inner_stream: mpsc::UnboundedReceiver>, table_router: Router

, exit: E, } @@ -54,19 +63,12 @@ impl MessageProcessTask where P::Api: ParachainHost, E: Future + Clone + Send + 'static, { - fn process_message(&self, msg: ConsensusMessage) -> Option> { - use polkadot_consensus::SignedStatement; - + fn process_message(&self, msg: Vec) -> Option> { debug!(target: "consensus", "Processing consensus statement for live consensus"); - if let Some(statement) = SignedStatement::decode(&mut msg.as_slice()) { - if ::polkadot_consensus::check_statement( - &statement.statement, - &statement.signature, - statement.sender, - &self.parent_hash - ) { - self.table_router.import_statement(statement, self.exit.clone()); - } + + // statements are already checked by gossip validator. + if let Some(message) = GossipMessage::decode(&mut &msg[..]) { + self.table_router.import_statement(message.statement, self.exit.clone()); } None @@ -99,13 +101,19 @@ impl Future for MessageProcessTask where pub struct ConsensusNetwork { network: Arc, api: Arc

, + message_validator: RegisteredMessageValidator, exit: E, } impl ConsensusNetwork { /// Create a new consensus networking object. - pub fn new(network: Arc, exit: E, api: Arc

) -> Self { - ConsensusNetwork { network, exit, api } + pub fn new( + network: Arc, + exit: E, + message_validator: RegisteredMessageValidator, + api: Arc

, + ) -> Self { + ConsensusNetwork { network, exit, message_validator, api } } } @@ -115,6 +123,7 @@ impl Clone for ConsensusNetwork { network: self.network.clone(), exit: self.exit.clone(), api: self.api.clone(), + message_validator: self.message_validator.clone(), } } } @@ -130,7 +139,7 @@ impl Network for ConsensusNetwork where /// Instantiate a table router using the given shared table. fn communication_for( &self, - _validators: &[SessionKey], + authorities: &[SessionKey], table: Arc, task_executor: TaskExecutor, ) -> Self::TableRouter { @@ -146,14 +155,21 @@ impl Network for ConsensusNetwork where task_executor.clone(), parent_hash, knowledge.clone(), + self.message_validator.clone(), ); let attestation_topic = table_router.gossip_topic(); let exit = self.exit.clone(); + // before requesting messages, note live consensus session. + self.message_validator.note_consensus( + parent_hash, + MessageValidationData { authorities: authorities.to_vec() }, + ); + let (tx, rx) = std::sync::mpsc::channel(); self.network.with_gossip(move |gossip, _| { - let inner_rx = gossip.messages_for(attestation_topic); + let inner_rx = gossip.messages_for(POLKADOT_ENGINE_ID, attestation_topic); let _ = tx.send(inner_rx); }); @@ -168,7 +184,6 @@ impl Network for ConsensusNetwork where let inner_stream = rx.try_recv().expect("1. The with_gossip closure executed first, 2. the reply should be available"); let process_task = MessageProcessTask { inner_stream, - parent_hash, table_router: table_router_clone, exit, }; @@ -200,7 +215,7 @@ impl Future for AwaitingCollation { .map_err(|_| NetworkDown) } match self.outer.poll() { - Ok(futures::Async::Ready(mut inner)) => { + Ok(futures::Async::Ready(inner)) => { self.inner = Some(inner); self.poll() }, diff --git a/network/src/gossip.rs b/network/src/gossip.rs new file mode 100644 index 000000000000..44f6f931220c --- /dev/null +++ b/network/src/gossip.rs @@ -0,0 +1,159 @@ +// Copyright 2019 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Gossip messages and the message validator + +use substrate_network::consensus_gossip::{ + self as network_gossip, ValidationResult as GossipValidationResult, +}; +use polkadot_consensus::SignedStatement; +use polkadot_primitives::{Hash, SessionKey}; +use codec::Decode; + +use std::collections::HashMap; +use std::sync::Arc; + +use parking_lot::RwLock; + +use super::NetworkService; + +/// The engine ID of the polkadot attestation system. +pub const POLKADOT_ENGINE_ID: substrate_network::ConsensusEngineId = [b'd', b'o', b't', b'1']; + +/// A gossip message. +#[derive(Encode, Decode, Clone)] +pub(crate) struct GossipMessage { + /// The relay chain parent hash. + pub(crate) relay_parent: Hash, + /// The signed statement being gossipped. + pub(crate) statement: SignedStatement, +} + +/// whether a block is known. +pub enum Known { + /// The block is a known leaf. + Leaf, + /// The block is known to be old. + Old, + /// The block is known to be bad. + Bad, +} + +/// An oracle for known blocks. +pub trait KnownOracle: Send + Sync { + /// whether a block is known. If it's not, returns `None`. + fn is_known(&self, block_hash: &Hash) -> Option; +} + +impl KnownOracle for F where F: Fn(&Hash) -> Option + Send + Sync { + fn is_known(&self, block_hash: &Hash) -> Option { + (self)(block_hash) + } +} + +/// Register a gossip validator on the network service. +/// +/// This returns a `RegisteredMessageValidator` +// NOTE: since RegisteredMessageValidator is meant to be a type-safe proof +// that we've actually done the registration, this should be the only way +// to construct it outside of tests. +pub fn register_validator( + service: &NetworkService, + oracle: O, +) -> RegisteredMessageValidator { + let validator = Arc::new(MessageValidator { + live_consensus: RwLock::new(HashMap::new()), + oracle, + }); + + let gossip_side = validator.clone(); + service.with_gossip(|gossip, _| gossip.register_validator(POLKADOT_ENGINE_ID, gossip_side)); + + RegisteredMessageValidator { inner: validator as _ } +} + +/// A registered message validator. +/// +/// Create this using `register_validator`. +#[derive(Clone)] +pub struct RegisteredMessageValidator { + inner: Arc>, +} + +impl RegisteredMessageValidator { + /// Note a live consensus session. This must be removed later with + /// `remove_consensus`. + pub(crate) fn note_consensus(&self, relay_parent: Hash, validation: MessageValidationData) { + self.inner.live_consensus.write().insert(relay_parent, validation); + } + + /// Remove a live consensus session when it is no longer live. + pub(crate) fn remove_consensus(&self, relay_parent: &Hash) { + self.inner.live_consensus.write().remove(relay_parent); + } +} + +// data needed for validating gossip. +pub(crate) struct MessageValidationData { + /// The authorities at a block. + pub(crate) authorities: Vec, +} + +impl MessageValidationData { + fn check_statement(&self, relay_parent: &Hash, statement: &SignedStatement) -> bool { + self.authorities.contains(&statement.sender) && + ::polkadot_consensus::check_statement( + &statement.statement, + &statement.signature, + statement.sender, + relay_parent, + ) + } +} + +/// An unregistered message validator. Register this with `register_validator`. +pub struct MessageValidator { + live_consensus: RwLock>, + oracle: O, +} + +impl network_gossip::Validator for MessageValidator { + fn validate(&self, mut data: &[u8]) -> GossipValidationResult { + match GossipMessage::decode(&mut data) { + Some(GossipMessage { relay_parent, statement }) => { + let live = self.live_consensus.read(); + let topic = || ::consensus::attestation_topic(relay_parent.clone()); + if let Some(validation) = live.get(&relay_parent) { + if validation.check_statement(&relay_parent, &statement) { + GossipValidationResult::Valid(topic()) + } else { + GossipValidationResult::Invalid + } + } else { + match self.oracle.is_known(&relay_parent) { + None | Some(Known::Leaf) => GossipValidationResult::Future(topic()), + Some(Known::Old) => GossipValidationResult::Expired, + Some(Known::Bad) => GossipValidationResult::Invalid, + } + } + } + None => { + debug!(target: "consensus", "Error decoding gossip message"); + GossipValidationResult::Invalid + } + } + } +} diff --git a/network/src/lib.rs b/network/src/lib.rs index 3e3280c5b508..47ae1b842812 100644 --- a/network/src/lib.rs +++ b/network/src/lib.rs @@ -44,6 +44,7 @@ mod collator_pool; mod local_collations; mod router; pub mod consensus; +pub mod gossip; use codec::{Decode, Encode}; use futures::sync::oneshot; diff --git a/network/src/router.rs b/network/src/router.rs index a4f6912ec682..2ae79effdaf9 100644 --- a/network/src/router.rs +++ b/network/src/router.rs @@ -22,7 +22,7 @@ //! the `TableRouter` trait from `polkadot-consensus`, which is expected to call into a shared statement table //! and dispatch evaluation work as necessary when new statements come in. -use sr_primitives::traits::{ProvideRuntimeApi, BlakeTwo256, Hash as HashT}; +use sr_primitives::traits::ProvideRuntimeApi; use polkadot_consensus::{SharedTable, TableRouter, SignedStatement, GenericStatement, StatementProducer}; use polkadot_primitives::{Block, Hash, BlockId, SessionKey}; use polkadot_primitives::parachain::{BlockData, Extrinsic, CandidateReceipt, ParachainHost}; @@ -38,15 +38,9 @@ use std::io; use std::sync::Arc; use consensus::Knowledge; +use gossip::{POLKADOT_ENGINE_ID, RegisteredMessageValidator}; use super::NetworkService; -fn attestation_topic(parent_hash: Hash) -> Hash { - let mut v = parent_hash.as_ref().to_vec(); - v.extend(b"attestations"); - - BlakeTwo256::hash(&v[..]) -} - /// Table routing implementation. pub struct Router

{ table: Arc, @@ -57,6 +51,7 @@ pub struct Router

{ attestation_topic: Hash, knowledge: Arc>, deferred_statements: Arc>, + message_validator: RegisteredMessageValidator, } impl

Router

{ @@ -67,6 +62,7 @@ impl

Router

{ task_executor: TaskExecutor, parent_hash: Hash, knowledge: Arc>, + message_validator: RegisteredMessageValidator, ) -> Self { Router { table, @@ -74,9 +70,10 @@ impl

Router

{ api, task_executor, parent_hash, - attestation_topic: attestation_topic(parent_hash), + attestation_topic: crate::consensus::attestation_topic(parent_hash), knowledge, deferred_statements: Arc::new(Mutex::new(DeferredStatements::new())), + message_validator, } } @@ -97,6 +94,7 @@ impl

Clone for Router

{ attestation_topic: self.attestation_topic.clone(), deferred_statements: self.deferred_statements.clone(), knowledge: self.knowledge.clone(), + message_validator: self.message_validator.clone(), } } } @@ -195,12 +193,20 @@ impl Router

// consider something more targeted than gossip in the future. if let Some(validity) = produced.validity { let signed = table.sign_and_import(validity.clone()).0; - network.gossip_consensus_message(attestation_topic, signed.encode(), false); + network.gossip_consensus_message( + attestation_topic, + POLKADOT_ENGINE_ID, + signed.encode(), + ); } if let Some(availability) = produced.availability { let signed = table.sign_and_import(availability).0; - network.gossip_consensus_message(attestation_topic, signed.encode(), false); + network.gossip_consensus_message( + attestation_topic, + POLKADOT_ENGINE_ID, + signed.encode(), + ); } }) .map_err(|e| debug!(target: "p_net", "Failed to produce statements: {:?}", e)) @@ -220,9 +226,17 @@ impl TableRouter for Router

let (candidate, availability) = self.table.sign_and_import(GenericStatement::Candidate(receipt)); self.knowledge.lock().note_candidate(hash, Some(block_data), Some(extrinsic)); - self.network.gossip_consensus_message(self.attestation_topic, candidate.encode(), false); + self.network.gossip_consensus_message( + self.attestation_topic, + POLKADOT_ENGINE_ID, + candidate.encode(), + ); if let Some(availability) = availability { - self.network.gossip_consensus_message(self.attestation_topic, availability.encode(), false); + self.network.gossip_consensus_message( + self.attestation_topic, + POLKADOT_ENGINE_ID, + availability.encode(), + ); } } @@ -245,6 +259,7 @@ impl TableRouter for Router

impl

Drop for Router

{ fn drop(&mut self) { let parent_hash = self.parent_hash.clone(); + self.message_validator.remove_consensus(&parent_hash); self.network.with_spec(move |spec, _| spec.remove_consensus(&parent_hash)); } } @@ -269,7 +284,7 @@ impl Future for BlockDataReceiver { )) } match self.outer.poll() { - Ok(futures::Async::Ready(mut inner)) => { + Ok(futures::Async::Ready(inner)) => { self.inner = Some(inner); self.poll() }, diff --git a/network/src/tests.rs b/network/src/tests.rs index 20ed401f555e..712f7d4b3122 100644 --- a/network/src/tests.rs +++ b/network/src/tests.rs @@ -77,6 +77,7 @@ impl TestContext { fn make_status(status: &Status, roles: Roles) -> FullStatus { FullStatus { version: 1, + min_supported_version: 1, roles, best_number: 0, best_hash: Default::default(), diff --git a/service/src/chain_spec.rs b/service/src/chain_spec.rs index 1647eae1d397..725417417e35 100644 --- a/service/src/chain_spec.rs +++ b/service/src/chain_spec.rs @@ -23,6 +23,7 @@ use polkadot_runtime::{ CouncilVotingConfig, GrandpaConfig, UpgradeKeyConfig, SudoConfig, IndicesConfig, CuratedGrandpaConfig, Permill }; +use telemetry::TelemetryEndpoints; const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; const DEFAULT_PROTOCOL_ID: &str = "dot"; @@ -145,7 +146,7 @@ pub fn staging_testnet_config() -> ChainSpec { "staging_testnet", staging_testnet_config_genesis, boot_nodes, - Some(STAGING_TELEMETRY_URL.into()), + Some(TelemetryEndpoints::new(vec![(STAGING_TELEMETRY_URL.to_string(), 0)])), Some(DEFAULT_PROTOCOL_ID), None, None, diff --git a/service/src/lib.rs b/service/src/lib.rs index 2bd9daeed3e9..30e4f8b27a15 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -33,6 +33,7 @@ extern crate substrate_service as service; extern crate substrate_consensus_aura as aura; extern crate substrate_finality_grandpa as grandpa; extern crate substrate_transaction_pool as transaction_pool; +extern crate substrate_telemetry as telemetry; extern crate tokio; #[macro_use] @@ -44,8 +45,9 @@ pub mod chain_spec; use std::sync::Arc; use std::time::Duration; -use polkadot_primitives::{parachain, AccountId, Block}; +use polkadot_primitives::{parachain, AccountId, Block, Hash, BlockId}; use polkadot_runtime::{GenesisConfig, RuntimeApi}; +use polkadot_network::gossip::{self as network_gossip, Known}; use primitives::ed25519; use tokio::runtime::TaskExecutor; use service::{FactoryFullConfiguration, FullBackend, LightBackend, FullExecutor, LightExecutor}; @@ -200,11 +202,33 @@ construct_service_factory! { }; let client = service.client(); + let known_oracle = client.clone(); + + let gossip_validator = network_gossip::register_validator( + &*service.network(), + move |block_hash: &Hash| { + use client::{BlockStatus, ChainHead}; + + match known_oracle.block_status(&BlockId::hash(*block_hash)) { + Err(_) | Ok(BlockStatus::Unknown) | Ok(BlockStatus::Queued) => None, + Ok(BlockStatus::KnownBad) => Some(Known::Bad), + Ok(BlockStatus::InChain) => match known_oracle.leaves() { + Err(_) => None, + Ok(leaves) => if leaves.contains(block_hash) { + Some(Known::Leaf) + } else { + Some(Known::Old) + }, + } + } + }, + ); // collator connections and consensus network both fulfilled by this let consensus_network = ConsensusNetwork::new( service.network(), service.on_exit(), + gossip_validator, service.client(), ); let proposer_factory = ::consensus::ProposerFactory::new(