diff --git a/Cargo.lock b/Cargo.lock index 2c38d96c120e..679ee82a04d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -855,7 +855,7 @@ dependencies = [ "hashmap_core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -907,7 +907,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "fork-tree" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1218,7 +1218,7 @@ dependencies = [ [[package]] name = "hyper" -version = "0.12.31" +version = "0.12.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1260,7 +1260,7 @@ name = "impl-codec" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1337,7 +1337,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.32 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 12.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-pubsub 12.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1383,7 +1383,7 @@ name = "jsonrpc-http-server" version = "12.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.32 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 12.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-server-utils 12.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2194,7 +2194,7 @@ dependencies = [ "node-executor 2.0.0", "node-primitives 2.0.0", "node-runtime 2.0.0", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -2230,7 +2230,7 @@ version = "2.0.0" dependencies = [ "node-primitives 2.0.0", "node-runtime 2.0.0", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", "srml-balances 2.0.0", @@ -2257,7 +2257,7 @@ dependencies = [ name = "node-primitives" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -2272,7 +2272,7 @@ version = "2.0.0" dependencies = [ "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.32 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core-client 12.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 2.0.0", @@ -2285,7 +2285,7 @@ version = "2.0.0" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 2.0.0", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2327,7 +2327,7 @@ dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "node-template-runtime 2.0.0", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "substrate-basic-authorship 2.0.0", @@ -2349,7 +2349,7 @@ dependencies = [ name = "node-template-runtime" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -2503,7 +2503,7 @@ source = "git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7 [[package]] name = "parity-codec" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3094,7 +3094,7 @@ dependencies = [ "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3477,7 +3477,7 @@ version = "2.0.0" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3499,7 +3499,7 @@ dependencies = [ "environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 2.0.0", "substrate-offchain 2.0.0", @@ -3516,7 +3516,7 @@ 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)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3531,7 +3531,7 @@ name = "sr-sandbox" version = "2.0.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 2.0.0", "substrate-primitives 2.0.0", @@ -3551,7 +3551,7 @@ name = "sr-version" version = "2.0.0" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "sr-std 2.0.0", @@ -3561,7 +3561,7 @@ dependencies = [ name = "srml-assets" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -3576,7 +3576,7 @@ name = "srml-aura" version = "2.0.0" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -3596,7 +3596,7 @@ dependencies = [ name = "srml-authorship" version = "0.1.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", "sr-std 2.0.0", @@ -3611,7 +3611,7 @@ version = "2.0.0" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -3630,7 +3630,7 @@ dependencies = [ name = "srml-balances" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -3649,7 +3649,7 @@ dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (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.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3671,7 +3671,7 @@ name = "srml-council" version = "2.0.0" dependencies = [ "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -3688,7 +3688,7 @@ dependencies = [ name = "srml-democracy" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -3704,7 +3704,7 @@ dependencies = [ name = "srml-example" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -3719,7 +3719,7 @@ name = "srml-executive" version = "2.0.0" dependencies = [ "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -3735,7 +3735,7 @@ dependencies = [ name = "srml-finality-tracker" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -3750,7 +3750,7 @@ dependencies = [ name = "srml-grandpa" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -3767,7 +3767,7 @@ dependencies = [ name = "srml-indices" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ref_thread_local 0.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.94 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3784,7 +3784,7 @@ dependencies = [ name = "srml-metadata" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 2.0.0", "substrate-primitives 2.0.0", @@ -3795,7 +3795,7 @@ name = "srml-session" version = "2.0.0" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -3812,7 +3812,7 @@ dependencies = [ name = "srml-staking" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3832,7 +3832,7 @@ dependencies = [ name = "srml-sudo" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -3849,7 +3849,7 @@ version = "2.0.0" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3898,7 +3898,7 @@ dependencies = [ name = "srml-support-test" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "srml-support 2.0.0", @@ -3912,7 +3912,7 @@ name = "srml-system" version = "2.0.0" dependencies = [ "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -3926,7 +3926,7 @@ dependencies = [ name = "srml-timestamp" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -3941,7 +3941,7 @@ dependencies = [ name = "srml-treasury" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -4033,7 +4033,7 @@ dependencies = [ "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 2.0.0", "node-runtime 2.0.0", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4058,7 +4058,7 @@ name = "substrate-basic-authorship" version = "2.0.0" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", "substrate-consensus-aura-primitives 2.0.0", @@ -4127,7 +4127,7 @@ dependencies = [ "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 2.0.0", "sr-primitives 2.0.0", @@ -4155,7 +4155,7 @@ dependencies = [ "kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", @@ -4176,7 +4176,7 @@ dependencies = [ "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -4203,7 +4203,7 @@ dependencies = [ name = "substrate-consensus-aura-primitives" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "sr-std 2.0.0", "substrate-client 2.0.0", @@ -4218,7 +4218,7 @@ dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "merlin 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4247,7 +4247,7 @@ dependencies = [ name = "substrate-consensus-babe-primitives" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "sr-std 2.0.0", "substrate-client 2.0.0", @@ -4263,7 +4263,7 @@ dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.10.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 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "sr-std 2.0.0", @@ -4283,7 +4283,7 @@ dependencies = [ "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rhododendron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", @@ -4305,7 +4305,7 @@ version = "2.0.0" dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", @@ -4327,7 +4327,7 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-version 2.0.0", @@ -4353,7 +4353,7 @@ dependencies = [ "fork-tree 2.0.0", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4378,7 +4378,7 @@ dependencies = [ name = "substrate-finality-grandpa-primitives" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "sr-std 2.0.0", @@ -4390,7 +4390,7 @@ dependencies = [ name = "substrate-inherents" version = "2.0.0" dependencies = [ - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "sr-std 2.0.0", @@ -4437,7 +4437,7 @@ dependencies = [ "linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4472,7 +4472,7 @@ dependencies = [ "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", @@ -4529,7 +4529,7 @@ dependencies = [ "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4559,7 +4559,7 @@ dependencies = [ "jsonrpc-derive 12.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-pubsub 12.1.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 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (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.94 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4621,7 +4621,7 @@ dependencies = [ "node-executor 2.0.0", "node-primitives 2.0.0", "node-runtime 2.0.0", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4671,7 +4671,7 @@ version = "2.0.0" dependencies = [ "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 2.0.0", ] @@ -4684,7 +4684,7 @@ dependencies = [ "hex-literal 0.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-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-panic-handler 2.0.0", "substrate-primitives 2.0.0", @@ -4719,7 +4719,7 @@ version = "2.0.0" dependencies = [ "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", "substrate-client-db 2.0.0", @@ -4736,7 +4736,7 @@ version = "2.0.0" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", @@ -4777,7 +4777,7 @@ dependencies = [ "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -4792,7 +4792,7 @@ dependencies = [ "derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", @@ -4811,7 +4811,7 @@ dependencies = [ "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 2.0.0", "substrate-primitives 2.0.0", "trie-bench 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5229,7 +5229,7 @@ name = "transaction-factory" version = "0.0.1" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-cli 2.0.0", "substrate-client 2.0.0", @@ -5247,7 +5247,7 @@ dependencies = [ "hash-db 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-db 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "trie-standardmap 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5932,7 +5932,7 @@ dependencies = [ "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum hyper 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" -"checksum hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)" = "6481fff8269772d4463253ca83c788104a7305cb3fb9136bc651a6211e46e03f" +"checksum hyper 0.12.32 (registry+https://github.com/rust-lang/crates.io-index)" = "a64d71c1e77d39da024f06f5821ee00ad9c38febb90370bad1f07a94e0bc8793" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum impl-codec 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62ed8ff267bc916dd848a800b96d3129aec73d5b23a5e3d018c83655d0c55371" "checksum impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5158079de9d4158e0ce1de3ae0bd7be03904efc40b3d7dd8b8c301cbf6b52b56" @@ -6031,7 +6031,7 @@ dependencies = [ "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=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" -"checksum parity-codec 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7902deb39d3b431897f211c1918789938251e67a740f55effd53201e79c0906c" +"checksum parity-codec 4.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "245e685a5c12ee06d523d63acce60c522dd0986dbf20b971cf55ede54d35e104" "checksum parity-codec-derive 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00a486fd383382ddcb2de928364b1f82571c1e48274fc43b7667a4738ee4056c" "checksum parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "045b3c7af871285146300da35b1932bb6e4639b66c7c98e85d06a32cbc4e8fa7" "checksum parity-multihash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eb83358a0c05e52c44d658981fec2d146d3516d1adffd9e553684f8c8e9e8fa5" diff --git a/core/finality-grandpa/src/aux_schema.rs b/core/finality-grandpa/src/aux_schema.rs index f3939f465027..59175e1f5b43 100644 --- a/core/finality-grandpa/src/aux_schema.rs +++ b/core/finality-grandpa/src/aux_schema.rs @@ -18,6 +18,9 @@ use std::fmt::Debug; use std::sync::Arc; +use std::collections::VecDeque; +use std::iter::FromIterator; + use parity_codec::{Encode, Decode}; use client::backend::AuxStore; use client::error::{Result as ClientResult, Error as ClientError}; @@ -30,15 +33,73 @@ use fg_primitives::AuthorityId; use crate::authorities::{AuthoritySet, SharedAuthoritySet, PendingChange, DelayKind}; use crate::consensus_changes::{SharedConsensusChanges, ConsensusChanges}; -use crate::environment::{CompletedRound, CompletedRounds, HasVoted, SharedVoterSetState, VoterSetState}; -use crate::NewAuthoritySet; +use crate::environment::{ + CompletedRound, CompletedRounds, HasVoted, SharedVoterSetState, VoterSetState, +}; +use crate::{NewAuthoritySet, HistoricalVotes, SignedMessage}; const VERSION_KEY: &[u8] = b"grandpa_schema_version"; const SET_STATE_KEY: &[u8] = b"grandpa_completed_round"; const AUTHORITY_SET_KEY: &[u8] = b"grandpa_voters"; const CONSENSUS_CHANGES_KEY: &[u8] = b"grandpa_consensus_changes"; -const CURRENT_VERSION: u32 = 2; +const CURRENT_VERSION: u32 = 3; + +/// Data about a completed round. +#[derive(Debug, Clone, Decode, Encode, PartialEq)] +pub struct V2CompletedRound { + /// The round number. + pub number: u64, + /// The round state (prevote ghost, estimate, finalized, etc.) + pub state: RoundState>, + /// The target block base used for voting in the round. + pub base: (Block::Hash, NumberFor), + /// All the votes observed in the round. + pub votes: Vec>, +} + +// Data about last completed rounds. +#[derive(Debug, Clone, PartialEq)] +pub struct V2CompletedRounds { + rounds: VecDeque>, + set_id: u64, + voters: Vec, +} + +impl Encode for V2CompletedRounds { + fn encode(&self) -> Vec { + let v = Vec::from_iter(&self.rounds); + (&v, &self.set_id, &self.voters).encode() + } +} + +impl Decode for V2CompletedRounds { + fn decode(value: &mut I) -> Option { + <(Vec>, u64, Vec)>::decode(value) + .map(|(rounds, set_id, voters)| V2CompletedRounds { + rounds: rounds.into(), + set_id, + voters, + }) + } +} + +// The state of the current voter set. +#[derive(Debug, Decode, Encode, PartialEq)] +pub enum V2VoterSetState { + /// The voter is live, i.e. participating in rounds. + Live { + /// The previously completed rounds. + completed_rounds: V2CompletedRounds, + /// Vote status for the current round. + current_round: HasVoted, + }, + /// The voter is paused, i.e. not casting or importing any votes. + Paused { + /// The previously completed rounds. + completed_rounds: V2CompletedRounds, + }, +} /// The voter set state. #[derive(Debug, Clone, Encode, Decode)] @@ -155,16 +216,21 @@ fn migrate_from_version0( let base = last_round_state.prevote_ghost .expect("state is for completed round; completed rounds must have a prevote ghost; qed."); + let completed_round = CompletedRound { + number: last_round_number, + state: last_round_state, + base, + historical_votes: HistoricalVotes::::new(), + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters = new_set.current().1.iter().map(|(a, _)| a.clone()).collect(); + let set_state = VoterSetState::Live { completed_rounds: CompletedRounds::new( - CompletedRound { - number: last_round_number, - state: last_round_state, - votes: Vec::new(), - base, - }, + rounds, set_id, - &new_set, + voters, ), current_round: HasVoted::No, }; @@ -195,17 +261,23 @@ fn migrate_from_version1( AUTHORITY_SET_KEY, )? { let set_id = set.current().0; - - let completed_rounds = |number, state, base| CompletedRounds::new( - CompletedRound { + let completed_rounds = |number, state, base| { + let completed_round = CompletedRound { number, state, - votes: Vec::new(), base, - }, - set_id, - &set, - ); + historical_votes: HistoricalVotes::::new(), + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters = set.current().1.iter().map(|(a, _)| a.clone()).collect(); + + CompletedRounds::new( + rounds, + set_id, + voters, + ) + }; let set_state = match load_decode::<_, V1VoterSetState>>( backend, @@ -248,6 +320,98 @@ fn migrate_from_version1( Ok(None) } +fn voter_set_state_from_v2(voter_set_state_v2: V2VoterSetState) -> VoterSetState { + let transform = |completed_rounds: V2CompletedRounds| { + CompletedRounds::new( + completed_rounds.rounds.into_iter().map( + | V2CompletedRound { number, state, base, votes } | { + CompletedRound { + number, + state, + base, + historical_votes: HistoricalVotes::::new_with(votes, None, None), + } + } + ).collect::>>(), + completed_rounds.set_id, + completed_rounds.voters, + ) + }; + match voter_set_state_v2 { + V2VoterSetState::Paused { completed_rounds } => { + VoterSetState::Paused { + completed_rounds: transform(completed_rounds) + } + }, + V2VoterSetState::Live { completed_rounds, current_round } => { + VoterSetState::Live { + completed_rounds: transform(completed_rounds), + current_round, + } + }, + } +} + +fn migrate_from_version2( + backend: &B, + genesis_round: &G, +) -> ClientResult>, + VoterSetState, +)>> where B: AuxStore, + G: Fn() -> RoundState>, +{ + CURRENT_VERSION.using_encoded(|s| + backend.insert_aux(&[(VERSION_KEY, s)], &[]) + )?; + + if let Some(set) = load_decode::<_, AuthoritySet>>( + backend, + AUTHORITY_SET_KEY, + )? { + let set_state = match load_decode::<_, V2VoterSetState>( + backend, + SET_STATE_KEY, + )? { + Some(voter_set_state_v2) => voter_set_state_from_v2(voter_set_state_v2), + None => { + let completed_rounds = |number, state, base| { + let completed_round = CompletedRound { + number, + state, + base, + historical_votes: HistoricalVotes::::new(), + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters = set.current().1.iter().map(|(a, _)| a.clone()).collect(); + + CompletedRounds::new( + rounds, + set.current().0, + voters, + ) + }; + + let set_state = genesis_round(); + let base = set_state.prevote_ghost + .expect("state is for completed round; completed rounds must have a prevote ghost; qed."); + + VoterSetState::Live { + completed_rounds: completed_rounds(0, set_state, base), + current_round: HasVoted::No, + } + }, + }; + + backend.insert_aux(&[(SET_STATE_KEY, set_state.encode().as_slice())], &[])?; + + return Ok(Some((set, set_state))); + } + + Ok(None) +} + /// Load or initialize persistent data from backend. pub(crate) fn load_persistent( backend: &B, @@ -286,6 +450,15 @@ pub(crate) fn load_persistent( } }, Some(2) => { + if let Some((new_set, set_state)) = migrate_from_version2::(backend, &make_genesis_round)? { + return Ok(PersistentData { + authority_set: new_set.into(), + consensus_changes: Arc::new(consensus_changes.into()), + set_state: set_state.into(), + }); + } + }, + Some(3) => { if let Some(set) = load_decode::<_, AuthoritySet>>( backend, AUTHORITY_SET_KEY, @@ -300,16 +473,22 @@ pub(crate) fn load_persistent( let base = state.prevote_ghost .expect("state is for completed round; completed rounds must have a prevote ghost; qed."); + let completed_round = CompletedRound { + number: 0, + historical_votes: HistoricalVotes::::new(), + base, + state, + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters = set + .current().1.iter().map(|(a, _)| a.clone()).collect(); + VoterSetState::Live { completed_rounds: CompletedRounds::new( - CompletedRound { - number: 0, - votes: Vec::new(), - base, - state, - }, + rounds, set.current().0, - &set, + voters, ), current_round: HasVoted::No, } @@ -338,16 +517,22 @@ pub(crate) fn load_persistent( let base = state.prevote_ghost .expect("state is for completed round; completed rounds must have a prevote ghost; qed."); + let completed_round = CompletedRound { + number: 0, + state, + base, + historical_votes: HistoricalVotes::::new(), + }; + + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters = genesis_set.current().1.iter().map(|(a, _)| a.clone()).collect(); + let genesis_state = VoterSetState::Live { completed_rounds: CompletedRounds::new( - CompletedRound { - number: 0, - votes: Vec::new(), - state, - base, - }, + rounds, 0, - &genesis_set, + voters, ), current_round: HasVoted::No, }; @@ -400,16 +585,21 @@ pub(crate) fn update_authority_set( new_set.canon_hash.clone(), new_set.canon_number.clone(), )); + let completed_round = CompletedRound { + number: 0, + state: round_state, + historical_votes: HistoricalVotes::::new(), + base: (new_set.canon_hash, new_set.canon_number), + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters = set.current().1.iter().map(|(a, _)| a.clone()).collect(); + let set_state = VoterSetState::::Live { completed_rounds: CompletedRounds::new( - CompletedRound { - number: 0, - state: round_state, - votes: Vec::new(), - base: (new_set.canon_hash, new_set.canon_number), - }, + rounds, new_set.set_id, - &set, + voters, ), current_round: HasVoted::No, }; @@ -458,6 +648,9 @@ pub(crate) fn load_authorities(backend: &B) mod test { use substrate_primitives::H256; use test_client; + use test_client::runtime::Block; + use crate::Prevote; + use crate::environment::Vote; use super::*; #[test] @@ -507,10 +700,10 @@ mod test { assert_eq!( load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), - Some(2), + Some(3), ); - let PersistentData { authority_set, set_state, .. } = load_persistent::( + let PersistentData { authority_set, set_state, .. } = load_persistent::( &client, H256::random(), 0, @@ -527,18 +720,24 @@ mod test { }, ); + let completed_round = CompletedRound { + number: round_number, + state: round_state.clone(), + base: round_state.prevote_ghost.unwrap(), + historical_votes: HistoricalVotes::::new(), + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters = authority_set.inner().read() + .current().1.iter().map(|(a, _)| a.clone()).collect(); + assert_eq!( &*set_state.read(), &VoterSetState::Live { completed_rounds: CompletedRounds::new( - CompletedRound { - number: round_number, - state: round_state.clone(), - base: round_state.prevote_ghost.unwrap(), - votes: vec![], - }, + rounds, set_id, - &*authority_set.inner().read(), + voters, ), current_round: HasVoted::No, }, @@ -592,12 +791,118 @@ mod test { || unreachable!(), ).unwrap(); + assert_eq!( + load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), + Some(3), + ); + + let PersistentData { authority_set, set_state, .. } = + load_persistent::( + &client, + H256::random(), + 0, + || unreachable!(), + ).unwrap(); + + assert_eq!( + *authority_set.inner().read(), + AuthoritySet { + current_authorities: authorities.clone(), + pending_standard_changes: ForkTree::new(), + pending_forced_changes: Vec::new(), + set_id, + }, + ); + + let completed_round = CompletedRound { + number: round_number, + state: round_state.clone(), + base: round_state.prevote_ghost.unwrap(), + historical_votes: HistoricalVotes::::new(), + }; + + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters = authority_set.inner().read() + .current().1.iter().map(|(a, _)| a.clone()).collect(); + + assert_eq!( + &*set_state.read(), + &VoterSetState::Live { + completed_rounds: CompletedRounds::new( + rounds, + set_id, + voters, + ), + current_round: HasVoted::No, + }, + ); + } + + #[test] + fn load_decode_from_v2_migrates_data_format() { + let client = test_client::new(); + let voters = vec![AuthorityId::default()]; + let authorities = vec![(AuthorityId::default(), 100)]; + let set_id = 3; + let h = H256::random(); + let n = 32; + + let prevote = Prevote::::new(h.clone(), n.clone()); + let vote = Vote::Prevote(None, prevote); + + { + let current_round = HasVoted::Yes(AuthorityId::default(), vote.clone()); + + let authority_set = AuthoritySet:: { + current_authorities: authorities.clone(), + pending_standard_changes: ForkTree::new(), + pending_forced_changes: Vec::new(), + set_id, + }; + + let rounds = VecDeque::new(); + + let completed_rounds = V2CompletedRounds { + rounds, + set_id, + voters, + }; + + let voter_set_state = V2VoterSetState::Live { + completed_rounds, + current_round, + }; + + client.insert_aux( + &[ + (AUTHORITY_SET_KEY, authority_set.encode().as_slice()), + (SET_STATE_KEY, voter_set_state.encode().as_slice()), + (VERSION_KEY, 2u32.encode().as_slice()), + ], + &[], + ).unwrap(); + } + assert_eq!( load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(2), ); - let PersistentData { authority_set, set_state, .. } = load_persistent::( + // should perform the migration + load_persistent::( + &client, + H256::random(), + 0, + || unreachable!(), + ).unwrap(); + + assert_eq!( + load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), + Some(3), + ); + + let PersistentData { authority_set, set_state, .. } = load_persistent::( &client, H256::random(), 0, @@ -607,27 +912,26 @@ mod test { assert_eq!( *authority_set.inner().read(), AuthoritySet { - current_authorities: authorities.clone(), + current_authorities: authorities, pending_standard_changes: ForkTree::new(), pending_forced_changes: Vec::new(), set_id, }, ); + let rounds = VecDeque::new(); + let voters = authority_set.inner().read() + .current().1.iter().map(|(a, _)| a.clone()).collect(); + assert_eq!( &*set_state.read(), &VoterSetState::Live { completed_rounds: CompletedRounds::new( - CompletedRound { - number: round_number, - state: round_state.clone(), - base: round_state.prevote_ghost.unwrap(), - votes: vec![], - }, + rounds, set_id, - &*authority_set.inner().read(), + voters, ), - current_round: HasVoted::No, + current_round: HasVoted::Yes(AuthorityId::default(), vote), }, ); } diff --git a/core/finality-grandpa/src/communication/gossip.rs b/core/finality-grandpa/src/communication/gossip.rs index dfaa96628f2d..803aa7c268ba 100644 --- a/core/finality-grandpa/src/communication/gossip.rs +++ b/core/finality-grandpa/src/communication/gossip.rs @@ -763,7 +763,7 @@ impl Inner { // code below assumes this invariant is maintained when creating the // catch up reply since peers won't accept catch-up messages that have // too many equivocations (we exceed the fault-tolerance bound). - for vote in last_completed_round.votes { + for vote in last_completed_round.historical_votes.seen().clone() { match vote.message { grandpa::Message::Prevote(prevote) => { prevotes.push(grandpa::SignedPrevote { @@ -1231,6 +1231,7 @@ impl> Future for ReportingTask { mod tests { use super::*; use super::environment::SharedVoterSetState; + use crate::HistoricalVotes; use network_gossip::Validator as GossipValidatorT; use network::test::Block; @@ -1246,24 +1247,27 @@ mod tests { // dummy voter set state fn voter_set_state() -> SharedVoterSetState { - use crate::authorities::AuthoritySet; use crate::environment::{CompletedRound, CompletedRounds, HasVoted, VoterSetState}; use grandpa::round::State as RoundState; use substrate_primitives::H256; let state = RoundState::genesis((H256::zero(), 0)); let base = state.prevote_ghost.unwrap(); - let voters = AuthoritySet::genesis(Vec::new()); + let voters = Vec::new(); + let completed_round = CompletedRound { + state, + number: 0, + base, + historical_votes: HistoricalVotes::::new(), + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let set_state = VoterSetState::Live { completed_rounds: CompletedRounds::new( - CompletedRound { - state, - number: 0, - votes: Vec::new(), - base, - }, + rounds, 0, - &voters, + voters, ), current_round: HasVoted::No, }; @@ -1545,7 +1549,7 @@ mod tests { number: 1, state: grandpa::round::State::genesis(Default::default()), base: Default::default(), - votes: Default::default(), + historical_votes: HistoricalVotes::::new(), })); let set_state = environment::VoterSetState::::Live { diff --git a/core/finality-grandpa/src/communication/mod.rs b/core/finality-grandpa/src/communication/mod.rs index 4707dede78d6..58e327a44857 100644 --- a/core/finality-grandpa/src/communication/mod.rs +++ b/core/finality-grandpa/src/communication/mod.rs @@ -265,7 +265,7 @@ impl> NetworkBridge { // messages will be ignored. validator.note_round(Round(round.number), |_, _| {}); - for signed in round.votes.iter() { + for signed in round.historical_votes.seen().iter() { let message = gossip::GossipMessage::VoteOrPrecommit( gossip::VoteOrPrecommitMessage:: { message: signed.clone(), @@ -282,7 +282,7 @@ impl> NetworkBridge { trace!(target: "afg", "Registered {} messages for topic {:?} (round: {}, set_id: {})", - round.votes.len(), + round.historical_votes.seen().len(), topic, round.number, set_id, diff --git a/core/finality-grandpa/src/communication/tests.rs b/core/finality-grandpa/src/communication/tests.rs index 5760b3936cd9..f71af8f1d5a2 100644 --- a/core/finality-grandpa/src/communication/tests.rs +++ b/core/finality-grandpa/src/communication/tests.rs @@ -23,10 +23,12 @@ use network::test::{Block, Hash}; use network_gossip::Validator; use tokio::runtime::current_thread; use std::sync::Arc; +use std::collections::VecDeque; use keyring::AuthorityKeyring; use parity_codec::Encode; use crate::environment::SharedVoterSetState; +use crate::HistoricalVotes; use super::gossip::{self, GossipValidator}; use super::{AuthorityId, VoterSet, Round, SetId}; @@ -140,24 +142,26 @@ fn config() -> crate::Config { // dummy voter set state fn voter_set_state() -> SharedVoterSetState { - use crate::authorities::AuthoritySet; use crate::environment::{CompletedRound, CompletedRounds, HasVoted, VoterSetState}; use grandpa::round::State as RoundState; use substrate_primitives::H256; let state = RoundState::genesis((H256::zero(), 0)); let base = state.prevote_ghost.unwrap(); - let voters = AuthoritySet::genesis(Vec::new()); + let voters = Vec::new(); + let completed_round = CompletedRound { + state, + number: 0, + base, + historical_votes: HistoricalVotes::::new(), + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); let set_state = VoterSetState::Live { completed_rounds: CompletedRounds::new( - CompletedRound { - state, - number: 0, - votes: Vec::new(), - base, - }, + rounds, 0, - &voters, + voters, ), current_round: HasVoted::No, }; diff --git a/core/finality-grandpa/src/environment.rs b/core/finality-grandpa/src/environment.rs index 414e3ca0ab43..67b698a4de4b 100644 --- a/core/finality-grandpa/src/environment.rs +++ b/core/finality-grandpa/src/environment.rs @@ -41,12 +41,12 @@ use substrate_telemetry::{telemetry, CONSENSUS_INFO}; use crate::{ CommandOrError, Commit, Config, Error, Network, Precommit, Prevote, - PrimaryPropose, SignedMessage, NewAuthoritySet, VoterCommand, + PrimaryPropose, NewAuthoritySet, VoterCommand, }; use consensus_common::SelectChain; -use crate::authorities::{AuthoritySet, SharedAuthoritySet}; +use crate::authorities::SharedAuthoritySet; use crate::consensus_changes::SharedConsensusChanges; use crate::justification::GrandpaJustification; use crate::until_imported::UntilVoteTargetImported; @@ -70,7 +70,7 @@ pub struct CompletedRound { /// The target block base used for voting in the round. pub base: (Block::Hash, NumberFor), /// All the votes observed in the round. - pub votes: Vec>, + pub historical_votes: HistoricalVotes, } // Data about last completed rounds within a single voter set. Stores NUM_LAST_COMPLETED_ROUNDS and always @@ -82,6 +82,7 @@ pub struct CompletedRounds { voters: Vec, } + // NOTE: the current strategy for persisting completed rounds is very naive // (update everything) and we also rely on cloning to do atomic updates, // therefore this value should be kept small for now. @@ -108,16 +109,12 @@ impl Decode for CompletedRounds { impl CompletedRounds { /// Create a new completed rounds tracker with NUM_LAST_COMPLETED_ROUNDS capacity. pub(crate) fn new( - genesis: CompletedRound, + rounds: VecDeque>, set_id: u64, - voters: &AuthoritySet>, + voters: Vec, ) -> CompletedRounds { - let mut rounds = VecDeque::with_capacity(NUM_LAST_COMPLETED_ROUNDS); - rounds.push_back(genesis); - - let voters = voters.current().1.iter().map(|(a, _)| a.clone()).collect(); CompletedRounds { rounds, set_id, voters } } @@ -668,15 +665,12 @@ where self.update_voter_set_state(|voter_set_state| { let mut completed_rounds = voter_set_state.completed_rounds(); - // TODO: Future integration will store the prevote and precommit index. See #2611. - let votes = historical_votes.seen().clone(); - // NOTE: the Environment assumes that rounds are *always* completed in-order. if !completed_rounds.push(CompletedRound { number: round, state: state.clone(), base, - votes, + historical_votes: historical_votes.clone(), }) { let msg = "Voter completed round that is older than the last completed round."; return Err(Error::Safety(msg.to_string())); diff --git a/core/finality-grandpa/src/lib.rs b/core/finality-grandpa/src/lib.rs index 534a5d925603..cbed2b5e7eb4 100644 --- a/core/finality-grandpa/src/lib.rs +++ b/core/finality-grandpa/src/lib.rs @@ -77,6 +77,7 @@ use grandpa::{voter, round::State as RoundState, BlockNumberOps, voter_set::Vote use std::fmt; use std::sync::Arc; use std::time::Duration; +use std::collections::VecDeque; mod authorities; mod aux_schema; @@ -115,6 +116,7 @@ mod tests; /// A GRANDPA message for a substrate chain. pub type Message = grandpa::Message<::Hash, NumberFor>; + /// A signed message. pub type SignedMessage = grandpa::SignedMessage< ::Hash, @@ -123,12 +125,23 @@ pub type SignedMessage = grandpa::SignedMessage< AuthorityId, >; +/// An ordered set of historical votes. +pub type HistoricalVotes = grandpa::HistoricalVotes< + ::Hash, + NumberFor, + AuthoritySignature, + AuthorityId, +>; + /// A primary propose message for this chain's block type. pub type PrimaryPropose = grandpa::PrimaryPropose<::Hash, NumberFor>; + /// A prevote message for this chain's block type. pub type Prevote = grandpa::Prevote<::Hash, NumberFor>; + /// A precommit message for this chain's block type. pub type Precommit = grandpa::Precommit<::Hash, NumberFor>; + /// A catch up message for this chain's block type. pub type CatchUp = grandpa::CatchUp< ::Hash, @@ -136,6 +149,7 @@ pub type CatchUp = grandpa::CatchUp< AuthoritySignature, AuthorityId, >; + /// A commit message for this chain's block type. pub type Commit = grandpa::Commit< ::Hash, @@ -143,6 +157,7 @@ pub type Commit = grandpa::Commit< AuthoritySignature, AuthorityId, >; + /// A compact commit message for this chain's block type. pub type CompactCommit = grandpa::CompactCommit< ::Hash, @@ -150,6 +165,7 @@ pub type CompactCommit = grandpa::CompactCommit< AuthoritySignature, AuthorityId, >; + /// A global communication input stream for commits and catch up messages. Not /// exposed publicly, used internally to simplify types in the communication /// layer. @@ -663,19 +679,29 @@ pub fn run_grandpa_voter, N, RA, SC, X>( // start the new authority set using the block where the // set changed (not where the signal happened!) as the base. let genesis_state = RoundState::genesis((new.canon_hash, new.canon_number)); + + // always start at round 0 when changing sets. + let completed_round = CompletedRound { + number: 0, + state: genesis_state, + base: (new.canon_hash, new.canon_number), + historical_votes: HistoricalVotes::::new(), + }; + + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + + let voters = authority_set.inner().read() + .current().1.iter().map(|(a, _)| a.clone()).collect(); + + let completed_rounds = CompletedRounds::new( + rounds, + new.set_id, + voters, + ); let set_state = VoterSetState::Live { - // always start at round 0 when changing sets. - completed_rounds: CompletedRounds::new( - CompletedRound { - number: 0, - state: genesis_state, - base: (new.canon_hash, new.canon_number), - votes: Vec::new(), - }, - new.set_id, - &*authority_set.inner().read(), - ), + completed_rounds, current_round: HasVoted::No, }; diff --git a/core/finality-grandpa/src/observer.rs b/core/finality-grandpa/src/observer.rs index 2c0818c2d709..ae8ea6349a26 100644 --- a/core/finality-grandpa/src/observer.rs +++ b/core/finality-grandpa/src/observer.rs @@ -15,12 +15,14 @@ // along with Substrate. If not, see . use std::sync::Arc; +use std::collections::VecDeque; use futures::prelude::*; use futures::future::{self, Loop as FutureLoop}; use grandpa::{ - BlockNumberOps, Error as GrandpaError, round::State as RoundState, voter, voter_set::VoterSet + BlockNumberOps, Error as GrandpaError, round::State as RoundState, voter, voter_set::VoterSet, + HistoricalVotes, }; use log::{debug, info, warn}; @@ -239,19 +241,26 @@ pub fn run_grandpa_observer, N, RA, SC>( // start the new authority set using the block where the // set changed (not where the signal happened!) as the base. let genesis_state = RoundState::genesis((new.canon_hash, new.canon_number)); - + let completed_round = CompletedRound { + number: 0, + state: genesis_state, + base: (new.canon_hash, new.canon_number), + historical_votes: HistoricalVotes::new(), + }; + let mut rounds = VecDeque::new(); + rounds.push_back(completed_round); + let voters_set = &*authority_set.inner().read(); + let voters = voters_set + .current().1.iter().map(|(a, _)| a.clone()).collect(); + + let completed_rounds = CompletedRounds::new( + rounds, + new.set_id, + voters, + ); let set_state = VoterSetState::Live:: { // always start at round 0 when changing sets. - completed_rounds: CompletedRounds::new( - CompletedRound { - number: 0, - state: genesis_state, - base: (new.canon_hash, new.canon_number), - votes: Vec::new(), - }, - new.set_id, - &*authority_set.inner().read(), - ), + completed_rounds, current_round: HasVoted::No, };