From 3f8cfb7d806802915a396087fcd346522d27f76a Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Thu, 9 Jul 2020 15:12:52 +0200 Subject: [PATCH 1/9] Make a test crate to make the runtime-test usable (#1258) Fixes #833 --- Cargo.lock | 342 ++++++++++++++--------- Cargo.toml | 1 + network/test/src/block_import.rs | 2 +- node/service/src/grandpa_support.rs | 8 +- node/test-service/Cargo.toml | 56 ++++ node/test-service/src/chain_spec.rs | 184 ++++++++++++ node/test-service/src/lib.rs | 307 ++++++++++++++++++++ node/test-service/tests/build-blocks.rs | 78 ++++++ node/test-service/tests/call-function.rs | 73 +++++ runtime/test-runtime/Cargo.toml | 7 + runtime/test-runtime/client/Cargo.toml | 25 +- runtime/test-runtime/client/src/lib.rs | 47 ++-- runtime/test-runtime/src/genesismap.rs | 75 ----- runtime/test-runtime/src/lib.rs | 83 ++++-- service/src/grandpa_support.rs | 10 +- service/src/lib.rs | 220 +++++++++------ 16 files changed, 1161 insertions(+), 357 deletions(-) create mode 100644 node/test-service/Cargo.toml create mode 100644 node/test-service/src/chain_spec.rs create mode 100644 node/test-service/src/lib.rs create mode 100644 node/test-service/tests/build-blocks.rs create mode 100644 node/test-service/tests/call-function.rs delete mode 100644 runtime/test-runtime/src/genesismap.rs diff --git a/Cargo.lock b/Cargo.lock index 9b53e65c3f9c..894eeab6f4c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1285,7 +1285,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", ] @@ -1293,7 +1293,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -1310,7 +1310,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "Inflector", "frame-benchmarking", @@ -1329,7 +1329,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -1344,7 +1344,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "11.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "serde", @@ -1355,7 +1355,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "bitmask", "frame-metadata", @@ -1380,7 +1380,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.18", @@ -1391,7 +1391,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1403,7 +1403,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -1413,7 +1413,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1429,7 +1429,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -3409,7 +3409,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3425,7 +3425,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3440,7 +3440,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3465,7 +3465,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3479,7 +3479,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3495,7 +3495,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3510,7 +3510,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3525,7 +3525,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3541,7 +3541,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3561,7 +3561,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3577,7 +3577,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3597,7 +3597,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3613,7 +3613,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3627,7 +3627,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3642,7 +3642,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3656,7 +3656,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3671,7 +3671,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3692,7 +3692,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3707,7 +3707,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3720,7 +3720,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "enumflags2", "frame-support", @@ -3735,7 +3735,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3750,7 +3750,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3770,7 +3770,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3786,7 +3786,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3822,7 +3822,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -3833,7 +3833,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3847,7 +3847,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3865,7 +3865,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3880,7 +3880,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -3898,7 +3898,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "parity-scale-codec", @@ -3911,7 +3911,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3926,7 +3926,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3942,7 +3942,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4943,6 +4943,7 @@ dependencies = [ "hex-literal", "libsecp256k1", "log 0.3.9", + "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-balances", @@ -4955,6 +4956,7 @@ dependencies = [ "pallet-session", "pallet-staking", "pallet-staking-reward-curve", + "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -4969,12 +4971,14 @@ dependencies = [ "serde_json", "smallvec 1.4.1", "sp-api", + "sp-authority-discovery", "sp-block-builder", "sp-consensus-babe", "sp-core", "sp-inherents", "sp-io", "sp-keyring", + "sp-offchain", "sp-runtime", "sp-session", "sp-staking", @@ -4996,6 +5000,7 @@ dependencies = [ "polkadot-primitives", "polkadot-runtime-common", "polkadot-test-runtime", + "polkadot-test-service", "sc-block-builder", "sc-client-api", "sc-consensus", @@ -5008,6 +5013,55 @@ dependencies = [ "substrate-test-client", ] +[[package]] +name = "polkadot-test-service" +version = "0.8.2" +dependencies = [ + "frame-benchmarking", + "frame-system", + "futures 0.1.29", + "futures 0.3.5", + "hex", + "log 0.4.8", + "pallet-balances", + "pallet-staking", + "pallet-transaction-payment", + "polkadot-availability-store", + "polkadot-network", + "polkadot-primitives", + "polkadot-rpc", + "polkadot-runtime-common", + "polkadot-service", + "polkadot-test-runtime", + "polkadot-validation", + "rand 0.7.3", + "sc-authority-discovery", + "sc-chain-spec", + "sc-client-api", + "sc-consensus", + "sc-consensus-babe", + "sc-executor", + "sc-finality-grandpa", + "sc-informant", + "sc-network", + "sc-service", + "sc-transaction-pool", + "serde_json", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-core", + "sp-finality-grandpa", + "sp-inherents", + "sp-keyring", + "sp-runtime", + "sp-state-machine", + "substrate-test-client", + "tempfile", + "tokio 0.2.21", +] + [[package]] name = "polkadot-validation" version = "0.8.14" @@ -5820,7 +5874,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "bytes 0.5.4", "derive_more 0.99.8", @@ -5847,7 +5901,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -5871,7 +5925,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5888,7 +5942,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5904,7 +5958,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -5915,7 +5969,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "ansi_term 0.12.1", "atty", @@ -5956,7 +6010,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "fnv", @@ -5992,7 +6046,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "blake2-rfc", "hash-db", @@ -6021,7 +6075,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6032,7 +6086,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "fork-tree", @@ -6074,7 +6128,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6098,7 +6152,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6111,7 +6165,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6134,7 +6188,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "sc-client-api", @@ -6148,7 +6202,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "lazy_static", @@ -6176,7 +6230,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -6193,7 +6247,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6208,7 +6262,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "cranelift-codegen", "cranelift-wasm", @@ -6229,7 +6283,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "assert_matches", "derive_more 0.99.8", @@ -6267,7 +6321,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "finality-grandpa", @@ -6284,7 +6338,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", @@ -6302,7 +6356,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "hex", @@ -6318,7 +6372,7 @@ dependencies = [ [[package]] name = "sc-light" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "hash-db", "lazy_static", @@ -6337,7 +6391,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "bitflags", "bs58", @@ -6389,7 +6443,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6404,7 +6458,7 @@ dependencies = [ [[package]] name = "sc-network-test" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "env_logger", "futures 0.3.5", @@ -6431,7 +6485,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "bytes 0.5.4", "fnv", @@ -6458,7 +6512,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "libp2p", @@ -6471,7 +6525,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "substrate-prometheus-endpoint", @@ -6480,7 +6534,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "hash-db", @@ -6512,7 +6566,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6536,7 +6590,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6552,7 +6606,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "directories", @@ -6615,7 +6669,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6629,7 +6683,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6650,7 +6704,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "erased-serde", "log 0.4.8", @@ -6667,7 +6721,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6687,7 +6741,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7094,7 +7148,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -7106,7 +7160,7 @@ dependencies = [ [[package]] name = "sp-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "hash-db", "parity-scale-codec", @@ -7121,7 +7175,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7133,7 +7187,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "serde", @@ -7145,7 +7199,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "integer-sqrt", "num-traits 0.2.12", @@ -7158,7 +7212,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -7170,7 +7224,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7181,7 +7235,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -7193,7 +7247,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -7209,7 +7263,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "serde", "serde_json", @@ -7218,7 +7272,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7242,7 +7296,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -7256,7 +7310,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "merlin", "parity-scale-codec", @@ -7275,7 +7329,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7284,7 +7338,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7296,7 +7350,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "base58", "blake2-rfc", @@ -7339,7 +7393,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7348,7 +7402,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -7358,7 +7412,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "environmental", "parity-scale-codec", @@ -7369,7 +7423,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "finality-grandpa", "log 0.4.8", @@ -7385,7 +7439,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7395,7 +7449,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "parity-scale-codec", @@ -7407,7 +7461,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "hash-db", @@ -7428,7 +7482,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "lazy_static", "sp-core", @@ -7439,7 +7493,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "serde", @@ -7451,7 +7505,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -7462,7 +7516,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "sp-api", "sp-core", @@ -7472,7 +7526,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "backtrace", "log 0.4.8", @@ -7481,7 +7535,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "serde", "sp-core", @@ -7490,7 +7544,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "either", "hash256-std-hasher", @@ -7512,7 +7566,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7527,7 +7581,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "Inflector", "proc-macro-crate", @@ -7539,7 +7593,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "serde", "serde_json", @@ -7548,7 +7602,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -7561,7 +7615,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7571,7 +7625,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "hash-db", "itertools 0.9.0", @@ -7592,12 +7646,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" [[package]] name = "sp-storage" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7609,7 +7663,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7623,7 +7677,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "rental", @@ -7633,7 +7687,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7649,7 +7703,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "hash-db", "memory-db", @@ -7663,7 +7717,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-core", @@ -7675,7 +7729,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7687,7 +7741,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7827,7 +7881,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "chrono", "clear_on_drop", @@ -7854,7 +7908,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "platforms", ] @@ -7862,7 +7916,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -7885,7 +7939,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "async-std", "derive_more 0.99.8", @@ -7899,7 +7953,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.1.29", "futures 0.3.5", @@ -7912,6 +7966,8 @@ dependencies = [ "sc-executor", "sc-light", "sc-service", + "serde", + "serde_json", "sp-blockchain", "sp-consensus", "sp-core", @@ -7923,7 +7979,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "cfg-if", "frame-executive", @@ -7963,7 +8019,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "parity-scale-codec", @@ -7984,7 +8040,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" [[package]] name = "substrate-wasm-builder-runner" @@ -8419,6 +8475,7 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "slab", + "tokio-macros", "winapi 0.3.8", ] @@ -8497,6 +8554,17 @@ dependencies = [ "log 0.4.8", ] +[[package]] +name = "tokio-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.31", +] + [[package]] name = "tokio-named-pipes" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index fa5fa1627970..fe5bbcf2f9bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,7 @@ members = [ "node/service", "node/subsystem", "node/test-helpers/subsystem", + "node/test-service", "parachain/test-parachains", "parachain/test-parachains/adder", diff --git a/network/test/src/block_import.rs b/network/test/src/block_import.rs index ec848609cd4a..68b0291e5089 100644 --- a/network/test/src/block_import.rs +++ b/network/test/src/block_import.rs @@ -29,7 +29,7 @@ fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock) let mut client = polkadot_test_runtime_client::new(); let mut builder = client.new_block(Default::default()).unwrap(); - let extrinsics = polkadot_test_runtime_client::needed_extrinsics(vec![]); + let extrinsics = polkadot_test_runtime_client::needed_extrinsics(vec![], 0); for extrinsic in &extrinsics { builder.push(extrinsic.clone()).unwrap(); diff --git a/node/service/src/grandpa_support.rs b/node/service/src/grandpa_support.rs index a875c4b45a37..806a189d9fe5 100644 --- a/node/service/src/grandpa_support.rs +++ b/node/service/src/grandpa_support.rs @@ -250,17 +250,21 @@ mod tests { let mut push_blocks = { let mut client = client.clone(); + let mut base = 0; + move |n| { - for _ in 0..n { + for i in 0..n { let mut builder = client.new_block(Default::default()).unwrap(); - for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![]) { + for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![], base + i) { builder.push(extrinsic).unwrap() } let block = builder.build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); } + + base += n; } }; diff --git a/node/test-service/Cargo.toml b/node/test-service/Cargo.toml new file mode 100644 index 000000000000..db6328a9aac2 --- /dev/null +++ b/node/test-service/Cargo.toml @@ -0,0 +1,56 @@ +[package] +name = "polkadot-test-service" +version = "0.8.2" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +futures = "0.3.4" +futures01 = { package = "futures", version = "0.1.29" } +hex = "0.4" +log = "0.4.8" +rand = "0.7.3" +tempfile = "3.1.0" + +# Polkadot dependencies +av_store = { package = "polkadot-availability-store", path = "../../availability-store" } +consensus = { package = "polkadot-validation", path = "../../validation" } +polkadot-network = { path = "../../network" } +polkadot-primitives = { path = "../../primitives" } +polkadot-rpc = { path = "../../rpc" } +polkadot-runtime-common = { path = "../../runtime/common" } +polkadot-service = { path = "../../service" } +polkadot-test-runtime = { path = "../../runtime/test-runtime" } + +# Substrate dependencies +authority-discovery = { package = "sc-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master" } +babe = { package = "sc-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" } +babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" } +consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } +grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } +grandpa_primitives = { package = "sp-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } +inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-informant = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } +service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" } + +[dev-dependencies] +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +serde_json = "1.0" +tokio = { version = "0.2", features = ["macros"] } diff --git a/node/test-service/src/chain_spec.rs b/node/test-service/src/chain_spec.rs new file mode 100644 index 000000000000..cbb08c470f07 --- /dev/null +++ b/node/test-service/src/chain_spec.rs @@ -0,0 +1,184 @@ +// Copyright 2020 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 . + +use babe_primitives::AuthorityId as BabeId; +use grandpa::AuthorityId as GrandpaId; +use pallet_staking::Forcing; +use polkadot_primitives::{parachain::ValidatorId, AccountId}; +use polkadot_service::chain_spec::{get_account_id_from_seed, get_from_seed, Extensions}; +use polkadot_test_runtime::constants::currency::DOTS; +use sc_chain_spec::{ChainSpec, ChainType}; +use sp_core::{sr25519, ChangesTrieConfiguration}; +use sp_runtime::Perbill; + +const DEFAULT_PROTOCOL_ID: &str = "dot"; + +/// The `ChainSpec parametrised for polkadot runtime`. +pub type PolkadotChainSpec = + service::GenericChainSpec; + +/// Polkadot local testnet config (multivalidator Alice + Bob) +pub fn polkadot_local_testnet_config() -> PolkadotChainSpec { + PolkadotChainSpec::from_genesis( + "Local Testnet", + "local_testnet", + ChainType::Local, + || polkadot_local_testnet_genesis(None), + vec![], + None, + Some(DEFAULT_PROTOCOL_ID), + None, + Default::default(), + ) +} + +/// Polkadot local testnet genesis config (multivalidator Alice + Bob) +pub fn polkadot_local_testnet_genesis( + changes_trie_config: Option, +) -> polkadot_test_runtime::GenesisConfig { + polkadot_testnet_genesis( + vec![ + get_authority_keys_from_seed("Alice"), + get_authority_keys_from_seed("Bob"), + get_authority_keys_from_seed("Charlie"), + ], + get_account_id_from_seed::("Alice"), + None, + changes_trie_config, + ) +} + +/// Helper function to generate stash, controller and session key from seed +fn get_authority_keys_from_seed( + seed: &str, +) -> (AccountId, AccountId, BabeId, GrandpaId, ValidatorId) { + ( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + ) +} + +fn testnet_accounts() -> Vec { + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ] +} + +/// Helper function to create polkadot GenesisConfig for testing +fn polkadot_testnet_genesis( + initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ValidatorId)>, + root_key: AccountId, + endowed_accounts: Option>, + changes_trie_config: Option, +) -> polkadot_test_runtime::GenesisConfig { + use polkadot_test_runtime as polkadot; + + let endowed_accounts: Vec = endowed_accounts.unwrap_or_else(testnet_accounts); + + const ENDOWMENT: u128 = 1_000_000 * DOTS; + const STASH: u128 = 100 * DOTS; + + polkadot::GenesisConfig { + system: Some(polkadot::SystemConfig { + code: polkadot::WASM_BINARY.to_vec(), + changes_trie_config, + }), + indices: Some(polkadot::IndicesConfig { indices: vec![] }), + balances: Some(polkadot::BalancesConfig { + balances: endowed_accounts + .iter() + .map(|k| (k.clone(), ENDOWMENT)) + .collect(), + }), + session: Some(polkadot::SessionConfig { + keys: initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + polkadot_test_runtime::SessionKeys { + babe: x.2.clone(), + grandpa: x.3.clone(), + parachain_validator: x.4.clone(), + }, + ) + }) + .collect::>(), + }), + staking: Some(polkadot::StakingConfig { + minimum_validator_count: 1, + validator_count: 2, + stakers: initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.1.clone(), + STASH, + polkadot::StakerStatus::Validator, + ) + }) + .collect(), + invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(), + force_era: Forcing::NotForcing, + slash_reward_fraction: Perbill::from_percent(10), + ..Default::default() + }), + babe: Some(Default::default()), + grandpa: Some(Default::default()), + authority_discovery: Some(polkadot::AuthorityDiscoveryConfig { keys: vec![] }), + parachains: Some(polkadot::ParachainsConfig { + authorities: vec![], + }), + registrar: Some(polkadot::RegistrarConfig { + parachains: vec![], + _phdata: Default::default(), + }), + claims: Some(polkadot::ClaimsConfig { + claims: vec![], + vesting: vec![], + }), + vesting: Some(polkadot::VestingConfig { vesting: vec![] }), + sudo: Some(polkadot::SudoConfig { key: root_key }), + } +} + +/// Can be called for a `Configuration` to check if it is a configuration for the `Test` network. +pub trait IdentifyVariant { + /// Returns if this is a configuration for the `Test` network. + fn is_test(&self) -> bool; +} + +impl IdentifyVariant for Box { + fn is_test(&self) -> bool { + self.id().starts_with("test") + } +} diff --git a/node/test-service/src/lib.rs b/node/test-service/src/lib.rs new file mode 100644 index 000000000000..7fc75d9f3719 --- /dev/null +++ b/node/test-service/src/lib.rs @@ -0,0 +1,307 @@ +// Copyright 2020 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 . + +//! Polkadot test service only. + +#![warn(missing_docs)] + +mod chain_spec; + +pub use chain_spec::*; +use consensus_common::{block_validation::Chain, SelectChain}; +use futures::future::Future; +use grandpa::FinalityProofProvider as GrandpaFinalityProofProvider; +use log::info; +use polkadot_network::{legacy::gossip::Known, protocol as network_protocol}; +use polkadot_primitives::{ + parachain::{self, CollatorId}, + Block, BlockId, Hash, +}; +use polkadot_runtime_common::{parachains, registrar, BlockHashCount}; +use polkadot_service::{ + new_full, new_full_start, FullNodeHandles, PolkadotClient, ServiceComponents, +}; +use polkadot_test_runtime::{RestrictFunctionality, Runtime, SignedExtra, SignedPayload, VERSION}; +use sc_chain_spec::ChainSpec; +use sc_client_api::{execution_extensions::ExecutionStrategies, BlockchainEvents}; +use sc_executor::native_executor_instance; +use sc_informant::OutputFormat; +use sc_network::{ + config::{NetworkConfiguration, TransportConfig}, + multiaddr, NetworkService, +}; +use service::{ + config::{DatabaseConfig, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod}, + error::Error as ServiceError, + RpcHandlers, TaskExecutor, TaskManager, +}; +use service::{BasePath, Configuration, Role, TFullBackend}; +use sp_arithmetic::traits::SaturatedConversion; +use sp_blockchain::HeaderBackend; +use sp_keyring::Sr25519Keyring; +use sp_runtime::{codec::Encode, generic}; +use sp_state_machine::BasicExternalities; +use std::sync::Arc; +use std::time::Duration; +use substrate_test_client::{BlockchainEventsExt, RpcHandlersExt, RpcTransactionOutput, RpcTransactionError}; + +native_executor_instance!( + pub PolkadotTestExecutor, + polkadot_test_runtime::api::dispatch, + polkadot_test_runtime::native_version, + frame_benchmarking::benchmarking::HostFunctions, +); + +/// Create a new Polkadot test service for a full node. +pub fn polkadot_test_new_full( + config: Configuration, + collating_for: Option<(CollatorId, parachain::Id)>, + max_block_data_size: Option, + authority_discovery_enabled: bool, + slot_duration: u64, +) -> Result< + ( + TaskManager, + Arc, polkadot_test_runtime::RuntimeApi>>, + FullNodeHandles, + Arc>, + Arc, + ), + ServiceError, +> { + let (task_manager, client, handles, network, rpc_handlers) = new_full!(test + config, + collating_for, + max_block_data_size, + authority_discovery_enabled, + slot_duration, + polkadot_test_runtime::RuntimeApi, + PolkadotTestExecutor, + ); + + Ok((task_manager, client, handles, network, rpc_handlers)) +} + +/// Create a Polkadot `Configuration`. By default an in-memory socket will be used, therefore you need to provide boot +/// nodes if you want the future node to be connected to other nodes. The `storage_update_func` can be used to make +/// adjustements to the runtime before the node starts. +pub fn node_config( + storage_update_func: impl Fn(), + task_executor: TaskExecutor, + key: Sr25519Keyring, + boot_nodes: Vec, +) -> Configuration { + let base_path = BasePath::new_temp_dir().expect("could not create temporary directory"); + let root = base_path.path(); + let role = Role::Authority { + sentry_nodes: Vec::new(), + }; + let key_seed = key.to_seed(); + let mut spec = polkadot_local_testnet_config(); + let mut storage = spec + .as_storage_builder() + .build_storage() + .expect("could not build storage"); + + BasicExternalities::execute_with_storage(&mut storage, storage_update_func); + spec.set_storage(storage); + + let mut network_config = NetworkConfiguration::new( + format!("Polkadot Test Node for: {}", key_seed), + "network/test/0.1", + Default::default(), + None, + ); + let informant_output_format = OutputFormat { + enable_color: false, + prefix: format!("[{}] ", key_seed), + }; + + network_config.boot_nodes = boot_nodes; + + network_config.allow_non_globals_in_dht = true; + + network_config + .listen_addresses + .push(multiaddr::Protocol::Memory(rand::random()).into()); + + network_config.transport = TransportConfig::MemoryOnly; + + Configuration { + impl_name: "polkadot-test-node".to_string(), + impl_version: "0.1".to_string(), + role, + task_executor, + transaction_pool: Default::default(), + network: network_config, + keystore: KeystoreConfig::Path { + path: root.join("key"), + password: None, + }, + database: DatabaseConfig::RocksDb { + path: root.join("db"), + cache_size: 128, + }, + state_cache_size: 16777216, + state_cache_child_ratio: None, + pruning: Default::default(), + chain_spec: Box::new(spec), + wasm_method: WasmExecutionMethod::Interpreted, + // NOTE: we enforce the use of the native runtime to make the errors more debuggable + execution_strategies: ExecutionStrategies { + syncing: sc_client_api::ExecutionStrategy::NativeWhenPossible, + importing: sc_client_api::ExecutionStrategy::NativeWhenPossible, + block_construction: sc_client_api::ExecutionStrategy::NativeWhenPossible, + offchain_worker: sc_client_api::ExecutionStrategy::NativeWhenPossible, + other: sc_client_api::ExecutionStrategy::NativeWhenPossible, + }, + rpc_http: None, + rpc_ws: None, + rpc_ipc: None, + rpc_ws_max_connections: None, + rpc_cors: None, + rpc_methods: Default::default(), + prometheus_config: None, + telemetry_endpoints: None, + telemetry_external_transport: None, + default_heap_pages: None, + offchain_worker: Default::default(), + force_authoring: false, + disable_grandpa: false, + dev_key_seed: Some(key_seed), + tracing_targets: None, + tracing_receiver: Default::default(), + max_runtime_instances: 8, + announce_block: true, + base_path: Some(base_path), + informant_output_format, + } +} + +/// Run a Polkadot test node using the Polkadot test runtime. The node will be using an in-memory socket, therefore you +/// need to provide boot nodes if you want it to be connected to other nodes. The `storage_update_func` can be used to +/// make adjustements to the runtime before the node starts. +pub fn run_test_node( + task_executor: TaskExecutor, + key: Sr25519Keyring, + storage_update_func: impl Fn(), + boot_nodes: Vec, +) -> PolkadotTestNode< + TaskManager, + impl PolkadotClient, polkadot_test_runtime::RuntimeApi>, +> { + let config = node_config(storage_update_func, task_executor, key, boot_nodes); + let multiaddr = config.network.listen_addresses[0].clone(); + let authority_discovery_enabled = false; + let (task_manager, client, handles, network, rpc_handlers) = + polkadot_test_new_full(config, None, None, authority_discovery_enabled, 6000) + .expect("could not create Polkadot test service"); + + let peer_id = network.local_peer_id().clone(); + let addr = MultiaddrWithPeerId { multiaddr, peer_id }; + + PolkadotTestNode { + task_manager, + client, + handles, + addr, + rpc_handlers, + } +} + +/// A Polkadot test node instance used for testing. +pub struct PolkadotTestNode { + /// TaskManager's instance. + pub task_manager: S, + /// Client's instance. + pub client: Arc, + /// Node's handles. + pub handles: FullNodeHandles, + /// The `MultiaddrWithPeerId` to this node. This is useful if you want to pass it as "boot node" to other nodes. + pub addr: MultiaddrWithPeerId, + /// RPCHandlers to make RPC queries. + pub rpc_handlers: Arc, +} + +impl PolkadotTestNode +where + C: HeaderBackend, +{ + /// Send a transaction through RPCHandlers to call a function. + pub async fn call_function( + &self, + function: polkadot_test_runtime::Call, + caller: Sr25519Keyring, + ) -> Result { + let current_block_hash = self.client.info().best_hash; + let current_block = self.client.info().best_number.saturated_into(); + let genesis_block = self.client.hash(0).unwrap().unwrap(); + let nonce = 0; + let period = BlockHashCount::get() + .checked_next_power_of_two() + .map(|c| c / 2) + .unwrap_or(2) as u64; + let tip = 0; + let extra: SignedExtra = ( + RestrictFunctionality, + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(generic::Era::mortal(period, current_block)), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + registrar::LimitParathreadCommits::::new(), + parachains::ValidateDoubleVoteReports::::new(), + ); + let raw_payload = SignedPayload::from_raw( + function.clone(), + extra.clone(), + ( + (), + VERSION.spec_version, + VERSION.transaction_version, + genesis_block, + current_block_hash, + (), + (), + (), + (), + (), + ), + ); + let signature = raw_payload.using_encoded(|e| caller.sign(e)); + let extrinsic = polkadot_test_runtime::UncheckedExtrinsic::new_signed( + function.clone(), + polkadot_test_runtime::Address::Id(caller.public().into()), + polkadot_primitives::Signature::Sr25519(signature.clone()), + extra.clone(), + ); + + self.rpc_handlers.send_transaction(extrinsic.into()).await + } +} + +impl PolkadotTestNode +where + C: BlockchainEvents, +{ + /// Wait for `count` blocks to be imported in the node and then exit. This function will not return if no blocks + /// are ever created, thus you should restrict the maximum amount of time of the test execution. + pub fn wait_for_blocks(&self, count: usize) -> impl Future { + self.client.wait_for_blocks(count) + } +} diff --git a/node/test-service/tests/build-blocks.rs b/node/test-service/tests/build-blocks.rs new file mode 100644 index 000000000000..65771dda0525 --- /dev/null +++ b/node/test-service/tests/build-blocks.rs @@ -0,0 +1,78 @@ +// Copyright 2020 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 . + +use tokio::{time::delay_for as sleep, task::spawn}; +use futures::{future, pin_mut, select, FutureExt as _}; +use polkadot_test_service::*; +use service::TaskExecutor; +use sp_keyring::Sr25519Keyring; +use std::time::Duration; + +static INTEGRATION_TEST_ALLOWED_TIME: Option<&str> = option_env!("INTEGRATION_TEST_ALLOWED_TIME"); + +#[tokio::test] +async fn ensure_test_service_build_blocks() { + let task_executor: TaskExecutor = (move |fut, _| { + spawn(fut); + }) + .into(); + let mut alice = run_test_node( + task_executor.clone(), + Sr25519Keyring::Alice, + || {}, + Vec::new(), + ); + let mut bob = run_test_node( + task_executor.clone(), + Sr25519Keyring::Bob, + || {}, + vec![alice.addr.clone()], + ); + let t1 = sleep(Duration::from_secs( + INTEGRATION_TEST_ALLOWED_TIME + .and_then(|x| x.parse().ok()) + .unwrap_or(600), + )) + .fuse(); + let t2 = async { + { + let t1 = future::join(alice.wait_for_blocks(3), bob.wait_for_blocks(3)).fuse(); + let t2 = alice.task_manager.future().fuse(); + let t3 = bob.task_manager.future().fuse(); + + pin_mut!(t1, t2, t3); + + select! { + _ = t1 => {}, + _ = t2 => panic!("service Alice failed"), + _ = t3 => panic!("service Bob failed"), + } + } + + alice.task_manager.terminate(); + bob.task_manager.terminate(); + } + .fuse(); + + pin_mut!(t1, t2); + + select! { + _ = t1 => { + panic!("the test took too long, maybe no blocks have been produced"); + }, + _ = t2 => {}, + } +} diff --git a/node/test-service/tests/call-function.rs b/node/test-service/tests/call-function.rs new file mode 100644 index 000000000000..b7b191fdab96 --- /dev/null +++ b/node/test-service/tests/call-function.rs @@ -0,0 +1,73 @@ +// Copyright 2020 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 . + +use tokio::{time::delay_for as sleep, task::spawn}; +use futures::{pin_mut, select, FutureExt as _}; +use polkadot_test_service::*; +use sp_keyring::Sr25519Keyring::{Alice, Bob}; +use std::time::Duration; + +static INTEGRATION_TEST_ALLOWED_TIME: Option<&str> = option_env!("INTEGRATION_TEST_ALLOWED_TIME"); + +#[tokio::test] +async fn call_function_actually_work() { + let mut alice = run_test_node( + (move |fut, _| { + spawn(fut); + }) + .into(), + Alice, + || {}, + Vec::new(), + ); + let t1 = sleep(Duration::from_secs( + INTEGRATION_TEST_ALLOWED_TIME + .and_then(|x| x.parse().ok()) + .unwrap_or(600), + )) + .fuse(); + let t2 = async { + let function = polkadot_test_runtime::Call::Balances(pallet_balances::Call::transfer( + Default::default(), + 1, + )); + let output = alice.call_function(function, Bob).await.unwrap(); + + let res = output.result.expect("return value expected"); + let json = serde_json::from_str::(res.as_str()).expect("valid JSON"); + let object = json.as_object().expect("JSON is an object"); + assert!(object.contains_key("jsonrpc"), "key jsonrpc exists"); + let result = object.get("result"); + let result = result.expect("key result exists"); + assert_eq!( + result.as_str().map(|x| x.starts_with("0x")), + Some(true), + "result starts with 0x" + ); + + alice.task_manager.terminate(); + } + .fuse(); + + pin_mut!(t1, t2); + + select! { + _ = t1 => { + panic!("the test took too long, maybe no blocks have been produced"); + }, + _ = t2 => {}, + } +} diff --git a/runtime/test-runtime/Cargo.toml b/runtime/test-runtime/Cargo.toml index c4bf27750a34..ceac5dc13421 100644 --- a/runtime/test-runtime/Cargo.toml +++ b/runtime/test-runtime/Cargo.toml @@ -14,9 +14,11 @@ serde = { version = "1.0.102", default-features = false } serde_derive = { version = "1.0.102", optional = true } smallvec = "1.4.1" +authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } rstd = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -27,6 +29,7 @@ version = { package = "sp-version", git = "https://github.com/paritytech/substra tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +authority-discovery = { package = "pallet-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } authorship = { package = "pallet-authorship", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } babe = { package = "pallet-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } balances = { package = "pallet-balances", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -46,6 +49,7 @@ pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", system = { package = "frame-system", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } system_rpc_runtime_api = { package = "frame-system-rpc-runtime-api", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sudo = { package = "pallet-sudo", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } vesting = { package = "pallet-vesting", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false } @@ -68,6 +72,8 @@ default = ["std"] no_std = [] only-staking = [] std = [ + "authority-discovery-primitives/std", + "authority-discovery/std", "bitvec/std", "primitives/std", "rustc-hex/std", @@ -78,6 +84,7 @@ std = [ "sp-api/std", "tx-pool-api/std", "block-builder-api/std", + "offchain-primitives/std", "rstd/std", "sp-io/std", "frame-support/std", diff --git a/runtime/test-runtime/client/Cargo.toml b/runtime/test-runtime/client/Cargo.toml index a9439e060968..7dbb7d5ec5a0 100644 --- a/runtime/test-runtime/client/Cargo.toml +++ b/runtime/test-runtime/client/Cargo.toml @@ -6,19 +6,24 @@ edition = "2018" license = "GPL-3.0" [dependencies] +futures = "0.3.1" +codec = { package = "parity-scale-codec", version = "1.0.0" } + +# Polkadot dependencies +polkadot-primitives = { path = "../../../primitives" } +polkadot-runtime-common = { path = "../../common" } +polkadot-test-runtime = { path = ".." } +polkadot-test-service = { path = "../../../node/test-service" } + +# Substrate dependencies +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-light = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["test-helpers"], default-features = false } -substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -polkadot-test-runtime = { path = ".." } -polkadot-runtime-common = { path = "../../common" } -polkadot-primitives = { path = "../../../primitives" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } -codec = { package = "parity-scale-codec", version = "1.0.0" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" } -futures = "0.3.1" +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/runtime/test-runtime/client/src/lib.rs b/runtime/test-runtime/client/src/lib.rs index 2e026647195f..2554f4f1c824 100644 --- a/runtime/test-runtime/client/src/lib.rs +++ b/runtime/test-runtime/client/src/lib.rs @@ -20,13 +20,18 @@ use std::sync::Arc; use std::collections::BTreeMap; +use std::convert::TryFrom; pub use substrate_test_client::*; pub use polkadot_test_runtime as runtime; -use sp_core::{sr25519, ChangesTrieConfiguration, map, twox_128}; +use sp_core::{ChangesTrieConfiguration, map, twox_128}; use sp_core::storage::{ChildInfo, Storage, StorageChild}; -use polkadot_test_runtime::genesismap::GenesisConfig; -use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, HashFor}; +use polkadot_test_runtime::GenesisConfig; +use polkadot_test_service::polkadot_local_testnet_genesis; +use sp_runtime::{ + traits::{Block as BlockT, Header as HeaderT, Hash as HashT, HashFor}, + BuildStorage, +}; use sc_consensus::LongestChain; use sc_client_api::light::{RemoteCallRequest, RemoteBodyRequest}; use sc_service::client::{ @@ -89,16 +94,10 @@ pub struct GenesisParameters { impl GenesisParameters { fn genesis_config(&self) -> GenesisConfig { - GenesisConfig::new( - self.changes_trie_config.clone(), - vec![ - sr25519::Public::from(Sr25519Keyring::Alice).into(), - sr25519::Public::from(Sr25519Keyring::Bob).into(), - sr25519::Public::from(Sr25519Keyring::Charlie).into(), - ], - 1000, - self.extra_storage.clone(), - ) + let config = polkadot_local_testnet_genesis(self.changes_trie_config.clone()); + config.assimilate_storage(&mut self.extra_storage.clone()).expect("Adding `system::GensisConfig` to the genesis"); + + config } } @@ -112,7 +111,7 @@ impl substrate_test_client::GenesisInit for GenesisParameters { fn genesis_storage(&self) -> Storage { use codec::Encode; - let mut storage = self.genesis_config().genesis_map(); + let mut storage = self.genesis_config().build_storage().unwrap(); let child_roots = storage.children_default.iter().map(|(sk, child_content)| { let state_root = <<::Header as HeaderT>::Hashing as HashT>::trie_root( @@ -323,20 +322,28 @@ pub fn new_native_executor() -> sc_executor::NativeExecutor { } /// Extrinsics that must be included in each block. -pub fn needed_extrinsics(heads: Vec) -> Vec { +/// +/// The index of the block must be provided to calculate a valid timestamp for the block. The value starts at 0 and +/// should be incremented by one for every block produced. +pub fn needed_extrinsics( + heads: Vec, + i: u64, +) -> Vec { use polkadot_runtime_common::parachains; + let timestamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) + .expect("now always later than unix epoch; qed") + .as_millis() + (i * polkadot_test_runtime::constants::time::SLOT_DURATION / 2) as u128; + vec![ polkadot_test_runtime::UncheckedExtrinsic { function: polkadot_test_runtime::Call::Parachains(parachains::Call::set_heads(heads)), signature: None, }, polkadot_test_runtime::UncheckedExtrinsic { - function: polkadot_test_runtime::Call::Timestamp(pallet_timestamp::Call::set({ - std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) - .expect("now always later than unix epoch; qed") - .as_millis() as u64 - })), + function: polkadot_test_runtime::Call::Timestamp(pallet_timestamp::Call::set( + u64::try_from(timestamp).expect("unexpected big timestamp"), + )), signature: None, } ] diff --git a/runtime/test-runtime/src/genesismap.rs b/runtime/test-runtime/src/genesismap.rs deleted file mode 100644 index f3ae9693d149..000000000000 --- a/runtime/test-runtime/src/genesismap.rs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2020 Parity Technologies (UK) Ltd. -// This file is part of Substrate. - -// Substrate is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Substrate is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Substrate. If not, see . - -//! Tool for creating the genesis block. - -use std::collections::BTreeMap; -use super::{AccountId, WASM_BINARY, constants::currency}; -use sp_core::ChangesTrieConfiguration; -use sp_core::storage::Storage; -use sp_runtime::BuildStorage; - -/// Configuration of a general Substrate test genesis block. -pub struct GenesisConfig { - changes_trie_config: Option, - balances: Vec<(AccountId, u128)>, - /// Additional storage key pairs that will be added to the genesis map. - extra_storage: Storage, -} - -impl GenesisConfig { - pub fn new( - changes_trie_config: Option, - endowed_accounts: Vec, - balance: u128, - extra_storage: Storage, - ) -> Self { - GenesisConfig { - changes_trie_config, - balances: endowed_accounts.into_iter().map(|a| (a, balance * currency::DOLLARS)).collect(), - extra_storage, - } - } - - pub fn genesis_map(&self) -> Storage { - // Assimilate the system genesis config. - let mut storage = Storage { - top: BTreeMap::new(), - children_default: self.extra_storage.children_default.clone(), - }; - let config = crate::GenesisConfig { - system: Some(system::GenesisConfig { - changes_trie_config: self.changes_trie_config.clone(), - code: WASM_BINARY.to_vec(), - }), - babe: None, - indices: None, - balances: Some(balances::GenesisConfig { - balances: self.balances.clone() - }), - staking: None, - session: None, - grandpa: None, - claims: None, - parachains: None, - registrar: None, - vesting: None, - }; - config.assimilate_storage(&mut storage).expect("Adding `system::GensisConfig` to the genesis"); - - storage - } -} diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index 31b17002fe6f..57ceffa4a96f 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -55,6 +55,7 @@ use frame_support::{ traits::{KeyOwnerProofSystem, Randomness}, weights::Weight, }; +use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; use session::historical as session_historical; @@ -69,8 +70,6 @@ pub use parachains::Call as ParachainsCall; /// Constant values used within the runtime. pub mod constants; -#[cfg(feature = "std")] -pub mod genesismap; use constants::{time::*, currency::*, fee::*}; // Make the WASM binary available. @@ -166,8 +165,8 @@ impl system::offchain::SendTransactionTypes for Runtime where } parameter_types! { - pub const EpochDuration: u64 = EPOCH_DURATION_IN_BLOCKS as u64; - pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; + pub storage EpochDuration: u64 = EPOCH_DURATION_IN_BLOCKS as u64; + pub storage ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; } impl babe::Trait for Runtime { @@ -193,7 +192,7 @@ impl babe::Trait for Runtime { } parameter_types! { - pub const IndexDeposit: Balance = 1 * DOLLARS; + pub storage IndexDeposit: Balance = 1 * DOLLARS; } impl indices::Trait for Runtime { @@ -205,7 +204,7 @@ impl indices::Trait for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * CENTS; + pub storage ExistentialDeposit: Balance = 1 * CENTS; } impl balances::Trait for Runtime { @@ -218,7 +217,7 @@ impl balances::Trait for Runtime { } parameter_types! { - pub const TransactionByteFee: Balance = 10 * MILLICENTS; + pub storage TransactionByteFee: Balance = 10 * MILLICENTS; } impl transaction_payment::Trait for Runtime { @@ -230,7 +229,8 @@ impl transaction_payment::Trait for Runtime { } parameter_types! { - pub const MinimumPeriod: u64 = 0; + pub storage SlotDuration: u64 = SLOT_DURATION; + pub storage MinimumPeriod: u64 = SlotDuration::get() / 2; } impl timestamp::Trait for Runtime { type Moment = u64; @@ -240,7 +240,7 @@ impl timestamp::Trait for Runtime { } parameter_types! { - pub const UncleGenerations: u32 = 0; + pub storage UncleGenerations: u32 = 0; } // TODO: substrate#2986 implement this properly @@ -252,8 +252,8 @@ impl authorship::Trait for Runtime { } parameter_types! { - pub const Period: BlockNumber = 10 * MINUTES; - pub const Offset: BlockNumber = 0; + pub storage Period: BlockNumber = 10 * MINUTES; + pub storage Offset: BlockNumber = 0; } impl_opaque_keys! { @@ -265,7 +265,7 @@ impl_opaque_keys! { } parameter_types! { - pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); + pub storage DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); } impl session::Trait for Runtime { @@ -299,16 +299,16 @@ pallet_staking_reward_curve::build! { parameter_types! { // Six sessions in an era (6 hours). - pub const SessionsPerEra: SessionIndex = 6; + pub storage SessionsPerEra: SessionIndex = 6; // 28 eras for unbonding (7 days). - pub const BondingDuration: staking::EraIndex = 28; + pub storage BondingDuration: staking::EraIndex = 28; // 28 eras in which slashes can be cancelled (7 days). - pub const SlashDeferDuration: staking::EraIndex = 28; + pub storage SlashDeferDuration: staking::EraIndex = 28; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; - pub const MaxNominatorRewardedPerValidator: u32 = 64; - pub const ElectionLookahead: BlockNumber = 0; - pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2; - pub const MaxIterations: u32 = 10; + pub storage MaxNominatorRewardedPerValidator: u32 = 64; + pub storage ElectionLookahead: BlockNumber = 0; + pub storage StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2; + pub storage MaxIterations: u32 = 10; pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); } @@ -366,12 +366,12 @@ impl attestations::Trait for Runtime { } parameter_types! { - pub const MaxCodeSize: u32 = 10 * 1024 * 1024; // 10 MB - pub const MaxHeadDataSize: u32 = 20 * 1024; // 20 KB + pub storage MaxCodeSize: u32 = 10 * 1024 * 1024; // 10 MB + pub storage MaxHeadDataSize: u32 = 20 * 1024; // 20 KB - pub const ValidationUpgradeFrequency: BlockNumber = 2; - pub const ValidationUpgradeDelay: BlockNumber = 1; - pub const SlashPeriod: BlockNumber = 1 * MINUTES; + pub storage ValidationUpgradeFrequency: BlockNumber = 2; + pub storage ValidationUpgradeDelay: BlockNumber = 1; + pub storage SlashPeriod: BlockNumber = 1 * MINUTES; } impl parachains::Trait for Runtime { @@ -447,7 +447,7 @@ impl system::offchain::SigningTypes for Runtime { } parameter_types! { - pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); + pub storage OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); } impl offences::Trait for Runtime { @@ -458,10 +458,12 @@ impl offences::Trait for Runtime { type WeightInfo = (); } +impl authority_discovery::Trait for Runtime {} + parameter_types! { - pub const ParathreadDeposit: Balance = 5 * DOLLARS; + pub storage ParathreadDeposit: Balance = 5 * DOLLARS; pub const QueueSize: usize = 2; - pub const MaxRetries: u32 = 3; + pub storage MaxRetries: u32 = 3; } impl registrar::Trait for Runtime { @@ -475,8 +477,8 @@ impl registrar::Trait for Runtime { } parameter_types! { - pub const LeasePeriod: BlockNumber = 100_000; - pub const EndingPeriod: BlockNumber = 1000; + pub storage LeasePeriod: BlockNumber = 100_000; + pub storage EndingPeriod: BlockNumber = 1000; } impl slots::Trait for Runtime { @@ -500,7 +502,7 @@ impl claims::Trait for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 100 * DOLLARS; + pub storage MinVestedTransfer: Balance = 100 * DOLLARS; } impl vesting::Trait for Runtime { @@ -511,6 +513,11 @@ impl vesting::Trait for Runtime { type WeightInfo = (); } +impl sudo::Trait for Runtime { + type Event = Event; + type Call = Call; +} + construct_runtime! { pub enum Runtime where Block = Block, @@ -536,6 +543,7 @@ construct_runtime! { Historical: session_historical::{Module}, Session: session::{Module, Call, Storage, Event, Config}, Grandpa: grandpa::{Module, Call, Storage, Config, Event}, + AuthorityDiscovery: authority_discovery::{Module, Call, Config}, // Claims. Usable initially. Claims: claims::{Module, Call, Storage, Event, Config, ValidateUnsigned}, @@ -549,6 +557,9 @@ construct_runtime! { // Vesting. Usable initially, but removed once all vesting is finished. Vesting: vesting::{Module, Call, Storage, Event, Config}, + + // Sudo. Last module. + Sudo: sudo::{Module, Call, Storage, Config, Event}, } } @@ -642,6 +653,18 @@ sp_api::impl_runtime_apis! { } } + impl offchain_primitives::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl authority_discovery_primitives::AuthorityDiscoveryApi for Runtime { + fn authorities() -> Vec { + Vec::new() + } + } + impl parachain::ParachainHost for Runtime { fn validators() -> Vec { Parachains::authorities() diff --git a/service/src/grandpa_support.rs b/service/src/grandpa_support.rs index a875c4b45a37..794b4e4fc180 100644 --- a/service/src/grandpa_support.rs +++ b/service/src/grandpa_support.rs @@ -23,7 +23,7 @@ use sp_runtime::traits::{Block as BlockT, NumberFor}; /// same last finalized block) after a given block at height `N` has been /// finalized and for a delay of `M` blocks, i.e. until the best block reaches /// `N` + `M`, the voter will keep voting for block `N`. -pub(crate) struct PauseAfterBlockFor(pub(crate) N, pub(crate) N); +pub struct PauseAfterBlockFor(pub N, pub N); impl grandpa::VotingRule for PauseAfterBlockFor> where Block: BlockT, @@ -250,17 +250,21 @@ mod tests { let mut push_blocks = { let mut client = client.clone(); + let mut base = 0; + move |n| { - for _ in 0..n { + for i in 0..n { let mut builder = client.new_block(Default::default()).unwrap(); - for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![]) { + for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![], base + i) { builder.push(extrinsic).unwrap() } let block = builder.build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); } + + base += n; } }; diff --git a/service/src/lib.rs b/service/src/lib.rs index 33d02f53154a..313791611b1c 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -17,7 +17,7 @@ //! Polkadot service. Specialized wrapper over substrate service. pub mod chain_spec; -mod grandpa_support; +pub mod grandpa_support; mod client; use std::sync::Arc; @@ -136,27 +136,20 @@ impl IdentifyVariant for Box { } } -// If we're using prometheus, use a registry with a prefix of `polkadot`. -fn set_prometheus_registry(config: &mut Configuration) -> Result<(), ServiceError> { - if let Some(PrometheusConfig { registry, .. }) = config.prometheus_config.as_mut() { - *registry = Registry::new_custom(Some("polkadot".into()), None)?; - } - - Ok(()) -} - /// Starts a `ServiceBuilder` for a full service. /// /// Use this macro if you don't actually need the full service, but just the builder in order to /// be able to perform chain operations. +#[macro_export] macro_rules! new_full_start { - ($config:expr, $runtime:ty, $executor:ty) => {{ - set_prometheus_registry(&mut $config)?; - - let mut import_setup = None; - let mut rpc_setup = None; - let inherent_data_providers = inherents::InherentDataProviders::new(); - let builder = service::ServiceBuilder::new_full::< + (prometheus_setup $config:expr) => {{ + // If we're using prometheus, use a registry with a prefix of `polkadot`. + if let Some(PrometheusConfig { registry, .. }) = $config.prometheus_config.as_mut() { + *registry = Registry::new_custom(Some("polkadot".into()), None)?; + } + }}; + (start_builder $config:expr, $runtime:ty, $executor:ty $(,)?) => {{ + service::ServiceBuilder::new_full::< Block, $runtime, $executor >($config)? .with_select_chain(|_, backend| { @@ -174,56 +167,58 @@ macro_rules! new_full_start { ); Ok(pool) })? - .with_import_queue(| - config, - client, - mut select_chain, - _, - spawn_task_handle, - registry, - | { - let select_chain = select_chain.take() - .ok_or_else(|| service::Error::SelectChainRequired)?; - - let grandpa_hard_forks = if config.chain_spec.is_kusama() { - grandpa_support::kusama_hard_forks() - } else { - Vec::new() - }; + }}; + (import_queue_setup + $builder:expr, $inherent_data_providers:expr, $import_setup:expr, $grandpa_hard_forks:expr, $(,)? + ) => {{ + $builder.with_import_queue(| + _config, + client, + mut select_chain, + _, + spawn_task_handle, + registry, + | { + let select_chain = select_chain.take() + .ok_or_else(|| service::Error::SelectChainRequired)?; + + let (grandpa_block_import, grandpa_link) = + grandpa::block_import_with_authority_set_hard_forks( + client.clone(), + &(client.clone() as Arc<_>), + select_chain.clone(), + $grandpa_hard_forks, + )?; - let (grandpa_block_import, grandpa_link) = - grandpa::block_import_with_authority_set_hard_forks( - client.clone(), - &(client.clone() as Arc<_>), - select_chain.clone(), - grandpa_hard_forks, - )?; + let justification_import = grandpa_block_import.clone(); - let justification_import = grandpa_block_import.clone(); + let (block_import, babe_link) = babe::block_import( + babe::Config::get_or_compute(&*client)?, + grandpa_block_import, + client.clone(), + )?; - let (block_import, babe_link) = babe::block_import( - babe::Config::get_or_compute(&*client)?, - grandpa_block_import, - client.clone(), - )?; + let import_queue = babe::import_queue( + babe_link.clone(), + block_import.clone(), + Some(Box::new(justification_import)), + None, + client, + select_chain, + $inherent_data_providers.clone(), + spawn_task_handle, + registry, + )?; - let import_queue = babe::import_queue( - babe_link.clone(), - block_import.clone(), - Some(Box::new(justification_import)), - None, - client, - select_chain, - inherent_data_providers.clone(), - spawn_task_handle, - registry, - )?; + $import_setup = Some((block_import, grandpa_link, babe_link)); + Ok(import_queue) + })? + }}; + (finish_builder_setup $builder:expr, $inherent_data_providers:expr, $import_setup:expr) => {{ + let mut rpc_setup = None; - import_setup = Some((block_import, grandpa_link, babe_link)); - Ok(import_queue) - })? - .with_rpc_extensions_builder(|builder| { - let grandpa_link = import_setup.as_ref().map(|s| &s.1) + let builder = $builder.with_rpc_extensions_builder(|builder| { + let grandpa_link = $import_setup.as_ref().map(|s| &s.1) .expect("GRANDPA LinkHalf is present for full services or set up failed; qed."); let shared_authority_set = grandpa_link.shared_authority_set().clone(); @@ -231,7 +226,7 @@ macro_rules! new_full_start { rpc_setup = Some((shared_voter_state.clone())); - let babe_link = import_setup.as_ref().map(|s| &s.2) + let babe_link = $import_setup.as_ref().map(|s| &s.2) .expect("BabeLink is present for full services or set up faile; qed."); let babe_config = babe_link.config().clone(); @@ -264,22 +259,47 @@ macro_rules! new_full_start { }) })?; - (builder, import_setup, inherent_data_providers, rpc_setup) - }} + (builder, $import_setup, $inherent_data_providers, rpc_setup) + }}; + ($config:expr, $runtime:ty, $executor:ty $(,)?) => {{ + let inherent_data_providers = inherents::InherentDataProviders::new(); + let mut import_setup = None; + new_full_start!(prometheus_setup $config); + let grandpa_hard_forks = if $config.chain_spec.is_kusama() { + $crate::grandpa_support::kusama_hard_forks() + } else { + Vec::new() + }; + let builder = new_full_start!(start_builder $config, $runtime, $executor); + let builder = new_full_start!(import_queue_setup + builder, inherent_data_providers, import_setup, grandpa_hard_forks, + ); + new_full_start!(finish_builder_setup builder, inherent_data_providers, import_setup) + }}; + (test $config:expr, $runtime:ty, $executor:ty $(,)?) => {{ + let inherent_data_providers = inherents::InherentDataProviders::new(); + let mut import_setup = None; + let grandpa_hard_forks = Vec::new(); + let builder = new_full_start!(start_builder $config, $runtime, $executor); + let builder = new_full_start!(import_queue_setup + builder, inherent_data_providers, import_setup, grandpa_hard_forks, + ); + new_full_start!(finish_builder_setup builder, inherent_data_providers, import_setup) + }}; } /// Builds a new service for a full client. #[macro_export] macro_rules! new_full { ( + with_full_start $config:expr, $collating_for:expr, $max_block_data_size:expr, $authority_discovery_enabled:expr, $slot_duration:expr, $grandpa_pause:expr, - $runtime:ty, - $dispatch:ty, + $new_full_start:expr $(,)? ) => {{ use sc_network::Event; use sc_client_api::ExecutorProvider; @@ -290,22 +310,21 @@ macro_rules! new_full { let role = $config.role.clone(); let is_authority = role.is_authority() && !is_collator; let force_authoring = $config.force_authoring; - let max_block_data_size = $max_block_data_size; let db_path = match $config.database.path() { Some(path) => std::path::PathBuf::from(path), None => return Err("Starting a Polkadot service with a custom database isn't supported".to_string().into()), }; + let max_block_data_size = $max_block_data_size; let disable_grandpa = $config.disable_grandpa; let name = $config.network.node_name.clone(); let authority_discovery_enabled = $authority_discovery_enabled; let slot_duration = $slot_duration; - let (builder, mut import_setup, inherent_data_providers, mut rpc_setup) = - new_full_start!($config, $runtime, $dispatch); + let (builder, mut import_setup, inherent_data_providers, mut rpc_setup) = $new_full_start; let ServiceComponents { client, network, select_chain, keystore, transaction_pool, prometheus_registry, - task_manager, telemetry_on_connect_sinks, .. + task_manager, telemetry_on_connect_sinks, rpc_handlers, .. } = builder .with_finality_proof_provider(|client, backend| { let provider = client as Arc>; @@ -510,7 +529,7 @@ macro_rules! new_full { ); grandpa::VotingRulesBuilder::default() - .add(grandpa_support::PauseAfterBlockFor(block, delay)) + .add($crate::grandpa_support::PauseAfterBlockFor(block, delay)) .build() }, None => @@ -542,15 +561,58 @@ macro_rules! new_full { } handles.polkadot_network = Some(polkadot_network_service); - (task_manager, client, handles) - }} + (task_manager, client, handles, network, rpc_handlers) + }}; + ( + $config:expr, + $collating_for:expr, + $max_block_data_size:expr, + $authority_discovery_enabled:expr, + $slot_duration:expr, + $grandpa_pause:expr, + $runtime:ty, + $dispatch:ty, + ) => {{ + new_full!(with_full_start + $config, + $collating_for, + $max_block_data_size, + $authority_discovery_enabled, + $slot_duration, + $grandpa_pause, + new_full_start!($config, $runtime, $dispatch), + ) + }}; + ( + test + $config:expr, + $collating_for:expr, + $max_block_data_size:expr, + $authority_discovery_enabled:expr, + $slot_duration:expr, + $runtime:ty, + $dispatch:ty, + ) => {{ + new_full!(with_full_start + $config, + $collating_for, + $max_block_data_size, + $authority_discovery_enabled, + $slot_duration, + None, + new_full_start!(test $config, $runtime, $dispatch), + ) + }}; } /// Builds a new service for a light client. #[macro_export] macro_rules! new_light { ($config:expr, $runtime:ty, $dispatch:ty) => {{ - crate::set_prometheus_registry(&mut $config)?; + // If we're using prometheus, use a registry with a prefix of `polkadot`. + if let Some(PrometheusConfig { registry, .. }) = $config.prometheus_config.as_mut() { + *registry = Registry::new_custom(Some("polkadot".into()), None)?; + } let inherent_data_providers = inherents::InherentDataProviders::new(); ServiceBuilder::new_light::($config)? @@ -646,7 +708,7 @@ macro_rules! new_light { /// Builds a new object suitable for chain operations. pub fn new_chain_ops(mut config: Configuration) -> Result< ( - Arc>, + Arc>, Arc>, consensus_common::import_queue::BasicQueue>, TaskManager, @@ -685,7 +747,7 @@ pub fn polkadot_new_full( FullNodeHandles, ), ServiceError> { - let (service, client, handles) = new_full!( + let (service, client, handles, _, _) = new_full!( config, collating_for, max_block_data_size, @@ -719,7 +781,7 @@ pub fn kusama_new_full( FullNodeHandles ), ServiceError> { - let (service, client, handles) = new_full!( + let (service, client, handles, _, _) = new_full!( config, collating_for, max_block_data_size, @@ -753,7 +815,7 @@ pub fn westend_new_full( FullNodeHandles, ), ServiceError> { - let (service, client, handles) = new_full!( + let (service, client, handles, _, _) = new_full!( config, collating_for, max_block_data_size, From da2376768a65fe51d749b94b6bb0000a5c9b2e82 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 9 Jul 2020 09:43:26 -0400 Subject: [PATCH 2/9] Delay session changes' effects on parachains by 1 block (#1354) * note that the initializer is responsible for buffering session changes * amend initializer definition to include session change buffering * support buffered changes before `on_initialize` * implement and test session buffering * Update roadmap/implementors-guide/src/runtime/README.md Co-authored-by: Bernhard Schuster * expand on how this affects misbehavior reports * fix typo Co-authored-by: Bernhard Schuster --- .../implementers-guide/src/runtime/README.md | 13 +- .../src/runtime/initializer.md | 16 ++- runtime/parachains/src/initializer.rs | 114 ++++++++++++++---- 3 files changed, 106 insertions(+), 37 deletions(-) diff --git a/roadmap/implementers-guide/src/runtime/README.md b/roadmap/implementers-guide/src/runtime/README.md index 2a806d4c2dbc..5279752e911c 100644 --- a/roadmap/implementers-guide/src/runtime/README.md +++ b/roadmap/implementers-guide/src/runtime/README.md @@ -23,17 +23,13 @@ We will split the logic of the runtime up into these modules: The [Initializer module](initializer.md) is special - it's responsible for handling the initialization logic of the other modules to ensure that the correct initialization order and related invariants are maintained. The other modules won't specify a on-initialize logic, but will instead expose a special semi-private routine that the initialization module will call. The other modules are relatively straightforward and perform the roles described above. -The Parachain Host operates under a changing set of validators. Time is split up into periodic sessions, where each session brings a potentially new set of validators. Sessions are buffered by one, meaning that the validators of the upcoming session are fixed and always known. Parachain Host runtime modules need to react to changes in the validator set, as it will affect the runtime logic for processing candidate backing, availability bitfields, and misbehavior reports. The Parachain Host modules can't determine ahead-of-time exactly when session change notifications are going to happen within the block (note: this depends on module initialization order again - better to put session before parachains modules). Ideally, session changes are always handled before initialization. It is clearly a problem if we compute validator assignments to parachains during initialization and then the set of validators changes. In the best case, we can recognize that re-initialization needs to be done. In the worst case, bugs would occur. +The Parachain Host operates under a changing set of validators. Time is split up into periodic sessions, where each session brings a potentially new set of validators. Sessions are buffered by one, meaning that the validators of the upcoming session `n+1` are determined at the end of session `n-1`, right before session `n` starts. Parachain Host runtime modules need to react to changes in the validator set, as it will affect the runtime logic for processing candidate backing, availability bitfields, and misbehavior reports. The Parachain Host modules can't determine ahead-of-time exactly when session change notifications are going to happen within the block (note: this depends on module initialization order again - better to put session before parachains modules). -There are 3 main ways that we can handle this issue: +The relay chain is intended to use BABE or SASSAFRAS, which both have the property that a session changing at a block is determined not by the number of the block but instead by the time the block is authored. In some sense, sessions change in-between blocks, not at blocks. This has the side effect that the session of a child block cannot be determined solely by the parent block's identifier. Being able to unilaterally determine the validator-set at a specific block based on its parent hash would make a lot of Node-side logic much simpler. -1. Establish an invariant that session change notifications always happen after initialization. This means that when we receive a session change notification before initialization, we call the initialization routines before handling the session change. -1. Require that session change notifications always occur before initialization. Brick the chain if session change notifications ever happen after initialization. -1. Handle both the before and after cases. +In order to regain the property that the validator set of a block is predictable by its parent block, we delay session changes' application to Parachains by 1 block. This means that if there is a session change at block X, that session change will be stored and applied during initialization of direct descendents of X. This principal side effect of this change is that the Parachains runtime can disagree with session or consensus modules about which session it currently is. Misbehavior reporting routines in particular will be affected by this, although not severely. The parachains runtime might believe it is the last block of the session while the system is really in the first block of the next session. In such cases, a historical validator-set membership proof will need to accompany any misbehavior report, although they typically do not need to during current-session misbehavior reports. -Although option 3 is the most comprehensive, it runs counter to our goal of simplicity. Option 1 means requiring the runtime to do redundant work at all sessions and will also mean, like option 3, that designing things in such a way that initialization can be rolled back and reapplied under the new environment. That leaves option 2, although it is a "nuclear" option in a way and requires us to constrain the parachain host to only run in full runtimes with a certain order of operations. - -So the other role of the initializer module is to forward session change notifications to modules in the initialization order, throwing an unrecoverable error if the notification is received after initialization. Session change is the point at which the [Configuration Module](configuration.md) updates the configuration. Most of the other modules will handle changes in the configuration during their session change operation, so the initializer should provide both the old and new configuration to all the other +So the other role of the initializer module is to forward session change notifications to modules in the initialization order. Session change is also the point at which the [Configuration Module](configuration.md) updates the configuration. Most of the other modules will handle changes in the configuration during their session change operation, so the initializer should provide both the old and new configuration to all the other modules alongside the session change notification. This means that a session change notification should consist of the following data: ```rust @@ -53,5 +49,4 @@ struct SessionChangeNotification { } ``` -> REVIEW: other options? arguments in favor of going for options 1 or 3 instead of 2. we could do a "soft" version of 2 where we note that the chain is potentially broken due to bad initialization order > TODO Diagram: order of runtime operations (initialization, session change) diff --git a/roadmap/implementers-guide/src/runtime/initializer.md b/roadmap/implementers-guide/src/runtime/initializer.md index aba4d5f352ab..5fd2bc3bd60f 100644 --- a/roadmap/implementers-guide/src/runtime/initializer.md +++ b/roadmap/implementers-guide/src/runtime/initializer.md @@ -1,16 +1,23 @@ # Initializer Module -This module is responsible for initializing the other modules in a deterministic order. It also has one other purpose as described above: accepting and forwarding session change notifications. +This module is responsible for initializing the other modules in a deterministic order. It also has one other purpose as described in the overview of the runtime: accepting and forwarding session change notifications. ## Storage ```rust -HasInitialized: bool +HasInitialized: bool; +// buffered session changes along with the block number at which they should be applied. +// +// typically this will be empty or one element long. ordered ascending by BlockNumber and insertion +// order. +BufferedSessionChanges: Vec<(BlockNumber, ValidatorSet, ValidatorSet)>; ``` ## Initialization -The other modules are initialized in this order: +Before initializing modules, remove all changes from the `BufferedSessionChanges` with number less than or equal to the current block number, and apply the last one. The session change is applied to all modules in the same order as initialization. + +The other parachains modules are initialized in this order: 1. Configuration 1. Paras @@ -25,8 +32,7 @@ Set `HasInitialized` to true. ## Session Change -If `HasInitialized` is true, throw an unrecoverable error (panic). -Otherwise, forward the session change notification to other modules in initialization order. +Store the session change information in `BufferedSessionChange` along with the block number at which it was submitted, plus one. Although the expected operational parameters of the block authorship system should prevent more than one change from being buffered at any time, it may occur. Regardless, we always need to track the block number at which the session change can be applied so as to remain flexible over session change notifications being issued before or after initialization of the current block. ## Finalization diff --git a/runtime/parachains/src/initializer.rs b/runtime/parachains/src/initializer.rs index 0f7f4b74eccf..9c0cda29697a 100644 --- a/runtime/parachains/src/initializer.rs +++ b/runtime/parachains/src/initializer.rs @@ -27,6 +27,8 @@ use primitives::{ use frame_support::{ decl_storage, decl_module, decl_error, traits::Randomness, }; +use sp_runtime::traits::One; +use codec::{Encode, Decode}; use crate::{configuration::{self, HostConfiguration}, paras, scheduler, inclusion}; /// Information about a session change that has just occurred. @@ -46,6 +48,14 @@ pub struct SessionChangeNotification { pub session_index: sp_staking::SessionIndex, } +#[derive(Encode, Decode)] +struct BufferedSessionChange { + apply_at: N, + validators: Vec, + queued: Vec, + session_index: sp_staking::SessionIndex, +} + pub trait Trait: system::Trait + configuration::Trait + paras::Trait + scheduler::Trait + inclusion::Trait { @@ -64,6 +74,14 @@ decl_storage! { /// them writes to the trie and one does not. This confusion makes `Option<()>` more suitable for /// the semantics of this variable. HasInitialized: Option<()>; + /// Buffered session changes along with the block number at which they should be applied. + /// + /// Typically this will be empty or one element long, with the single element having a block + /// number of the next block. + /// + /// However this is a `Vec` regardless to handle various edge cases that may occur at runtime + /// upgrade boundaries or if governance intervenes. + BufferedSessionChanges: Vec>; } } @@ -77,6 +95,21 @@ decl_module! { type Error = Error; fn on_initialize(now: T::BlockNumber) -> Weight { + // Apply buffered session changes before initializing modules, so they + // can be initialized with respect to the current validator set. + >::mutate(|v| { + let drain_up_to = v.iter().take_while(|b| b.apply_at <= now).count(); + + // apply only the last session as all others lasted less than a block (weirdly). + if let Some(buffered) = v.drain(..drain_up_to).last() { + Self::apply_new_session( + buffered.session_index, + buffered.validators, + buffered.queued, + ); + } + }); + // The other modules are initialized in this order: // - Configuration // - Paras @@ -106,27 +139,11 @@ decl_module! { } impl Module { - /// Should be called when a new session occurs. Forwards the session notification to all - /// wrapped modules. If `queued` is `None`, the `validators` are considered queued. - /// - /// Panics if the modules have already been initialized. - fn on_new_session<'a, I: 'a>( - _changed: bool, + fn apply_new_session( session_index: sp_staking::SessionIndex, - validators: I, - queued: Option, - ) - where I: Iterator - { - assert!(HasInitialized::get().is_none()); - - let validators: Vec<_> = validators.map(|(_, v)| v).collect(); - let queued: Vec<_> = if let Some(queued) = queued { - queued.map(|(_, v)| v).collect() - } else { - validators.clone() - }; - + validators: Vec, + queued: Vec, + ) { let prev_config = >::config(); let random_seed = { @@ -156,6 +173,31 @@ impl Module { scheduler::Module::::initializer_on_new_session(¬ification); inclusion::Module::::initializer_on_new_session(¬ification); } + + /// Should be called when a new session occurs. Buffers the session notification to be applied + /// at the next block. If `queued` is `None`, the `validators` are considered queued. + fn on_new_session<'a, I: 'a>( + _changed: bool, + session_index: sp_staking::SessionIndex, + validators: I, + queued: Option, + ) + where I: Iterator + { + let validators: Vec<_> = validators.map(|(_, v)| v).collect(); + let queued: Vec<_> = if let Some(queued) = queued { + queued.map(|(_, v)| v).collect() + } else { + validators.clone() + }; + + >::mutate(|v| v.push(BufferedSessionChange { + apply_at: >::block_number() + One::one(), + validators, + queued, + session_index, + })); + } } impl sp_runtime::BoundToRuntimeAppPublic for Module { @@ -184,21 +226,47 @@ impl session::OneSessionHandler for Mod #[cfg(test)] mod tests { use super::*; - use crate::mock::{new_test_ext, Initializer}; + use crate::mock::{new_test_ext, Initializer, Test, System}; use frame_support::traits::{OnFinalize, OnInitialize}; #[test] - #[should_panic] - fn panics_if_session_changes_after_on_initialize() { + fn session_change_before_initialize_is_still_buffered_after() { + new_test_ext(Default::default()).execute_with(|| { + Initializer::on_new_session( + false, + 1, + Vec::new().into_iter(), + Some(Vec::new().into_iter()), + ); + + let now = System::block_number(); + Initializer::on_initialize(now); + + let v = >::get(); + assert_eq!(v.len(), 1); + + let apply_at = now + 1; + assert_eq!(v[0].apply_at, apply_at); + }); + } + + #[test] + fn session_change_applied_on_initialize() { new_test_ext(Default::default()).execute_with(|| { Initializer::on_initialize(1); + + let now = System::block_number(); Initializer::on_new_session( false, 1, Vec::new().into_iter(), Some(Vec::new().into_iter()), ); + + Initializer::on_initialize(now + 1); + + assert!(>::get().is_empty()); }); } From 8347bf8ee4174cdef85dcf1a6967c5c910b00c51 Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 9 Jul 2020 16:59:58 +0200 Subject: [PATCH 3/9] Companion PR for ' Simplify a few chain components creation APIs related to the service' (#1384) * Switch branch * Fix service creation * Revert "Switch branch" This reverts commit a706335821eb1553e48f86e0b0c5b3c11d589a1d. * Switch branch again * Revert "Switch branch again" This reverts commit 04afc5095e408ff9a116c526ef84f6b101482ee1. * Update substrate branch --- Cargo.lock | 276 ++++++++++++++++++++-------------------- node/service/src/lib.rs | 10 +- service/src/lib.rs | 10 +- 3 files changed, 151 insertions(+), 145 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 894eeab6f4c4..0c344600c204 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1285,7 +1285,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", ] @@ -1293,7 +1293,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -1310,7 +1310,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "Inflector", "frame-benchmarking", @@ -1329,7 +1329,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -1344,7 +1344,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "11.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "serde", @@ -1355,7 +1355,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "bitmask", "frame-metadata", @@ -1380,7 +1380,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.18", @@ -1391,7 +1391,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1403,7 +1403,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -1413,7 +1413,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1429,7 +1429,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-api", @@ -3409,7 +3409,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3425,7 +3425,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3440,7 +3440,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3465,7 +3465,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3479,7 +3479,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3495,7 +3495,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3510,7 +3510,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3525,7 +3525,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3541,7 +3541,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3561,7 +3561,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3577,7 +3577,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3597,7 +3597,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3613,7 +3613,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3627,7 +3627,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3642,7 +3642,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3656,7 +3656,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3671,7 +3671,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3692,7 +3692,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3707,7 +3707,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3720,7 +3720,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "enumflags2", "frame-support", @@ -3735,7 +3735,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3750,7 +3750,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3770,7 +3770,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3786,7 +3786,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3822,7 +3822,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -3833,7 +3833,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3847,7 +3847,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3865,7 +3865,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "frame-system", @@ -3880,7 +3880,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -3898,7 +3898,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-support", "parity-scale-codec", @@ -3911,7 +3911,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3926,7 +3926,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-benchmarking", "frame-support", @@ -3942,7 +3942,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5874,7 +5874,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "bytes 0.5.4", "derive_more 0.99.8", @@ -5901,7 +5901,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -5925,7 +5925,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5942,7 +5942,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5958,7 +5958,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -5969,7 +5969,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "ansi_term 0.12.1", "atty", @@ -6010,7 +6010,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "fnv", @@ -6046,7 +6046,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "blake2-rfc", "hash-db", @@ -6075,7 +6075,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6086,7 +6086,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "fork-tree", @@ -6128,7 +6128,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6152,7 +6152,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6165,7 +6165,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6188,7 +6188,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "log 0.4.8", "sc-client-api", @@ -6202,7 +6202,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "lazy_static", @@ -6230,7 +6230,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -6247,7 +6247,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6262,7 +6262,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "cranelift-codegen", "cranelift-wasm", @@ -6283,7 +6283,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "assert_matches", "derive_more 0.99.8", @@ -6321,7 +6321,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "finality-grandpa", @@ -6338,7 +6338,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", @@ -6356,7 +6356,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "hex", @@ -6372,7 +6372,7 @@ dependencies = [ [[package]] name = "sc-light" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "hash-db", "lazy_static", @@ -6391,7 +6391,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "bitflags", "bs58", @@ -6443,7 +6443,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6458,7 +6458,7 @@ dependencies = [ [[package]] name = "sc-network-test" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "env_logger", "futures 0.3.5", @@ -6485,7 +6485,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "bytes 0.5.4", "fnv", @@ -6512,7 +6512,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "libp2p", @@ -6525,7 +6525,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "log 0.4.8", "substrate-prometheus-endpoint", @@ -6534,7 +6534,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "hash-db", @@ -6566,7 +6566,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6590,7 +6590,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6606,7 +6606,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "directories", @@ -6669,7 +6669,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6683,7 +6683,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6704,7 +6704,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "erased-serde", "log 0.4.8", @@ -6721,7 +6721,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6741,7 +6741,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7148,7 +7148,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -7160,7 +7160,7 @@ dependencies = [ [[package]] name = "sp-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "hash-db", "parity-scale-codec", @@ -7175,7 +7175,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7187,7 +7187,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "serde", @@ -7199,7 +7199,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "integer-sqrt", "num-traits 0.2.12", @@ -7212,7 +7212,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-api", @@ -7224,7 +7224,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7235,7 +7235,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-api", @@ -7247,7 +7247,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -7256,6 +7256,7 @@ dependencies = [ "parking_lot 0.10.2", "sp-block-builder", "sp-consensus", + "sp-database", "sp-runtime", "sp-state-machine", ] @@ -7263,7 +7264,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "serde", "serde_json", @@ -7272,7 +7273,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7287,6 +7288,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", "sp-utils", "sp-version", "substrate-prometheus-endpoint", @@ -7296,7 +7298,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-api", @@ -7310,7 +7312,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "merlin", "parity-scale-codec", @@ -7329,7 +7331,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7338,7 +7340,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7350,7 +7352,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "base58", "blake2-rfc", @@ -7393,7 +7395,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7402,7 +7404,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -7412,7 +7414,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "environmental", "parity-scale-codec", @@ -7423,7 +7425,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "finality-grandpa", "log 0.4.8", @@ -7439,7 +7441,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7449,7 +7451,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "parity-scale-codec", @@ -7461,7 +7463,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "hash-db", @@ -7482,7 +7484,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "lazy_static", "sp-core", @@ -7493,7 +7495,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "serde", @@ -7505,7 +7507,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -7516,7 +7518,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "sp-api", "sp-core", @@ -7526,7 +7528,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "backtrace", "log 0.4.8", @@ -7535,7 +7537,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "serde", "sp-core", @@ -7544,7 +7546,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "either", "hash256-std-hasher", @@ -7566,7 +7568,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7581,7 +7583,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "Inflector", "proc-macro-crate", @@ -7593,7 +7595,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "serde", "serde_json", @@ -7602,7 +7604,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-api", @@ -7615,7 +7617,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7625,7 +7627,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "hash-db", "itertools 0.9.0", @@ -7646,12 +7648,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" [[package]] name = "sp-storage" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7663,7 +7665,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7677,7 +7679,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "log 0.4.8", "rental", @@ -7687,7 +7689,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7703,7 +7705,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "hash-db", "memory-db", @@ -7717,7 +7719,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "futures-core", @@ -7729,7 +7731,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7741,7 +7743,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7881,7 +7883,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "chrono", "clear_on_drop", @@ -7908,7 +7910,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "platforms", ] @@ -7916,7 +7918,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -7939,7 +7941,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "async-std", "derive_more 0.99.8", @@ -7953,7 +7955,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.1.29", "futures 0.3.5", @@ -7979,7 +7981,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "cfg-if", "frame-executive", @@ -8019,7 +8021,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" dependencies = [ "futures 0.3.5", "parity-scale-codec", @@ -8040,7 +8042,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" +source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" [[package]] name = "substrate-wasm-builder-runner" diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 23a6dbfd4192..772481672ad5 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -172,10 +172,12 @@ macro_rules! new_full_start { builder.client().clone(), builder.prometheus_registry(), ); - let pool = sc_transaction_pool::BasicPool::new( + let pool = sc_transaction_pool::BasicPool::new_full( builder.config().transaction_pool.clone(), std::sync::Arc::new(pool_api), builder.prometheus_registry(), + builder.spawn_handle(), + builder.client().clone(), ); Ok(pool) })? @@ -509,12 +511,12 @@ macro_rules! new_light { builder.client().clone(), fetcher, ); - let pool = sc_transaction_pool::BasicPool::with_revalidation_type( + let pool = Arc::new(sc_transaction_pool::BasicPool::new_light( builder.config().transaction_pool.clone(), Arc::new(pool_api), builder.prometheus_registry(), - sc_transaction_pool::RevalidationType::Light, - ); + builder.spawn_handle(), + )); Ok(pool) })? .with_import_queue_and_fprb(| diff --git a/service/src/lib.rs b/service/src/lib.rs index 313791611b1c..eaa5f9682f0c 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -160,10 +160,12 @@ macro_rules! new_full_start { builder.client().clone(), builder.prometheus_registry(), ); - let pool = sc_transaction_pool::BasicPool::new( + let pool = sc_transaction_pool::BasicPool::new_full( builder.config().transaction_pool.clone(), std::sync::Arc::new(pool_api), builder.prometheus_registry(), + builder.spawn_handle(), + builder.client().clone(), ); Ok(pool) })? @@ -626,12 +628,12 @@ macro_rules! new_light { builder.client().clone(), fetcher, ); - let pool = sc_transaction_pool::BasicPool::with_revalidation_type( + let pool = Arc::new(sc_transaction_pool::BasicPool::new_light( builder.config().transaction_pool.clone(), Arc::new(pool_api), builder.prometheus_registry(), - sc_transaction_pool::RevalidationType::Light, - ); + builder.spawn_handle(), + )); Ok(pool) })? .with_import_queue_and_fprb(| From 10928c7278dc375c1674d805dea26721f4305438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 9 Jul 2020 17:24:00 +0200 Subject: [PATCH 4/9] Companion for #6620 (#1386) * Companiong for #6620 https://github.com/paritytech/substrate/pull/6620 * 'Update substrate' Co-authored-by: parity-processbot <> --- Cargo.lock | 274 ++++++++++++++++++++++----------------------- cli/src/command.rs | 4 +- 2 files changed, 139 insertions(+), 139 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c344600c204..b749998cd31b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1285,7 +1285,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", ] @@ -1293,7 +1293,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -1310,7 +1310,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "Inflector", "frame-benchmarking", @@ -1329,7 +1329,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -1344,7 +1344,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "11.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "serde", @@ -1355,7 +1355,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "bitmask", "frame-metadata", @@ -1380,7 +1380,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.18", @@ -1391,7 +1391,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1403,7 +1403,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -1413,7 +1413,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1429,7 +1429,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-api", @@ -3409,7 +3409,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3425,7 +3425,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3440,7 +3440,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3465,7 +3465,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3479,7 +3479,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3495,7 +3495,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3510,7 +3510,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3525,7 +3525,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3541,7 +3541,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3561,7 +3561,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3577,7 +3577,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3597,7 +3597,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3613,7 +3613,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3627,7 +3627,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3642,7 +3642,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3656,7 +3656,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3671,7 +3671,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3692,7 +3692,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3707,7 +3707,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3720,7 +3720,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "enumflags2", "frame-support", @@ -3735,7 +3735,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3750,7 +3750,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3770,7 +3770,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3786,7 +3786,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3822,7 +3822,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -3833,7 +3833,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3847,7 +3847,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3865,7 +3865,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "frame-system", @@ -3880,7 +3880,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -3898,7 +3898,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-support", "parity-scale-codec", @@ -3911,7 +3911,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3926,7 +3926,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-benchmarking", "frame-support", @@ -3942,7 +3942,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5874,7 +5874,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "bytes 0.5.4", "derive_more 0.99.8", @@ -5901,7 +5901,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -5925,7 +5925,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5942,7 +5942,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5958,7 +5958,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -5969,7 +5969,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "ansi_term 0.12.1", "atty", @@ -6010,7 +6010,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "fnv", @@ -6046,7 +6046,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "blake2-rfc", "hash-db", @@ -6075,7 +6075,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6086,7 +6086,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "fork-tree", @@ -6128,7 +6128,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6152,7 +6152,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6165,7 +6165,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6188,7 +6188,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "log 0.4.8", "sc-client-api", @@ -6202,7 +6202,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "lazy_static", @@ -6230,7 +6230,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -6247,7 +6247,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6262,7 +6262,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "cranelift-codegen", "cranelift-wasm", @@ -6283,7 +6283,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "assert_matches", "derive_more 0.99.8", @@ -6321,7 +6321,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "finality-grandpa", @@ -6338,7 +6338,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", @@ -6356,7 +6356,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "hex", @@ -6372,7 +6372,7 @@ dependencies = [ [[package]] name = "sc-light" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "hash-db", "lazy_static", @@ -6391,7 +6391,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "bitflags", "bs58", @@ -6443,7 +6443,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6458,7 +6458,7 @@ dependencies = [ [[package]] name = "sc-network-test" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "env_logger", "futures 0.3.5", @@ -6485,7 +6485,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "bytes 0.5.4", "fnv", @@ -6512,7 +6512,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "libp2p", @@ -6525,7 +6525,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "log 0.4.8", "substrate-prometheus-endpoint", @@ -6534,7 +6534,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "hash-db", @@ -6566,7 +6566,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6590,7 +6590,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6606,7 +6606,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "directories", @@ -6669,7 +6669,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6683,7 +6683,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6704,7 +6704,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "erased-serde", "log 0.4.8", @@ -6721,7 +6721,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6741,7 +6741,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7148,7 +7148,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -7160,7 +7160,7 @@ dependencies = [ [[package]] name = "sp-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "hash-db", "parity-scale-codec", @@ -7175,7 +7175,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7187,7 +7187,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "serde", @@ -7199,7 +7199,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "integer-sqrt", "num-traits 0.2.12", @@ -7212,7 +7212,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-api", @@ -7224,7 +7224,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7235,7 +7235,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-api", @@ -7247,7 +7247,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -7264,7 +7264,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "serde", "serde_json", @@ -7273,7 +7273,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7298,7 +7298,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-api", @@ -7312,7 +7312,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "merlin", "parity-scale-codec", @@ -7331,7 +7331,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7340,7 +7340,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7352,7 +7352,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "base58", "blake2-rfc", @@ -7395,7 +7395,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7404,7 +7404,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -7414,7 +7414,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "environmental", "parity-scale-codec", @@ -7425,7 +7425,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "finality-grandpa", "log 0.4.8", @@ -7441,7 +7441,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7451,7 +7451,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "parity-scale-codec", @@ -7463,7 +7463,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "hash-db", @@ -7484,7 +7484,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "lazy_static", "sp-core", @@ -7495,7 +7495,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "serde", @@ -7507,7 +7507,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -7518,7 +7518,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "sp-api", "sp-core", @@ -7528,7 +7528,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "backtrace", "log 0.4.8", @@ -7537,7 +7537,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "serde", "sp-core", @@ -7546,7 +7546,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "either", "hash256-std-hasher", @@ -7568,7 +7568,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7583,7 +7583,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "Inflector", "proc-macro-crate", @@ -7595,7 +7595,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "serde", "serde_json", @@ -7604,7 +7604,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-api", @@ -7617,7 +7617,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7627,7 +7627,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "hash-db", "itertools 0.9.0", @@ -7648,12 +7648,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" [[package]] name = "sp-storage" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7665,7 +7665,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7679,7 +7679,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "log 0.4.8", "rental", @@ -7689,7 +7689,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7705,7 +7705,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "hash-db", "memory-db", @@ -7719,7 +7719,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "futures-core", @@ -7731,7 +7731,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7743,7 +7743,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7883,7 +7883,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "chrono", "clear_on_drop", @@ -7910,7 +7910,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "platforms", ] @@ -7918,7 +7918,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -7941,7 +7941,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "async-std", "derive_more 0.99.8", @@ -7955,7 +7955,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.1.29", "futures 0.3.5", @@ -7981,7 +7981,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "cfg-if", "frame-executive", @@ -8021,7 +8021,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "futures 0.3.5", "parity-scale-codec", @@ -8042,7 +8042,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/paritytech/substrate#efbac7be80c6e8988a25339061078d3e300f132d" +source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" [[package]] name = "substrate-wasm-builder-runner" diff --git a/cli/src/command.rs b/cli/src/command.rs index 076ddb86f36a..4d4b4080f0b4 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -19,7 +19,7 @@ use log::info; use service::{IdentifyVariant, self}; #[cfg(feature = "service-rewr")] use service_new::{IdentifyVariant, self as service}; -use sc_cli::{CliConfiguration, SubstrateCli, Result, RuntimeVersion, Role}; +use sc_cli::{SubstrateCli, Result, RuntimeVersion, Role}; use crate::cli::{Cli, Subcommand}; fn get_exec_name() -> Option { @@ -198,7 +198,7 @@ pub fn run() -> Result<()> { } }, Some(Subcommand::ValidationWorker(cmd)) => { - sc_cli::init_logger("", cli.run.base.log_rotation_opt()?)?; + sc_cli::init_logger("", None)?; if cfg!(feature = "browser") { Err(sc_cli::Error::Input("Cannot run validation worker in browser".into())) From 6aa5bfbad071741c977d468b14acd5d0e6243d9b Mon Sep 17 00:00:00 2001 From: Fedor Sakharov Date: Thu, 9 Jul 2020 23:23:58 +0300 Subject: [PATCH 5/9] CandidateBackingSubsystem (#1312) * Updates guide for CandidateBacking * Move assignment types to primitives * Initial implementation. * More functionality * use assert_matches * Changes to report misbehaviors * Some fixes after a review * Remove a blank line * Update guide and some types * Adds run_job function * Some comments and refactorings * Fix review * Remove warnings * Use summary in kicking off validation * Parallelize requests * Validation provides local and global validation params * Test issued validity tracking * Nits from review --- Cargo.lock | 776 +++++--- Cargo.toml | 1 + node/core/backing/Cargo.toml | 30 + node/core/backing/src/lib.rs | 1729 +++++++++++++++++ node/overseer/examples/minimal-example.rs | 1 + node/overseer/src/lib.rs | 1 + node/primitives/src/lib.rs | 134 +- node/subsystem/src/messages.rs | 36 +- primitives/src/parachain.rs | 125 +- .../src/node/backing/candidate-backing.md | 99 +- .../src/types/overseer-protocol.md | 43 +- runtime/parachains/src/inclusion.rs | 7 +- runtime/parachains/src/scheduler.rs | 94 +- statement-table/src/generic.rs | 17 +- 14 files changed, 2639 insertions(+), 454 deletions(-) create mode 100644 node/core/backing/Cargo.toml create mode 100644 node/core/backing/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index b749998cd31b..7536eae33b2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,13 +12,19 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" +checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" dependencies = [ - "gimli 0.21.0", + "gimli 0.22.0", ] +[[package]] +name = "adler" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccc9a9dd069569f212bc4330af9f17c4afb5e8ce185e83dbb14f1349dda18b10" + [[package]] name = "adler32" version = "1.1.0" @@ -27,57 +33,56 @@ checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" [[package]] name = "aead" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" dependencies = [ - "generic-array", + "generic-array 0.14.2", ] [[package]] name = "aes" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" +checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5" dependencies = [ "aes-soft", "aesni", - "block-cipher-trait", + "block-cipher", ] [[package]] name = "aes-gcm" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638" +checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1" dependencies = [ "aead", "aes", - "block-cipher-trait", + "block-cipher", "ghash", "subtle 2.2.3", - "zeroize", ] [[package]] name = "aes-soft" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" +checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7" dependencies = [ - "block-cipher-trait", + "block-cipher", "byteorder", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] name = "aesni" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" +checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264" dependencies = [ - "block-cipher-trait", - "opaque-debug", + "block-cipher", + "opaque-debug 0.2.3", ] [[package]] @@ -97,9 +102,9 @@ checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" [[package]] name = "aho-corasick" -version = "0.7.10" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" dependencies = [ "memchr", ] @@ -121,7 +126,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -130,7 +135,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -191,7 +196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" dependencies = [ "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -246,12 +251,12 @@ checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" [[package]] name = "async-tls" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a" +checksum = "df097e3f506bec0e1a24f06bb3c962c228f36671de841ff579cb99f371772634" dependencies = [ "futures 0.3.5", - "rustls", + "rustls 0.18.0", "webpki", "webpki-roots 0.19.0", ] @@ -264,7 +269,7 @@ checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -275,7 +280,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -292,9 +297,9 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "backtrace" -version = "0.3.49" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05100821de9e028f12ae3d189176b41ee198341eb8f369956407fea2f5cc666c" +checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" dependencies = [ "addr2line", "cfg-if", @@ -318,15 +323,15 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "base64" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e223af0dc48c96d4f8342ec01a4974f139df863896b316681efd36742f22cc67" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "bincode" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf" +checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" dependencies = [ "byteorder", "serde", @@ -385,9 +390,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" dependencies = [ "byte-tools", - "crypto-mac", - "digest", - "opaque-debug", + "crypto-mac 0.7.0", + "digest 0.8.1", + "opaque-debug 0.2.3", +] + +[[package]] +name = "blake2" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84ce5b6108f8e154604bd4eb76a2f726066c3464d5a552a4229262a18c9bb471" +dependencies = [ + "byte-tools", + "byteorder", + "crypto-mac 0.8.0", + "digest 0.9.0", + "opaque-debug 0.2.3", ] [[package]] @@ -431,16 +449,25 @@ dependencies = [ "block-padding", "byte-tools", "byteorder", - "generic-array", + "generic-array 0.12.3", ] [[package]] -name = "block-cipher-trait" -version = "0.6.2" +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.2", +] + +[[package]] +name = "block-cipher" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" +checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" dependencies = [ - "generic-array", + "generic-array 0.14.2", ] [[package]] @@ -517,9 +544,12 @@ dependencies = [ [[package]] name = "bytes" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" +dependencies = [ + "loom", +] [[package]] name = "c_linked_list" @@ -535,9 +565,9 @@ checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" [[package]] name = "cc" -version = "1.0.54" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" +checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" dependencies = [ "jobserver", ] @@ -559,9 +589,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chacha20" -version = "0.3.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6a7ae4c498f8447d86baef0fa0831909333f558866fabcb21600625ac5a31c7" +checksum = "086c0f07ac275808b7bf9a39f2fd013aae1498be83632814c8c4e0bd53f2dc58" dependencies = [ "stream-cipher", "zeroize", @@ -569,9 +599,9 @@ dependencies = [ [[package]] name = "chacha20poly1305" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48901293601228db2131606f741db33561f7576b5d19c99cd66222380a7dc863" +checksum = "18b0c90556d8e3fec7cf18d84a2f53d27b21288f2fe481b830fadcf809e48205" dependencies = [ "aead", "chacha20", @@ -582,9 +612,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" dependencies = [ "js-sys", "num-integer", @@ -708,6 +738,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +[[package]] +name = "cpuid-bool" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d375c433320f6c5057ae04a04376eef4d04ce2801448cf8863a78da99107be4" + [[package]] name = "cranelift-bforest" version = "0.63.0" @@ -869,10 +905,20 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" dependencies = [ - "generic-array", + "generic-array 0.12.3", "subtle 1.0.0", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.2", + "subtle 2.2.3", +] + [[package]] name = "ct-logs" version = "0.6.0" @@ -889,7 +935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" dependencies = [ "byteorder", - "digest", + "digest 0.8.1", "rand_core 0.5.1", "subtle 2.2.3", "zeroize", @@ -929,13 +975,13 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.8" +version = "0.99.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc655351f820d774679da6cdc23355a93de496867d8203496675162e17b1d671" +checksum = "298998b1cf6b5b2c8a7b023dfd45821825ce3ba8a8af55c921a0e734e4653f76" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -950,7 +996,16 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array", + "generic-array 0.12.3", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.2", ] [[package]] @@ -971,7 +1026,7 @@ checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" dependencies = [ "libc", "redox_users", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1008,7 +1063,7 @@ dependencies = [ "clear_on_drop", "curve25519-dalek", "rand 0.7.3", - "sha2", + "sha2 0.8.2", ] [[package]] @@ -1054,7 +1109,7 @@ checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -1093,7 +1148,7 @@ checksum = "b480f641ccf0faf324e20c1d3e53d81b7484c698b42ea677f6907ae4db195371" dependencies = [ "errno-dragonfly", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1160,7 +1215,7 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", "synstructure", ] @@ -1251,9 +1306,9 @@ checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" [[package]] name = "flate2" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" +checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e" dependencies = [ "cfg-if", "crc32fast", @@ -1385,7 +1440,7 @@ dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -1397,7 +1452,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -1407,7 +1462,7 @@ source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c67 dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -1458,7 +1513,7 @@ dependencies = [ "lazy_static", "libc", "libloading", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1594,7 +1649,7 @@ dependencies = [ "proc-macro-hack", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -1667,7 +1722,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "futures 0.3.5", "memchr", "pin-project", @@ -1679,7 +1734,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "futures 0.3.5", "memchr", "pin-project", @@ -1691,6 +1746,19 @@ version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" +[[package]] +name = "generator" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" +dependencies = [ + "cc", + "libc", + "log 0.4.8", + "rustc_version", + "winapi 0.3.9", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -1700,6 +1768,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "generic-array" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac746a5f3bbfdadd6106868134545e684693d54d9d44f6e9588a7d54af0bf980" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "get_if_addrs" version = "0.5.3" @@ -1736,9 +1814,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252" +checksum = "d6e27f0689a6e15944bdce7e45425efb87eaa8ab0c6e87f11d0987a9133e2531" dependencies = [ "polyval", ] @@ -1759,9 +1837,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" +checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" [[package]] name = "glob" @@ -1830,7 +1908,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "fnv", "futures-core", "futures-sink", @@ -1889,9 +1967,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" dependencies = [ "libc", ] @@ -1927,8 +2005,8 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" dependencies = [ - "crypto-mac", - "digest", + "crypto-mac 0.7.0", + "digest 0.8.1", ] [[package]] @@ -1937,8 +2015,8 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" dependencies = [ - "digest", - "generic-array", + "digest 0.8.1", + "generic-array 0.12.3", "hmac", ] @@ -1959,7 +2037,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "fnv", "itoa", ] @@ -1982,7 +2060,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "http 0.2.1", ] @@ -2037,7 +2115,7 @@ version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "futures-channel", "futures-core", "futures-util", @@ -2061,12 +2139,12 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "ct-logs", "futures-util", "hyper 0.13.6", "log 0.4.8", - "rustls", + "rustls 0.17.0", "rustls-native-certs", "tokio 0.2.21", "tokio-rustls", @@ -2130,7 +2208,7 @@ checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -2235,9 +2313,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.40" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177" +checksum = "c4b9172132a62451e56142bff9afc91c8e4a4500aa5b847da36815b63bfda916" dependencies = [ "wasm-bindgen", ] @@ -2289,7 +2367,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -2457,9 +2535,9 @@ dependencies = [ [[package]] name = "kv-log-macro" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ff57d6d215f7ca7eb35a9a64d656ba4d9d2bef114d741dc08048e75e2f5d418" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" dependencies = [ "log 0.4.8", ] @@ -2540,15 +2618,15 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" [[package]] name = "libc" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" +checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" [[package]] name = "libflate" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784f4ec5908a9d7f4e53658906386667e8b02e9389a47cfebf45d324ba9e8d25" +checksum = "e9bac9023e1db29c084f9f8cd9d3852e5e8fddf98fb47c4964a0ea4663d95949" dependencies = [ "adler32", "crc32fast", @@ -2569,7 +2647,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" dependencies = [ "cc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2584,7 +2662,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d743d03fab397cde23925a17cb87b35b25994f44ab8c6a9e46a7e953ec739cd" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "futures 0.3.5", "lazy_static", "libp2p-core", @@ -2635,7 +2713,7 @@ dependencies = [ "rand 0.7.3", "ring", "rw-stream-sink", - "sha2", + "sha2 0.8.2", "smallvec 1.4.1", "thiserror", "unsigned-varint 0.4.0", @@ -2650,7 +2728,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "515c4a7cba5d321bb88ed3ed803997bdd5634ce35c9c5e8e9ace9c512e57eceb" dependencies = [ "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -2687,7 +2765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44ed3a4c8111c570ab2bffb30c6353178d7603ce3787e3c5f2493c8d3d16d1f0" dependencies = [ "arrayvec 0.5.1", - "bytes 0.5.4", + "bytes 0.5.5", "either", "fnv", "futures 0.3.5", @@ -2699,7 +2777,7 @@ dependencies = [ "prost", "prost-build", "rand 0.7.3", - "sha2", + "sha2 0.8.2", "smallvec 1.4.1", "uint", "unsigned-varint 0.4.0", @@ -2735,7 +2813,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14ae0ffacd30f073f96cd518b2c9cd2cb18ac27c3d136a4b23cf1af99f33e541" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "fnv", "futures 0.3.5", "futures_codec 0.4.1", @@ -2759,7 +2837,7 @@ dependencies = [ "prost", "prost-build", "rand 0.7.3", - "sha2", + "sha2 0.8.2", "snow", "static_assertions", "x25519-dalek", @@ -2828,9 +2906,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd3a13025c0f621647ed2c5147615468e7b3cd1a5c7f26f2a6f6f8eafc9c1950" +checksum = "046a5201f6e471f22b22b394e4d084269ed1e28cf7300f7b49874385db84c7bd" dependencies = [ "async-tls", "either", @@ -2838,7 +2916,7 @@ dependencies = [ "libp2p-core", "log 0.4.8", "quicksink", - "rustls", + "rustls 0.18.0", "rw-stream-sink", "soketto", "url 2.1.1", @@ -2879,10 +2957,10 @@ checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" dependencies = [ "arrayref", "crunchy", - "digest", + "digest 0.8.1", "hmac-drbg", "rand 0.7.3", - "sha2", + "sha2 0.8.2", "subtle 2.2.3", "typenum", ] @@ -2952,6 +3030,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "loom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls 0.1.2", +] + [[package]] name = "lru" version = "0.4.3" @@ -3004,14 +3093,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "memoffset" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" +checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" dependencies = [ "autocfg 1.0.0", ] @@ -3056,11 +3145,11 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.3.7" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f" dependencies = [ - "adler32", + "adler", ] [[package]] @@ -3096,14 +3185,14 @@ dependencies = [ [[package]] name = "mio-named-pipes" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ "log 0.4.8", "mio", "miow 0.3.5", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -3136,7 +3225,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" dependencies = [ "socket2", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -3153,9 +3242,9 @@ checksum = "f75db05d738947aa5389863aadafbcf2e509d7ba099dc2ddcdf4fc66bf7a9e03" dependencies = [ "blake2b_simd", "blake2s_simd", - "digest", + "digest 0.8.1", "sha-1", - "sha2", + "sha2 0.8.2", "sha3", "unsigned-varint 0.3.3", ] @@ -3172,7 +3261,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9157e87afbc2ef0d84cc0345423d715f445edde00141c93721c162de35a05e5" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "futures 0.3.5", "log 0.4.8", "pin-project", @@ -3188,7 +3277,7 @@ checksum = "aaa9fddbc34c8c35dd2108515587b8ce0cab396f17977b8c738568e4edb521a2" dependencies = [ "alga", "approx", - "generic-array", + "generic-array 0.12.3", "matrixmultiply", "num-complex", "num-rational", @@ -3214,7 +3303,7 @@ checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -3286,7 +3375,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -3391,6 +3480,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "openssl-probe" version = "0.1.2" @@ -3827,7 +3922,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -4010,11 +4105,11 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a1cd2ba02391b81367bec529fb209019d718684fdc8ad6a712c2b536e46f775" dependencies = [ - "blake2", - "bytes 0.5.4", + "blake2 0.8.1", + "bytes 0.5.5", "rand 0.7.3", "sha-1", - "sha2", + "sha2 0.8.2", "sha3", "unsigned-varint 0.3.3", ] @@ -4041,7 +4136,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -4066,7 +4161,7 @@ dependencies = [ "tokio 0.1.22", "tokio-named-pipes", "tokio-uds", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -4083,7 +4178,7 @@ dependencies = [ "parking_lot 0.10.2", "primitive-types", "smallvec 1.4.1", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -4093,7 +4188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" dependencies = [ "proc-macro2 1.0.18", - "syn 1.0.31", + "syn 1.0.33", "synstructure", ] @@ -4142,7 +4237,7 @@ dependencies = [ "redox_syscall", "rustc_version", "smallvec 0.6.13", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -4156,14 +4251,14 @@ dependencies = [ "libc", "redox_syscall", "smallvec 1.4.1", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "paste" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "026c63fe245362be0322bfec5a9656d458d13f9cfb1785d1b38458b9968e8080" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ "paste-impl", "proc-macro-hack", @@ -4171,9 +4266,9 @@ dependencies = [ [[package]] name = "paste-impl" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b9281a268ec213237dcd2aa3c3d0f46681b04ced37c1616fd36567a9e6954b0" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ "proc-macro-hack", ] @@ -4185,7 +4280,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" dependencies = [ "byteorder", - "crypto-mac", + "crypto-mac 0.7.0", ] [[package]] @@ -4239,7 +4334,7 @@ checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -4290,7 +4385,7 @@ dependencies = [ name = "polkadot-availability-store" version = "0.8.14" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "exit-future", "futures 0.3.5", "kvdb", @@ -4392,7 +4487,7 @@ name = "polkadot-network" version = "0.8.14" dependencies = [ "arrayvec 0.4.12", - "bytes 0.5.4", + "bytes 0.5.5", "derive_more 0.14.1", "exit-future", "futures 0.3.5", @@ -4456,6 +4551,31 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "polkadot-node-core-backing" +version = "0.1.0" +dependencies = [ + "assert_matches", + "bitvec", + "derive_more 0.99.9", + "futures 0.3.5", + "futures-timer 3.0.2", + "log 0.4.8", + "polkadot-erasure-coding", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-primitives", + "polkadot-statement-table", + "polkadot-subsystem-test-helpers", + "sc-client-api", + "sc-keystore", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-keyring", + "streamunordered", +] + [[package]] name = "polkadot-node-core-proposer" version = "0.1.0" @@ -4525,7 +4645,7 @@ dependencies = [ name = "polkadot-parachain" version = "0.8.14" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "log 0.4.8", "parity-scale-codec", "parking_lot 0.10.2", @@ -5103,18 +5223,18 @@ dependencies = [ [[package]] name = "poly1305" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5829f50f48e9ddb79f3f7c3097029d0caee30f8286accb241416df603b080b8" +checksum = "d9b42192ab143ed7619bf888a7f9c6733a9a2153b218e2cd557cfdb52fbf9bb1" dependencies = [ "universal-hash", ] [[package]] name = "polyval" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212" +checksum = "d9a50142b55ab3ed0e9f68dfb3709f1d90d29da24e91033f28b96330643107dc" dependencies = [ "cfg-if", "universal-hash", @@ -5185,26 +5305,26 @@ dependencies = [ [[package]] name = "proc-macro-error" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" +checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880" dependencies = [ "proc-macro-error-attr", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", "version_check", ] [[package]] name = "proc-macro-error-attr" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" +checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", "syn-mid", "version_check", ] @@ -5236,7 +5356,7 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" dependencies = [ - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] @@ -5274,7 +5394,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "prost-derive", ] @@ -5284,7 +5404,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "heck", "itertools 0.8.2", "log 0.4.8", @@ -5306,7 +5426,7 @@ dependencies = [ "itertools 0.8.2", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -5315,15 +5435,15 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "prost", ] [[package]] name = "protobuf" -version = "2.14.0" +version = "2.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485" +checksum = "d883f78645c21b7281d21305181aa1f4dd9e9363e7cf2566c93121552cff003e" [[package]] name = "quick-error" @@ -5392,7 +5512,7 @@ dependencies = [ "libc", "rand_core 0.3.1", "rdrand", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5405,7 +5525,7 @@ dependencies = [ "fuchsia-cprng", "libc", "rand_core 0.3.1", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5424,7 +5544,7 @@ dependencies = [ "rand_os", "rand_pcg 0.1.2", "rand_xorshift", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5520,7 +5640,7 @@ checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" dependencies = [ "libc", "rand_core 0.4.2", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5535,7 +5655,7 @@ dependencies = [ "rand_core 0.4.2", "rdrand", "wasm-bindgen", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5660,7 +5780,7 @@ checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -5701,7 +5821,7 @@ dependencies = [ "bitflags", "libc", "mach", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5710,7 +5830,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5731,7 +5851,7 @@ checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -5746,7 +5866,7 @@ dependencies = [ "spin", "untrusted", "web-sys", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5772,7 +5892,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99371657d3c8e4d816fb6221db98fa408242b0b53bac08f8676a41f8554fe99f" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -5833,6 +5953,19 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustls" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cac94b333ee2aac3284c5b8a1b7fb4dd11cba88c244e3fe33cdbd047af0eb693" +dependencies = [ + "base64 0.12.3", + "log 0.4.8", + "ring", + "sct", + "webpki", +] + [[package]] name = "rustls-native-certs" version = "0.3.0" @@ -5840,7 +5973,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5" dependencies = [ "openssl-probe", - "rustls", + "rustls 0.17.0", "schannel", "security-framework", ] @@ -5876,8 +6009,8 @@ name = "sc-authority-discovery" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "bytes 0.5.4", - "derive_more 0.99.8", + "bytes 0.5.5", + "derive_more 0.99.9", "futures 0.3.5", "futures-timer 3.0.2", "libp2p", @@ -5963,7 +6096,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -5974,7 +6107,7 @@ dependencies = [ "ansi_term 0.12.1", "atty", "chrono", - "derive_more 0.99.8", + "derive_more 0.99.9", "fdlimit", "flexi_logger", "futures 0.3.5", @@ -6012,7 +6145,7 @@ name = "sc-client-api" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "fnv", "futures 0.3.5", "hash-db", @@ -6088,7 +6221,7 @@ name = "sc-consensus-babe" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "fork-tree", "futures 0.3.5", "futures-timer 3.0.2", @@ -6130,7 +6263,7 @@ name = "sc-consensus-babe-rpc" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", @@ -6204,7 +6337,7 @@ name = "sc-executor" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "lazy_static", "libsecp256k1", "log 0.4.8", @@ -6232,7 +6365,7 @@ name = "sc-executor-common" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "log 0.4.8", "parity-scale-codec", "parity-wasm", @@ -6270,7 +6403,7 @@ dependencies = [ "parity-scale-codec", "parity-wasm", "sc-executor-common", - "scoped-tls", + "scoped-tls 1.0.0", "sp-allocator", "sp-core", "sp-runtime-interface", @@ -6286,7 +6419,7 @@ version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "assert_matches", - "derive_more 0.99.8", + "derive_more 0.99.9", "finality-grandpa", "fork-tree", "futures 0.3.5", @@ -6323,7 +6456,7 @@ name = "sc-finality-grandpa-rpc" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "finality-grandpa", "futures 0.3.5", "jsonrpc-core", @@ -6358,7 +6491,7 @@ name = "sc-keystore" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "hex", "merlin", "parking_lot 0.10.2", @@ -6395,8 +6528,8 @@ source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c67 dependencies = [ "bitflags", "bs58", - "bytes 0.5.4", - "derive_more 0.99.8", + "bytes 0.5.5", + "derive_more 0.99.9", "either", "erased-serde", "fnv", @@ -6487,7 +6620,7 @@ name = "sc-offchain" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "fnv", "futures 0.3.5", "futures-timer 3.0.2", @@ -6568,7 +6701,7 @@ name = "sc-rpc-api" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "futures 0.3.5", "jsonrpc-core", "jsonrpc-core-client", @@ -6608,7 +6741,7 @@ name = "sc-service" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "directories", "exit-future", "futures 0.1.29", @@ -6723,7 +6856,7 @@ name = "sc-transaction-graph" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "futures 0.3.5", "linked-hash-map", "log 0.4.8", @@ -6743,7 +6876,7 @@ name = "sc-transaction-pool" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "futures 0.3.5", "futures-diagnose", "intervalier", @@ -6771,7 +6904,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -6787,11 +6920,17 @@ dependencies = [ "merlin", "rand 0.7.3", "rand_core 0.5.1", - "sha2", + "sha2 0.8.2", "subtle 2.2.3", "zeroize", ] +[[package]] +name = "scoped-tls" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" + [[package]] name = "scoped-tls" version = "1.0.0" @@ -6821,7 +6960,7 @@ checksum = "e367622f934864ffa1c704ba2b82280aab856e3d8213c84c5720257eb34b15b9" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -6901,29 +7040,29 @@ checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] name = "serde" -version = "1.0.112" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736aac72d1eafe8e5962d1d1c3d99b0df526015ba40915cb3c49d042e92ec243" +checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.112" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf0343ce212ac0d3d6afd9391ac8e9c9efe06b533c8d33f660f6390cc4093f57" +checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] name = "serde_json" -version = "1.0.55" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" +checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" dependencies = [ "itoa", "ryu", @@ -6936,10 +7075,10 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.7.3", + "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] @@ -6948,10 +7087,23 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.7.3", + "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -6960,11 +7112,11 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" dependencies = [ - "block-buffer", + "block-buffer 0.7.3", "byte-tools", - "digest", + "digest 0.8.1", "keccak", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] @@ -6983,7 +7135,7 @@ dependencies = [ "rand 0.4.6", "shared_memory_derive", "theban_interval_tree", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -7060,7 +7212,7 @@ checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -7092,27 +7244,27 @@ dependencies = [ "futures-util", "libc", "once_cell", - "scoped-tls", + "scoped-tls 1.0.0", "slab", "socket2", "wepoll-sys-stjepang", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "snow" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce0f91be479494dd92e69d9971bd23ed27037dd1c94fcf558f6c6e74e6afa654" +checksum = "32bf8474159a95551661246cda4976e89356999e3cbfef36f493dacc3fae1e8e" dependencies = [ "aes-gcm", - "blake2", + "blake2 0.9.0", "chacha20poly1305", "rand 0.7.3", "rand_core 0.5.1", "ring", "rustc_version", - "sha2", + "sha2 0.9.1", "subtle 2.2.3", "x25519-dalek", ] @@ -7126,7 +7278,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -7135,8 +7287,8 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85457366ae0c6ce56bf05a958aef14cd38513c236568618edbcd9a8c52cb80b0" dependencies = [ - "base64 0.12.2", - "bytes 0.5.4", + "base64 0.12.3", + "bytes 0.5.5", "flate2", "futures 0.3.5", "httparse", @@ -7150,7 +7302,7 @@ name = "sp-allocator" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "log 0.4.8", "sp-core", "sp-std", @@ -7181,7 +7333,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -7249,7 +7401,7 @@ name = "sp-blockchain" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "log 0.4.8", "lru", "parity-scale-codec", @@ -7275,7 +7427,7 @@ name = "sp-consensus" version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "futures 0.3.5", "futures-timer 3.0.2", "libp2p", @@ -7357,7 +7509,7 @@ dependencies = [ "base58", "blake2-rfc", "byteorder", - "derive_more 0.99.8", + "derive_more 0.99.9", "ed25519-dalek", "futures 0.3.5", "hash-db", @@ -7378,7 +7530,7 @@ dependencies = [ "schnorrkel", "secrecy", "serde", - "sha2", + "sha2 0.8.2", "sp-debug-derive", "sp-externalities", "sp-runtime-interface", @@ -7408,7 +7560,7 @@ source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c67 dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -7453,7 +7605,7 @@ name = "sp-inherents" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "parity-scale-codec", "parking_lot 0.10.2", "sp-core", @@ -7512,7 +7664,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -7589,7 +7741,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -7691,7 +7843,7 @@ name = "sp-transaction-pool" version = "2.0.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ - "derive_more 0.99.8", + "derive_more 0.99.9", "futures 0.3.5", "log 0.4.8", "parity-scale-codec", @@ -7780,11 +7932,11 @@ dependencies = [ [[package]] name = "stream-cipher" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" +checksum = "09f8ed9974042b8c3672ff3030a69fcc03b74c47c3d1ecb7755e8a3626011e88" dependencies = [ - "generic-array", + "generic-array 0.14.2", ] [[package]] @@ -7844,7 +7996,7 @@ dependencies = [ "proc-macro-error", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -7865,7 +8017,7 @@ dependencies = [ "heck", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -7877,7 +8029,7 @@ dependencies = [ "hmac", "pbkdf2", "schnorrkel", - "sha2", + "sha2 0.8.2", ] [[package]] @@ -7944,7 +8096,7 @@ version = "0.8.0-rc4" source = "git+https://github.com/paritytech/substrate#06dedb0eb77abb7f64832b5c675ee4c00e40d730" dependencies = [ "async-std", - "derive_more 0.99.8", + "derive_more 0.99.9", "futures-util", "hyper 0.13.6", "log 0.4.8", @@ -8070,7 +8222,7 @@ dependencies = [ "wasmparser 0.52.2", "wasmtime-environ", "wat", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -8097,7 +8249,7 @@ dependencies = [ "wasmparser 0.52.2", "wasmtime-debug", "wasmtime-environ", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -8136,7 +8288,7 @@ dependencies = [ "region", "thiserror", "wasmtime-environ", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -8175,13 +8327,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" +checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] @@ -8192,7 +8344,7 @@ checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -8212,8 +8364,8 @@ checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", - "unicode-xid 0.2.0", + "syn 1.0.33", + "unicode-xid 0.2.1", ] [[package]] @@ -8228,7 +8380,7 @@ dependencies = [ "ntapi", "once_cell", "rayon", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -8254,7 +8406,7 @@ dependencies = [ "rand 0.7.3", "redox_syscall", "remove_dir_all", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -8363,7 +8515,7 @@ checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -8391,7 +8543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -8406,7 +8558,7 @@ dependencies = [ "pbkdf2", "rand 0.7.3", "rustc-hash", - "sha2", + "sha2 0.8.2", "unicode-normalization", ] @@ -8464,7 +8616,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "fnv", "futures-core", "iovec", @@ -8478,7 +8630,7 @@ dependencies = [ "signal-hook-registry", "slab", "tokio-macros", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -8564,7 +8716,7 @@ checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] @@ -8606,7 +8758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4" dependencies = [ "futures-core", - "rustls", + "rustls 0.17.0", "tokio 0.2.21", "webpki", ] @@ -8701,9 +8853,9 @@ dependencies = [ [[package]] name = "tokio-uds" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5076db410d6fdc6523df7595447629099a1fdc47b3d9f896220780fa48faf798" +checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" dependencies = [ "bytes 0.4.12", "futures 0.1.29", @@ -8723,7 +8875,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "futures-core", "futures-sink", "log 0.4.8", @@ -8748,9 +8900,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" +checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" dependencies = [ "cfg-if", "tracing-attributes", @@ -8759,20 +8911,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" +checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", ] [[package]] name = "tracing-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" dependencies = [ "lazy_static", ] @@ -8873,9 +9025,9 @@ checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" [[package]] name = "unicode-width" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" @@ -8891,17 +9043,17 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "universal-hash" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" dependencies = [ - "generic-array", + "generic-array 0.14.2", "subtle 2.2.3", ] @@ -8911,7 +9063,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f67332660eb59a6f1eb24ff1220c9e8d01738a8503c6002e30bcfe4bd9f2b4a9" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "futures-io", "futures-util", "futures_codec 0.3.4", @@ -8923,7 +9075,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.5", "futures_codec 0.4.1", ] @@ -9023,9 +9175,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.63" +version = "0.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" +checksum = "6a634620115e4a229108b71bde263bb4220c483b3f07f5ba514ee8d15064c4c2" dependencies = [ "cfg-if", "serde", @@ -9035,24 +9187,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.63" +version = "0.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101" +checksum = "3e53963b583d18a5aa3aaae4b4c1cb535218246131ba22a71f05b518098571df" dependencies = [ "bumpalo", "lazy_static", "log 0.4.8", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6" +checksum = "dba48d66049d2a6cc8488702e7259ab7afc9043ad0dc5448444f46f2a453b362" dependencies = [ "cfg-if", "js-sys", @@ -9062,9 +9214,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.63" +version = "0.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3" +checksum = "3fcfd5ef6eec85623b4c6e844293d4516470d8f19cd72d0d12246017eb9060b8" dependencies = [ "quote 1.0.7", "wasm-bindgen-macro-support", @@ -9072,22 +9224,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.63" +version = "0.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92" +checksum = "9adff9ee0e94b926ca81b57f57f86d5545cdcb1d259e21ec9bdd95b901754c75" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.63" +version = "0.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd" +checksum = "7f7b90ea6c632dd06fd765d44542e234d5e63d9bb917ecd64d79778a13bd79ae" [[package]] name = "wasm-timer" @@ -9163,7 +9315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed54fd9d64dfeeee7c285fd126174a6b5e6d4efc7e5a1566fdb635e60ff6a74e" dependencies = [ "anyhow", - "base64 0.12.2", + "base64 0.12.3", "bincode", "cranelift-codegen", "cranelift-entity", @@ -9177,37 +9329,37 @@ dependencies = [ "more-asserts", "rayon", "serde", - "sha2", + "sha2 0.8.2", "thiserror", "toml", "wasmparser 0.51.4", - "winapi 0.3.8", + "winapi 0.3.9", "zstd", ] [[package]] name = "wast" -version = "18.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b1f23531740a81f9300bd2febd397a95c76bfa4aa4bfaf4ca8b1ee3438f337" +checksum = "0b1844f66a2bc8526d71690104c0e78a8e59ffa1597b7245769d174ebb91deb5" dependencies = [ "leb128", ] [[package]] name = "wat" -version = "1.0.19" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4006d418d59293172aebfeeadb7673459dc151874a79135946ea7996b6a98515" +checksum = "ce85d72b74242c340e9e3492cfb602652d7bb324c3172dd441b5577e39a2e18c" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.40" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b72fe77fd39e4bd3eaa4412fd299a0be6b3dfe9d2597e2f1c20beb968f41d17" +checksum = "863539788676619aac1a23e2df3655e96b32b0e05eb72ca34ba045ad573c625d" dependencies = [ "js-sys", "wasm-bindgen", @@ -9344,9 +9496,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", @@ -9370,7 +9522,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -9420,9 +9572,9 @@ dependencies = [ [[package]] name = "yamux" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84300bb493cc878f3638b981c62b4632ec1a5c52daaa3036651e8c106d3b55ea" +checksum = "cd37e58a1256a0b328ce9c67d8b62ecdd02f4803ba443df478835cb1a41a637c" dependencies = [ "futures 0.3.5", "log 0.4.8", @@ -9455,7 +9607,7 @@ checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.31", + "syn 1.0.33", "synstructure", ] diff --git a/Cargo.toml b/Cargo.toml index fe5bbcf2f9bd..b6d1aa53eaa2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,6 +50,7 @@ members = [ "node/overseer", "node/primitives", "node/service", + "node/core/backing", "node/subsystem", "node/test-helpers/subsystem", "node/test-service", diff --git a/node/core/backing/Cargo.toml b/node/core/backing/Cargo.toml new file mode 100644 index 000000000000..b25055293add --- /dev/null +++ b/node/core/backing/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "polkadot-node-core-backing" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +futures = "0.3.5" +log = "0.4.8" +sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } +keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "master" } +primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master" } + +polkadot-primitives = { path = "../../../primitives" } +polkadot-node-primitives = { path = "../../primitives" } +polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" } +erasure-coding = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" } +statement-table = { package = "polkadot-statement-table", path = "../../../statement-table" } +futures-timer = "3.0.2" +streamunordered = "0.5.1" +derive_more = "0.99.9" +bitvec = { version = "0.17.4", default-features = false, features = ["alloc"] } + +[dev-dependencies] +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } +futures = { version = "0.3.5", features = ["thread-pool"] } +subsystem-test = { package = "polkadot-subsystem-test-helpers", path = "../../test-helpers/subsystem" } +assert_matches = "1.3.0" diff --git a/node/core/backing/src/lib.rs b/node/core/backing/src/lib.rs new file mode 100644 index 000000000000..e4490d20d3f1 --- /dev/null +++ b/node/core/backing/src/lib.rs @@ -0,0 +1,1729 @@ +// Copyright 2020 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 . + +//! Implements a `CandidateBackingSubsystem`. + +#![recursion_limit="256"] + +use std::collections::{HashMap, HashSet}; +use std::convert::TryFrom; +use std::pin::Pin; +use std::time::Duration; + +use bitvec::vec::BitVec; +use log; +use futures::{ + select, FutureExt, SinkExt, StreamExt, + channel::{oneshot, mpsc}, + future::{self, Either}, + task::{Spawn, SpawnError, SpawnExt}, +}; +use futures_timer::Delay; +use streamunordered::{StreamUnordered, StreamYield}; + +use primitives::Pair; +use keystore::KeyStorePtr; +use polkadot_primitives::{ + Hash, + parachain::{ + AbridgedCandidateReceipt, BackedCandidate, Id as ParaId, ValidatorPair, ValidatorId, + ValidatorIndex, HeadData, SigningContext, PoVBlock, OmittedValidationData, + CandidateDescriptor, LocalValidationData, GlobalValidationSchedule, AvailableData, + ErasureChunk, + }, +}; +use polkadot_node_primitives::{ + FromTableMisbehavior, Statement, SignedFullStatement, MisbehaviorReport, ValidationResult, +}; +use polkadot_subsystem::{ + FromOverseer, OverseerSignal, Subsystem, SubsystemContext, SpawnedSubsystem, +}; +use polkadot_subsystem::messages::{ + AllMessages, CandidateBackingMessage, CandidateSelectionMessage, SchedulerRoster, + RuntimeApiMessage, RuntimeApiRequest, CandidateValidationMessage, ValidationFailed, + StatementDistributionMessage, NewBackedCandidate, ProvisionerMessage, ProvisionableData, + PoVDistributionMessage, AvailabilityStoreMessage, +}; +use statement_table::{ + generic::AttestedCandidate as TableAttestedCandidate, + Table, Context as TableContextTrait, Statement as TableStatement, + SignedStatement as TableSignedStatement, Summary as TableSummary, +}; + +#[derive(Debug, derive_more::From)] +enum Error { + NotInValidatorSet, + CandidateNotFound, + JobNotFound(Hash), + InvalidSignature, + #[from] + Erasure(erasure_coding::Error), + #[from] + ValidationFailed(ValidationFailed), + #[from] + Oneshot(oneshot::Canceled), + #[from] + Mpsc(mpsc::SendError), + #[from] + Spawn(SpawnError), +} + +/// Holds all data needed for candidate backing job operation. +struct CandidateBackingJob { + /// The hash of the relay parent on top of which this job is doing it's work. + parent: Hash, + /// Inbound message channel receiving part. + rx_to: mpsc::Receiver, + /// Outbound message channel sending part. + tx_from: mpsc::Sender, + + /// `HeadData`s of the parachains that this validator is assigned to. + head_data: HeadData, + /// The `ParaId`s assigned to this validator. + assignment: ParaId, + /// We issued `Valid` or `Invalid` statements on about these candidates. + issued_statements: HashSet, + /// `Some(h)` if this job has already issues `Seconded` statemt for some candidate with `h` hash. + seconded: Option, + /// We have already reported misbehaviors for these validators. + reported_misbehavior_for: HashSet, + + table: Table, + table_context: TableContext, +} + +const fn group_quorum(n_validators: usize) -> usize { + (n_validators / 2) + 1 +} + +#[derive(Default)] +struct TableContext { + signing_context: SigningContext, + key: Option, + groups: HashMap>, + validators: Vec, +} + +impl TableContextTrait for TableContext { + fn is_member_of(&self, authority: ValidatorIndex, group: &ParaId) -> bool { + self.groups.get(group).map_or(false, |g| g.iter().position(|&a| a == authority).is_some()) + } + + fn requisite_votes(&self, group: &ParaId) -> usize { + self.groups.get(group).map_or(usize::max_value(), |g| group_quorum(g.len())) + } +} + +impl TableContext { + fn local_id(&self) -> Option { + self.key.as_ref().map(|k| k.public()) + } + + fn local_index(&self) -> Option { + self.local_id().and_then(|id| + self.validators + .iter() + .enumerate() + .find(|(_, k)| k == &&id) + .map(|(i, _)| i as ValidatorIndex) + ) + } +} + +const CHANNEL_CAPACITY: usize = 64; + +/// A message type that is sent from `CandidateBackingSubsystem` to `CandidateBackingJob`. +enum ToJob { + /// A `CandidateBackingMessage`. + CandidateBacking(CandidateBackingMessage), + /// Stop working. + Stop, +} + +/// A message type that is sent from `CandidateBackingJob` to `CandidateBackingSubsystem`. +enum FromJob { + AvailabilityStore(AvailabilityStoreMessage), + RuntimeApiMessage(RuntimeApiMessage), + CandidateValidation(CandidateValidationMessage), + CandidateSelection(CandidateSelectionMessage), + Provisioner(ProvisionerMessage), + PoVDistribution(PoVDistributionMessage), + StatementDistribution(StatementDistributionMessage), +} + +impl From for AllMessages { + fn from(f: FromJob) -> Self { + match f { + FromJob::AvailabilityStore(msg) => AllMessages::AvailabilityStore(msg), + FromJob::RuntimeApiMessage(msg) => AllMessages::RuntimeApi(msg), + FromJob::CandidateValidation(msg) => AllMessages::CandidateValidation(msg), + FromJob::CandidateSelection(msg) => AllMessages::CandidateSelection(msg), + FromJob::StatementDistribution(msg) => AllMessages::StatementDistribution(msg), + FromJob::PoVDistribution(msg) => AllMessages::PoVDistribution(msg), + FromJob::Provisioner(msg) => AllMessages::Provisioner(msg), + } + } +} + +// It looks like it's not possible to do an `impl From` given the current state of +// the code. So this does the necessary conversion. +fn primitive_statement_to_table(s: &SignedFullStatement) -> TableSignedStatement { + let statement = match s.payload() { + Statement::Seconded(c) => TableStatement::Candidate(c.clone()), + Statement::Valid(h) => TableStatement::Valid(h.clone()), + Statement::Invalid(h) => TableStatement::Invalid(h.clone()), + }; + + TableSignedStatement { + statement, + signature: s.signature().clone(), + sender: s.validator_index(), + } +} + +// finds the first key we are capable of signing with out of the given set of validators, +// if any. +fn signing_key(validators: &[ValidatorId], keystore: &KeyStorePtr) -> Option { + let keystore = keystore.read(); + validators.iter() + .find_map(|v| { + keystore.key_pair::(&v).ok() + }) +} + +impl CandidateBackingJob { + /// Run asynchronously. + async fn run(mut self) -> Result<(), Error> { + while let Some(msg) = self.rx_to.next().await { + match msg { + ToJob::CandidateBacking(msg) => { + self.process_msg(msg).await?; + } + _ => break, + } + } + + Ok(()) + } + + async fn issue_candidate_invalid_message( + &mut self, + candidate: AbridgedCandidateReceipt, + ) -> Result<(), Error> { + self.tx_from.send(FromJob::CandidateSelection( + CandidateSelectionMessage::Invalid(self.parent, candidate) + )).await?; + + Ok(()) + } + + /// Validate the candidate that is requested to be `Second`ed and distribute validation result. + async fn validate_and_second( + &mut self, + candidate: AbridgedCandidateReceipt, + pov: PoVBlock, + ) -> Result { + let valid = self.request_candidate_validation(candidate.clone(), pov.clone()).await?; + let statement = match valid.0 { + ValidationResult::Valid => { + // make PoV available for later distribution. Send data to the availability + // store to keep. Sign and dispatch `valid` statement to network if we + // have not seconded the given candidate. + self.make_pov_available(pov, valid.1, valid.2).await?; + self.issued_statements.insert(candidate.hash()); + Statement::Seconded(candidate) + } + ValidationResult::Invalid => { + let candidate_hash = candidate.hash(); + self.issue_candidate_invalid_message(candidate).await?; + Statement::Invalid(candidate_hash) + } + }; + + if let Some(signed_statement) = self.sign_statement(statement) { + self.import_statement(&signed_statement).await?; + self.distribute_signed_statement(signed_statement).await?; + } + + Ok(valid.0) + } + + fn get_backed(&self) -> Vec { + let proposed = self.table.proposed_candidates(&self.table_context); + let mut res = Vec::with_capacity(proposed.len()); + + for p in proposed.into_iter() { + let TableAttestedCandidate { candidate, validity_votes, .. } = p; + + let (ids, validity_votes): (Vec<_>, Vec<_>) = validity_votes + .into_iter() + .map(|(id, vote)| (id, vote.into())) + .unzip(); + + let group = match self.table_context.groups.get(&self.assignment) { + Some(group) => group, + None => continue, + }; + + let mut validator_indices = BitVec::with_capacity( + group.len() + ); + + validator_indices.resize(group.len(), false); + + for id in ids.iter() { + if let Some(position) = group.iter().position(|x| x == id) { + validator_indices.set(position, true); + } + } + + let backed = BackedCandidate { + candidate, + validity_votes, + validator_indices, + }; + + res.push(NewBackedCandidate(backed.clone())); + } + + res + } + + /// Check if there have happened any new misbehaviors and issue necessary messages. + /// + /// TODO: Report multiple misbehaviors (https://github.com/paritytech/polkadot/issues/1387) + async fn issue_new_misbehaviors(&mut self) -> Result<(), Error> { + let mut reports = Vec::new(); + + for (k, v) in self.table.get_misbehavior().iter() { + if !self.reported_misbehavior_for.contains(k) { + self.reported_misbehavior_for.insert(*k); + + let f = FromTableMisbehavior { + id: *k, + report: v.clone(), + signing_context: self.table_context.signing_context.clone(), + key: self.table_context.validators[*k as usize].clone(), + }; + + if let Ok(report) = MisbehaviorReport::try_from(f) { + let message = ProvisionerMessage::ProvisionableData( + ProvisionableData::MisbehaviorReport(self.parent, report) + ); + + reports.push(message); + } + } + } + + for report in reports.drain(..) { + self.send_to_provisioner(report).await? + } + + Ok(()) + } + + /// Import a statement into the statement table and return the summary of the import. + async fn import_statement( + &mut self, + statement: &SignedFullStatement, + ) -> Result, Error> { + let stmt = primitive_statement_to_table(statement); + + let summary = self.table.import_statement(&self.table_context, stmt); + + self.issue_new_misbehaviors().await?; + + return Ok(summary); + } + + async fn process_msg(&mut self, msg: CandidateBackingMessage) -> Result<(), Error> { + match msg { + CandidateBackingMessage::Second(_, candidate, pov) => { + // Sanity check that candidate is from our assignment. + if candidate.parachain_index != self.assignment { + return Ok(()); + } + + // If the message is a `CandidateBackingMessage::Second`, sign and dispatch a + // Seconded statement only if we have not seconded any other candidate and + // have not signed a Valid statement for the requested candidate. + match self.seconded { + // This job has not seconded a candidate yet. + None => { + let candidate_hash = candidate.hash(); + + if !self.issued_statements.contains(&candidate_hash) { + if let Ok(ValidationResult::Valid) = self.validate_and_second( + candidate, + pov, + ).await { + self.seconded = Some(candidate_hash); + } + } + } + // This job has already seconded a candidate. + Some(_) => {} + } + } + CandidateBackingMessage::Statement(_, statement) => { + self.check_statement_signature(&statement)?; + self.maybe_validate_and_import(statement).await?; + } + CandidateBackingMessage::GetBackedCandidates(_, tx) => { + let backed = self.get_backed(); + + tx.send(backed).map_err(|_| oneshot::Canceled)?; + } + } + + Ok(()) + } + + /// Kick off validation work and distribute the result as a signed statement. + async fn kick_off_validation_work( + &mut self, + summary: TableSummary, + ) -> Result { + let candidate = self.table.get_candidate(&summary.candidate).ok_or(Error::CandidateNotFound)?; + let candidate = candidate.clone(); + let descriptor = candidate.to_descriptor(); + let candidate_hash = candidate.hash(); + let pov = self.request_pov_from_distribution(descriptor).await?; + let v = self.request_candidate_validation(candidate, pov).await?; + + let statement = match v.0 { + ValidationResult::Valid => { + Statement::Valid(candidate_hash) + } + ValidationResult::Invalid => { + Statement::Invalid(candidate_hash) + } + }; + + self.issued_statements.insert(candidate_hash); + + if let Some(signed_statement) = self.sign_statement(statement) { + self.distribute_signed_statement(signed_statement).await?; + } + + Ok(v.0) + } + + /// Import the statement and kick off validation work if it is a part of our assignment. + async fn maybe_validate_and_import( + &mut self, + statement: SignedFullStatement, + ) -> Result<(), Error> { + if let Some(summary) = self.import_statement(&statement).await? { + if let Statement::Seconded(_) = statement.payload() { + if summary.group_id == self.assignment { + self.kick_off_validation_work(summary).await?; + } + } + } + + Ok(()) + } + + fn sign_statement(&self, statement: Statement) -> Option { + let local_index = self.table_context.local_index()?; + + let signing_key = self.table_context.key.as_ref()?; + + let signed_statement = SignedFullStatement::sign( + statement, + &self.table_context.signing_context, + local_index, + signing_key, + ); + + Some(signed_statement) + } + + fn check_statement_signature(&self, statement: &SignedFullStatement) -> Result<(), Error> { + let idx = statement.validator_index() as usize; + + if self.table_context.validators.len() > idx { + statement.check_signature( + &self.table_context.signing_context, + &self.table_context.validators[idx], + ).map_err(|_| Error::InvalidSignature)?; + } else { + return Err(Error::InvalidSignature); + } + + Ok(()) + } + + async fn send_to_provisioner(&mut self, msg: ProvisionerMessage) -> Result<(), Error> { + self.tx_from.send(FromJob::Provisioner(msg)).await?; + + Ok(()) + } + + async fn request_pov_from_distribution( + &mut self, + descriptor: CandidateDescriptor, + ) -> Result { + let (tx, rx) = oneshot::channel(); + + self.tx_from.send(FromJob::PoVDistribution( + PoVDistributionMessage::FetchPoV(self.parent, descriptor, tx) + )).await?; + + let pov = rx.await?; + Ok((*pov).clone()) + } + + async fn request_candidate_validation( + &mut self, + candidate: AbridgedCandidateReceipt, + pov: PoVBlock, + ) -> Result<(ValidationResult, GlobalValidationSchedule, LocalValidationData), Error> { + let (tx, rx) = oneshot::channel(); + + self.tx_from.send(FromJob::CandidateValidation( + CandidateValidationMessage::Validate( + self.parent, + candidate, + self.head_data.clone(), + pov, + tx, + ) + ) + ).await?; + + Ok(rx.await??) + } + + async fn store_chunk( + &mut self, + id: ValidatorIndex, + chunk: ErasureChunk, + ) -> Result<(), Error> { + self.tx_from.send(FromJob::AvailabilityStore( + AvailabilityStoreMessage::StoreChunk(self.parent, id, chunk) + ) + ).await?; + + Ok(()) + } + + async fn make_pov_available( + &mut self, + pov_block: PoVBlock, + global_validation: GlobalValidationSchedule, + local_validation: LocalValidationData, + ) -> Result<(), Error> { + let omitted_validation = OmittedValidationData { + global_validation, + local_validation, + }; + + let available_data = AvailableData { + pov_block, + omitted_validation, + }; + + let chunks = erasure_coding::obtain_chunks( + self.table_context.validators.len(), + &available_data, + )?; + + let branches = erasure_coding::branches(chunks.as_ref()); + + for (index, (chunk, proof)) in chunks.iter().zip(branches.map(|(proof, _)| proof)).enumerate() { + let chunk = ErasureChunk { + chunk: chunk.clone(), + index: index as u32, + proof, + }; + + self.store_chunk(index as ValidatorIndex, chunk).await?; + } + + Ok(()) + } + + async fn distribute_signed_statement(&mut self, s: SignedFullStatement) -> Result<(), Error> { + let smsg = StatementDistributionMessage::Share(self.parent, s); + + self.tx_from.send(FromJob::StatementDistribution(smsg)).await?; + + Ok(()) + } +} + +struct JobHandle { + abort_handle: future::AbortHandle, + to_job: mpsc::Sender, + finished: oneshot::Receiver<()>, + su_handle: usize, +} + +impl JobHandle { + async fn stop(mut self) { + let _ = self.to_job.send(ToJob::Stop).await; + let stop_timer = Delay::new(Duration::from_secs(1)); + + match future::select(stop_timer, self.finished).await { + Either::Left((_, _)) => { + }, + Either::Right((_, _)) => { + self.abort_handle.abort(); + }, + } + } + + async fn send_msg(&mut self, msg: ToJob) -> Result<(), Error> { + Ok(self.to_job.send(msg).await?) + } +} + +struct Jobs { + spawner: S, + running: HashMap, + outgoing_msgs: StreamUnordered>, +} + +async fn run_job( + parent: Hash, + keystore: KeyStorePtr, + rx_to: mpsc::Receiver, + mut tx_from: mpsc::Sender, +) -> Result<(), Error> { + let (validators, roster) = futures::try_join!( + request_validators(parent, &mut tx_from).await?, + request_validator_groups(parent, &mut tx_from).await?, + )?; + + let key = signing_key(&validators[..], &keystore).ok_or(Error::NotInValidatorSet)?; + let mut groups = HashMap::new(); + + for assignment in roster.scheduled { + if let Some(g) = roster.validator_groups.get(assignment.group_idx.0 as usize) { + groups.insert( + assignment.para_id, + g.clone(), + ); + } + } + + let mut assignment = Default::default(); + + if let Some(idx) = validators.iter().position(|k| *k == key.public()) { + let idx = idx as u32; + for (para_id, group) in groups.iter() { + if group.contains(&idx) { + assignment = *para_id; + break; + } + } + } + + let ( + head_data, + signing_context, + ) = futures::try_join!( + request_head_data(parent, &mut tx_from, assignment).await?, + request_signing_context(parent, &mut tx_from).await?, + )?; + + let table_context = TableContext { + signing_context, + key: Some(key), + groups, + validators, + }; + + let job = CandidateBackingJob { + parent, + rx_to, + tx_from, + head_data, + assignment, + issued_statements: HashSet::new(), + seconded: None, + reported_misbehavior_for: HashSet::new(), + table: Table::default(), + table_context, + }; + + job.run().await +} + +/// Request a validator set from the `RuntimeApi`. +async fn request_validators( + parent: Hash, + s: &mut mpsc::Sender, +) -> Result>, Error> { + let (tx, rx) = oneshot::channel(); + + s.send(FromJob::RuntimeApiMessage(RuntimeApiMessage::Request( + parent, + RuntimeApiRequest::Validators(tx), + ) + )).await?; + + Ok(rx) +} + +/// Request the scheduler roster from `RuntimeApi`. +async fn request_validator_groups( + parent: Hash, + s: &mut mpsc::Sender, +) -> Result, Error> { + let (tx, rx) = oneshot::channel(); + + s.send(FromJob::RuntimeApiMessage(RuntimeApiMessage::Request( + parent, + RuntimeApiRequest::ValidatorGroups(tx), + ) + )).await?; + + Ok(rx) +} + +/// Request a `SigningContext` from the `RuntimeApi`. +async fn request_signing_context( + parent: Hash, + s: &mut mpsc::Sender, +) -> Result, Error> { + let (tx, rx) = oneshot::channel(); + + s.send(FromJob::RuntimeApiMessage(RuntimeApiMessage::Request( + parent, + RuntimeApiRequest::SigningContext(tx), + ) + )).await?; + + Ok(rx) +} + +/// Request `HeadData` for some `ParaId` from `RuntimeApi`. +async fn request_head_data( + parent: Hash, + s: &mut mpsc::Sender, + id: ParaId, +) -> Result, Error> { + let (tx, rx) = oneshot::channel(); + + s.send(FromJob::RuntimeApiMessage(RuntimeApiMessage::Request( + parent, + RuntimeApiRequest::HeadData(id, tx), + ) + )).await?; + + Ok(rx) +} + +impl Jobs { + fn new(spawner: S) -> Self { + Self { + spawner, + running: HashMap::default(), + outgoing_msgs: StreamUnordered::new(), + } + } + + fn spawn_job(&mut self, parent_hash: Hash, keystore: KeyStorePtr) -> Result<(), Error> { + let (to_job_tx, to_job_rx) = mpsc::channel(CHANNEL_CAPACITY); + let (from_job_tx, from_job_rx) = mpsc::channel(CHANNEL_CAPACITY); + + let (future, abort_handle) = future::abortable(async move { + if let Err(e) = run_job(parent_hash, keystore, to_job_rx, from_job_tx).await { + log::error!( + "CandidateBackingJob({}) finished with an error {:?}", + parent_hash, + e, + ); + } + }); + + let (finished_tx, finished) = oneshot::channel(); + + let future = async move { + let _ = future.await; + let _ = finished_tx.send(()); + }; + self.spawner.spawn(future)?; + + let su_handle = self.outgoing_msgs.push(from_job_rx); + + let handle = JobHandle { + abort_handle, + to_job: to_job_tx, + finished, + su_handle, + }; + + self.running.insert(parent_hash, handle); + + Ok(()) + } + + async fn stop_job(&mut self, parent_hash: Hash) -> Result<(), Error> { + match self.running.remove(&parent_hash) { + Some(handle) => { + Pin::new(&mut self.outgoing_msgs).remove(handle.su_handle); + handle.stop().await; + Ok(()) + } + None => Err(Error::JobNotFound(parent_hash)) + } + } + + async fn send_msg(&mut self, parent_hash: Hash, msg: ToJob) -> Result<(), Error> { + if let Some(job) = self.running.get_mut(&parent_hash) { + job.send_msg(msg).await?; + } + Ok(()) + } + + async fn next(&mut self) -> Option { + self.outgoing_msgs.next().await.and_then(|(e, _)| match e { + StreamYield::Item(e) => Some(e), + _ => None, + }) + } +} + +/// An implementation of the Candidate Backing subsystem. +pub struct CandidateBackingSubsystem { + spawner: S, + keystore: KeyStorePtr, + _context: std::marker::PhantomData, +} + +impl CandidateBackingSubsystem + where + S: Spawn + Clone, + Context: SubsystemContext, +{ + /// Creates a new `CandidateBackingSubsystem`. + pub fn new(keystore: KeyStorePtr, spawner: S) -> Self { + Self { + spawner, + keystore, + _context: std::marker::PhantomData, + } + } + + async fn run( + mut ctx: Context, + keystore: KeyStorePtr, + spawner: S, + ) { + let mut jobs = Jobs::new(spawner.clone()); + + loop { + select! { + incoming = ctx.recv().fuse() => { + match incoming { + Ok(msg) => match msg { + FromOverseer::Signal(OverseerSignal::StartWork(hash)) => { + if let Err(e) = jobs.spawn_job(hash, keystore.clone()) { + log::error!("Failed to spawn a job: {:?}", e); + break; + } + } + FromOverseer::Signal(OverseerSignal::StopWork(hash)) => { + if let Err(e) = jobs.stop_job(hash).await { + log::error!("Failed to spawn a job: {:?}", e); + break; + } + } + FromOverseer::Communication { msg } => { + match msg { + CandidateBackingMessage::Second(hash, _, _) | + CandidateBackingMessage::Statement(hash, _) | + CandidateBackingMessage::GetBackedCandidates(hash, _) => { + let res = jobs.send_msg( + hash.clone(), + ToJob::CandidateBacking(msg), + ).await; + + if let Err(e) = res { + log::error!( + "Failed to send a message to a job: {:?}", + e, + ); + + break; + } + } + _ => (), + } + } + _ => (), + }, + Err(_) => break, + } + } + outgoing = jobs.next().fuse() => { + match outgoing { + Some(msg) => { + let _ = ctx.send_message(msg.into()).await; + } + None => break, + } + } + complete => break, + } + } + } +} + +impl Subsystem for CandidateBackingSubsystem + where + S: Spawn + Send + Clone + 'static, + Context: SubsystemContext, +{ + fn start(self, ctx: Context) -> SpawnedSubsystem { + let keystore = self.keystore.clone(); + let spawner = self.spawner.clone(); + + SpawnedSubsystem(Box::pin(async move { + Self::run(ctx, keystore, spawner).await; + })) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use futures::{Future, executor::{self, ThreadPool}}; + use std::collections::HashMap; + use std::sync::Arc; + use sp_keyring::Sr25519Keyring; + use polkadot_primitives::parachain::{ + AssignmentKind, CollatorId, CoreAssignment, BlockData, CoreIndex, GroupIndex, ValidityAttestation, + }; + use assert_matches::assert_matches; + + fn validator_pubkeys(val_ids: &[Sr25519Keyring]) -> Vec { + val_ids.iter().map(|v| v.public().into()).collect() + } + + struct TestState { + chain_ids: Vec, + keystore: KeyStorePtr, + validators: Vec, + validator_public: Vec, + global_validation_schedule: GlobalValidationSchedule, + local_validation_data: LocalValidationData, + roster: SchedulerRoster, + head_data: HashMap, + signing_context: SigningContext, + relay_parent: Hash, + } + + impl Default for TestState { + fn default() -> Self { + let chain_a = ParaId::from(1); + let chain_b = ParaId::from(2); + let thread_a = ParaId::from(3); + + let chain_ids = vec![chain_a, chain_b, thread_a]; + + let validators = vec![ + Sr25519Keyring::Alice, + Sr25519Keyring::Bob, + Sr25519Keyring::Charlie, + Sr25519Keyring::Dave, + Sr25519Keyring::Ferdie, + ]; + + let keystore = keystore::Store::new_in_memory(); + // Make sure `Alice` key is in the keystore, so this mocked node will be a parachain validator. + keystore.write().insert_ephemeral_from_seed::(&validators[0].to_seed()) + .expect("Insert key into keystore"); + + let validator_public = validator_pubkeys(&validators); + + let chain_a_assignment = CoreAssignment { + core: CoreIndex::from(0), + para_id: chain_a, + kind: AssignmentKind::Parachain, + group_idx: GroupIndex::from(0), + }; + + let chain_b_assignment = CoreAssignment { + core: CoreIndex::from(1), + para_id: chain_b, + kind: AssignmentKind::Parachain, + group_idx: GroupIndex::from(1), + }; + + let thread_collator: CollatorId = Sr25519Keyring::Two.public().into(); + + let thread_a_assignment = CoreAssignment { + core: CoreIndex::from(2), + para_id: thread_a, + kind: AssignmentKind::Parathread(thread_collator.clone(), 0), + group_idx: GroupIndex::from(2), + }; + + let validator_groups = vec![vec![2, 0, 3], vec![1], vec![4]]; + + let parent_hash_1 = [1; 32].into(); + + let roster = SchedulerRoster { + validator_groups, + scheduled: vec![ + chain_a_assignment, + chain_b_assignment, + thread_a_assignment, + ], + upcoming: vec![], + availability_cores: vec![], + }; + let signing_context = SigningContext { + session_index: 1, + parent_hash: parent_hash_1, + }; + + let mut head_data = HashMap::new(); + head_data.insert(chain_a, HeadData(vec![4, 5, 6])); + + let relay_parent = Hash::from([5; 32]); + + let local_validation_data = LocalValidationData { + parent_head: HeadData(vec![7, 8, 9]), + balance: Default::default(), + code_upgrade_allowed: None, + }; + + let global_validation_schedule = GlobalValidationSchedule { + max_code_size: 1000, + max_head_data_size: 1000, + block_number: Default::default(), + }; + + Self { + chain_ids, + keystore, + validators, + validator_public, + roster, + head_data, + local_validation_data, + global_validation_schedule, + signing_context, + relay_parent, + } + } + } + + struct TestHarness { + virtual_overseer: subsystem_test::TestSubsystemContextHandle, + } + + fn test_harness>(keystore: KeyStorePtr, test: impl FnOnce(TestHarness) -> T) { + let pool = ThreadPool::new().unwrap(); + + let (context, virtual_overseer) = subsystem_test::make_subsystem_context(pool.clone()); + + let subsystem = CandidateBackingSubsystem::run(context, keystore, pool.clone()); + + let test_fut = test(TestHarness { + virtual_overseer, + }); + + futures::pin_mut!(test_fut); + futures::pin_mut!(subsystem); + + executor::block_on(future::select(test_fut, subsystem)); + } + + // Tests that the subsystem performs actions that are requied on startup. + async fn test_startup( + virtual_overseer: &mut subsystem_test::TestSubsystemContextHandle, + test_state: &TestState, + ) { + // Start work on some new parent. + virtual_overseer.send(FromOverseer::Signal( + OverseerSignal::StartWork(test_state.relay_parent)) + ).await; + + // Check that subsystem job issues a request for a validator set. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::RuntimeApi( + RuntimeApiMessage::Request(parent, RuntimeApiRequest::Validators(tx)) + ) if parent == test_state.relay_parent => { + tx.send(test_state.validator_public.clone()).unwrap(); + } + ); + + // Check that subsystem job issues a request for the validator groups. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::RuntimeApi( + RuntimeApiMessage::Request(parent, RuntimeApiRequest::ValidatorGroups(tx)) + ) if parent == test_state.relay_parent => { + tx.send(test_state.roster.clone()).unwrap(); + } + ); + + // Check that subsystem job issues a request for the head data. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::RuntimeApi( + RuntimeApiMessage::Request(parent, RuntimeApiRequest::HeadData(id, tx)) + ) if parent == test_state.relay_parent => { + tx.send(test_state.head_data.get(&id).unwrap().clone()).unwrap(); + } + ); + + // Check that subsystem job issues a request for the signing context. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::RuntimeApi( + RuntimeApiMessage::Request(parent, RuntimeApiRequest::SigningContext(tx)) + ) if parent == test_state.relay_parent => { + tx.send(test_state.signing_context.clone()).unwrap(); + } + ); + } + + // Test that a `CandidateBackingMessage::Second` issues validation work + // and in case validation is successful issues a `StatementDistributionMessage`. + #[test] + fn backing_second_works() { + let test_state = TestState::default(); + test_harness(test_state.keystore.clone(), |test_harness| async move { + let TestHarness { mut virtual_overseer } = test_harness; + + test_startup(&mut virtual_overseer, &test_state).await; + + let pov_block = PoVBlock { + block_data: BlockData(vec![42, 43, 44]), + }; + + let pov_block_hash = pov_block.hash(); + let candidate = AbridgedCandidateReceipt { + parachain_index: test_state.chain_ids[0], + relay_parent: test_state.relay_parent, + pov_block_hash, + ..Default::default() + }; + + let second = CandidateBackingMessage::Second( + test_state.relay_parent, + candidate.clone(), + pov_block.clone(), + ); + + virtual_overseer.send(FromOverseer::Communication{ msg: second }).await; + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::CandidateValidation( + CandidateValidationMessage::Validate( + parent_hash, + c, + head_data, + pov, + tx, + ) + ) if parent_hash == test_state.relay_parent && + pov == pov_block && c == candidate => { + assert_eq!(head_data, *expected_head_data); + tx.send(Ok(( + ValidationResult::Valid, + test_state.global_validation_schedule, + test_state.local_validation_data, + ))).unwrap(); + } + ); + + for _ in 0..test_state.validators.len() { + assert_matches!( + virtual_overseer.recv().await, + AllMessages::AvailabilityStore( + AvailabilityStoreMessage::StoreChunk(parent_hash, _, _) + ) if parent_hash == test_state.relay_parent + ); + } + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::StatementDistribution( + StatementDistributionMessage::Share( + parent_hash, + signed_statement, + ) + ) if parent_hash == test_state.relay_parent => { + signed_statement.check_signature( + &test_state.signing_context, + &test_state.validator_public[0], + ).unwrap(); + } + ); + + virtual_overseer.send(FromOverseer::Signal( + OverseerSignal::StopWork(test_state.relay_parent)) + ).await; + }); + } + + // Test that the candidate reaches quorum succesfully. + #[test] + fn backing_works() { + let test_state = TestState::default(); + test_harness(test_state.keystore.clone(), |test_harness| async move { + let TestHarness { mut virtual_overseer } = test_harness; + + test_startup(&mut virtual_overseer, &test_state).await; + + let pov_block = PoVBlock { + block_data: BlockData(vec![1, 2, 3]), + }; + + let pov_block_hash = pov_block.hash(); + + let candidate_a = AbridgedCandidateReceipt { + parachain_index: test_state.chain_ids[0], + relay_parent: test_state.relay_parent, + pov_block_hash, + ..Default::default() + }; + + let candidate_a_hash = candidate_a.hash(); + + let signed_a = SignedFullStatement::sign( + Statement::Seconded(candidate_a.clone()), + &test_state.signing_context, + 2, + &test_state.validators[2].pair().into(), + ); + + let signed_b = SignedFullStatement::sign( + Statement::Valid(candidate_a_hash), + &test_state.signing_context, + 0, + &test_state.validators[0].pair().into(), + ); + + let statement = CandidateBackingMessage::Statement(test_state.relay_parent, signed_a.clone()); + + virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await; + + // Sending a `Statement::Seconded` for our assignment will start + // validation process. The first thing requested is PoVBlock from the + // `PoVDistribution`. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::PoVDistribution( + PoVDistributionMessage::FetchPoV(relay_parent, _, tx) + ) if relay_parent == test_state.relay_parent => { + tx.send(Arc::new(pov_block.clone())).unwrap(); + } + ); + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); + + // The next step is the actual request to Validation subsystem + // to validate the `Seconded` candidate. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::CandidateValidation( + CandidateValidationMessage::Validate( + relay_parent, + candidate, + head_data, + pov, + tx, + ) + ) if relay_parent == test_state.relay_parent && candidate == candidate_a => { + assert_eq!(head_data, *expected_head_data); + assert_eq!(pov, pov_block); + tx.send(Ok(( + ValidationResult::Valid, + test_state.global_validation_schedule, + test_state.local_validation_data, + ))).unwrap(); + } + ); + + let statement = CandidateBackingMessage::Statement( + test_state.relay_parent, + signed_b.clone(), + ); + + virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await; + + let (tx, rx) = oneshot::channel(); + + // The backed candidats set should be not empty at this point. + virtual_overseer.send(FromOverseer::Communication{ + msg: CandidateBackingMessage::GetBackedCandidates( + test_state.relay_parent, + tx, + ) + }).await; + + let backed = rx.await.unwrap(); + + // `validity_votes` may be in any order so we can't do this in a single assert. + assert_eq!(backed[0].0.candidate, candidate_a); + assert_eq!(backed[0].0.validity_votes.len(), 2); + assert!(backed[0].0.validity_votes.contains( + &ValidityAttestation::Explicit(signed_b.signature().clone()) + )); + assert!(backed[0].0.validity_votes.contains( + &ValidityAttestation::Implicit(signed_a.signature().clone()) + )); + assert_eq!(backed[0].0.validator_indices, bitvec::bitvec![Lsb0, u8; 1, 1, 0]); + + virtual_overseer.send(FromOverseer::Signal( + OverseerSignal::StopWork(test_state.relay_parent)) + ).await; + }); + } + + // Issuing conflicting statements on the same candidate should + // be a misbehavior. + #[test] + fn backing_misbehavior_works() { + let test_state = TestState::default(); + test_harness(test_state.keystore.clone(), |test_harness| async move { + let TestHarness { mut virtual_overseer } = test_harness; + + test_startup(&mut virtual_overseer, &test_state).await; + + let pov_block = PoVBlock { + block_data: BlockData(vec![1, 2, 3]), + }; + + let pov_block_hash = pov_block.hash(); + let candidate_a = AbridgedCandidateReceipt { + parachain_index: test_state.chain_ids[0], + relay_parent: test_state.relay_parent, + pov_block_hash, + ..Default::default() + }; + + let candidate_a_hash = candidate_a.hash(); + + let signed_a = SignedFullStatement::sign( + Statement::Seconded(candidate_a.clone()), + &test_state.signing_context, + 2, + &test_state.validators[2].pair().into(), + ); + + let signed_b = SignedFullStatement::sign( + Statement::Valid(candidate_a_hash), + &test_state.signing_context, + 0, + &test_state.validators[0].pair().into(), + ); + + let signed_c = SignedFullStatement::sign( + Statement::Invalid(candidate_a_hash), + &test_state.signing_context, + 0, + &test_state.validators[0].pair().into(), + ); + + let statement = CandidateBackingMessage::Statement(test_state.relay_parent, signed_a.clone()); + + virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await; + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::PoVDistribution( + PoVDistributionMessage::FetchPoV(relay_parent, _, tx) + ) if relay_parent == test_state.relay_parent => { + tx.send(Arc::new(pov_block.clone())).unwrap(); + } + ); + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::CandidateValidation( + CandidateValidationMessage::Validate( + relay_parent, + candidate, + head_data, + pov, + tx, + ) + ) if relay_parent == test_state.relay_parent && candidate == candidate_a => { + assert_eq!(pov, pov_block); + assert_eq!(head_data, *expected_head_data); + tx.send(Ok(( + ValidationResult::Valid, + test_state.global_validation_schedule, + test_state.local_validation_data, + ))).unwrap(); + } + ); + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::StatementDistribution( + StatementDistributionMessage::Share( + relay_parent, + signed_statement, + ) + ) if relay_parent == test_state.relay_parent => { + signed_statement.check_signature( + &test_state.signing_context, + &test_state.validator_public[0], + ).unwrap(); + + assert_eq!(*signed_statement.payload(), Statement::Valid(candidate_a_hash)); + } + ); + + let statement = CandidateBackingMessage::Statement(test_state.relay_parent, signed_b.clone()); + + virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await; + + let statement = CandidateBackingMessage::Statement(test_state.relay_parent, signed_c.clone()); + + virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await; + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::Provisioner( + ProvisionerMessage::ProvisionableData( + ProvisionableData::MisbehaviorReport( + relay_parent, + MisbehaviorReport::SelfContradiction(_, s1, s2), + ) + ) + ) if relay_parent == test_state.relay_parent => { + s1.check_signature( + &test_state.signing_context, + &test_state.validator_public[s1.validator_index() as usize], + ).unwrap(); + + s2.check_signature( + &test_state.signing_context, + &test_state.validator_public[s2.validator_index() as usize], + ).unwrap(); + } + ); + + }); + } + + // Test that if we are asked to second an invalid candidate we + // can still second a valid one afterwards. + #[test] + fn backing_dont_second_invalid() { + let test_state = TestState::default(); + test_harness(test_state.keystore.clone(), |test_harness| async move { + let TestHarness { mut virtual_overseer } = test_harness; + + test_startup(&mut virtual_overseer, &test_state).await; + + let pov_block_a = PoVBlock { + block_data: BlockData(vec![42, 43, 44]), + }; + + let pov_block_b = PoVBlock { + block_data: BlockData(vec![45, 46, 47]), + }; + + let pov_block_hash_a = pov_block_a.hash(); + let pov_block_hash_b = pov_block_b.hash(); + + let candidate_a = AbridgedCandidateReceipt { + parachain_index: test_state.chain_ids[0], + relay_parent: test_state.relay_parent, + pov_block_hash: pov_block_hash_a, + ..Default::default() + }; + + let candidate_a_hash = candidate_a.hash(); + + let candidate_b = AbridgedCandidateReceipt { + parachain_index: test_state.chain_ids[0], + relay_parent: test_state.relay_parent, + pov_block_hash: pov_block_hash_b, + ..Default::default() + }; + + let second = CandidateBackingMessage::Second( + test_state.relay_parent, + candidate_a.clone(), + pov_block_a.clone(), + ); + + virtual_overseer.send(FromOverseer::Communication{ msg: second }).await; + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::CandidateValidation( + CandidateValidationMessage::Validate( + parent_hash, + c, + head_data, + pov, + tx, + ) + ) if parent_hash == test_state.relay_parent && + pov == pov_block_a && c == candidate_a => { + assert_eq!(head_data, *expected_head_data); + tx.send(Ok(( + ValidationResult::Invalid, + test_state.global_validation_schedule.clone(), + test_state.local_validation_data.clone(), + ))).unwrap(); + } + ); + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::CandidateSelection( + CandidateSelectionMessage::Invalid(parent_hash, candidate) + ) if parent_hash == test_state.relay_parent && candidate == candidate_a + ); + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::StatementDistribution( + StatementDistributionMessage::Share( + relay_parent, + statement, + ) + ) if relay_parent == test_state.relay_parent => { + assert_eq!(*statement.payload(), Statement::Invalid(candidate_a_hash)); + } + ); + + let second = CandidateBackingMessage::Second( + test_state.relay_parent, + candidate_b.clone(), + pov_block_b.clone(), + ); + + virtual_overseer.send(FromOverseer::Communication{ msg: second }).await; + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::CandidateValidation( + CandidateValidationMessage::Validate( + parent_hash, + c, + head_data, + pov, + tx, + ) + ) if parent_hash == test_state.relay_parent && + pov == pov_block_b && c == candidate_b => { + assert_eq!(head_data, *expected_head_data); + tx.send(Ok(( + ValidationResult::Valid, + test_state.global_validation_schedule, + test_state.local_validation_data, + ))).unwrap(); + } + ); + + for _ in 0..test_state.validators.len() { + assert_matches!( + virtual_overseer.recv().await, + AllMessages::AvailabilityStore( + AvailabilityStoreMessage::StoreChunk(parent_hash, _, _) + ) if parent_hash == test_state.relay_parent + ); + } + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::StatementDistribution( + StatementDistributionMessage::Share( + parent_hash, + signed_statement, + ) + ) if parent_hash == test_state.relay_parent => { + signed_statement.check_signature( + &test_state.signing_context, + &test_state.validator_public[0], + ).unwrap(); + + assert_eq!(*signed_statement.payload(), Statement::Seconded(candidate_b)); + } + ); + + virtual_overseer.send(FromOverseer::Signal( + OverseerSignal::StopWork(test_state.relay_parent)) + ).await; + }); + } + + // Test that if we have already issued a statement (in this case `Invalid`) about a + // candidate we will not be issuing a `Seconded` statement on it. + #[test] + fn backing_multiple_statements_work() { + let test_state = TestState::default(); + test_harness(test_state.keystore.clone(), |test_harness| async move { + let TestHarness { mut virtual_overseer } = test_harness; + + test_startup(&mut virtual_overseer, &test_state).await; + + let pov_block = PoVBlock { + block_data: BlockData(vec![42, 43, 44]), + }; + + let pov_block_hash = pov_block.hash(); + + let candidate = AbridgedCandidateReceipt { + parachain_index: test_state.chain_ids[0], + relay_parent: test_state.relay_parent, + pov_block_hash, + ..Default::default() + }; + + let candidate_hash = candidate.hash(); + + let signed_a = SignedFullStatement::sign( + Statement::Seconded(candidate.clone()), + &test_state.signing_context, + 2, + &test_state.validators[2].pair().into(), + ); + + // Send in a `Statement` with a candidate. + let statement = CandidateBackingMessage::Statement( + test_state.relay_parent, + signed_a.clone(), + ); + + virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await; + + // Subsystem requests PoV and requests validation. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::PoVDistribution( + PoVDistributionMessage::FetchPoV(relay_parent, _, tx) + ) => { + assert_eq!(relay_parent, test_state.relay_parent); + tx.send(Arc::new(pov_block.clone())).unwrap(); + } + ); + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); + + // Tell subsystem that this candidate is invalid. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::CandidateValidation( + CandidateValidationMessage::Validate( + relay_parent, + candidate_recvd, + head_data, + pov, + tx, + ) + ) => { + assert_eq!(relay_parent, test_state.relay_parent); + assert_eq!(candidate_recvd, candidate); + assert_eq!(head_data, *expected_head_data); + assert_eq!(pov, pov_block); + tx.send(Ok(( + ValidationResult::Invalid, + test_state.global_validation_schedule, + test_state.local_validation_data, + ))).unwrap(); + } + ); + + // The invalid message is shared. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::StatementDistribution( + StatementDistributionMessage::Share( + relay_parent, + signed_statement, + ) + ) => { + assert_eq!(relay_parent, test_state.relay_parent); + signed_statement.check_signature( + &test_state.signing_context, + &test_state.validator_public[0], + ).unwrap(); + assert_eq!(*signed_statement.payload(), Statement::Invalid(candidate_hash)); + } + ); + + // Ask subsystem to `Second` a candidate that already has a statement issued about. + // This should emit no actions from subsystem. + let second = CandidateBackingMessage::Second( + test_state.relay_parent, + candidate.clone(), + pov_block.clone(), + ); + + virtual_overseer.send(FromOverseer::Communication{ msg: second }).await; + + let pov_to_second = PoVBlock { + block_data: BlockData(vec![3, 2, 1]), + }; + + let pov_block_hash = pov_to_second.hash(); + + let candidate_to_second = AbridgedCandidateReceipt { + parachain_index: test_state.chain_ids[0], + relay_parent: test_state.relay_parent, + pov_block_hash, + ..Default::default() + }; + + let second = CandidateBackingMessage::Second( + test_state.relay_parent, + candidate_to_second.clone(), + pov_to_second.clone(), + ); + + // In order to trigger _some_ actions from subsystem ask it to second another + // candidate. The only reason to do so is to make sure that no actions were + // triggered on the prev step. + virtual_overseer.send(FromOverseer::Communication{ msg: second }).await; + + assert_matches!( + virtual_overseer.recv().await, + AllMessages::CandidateValidation( + CandidateValidationMessage::Validate( + relay_parent, + _, + _, + pov, + _, + ) + ) => { + assert_eq!(relay_parent, test_state.relay_parent); + assert_eq!(pov, pov_to_second); + } + ); + }); + } +} diff --git a/node/overseer/examples/minimal-example.rs b/node/overseer/examples/minimal-example.rs index cdef0340d04f..aefb627f7f56 100644 --- a/node/overseer/examples/minimal-example.rs +++ b/node/overseer/examples/minimal-example.rs @@ -59,6 +59,7 @@ impl Subsystem1 { ctx.send_message(AllMessages::CandidateValidation( CandidateValidationMessage::Validate( + Default::default(), Default::default(), Default::default(), PoVBlock { diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index 70de3c1d86f8..ffebf33ce4f9 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -726,6 +726,7 @@ mod tests { ctx.send_message( AllMessages::CandidateValidation( CandidateValidationMessage::Validate( + Default::default(), Default::default(), Default::default(), PoVBlock { diff --git a/node/primitives/src/lib.rs b/node/primitives/src/lib.rs index 921f620ea9dc..25313c09154e 100644 --- a/node/primitives/src/lib.rs +++ b/node/primitives/src/lib.rs @@ -23,10 +23,17 @@ use parity_scale_codec::{Decode, Encode}; use polkadot_primitives::{Hash, parachain::{ - AbridgedCandidateReceipt, CandidateReceipt, CompactStatement, - EncodeAs, Signed, + AbridgedCandidateReceipt, CompactStatement, + EncodeAs, Signed, SigningContext, ValidatorIndex, ValidatorId, } }; +use polkadot_statement_table::{ + generic::{ + ValidityDoubleVote as TableValidityDoubleVote, + MultipleCandidates as TableMultipleCandidates, + }, + Misbehavior as TableMisbehavior, +}; /// A statement, where the candidate receipt is included in the `Seconded` variant. #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] @@ -77,11 +84,128 @@ pub enum MisbehaviorReport { /// this message should be dispatched with all of them, in arbitrary order. /// /// This variant is also used when our own validity checks disagree with others'. - CandidateValidityDisagreement(CandidateReceipt, Vec), + CandidateValidityDisagreement(AbridgedCandidateReceipt, Vec), /// I've noticed a peer contradicting itself about a particular candidate - SelfContradiction(CandidateReceipt, SignedFullStatement, SignedFullStatement), + SelfContradiction(AbridgedCandidateReceipt, SignedFullStatement, SignedFullStatement), /// This peer has seconded more than one parachain candidate for this relay parent head - DoubleVote(CandidateReceipt, SignedFullStatement, SignedFullStatement), + DoubleVote(SignedFullStatement, SignedFullStatement), +} + +/// A utility struct used to convert `TableMisbehavior` to `MisbehaviorReport`s. +pub struct FromTableMisbehavior { + /// Index of the validator. + pub id: ValidatorIndex, + /// The misbehavior reported by the table. + pub report: TableMisbehavior, + /// Signing context. + pub signing_context: SigningContext, + /// Misbehaving validator's public key. + pub key: ValidatorId, +} + +/// Result of the validation of the candidate. +#[derive(Debug)] +pub enum ValidationResult { + /// Candidate is valid. + Valid, + /// Candidate is invalid. + Invalid, +} + +impl std::convert::TryFrom for MisbehaviorReport { + type Error = (); + + fn try_from(f: FromTableMisbehavior) -> Result { + match f.report { + TableMisbehavior::ValidityDoubleVote( + TableValidityDoubleVote::IssuedAndValidity((c, s1), (d, s2)) + ) => { + let receipt = c.clone(); + let signed_1 = SignedFullStatement::new( + Statement::Seconded(c), + f.id, + s1, + &f.signing_context, + &f.key, + ).ok_or(())?; + let signed_2 = SignedFullStatement::new( + Statement::Valid(d), + f.id, + s2, + &f.signing_context, + &f.key, + ).ok_or(())?; + + Ok(MisbehaviorReport::SelfContradiction(receipt, signed_1, signed_2)) + } + TableMisbehavior::ValidityDoubleVote( + TableValidityDoubleVote::IssuedAndInvalidity((c, s1), (d, s2)) + ) => { + let receipt = c.clone(); + let signed_1 = SignedFullStatement::new( + Statement::Seconded(c), + f.id, + s1, + &f.signing_context, + &f.key, + ).ok_or(())?; + let signed_2 = SignedFullStatement::new( + Statement::Invalid(d), + f.id, + s2, + &f.signing_context, + &f.key, + ).ok_or(())?; + + Ok(MisbehaviorReport::SelfContradiction(receipt, signed_1, signed_2)) + } + TableMisbehavior::ValidityDoubleVote( + TableValidityDoubleVote::ValidityAndInvalidity(c, s1, s2) + ) => { + let signed_1 = SignedFullStatement::new( + Statement::Valid(c.hash()), + f.id, + s1, + &f.signing_context, + &f.key, + ).ok_or(())?; + let signed_2 = SignedFullStatement::new( + Statement::Invalid(c.hash()), + f.id, + s2, + &f.signing_context, + &f.key, + ).ok_or(())?; + + Ok(MisbehaviorReport::SelfContradiction(c, signed_1, signed_2)) + } + TableMisbehavior::MultipleCandidates( + TableMultipleCandidates { + first, + second, + } + ) => { + let signed_1 = SignedFullStatement::new( + Statement::Seconded(first.0), + f.id, + first.1, + &f.signing_context, + &f.key, + ).ok_or(())?; + + let signed_2 = SignedFullStatement::new( + Statement::Seconded(second.0), + f.id, + second.1, + &f.signing_context, + &f.key, + ).ok_or(())?; + + Ok(MisbehaviorReport::DoubleVote(signed_1, signed_2)) + } + _ => Err(()), + } + } } /// A unique identifier for a network protocol. diff --git a/node/subsystem/src/messages.rs b/node/subsystem/src/messages.rs index 73371e28fd9b..c98658e4aeab 100644 --- a/node/subsystem/src/messages.rs +++ b/node/subsystem/src/messages.rs @@ -28,10 +28,11 @@ use polkadot_primitives::{BlockNumber, Hash, Signature}; use polkadot_primitives::parachain::{ AbridgedCandidateReceipt, PoVBlock, ErasureChunk, BackedCandidate, Id as ParaId, SignedAvailabilityBitfield, SigningContext, ValidatorId, ValidationCode, ValidatorIndex, - CandidateDescriptor, + CoreAssignment, CoreOccupied, HeadData, CandidateDescriptor, GlobalValidationSchedule, + LocalValidationData, }; use polkadot_node_primitives::{ - MisbehaviorReport, SignedFullStatement, View, ProtocolId, + MisbehaviorReport, SignedFullStatement, View, ProtocolId, ValidationResult, }; use std::sync::Arc; @@ -53,12 +54,12 @@ pub enum CandidateSelectionMessage { /// Messages received by the Candidate Backing subsystem. #[derive(Debug)] pub enum CandidateBackingMessage { - /// Registers a stream listener for updates to the set of backable candidates that could be backed - /// in a child of the given relay-parent, referenced by its hash. - RegisterBackingWatcher(Hash, mpsc::Sender), + /// Requests a set of backable candidates that could be backed in a child of the given + /// relay-parent, referenced by its hash. + GetBackedCandidates(Hash, oneshot::Sender>), /// Note that the Candidate Backing subsystem should second the given candidate in the context of the /// given relay-parent (ref. by hash). This candidate must be validated. - Second(Hash, AbridgedCandidateReceipt), + Second(Hash, AbridgedCandidateReceipt, PoVBlock), /// Note a validator's statement about a particular candidate. Disagreements about validity must be escalated /// to a broader check by Misbehavior Arbitration. Agreements are simply tallied until a quorum is reached. Statement(Hash, SignedFullStatement), @@ -78,8 +79,12 @@ pub enum CandidateValidationMessage { Validate( Hash, AbridgedCandidateReceipt, + HeadData, PoVBlock, - oneshot::Sender>, + oneshot::Sender>, ), } @@ -151,17 +156,34 @@ pub enum AvailabilityStoreMessage { StoreChunk(Hash, ValidatorIndex, ErasureChunk), } +/// The information on scheduler assignments that some somesystems may be querying. +#[derive(Debug, Clone)] +pub struct SchedulerRoster { + /// Validator-to-groups assignments. + pub validator_groups: Vec>, + /// All scheduled paras. + pub scheduled: Vec, + /// Upcoming paras (chains and threads). + pub upcoming: Vec, + /// Occupied cores. + pub availability_cores: Vec>, +} + /// A request to the Runtime API subsystem. #[derive(Debug)] pub enum RuntimeApiRequest { /// Get the current validator set. Validators(oneshot::Sender>), + /// Get the assignments of validators to cores. + ValidatorGroups(oneshot::Sender), /// Get a signing context for bitfields and statements. SigningContext(oneshot::Sender), /// Get the validation code for a specific para, assuming execution under given block number, and /// an optional block number representing an intermediate parablock executed in the context of /// that block. ValidationCode(ParaId, BlockNumber, Option, oneshot::Sender), + /// Get head data for a specific para. + HeadData(ParaId, oneshot::Sender), } /// A message to the Runtime API subsystem. diff --git a/primitives/src/parachain.rs b/primitives/src/parachain.rs index d0d3dce558c9..19937798c646 100644 --- a/primitives/src/parachain.rs +++ b/primitives/src/parachain.rs @@ -171,6 +171,100 @@ pub struct DutyRoster { pub validator_duty: Vec, } +/// The unique (during session) index of a core. +#[derive(Encode, Decode, Default, PartialOrd, Ord, Eq, PartialEq, Clone, Copy)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct CoreIndex(pub u32); + +impl From for CoreIndex { + fn from(i: u32) -> CoreIndex { + CoreIndex(i) + } +} + +/// The unique (during session) index of a validator group. +#[derive(Encode, Decode, Default, Clone, Copy)] +#[cfg_attr(feature = "std", derive(Eq, Hash, PartialEq, Debug))] +pub struct GroupIndex(pub u32); + +impl From for GroupIndex { + fn from(i: u32) -> GroupIndex { + GroupIndex(i) + } +} + +/// A claim on authoring the next block for a given parathread. +#[derive(Clone, Encode, Decode, Default)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub struct ParathreadClaim(pub Id, pub CollatorId); + +/// An entry tracking a claim to ensure it does not pass the maximum number of retries. +#[derive(Clone, Encode, Decode, Default)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub struct ParathreadEntry { + /// The claim. + pub claim: ParathreadClaim, + /// Number of retries. + pub retries: u32, +} + +/// What is occupying a specific availability core. +#[derive(Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub enum CoreOccupied { + /// A parathread. + Parathread(ParathreadEntry), + /// A parachain. + Parachain, +} + +/// The assignment type. +#[derive(Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub enum AssignmentKind { + /// A parachain. + Parachain, + /// A parathread. + Parathread(CollatorId, u32), +} + +/// How a free core is scheduled to be assigned. +#[derive(Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub struct CoreAssignment { + /// The core that is assigned. + pub core: CoreIndex, + /// The unique ID of the para that is assigned to the core. + pub para_id: Id, + /// The kind of the assignment. + pub kind: AssignmentKind, + /// The index of the validator group assigned to the core. + pub group_idx: GroupIndex, +} + +impl CoreAssignment { + /// Get the ID of a collator who is required to collate this block. + pub fn required_collator(&self) -> Option<&CollatorId> { + match self.kind { + AssignmentKind::Parachain => None, + AssignmentKind::Parathread(ref id, _) => Some(id), + } + } + + /// Get the `CoreOccupied` from this. + pub fn to_core_occupied(&self) -> CoreOccupied { + match self.kind { + AssignmentKind::Parachain => CoreOccupied::Parachain, + AssignmentKind::Parathread(ref collator, retries) => CoreOccupied::Parathread( + ParathreadEntry { + claim: ParathreadClaim(self.para_id, collator.clone()), + retries, + } + ), + } + } +} + /// Extra data that is needed along with the other fields in a `CandidateReceipt` /// to fully validate the candidate. /// @@ -382,6 +476,15 @@ pub struct AbridgedCandidateReceipt { pub commitments: CandidateCommitments, } +/// A candidate-receipt with commitments directly included. +pub struct CommitedCandidateReceipt { + /// The descriptor of the candidae. + pub descriptor: CandidateDescriptor, + + /// The commitments of the candidate receipt. + pub commitments: CandidateCommitments +} + impl + Encode> AbridgedCandidateReceipt { /// Check integrity vs. provided block data. pub fn check_signature(&self) -> Result<(), ()> { @@ -473,7 +576,6 @@ impl AbridgedCandidateReceipt { } } - impl PartialOrd for AbridgedCandidateReceipt { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) @@ -923,6 +1025,27 @@ impl, RealPayload: Encode> Signed( + payload: Payload, + validator_index: ValidatorIndex, + signature: ValidatorSignature, + context: &SigningContext, + key: &ValidatorId, + ) -> Option { + let s = Self { + payload, + validator_index, + signature, + real_payload: std::marker::PhantomData, + }; + + s.check_signature(context, key).ok()?; + + Some(s) + } + /// Sign this payload with the given context and key, storing the validator index. #[cfg(feature = "std")] pub fn sign( diff --git a/roadmap/implementers-guide/src/node/backing/candidate-backing.md b/roadmap/implementers-guide/src/node/backing/candidate-backing.md index 1490bb074ccb..2044fbd8e75b 100644 --- a/roadmap/implementers-guide/src/node/backing/candidate-backing.md +++ b/roadmap/implementers-guide/src/node/backing/candidate-backing.md @@ -2,30 +2,43 @@ The Candidate Backing subsystem ensures every parablock considered for relay block inclusion has been seconded by at least one validator, and approved by a quorum. Parablocks for which no validator will assert correctness are discarded. If the block later proves invalid, the initial backers are slashable; this gives polkadot a rational threat model during subsequent stages. -Its role is to produce backable candidates for inclusion in new relay-chain blocks. It does so by issuing signed [`Statement`s](../../types/backing.md#statement-type) and tracking received statements signed by other validators. Once enough statements are received, they can be combined into backing for specific candidates. +Its role is to produce backable candidates for inclusion in new relay-chain blocks. It does so by issuing signed [`Statement`s][Statement] and tracking received statements signed by other validators. Once enough statements are received, they can be combined into backing for specific candidates. Note that though the candidate backing subsystem attempts to produce as many backable candidates as possible, it does _not_ attempt to choose a single authoritative one. The choice of which actually gets included is ultimately up to the block author, by whatever metrics it may use; those are opaque to this subsystem. -Once a sufficient quorum has agreed that a candidate is valid, this subsystem notifies the [Provisioner](../utility/provisioner.md), which in turn engages block production mechanisms to include the parablock. +Once a sufficient quorum has agreed that a candidate is valid, this subsystem notifies the [Provisioner][PV], which in turn engages block production mechanisms to include the parablock. ## Protocol -The [Candidate Selection subsystem](candidate-selection.md) is the primary source of non-overseer messages into this subsystem. That subsystem generates appropriate [`CandidateBackingMessage`s](../../types/overseer-protocol.md#candidate-backing-message), and passes them to this subsystem. +Input: [`CandidateBackingMessage`][CBM] -This subsystem validates the candidates and generates an appropriate [`SignedStatement`](../../types/backing.md#signed-statement-type). All `SignedStatement`s are then passed on to the [Statement Distribution subsystem](statement-distribution.md) to be gossiped to peers. All [Proofs of Validity](../../types/availability.md#proof-of-validity) should be distributed via the [PoV Distribution](pov-distribution.md) subsystem. When this subsystem decides that a candidate is invalid, and it was recommended to us to second by our own Candidate Selection subsystem, a message is sent to the Candidate Selection subsystem with the candidate's hash so that the collator which recommended it can be penalized. +Output: + +- [`CandidateValidationMessage`][CVM] +- [`RuntimeApiMessage`][RAM] +- [`CandidateSelectionMessage`][CSM] +- [`ProvisionerMessage`][PM] +- [`PoVDistributionMessage`][PDM] +- [`StatementDistributionMessage`][SDM] ## Functionality +The [Candidate Selection][CS] subsystem is the primary source of non-overseer messages into this subsystem. That subsystem generates appropriate [`CandidateBackingMessage`s][CBM] and passes them to this subsystem. + +This subsystem requests validation from the [Candidate Validation][CV] and generates an appropriate [`Statement`][Statement]. All `Statement`s are then passed on to the [Statement Distribution][SD] subsystem to be gossiped to peers. When [Candidate Validation][CV] decides that a candidate is invalid, and it was recommended to us to second by our own [Candidate Selection][CS] subsystem, a message is sent to the [Candidate Selection][CS] subsystem with the candidate's hash so that the collator which recommended it can be penalized. + The subsystem should maintain a set of handles to Candidate Backing Jobs that are currently live, as well as the relay-parent to which they correspond. ### On Overseer Signal -* If the signal is an [`OverseerSignal`](../../types/overseer-protocol.md#overseer-signal)`::StartWork(relay_parent)`, spawn a Candidate Backing Job with the given relay parent, storing a bidirectional channel with the Candidate Backing Job in the set of handles. -* If the signal is an [`OverseerSignal`](../../types/overseer-protocol.md#overseer-signal)`::StopWork(relay_parent)`, cease the Candidate Backing Job under that relay parent, if any. +* If the signal is an [`OverseerSignal`][OverseerSignal]`::StartWork(relay_parent)`, spawn a Candidate Backing Job with the given relay parent, storing a bidirectional channel with the Candidate Backing Job in the set of handles. +* If the signal is an [`OverseerSignal`][OverseerSignal]`::StopWork(relay_parent)`, cease the Candidate Backing Job under that relay parent, if any. -### On `CandidateBackingMessage` +### On Receiving `CandidateBackingMessage` -* If the message corresponds to a particular relay-parent, forward the message to the Candidate Backing Job for that relay-parent, if any is live. +* If the message is a [`CandidateBackingMessage`][CBM]`::GetBackedCandidates`, get all backable candidates from the statement table and send them back. +* If the message is a [`CandidateBackingMessage`][CBM]`::Second`, sign and dispatch a `Seconded` statement only if we have not seconded any other candidate and have not signed a `Valid` statement for the requested candidate. Signing both a `Seconded` and `Valid` message is a double-voting misbehavior with a heavy penalty, and this could occur if another validator has seconded the same candidate and we've received their message before the internal seconding request. +* If the message is a [`CandidateBackingMessage`][CBM]`::Statement`, count the statement to the quorum. If the statement in the message is `Seconded` and it contains a candidate that belongs to our assignment, request the corresponding `PoV` from the `PoVDistribution` and launch validation. Issue our own `Valid` or `Invalid` statement as a result. > big TODO: "contextual execution" > @@ -39,36 +52,49 @@ The subsystem should maintain a set of handles to Candidate Backing Jobs that ar The Candidate Backing Job represents the work a node does for backing candidates with respect to a particular relay-parent. -The goal of a Candidate Backing Job is to produce as many backable candidates as possible. This is done via signed [`Statement`s](../../types/backing.md#statement-type) by validators. If a candidate receives a majority of supporting Statements from the Parachain Validators currently assigned, then that candidate is considered backable. +The goal of a Candidate Backing Job is to produce as many backable candidates as possible. This is done via signed [`Statement`s][STMT] by validators. If a candidate receives a majority of supporting Statements from the Parachain Validators currently assigned, then that candidate is considered backable. ### On Startup -* Fetch current validator set, validator -> parachain assignments from runtime API. +* Fetch current validator set, validator -> parachain assignments from [`Runtime API`][RA] subsystem using [`RuntimeApiRequest::Validators`][RAM] and [`RuntimeApiRequest::ValidatorGroups`][RAM] * Determine if the node controls a key in the current validator set. Call this the local key if so. -* If the local key exists, extract the parachain head and validation function for the parachain the local key is assigned to. +* If the local key exists, extract the parachain head and validation function from the [`Runtime API`][RA] for the parachain the local key is assigned to by issuing a [`RuntimeApiRequest::Validators`][RAM] +* Issue a [`RuntimeApiRequest::SigningContext`][RAM] message to get a context that will later be used upon signing. -### On Receiving New Signed Statement +### On Receiving New Candidate Backing Message ```rust -if let Statement::Seconded(candidate) = signed.statement { - if candidate is unknown and in local assignment { - spawn_validation_work(candidate, parachain head, validation function) +match msg { + CetBackedCandidates(hash, tx) => { + // Send back a set of backable candidates. + } + CandidateBackingMessage::Second(hash, candidate) => { + if candidate is unknown and in local assignment { + spawn_validation_work(candidate, parachain head, validation function) + } + } + CandidateBackingMessage::Statement(hash, statement) => { + // count to the votes on this candidate + if let Statement::Seconded(candidate) = statement { + if candidate.parachain_id == our_assignment { + spawn_validation_work(candidate, parachain head, validation function) + } + } } } - -// add `Seconded` statements and `Valid` statements to a quorum. If quorum reaches validator-group -// majority, send a `BlockAuthorshipProvisioning::BackableCandidate(relay_parent, Candidate, Backing)` message. ``` -### Spawning Validation Work +Add `Seconded` statements and `Valid` statements to a quorum. If quorum reaches validator-group majority, send a [`ProvisionerMessage`][PM]`::ProvisionableData(ProvisionableData::BackedCandidate(BackedCandidate))` message. +`Invalid` statements that conflict with already witnessed `Seconded` and `Valid` statements for the given candidate, statements that are double-votes, self-contradictions and so on, should result in issuing a [`ProvisionerMessage`][PM]`::MisbehaviorReport` message for each newly detected case of this kind. + +### Validating Candidates. ```rust fn spawn_validation_work(candidate, parachain head, validation function) { asynchronously { let pov = (fetch pov block).await - // dispatched to sub-process (OS process) pool. - let valid = validate_candidate(candidate, validation function, parachain head, pov).await; + let valid = (validate pov block).await; if valid { // make PoV available for later distribution. Send data to the availability store to keep. // sign and dispatch `valid` statement to network if we have not seconded the given candidate. @@ -82,11 +108,30 @@ fn spawn_validation_work(candidate, parachain head, validation function) { ### Fetch Pov Block Create a `(sender, receiver)` pair. -Dispatch a `PovFetchSubsystemMessage(relay_parent, candidate_hash, sender)` and listen on the receiver for a response. +Dispatch a [`PoVDistributionMessage`][PDM]`::FecthPoV(relay_parent, candidate_hash, sender)` and listen on the receiver for a response. -### On Receiving `CandidateBackingMessage` - -* If the message is a `CandidateBackingMessage::RegisterBackingWatcher`, register the watcher and trigger it each time a new candidate is backable. Also trigger it once initially if there are any backable candidates at the time of receipt. -* If the message is a `CandidateBackingMessage::Second`, sign and dispatch a `Seconded` statement only if we have not seconded any other candidate and have not signed a `Valid` statement for the requested candidate. Signing both a `Seconded` and `Valid` message is a double-voting misbehavior with a heavy penalty, and this could occur if another validator has seconded the same candidate and we've received their message before the internal seconding request. +### Validate PoV Block -> TODO: send statements to Statement Distribution subsystem, handle shutdown signal from candidate backing subsystem +Create a `(sender, receiver)` pair. +Dispatch a `CandidateValidationMessage::Validate(validation function, candidate, pov, sender)` and listen on the receiver for a response. + +### Distribute Signed Statemnet + +Dispatch a [`StatementDistributionMessage`][PDM]`::Share(relay_parent, SignedFullStatement)`. + +[OverseerSignal]: ../../types/overseer-protocol.md#overseer-signal +[Statement]: ../../types/backing.md#statement-type +[STMT]: ../../types/backing.md#statement-type +[CSM]: ../../types/overseer-protocol.md#candidate-selection-message +[RAM]: ../../types/overseer-protocol.md#runtime-api-message +[CVM]: ../../types/overseer-protocol.md#validation-request-type +[PM]: ../../types/overseer-protocol.md#provisioner-message +[CBM]: ../../types/overseer-protocol.md#candidate-backing-message +[PDM]: ../../types/overseer-protocol.md#pov-distribution-message +[SDM]: ../../types/overseer-protocol.md#statement-distribution-message + +[CS]: candidate-selection.md +[CV]: ../utility/candidate-validation.md +[SD]: statement-distribution.md +[RA]: ../utility/runtime-api.md +[PV]: ../utility/provisioner.md diff --git a/roadmap/implementers-guide/src/types/overseer-protocol.md b/roadmap/implementers-guide/src/types/overseer-protocol.md index 799d1e2a7f8f..1e59eedff8db 100644 --- a/roadmap/implementers-guide/src/types/overseer-protocol.md +++ b/roadmap/implementers-guide/src/types/overseer-protocol.md @@ -86,9 +86,9 @@ enum BitfieldSigningMessage { } ```rust enum CandidateBackingMessage { - /// Registers a stream listener for updates to the set of backable candidates that could be backed - /// in a child of the given relay-parent, referenced by its hash. - RegisterBackingWatcher(Hash, TODO), + /// Requests a set of backable candidates that could be backed in a child of the given + /// relay-parent, referenced by its hash. + GetBackedCandidates(Hash, ResponseChannel>), /// Note that the Candidate Backing subsystem should second the given candidate in the context of the /// given relay-parent (ref. by hash). This candidate must be validated using the provided PoV. Second(Hash, CandidateReceipt, PoV), @@ -230,9 +230,24 @@ The Runtime API subsystem is responsible for providing an interface to the state Other subsystems query this data by sending these messages. ```rust +/// The information on validator groups, core assignments, +/// upcoming paras and availability cores. +struct SchedulerRoster { + /// Validator-to-groups assignments. + validator_groups: Vec>, + /// All scheduled paras. + scheduled: Vec, + /// Upcoming paras (chains and threads). + upcoming: Vec, + /// Occupied cores. + availability_cores: Vec>, +} + enum RuntimeApiRequest { /// Get the current validator set. Validators(ResponseChannel>), + /// Get the assignments of validators to cores, upcoming parachains. + SchedulerRoster(ResponseChannel), /// Get a signing context for bitfields and statements. SigningContext(ResponseChannel), /// Get the validation code for a specific para, assuming execution under given block number, and @@ -270,10 +285,26 @@ enum StatementDistributionMessage { Various modules request that the [Candidate Validation subsystem](../node/utility/candidate-validation.md) validate a block with this message ```rust + +/// Result of the validation of the candidate. +enum ValidationResult { + /// Candidate is valid. + Valid, + /// Candidate is invalid. + Invalid, +} + enum CandidateValidationMessage { /// Validate a candidate with provided parameters. Returns `Err` if an only if an internal - /// error is encountered. A bad candidate will return `Ok(false)`, while a good one will - /// return `Ok(true)`. - Validate(ValidationCode, CandidateReceipt, PoV, ResponseChannel>), + /// error is encountered. + /// In case no internal error was encontered it returns a tuple containing the result of + /// validation and `GlobalValidationSchedule` and `LocalValidationData` structures that + /// may be used by the caller to make the candidate available. + /// A bad candidate will return `Ok((ValidationResult::Invalid, _, _)`, while a good one will + /// return `Ok((ValidationResult::Valid, _, _))`. + Validate( + Hash, CandidateReceipt, HeadData, PoV, ResponseChannel< + Result<(ValidationResult, GlobalValidationSchedule, LocalValidationData)> + >), } ``` diff --git a/runtime/parachains/src/inclusion.rs b/runtime/parachains/src/inclusion.rs index 5819e3a06c47..33a5e2d1e919 100644 --- a/runtime/parachains/src/inclusion.rs +++ b/runtime/parachains/src/inclusion.rs @@ -25,7 +25,7 @@ use primitives::{ parachain::{ ValidatorId, AbridgedCandidateReceipt, ValidatorIndex, Id as ParaId, AvailabilityBitfield as AvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, - BackedCandidate, + BackedCandidate, CoreIndex, GroupIndex, CoreAssignment, }, }; use frame_support::{ @@ -38,7 +38,7 @@ use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec}; use sp_staking::SessionIndex; use sp_runtime::{DispatchError, traits::{One, Saturating}}; -use crate::{configuration, paras, scheduler::{CoreIndex, GroupIndex, CoreAssignment}}; +use crate::{configuration, paras}; /// A bitfield signed by a validator indicating that it is keeping its piece of the erasure-coding /// for any backed candidates referred to by a `1` bit available. @@ -498,7 +498,7 @@ mod tests { use primitives::{BlockNumber, Hash}; use primitives::parachain::{ SignedAvailabilityBitfield, CompactStatement as Statement, ValidityAttestation, CollatorId, - CandidateCommitments, SignedStatement, + CandidateCommitments, SignedStatement, AssignmentKind, }; use frame_support::traits::{OnFinalize, OnInitialize}; use keyring::Sr25519Keyring; @@ -510,7 +510,6 @@ mod tests { use crate::initializer::SessionChangeNotification; use crate::configuration::HostConfiguration; use crate::paras::ParaGenesisArgs; - use crate::scheduler::AssignmentKind; fn default_config() -> HostConfiguration { let mut config = HostConfiguration::default(); diff --git a/runtime/parachains/src/scheduler.rs b/runtime/parachains/src/scheduler.rs index 212c782d6463..772ab25cf4fd 100644 --- a/runtime/parachains/src/scheduler.rs +++ b/runtime/parachains/src/scheduler.rs @@ -38,7 +38,10 @@ use sp_std::prelude::*; use sp_std::convert::TryInto; use primitives::{ - parachain::{Id as ParaId, CollatorId, ValidatorIndex}, + parachain::{ + Id as ParaId, ValidatorIndex, CoreAssignment, CoreOccupied, CoreIndex, AssignmentKind, + GroupIndex, ParathreadClaim, ParathreadEntry, + }, }; use frame_support::{ decl_storage, decl_module, decl_error, @@ -52,41 +55,6 @@ use rand_chacha::ChaCha20Rng; use crate::{configuration, paras, initializer::SessionChangeNotification}; -/// The unique (during session) index of a core. -#[derive(Encode, Decode, Default, PartialOrd, Ord, Eq, PartialEq, Clone, Copy)] -#[cfg_attr(test, derive(Debug))] -pub struct CoreIndex(u32); - -impl From for CoreIndex { - fn from(i: u32) -> CoreIndex { - CoreIndex(i) - } -} - -/// The unique (during session) index of a validator group. -#[derive(Encode, Decode, Default, Clone, Copy)] -#[cfg_attr(test, derive(PartialEq, Debug))] -pub struct GroupIndex(u32); - -impl From for GroupIndex { - fn from(i: u32) -> GroupIndex { - GroupIndex(i) - } -} - -/// A claim on authoring the next block for a given parathread. -#[derive(Clone, Encode, Decode, Default)] -#[cfg_attr(test, derive(PartialEq, Debug))] -pub struct ParathreadClaim(pub ParaId, pub CollatorId); - -/// An entry tracking a claim to ensure it does not pass the maximum number of retries. -#[derive(Clone, Encode, Decode, Default)] -#[cfg_attr(test, derive(PartialEq, Debug))] -pub struct ParathreadEntry { - claim: ParathreadClaim, - retries: u32, -} - /// A queued parathread entry, pre-assigned to a core. #[derive(Encode, Decode, Default)] #[cfg_attr(test, derive(PartialEq, Debug))] @@ -125,58 +93,6 @@ impl ParathreadClaimQueue { } } -/// What is occupying a specific availability core. -#[derive(Clone, Encode, Decode)] -#[cfg_attr(test, derive(PartialEq, Debug))] -pub(crate) enum CoreOccupied { - Parathread(ParathreadEntry), - Parachain, -} - -/// The assignment type. -#[derive(Clone, Encode, Decode)] -#[cfg_attr(test, derive(PartialEq, Debug))] -pub enum AssignmentKind { - Parachain, - Parathread(CollatorId, u32), -} - -/// How a free core is scheduled to be assigned. -#[derive(Clone, Encode, Decode)] -#[cfg_attr(test, derive(PartialEq, Debug))] -pub struct CoreAssignment { - /// The core that is assigned. - pub core: CoreIndex, - /// The unique ID of the para that is assigned to the core. - pub para_id: ParaId, - /// The kind of the assignment. - pub kind: AssignmentKind, - /// The index of the validator group assigned to the core. - pub group_idx: GroupIndex, -} - -impl CoreAssignment { - /// Get the ID of a collator who is required to collate this block. - pub(crate) fn required_collator(&self) -> Option<&CollatorId> { - match self.kind { - AssignmentKind::Parachain => None, - AssignmentKind::Parathread(ref id, _) => Some(id), - } - } - - fn to_core_occupied(&self) -> CoreOccupied { - match self.kind { - AssignmentKind::Parachain => CoreOccupied::Parachain, - AssignmentKind::Parathread(ref collator, retries) => CoreOccupied::Parathread( - ParathreadEntry { - claim: ParathreadClaim(self.para_id, collator.clone()), - retries, - } - ), - } - } -} - /// Reasons a core might be freed pub enum FreedReason { /// The core's work concluded and the parablock assigned to it is considered available. @@ -670,7 +586,7 @@ impl Module { mod tests { use super::*; - use primitives::{BlockNumber, parachain::ValidatorId}; + use primitives::{BlockNumber, parachain::{CollatorId, ValidatorId}}; use frame_support::traits::{OnFinalize, OnInitialize}; use keyring::Sr25519Keyring; diff --git a/statement-table/src/generic.rs b/statement-table/src/generic.rs index 83cae9daf26b..11c6a3c02478 100644 --- a/statement-table/src/generic.rs +++ b/statement-table/src/generic.rs @@ -28,6 +28,8 @@ use std::collections::hash_map::{HashMap, Entry}; use std::hash::Hash; use std::fmt::Debug; +use primitives::parachain::{ValidityAttestation as PrimitiveValidityAttestation, ValidatorSignature}; + use codec::{Encode, Decode}; /// Context for the statement table. @@ -98,7 +100,7 @@ pub enum ValidityDoubleVote { /// Implicit vote by issuing and explicitly voting invalidity IssuedAndInvalidity((C, S), (D, S)), /// Direct votes for validity and invalidity - ValidityAndInvalidity(D, S, S), + ValidityAndInvalidity(C, S, S), } /// Misbehavior: multiple signatures on same statement. @@ -180,6 +182,15 @@ pub enum ValidityAttestation { Explicit(S), } +impl Into for ValidityAttestation { + fn into(self) -> PrimitiveValidityAttestation { + match self { + Self::Implicit(s) => PrimitiveValidityAttestation::Implicit(s), + Self::Explicit(s) => PrimitiveValidityAttestation::Explicit(s), + } + } +} + /// An attested-to candidate. #[derive(Clone, PartialEq, Decode, Encode)] pub struct AttestedCandidate { @@ -550,7 +561,7 @@ impl Table { // valid vote conflicting with invalid vote (ValidityVote::Valid(good), ValidityVote::Invalid(bad)) | (ValidityVote::Invalid(bad), ValidityVote::Valid(good)) => - make_vdv(ValidityDoubleVote::ValidityAndInvalidity(digest, good, bad)), + make_vdv(ValidityDoubleVote::ValidityAndInvalidity(votes.candidate.clone(), good, bad)), // two signatures on same candidate (ValidityVote::Issued(a), ValidityVote::Issued(b)) => @@ -817,7 +828,7 @@ mod tests { assert_eq!( table.detected_misbehavior.get(&AuthorityId(2)).unwrap(), &Misbehavior::ValidityDoubleVote(ValidityDoubleVote::ValidityAndInvalidity( - candidate_digest, + Candidate(2, 100), Signature(2), Signature(2), )) From 8845df228f6db595a76885e2ee25e58a598c9233 Mon Sep 17 00:00:00 2001 From: Andronik Ordian Date: Thu, 9 Jul 2020 22:25:40 +0200 Subject: [PATCH 6/9] Integrate all (dummy) subsystems with the Overseer (#1374) * overseer: introduce a utility typemap * it's ugly but it compiles * move DummySubsystem to subsystem crate * fix tests fallout * use a struct for all subsystems * more tests fallout * add missing pov_distribution subsystem * remove unused imports and bounds * fix minimal-example --- node/overseer/examples/minimal-example.rs | 25 +- node/overseer/src/lib.rs | 423 ++++++++++++++++++---- node/service/src/lib.rs | 53 +-- node/subsystem/src/lib.rs | 18 + node/subsystem/src/messages.rs | 12 +- 5 files changed, 425 insertions(+), 106 deletions(-) diff --git a/node/overseer/examples/minimal-example.rs b/node/overseer/examples/minimal-example.rs index aefb627f7f56..21e8eb3ab8fa 100644 --- a/node/overseer/examples/minimal-example.rs +++ b/node/overseer/examples/minimal-example.rs @@ -28,11 +28,14 @@ use futures_timer::Delay; use kv_log_macro as log; use polkadot_primitives::parachain::{BlockData, PoVBlock}; -use polkadot_overseer::Overseer; +use polkadot_overseer::{Overseer, AllSubsystems}; -use polkadot_subsystem::{Subsystem, SubsystemContext, SpawnedSubsystem, FromOverseer}; +use polkadot_subsystem::{ + Subsystem, SubsystemContext, DummySubsystem, + SpawnedSubsystem, FromOverseer, +}; use polkadot_subsystem::messages::{ - AllMessages, CandidateBackingMessage, CandidateValidationMessage + CandidateValidationMessage, CandidateBackingMessage, AllMessages, }; struct Subsystem1; @@ -128,10 +131,22 @@ fn main() { Delay::new(Duration::from_secs(1)).await; }); + let all_subsystems = AllSubsystems { + candidate_validation: Subsystem2, + candidate_backing: Subsystem1, + candidate_selection: DummySubsystem, + statement_distribution: DummySubsystem, + availability_distribution: DummySubsystem, + bitfield_distribution: DummySubsystem, + provisioner: DummySubsystem, + pov_distribution: DummySubsystem, + runtime_api: DummySubsystem, + availability_store: DummySubsystem, + network_bridge: DummySubsystem, + }; let (overseer, _handler) = Overseer::new( vec![], - Subsystem2, - Subsystem1, + all_subsystems, spawner, ).unwrap(); let overseer_fut = overseer.run().fuse(); diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index ffebf33ce4f9..458aae91e871 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -76,7 +76,11 @@ use polkadot_primitives::{Block, BlockNumber, Hash}; use client::{BlockImportNotification, BlockchainEvents, FinalityNotification}; use polkadot_subsystem::messages::{ - CandidateValidationMessage, CandidateBackingMessage, AllMessages + CandidateValidationMessage, CandidateBackingMessage, + CandidateSelectionMessage, StatementDistributionMessage, + AvailabilityDistributionMessage, BitfieldDistributionMessage, + ProvisionerMessage, PoVDistributionMessage, RuntimeApiMessage, + AvailabilityStoreMessage, NetworkBridgeMessage, AllMessages, }; pub use polkadot_subsystem::{ Subsystem, SubsystemContext, OverseerSignal, FromOverseer, SubsystemError, SubsystemResult, @@ -319,12 +323,40 @@ struct OverseenSubsystem { /// The `Overseer` itself. pub struct Overseer { - /// A validation subsystem - validation_subsystem: OverseenSubsystem, + /// A candidate validation subsystem. + candidate_validation_subsystem: OverseenSubsystem, - /// A candidate backing subsystem + /// A candidate backing subsystem. candidate_backing_subsystem: OverseenSubsystem, + /// A candidate selection subsystem. + candidate_selection_subsystem: OverseenSubsystem, + + /// A statement distribution subsystem. + statement_distribution_subsystem: OverseenSubsystem, + + /// An availability distribution subsystem. + availability_distribution_subsystem: OverseenSubsystem, + + /// A bitfield distribution subsystem. + bitfield_distribution_subsystem: OverseenSubsystem, + + /// A provisioner subsystem. + provisioner_subsystem: OverseenSubsystem, + + /// A PoV distribution subsystem. + pov_distribution_subsystem: OverseenSubsystem, + + /// A runtime API subsystem. + runtime_api_subsystem: OverseenSubsystem, + + /// An availability store subsystem. + availability_store_subsystem: OverseenSubsystem, + + /// A network bridge subsystem. + network_bridge_subsystem: OverseenSubsystem, + + /// Spawner to spawn tasks to. s: S, @@ -346,22 +378,48 @@ pub struct Overseer { active_leaves: HashSet<(Hash, BlockNumber)>, } +/// This struct is passed as an argument to create a new instance of an [`Overseer`]. +/// +/// As any entity that satisfies the interface may act as a [`Subsystem`] this allows +/// mocking in the test code: +/// +/// Each [`Subsystem`] is supposed to implement some interface that is generic over +/// message type that is specific to this [`Subsystem`]. At the moment not all +/// subsystems are implemented and the rest can be mocked with the [`DummySubsystem`]. +/// +/// [`Subsystem`]: trait.Subsystem.html +/// [`DummySubsystem`]: struct.DummySubsystem.html +pub struct AllSubsystems { + /// A candidate validation subsystem. + pub candidate_validation: CV, + /// A candidate backing subsystem. + pub candidate_backing: CB, + /// A candidate selection subsystem. + pub candidate_selection: CS, + /// A statement distribution subsystem. + pub statement_distribution: SD, + /// An availability distribution subsystem. + pub availability_distribution: AD, + /// A bitfield distribution subsystem. + pub bitfield_distribution: BD, + /// A provisioner subsystem. + pub provisioner: P, + /// A PoV distribution subsystem. + pub pov_distribution: PoVD, + /// A runtime API subsystem. + pub runtime_api: RA, + /// An availability store subsystem. + pub availability_store: AS, + /// A network bridge subsystem. + pub network_bridge: NB, +} + impl Overseer where S: Spawn, { /// Create a new intance of the `Overseer` with a fixed set of [`Subsystem`]s. /// - /// Each [`Subsystem`] is passed to this function as an explicit parameter - /// and is supposed to implement some interface that is generic over message type - /// that is specific to this [`Subsystem`]. At the moment there are only two - /// subsystems: - /// * Validation - /// * CandidateBacking - /// - /// As any entity that satisfies the interface may act as a [`Subsystem`] this allows - /// mocking in the test code: - /// /// ```text /// +------------------------------------+ /// | Overseer | @@ -388,16 +446,16 @@ where /// # Example /// /// The [`Subsystems`] may be any type as long as they implement an expected interface. - /// Here, we create two mock subsystems and start the `Overseer` with them. For the sake - /// of simplicity the termination of the example is done with a timeout. + /// Here, we create a mock validation subsystem and a few dummy ones and start the `Overseer` with them. + /// For the sake of simplicity the termination of the example is done with a timeout. /// ``` /// # use std::time::Duration; /// # use futures::{executor, pin_mut, select, FutureExt}; /// # use futures_timer::Delay; - /// # use polkadot_overseer::Overseer; + /// # use polkadot_overseer::{Overseer, AllSubsystems}; /// # use polkadot_subsystem::{ - /// # Subsystem, SpawnedSubsystem, SubsystemContext, - /// # messages::{CandidateValidationMessage, CandidateBackingMessage}, + /// # Subsystem, DummySubsystem, SpawnedSubsystem, SubsystemContext, + /// # messages::CandidateValidationMessage, /// # }; /// /// struct ValidationSubsystem; @@ -417,28 +475,24 @@ where /// } /// } /// - /// struct CandidateBackingSubsystem; - /// impl Subsystem for CandidateBackingSubsystem - /// where C: SubsystemContext - /// { - /// fn start( - /// self, - /// mut ctx: C, - /// ) -> SpawnedSubsystem { - /// SpawnedSubsystem(Box::pin(async move { - /// loop { - /// Delay::new(Duration::from_secs(1)).await; - /// } - /// })) - /// } - /// } - /// /// # fn main() { executor::block_on(async move { /// let spawner = executor::ThreadPool::new().unwrap(); + /// let all_subsystems = AllSubsystems { + /// candidate_validation: ValidationSubsystem, + /// candidate_backing: DummySubsystem, + /// candidate_selection: DummySubsystem, + /// statement_distribution: DummySubsystem, + /// availability_distribution: DummySubsystem, + /// bitfield_distribution: DummySubsystem, + /// provisioner: DummySubsystem, + /// pov_distribution: DummySubsystem, + /// runtime_api: DummySubsystem, + /// availability_store: DummySubsystem, + /// network_bridge: DummySubsystem, + /// }; /// let (overseer, _handler) = Overseer::new( /// vec![], - /// ValidationSubsystem, - /// CandidateBackingSubsystem, + /// all_subsystems, /// spawner, /// ).unwrap(); /// @@ -455,12 +509,24 @@ where /// # /// # }); } /// ``` - pub fn new( + pub fn new( leaves: impl IntoIterator, - validation: impl Subsystem> + Send, - candidate_backing: impl Subsystem> + Send, + all_subsystems: AllSubsystems, mut s: S, - ) -> SubsystemResult<(Self, OverseerHandler)> { + ) -> SubsystemResult<(Self, OverseerHandler)> + where + CV: Subsystem> + Send, + CB: Subsystem> + Send, + CS: Subsystem> + Send, + SD: Subsystem> + Send, + AD: Subsystem> + Send, + BD: Subsystem> + Send, + P: Subsystem> + Send, + PoVD: Subsystem> + Send, + RA: Subsystem> + Send, + AS: Subsystem> + Send, + NB: Subsystem> + Send, + { let (events_tx, events_rx) = mpsc::channel(CHANNEL_CAPACITY); let handler = OverseerHandler { @@ -470,18 +536,81 @@ where let mut running_subsystems_rx = StreamUnordered::new(); let mut running_subsystems = FuturesUnordered::new(); - let validation_subsystem = spawn( + let candidate_validation_subsystem = spawn( &mut s, &mut running_subsystems, &mut running_subsystems_rx, - validation, + all_subsystems.candidate_validation, )?; let candidate_backing_subsystem = spawn( &mut s, &mut running_subsystems, &mut running_subsystems_rx, - candidate_backing, + all_subsystems.candidate_backing, + )?; + + let candidate_selection_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.candidate_selection, + )?; + + let statement_distribution_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.statement_distribution, + )?; + + let availability_distribution_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.availability_distribution, + )?; + + let bitfield_distribution_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.bitfield_distribution, + )?; + + let provisioner_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.provisioner, + )?; + + let pov_distribution_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.pov_distribution, + )?; + + let runtime_api_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.runtime_api, + )?; + + let availability_store_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.availability_store, + )?; + + let network_bridge_subsystem = spawn( + &mut s, + &mut running_subsystems, + &mut running_subsystems_rx, + all_subsystems.network_bridge, )?; let active_leaves = HashSet::new(); @@ -492,8 +621,17 @@ where .collect(); let this = Self { - validation_subsystem, + candidate_validation_subsystem, candidate_backing_subsystem, + candidate_selection_subsystem, + statement_distribution_subsystem, + availability_distribution_subsystem, + bitfield_distribution_subsystem, + provisioner_subsystem, + pov_distribution_subsystem, + runtime_api_subsystem, + availability_store_subsystem, + network_bridge_subsystem, s, running_subsystems, running_subsystems_rx, @@ -507,7 +645,7 @@ where // Stop the overseer. async fn stop(mut self) { - if let Some(ref mut s) = self.validation_subsystem.instance { + if let Some(ref mut s) = self.candidate_validation_subsystem.instance { let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; } @@ -515,6 +653,42 @@ where let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; } + if let Some(ref mut s) = self.candidate_selection_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + + if let Some(ref mut s) = self.statement_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + + if let Some(ref mut s) = self.availability_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + + if let Some(ref mut s) = self.bitfield_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + + if let Some(ref mut s) = self.provisioner_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + + if let Some(ref mut s) = self.pov_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + + if let Some(ref mut s) = self.runtime_api_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + + if let Some(ref mut s) = self.availability_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + + if let Some(ref mut s) = self.network_bridge_subsystem.instance { + let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + } + let mut stop_delay = Delay::new(Duration::from_secs(STOP_DELAY)).fuse(); loop { @@ -616,11 +790,47 @@ where } async fn broadcast_signal(&mut self, signal: OverseerSignal) -> SubsystemResult<()> { - if let Some(ref mut s) = self.validation_subsystem.instance { + if let Some(ref mut s) = self.candidate_validation_subsystem.instance { s.tx.send(FromOverseer::Signal(signal.clone())).await?; } if let Some(ref mut s) = self.candidate_backing_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.candidate_selection_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.statement_distribution_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.availability_distribution_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.bitfield_distribution_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.provisioner_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.pov_distribution_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.runtime_api_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.availability_store_subsystem.instance { + s.tx.send(FromOverseer::Signal(signal.clone())).await?; + } + + if let Some(ref mut s) = self.network_bridge_subsystem.instance { s.tx.send(FromOverseer::Signal(signal)).await?; } @@ -630,7 +840,7 @@ where async fn route_message(&mut self, msg: AllMessages) { match msg { AllMessages::CandidateValidation(msg) => { - if let Some(ref mut s) = self.validation_subsystem.instance { + if let Some(ref mut s) = self.candidate_validation_subsystem.instance { let _= s.tx.send(FromOverseer::Communication { msg }).await; } } @@ -639,11 +849,50 @@ where let _ = s.tx.send(FromOverseer::Communication { msg }).await; } } - _ => { - // TODO: temporary catch-all until all subsystems are integrated with overseer. - // The overseer is not complete until this is an exhaustive match with all - // messages targeting an included subsystem. - // https://github.com/paritytech/polkadot/issues/1317 + AllMessages::CandidateSelection(msg) => { + if let Some(ref mut s) = self.candidate_selection_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } + } + AllMessages::StatementDistribution(msg) => { + if let Some(ref mut s) = self.statement_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } + } + AllMessages::AvailabilityDistribution(msg) => { + if let Some(ref mut s) = self.availability_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } + } + AllMessages::BitfieldDistribution(msg) => { + if let Some(ref mut s) = self.bitfield_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } + } + AllMessages::Provisioner(msg) => { + if let Some(ref mut s) = self.provisioner_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } + } + AllMessages::PoVDistribution(msg) => { + if let Some(ref mut s) = self.pov_distribution_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } + } + AllMessages::RuntimeApi(msg) => { + if let Some(ref mut s) = self.runtime_api_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } + } + AllMessages::AvailabilityStore(msg) => { + if let Some(ref mut s) = self.availability_store_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } + } + AllMessages::NetworkBridge(msg) => { + if let Some(ref mut s) = self.network_bridge_subsystem.instance { + let _ = s.tx.send(FromOverseer::Communication { msg }).await; + } } } } @@ -678,13 +927,16 @@ fn spawn( }) } + #[cfg(test)] mod tests { use futures::{executor, pin_mut, select, channel::mpsc, FutureExt}; use polkadot_primitives::parachain::{BlockData, PoVBlock}; + use polkadot_subsystem::DummySubsystem; use super::*; + struct TestSubsystem1(mpsc::Sender); impl Subsystem for TestSubsystem1 @@ -776,10 +1028,22 @@ mod tests { let (s1_tx, mut s1_rx) = mpsc::channel(64); let (s2_tx, mut s2_rx) = mpsc::channel(64); + let all_subsystems = AllSubsystems { + candidate_validation: TestSubsystem1(s1_tx), + candidate_backing: TestSubsystem2(s2_tx), + candidate_selection: DummySubsystem, + statement_distribution: DummySubsystem, + availability_distribution: DummySubsystem, + bitfield_distribution: DummySubsystem, + provisioner: DummySubsystem, + pov_distribution: DummySubsystem, + runtime_api: DummySubsystem, + availability_store: DummySubsystem, + network_bridge: DummySubsystem, + }; let (overseer, mut handler) = Overseer::new( vec![], - TestSubsystem1(s1_tx), - TestSubsystem2(s2_tx), + all_subsystems, spawner, ).unwrap(); let overseer_fut = overseer.run().fuse(); @@ -826,10 +1090,22 @@ mod tests { executor::block_on(async move { let (s1_tx, _) = mpsc::channel(64); + let all_subsystems = AllSubsystems { + candidate_validation: TestSubsystem1(s1_tx), + candidate_backing: TestSubsystem4, + candidate_selection: DummySubsystem, + statement_distribution: DummySubsystem, + availability_distribution: DummySubsystem, + bitfield_distribution: DummySubsystem, + provisioner: DummySubsystem, + pov_distribution: DummySubsystem, + runtime_api: DummySubsystem, + availability_store: DummySubsystem, + network_bridge: DummySubsystem, + }; let (overseer, _handle) = Overseer::new( vec![], - TestSubsystem1(s1_tx), - TestSubsystem4, + all_subsystems, spawner, ).unwrap(); let overseer_fut = overseer.run().fuse(); @@ -923,11 +1199,22 @@ mod tests { let (tx_5, mut rx_5) = mpsc::channel(64); let (tx_6, mut rx_6) = mpsc::channel(64); - + let all_subsystems = AllSubsystems { + candidate_validation: TestSubsystem5(tx_5), + candidate_backing: TestSubsystem6(tx_6), + candidate_selection: DummySubsystem, + statement_distribution: DummySubsystem, + availability_distribution: DummySubsystem, + bitfield_distribution: DummySubsystem, + provisioner: DummySubsystem, + pov_distribution: DummySubsystem, + runtime_api: DummySubsystem, + availability_store: DummySubsystem, + network_bridge: DummySubsystem, + }; let (overseer, mut handler) = Overseer::new( vec![first_block], - TestSubsystem5(tx_5), - TestSubsystem6(tx_6), + all_subsystems, spawner, ).unwrap(); @@ -1008,11 +1295,23 @@ mod tests { let (tx_5, mut rx_5) = mpsc::channel(64); let (tx_6, mut rx_6) = mpsc::channel(64); + let all_subsystems = AllSubsystems { + candidate_validation: TestSubsystem5(tx_5), + candidate_backing: TestSubsystem6(tx_6), + candidate_selection: DummySubsystem, + statement_distribution: DummySubsystem, + availability_distribution: DummySubsystem, + bitfield_distribution: DummySubsystem, + provisioner: DummySubsystem, + pov_distribution: DummySubsystem, + runtime_api: DummySubsystem, + availability_store: DummySubsystem, + network_bridge: DummySubsystem, + }; // start with two forks of different height. let (overseer, mut handler) = Overseer::new( vec![first_block, second_block], - TestSubsystem5(tx_5), - TestSubsystem6(tx_6), + all_subsystems, spawner, ).unwrap(); diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 772481672ad5..8a435e6b595b 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -29,11 +29,8 @@ use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider}; use sc_executor::native_executor_instance; use log::info; use sp_blockchain::HeaderBackend; -use polkadot_overseer::{self as overseer, BlockInfo, Overseer, OverseerHandler}; -use polkadot_subsystem::{ - Subsystem, SubsystemContext, SpawnedSubsystem, - messages::{CandidateValidationMessage, CandidateBackingMessage}, -}; +use polkadot_overseer::{self as overseer, AllSubsystems, BlockInfo, Overseer, OverseerHandler}; +use polkadot_subsystem::DummySubsystem; use polkadot_node_core_proposer::ProposerFactory; use sp_trie::PrefixedMemoryDB; pub use service::{ @@ -275,38 +272,28 @@ macro_rules! new_full_start { }} } -struct CandidateValidationSubsystem; - -impl Subsystem for CandidateValidationSubsystem - where C: SubsystemContext -{ - fn start(self, mut ctx: C) -> SpawnedSubsystem { - SpawnedSubsystem(Box::pin(async move { - while let Ok(_) = ctx.recv().await {} - })) - } -} - -struct CandidateBackingSubsystem; - -impl Subsystem for CandidateBackingSubsystem - where C: SubsystemContext -{ - fn start(self, mut ctx: C) -> SpawnedSubsystem { - SpawnedSubsystem(Box::pin(async move { - while let Ok(_) = ctx.recv().await {} - })) - } -} - fn real_overseer( leaves: impl IntoIterator, s: S, ) -> Result<(Overseer, OverseerHandler), ServiceError> { - let validation = CandidateValidationSubsystem; - let candidate_backing = CandidateBackingSubsystem; - Overseer::new(leaves, validation, candidate_backing, s) - .map_err(|e| ServiceError::Other(format!("Failed to create an Overseer: {:?}", e))) + let all_subsystems = AllSubsystems { + candidate_validation: DummySubsystem, + candidate_backing: DummySubsystem, + candidate_selection: DummySubsystem, + statement_distribution: DummySubsystem, + availability_distribution: DummySubsystem, + bitfield_distribution: DummySubsystem, + provisioner: DummySubsystem, + pov_distribution: DummySubsystem, + runtime_api: DummySubsystem, + availability_store: DummySubsystem, + network_bridge: DummySubsystem, + }; + Overseer::new( + leaves, + all_subsystems, + s, + ).map_err(|e| ServiceError::Other(format!("Failed to create an Overseer: {:?}", e))) } /// Builds a new service for a full client. diff --git a/node/subsystem/src/lib.rs b/node/subsystem/src/lib.rs index fd32d7cfdbc9..db9a0629cfd4 100644 --- a/node/subsystem/src/lib.rs +++ b/node/subsystem/src/lib.rs @@ -148,3 +148,21 @@ pub trait Subsystem { /// Start this `Subsystem` and return `SpawnedSubsystem`. fn start(self, ctx: C) -> SpawnedSubsystem; } + +/// A dummy subsystem that implements [`Subsystem`] for all +/// types of messages. Used for tests or as a placeholder. +pub struct DummySubsystem; + +impl Subsystem for DummySubsystem { + fn start(self, mut ctx: C) -> SpawnedSubsystem { + SpawnedSubsystem(Box::pin(async move { + loop { + match ctx.recv().await { + Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return, + Err(_) => return, + _ => continue, + } + } + })) + } +} diff --git a/node/subsystem/src/messages.rs b/node/subsystem/src/messages.rs index c98658e4aeab..36c293e49fe9 100644 --- a/node/subsystem/src/messages.rs +++ b/node/subsystem/src/messages.rs @@ -246,12 +246,12 @@ pub enum PoVDistributionMessage { /// /// This `CandidateDescriptor` should correspond to a candidate seconded under the provided /// relay-parent hash. - FetchPoV(Hash, CandidateDescriptor, oneshot::Sender>), - /// Distribute a PoV for the given relay-parent and CandidateDescriptor. - /// The PoV should correctly hash to the PoV hash mentioned in the CandidateDescriptor - DistributePoV(Hash, CandidateDescriptor, Arc), - /// An update from the network bridge. - NetworkBridgeUpdate(NetworkBridgeEvent), + FetchPoV(Hash, CandidateDescriptor, oneshot::Sender>), + /// Distribute a PoV for the given relay-parent and CandidateDescriptor. + /// The PoV should correctly hash to the PoV hash mentioned in the CandidateDescriptor + DistributePoV(Hash, CandidateDescriptor, Arc), + /// An update from the network bridge. + NetworkBridgeUpdate(NetworkBridgeEvent), } /// A message type tying together all message types that are used across Subsystems. From 96af6eadd5649e7faef75ddfe3cc181bd1567155 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 9 Jul 2020 21:23:03 -0400 Subject: [PATCH 7/9] Refactor primitives (#1383) * create a v1 primitives module * Improve guide on availability types * punctuate * new parachains runtime uses new primitives * tests of new runtime now use new primitives * add ErasureChunk to guide * export erasure chunk from v1 primitives * subsystem crate uses v1 primitives * node-primitives uses new v1 primitives * port overseer to new primitives * new-proposer uses v1 primitives (no ParachainHost anymore) * fix no-std compilation for primitives * service-new uses v1 primitives * network-bridge uses new primitives * statement distribution uses v1 primitives * PoV distribution uses v1 primitives; add PoV::hash fn * move parachain to v0 * remove inclusion_inherent module and place into v1 * remove everything from primitives crate root * remove some unused old types from v0 primitives * point everything else at primitives::v0 * squanch some warns up * add RuntimeDebug import to no-std as well * port over statement-table and validation * fix final errors in validation and node-primitives * add dummy Ord impl to committed candidate receipt * guide: update CandidateValidationMessage * add primitive for validationoutputs * expand CandidateValidationMessage further * bikeshed * add some impls to omitted-validation-data and available-data * expand CandidateValidationMessage * make erasure-coding generic over v1/v0 * update usages of erasure-coding * implement commitments.hash() * use Arc for CandidateValidation * improve new erasure-coding method names * fix up candidate backing * update docs a bit * fix most tests and add short-circuiting to make_pov_available * fix remainder of candidate backing tests * squanching warns * squanch it up * some fallout * overseer fallout * free from polkadot-test-service hell --- availability-store/src/lib.rs | 8 +- availability-store/src/store.rs | 13 +- availability-store/src/worker.rs | 4 +- collator/src/lib.rs | 21 +- core-primitives/src/lib.rs | 5 + erasure-coding/src/lib.rs | 63 +- network/src/legacy/collator_pool.rs | 5 +- network/src/legacy/gossip/attestation.rs | 2 +- network/src/legacy/gossip/mod.rs | 6 +- network/src/legacy/local_collations.rs | 4 +- network/src/legacy/mod.rs | 2 +- network/src/lib.rs | 2 +- network/src/protocol/mod.rs | 8 +- network/src/protocol/tests.rs | 6 +- node/core/backing/src/lib.rs | 600 ++++++++++-------- node/core/proposer/src/lib.rs | 12 +- node/network/bridge/src/lib.rs | 2 +- node/network/pov-distribution/src/lib.rs | 5 +- .../network/statement-distribution/src/lib.rs | 37 +- node/overseer/examples/minimal-example.rs | 12 +- node/overseer/src/lib.rs | 12 +- node/primitives/src/lib.rs | 52 +- node/service/src/chain_spec.rs | 6 +- node/service/src/grandpa_support.rs | 4 +- node/service/src/lib.rs | 15 +- node/subsystem/src/lib.rs | 2 +- node/subsystem/src/messages.rs | 64 +- node/test-service/src/chain_spec.rs | 2 +- node/test-service/src/lib.rs | 9 +- .../adder/collator/src/main.rs | 4 +- primitives/src/inclusion_inherent.rs | 23 - primitives/src/lib.rs | 57 +- primitives/src/{parachain.rs => v0.rs} | 244 ++----- primitives/src/v1.rs | 478 ++++++++++++++ .../src/types/availability.md | 49 +- .../implementers-guide/src/types/candidate.md | 22 + .../src/types/overseer-protocol.md | 41 +- rpc/src/lib.rs | 2 +- runtime/common/src/attestations.rs | 2 +- runtime/common/src/claims.rs | 2 +- runtime/common/src/crowdfund.rs | 4 +- runtime/common/src/impls.rs | 4 +- runtime/common/src/lib.rs | 2 +- runtime/common/src/parachains.rs | 34 +- runtime/common/src/registrar.rs | 16 +- runtime/common/src/slots.rs | 5 +- runtime/kusama/src/constants.rs | 6 +- runtime/kusama/src/lib.rs | 13 +- runtime/parachains/src/configuration.rs | 4 +- runtime/parachains/src/inclusion.rs | 211 +++--- runtime/parachains/src/inclusion_inherent.rs | 7 +- runtime/parachains/src/initializer.rs | 4 +- runtime/parachains/src/mock.rs | 5 +- runtime/parachains/src/paras.rs | 6 +- runtime/parachains/src/scheduler.rs | 10 +- runtime/polkadot/src/constants.rs | 6 +- runtime/polkadot/src/lib.rs | 13 +- runtime/polkadot/tests/weights.rs | 2 +- runtime/test-runtime/client/src/lib.rs | 2 +- runtime/test-runtime/src/constants.rs | 6 +- runtime/test-runtime/src/lib.rs | 11 +- runtime/westend/src/constants.rs | 6 +- runtime/westend/src/lib.rs | 13 +- service/src/chain_spec.rs | 6 +- service/src/grandpa_support.rs | 4 +- service/src/lib.rs | 5 +- statement-table/src/generic.rs | 2 +- statement-table/src/lib.rs | 144 +++-- validation/src/block_production.rs | 4 +- validation/src/collation.rs | 6 +- validation/src/error.rs | 4 +- validation/src/lib.rs | 2 +- validation/src/pipeline.rs | 6 +- validation/src/shared_table/includable.rs | 2 +- validation/src/shared_table/mod.rs | 57 +- validation/src/validation_service/mod.rs | 8 +- 76 files changed, 1545 insertions(+), 1002 deletions(-) delete mode 100644 primitives/src/inclusion_inherent.rs rename primitives/src/{parachain.rs => v0.rs} (83%) create mode 100644 primitives/src/v1.rs diff --git a/availability-store/src/lib.rs b/availability-store/src/lib.rs index 7abc444758f7..4b973c7d0271 100644 --- a/availability-store/src/lib.rs +++ b/availability-store/src/lib.rs @@ -25,12 +25,10 @@ use futures::prelude::*; use futures::channel::{mpsc, oneshot}; use keystore::KeyStorePtr; -use polkadot_primitives::{ +use polkadot_primitives::v0::{ Hash, Block, - parachain::{ - PoVBlock, AbridgedCandidateReceipt, ErasureChunk, - ParachainHost, AvailableData, OmittedValidationData, - }, + PoVBlock, AbridgedCandidateReceipt, ErasureChunk, + ParachainHost, AvailableData, OmittedValidationData, }; use sp_runtime::traits::HashFor; use sp_blockchain::Result as ClientResult; diff --git a/availability-store/src/store.rs b/availability-store/src/store.rs index 851beabc6ac8..cd76de5d44ad 100644 --- a/availability-store/src/store.rs +++ b/availability-store/src/store.rs @@ -19,11 +19,8 @@ use kvdb_rocksdb::{Database, DatabaseConfig}; use kvdb::{KeyValueDB, DBTransaction}; use codec::{Encode, Decode}; use polkadot_erasure_coding as erasure; -use polkadot_primitives::{ - Hash, - parachain::{ - ErasureChunk, AvailableData, AbridgedCandidateReceipt, - }, +use polkadot_primitives::v0::{ + Hash, ErasureChunk, AvailableData, AbridgedCandidateReceipt, }; use parking_lot::Mutex; @@ -273,7 +270,7 @@ impl Store { // If there are no block data in the store at this point, // check that they can be reconstructed now and add them to store if they can. if self.execution_data(&candidate_hash).is_none() { - if let Ok(available_data) = erasure::reconstruct( + if let Ok(available_data) = erasure::reconstruct_v0( n_validators as usize, v.iter().map(|chunk| (chunk.chunk.as_ref(), chunk.index as usize)), ) @@ -390,7 +387,7 @@ impl Store { mod tests { use super::*; use polkadot_erasure_coding::{self as erasure}; - use polkadot_primitives::parachain::{ + use polkadot_primitives::v0::{ Id as ParaId, BlockData, AvailableData, PoVBlock, OmittedValidationData, }; @@ -489,7 +486,7 @@ mod tests { let available_data = available_data(&[42; 8]); let n_validators = 5; - let erasure_chunks = erasure::obtain_chunks( + let erasure_chunks = erasure::obtain_chunks_v0( n_validators, &available_data, ).unwrap(); diff --git a/availability-store/src/worker.rs b/availability-store/src/worker.rs index 8a3898579f54..a7cf7ec41dae 100644 --- a/availability-store/src/worker.rs +++ b/availability-store/src/worker.rs @@ -33,8 +33,8 @@ use consensus_common::{ import_queue::CacheKeyId, }; use sp_core::traits::SpawnNamed; -use polkadot_primitives::{Block, BlockId, Hash}; -use polkadot_primitives::parachain::{ +use polkadot_primitives::v0::{ + Block, BlockId, Hash, ParachainHost, ValidatorId, AbridgedCandidateReceipt, AvailableData, ValidatorPair, ErasureChunk, }; diff --git a/collator/src/lib.rs b/collator/src/lib.rs index 0215b33ee6a1..663cb825bfc1 100644 --- a/collator/src/lib.rs +++ b/collator/src/lib.rs @@ -55,12 +55,11 @@ use log::warn; use sc_client_api::{StateBackend, BlockchainEvents}; use sp_blockchain::HeaderBackend; use sp_core::Pair; -use polkadot_primitives::{ +use polkadot_primitives::v0::{ BlockId, Hash, Block, DownwardMessage, - parachain::{ - self, BlockData, DutyRoster, HeadData, Id as ParaId, - PoVBlock, ValidatorId, CollatorPair, LocalValidationData, GlobalValidationSchedule, - } + BlockData, DutyRoster, HeadData, Id as ParaId, + PoVBlock, ValidatorId, CollatorPair, LocalValidationData, GlobalValidationSchedule, + Collation, CollationInfo, collator_signature_payload, }; use polkadot_cli::{ ProvideRuntimeApi, ParachainHost, IdentifyVariant, @@ -69,7 +68,7 @@ use polkadot_cli::{ pub use polkadot_cli::service::Configuration; pub use polkadot_cli::Cli; pub use polkadot_validation::SignedStatement; -pub use polkadot_primitives::parachain::CollatorId; +pub use polkadot_primitives::v0::CollatorId; pub use sc_network::PeerId; pub use service::RuntimeApiCollection; pub use sc_cli::SubstrateCli; @@ -164,7 +163,7 @@ pub async fn collate

( downward_messages: Vec, mut para_context: P, key: Arc, -) -> Option +) -> Option where P: ParachainContext, P::ProduceCandidate: Send, @@ -181,13 +180,13 @@ pub async fn collate

( }; let pov_block_hash = pov_block.hash(); - let signature = key.sign(¶chain::collator_signature_payload( + let signature = key.sign(&collator_signature_payload( &relay_parent, &local_id, &pov_block_hash, )); - let info = parachain::CollationInfo { + let info = CollationInfo { parachain_index: local_id, relay_parent, collator: key.public(), @@ -196,7 +195,7 @@ pub async fn collate

( pov_block_hash, }; - let collation = parachain::Collation { + let collation = Collation { info, pov: pov_block, }; @@ -456,7 +455,7 @@ where #[cfg(not(feature = "service-rewr"))] fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRoster) -> HashSet { - use polkadot_primitives::parachain::Chain; + use polkadot_primitives::v0::Chain; roster.validator_duty.iter().enumerate() .filter(|&(_, c)| c == &Chain::Parachain(para_id)) diff --git a/core-primitives/src/lib.rs b/core-primitives/src/lib.rs index d91ed3cfc197..ffb346467d9e 100644 --- a/core-primitives/src/lib.rs +++ b/core-primitives/src/lib.rs @@ -94,3 +94,8 @@ pub enum DownwardMessage { /// XCMP message for the Parachain. XCMPMessage(sp_std::vec::Vec), } + +/// V1 primitives. +pub mod v1 { + pub use super::*; +} diff --git a/erasure-coding/src/lib.rs b/erasure-coding/src/lib.rs index 98a2776d8848..708a167d6276 100644 --- a/erasure-coding/src/lib.rs +++ b/erasure-coding/src/lib.rs @@ -26,8 +26,8 @@ use codec::{Encode, Decode}; use reed_solomon::galois_16::{self, ReedSolomon}; -use primitives::{Hash as H256, BlakeTwo256, HashT}; -use primitives::parachain::AvailableData; +use primitives::v0::{self, Hash as H256, BlakeTwo256, HashT}; +use primitives::v1; use sp_core::Blake2Hasher; use trie::{EMPTY_PREFIX, MemoryDB, Trie, TrieMut, trie_types::{TrieDBMut, TrieDB}}; @@ -124,14 +124,32 @@ fn code_params(n_validators: usize) -> Result { }) } +/// Obtain erasure-coded chunks for v0 `AvailableData`, one for each validator. +/// +/// Works only up to 65536 validators, and `n_validators` must be non-zero. +pub fn obtain_chunks_v0(n_validators: usize, data: &v0::AvailableData) + -> Result>, Error> +{ + obtain_chunks(n_validators, data) +} + +/// Obtain erasure-coded chunks for v1 `AvailableData`, one for each validator. +/// +/// Works only up to 65536 validators, and `n_validators` must be non-zero. +pub fn obtain_chunks_v1(n_validators: usize, data: &v1::AvailableData) + -> Result>, Error> +{ + obtain_chunks(n_validators, data) +} + /// Obtain erasure-coded chunks, one for each validator. /// /// Works only up to 65536 validators, and `n_validators` must be non-zero. -pub fn obtain_chunks(n_validators: usize, available_data: &AvailableData) +fn obtain_chunks(n_validators: usize, data: &T) -> Result>, Error> { let params = code_params(n_validators)?; - let encoded = available_data.encode(); + let encoded = data.encode(); if encoded.is_empty() { return Err(Error::BadPayload); @@ -145,15 +163,42 @@ pub fn obtain_chunks(n_validators: usize, available_data: &AvailableData) Ok(shards.into_iter().map(|w| w.into_inner()).collect()) } -/// Reconstruct the block data from a set of chunks. +/// Reconstruct the v0 available data from a set of chunks. +/// +/// Provide an iterator containing chunk data and the corresponding index. +/// The indices of the present chunks must be indicated. If too few chunks +/// are provided, recovery is not possible. +/// +/// Works only up to 65536 validators, and `n_validators` must be non-zero. +pub fn reconstruct_v0<'a, I: 'a>(n_validators: usize, chunks: I) + -> Result + where I: IntoIterator +{ + reconstruct(n_validators, chunks) +} + +/// Reconstruct the v1 available data from a set of chunks. +/// +/// Provide an iterator containing chunk data and the corresponding index. +/// The indices of the present chunks must be indicated. If too few chunks +/// are provided, recovery is not possible. +/// +/// Works only up to 65536 validators, and `n_validators` must be non-zero. +pub fn reconstruct_v1<'a, I: 'a>(n_validators: usize, chunks: I) + -> Result + where I: IntoIterator +{ + reconstruct(n_validators, chunks) +} + +/// Reconstruct decodable data from a set of chunks. /// /// Provide an iterator containing chunk data and the corresponding index. /// The indices of the present chunks must be indicated. If too few chunks /// are provided, recovery is not possible. /// /// Works only up to 65536 validators, and `n_validators` must be non-zero. -pub fn reconstruct<'a, I: 'a>(n_validators: usize, chunks: I) - -> Result +fn reconstruct<'a, I: 'a, T: Decode>(n_validators: usize, chunks: I) -> Result where I: IntoIterator { let params = code_params(n_validators)?; @@ -343,7 +388,7 @@ impl<'a, I: Iterator> codec::Input for ShardInput<'a, I> { #[cfg(test)] mod tests { use super::*; - use primitives::parachain::{BlockData, PoVBlock}; + use primitives::v0::{AvailableData, BlockData, PoVBlock}; #[test] fn field_order_is_right_size() { @@ -420,7 +465,7 @@ mod tests { assert_eq!(chunks.len(), 10); // any 4 chunks should work. - let reconstructed = reconstruct( + let reconstructed: AvailableData = reconstruct( 10, [ (&*chunks[1], 1), diff --git a/network/src/legacy/collator_pool.rs b/network/src/legacy/collator_pool.rs index a0c0a0458e90..f2b168e0f592 100644 --- a/network/src/legacy/collator_pool.rs +++ b/network/src/legacy/collator_pool.rs @@ -17,8 +17,7 @@ //! Bridge between the network and consensus service for getting collations to it. use codec::{Encode, Decode}; -use polkadot_primitives::Hash; -use polkadot_primitives::parachain::{CollatorId, Id as ParaId, Collation}; +use polkadot_primitives::v0::{Hash, CollatorId, Id as ParaId, Collation}; use sc_network::PeerId; use futures::channel::oneshot; @@ -236,7 +235,7 @@ impl CollatorPool { mod tests { use super::*; use sp_core::crypto::UncheckedInto; - use polkadot_primitives::parachain::{CollationInfo, BlockData, PoVBlock}; + use polkadot_primitives::v0::{CollationInfo, BlockData, PoVBlock}; use futures::executor::block_on; fn make_pov(block_data: Vec) -> PoVBlock { diff --git a/network/src/legacy/gossip/attestation.rs b/network/src/legacy/gossip/attestation.rs index a47f75288bf4..2d20ce63b995 100644 --- a/network/src/legacy/gossip/attestation.rs +++ b/network/src/legacy/gossip/attestation.rs @@ -33,7 +33,7 @@ use sc_network_gossip::{ValidationResult as GossipValidationResult}; use sc_network::ReputationChange; use polkadot_validation::GenericStatement; -use polkadot_primitives::Hash; +use polkadot_primitives::v0::Hash; use std::collections::HashMap; diff --git a/network/src/legacy/gossip/mod.rs b/network/src/legacy/gossip/mod.rs index 7dea99656667..9e18d7ce2171 100644 --- a/network/src/legacy/gossip/mod.rs +++ b/network/src/legacy/gossip/mod.rs @@ -58,8 +58,8 @@ use sc_network_gossip::{ ValidatorContext, MessageIntent, }; use polkadot_validation::{SignedStatement}; -use polkadot_primitives::{Block, Hash}; -use polkadot_primitives::parachain::{ +use polkadot_primitives::v0::{ + Block, Hash, ParachainHost, ValidatorId, ErasureChunk as PrimitiveChunk, SigningContext, PoVBlock, }; use polkadot_erasure_coding::{self as erasure}; @@ -755,7 +755,7 @@ mod tests { use sc_network_gossip::Validator as ValidatorT; use std::sync::mpsc; use parking_lot::Mutex; - use polkadot_primitives::parachain::{AbridgedCandidateReceipt, BlockData}; + use polkadot_primitives::v0::{AbridgedCandidateReceipt, BlockData}; use sp_core::sr25519::Signature as Sr25519Signature; use polkadot_validation::GenericStatement; diff --git a/network/src/legacy/local_collations.rs b/network/src/legacy/local_collations.rs index 6bc9b985a7c1..d85911548613 100644 --- a/network/src/legacy/local_collations.rs +++ b/network/src/legacy/local_collations.rs @@ -19,7 +19,7 @@ //! Collations are attempted to be repropagated when a new validator connects, //! a validator changes his session key, or when they are generated. -use polkadot_primitives::{Hash, parachain::{ValidatorId}}; +use polkadot_primitives::v0::{Hash, ValidatorId}; use crate::legacy::collator_pool::Role; use std::collections::{HashMap, HashSet}; use std::time::Duration; @@ -144,7 +144,7 @@ impl LocalCollations { mod tests { use super::*; use sp_core::crypto::UncheckedInto; - use polkadot_primitives::parachain::ValidatorId; + use polkadot_primitives::v0::ValidatorId; #[test] fn add_validator_with_ready_collation() { diff --git a/network/src/legacy/mod.rs b/network/src/legacy/mod.rs index 28ea77a6bdc1..42698657c053 100644 --- a/network/src/legacy/mod.rs +++ b/network/src/legacy/mod.rs @@ -25,7 +25,7 @@ pub mod gossip; use codec::Decode; use futures::prelude::*; -use polkadot_primitives::Hash; +use polkadot_primitives::v0::Hash; use sc_network::PeerId; use sc_network_gossip::TopicNotification; use log::debug; diff --git a/network/src/lib.rs b/network/src/lib.rs index 5048f09adaf5..eaed7b34d2cb 100644 --- a/network/src/lib.rs +++ b/network/src/lib.rs @@ -21,7 +21,7 @@ #![recursion_limit="256"] -use polkadot_primitives::{Block, Hash, BlakeTwo256, HashT}; +use polkadot_primitives::v0::{Block, Hash, BlakeTwo256, HashT}; pub mod legacy; pub mod protocol; diff --git a/network/src/protocol/mod.rs b/network/src/protocol/mod.rs index 9a94065e5be6..22e72dcfd6e4 100644 --- a/network/src/protocol/mod.rs +++ b/network/src/protocol/mod.rs @@ -30,12 +30,10 @@ use futures::task::{Context, Poll}; use futures::stream::{FuturesUnordered, StreamFuture}; use log::{debug, trace}; -use polkadot_primitives::{ +use polkadot_primitives::v0::{ Hash, Block, - parachain::{ - PoVBlock, ValidatorId, ValidatorIndex, Collation, AbridgedCandidateReceipt, - ErasureChunk, ParachainHost, Id as ParaId, CollatorId, - }, + PoVBlock, ValidatorId, ValidatorIndex, Collation, AbridgedCandidateReceipt, + ErasureChunk, ParachainHost, Id as ParaId, CollatorId, }; use polkadot_validation::{ SharedTable, TableRouter, Network as ParachainNetwork, Validated, GenericStatement, Collators, diff --git a/network/src/protocol/tests.rs b/network/src/protocol/tests.rs index 049af3f5aca7..711906797be4 100644 --- a/network/src/protocol/tests.rs +++ b/network/src/protocol/tests.rs @@ -17,8 +17,8 @@ use super::*; use crate::legacy::gossip::GossipPoVBlock; use parking_lot::Mutex; -use polkadot_primitives::Block; -use polkadot_primitives::parachain::{ +use polkadot_primitives::v0::{ + Block, Id as ParaId, Chain, DutyRoster, ParachainHost, ValidatorId, Retriable, CollatorId, AbridgedCandidateReceipt, GlobalValidationSchedule, LocalValidationData, ErasureChunk, SigningContext, @@ -198,7 +198,7 @@ sp_api::mock_impl_runtime_apis! { parent_hash: Default::default(), } } - fn downward_messages(_: ParaId) -> Vec { + fn downward_messages(_: ParaId) -> Vec { Vec::new() } } diff --git a/node/core/backing/src/lib.rs b/node/core/backing/src/lib.rs index e4490d20d3f1..281147847e19 100644 --- a/node/core/backing/src/lib.rs +++ b/node/core/backing/src/lib.rs @@ -21,6 +21,7 @@ use std::collections::{HashMap, HashSet}; use std::convert::TryFrom; use std::pin::Pin; +use std::sync::Arc; use std::time::Duration; use bitvec::vec::BitVec; @@ -36,17 +37,15 @@ use streamunordered::{StreamUnordered, StreamYield}; use primitives::Pair; use keystore::KeyStorePtr; -use polkadot_primitives::{ - Hash, - parachain::{ - AbridgedCandidateReceipt, BackedCandidate, Id as ParaId, ValidatorPair, ValidatorId, - ValidatorIndex, HeadData, SigningContext, PoVBlock, OmittedValidationData, - CandidateDescriptor, LocalValidationData, GlobalValidationSchedule, AvailableData, - ErasureChunk, - }, +use polkadot_primitives::v1::{ + CommittedCandidateReceipt, BackedCandidate, Id as ParaId, ValidatorPair, ValidatorId, + ValidatorIndex, SigningContext, PoV, OmittedValidationData, + CandidateDescriptor, AvailableData, ErasureChunk, ValidatorSignature, Hash, CandidateReceipt, + CandidateCommitments, }; use polkadot_node_primitives::{ FromTableMisbehavior, Statement, SignedFullStatement, MisbehaviorReport, ValidationResult, + ValidationOutputs, }; use polkadot_subsystem::{ FromOverseer, OverseerSignal, Subsystem, SubsystemContext, SpawnedSubsystem, @@ -59,8 +58,12 @@ use polkadot_subsystem::messages::{ }; use statement_table::{ generic::AttestedCandidate as TableAttestedCandidate, - Table, Context as TableContextTrait, Statement as TableStatement, - SignedStatement as TableSignedStatement, Summary as TableSummary, + Context as TableContextTrait, + Table, + v1::{ + Statement as TableStatement, + SignedStatement as TableSignedStatement, Summary as TableSummary, + }, }; #[derive(Debug, derive_more::From)] @@ -90,8 +93,6 @@ struct CandidateBackingJob { /// Outbound message channel sending part. tx_from: mpsc::Sender, - /// `HeadData`s of the parachains that this validator is assigned to. - head_data: HeadData, /// The `ParaId`s assigned to this validator. assignment: ParaId, /// We issued `Valid` or `Invalid` statements on about these candidates. @@ -118,8 +119,22 @@ struct TableContext { } impl TableContextTrait for TableContext { - fn is_member_of(&self, authority: ValidatorIndex, group: &ParaId) -> bool { - self.groups.get(group).map_or(false, |g| g.iter().position(|&a| a == authority).is_some()) + type AuthorityId = ValidatorIndex; + type Digest = Hash; + type GroupId = ParaId; + type Signature = ValidatorSignature; + type Candidate = CommittedCandidateReceipt; + + fn candidate_digest(candidate: &CommittedCandidateReceipt) -> Hash { + candidate.hash() + } + + fn candidate_group(candidate: &CommittedCandidateReceipt) -> ParaId { + candidate.descriptor().para_id + } + + fn is_member_of(&self, authority: &ValidatorIndex, group: &ParaId) -> bool { + self.groups.get(group).map_or(false, |g| g.iter().position(|a| a == authority).is_some()) } fn requisite_votes(&self, group: &ParaId) -> usize { @@ -221,7 +236,7 @@ impl CandidateBackingJob { async fn issue_candidate_invalid_message( &mut self, - candidate: AbridgedCandidateReceipt, + candidate: CandidateReceipt, ) -> Result<(), Error> { self.tx_from.send(FromJob::CandidateSelection( CandidateSelectionMessage::Invalid(self.parent, candidate) @@ -231,34 +246,69 @@ impl CandidateBackingJob { } /// Validate the candidate that is requested to be `Second`ed and distribute validation result. + /// + /// Returns `Ok(true)` if we issued a `Seconded` statement about this candidate. async fn validate_and_second( &mut self, - candidate: AbridgedCandidateReceipt, - pov: PoVBlock, - ) -> Result { - let valid = self.request_candidate_validation(candidate.clone(), pov.clone()).await?; - let statement = match valid.0 { - ValidationResult::Valid => { + candidate: &CandidateReceipt, + pov: PoV, + ) -> Result { + let valid = self.request_candidate_validation( + candidate.descriptor().clone(), + Arc::new(pov.clone()), + ).await?; + + let candidate_hash = candidate.hash(); + + let statement = match valid { + ValidationResult::Valid(outputs) => { // make PoV available for later distribution. Send data to the availability // store to keep. Sign and dispatch `valid` statement to network if we // have not seconded the given candidate. - self.make_pov_available(pov, valid.1, valid.2).await?; - self.issued_statements.insert(candidate.hash()); - Statement::Seconded(candidate) + // + // If the commitments hash produced by validation is not the same as given by + // the collator, do not make available and report the collator. + let commitments_check = self.make_pov_available( + pov, + outputs, + |commitments| if commitments.hash() == candidate.commitments_hash { + Ok(CommittedCandidateReceipt { + descriptor: candidate.descriptor().clone(), + commitments, + }) + } else { + Err(()) + }, + ).await?; + + match commitments_check { + Ok(candidate) => { + self.issued_statements.insert(candidate_hash); + Some(Statement::Seconded(candidate)) + } + Err(()) => { + self.issue_candidate_invalid_message(candidate.clone()).await?; + None + } + } } ValidationResult::Invalid => { - let candidate_hash = candidate.hash(); - self.issue_candidate_invalid_message(candidate).await?; - Statement::Invalid(candidate_hash) + // no need to issue a statement about this if we aren't seconding it. + // + // there's an infinite amount of garbage out there. no need to acknowledge + // all of it. + self.issue_candidate_invalid_message(candidate.clone()).await?; + None } }; - if let Some(signed_statement) = self.sign_statement(statement) { + let issued_statement = statement.is_some(); + if let Some(signed_statement) = statement.and_then(|s| self.sign_statement(s)) { self.import_statement(&signed_statement).await?; self.distribute_signed_statement(signed_statement).await?; } - Ok(valid.0) + Ok(issued_statement) } fn get_backed(&self) -> Vec { @@ -303,7 +353,7 @@ impl CandidateBackingJob { } /// Check if there have happened any new misbehaviors and issue necessary messages. - /// + /// /// TODO: Report multiple misbehaviors (https://github.com/paritytech/polkadot/issues/1387) async fn issue_new_misbehaviors(&mut self) -> Result<(), Error> { let mut reports = Vec::new(); @@ -354,7 +404,7 @@ impl CandidateBackingJob { match msg { CandidateBackingMessage::Second(_, candidate, pov) => { // Sanity check that candidate is from our assignment. - if candidate.parachain_index != self.assignment { + if candidate.descriptor().para_id != self.assignment { return Ok(()); } @@ -367,8 +417,8 @@ impl CandidateBackingJob { let candidate_hash = candidate.hash(); if !self.issued_statements.contains(&candidate_hash) { - if let Ok(ValidationResult::Valid) = self.validate_and_second( - candidate, + if let Ok(true) = self.validate_and_second( + &candidate, pov, ).await { self.seconded = Some(candidate_hash); @@ -397,17 +447,40 @@ impl CandidateBackingJob { async fn kick_off_validation_work( &mut self, summary: TableSummary, - ) -> Result { - let candidate = self.table.get_candidate(&summary.candidate).ok_or(Error::CandidateNotFound)?; - let candidate = candidate.clone(); - let descriptor = candidate.to_descriptor(); - let candidate_hash = candidate.hash(); - let pov = self.request_pov_from_distribution(descriptor).await?; - let v = self.request_candidate_validation(candidate, pov).await?; + ) -> Result<(), Error> { + let candidate_hash = summary.candidate.clone(); + + if self.issued_statements.contains(&candidate_hash) { + return Ok(()) + } + + // We clone the commitments here because there are borrowck + // errors relating to this being a struct and methods borrowing the entirety of self + // and not just those things that the function uses. + let candidate = self.table.get_candidate(&candidate_hash).ok_or(Error::CandidateNotFound)?; + let expected_commitments = candidate.commitments.clone(); + + let descriptor = candidate.descriptor().clone(); + let pov = self.request_pov_from_distribution(descriptor.clone()).await?; + let v = self.request_candidate_validation(descriptor, pov.clone()).await?; + + let statement = match v { + ValidationResult::Valid(outputs) => { + // If validation produces a new set of commitments, we vote the candidate as invalid. + let commitments_check = self.make_pov_available( + (&*pov).clone(), + outputs, + |commitments| if commitments == expected_commitments { + Ok(()) + } else { + Err(()) + } + ).await?; - let statement = match v.0 { - ValidationResult::Valid => { - Statement::Valid(candidate_hash) + match commitments_check { + Ok(()) => Statement::Valid(candidate_hash), + Err(()) => Statement::Invalid(candidate_hash), + } } ValidationResult::Invalid => { Statement::Invalid(candidate_hash) @@ -420,7 +493,7 @@ impl CandidateBackingJob { self.distribute_signed_statement(signed_statement).await?; } - Ok(v.0) + Ok(()) } /// Import the statement and kick off validation work if it is a part of our assignment. @@ -478,29 +551,26 @@ impl CandidateBackingJob { async fn request_pov_from_distribution( &mut self, descriptor: CandidateDescriptor, - ) -> Result { + ) -> Result, Error> { let (tx, rx) = oneshot::channel(); self.tx_from.send(FromJob::PoVDistribution( PoVDistributionMessage::FetchPoV(self.parent, descriptor, tx) )).await?; - let pov = rx.await?; - Ok((*pov).clone()) + Ok(rx.await?) } async fn request_candidate_validation( &mut self, - candidate: AbridgedCandidateReceipt, - pov: PoVBlock, - ) -> Result<(ValidationResult, GlobalValidationSchedule, LocalValidationData), Error> { + candidate: CandidateDescriptor, + pov: Arc, + ) -> Result { let (tx, rx) = oneshot::channel(); self.tx_from.send(FromJob::CandidateValidation( - CandidateValidationMessage::Validate( - self.parent, + CandidateValidationMessage::ValidateFromChainState( candidate, - self.head_data.clone(), pov, tx, ) @@ -523,32 +593,51 @@ impl CandidateBackingJob { Ok(()) } - async fn make_pov_available( + // Compute the erasure-coding and make it available. + // + // This calls an inspection function before making the PoV available for any last checks + // that need to be done. If the inspection function returns an error, this function returns + // early without making the PoV available. + async fn make_pov_available( &mut self, - pov_block: PoVBlock, - global_validation: GlobalValidationSchedule, - local_validation: LocalValidationData, - ) -> Result<(), Error> { + pov: PoV, + outputs: ValidationOutputs, + with_commitments: impl FnOnce(CandidateCommitments) -> Result, + ) -> Result, Error> { let omitted_validation = OmittedValidationData { - global_validation, - local_validation, + global_validation: outputs.global_validation_schedule, + local_validation: outputs.local_validation_data, }; let available_data = AvailableData { - pov_block, + pov, omitted_validation, }; - let chunks = erasure_coding::obtain_chunks( + let chunks = erasure_coding::obtain_chunks_v1( self.table_context.validators.len(), &available_data, )?; let branches = erasure_coding::branches(chunks.as_ref()); + let erasure_root = branches.root(); + + let commitments = CandidateCommitments { + fees: outputs.fees, + upward_messages: outputs.upward_messages, + erasure_root, + new_validation_code: outputs.new_validation_code, + head_data: outputs.head_data, + }; - for (index, (chunk, proof)) in chunks.iter().zip(branches.map(|(proof, _)| proof)).enumerate() { + let res = match with_commitments(commitments) { + Ok(x) => x, + Err(e) => return Ok(Err(e)), + }; + + for (index, (proof, chunk)) in branches.enumerate() { let chunk = ErasureChunk { - chunk: chunk.clone(), + chunk: chunk.to_vec(), index: index as u32, proof, }; @@ -556,7 +645,7 @@ impl CandidateBackingJob { self.store_chunk(index as ValidatorIndex, chunk).await?; } - Ok(()) + Ok(Ok(res)) } async fn distribute_signed_statement(&mut self, s: SignedFullStatement) -> Result<(), Error> { @@ -635,13 +724,7 @@ async fn run_job( } } - let ( - head_data, - signing_context, - ) = futures::try_join!( - request_head_data(parent, &mut tx_from, assignment).await?, - request_signing_context(parent, &mut tx_from).await?, - )?; + let signing_context = request_signing_context(parent, &mut tx_from).await?.await?; let table_context = TableContext { signing_context, @@ -654,7 +737,6 @@ async fn run_job( parent, rx_to, tx_from, - head_data, assignment, issued_statements: HashSet::new(), seconded: None, @@ -714,23 +796,6 @@ async fn request_signing_context( Ok(rx) } -/// Request `HeadData` for some `ParaId` from `RuntimeApi`. -async fn request_head_data( - parent: Hash, - s: &mut mpsc::Sender, - id: ParaId, -) -> Result, Error> { - let (tx, rx) = oneshot::channel(); - - s.send(FromJob::RuntimeApiMessage(RuntimeApiMessage::Request( - parent, - RuntimeApiRequest::HeadData(id, tx), - ) - )).await?; - - Ok(rx) -} - impl Jobs { fn new(spawner: S) -> Self { Self { @@ -910,8 +975,9 @@ mod tests { use std::collections::HashMap; use std::sync::Arc; use sp_keyring::Sr25519Keyring; - use polkadot_primitives::parachain::{ + use polkadot_primitives::v1::{ AssignmentKind, CollatorId, CoreAssignment, BlockData, CoreIndex, GroupIndex, ValidityAttestation, + CandidateCommitments, LocalValidationData, GlobalValidationSchedule, HeadData, }; use assert_matches::assert_matches; @@ -1006,6 +1072,7 @@ mod tests { parent_head: HeadData(vec![7, 8, 9]), balance: Default::default(), code_upgrade_allowed: None, + validation_code_hash: Default::default(), }; let global_validation_schedule = GlobalValidationSchedule { @@ -1050,6 +1117,48 @@ mod tests { executor::block_on(future::select(test_fut, subsystem)); } + fn make_erasure_root(test: &TestState, pov: PoV) -> Hash { + let omitted_validation = OmittedValidationData { + global_validation: test.global_validation_schedule.clone(), + local_validation: test.local_validation_data.clone(), + }; + + let available_data = AvailableData { + omitted_validation, + pov, + }; + + let chunks = erasure_coding::obtain_chunks_v1(test.validators.len(), &available_data).unwrap(); + erasure_coding::branches(&chunks).root() + } + + #[derive(Default)] + struct TestCandidateBuilder { + para_id: ParaId, + head_data: HeadData, + pov_hash: Hash, + relay_parent: Hash, + erasure_root: Hash, + } + + impl TestCandidateBuilder { + fn build(self) -> CommittedCandidateReceipt { + CommittedCandidateReceipt { + descriptor: CandidateDescriptor { + para_id: self.para_id, + pov_hash: self.pov_hash, + relay_parent: self.relay_parent, + ..Default::default() + }, + commitments: CandidateCommitments { + head_data: self.head_data, + erasure_root: self.erasure_root, + ..Default::default() + }, + } + } + } + // Tests that the subsystem performs actions that are requied on startup. async fn test_startup( virtual_overseer: &mut subsystem_test::TestSubsystemContextHandle, @@ -1080,16 +1189,6 @@ mod tests { } ); - // Check that subsystem job issues a request for the head data. - assert_matches!( - virtual_overseer.recv().await, - AllMessages::RuntimeApi( - RuntimeApiMessage::Request(parent, RuntimeApiRequest::HeadData(id, tx)) - ) if parent == test_state.relay_parent => { - tx.send(test_state.head_data.get(&id).unwrap().clone()).unwrap(); - } - ); - // Check that subsystem job issues a request for the signing context. assert_matches!( virtual_overseer.recv().await, @@ -1108,49 +1207,53 @@ mod tests { let test_state = TestState::default(); test_harness(test_state.keystore.clone(), |test_harness| async move { let TestHarness { mut virtual_overseer } = test_harness; - + test_startup(&mut virtual_overseer, &test_state).await; - - let pov_block = PoVBlock { + + let pov = PoV { block_data: BlockData(vec![42, 43, 44]), }; - let pov_block_hash = pov_block.hash(); - let candidate = AbridgedCandidateReceipt { - parachain_index: test_state.chain_ids[0], + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); + + let pov_hash = pov.hash(); + let candidate = TestCandidateBuilder { + para_id: test_state.chain_ids[0], relay_parent: test_state.relay_parent, - pov_block_hash, + pov_hash, + head_data: expected_head_data.clone(), + erasure_root: make_erasure_root(&test_state, pov.clone()), ..Default::default() - }; + }.build(); let second = CandidateBackingMessage::Second( test_state.relay_parent, - candidate.clone(), - pov_block.clone(), + candidate.to_plain(), + pov.clone(), ); virtual_overseer.send(FromOverseer::Communication{ msg: second }).await; - let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); assert_matches!( virtual_overseer.recv().await, AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( - parent_hash, + CandidateValidationMessage::ValidateFromChainState( c, - head_data, pov, tx, ) - ) if parent_hash == test_state.relay_parent && - pov == pov_block && c == candidate => { - assert_eq!(head_data, *expected_head_data); - tx.send(Ok(( - ValidationResult::Valid, - test_state.global_validation_schedule, - test_state.local_validation_data, - ))).unwrap(); + ) if pov == pov && &c == candidate.descriptor() => { + tx.send(Ok( + ValidationResult::Valid(ValidationOutputs { + global_validation_schedule: test_state.global_validation_schedule, + local_validation_data: test_state.local_validation_data, + head_data: expected_head_data.clone(), + upward_messages: Vec::new(), + fees: Default::default(), + new_validation_code: None, + }), + )).unwrap(); } ); @@ -1193,18 +1296,22 @@ mod tests { test_startup(&mut virtual_overseer, &test_state).await; - let pov_block = PoVBlock { + let pov = PoV { block_data: BlockData(vec![1, 2, 3]), }; - let pov_block_hash = pov_block.hash(); + let pov_hash = pov.hash(); + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); - let candidate_a = AbridgedCandidateReceipt { - parachain_index: test_state.chain_ids[0], + let candidate_a = TestCandidateBuilder { + para_id: test_state.chain_ids[0], relay_parent: test_state.relay_parent, - pov_block_hash, + pov_hash, + head_data: expected_head_data.clone(), + erasure_root: make_erasure_root(&test_state, pov.clone()), ..Default::default() - }; + }.build(); let candidate_a_hash = candidate_a.hash(); @@ -1227,39 +1334,38 @@ mod tests { virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await; // Sending a `Statement::Seconded` for our assignment will start - // validation process. The first thing requested is PoVBlock from the + // validation process. The first thing requested is PoV from the // `PoVDistribution`. assert_matches!( virtual_overseer.recv().await, AllMessages::PoVDistribution( PoVDistributionMessage::FetchPoV(relay_parent, _, tx) ) if relay_parent == test_state.relay_parent => { - tx.send(Arc::new(pov_block.clone())).unwrap(); + tx.send(Arc::new(pov.clone())).unwrap(); } ); - let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); - // The next step is the actual request to Validation subsystem // to validate the `Seconded` candidate. assert_matches!( virtual_overseer.recv().await, AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( - relay_parent, - candidate, - head_data, + CandidateValidationMessage::ValidateFromChainState( + c, pov, tx, ) - ) if relay_parent == test_state.relay_parent && candidate == candidate_a => { - assert_eq!(head_data, *expected_head_data); - assert_eq!(pov, pov_block); - tx.send(Ok(( - ValidationResult::Valid, - test_state.global_validation_schedule, - test_state.local_validation_data, - ))).unwrap(); + ) if pov == pov && &c == candidate_a.descriptor() => { + tx.send(Ok( + ValidationResult::Valid(ValidationOutputs { + global_validation_schedule: test_state.global_validation_schedule, + local_validation_data: test_state.local_validation_data, + head_data: expected_head_data.clone(), + upward_messages: Vec::new(), + fees: Default::default(), + new_validation_code: None, + }), + )).unwrap(); } ); @@ -1309,17 +1415,22 @@ mod tests { test_startup(&mut virtual_overseer, &test_state).await; - let pov_block = PoVBlock { + let pov = PoV { block_data: BlockData(vec![1, 2, 3]), }; - let pov_block_hash = pov_block.hash(); - let candidate_a = AbridgedCandidateReceipt { - parachain_index: test_state.chain_ids[0], + let pov_hash = pov.hash(); + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); + + let candidate_a = TestCandidateBuilder { + para_id: test_state.chain_ids[0], relay_parent: test_state.relay_parent, - pov_block_hash, + pov_hash, + erasure_root: make_erasure_root(&test_state, pov.clone()), + head_data: expected_head_data.clone(), ..Default::default() - }; + }.build(); let candidate_a_hash = candidate_a.hash(); @@ -1353,33 +1464,41 @@ mod tests { AllMessages::PoVDistribution( PoVDistributionMessage::FetchPoV(relay_parent, _, tx) ) if relay_parent == test_state.relay_parent => { - tx.send(Arc::new(pov_block.clone())).unwrap(); + tx.send(Arc::new(pov.clone())).unwrap(); } ); - let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); - assert_matches!( virtual_overseer.recv().await, AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( - relay_parent, - candidate, - head_data, + CandidateValidationMessage::ValidateFromChainState( + c, pov, tx, ) - ) if relay_parent == test_state.relay_parent && candidate == candidate_a => { - assert_eq!(pov, pov_block); - assert_eq!(head_data, *expected_head_data); - tx.send(Ok(( - ValidationResult::Valid, - test_state.global_validation_schedule, - test_state.local_validation_data, - ))).unwrap(); + ) if pov == pov && &c == candidate_a.descriptor() => { + tx.send(Ok( + ValidationResult::Valid(ValidationOutputs { + global_validation_schedule: test_state.global_validation_schedule, + local_validation_data: test_state.local_validation_data, + head_data: expected_head_data.clone(), + upward_messages: Vec::new(), + fees: Default::default(), + new_validation_code: None, + }), + )).unwrap(); } ); + for _ in 0..test_state.validators.len() { + assert_matches!( + virtual_overseer.recv().await, + AllMessages::AvailabilityStore( + AvailabilityStoreMessage::StoreChunk(parent_hash, _, _) + ) if parent_hash == test_state.relay_parent + ); + } + assert_matches!( virtual_overseer.recv().await, AllMessages::StatementDistribution( @@ -1440,86 +1559,68 @@ mod tests { test_startup(&mut virtual_overseer, &test_state).await; - let pov_block_a = PoVBlock { + let pov_block_a = PoV { block_data: BlockData(vec![42, 43, 44]), }; - let pov_block_b = PoVBlock { + let pov_block_b = PoV { block_data: BlockData(vec![45, 46, 47]), }; - let pov_block_hash_a = pov_block_a.hash(); - let pov_block_hash_b = pov_block_b.hash(); + let pov_hash_a = pov_block_a.hash(); + let pov_hash_b = pov_block_b.hash(); + + let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); - let candidate_a = AbridgedCandidateReceipt { - parachain_index: test_state.chain_ids[0], + let candidate_a = TestCandidateBuilder { + para_id: test_state.chain_ids[0], relay_parent: test_state.relay_parent, - pov_block_hash: pov_block_hash_a, + pov_hash: pov_hash_a, + erasure_root: make_erasure_root(&test_state, pov_block_a.clone()), ..Default::default() - }; - - let candidate_a_hash = candidate_a.hash(); + }.build(); - let candidate_b = AbridgedCandidateReceipt { - parachain_index: test_state.chain_ids[0], + let candidate_b = TestCandidateBuilder { + para_id: test_state.chain_ids[0], relay_parent: test_state.relay_parent, - pov_block_hash: pov_block_hash_b, + pov_hash: pov_hash_b, + erasure_root: make_erasure_root(&test_state, pov_block_b.clone()), + head_data: expected_head_data.clone(), ..Default::default() - }; + }.build(); let second = CandidateBackingMessage::Second( test_state.relay_parent, - candidate_a.clone(), + candidate_a.to_plain(), pov_block_a.clone(), ); virtual_overseer.send(FromOverseer::Communication{ msg: second }).await; - let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); assert_matches!( virtual_overseer.recv().await, AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( - parent_hash, + CandidateValidationMessage::ValidateFromChainState( c, - head_data, pov, tx, ) - ) if parent_hash == test_state.relay_parent && - pov == pov_block_a && c == candidate_a => { - assert_eq!(head_data, *expected_head_data); - tx.send(Ok(( - ValidationResult::Invalid, - test_state.global_validation_schedule.clone(), - test_state.local_validation_data.clone(), - ))).unwrap(); + ) if pov == pov && &c == candidate_a.descriptor() => { + tx.send(Ok(ValidationResult::Invalid)).unwrap(); } ); assert_matches!( virtual_overseer.recv().await, AllMessages::CandidateSelection( - CandidateSelectionMessage::Invalid(parent_hash, candidate) - ) if parent_hash == test_state.relay_parent && candidate == candidate_a - ); - - assert_matches!( - virtual_overseer.recv().await, - AllMessages::StatementDistribution( - StatementDistributionMessage::Share( - relay_parent, - statement, - ) - ) if relay_parent == test_state.relay_parent => { - assert_eq!(*statement.payload(), Statement::Invalid(candidate_a_hash)); - } + CandidateSelectionMessage::Invalid(parent_hash, c) + ) if parent_hash == test_state.relay_parent && c == candidate_a.to_plain() ); let second = CandidateBackingMessage::Second( test_state.relay_parent, - candidate_b.clone(), + candidate_b.to_plain(), pov_block_b.clone(), ); @@ -1530,21 +1631,22 @@ mod tests { assert_matches!( virtual_overseer.recv().await, AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( - parent_hash, + CandidateValidationMessage::ValidateFromChainState( c, - head_data, pov, tx, ) - ) if parent_hash == test_state.relay_parent && - pov == pov_block_b && c == candidate_b => { - assert_eq!(head_data, *expected_head_data); - tx.send(Ok(( - ValidationResult::Valid, - test_state.global_validation_schedule, - test_state.local_validation_data, - ))).unwrap(); + ) if pov == pov && &c == candidate_b.descriptor() => { + tx.send(Ok( + ValidationResult::Valid(ValidationOutputs { + global_validation_schedule: test_state.global_validation_schedule, + local_validation_data: test_state.local_validation_data, + head_data: expected_head_data.clone(), + upward_messages: Vec::new(), + fees: Default::default(), + new_validation_code: None, + }), + )).unwrap(); } ); @@ -1590,18 +1692,19 @@ mod tests { test_startup(&mut virtual_overseer, &test_state).await; - let pov_block = PoVBlock { + let pov = PoV { block_data: BlockData(vec![42, 43, 44]), }; - let pov_block_hash = pov_block.hash(); + let pov_hash = pov.hash(); - let candidate = AbridgedCandidateReceipt { - parachain_index: test_state.chain_ids[0], + let candidate = TestCandidateBuilder { + para_id: test_state.chain_ids[0], relay_parent: test_state.relay_parent, - pov_block_hash, + pov_hash, + erasure_root: make_erasure_root(&test_state, pov.clone()), ..Default::default() - }; + }.build(); let candidate_hash = candidate.hash(); @@ -1627,33 +1730,22 @@ mod tests { PoVDistributionMessage::FetchPoV(relay_parent, _, tx) ) => { assert_eq!(relay_parent, test_state.relay_parent); - tx.send(Arc::new(pov_block.clone())).unwrap(); + tx.send(Arc::new(pov.clone())).unwrap(); } ); - let expected_head_data = test_state.head_data.get(&test_state.chain_ids[0]).unwrap(); // Tell subsystem that this candidate is invalid. assert_matches!( virtual_overseer.recv().await, AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( - relay_parent, - candidate_recvd, - head_data, + CandidateValidationMessage::ValidateFromChainState( + c, pov, tx, ) - ) => { - assert_eq!(relay_parent, test_state.relay_parent); - assert_eq!(candidate_recvd, candidate); - assert_eq!(head_data, *expected_head_data); - assert_eq!(pov, pov_block); - tx.send(Ok(( - ValidationResult::Invalid, - test_state.global_validation_schedule, - test_state.local_validation_data, - ))).unwrap(); + ) if pov == pov && &c == candidate.descriptor() => { + tx.send(Ok(ValidationResult::Invalid)).unwrap(); } ); @@ -1679,28 +1771,29 @@ mod tests { // This should emit no actions from subsystem. let second = CandidateBackingMessage::Second( test_state.relay_parent, - candidate.clone(), - pov_block.clone(), + candidate.to_plain(), + pov.clone(), ); virtual_overseer.send(FromOverseer::Communication{ msg: second }).await; - let pov_to_second = PoVBlock { + let pov_to_second = PoV { block_data: BlockData(vec![3, 2, 1]), }; - let pov_block_hash = pov_to_second.hash(); + let pov_hash = pov_to_second.hash(); - let candidate_to_second = AbridgedCandidateReceipt { - parachain_index: test_state.chain_ids[0], + let candidate_to_second = TestCandidateBuilder { + para_id: test_state.chain_ids[0], relay_parent: test_state.relay_parent, - pov_block_hash, + pov_hash, + erasure_root: make_erasure_root(&test_state, pov_to_second.clone()), ..Default::default() - }; + }.build(); let second = CandidateBackingMessage::Second( test_state.relay_parent, - candidate_to_second.clone(), + candidate_to_second.to_plain(), pov_to_second.clone(), ); @@ -1712,16 +1805,13 @@ mod tests { assert_matches!( virtual_overseer.recv().await, AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( - relay_parent, - _, + CandidateValidationMessage::ValidateFromChainState( _, pov, _, ) ) => { - assert_eq!(relay_parent, test_state.relay_parent); - assert_eq!(pov, pov_to_second); + assert_eq!(&*pov, &pov_to_second); } ); }); diff --git a/node/core/proposer/src/lib.rs b/node/core/proposer/src/lib.rs index b53ac5729fa9..d43810227ba4 100644 --- a/node/core/proposer/src/lib.rs +++ b/node/core/proposer/src/lib.rs @@ -2,9 +2,7 @@ use futures::prelude::*; use futures::select; use polkadot_node_subsystem::{messages::{AllMessages, ProvisionerInherentData, ProvisionerMessage}, SubsystemError}; use polkadot_overseer::OverseerHandler; -use polkadot_primitives::{ - inclusion_inherent, - parachain::ParachainHost, +use polkadot_primitives::v1::{ Block, Hash, Header, }; use sc_block_builder::{BlockBuilderApi, BlockBuilderProvider}; @@ -53,7 +51,7 @@ where + Send + Sync, Client::Api: - ParachainHost + BlockBuilderApi + ApiExt, + BlockBuilderApi + ApiExt, Backend: 'static + sc_client_api::Backend>, // Rust bug: https://github.com/rust-lang/rust/issues/24159 @@ -104,7 +102,7 @@ where + Send + Sync, Client::Api: - ParachainHost + BlockBuilderApi + ApiExt, + BlockBuilderApi + ApiExt, Backend: 'static + sc_client_api::Backend>, // Rust bug: https://github.com/rust-lang/rust/issues/24159 @@ -155,7 +153,7 @@ where + Send + Sync, Client::Api: - ParachainHost + BlockBuilderApi + ApiExt, + BlockBuilderApi + ApiExt, Backend: 'static + sc_client_api::Backend>, // Rust bug: https://github.com/rust-lang/rust/issues/24159 @@ -186,7 +184,7 @@ where }; inherent_data.put_data( - inclusion_inherent::INHERENT_IDENTIFIER, + polkadot_primitives::v1::INCLUSION_INHERENT_IDENTIFIER, &provisioner_data, )?; diff --git a/node/network/bridge/src/lib.rs b/node/network/bridge/src/lib.rs index 6f90779afe62..46b9dbd84024 100644 --- a/node/network/bridge/src/lib.rs +++ b/node/network/bridge/src/lib.rs @@ -33,7 +33,7 @@ use polkadot_subsystem::{ }; use polkadot_subsystem::messages::{NetworkBridgeEvent, NetworkBridgeMessage, AllMessages}; use node_primitives::{ProtocolId, View}; -use polkadot_primitives::{Block, Hash}; +use polkadot_primitives::v1::{Block, Hash}; use std::collections::btree_map::{BTreeMap, Entry as BEntry}; use std::collections::hash_map::{HashMap, Entry as HEntry}; diff --git a/node/network/pov-distribution/src/lib.rs b/node/network/pov-distribution/src/lib.rs index 589e33fde0d6..84d6e803d2c7 100644 --- a/node/network/pov-distribution/src/lib.rs +++ b/node/network/pov-distribution/src/lib.rs @@ -19,8 +19,7 @@ //! This is a gossip implementation of code that is responsible for distributing PoVs //! among validators. -use polkadot_primitives::Hash; -use polkadot_primitives::parachain::{PoVBlock as PoV, CandidateDescriptor}; +use polkadot_primitives::v1::{Hash, PoV, CandidateDescriptor}; use polkadot_subsystem::{ OverseerSignal, SubsystemContext, Subsystem, SubsystemResult, FromOverseer, SpawnedSubsystem, }; @@ -550,7 +549,7 @@ async fn run( mod tests { use super::*; use futures::executor::{self, ThreadPool}; - use polkadot_primitives::parachain::BlockData; + use polkadot_primitives::v1::BlockData; use assert_matches::assert_matches; fn make_pov(data: Vec) -> PoV { diff --git a/node/network/statement-distribution/src/lib.rs b/node/network/statement-distribution/src/lib.rs index f3d2653266f7..cef499eae98b 100644 --- a/node/network/statement-distribution/src/lib.rs +++ b/node/network/statement-distribution/src/lib.rs @@ -29,9 +29,8 @@ use polkadot_subsystem::messages::{ RuntimeApiRequest, }; use node_primitives::{ProtocolId, View, SignedFullStatement}; -use polkadot_primitives::Hash; -use polkadot_primitives::parachain::{ - CompactStatement, ValidatorIndex, ValidatorId, SigningContext, ValidatorSignature, +use polkadot_primitives::v1::{ + Hash, CompactStatement, ValidatorIndex, ValidatorId, SigningContext, ValidatorSignature, }; use parity_scale_codec::{Encode, Decode}; @@ -891,7 +890,7 @@ mod tests { use super::*; use sp_keyring::Sr25519Keyring; use node_primitives::Statement; - use polkadot_primitives::parachain::{AbridgedCandidateReceipt}; + use polkadot_primitives::v1::CommittedCandidateReceipt; use assert_matches::assert_matches; use futures::executor::{self, ThreadPool}; @@ -911,23 +910,23 @@ mod tests { }; let candidate_a = { - let mut c = AbridgedCandidateReceipt::default(); - c.relay_parent = parent_hash; - c.parachain_index = 1.into(); + let mut c = CommittedCandidateReceipt::default(); + c.descriptor.relay_parent = parent_hash; + c.descriptor.para_id = 1.into(); c }; let candidate_b = { - let mut c = AbridgedCandidateReceipt::default(); - c.relay_parent = parent_hash; - c.parachain_index = 2.into(); + let mut c = CommittedCandidateReceipt::default(); + c.descriptor.relay_parent = parent_hash; + c.descriptor.para_id = 2.into(); c }; let candidate_c = { - let mut c = AbridgedCandidateReceipt::default(); - c.relay_parent = parent_hash; - c.parachain_index = 3.into(); + let mut c = CommittedCandidateReceipt::default(); + c.descriptor.relay_parent = parent_hash; + c.descriptor.para_id = 3.into(); c }; @@ -1140,9 +1139,9 @@ mod tests { let hash_c = [3; 32].into(); let candidate = { - let mut c = AbridgedCandidateReceipt::default(); - c.relay_parent = hash_c; - c.parachain_index = 1.into(); + let mut c = CommittedCandidateReceipt::default(); + c.descriptor.relay_parent = hash_c; + c.descriptor.para_id = 1.into(); c }; let candidate_hash = candidate.hash(); @@ -1275,9 +1274,9 @@ mod tests { let hash_c = [3; 32].into(); let candidate = { - let mut c = AbridgedCandidateReceipt::default(); - c.relay_parent = hash_b; - c.parachain_index = 1.into(); + let mut c = CommittedCandidateReceipt::default(); + c.descriptor.relay_parent = hash_b; + c.descriptor.para_id = 1.into(); c }; diff --git a/node/overseer/examples/minimal-example.rs b/node/overseer/examples/minimal-example.rs index 21e8eb3ab8fa..d5f7f043ff43 100644 --- a/node/overseer/examples/minimal-example.rs +++ b/node/overseer/examples/minimal-example.rs @@ -27,11 +27,11 @@ use futures::{ use futures_timer::Delay; use kv_log_macro as log; -use polkadot_primitives::parachain::{BlockData, PoVBlock}; +use polkadot_primitives::v1::{BlockData, PoV}; use polkadot_overseer::{Overseer, AllSubsystems}; use polkadot_subsystem::{ - Subsystem, SubsystemContext, DummySubsystem, + Subsystem, SubsystemContext, DummySubsystem, SpawnedSubsystem, FromOverseer, }; use polkadot_subsystem::messages::{ @@ -61,13 +61,11 @@ impl Subsystem1 { let (tx, _) = oneshot::channel(); ctx.send_message(AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( + CandidateValidationMessage::ValidateFromChainState( Default::default(), - Default::default(), - Default::default(), - PoVBlock { + PoV { block_data: BlockData(Vec::new()), - }, + }.into(), tx, ) )).await.unwrap(); diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index 458aae91e871..91fceb0d3bb0 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -72,7 +72,7 @@ use futures::{ use futures_timer::Delay; use streamunordered::{StreamYield, StreamUnordered}; -use polkadot_primitives::{Block, BlockNumber, Hash}; +use polkadot_primitives::v1::{Block, BlockNumber, Hash}; use client::{BlockImportNotification, BlockchainEvents, FinalityNotification}; use polkadot_subsystem::messages::{ @@ -932,7 +932,7 @@ fn spawn( mod tests { use futures::{executor, pin_mut, select, channel::mpsc, FutureExt}; - use polkadot_primitives::parachain::{BlockData, PoVBlock}; + use polkadot_primitives::v1::{BlockData, PoV}; use polkadot_subsystem::DummySubsystem; use super::*; @@ -977,13 +977,11 @@ mod tests { let (tx, _) = oneshot::channel(); ctx.send_message( AllMessages::CandidateValidation( - CandidateValidationMessage::Validate( + CandidateValidationMessage::ValidateFromChainState( Default::default(), - Default::default(), - Default::default(), - PoVBlock { + PoV { block_data: BlockData(Vec::new()), - }, + }.into(), tx, ) ) diff --git a/node/primitives/src/lib.rs b/node/primitives/src/lib.rs index 25313c09154e..f29be5737450 100644 --- a/node/primitives/src/lib.rs +++ b/node/primitives/src/lib.rs @@ -21,26 +21,31 @@ //! there. use parity_scale_codec::{Decode, Encode}; -use polkadot_primitives::{Hash, - parachain::{ - AbridgedCandidateReceipt, CompactStatement, - EncodeAs, Signed, SigningContext, ValidatorIndex, ValidatorId, - } +use polkadot_primitives::v1::{ + Hash, CommittedCandidateReceipt, CandidateReceipt, CompactStatement, + EncodeAs, Signed, SigningContext, ValidatorIndex, ValidatorId, + UpwardMessage, Balance, ValidationCode, GlobalValidationSchedule, LocalValidationData, + HeadData, }; use polkadot_statement_table::{ generic::{ ValidityDoubleVote as TableValidityDoubleVote, MultipleCandidates as TableMultipleCandidates, }, - Misbehavior as TableMisbehavior, + v1::Misbehavior as TableMisbehavior, }; /// A statement, where the candidate receipt is included in the `Seconded` variant. +/// +/// This is the committed candidate receipt instead of the bare candidate receipt. As such, +/// it gives access to the commitments to validators who have not executed the candidate. This +/// is necessary to allow a block-producing validator to include candidates from outside of the para +/// it is assigned to. #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] pub enum Statement { /// A statement that a validator seconds a candidate. #[codec(index = "1")] - Seconded(AbridgedCandidateReceipt), + Seconded(CommittedCandidateReceipt), /// A statement that a validator has deemed a candidate valid. #[codec(index = "2")] Valid(Hash), @@ -50,6 +55,8 @@ pub enum Statement { } impl Statement { + /// Transform this statement into its compact version, which references only the hash + /// of the candidate. pub fn to_compact(&self) -> CompactStatement { match *self { Statement::Seconded(ref c) => CompactStatement::Candidate(c.hash()), @@ -84,9 +91,9 @@ pub enum MisbehaviorReport { /// this message should be dispatched with all of them, in arbitrary order. /// /// This variant is also used when our own validity checks disagree with others'. - CandidateValidityDisagreement(AbridgedCandidateReceipt, Vec), + CandidateValidityDisagreement(CandidateReceipt, Vec), /// I've noticed a peer contradicting itself about a particular candidate - SelfContradiction(AbridgedCandidateReceipt, SignedFullStatement, SignedFullStatement), + SelfContradiction(CandidateReceipt, SignedFullStatement, SignedFullStatement), /// This peer has seconded more than one parachain candidate for this relay parent head DoubleVote(SignedFullStatement, SignedFullStatement), } @@ -103,11 +110,28 @@ pub struct FromTableMisbehavior { pub key: ValidatorId, } +/// Outputs of validating a candidate. +#[derive(Debug)] +pub struct ValidationOutputs { + /// The head-data produced by validation. + pub head_data: HeadData, + /// The global validation schedule. + pub global_validation_schedule: GlobalValidationSchedule, + /// The local validation data. + pub local_validation_data: LocalValidationData, + /// Upward messages to the relay chain. + pub upward_messages: Vec, + /// Fees paid to the validators of the relay-chain. + pub fees: Balance, + /// The new validation code submitted by the execution, if any. + pub new_validation_code: Option, +} + /// Result of the validation of the candidate. #[derive(Debug)] pub enum ValidationResult { - /// Candidate is valid. - Valid, + /// Candidate is valid. The validation process yields these outputs. + Valid(ValidationOutputs), /// Candidate is invalid. Invalid, } @@ -136,7 +160,7 @@ impl std::convert::TryFrom for MisbehaviorReport { &f.key, ).ok_or(())?; - Ok(MisbehaviorReport::SelfContradiction(receipt, signed_1, signed_2)) + Ok(MisbehaviorReport::SelfContradiction(receipt.to_plain(), signed_1, signed_2)) } TableMisbehavior::ValidityDoubleVote( TableValidityDoubleVote::IssuedAndInvalidity((c, s1), (d, s2)) @@ -157,7 +181,7 @@ impl std::convert::TryFrom for MisbehaviorReport { &f.key, ).ok_or(())?; - Ok(MisbehaviorReport::SelfContradiction(receipt, signed_1, signed_2)) + Ok(MisbehaviorReport::SelfContradiction(receipt.to_plain(), signed_1, signed_2)) } TableMisbehavior::ValidityDoubleVote( TableValidityDoubleVote::ValidityAndInvalidity(c, s1, s2) @@ -177,7 +201,7 @@ impl std::convert::TryFrom for MisbehaviorReport { &f.key, ).ok_or(())?; - Ok(MisbehaviorReport::SelfContradiction(c, signed_1, signed_2)) + Ok(MisbehaviorReport::SelfContradiction(c.to_plain(), signed_1, signed_2)) } TableMisbehavior::MultipleCandidates( TableMultipleCandidates { diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index 0659d0808301..db9d9c5dded9 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -17,7 +17,7 @@ //! Polkadot chain configurations. use sp_core::{Pair, Public, crypto::UncheckedInto, sr25519}; -use polkadot_primitives::{AccountId, AccountPublic, parachain::ValidatorId}; +use polkadot_primitives::v1::{AccountId, AccountPublic, ValidatorId}; use polkadot_runtime as polkadot; use kusama_runtime as kusama; use westend_runtime as westend; @@ -48,9 +48,9 @@ const DEFAULT_PROTOCOL_ID: &str = "dot"; #[serde(rename_all = "camelCase")] pub struct Extensions { /// Block numbers with known hashes. - pub fork_blocks: sc_client_api::ForkBlocks, + pub fork_blocks: sc_client_api::ForkBlocks, /// Known bad block hashes. - pub bad_blocks: sc_client_api::BadBlocks, + pub bad_blocks: sc_client_api::BadBlocks, } /// The `ChainSpec parametrised for polkadot runtime`. diff --git a/node/service/src/grandpa_support.rs b/node/service/src/grandpa_support.rs index 806a189d9fe5..2a9b73b0868e 100644 --- a/node/service/src/grandpa_support.rs +++ b/node/service/src/grandpa_support.rs @@ -16,7 +16,7 @@ //! Polkadot-specific GRANDPA integration utilities. -use polkadot_primitives::Hash; +use polkadot_primitives::v1::Hash; use sp_runtime::traits::{Block as BlockT, NumberFor}; /// A custom GRANDPA voting rule that "pauses" voting (i.e. keeps voting for the @@ -98,7 +98,7 @@ impl grandpa::VotingRule for PauseAfterBlockFor Vec<( grandpa_primitives::SetId, - (Hash, polkadot_primitives::BlockNumber), + (Hash, polkadot_primitives::v1::BlockNumber), grandpa_primitives::AuthorityList, )> { use sp_core::crypto::Ss58Codec; diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 8a435e6b595b..1205d9f3ef19 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -22,7 +22,7 @@ mod client; use std::sync::Arc; use std::time::Duration; -use polkadot_primitives::{parachain, AccountId, Nonce, Balance}; +use polkadot_primitives::v1::{AccountId, Nonce, Balance}; #[cfg(feature = "full-node")] use service::{error::Error as ServiceError, ServiceBuilder}; use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider}; @@ -45,8 +45,7 @@ pub use sc_consensus::LongestChain; pub use sp_api::{ApiRef, Core as CoreApi, ConstructRuntimeApi, ProvideRuntimeApi, StateBackend}; pub use sp_runtime::traits::{DigestFor, HashFor, NumberFor}; pub use consensus_common::{Proposal, SelectChain, BlockImport, RecordProof, block_validation::Chain}; -pub use polkadot_primitives::parachain::{CollatorId, ParachainHost}; -pub use polkadot_primitives::{Block, BlockId}; +pub use polkadot_primitives::v1::{Block, BlockId, CollatorId, Id as ParaId}; pub use sp_runtime::traits::{Block as BlockT, self as runtime_traits, BlakeTwo256}; pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec}; #[cfg(feature = "full-node")] @@ -84,7 +83,6 @@ pub trait RuntimeApiCollection: + sp_api::ApiExt + babe_primitives::BabeApi + grandpa_primitives::GrandpaApi - + ParachainHost + sp_block_builder::BlockBuilder + system_rpc_runtime_api::AccountNonceApi + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi @@ -104,7 +102,6 @@ where + sp_api::ApiExt + babe_primitives::BabeApi + grandpa_primitives::GrandpaApi - + ParachainHost + sp_block_builder::BlockBuilder + system_rpc_runtime_api::AccountNonceApi + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi @@ -578,7 +575,7 @@ macro_rules! new_light { /// Builds a new object suitable for chain operations. pub fn new_chain_ops(mut config: Configuration) -> Result< ( - Arc>, + Arc>, Arc>, consensus_common::import_queue::BasicQueue>, TaskManager, @@ -601,7 +598,7 @@ where #[cfg(feature = "full-node")] pub fn polkadot_new_full( mut config: Configuration, - collating_for: Option<(CollatorId, parachain::Id)>, + collating_for: Option<(CollatorId, ParaId)>, _max_block_data_size: Option, _authority_discovery_enabled: bool, _slot_duration: u64, @@ -633,7 +630,7 @@ pub fn polkadot_new_full( #[cfg(feature = "full-node")] pub fn kusama_new_full( mut config: Configuration, - collating_for: Option<(CollatorId, parachain::Id)>, + collating_for: Option<(CollatorId, ParaId)>, _max_block_data_size: Option, _authority_discovery_enabled: bool, _slot_duration: u64, @@ -665,7 +662,7 @@ pub fn kusama_new_full( #[cfg(feature = "full-node")] pub fn westend_new_full( mut config: Configuration, - collating_for: Option<(CollatorId, parachain::Id)>, + collating_for: Option<(CollatorId, ParaId)>, _max_block_data_size: Option, _authority_discovery_enabled: bool, _slot_duration: u64, diff --git a/node/subsystem/src/lib.rs b/node/subsystem/src/lib.rs index db9a0629cfd4..e374eb9cfcdd 100644 --- a/node/subsystem/src/lib.rs +++ b/node/subsystem/src/lib.rs @@ -26,7 +26,7 @@ use futures::prelude::*; use futures::channel::{mpsc, oneshot}; use futures::future::BoxFuture; -use polkadot_primitives::Hash; +use polkadot_primitives::v1::Hash; use async_trait::async_trait; use crate::messages::AllMessages; diff --git a/node/subsystem/src/messages.rs b/node/subsystem/src/messages.rs index 36c293e49fe9..10c861f1410c 100644 --- a/node/subsystem/src/messages.rs +++ b/node/subsystem/src/messages.rs @@ -24,12 +24,12 @@ use futures::channel::{mpsc, oneshot}; -use polkadot_primitives::{BlockNumber, Hash, Signature}; -use polkadot_primitives::parachain::{ - AbridgedCandidateReceipt, PoVBlock, ErasureChunk, BackedCandidate, Id as ParaId, +use polkadot_primitives::v1::{ + BlockNumber, Hash, + CandidateReceipt, PoV, ErasureChunk, BackedCandidate, Id as ParaId, SignedAvailabilityBitfield, SigningContext, ValidatorId, ValidationCode, ValidatorIndex, - CoreAssignment, CoreOccupied, HeadData, CandidateDescriptor, GlobalValidationSchedule, - LocalValidationData, + CoreAssignment, CoreOccupied, HeadData, CandidateDescriptor, + ValidatorSignature, OmittedValidationData, }; use polkadot_node_primitives::{ MisbehaviorReport, SignedFullStatement, View, ProtocolId, ValidationResult, @@ -48,7 +48,7 @@ pub struct NewBackedCandidate(pub BackedCandidate); pub enum CandidateSelectionMessage { /// We recommended a particular candidate to be seconded, but it was invalid; penalize the collator. /// The hash is the relay parent. - Invalid(Hash, AbridgedCandidateReceipt), + Invalid(Hash, CandidateReceipt), } /// Messages received by the Candidate Backing subsystem. @@ -59,7 +59,7 @@ pub enum CandidateBackingMessage { GetBackedCandidates(Hash, oneshot::Sender>), /// Note that the Candidate Backing subsystem should second the given candidate in the context of the /// given relay-parent (ref. by hash). This candidate must be validated. - Second(Hash, AbridgedCandidateReceipt, PoVBlock), + Second(Hash, CandidateReceipt, PoV), /// Note a validator's statement about a particular candidate. Disagreements about validity must be escalated /// to a broader check by Misbehavior Arbitration. Agreements are simply tallied until a quorum is reached. Statement(Hash, SignedFullStatement), @@ -69,22 +69,36 @@ pub enum CandidateBackingMessage { #[derive(Debug)] pub struct ValidationFailed; -/// Messages received by the Validation subsystem +/// Messages received by the Validation subsystem. +/// +/// ## Validation Requests +/// +/// Validation requests made to the subsystem should return an error only on internal error. +/// Otherwise, they should return either `Ok(ValidationResult::Valid(_))` +/// or `Ok(ValidationResult::Invalid)`. #[derive(Debug)] pub enum CandidateValidationMessage { - /// Validate a candidate, sending a side-channel response of valid or invalid. + /// Validate a candidate with provided parameters using relay-chain state. + /// + /// This will implicitly attempt to gather the `OmittedValidationData` and `ValidationCode` + /// from the runtime API of the chain, based on the `relay_parent` + /// of the `CandidateDescriptor`. + /// If there is no state available which can provide this data, an error is returned. + ValidateFromChainState( + CandidateDescriptor, + Arc, + oneshot::Sender>, + ), + /// Validate a candidate with provided, exhaustive parameters for validation. /// - /// Provide the relay-parent in whose context this should be validated, the full candidate receipt, - /// and the PoV. - Validate( - Hash, - AbridgedCandidateReceipt, - HeadData, - PoVBlock, - oneshot::Sender>, + /// Explicitly provide the `OmittedValidationData` and `ValidationCode` so this can do full + /// validation without needing to access the state of the relay-chain. + ValidateFromExhaustive( + OmittedValidationData, + ValidationCode, + CandidateDescriptor, + Arc, + oneshot::Sender>, ), } @@ -146,8 +160,8 @@ pub enum BitfieldDistributionMessage { /// Availability store subsystem message. #[derive(Debug)] pub enum AvailabilityStoreMessage { - /// Query a `PoVBlock` from the AV store. - QueryPoV(Hash, oneshot::Sender>), + /// Query a `PoV` from the AV store. + QueryPoV(Hash, oneshot::Sender>), /// Query an `ErasureChunk` from the AV store. QueryChunk(Hash, ValidatorIndex, oneshot::Sender), @@ -213,7 +227,7 @@ pub enum ProvisionableData { /// Misbehavior reports are self-contained proofs of validator misbehavior. MisbehaviorReport(Hash, MisbehaviorReport), /// Disputes trigger a broad dispute resolution process. - Dispute(Hash, Signature), + Dispute(Hash, ValidatorSignature), } /// This data needs to make its way from the provisioner into the InherentData. @@ -246,10 +260,10 @@ pub enum PoVDistributionMessage { /// /// This `CandidateDescriptor` should correspond to a candidate seconded under the provided /// relay-parent hash. - FetchPoV(Hash, CandidateDescriptor, oneshot::Sender>), + FetchPoV(Hash, CandidateDescriptor, oneshot::Sender>), /// Distribute a PoV for the given relay-parent and CandidateDescriptor. /// The PoV should correctly hash to the PoV hash mentioned in the CandidateDescriptor - DistributePoV(Hash, CandidateDescriptor, Arc), + DistributePoV(Hash, CandidateDescriptor, Arc), /// An update from the network bridge. NetworkBridgeUpdate(NetworkBridgeEvent), } diff --git a/node/test-service/src/chain_spec.rs b/node/test-service/src/chain_spec.rs index cbb08c470f07..e81050afdbbe 100644 --- a/node/test-service/src/chain_spec.rs +++ b/node/test-service/src/chain_spec.rs @@ -17,7 +17,7 @@ use babe_primitives::AuthorityId as BabeId; use grandpa::AuthorityId as GrandpaId; use pallet_staking::Forcing; -use polkadot_primitives::{parachain::ValidatorId, AccountId}; +use polkadot_primitives::v0::{ValidatorId, AccountId}; use polkadot_service::chain_spec::{get_account_id_from_seed, get_from_seed, Extensions}; use polkadot_test_runtime::constants::currency::DOTS; use sc_chain_spec::{ChainSpec, ChainType}; diff --git a/node/test-service/src/lib.rs b/node/test-service/src/lib.rs index 7fc75d9f3719..751373265fc3 100644 --- a/node/test-service/src/lib.rs +++ b/node/test-service/src/lib.rs @@ -26,9 +26,8 @@ use futures::future::Future; use grandpa::FinalityProofProvider as GrandpaFinalityProofProvider; use log::info; use polkadot_network::{legacy::gossip::Known, protocol as network_protocol}; -use polkadot_primitives::{ - parachain::{self, CollatorId}, - Block, BlockId, Hash, +use polkadot_primitives::v0::{ + Block, BlockId, Hash, CollatorId, Id as ParaId, }; use polkadot_runtime_common::{parachains, registrar, BlockHashCount}; use polkadot_service::{ @@ -68,7 +67,7 @@ native_executor_instance!( /// Create a new Polkadot test service for a full node. pub fn polkadot_test_new_full( config: Configuration, - collating_for: Option<(CollatorId, parachain::Id)>, + collating_for: Option<(CollatorId, ParaId)>, max_block_data_size: Option, authority_discovery_enabled: bool, slot_duration: u64, @@ -287,7 +286,7 @@ where let extrinsic = polkadot_test_runtime::UncheckedExtrinsic::new_signed( function.clone(), polkadot_test_runtime::Address::Id(caller.public().into()), - polkadot_primitives::Signature::Sr25519(signature.clone()), + polkadot_primitives::v0::Signature::Sr25519(signature.clone()), extra.clone(), ); diff --git a/parachain/test-parachains/adder/collator/src/main.rs b/parachain/test-parachains/adder/collator/src/main.rs index 42c3c824004a..ec5b626883c1 100644 --- a/parachain/test-parachains/adder/collator/src/main.rs +++ b/parachain/test-parachains/adder/collator/src/main.rs @@ -22,9 +22,9 @@ use std::sync::Arc; use adder::{HeadData as AdderHead, BlockData as AdderBody}; use sp_core::Pair; use codec::{Encode, Decode}; -use primitives::{ +use primitives::v0::{ Hash, DownwardMessage, - parachain::{HeadData, BlockData, Id as ParaId, LocalValidationData, GlobalValidationSchedule}, + HeadData, BlockData, Id as ParaId, LocalValidationData, GlobalValidationSchedule, }; use collator::{ParachainContext, Network, BuildParachainContext, Cli, SubstrateCli}; use parking_lot::Mutex; diff --git a/primitives/src/inclusion_inherent.rs b/primitives/src/inclusion_inherent.rs deleted file mode 100644 index ca3f5ec23a16..000000000000 --- a/primitives/src/inclusion_inherent.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017-2020 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 . - -//! Inclusion Inherent primitives define types and constants which can be imported -//! without needing to import the entire inherent module. - -use inherents::InherentIdentifier; - -/// Unique identifier for the Inclusion Inherent -pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"inclusn0"; diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 6f0a0986c933..82a5e7ca2e03 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -20,58 +20,5 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub use runtime_primitives::traits::{BlakeTwo256, Hash as HashT, Verify, IdentifyAccount}; -pub use polkadot_core_primitives::*; - -pub mod inclusion_inherent; -pub mod parachain; - -pub use parity_scale_codec::Compact; - -/// Custom validity errors used in Polkadot while validating transactions. -#[repr(u8)] -pub enum ValidityError { - /// The Ethereum signature is invalid. - InvalidEthereumSignature = 0, - /// The signer has no claim. - SignerHasNoClaim = 1, - /// No permission to execute the call. - NoPermission = 2, - /// An invalid statement was made for a claim. - InvalidStatement = 3, -} - -impl From for u8 { - fn from(err: ValidityError) -> Self { - err as u8 - } -} - -/// App-specific crypto used for reporting equivocation/misbehavior in BABE, -/// GRANDPA and Parachains, described in the white paper as the fisherman role. -/// Any rewards for misbehavior reporting will be paid out to this account. -pub mod fisherman { - use super::{Signature, Verify}; - use primitives::crypto::KeyTypeId; - - /// Key type for the reporting module. Used for reporting BABE, GRANDPA - /// and Parachain equivocations. - pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"fish"); - - mod app { - use application_crypto::{app_crypto, sr25519}; - app_crypto!(sr25519, super::KEY_TYPE); - } - - /// Identity of the equivocation/misbehavior reporter. - pub type FishermanId = app::Public; - - /// An `AppCrypto` type to allow submitting signed transactions using the fisherman - /// application key as signer. - pub struct FishermanAppCrypto; - impl frame_system::offchain::AppCrypto<::Signer, Signature> for FishermanAppCrypto { - type RuntimeAppPublic = FishermanId; - type GenericSignature = primitives::sr25519::Signature; - type GenericPublic = primitives::sr25519::Public; - } -} +pub mod v0; +pub mod v1; diff --git a/primitives/src/parachain.rs b/primitives/src/v0.rs similarity index 83% rename from primitives/src/parachain.rs rename to primitives/src/v0.rs index 19937798c646..e1ec3a55463c 100644 --- a/primitives/src/parachain.rs +++ b/primitives/src/v0.rs @@ -21,18 +21,20 @@ use sp_std::prelude::*; use sp_std::cmp::Ordering; use parity_scale_codec::{Encode, Decode}; use bitvec::vec::BitVec; -use super::{Hash, Balance, BlockNumber}; #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; #[cfg(feature = "std")] -use primitives::{bytes, crypto::Pair}; +use primitives::crypto::Pair; use primitives::RuntimeDebug; use runtime_primitives::traits::{AppVerify, Block as BlockT}; use inherents::InherentIdentifier; use application_crypto::KeyTypeId; -use polkadot_core_primitives::DownwardMessage; + +pub use runtime_primitives::traits::{BlakeTwo256, Hash as HashT, Verify, IdentifyAccount}; +pub use polkadot_core_primitives::*; +pub use parity_scale_codec::Compact; pub use polkadot_parachain::primitives::{ Id, ParachainDispatchOrigin, LOWEST_USER_ID, UpwardMessage, HeadData, BlockData, @@ -171,100 +173,6 @@ pub struct DutyRoster { pub validator_duty: Vec, } -/// The unique (during session) index of a core. -#[derive(Encode, Decode, Default, PartialOrd, Ord, Eq, PartialEq, Clone, Copy)] -#[cfg_attr(feature = "std", derive(Debug))] -pub struct CoreIndex(pub u32); - -impl From for CoreIndex { - fn from(i: u32) -> CoreIndex { - CoreIndex(i) - } -} - -/// The unique (during session) index of a validator group. -#[derive(Encode, Decode, Default, Clone, Copy)] -#[cfg_attr(feature = "std", derive(Eq, Hash, PartialEq, Debug))] -pub struct GroupIndex(pub u32); - -impl From for GroupIndex { - fn from(i: u32) -> GroupIndex { - GroupIndex(i) - } -} - -/// A claim on authoring the next block for a given parathread. -#[derive(Clone, Encode, Decode, Default)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug))] -pub struct ParathreadClaim(pub Id, pub CollatorId); - -/// An entry tracking a claim to ensure it does not pass the maximum number of retries. -#[derive(Clone, Encode, Decode, Default)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug))] -pub struct ParathreadEntry { - /// The claim. - pub claim: ParathreadClaim, - /// Number of retries. - pub retries: u32, -} - -/// What is occupying a specific availability core. -#[derive(Clone, Encode, Decode)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug))] -pub enum CoreOccupied { - /// A parathread. - Parathread(ParathreadEntry), - /// A parachain. - Parachain, -} - -/// The assignment type. -#[derive(Clone, Encode, Decode)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug))] -pub enum AssignmentKind { - /// A parachain. - Parachain, - /// A parathread. - Parathread(CollatorId, u32), -} - -/// How a free core is scheduled to be assigned. -#[derive(Clone, Encode, Decode)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug))] -pub struct CoreAssignment { - /// The core that is assigned. - pub core: CoreIndex, - /// The unique ID of the para that is assigned to the core. - pub para_id: Id, - /// The kind of the assignment. - pub kind: AssignmentKind, - /// The index of the validator group assigned to the core. - pub group_idx: GroupIndex, -} - -impl CoreAssignment { - /// Get the ID of a collator who is required to collate this block. - pub fn required_collator(&self) -> Option<&CollatorId> { - match self.kind { - AssignmentKind::Parachain => None, - AssignmentKind::Parathread(ref id, _) => Some(id), - } - } - - /// Get the `CoreOccupied` from this. - pub fn to_core_occupied(&self) -> CoreOccupied { - match self.kind { - AssignmentKind::Parachain => CoreOccupied::Parachain, - AssignmentKind::Parathread(ref collator, retries) => CoreOccupied::Parathread( - ParathreadEntry { - claim: ParathreadClaim(self.para_id, collator.clone()), - retries, - } - ), - } - } -} - /// Extra data that is needed along with the other fields in a `CandidateReceipt` /// to fully validate the candidate. /// @@ -505,7 +413,6 @@ impl + Encode> AbridgedCandidateReceipt { /// the relay-chain block in which context it should be executed, which implies /// any blockchain state that must be referenced. pub fn hash(&self) -> Hash { - use runtime_primitives::traits::{BlakeTwo256, Hash}; BlakeTwo256::hash_of(self) } } @@ -687,7 +594,6 @@ impl PoVBlock { /// Compute hash of block data. #[cfg(feature = "std")] pub fn hash(&self) -> Hash { - use runtime_primitives::traits::{BlakeTwo256, Hash}; BlakeTwo256::hash_of(&self) } } @@ -716,16 +622,6 @@ pub struct ErasureChunk { pub proof: Vec>, } -/// Parachain header raw bytes wrapper type. -#[derive(PartialEq, Eq)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] -pub struct Header(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); - -/// Activity bit field. -#[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] -pub struct Activity(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); - /// Statements that can be made about parachain candidates. These are the /// actual values that are signed. #[derive(Clone, PartialEq, Eq, Encode, Decode, Hash)] @@ -854,87 +750,6 @@ impl FeeSchedule { } } -/// A bitfield concerning availability of backed candidates. -#[derive(PartialEq, Eq, Clone, Encode, Decode)] -#[cfg_attr(feature = "std", derive(Debug))] -pub struct AvailabilityBitfield(pub BitVec); - -impl From> for AvailabilityBitfield { - fn from(inner: BitVec) -> Self { - AvailabilityBitfield(inner) - } -} - -/// A bitfield signed by a particular validator about the availability of pending candidates. -pub type SignedAvailabilityBitfield = Signed; - -/// A set of signed availability bitfields. Should be sorted by validator index, ascending. -pub type SignedAvailabilityBitfields = Vec; - -/// A backed (or backable, depending on context) candidate. -// TODO: yes, this is roughly the same as AttestedCandidate. -// After https://github.com/paritytech/polkadot/issues/1250 -// they should be unified to this type. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] -pub struct BackedCandidate { - /// The candidate referred to. - pub candidate: AbridgedCandidateReceipt, - /// The validity votes themselves, expressed as signatures. - pub validity_votes: Vec, - /// The indices of the validators within the group, expressed as a bitfield. - pub validator_indices: BitVec, -} - -/// Verify the backing of the given candidate. -/// -/// Provide a lookup from the index of a validator within the group assigned to this para, -/// as opposed to the index of the validator within the overall validator set, as well as -/// the number of validators in the group. -/// -/// Also provide the signing context. -/// -/// Returns either an error, indicating that one of the signatures was invalid or that the index -/// was out-of-bounds, or the number of signatures checked. -pub fn check_candidate_backing + Encode>( - backed: &BackedCandidate, - signing_context: &SigningContext, - group_len: usize, - validator_lookup: impl Fn(usize) -> Option, -) -> Result { - if backed.validator_indices.len() != group_len { - return Err(()) - } - - if backed.validity_votes.len() > group_len { - return Err(()) - } - - // this is known, even in runtime, to be blake2-256. - let hash: Hash = backed.candidate.hash(); - - let mut signed = 0; - for ((val_in_group_idx, _), attestation) in backed.validator_indices.iter().enumerate() - .filter(|(_, signed)| **signed) - .zip(backed.validity_votes.iter()) - { - let validator_id = validator_lookup(val_in_group_idx).ok_or(())?; - let payload = attestation.signed_payload(hash.clone(), signing_context); - let sig = attestation.signature(); - - if sig.verify(&payload[..], &validator_id) { - signed += 1; - } else { - return Err(()) - } - } - - if signed != backed.validity_votes.len() { - return Err(()) - } - - Ok(signed) -} - sp_api::decl_runtime_apis! { /// The API for querying the state of parachains on-chain. #[api_version(3)] @@ -1098,6 +913,55 @@ impl, RealPayload: Encode> Signed for u8 { + fn from(err: ValidityError) -> Self { + err as u8 + } +} + +/// App-specific crypto used for reporting equivocation/misbehavior in BABE, +/// GRANDPA and Parachains, described in the white paper as the fisherman role. +/// Any rewards for misbehavior reporting will be paid out to this account. +pub mod fisherman { + use super::{Signature, Verify}; + use primitives::crypto::KeyTypeId; + + /// Key type for the reporting module. Used for reporting BABE, GRANDPA + /// and Parachain equivocations. + pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"fish"); + + mod app { + use application_crypto::{app_crypto, sr25519}; + app_crypto!(sr25519, super::KEY_TYPE); + } + + /// Identity of the equivocation/misbehavior reporter. + pub type FishermanId = app::Public; + + /// An `AppCrypto` type to allow submitting signed transactions using the fisherman + /// application key as signer. + pub struct FishermanAppCrypto; + impl frame_system::offchain::AppCrypto<::Signer, Signature> for FishermanAppCrypto { + type RuntimeAppPublic = FishermanId; + type GenericSignature = primitives::sr25519::Signature; + type GenericPublic = primitives::sr25519::Public; + } +} + + #[cfg(test)] mod tests { use super::*; diff --git a/primitives/src/v1.rs b/primitives/src/v1.rs new file mode 100644 index 000000000000..9fb3d1662ec7 --- /dev/null +++ b/primitives/src/v1.rs @@ -0,0 +1,478 @@ +// Copyright 2017-2020 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 . + +//! V1 Primitives. + +use sp_std::prelude::*; +use parity_scale_codec::{Encode, Decode}; +use bitvec::vec::BitVec; + +use primitives::RuntimeDebug; +use runtime_primitives::traits::AppVerify; +use inherents::InherentIdentifier; + +use runtime_primitives::traits::{BlakeTwo256, Hash as HashT}; + +// Export some core primitives. +pub use polkadot_core_primitives::v1::{ + BlockNumber, Moment, Signature, AccountPublic, AccountId, AccountIndex, + ChainId, Hash, Nonce, Balance, Header, Block, BlockId, UncheckedExtrinsic, + Remark, DownwardMessage, +}; + +// Export some polkadot-parachain primitives +pub use polkadot_parachain::primitives::{ + Id, ParachainDispatchOrigin, LOWEST_USER_ID, UpwardMessage, HeadData, BlockData, + ValidationCode, +}; + +// Export some basic parachain primitives from v0. +pub use crate::v0::{ + CollatorId, CollatorSignature, PARACHAIN_KEY_TYPE_ID, ValidatorId, ValidatorIndex, + ValidatorSignature, SigningContext, Signed, ValidityAttestation, + CompactStatement, SignedStatement, ErasureChunk, EncodeAs, +}; + +// More exports from v0 for std. +#[cfg(feature = "std")] +pub use crate::v0::{ValidatorPair, CollatorPair}; + +/// Unique identifier for the Inclusion Inherent +pub const INCLUSION_INHERENT_IDENTIFIER: InherentIdentifier = *b"inclusn0"; + +/// Get a collator signature payload on a relay-parent, block-data combo. +pub fn collator_signature_payload>( + relay_parent: &H, + para_id: &Id, + pov_hash: &Hash, +) -> [u8; 68] { + // 32-byte hash length is protected in a test below. + let mut payload = [0u8; 68]; + + payload[0..32].copy_from_slice(relay_parent.as_ref()); + u32::from(*para_id).using_encoded(|s| payload[32..32 + s.len()].copy_from_slice(s)); + payload[36..68].copy_from_slice(pov_hash.as_ref()); + + payload +} + +fn check_collator_signature>( + relay_parent: &H, + para_id: &Id, + pov_hash: &Hash, + collator: &CollatorId, + signature: &CollatorSignature, +) -> Result<(),()> { + let payload = collator_signature_payload(relay_parent, para_id, pov_hash); + if signature.verify(&payload[..], collator) { + Ok(()) + } else { + Err(()) + } +} + +/// A unique descriptor of the candidate receipt. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Default))] +pub struct CandidateDescriptor { + /// The ID of the para this is a candidate for. + pub para_id: Id, + /// The hash of the relay-chain block this is executed in the context of. + pub relay_parent: H, + /// The collator's sr25519 public key. + pub collator: CollatorId, + /// Signature on blake2-256 of components of this receipt: + /// The parachain index, the relay parent, and the pov_hash. + pub signature: CollatorSignature, + /// The blake2-256 hash of the pov. + pub pov_hash: Hash, +} + +impl> CandidateDescriptor { + /// Check the signature of the collator within this descriptor. + pub fn check_collator_signature(&self) -> Result<(), ()> { + check_collator_signature( + &self.relay_parent, + &self.para_id, + &self.pov_hash, + &self.collator, + &self.signature, + ) + } +} + +/// A candidate-receipt. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Default))] +pub struct CandidateReceipt { + /// The descriptor of the candidate. + pub descriptor: CandidateDescriptor, + /// The hash of the encoded commitments made as a result of candidate execution. + pub commitments_hash: Hash, +} + +impl CandidateReceipt { + /// Get a reference to the candidate descriptor. + pub fn descriptor(&self) -> &CandidateDescriptor { + &self.descriptor + } + + /// Computes the blake2-256 hash of the receipt. + pub fn hash(&self) -> Hash where H: Encode { + BlakeTwo256::hash_of(self) + } +} + +/// All data pertaining to the execution of a para candidate. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Default))] +pub struct FullCandidateReceipt { + /// The inner candidate receipt. + pub inner: CandidateReceipt, + /// The global validation schedule. + pub global_validation: GlobalValidationSchedule, + /// The local validation data. + pub local_validation: LocalValidationData, +} + +/// A candidate-receipt with commitments directly included. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Default))] +pub struct CommittedCandidateReceipt { + /// The descriptor of the candidate. + pub descriptor: CandidateDescriptor, + /// The commitments of the candidate receipt. + pub commitments: CandidateCommitments, +} + +impl CommittedCandidateReceipt { + /// Get a reference to the candidate descriptor. + pub fn descriptor(&self) -> &CandidateDescriptor { + &self.descriptor + } +} + +impl CommittedCandidateReceipt { + /// Transforms this into a plain CandidateReceipt. + pub fn to_plain(&self) -> CandidateReceipt { + CandidateReceipt { + descriptor: self.descriptor.clone(), + commitments_hash: self.commitments.hash(), + } + } + + /// Computes the hash of the committed candidate receipt. + /// + /// This computes the canonical hash, not the hash of the directly encoded data. + /// Thus this is a shortcut for `candidate.to_plain().hash()`. + pub fn hash(&self) -> Hash where H: Encode { + self.to_plain().hash() + } +} + +impl PartialOrd for CommittedCandidateReceipt { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for CommittedCandidateReceipt { + fn cmp(&self, other: &Self) -> sp_std::cmp::Ordering { + // TODO: compare signatures or something more sane + // https://github.com/paritytech/polkadot/issues/222 + self.descriptor().para_id.cmp(&other.descriptor().para_id) + .then_with(|| self.commitments.head_data.cmp(&other.commitments.head_data)) + } +} + +/// Extra data that is needed along with the other fields in a `CandidateReceipt` +/// to fully validate the candidate. These fields are parachain-specific. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Default))] +pub struct LocalValidationData { + /// The parent head-data. + pub parent_head: HeadData, + /// The balance of the parachain at the moment of validation. + pub balance: Balance, + /// The blake2-256 hash of the validation code used to execute the candidate. + pub validation_code_hash: Hash, + /// Whether the parachain is allowed to upgrade its validation code. + /// + /// This is `Some` if so, and contains the number of the minimum relay-chain + /// height at which the upgrade will be applied, if an upgrade is signaled + /// now. + /// + /// A parachain should enact its side of the upgrade at the end of the first + /// parablock executing in the context of a relay-chain block with at least this + /// height. This may be equal to the current perceived relay-chain block height, in + /// which case the code upgrade should be applied at the end of the signaling + /// block. + pub code_upgrade_allowed: Option, +} + +/// Extra data that is needed along with the other fields in a `CandidateReceipt` +/// to fully validate the candidate. +/// +/// These are global parameters that apply to all candidates in a block. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Default))] +pub struct GlobalValidationSchedule { + /// The maximum code size permitted, in bytes. + pub max_code_size: u32, + /// The maximum head-data size permitted, in bytes. + pub max_head_data_size: u32, + /// The relay-chain block number this is in the context of. + pub block_number: BlockNumber, +} + +/// Commitments made in a `CandidateReceipt`. Many of these are outputs of validation. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Default))] +pub struct CandidateCommitments { + /// Fees paid from the chain to the relay chain validators. + pub fees: Balance, + /// Messages destined to be interpreted by the Relay chain itself. + pub upward_messages: Vec, + /// The root of a block's erasure encoding Merkle tree. + pub erasure_root: Hash, + /// New validation code. + pub new_validation_code: Option, + /// The head-data produced as a result of execution. + pub head_data: HeadData, +} + +impl CandidateCommitments { + /// Compute the blake2-256 hash of the commitments. + pub fn hash(&self) -> Hash { + BlakeTwo256::hash_of(self) + } +} + +/// A Proof-of-Validity +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct PoV { + /// The block witness data. + pub block_data: BlockData, +} + +impl PoV { + /// Get the blake2-256 hash of the PoV. + #[cfg(feature = "std")] + pub fn hash(&self) -> Hash { + BlakeTwo256::hash_of(self) + } +} + +/// A bitfield concerning availability of backed candidates. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct AvailabilityBitfield(pub BitVec); + +impl From> for AvailabilityBitfield { + fn from(inner: BitVec) -> Self { + AvailabilityBitfield(inner) + } +} + +/// A bitfield signed by a particular validator about the availability of pending candidates. +pub type SignedAvailabilityBitfield = Signed; + +/// A set of signed availability bitfields. Should be sorted by validator index, ascending. +pub type SignedAvailabilityBitfields = Vec; + +/// A backed (or backable, depending on context) candidate. +#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] +pub struct BackedCandidate { + /// The candidate referred to. + pub candidate: CommittedCandidateReceipt, + /// The validity votes themselves, expressed as signatures. + pub validity_votes: Vec, + /// The indices of the validators within the group, expressed as a bitfield. + pub validator_indices: BitVec, +} + +impl BackedCandidate { + /// Get a reference to the descriptor of the para. + pub fn descriptor(&self) -> &CandidateDescriptor { + &self.candidate.descriptor + } +} + +/// Verify the backing of the given candidate. +/// +/// Provide a lookup from the index of a validator within the group assigned to this para, +/// as opposed to the index of the validator within the overall validator set, as well as +/// the number of validators in the group. +/// +/// Also provide the signing context. +/// +/// Returns either an error, indicating that one of the signatures was invalid or that the index +/// was out-of-bounds, or the number of signatures checked. +pub fn check_candidate_backing + Clone + Encode>( + backed: &BackedCandidate, + signing_context: &SigningContext, + group_len: usize, + validator_lookup: impl Fn(usize) -> Option, +) -> Result { + if backed.validator_indices.len() != group_len { + return Err(()) + } + + if backed.validity_votes.len() > group_len { + return Err(()) + } + + // this is known, even in runtime, to be blake2-256. + let hash: Hash = backed.candidate.hash(); + + let mut signed = 0; + for ((val_in_group_idx, _), attestation) in backed.validator_indices.iter().enumerate() + .filter(|(_, signed)| **signed) + .zip(backed.validity_votes.iter()) + { + let validator_id = validator_lookup(val_in_group_idx).ok_or(())?; + let payload = attestation.signed_payload(hash.clone(), signing_context); + let sig = attestation.signature(); + + if sig.verify(&payload[..], &validator_id) { + signed += 1; + } else { + return Err(()) + } + } + + if signed != backed.validity_votes.len() { + return Err(()) + } + + Ok(signed) +} + +/// The unique (during session) index of a core. +#[derive(Encode, Decode, Default, PartialOrd, Ord, Eq, PartialEq, Clone, Copy)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct CoreIndex(pub u32); + +impl From for CoreIndex { + fn from(i: u32) -> CoreIndex { + CoreIndex(i) + } +} + +/// The unique (during session) index of a validator group. +#[derive(Encode, Decode, Default, Clone, Copy)] +#[cfg_attr(feature = "std", derive(Eq, Hash, PartialEq, Debug))] +pub struct GroupIndex(pub u32); + +impl From for GroupIndex { + fn from(i: u32) -> GroupIndex { + GroupIndex(i) + } +} + +/// A claim on authoring the next block for a given parathread. +#[derive(Clone, Encode, Decode, Default)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub struct ParathreadClaim(pub Id, pub CollatorId); + +/// An entry tracking a claim to ensure it does not pass the maximum number of retries. +#[derive(Clone, Encode, Decode, Default)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub struct ParathreadEntry { + /// The claim. + pub claim: ParathreadClaim, + /// Number of retries. + pub retries: u32, +} + +/// What is occupying a specific availability core. +#[derive(Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub enum CoreOccupied { + /// A parathread. + Parathread(ParathreadEntry), + /// A parachain. + Parachain, +} + +/// The assignment type. +#[derive(Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub enum AssignmentKind { + /// A parachain. + Parachain, + /// A parathread. + Parathread(CollatorId, u32), +} + +/// How a free core is scheduled to be assigned. +#[derive(Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub struct CoreAssignment { + /// The core that is assigned. + pub core: CoreIndex, + /// The unique ID of the para that is assigned to the core. + pub para_id: Id, + /// The kind of the assignment. + pub kind: AssignmentKind, + /// The index of the validator group assigned to the core. + pub group_idx: GroupIndex, +} + +impl CoreAssignment { + /// Get the ID of a collator who is required to collate this block. + pub fn required_collator(&self) -> Option<&CollatorId> { + match self.kind { + AssignmentKind::Parachain => None, + AssignmentKind::Parathread(ref id, _) => Some(id), + } + } + + /// Get the `CoreOccupied` from this. + pub fn to_core_occupied(&self) -> CoreOccupied { + match self.kind { + AssignmentKind::Parachain => CoreOccupied::Parachain, + AssignmentKind::Parathread(ref collator, retries) => CoreOccupied::Parathread( + ParathreadEntry { + claim: ParathreadClaim(self.para_id, collator.clone()), + retries, + } + ), + } + } +} + +/// Validation data omitted from most candidate descriptor structs, as it can be derived from the +/// relay-parent. +#[derive(Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub struct OmittedValidationData { + /// The global validation schedule. + pub global_validation: GlobalValidationSchedule, + /// The local validation data. + pub local_validation: LocalValidationData, +} + +/// This is the data we keep available for each candidate included in the relay chain. +#[derive(Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +pub struct AvailableData { + /// The Proof-of-Validation of the candidate. + pub pov: PoV, + /// The omitted validation data. + pub omitted_validation: OmittedValidationData, +} diff --git a/roadmap/implementers-guide/src/types/availability.md b/roadmap/implementers-guide/src/types/availability.md index 3362908d6b63..be42c7a9278a 100644 --- a/roadmap/implementers-guide/src/types/availability.md +++ b/roadmap/implementers-guide/src/types/availability.md @@ -9,7 +9,7 @@ A bitfield [signed](backing.md#signed-wrapper) by a particular validator about t ```rust -pub type SignedAvailabilityBitfield = Signed; +type SignedAvailabilityBitfield = Signed; struct Bitfields(Vec<(SignedAvailabilityBitfield)>), // bitfields sorted by validator index, ascending ``` @@ -21,3 +21,50 @@ Often referred to as PoV, this is a type-safe wrapper around bytes (`Vec`) w ```rust struct PoV(Vec); ``` + +## Omitted Validation Data + +Validation data that is often omitted from types describing candidates as it can be derived from the relay-parent of the candidate. However, with the expectation of state pruning, these are best kept available elsewhere as well. + +This contains the [`GlobalValidationSchedule`](candidate.md#globalvalidationschedule) and [`LocalValidationData`](candidate.md#localvalidationdata) + +```rust +struct OmittedValidationData { + /// The global validation schedule. + global_validation: GlobalValidationSchedule, + /// The local validation data. + local_validation: LocalValidationData, +} +``` + + +## Available Data + +This is the data we want to keep available for each [candidate](candidate.md) included in the relay chain. + +```rust +struct AvailableData { + /// The Proof-of-Validation of the candidate. + pov: PoV, + /// The omitted validation data. + omitted_validation: OmittedValidationData, +} +``` + +> TODO: With XCMP, we also need to keep available the outgoing messages as a result of para-validation. + +## Erasure Chunk + +The [`AvailableData`](#availabledata) is split up into an erasure-coding as part of the availability process. Each validator gets a chunk. This describes one of those chunks, along with its proof against a merkle root hash, which should be apparent from context, and is the `erasure_root` field of a [`CandidateDescriptor`](candidate.md#candidatedescriptor). + + +```rust +struct ErasureChunk { + /// The erasure-encoded chunk of data belonging to the candidate block. + chunk: Vec, + /// The index of this erasure-encoded chunk of data. + index: u32, + /// Proof for this chunk's branch in the Merkle tree. + proof: Vec>, +} +``` diff --git a/roadmap/implementers-guide/src/types/candidate.md b/roadmap/implementers-guide/src/types/candidate.md index fdba6919e57c..0ed38590a733 100644 --- a/roadmap/implementers-guide/src/types/candidate.md +++ b/roadmap/implementers-guide/src/types/candidate.md @@ -1,6 +1,7 @@ # Candidate Types Para candidates are some of the most common types, both within the runtime and on the Node-side. +Candidates are the fundamental datatype for advancing parachains and parathreads, encapsulating the collator's signature, the context of the parablock, the commitments to the output, and a commitment to the data which proves it valid. In a way, this entire guide is about these candidates: how they are scheduled, constructed, backed, included, and challenged. @@ -179,3 +180,24 @@ struct SigningContext { session_index: SessionIndex, } ``` + +## Validation Outputs + +This struct encapsulates the outputs of candidate validation. + +```rust +struct ValidationOutputs { + /// The head-data produced by validation. + head_data: HeadData, + /// The global validation schedule. + global_validation_schedule: GlobalValidationSchedule, + /// The local validation data. + local_validation_data: LocalValidationData, + /// Upwards messages to the relay chain. + upwards_messages: Vec, + /// Fees paid to the validators of the relay-chain. + fees: Balance, + /// The new validation code submitted by the execution, if any. + new_validation_code: Option, +} +``` diff --git a/roadmap/implementers-guide/src/types/overseer-protocol.md b/roadmap/implementers-guide/src/types/overseer-protocol.md index 1e59eedff8db..b822508f4a3e 100644 --- a/roadmap/implementers-guide/src/types/overseer-protocol.md +++ b/roadmap/implementers-guide/src/types/overseer-protocol.md @@ -91,6 +91,7 @@ enum CandidateBackingMessage { GetBackedCandidates(Hash, ResponseChannel>), /// Note that the Candidate Backing subsystem should second the given candidate in the context of the /// given relay-parent (ref. by hash). This candidate must be validated using the provided PoV. + /// The PoV is expected to match the `pov_hash` in the descriptor. Second(Hash, CandidateReceipt, PoV), /// Note a peer validator's statement about a particular candidate. Disagreements about validity must be escalated /// to a broader check by Misbehavior Arbitration. Agreements are simply tallied until a quorum is reached. @@ -282,29 +283,41 @@ enum StatementDistributionMessage { ## Validation Request Type -Various modules request that the [Candidate Validation subsystem](../node/utility/candidate-validation.md) validate a block with this message +Various modules request that the [Candidate Validation subsystem](../node/utility/candidate-validation.md) validate a block with this message. It returns [`ValidationOutputs`](candidate.md#validationoutputs) for successful validation. ```rust /// Result of the validation of the candidate. enum ValidationResult { - /// Candidate is valid. - Valid, + /// Candidate is valid, and here are the outputs. In practice, this should be a shared type + /// so that validation caching can be done. + Valid(ValidationOutputs), /// Candidate is invalid. Invalid, } +/// Messages issued to the candidate validation subsystem. +/// +/// ## Validation Requests +/// +/// Validation requests made to the subsystem should return an error only on internal error. +/// Otherwise, they should return either `Ok(ValidationResult::Valid(_))` or `Ok(ValidationResult::Invalid)`. enum CandidateValidationMessage { - /// Validate a candidate with provided parameters. Returns `Err` if an only if an internal - /// error is encountered. - /// In case no internal error was encontered it returns a tuple containing the result of - /// validation and `GlobalValidationSchedule` and `LocalValidationData` structures that - /// may be used by the caller to make the candidate available. - /// A bad candidate will return `Ok((ValidationResult::Invalid, _, _)`, while a good one will - /// return `Ok((ValidationResult::Valid, _, _))`. - Validate( - Hash, CandidateReceipt, HeadData, PoV, ResponseChannel< - Result<(ValidationResult, GlobalValidationSchedule, LocalValidationData)> - >), + /// Validate a candidate with provided parameters. This will implicitly attempt to gather the + /// `OmittedValidationData` and `ValidationCode` from the runtime API of the chain, + /// based on the `relay_parent` of the `CandidateDescriptor`. + /// If there is no state available which can provide this data, an error is returned. + ValidateFromChainState(CandidateDescriptor, PoV, ResponseChannel>), + + /// Validate a candidate with provided parameters. Explicitly provide the `OmittedValidationData` + /// and `ValidationCode` so this can do full validation without needing to access the state of + /// the relay-chain. + ValidateFromExhaustive( + OmittedValidationData, + ValidationCode, + CandidateDescriptor, + PoV, + ResponseChannel>, + ), } ``` diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 6bddc8ad8daf..c73b478329ee 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -20,7 +20,7 @@ use std::sync::Arc; -use polkadot_primitives::{Block, BlockNumber, AccountId, Nonce, Balance, Hash}; +use polkadot_primitives::v0::{Block, BlockNumber, AccountId, Nonce, Balance, Hash}; use sp_api::ProvideRuntimeApi; use txpool_api::TransactionPool; use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as BlockChainError}; diff --git a/runtime/common/src/attestations.rs b/runtime/common/src/attestations.rs index f27874117aaa..e7a6854bbb13 100644 --- a/runtime/common/src/attestations.rs +++ b/runtime/common/src/attestations.rs @@ -28,7 +28,7 @@ use frame_support::{ weights::DispatchClass, }; -use primitives::{Hash, parachain::{AttestedCandidate, AbridgedCandidateReceipt, Id as ParaId}}; +use primitives::v0::{Hash, AttestedCandidate, AbridgedCandidateReceipt, Id as ParaId}; use sp_runtime::RuntimeDebug; use sp_staking::SessionIndex; diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index fd8c1c1c880a..6efc3d31d75d 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -35,7 +35,7 @@ use sp_runtime::{ TransactionSource, TransactionValidityError, }, }; -use primitives::ValidityError; +use primitives::v0::ValidityError; type CurrencyOf = <::VestingSchedule as VestingSchedule<::AccountId>>::Currency; type BalanceOf = as Currency<::AccountId>>::Balance; diff --git a/runtime/common/src/crowdfund.rs b/runtime/common/src/crowdfund.rs index ee2b740745b7..fc233d107abe 100644 --- a/runtime/common/src/crowdfund.rs +++ b/runtime/common/src/crowdfund.rs @@ -79,7 +79,7 @@ use sp_runtime::{ModuleId, use crate::slots; use codec::{Encode, Decode}; use sp_std::vec::Vec; -use primitives::parachain::{Id as ParaId, HeadData}; +use primitives::v0::{Id as ParaId, HeadData}; pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; @@ -568,7 +568,7 @@ mod tests { }; use frame_support::traits::{Contains, ContainsLengthBound}; use sp_core::H256; - use primitives::parachain::{Info as ParaInfo, Id as ParaId, Scheduling, ValidationCode}; + use primitives::v0::{Info as ParaInfo, Id as ParaId, Scheduling, ValidationCode}; // The testing primitives are very useful for avoiding having to work with signatures // or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried. use sp_runtime::{ diff --git a/runtime/common/src/impls.rs b/runtime/common/src/impls.rs index 543e2c739adb..7e3b6d917f77 100644 --- a/runtime/common/src/impls.rs +++ b/runtime/common/src/impls.rs @@ -26,8 +26,8 @@ pub struct ToAuthor(sp_std::marker::PhantomData); impl OnUnbalanced> for ToAuthor where R: balances::Trait + authorship::Trait, - ::AccountId: From, - ::AccountId: Into, + ::AccountId: From, + ::AccountId: Into, ::Event: From::AccountId, ::Balance, diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index da6fc5fcc27b..d32db38e05be 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -27,7 +27,7 @@ pub mod slots; pub mod crowdfund; pub mod impls; -use primitives::BlockNumber; +use primitives::v0::BlockNumber; use sp_runtime::{Perquintill, Perbill, FixedPointNumber, traits::Saturating}; use frame_support::{ parameter_types, traits::{Currency}, diff --git a/runtime/common/src/parachains.rs b/runtime/common/src/parachains.rs index 25d93b6fde78..b0228a5a53c8 100644 --- a/runtime/common/src/parachains.rs +++ b/runtime/common/src/parachains.rs @@ -37,16 +37,13 @@ use frame_support::{ dispatch::IsSubType, weights::{DispatchClass, Weight}, }; -use primitives::{ - Balance, - BlockNumber, - parachain::{ - Id as ParaId, Chain, DutyRoster, AttestedCandidate, CompactStatement as Statement, ParachainDispatchOrigin, - UpwardMessage, ValidatorId, ActiveParas, CollatorId, Retriable, OmittedValidationData, - CandidateReceipt, GlobalValidationSchedule, AbridgedCandidateReceipt, - LocalValidationData, Scheduling, ValidityAttestation, NEW_HEADS_IDENTIFIER, PARACHAIN_KEY_TYPE_ID, - ValidatorSignature, SigningContext, HeadData, ValidationCode, - }, +use primitives::v0::{ + Balance, BlockNumber, + Id as ParaId, Chain, DutyRoster, AttestedCandidate, CompactStatement as Statement, ParachainDispatchOrigin, + UpwardMessage, ValidatorId, ActiveParas, CollatorId, Retriable, OmittedValidationData, + CandidateReceipt, GlobalValidationSchedule, AbridgedCandidateReceipt, + LocalValidationData, Scheduling, ValidityAttestation, NEW_HEADS_IDENTIFIER, PARACHAIN_KEY_TYPE_ID, + ValidatorSignature, SigningContext, HeadData, ValidationCode, Remark, DownwardMessage }; use frame_support::{ @@ -329,7 +326,7 @@ pub trait Trait: CreateSignedTransaction> + attestations::Trait + ses >; /// A type that converts the opaque hash type to exact one. - type BlockHashConversion: Convert; + type BlockHashConversion: Convert; } /// Origin for the parachains module. @@ -1681,13 +1678,10 @@ mod tests { }, testing::TestXt, }; - use primitives::{ - parachain::{ - CandidateReceipt, ValidityAttestation, ValidatorId, Info as ParaInfo, - Scheduling, CandidateCommitments, - }, - BlockNumber, - Header, + use primitives::v0::{ + CandidateReceipt, ValidityAttestation, ValidatorId, Info as ParaInfo, + Scheduling, CandidateCommitments, + BlockNumber, Header, }; use keyring::Sr25519Keyring; use frame_support::{ @@ -1819,7 +1813,7 @@ mod tests { } mod time { - use primitives::{Moment, BlockNumber}; + use primitives::v0::{Moment, BlockNumber}; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 1 * HOURS; // These time units are defined in number of blocks. @@ -2246,7 +2240,7 @@ mod tests { println!("session index {}", i); Staking::on_finalize(System::block_number()); System::set_block_number((i + 1).into()); - Timestamp::set_timestamp(System::block_number() as primitives::Moment * 6000); + Timestamp::set_timestamp(System::block_number() as primitives::v0::Moment * 6000); // In order to be able to use `System::parent_hash()` in the tests // we need to first get it via `System::finalize` and then set it diff --git a/runtime/common/src/registrar.rs b/runtime/common/src/registrar.rs index de152d9379b5..d7b9cb40caf9 100644 --- a/runtime/common/src/registrar.rs +++ b/runtime/common/src/registrar.rs @@ -34,7 +34,7 @@ use frame_support::{ weights::{DispatchClass, Weight}, }; use system::{self, ensure_root, ensure_signed}; -use primitives::parachain::{ +use primitives::v0::{ Id as ParaId, CollatorId, Scheduling, LOWEST_USER_ID, SwapAux, Info as ParaInfo, ActiveParas, Retriable, ValidationCode, HeadData, }; @@ -213,7 +213,7 @@ fn build(config: &GenesisConfig) { Parachains::put(&only_ids); for (id, code, genesis) in p { - Paras::insert(id, &primitives::parachain::PARACHAIN_INFO); + Paras::insert(id, &primitives::v0::PARACHAIN_INFO); // no ingress -- a chain cannot be routed to until it is live. ::insert(&id, &code); ::insert(&id, &genesis); @@ -670,12 +670,10 @@ mod tests { AccountIdConversion, Extrinsic as ExtrinsicT, }, testing::{UintAuthorityId, TestXt}, KeyTypeId, Perbill, curve::PiecewiseLinear, }; - use primitives::{ - parachain::{ - ValidatorId, Info as ParaInfo, Scheduling, LOWEST_USER_ID, AttestedCandidate, - CandidateReceipt, HeadData, ValidityAttestation, CompactStatement as Statement, Chain, - CollatorPair, CandidateCommitments, - }, + use primitives::v0::{ + ValidatorId, Info as ParaInfo, Scheduling, LOWEST_USER_ID, AttestedCandidate, + CandidateReceipt, HeadData, ValidityAttestation, CompactStatement as Statement, Chain, + CollatorPair, CandidateCommitments, Balance, BlockNumber, Header, Signature, }; use frame_support::{ @@ -869,7 +867,7 @@ mod tests { // This is needed for a custom `AccountId` type which is `u64` in testing here. pub mod test_keys { use sp_core::{crypto::KeyTypeId, sr25519}; - use primitives::Signature; + use primitives::v0::Signature; pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"test"); diff --git a/runtime/common/src/slots.rs b/runtime/common/src/slots.rs index 5618a680c5a0..eb0a7aff7d72 100644 --- a/runtime/common/src/slots.rs +++ b/runtime/common/src/slots.rs @@ -28,7 +28,7 @@ use frame_support::{ traits::{Currency, ReservableCurrency, WithdrawReason, ExistenceRequirement, Get, Randomness}, weights::{DispatchClass, Weight}, }; -use primitives::parachain::{ +use primitives::v0::{ SwapAux, PARACHAIN_INFO, Id as ParaId, ValidationCode, HeadData, }; use system::{ensure_signed, ensure_root}; @@ -890,8 +890,7 @@ mod tests { traits::{OnInitialize, OnFinalize} }; use balances; - use primitives::{BlockNumber, Header}; - use primitives::parachain::{Id as ParaId, Info as ParaInfo, Scheduling}; + use primitives::v0::{BlockNumber, Header, Id as ParaId, Info as ParaInfo, Scheduling}; impl_outer_origin! { pub enum Origin for Test {} diff --git a/runtime/kusama/src/constants.rs b/runtime/kusama/src/constants.rs index e06325d1bb95..560d83347d9b 100644 --- a/runtime/kusama/src/constants.rs +++ b/runtime/kusama/src/constants.rs @@ -16,7 +16,7 @@ /// Money matters. pub mod currency { - use primitives::Balance; + use primitives::v0::Balance; pub const DOTS: Balance = 1_000_000_000_000; pub const DOLLARS: Balance = DOTS / 6; @@ -30,7 +30,7 @@ pub mod currency { /// Time and blocks. pub mod time { - use primitives::{Moment, BlockNumber}; + use primitives::v0::{Moment, BlockNumber}; // Kusama & mainnet pub const MILLISECS_PER_BLOCK: Moment = 6000; // Testnet @@ -55,7 +55,7 @@ pub mod time { /// Fee-related. pub mod fee { pub use sp_runtime::Perbill; - use primitives::Balance; + use primitives::v0::Balance; use runtime_common::ExtrinsicBaseWeight; use frame_support::weights::{ WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index ee25e8961dec..569d055ccafe 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -23,9 +23,10 @@ use sp_std::prelude::*; use sp_core::u32_trait::{_1, _2, _3, _4, _5}; use codec::{Encode, Decode}; -use primitives::{ +use primitives::v0::{ + self as parachain, AccountId, AccountIndex, Balance, BlockNumber, Hash, Nonce, Signature, Moment, - parachain::{self, ActiveParas, AbridgedCandidateReceipt, SigningContext}, + ActiveParas, AbridgedCandidateReceipt, SigningContext, }; use runtime_common::{ attestations, claims, parachains, registrar, slots, SlowAdjustingFeeUpdate, @@ -560,7 +561,7 @@ impl grandpa::Trait for Runtime { type HandleEquivocation = grandpa::EquivocationHandler< Self::KeyOwnerIdentification, - primitives::fisherman::FishermanAppCrypto, + primitives::v0::fisherman::FishermanAppCrypto, Runtime, Offences, >; @@ -596,7 +597,7 @@ parameter_types! { } impl parachains::Trait for Runtime { - type AuthorityId = primitives::fisherman::FishermanAppCrypto; + type AuthorityId = primitives::v0::fisherman::FishermanAppCrypto; type Origin = Origin; type Call = Call; type ParachainCurrency = Balances; @@ -939,7 +940,7 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { construct_runtime! { pub enum Runtime where Block = Block, - NodeBlock = primitives::Block, + NodeBlock = primitives::v0::Block, UncheckedExtrinsic = UncheckedExtrinsic { // Basic stuff; balances is uncallable initially. @@ -1147,7 +1148,7 @@ sp_api::impl_runtime_apis! { fn signing_context() -> SigningContext { Parachains::signing_context() } - fn downward_messages(id: parachain::Id) -> Vec { + fn downward_messages(id: parachain::Id) -> Vec { Parachains::downward_messages(id) } } diff --git a/runtime/parachains/src/configuration.rs b/runtime/parachains/src/configuration.rs index 792dfe89a7b2..40688041b265 100644 --- a/runtime/parachains/src/configuration.rs +++ b/runtime/parachains/src/configuration.rs @@ -19,9 +19,7 @@ //! Configuration can change only at session boundaries and is buffered until then. use sp_std::prelude::*; -use primitives::{ - parachain::{ValidatorId}, -}; +use primitives::v1::ValidatorId; use frame_support::{ decl_storage, decl_module, decl_error, dispatch::DispatchResult, diff --git a/runtime/parachains/src/inclusion.rs b/runtime/parachains/src/inclusion.rs index 33a5e2d1e919..a2480f1c8034 100644 --- a/runtime/parachains/src/inclusion.rs +++ b/runtime/parachains/src/inclusion.rs @@ -21,12 +21,10 @@ //! to included. use sp_std::prelude::*; -use primitives::{ - parachain::{ - ValidatorId, AbridgedCandidateReceipt, ValidatorIndex, Id as ParaId, - AvailabilityBitfield as AvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, - BackedCandidate, CoreIndex, GroupIndex, CoreAssignment, - }, +use primitives::v1::{ + ValidatorId, CommittedCandidateReceipt, ValidatorIndex, Id as ParaId, + AvailabilityBitfield as AvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, + BackedCandidate, CoreIndex, GroupIndex, CoreAssignment, }; use frame_support::{ decl_storage, decl_module, decl_error, ensure, dispatch::DispatchResult, IterableStorageMap, @@ -53,13 +51,15 @@ pub struct AvailabilityBitfieldRecord { } /// A backed candidate pending availability. +// TODO: split this type and change this to hold a plain `CandidateReceipt`. +// https://github.com/paritytech/polkadot/issues/1357 #[derive(Encode, Decode, PartialEq)] #[cfg_attr(test, derive(Debug))] pub struct CandidatePendingAvailability { /// The availability core this is assigned to. core: CoreIndex, /// The candidate receipt itself. - receipt: AbridgedCandidateReceipt, + receipt: CommittedCandidateReceipt, /// The received availability votes. One bit per validator. availability_votes: BitVec, /// The block number of the relay-parent of the receipt. @@ -213,7 +213,10 @@ impl Module { let validator_public = &validators[signed_bitfield.validator_index() as usize]; - signed_bitfield.check_signature(&signing_context, validator_public).map_err(|_| Error::::InvalidBitfieldSignature)?; + signed_bitfield.check_signature( + &signing_context, + validator_public, + ).map_err(|_| Error::::InvalidBitfieldSignature)?; last_index = Some(signed_bitfield.validator_index()); } @@ -331,11 +334,11 @@ impl Module { // list. 'a: for candidate in &candidates { - let para_id = candidate.candidate.parachain_index; + let para_id = candidate.descriptor().para_id; // we require that the candidate is in the context of the parent block. ensure!( - candidate.candidate.relay_parent == parent_hash, + candidate.descriptor().relay_parent == parent_hash, Error::::CandidateNotInParentContext, ); @@ -348,17 +351,17 @@ impl Module { ensure!(code_upgrade_allowed, Error::::PrematureCodeUpgrade); ensure!( - candidate.candidate.check_signature().is_ok(), + candidate.descriptor().check_collator_signature().is_ok(), Error::::NotCollatorSigned, ); for (i, assignment) in scheduled[skip..].iter().enumerate() { check_assignment_in_order(assignment)?; - if candidate.candidate.parachain_index == assignment.para_id { + if candidate.descriptor().para_id == assignment.para_id { if let Some(required_collator) = assignment.required_collator() { ensure!( - required_collator == &candidate.candidate.collator, + required_collator == &candidate.descriptor().collator, Error::::WrongCollator, ); } @@ -377,7 +380,7 @@ impl Module { // check the signatures in the backing and that it is a majority. { let maybe_amount_validated - = primitives::parachain::check_candidate_backing( + = primitives::v1::check_candidate_backing( &candidate, &signing_context, group_vals.len(), @@ -419,7 +422,7 @@ impl Module { // one more sweep for actually writing to storage. for (candidate, core) in candidates.into_iter().zip(core_indices.iter().cloned()) { - let para_id = candidate.candidate.parachain_index; + let para_id = candidate.descriptor().para_id; // initialize all availability votes to 0. let availability_votes: BitVec @@ -438,7 +441,7 @@ impl Module { fn enact_candidate( relay_parent_number: T::BlockNumber, - receipt: AbridgedCandidateReceipt, + receipt: CommittedCandidateReceipt, ) -> Weight { let commitments = receipt.commitments; let config = >::config(); @@ -447,15 +450,15 @@ impl Module { let mut weight = T::DbWeight::get().reads_writes(1, 0); if let Some(new_code) = commitments.new_validation_code { weight += >::schedule_code_upgrade( - receipt.parachain_index, + receipt.descriptor.para_id, new_code, relay_parent_number + config.validation_upgrade_delay, ); } weight + >::note_new_head( - receipt.parachain_index, - receipt.head_data, + receipt.descriptor.para_id, + commitments.head_data, relay_parent_number, ) } @@ -495,10 +498,11 @@ const fn availability_threshold(n_validators: usize) -> usize { mod tests { use super::*; - use primitives::{BlockNumber, Hash}; - use primitives::parachain::{ + use primitives::v1::{BlockNumber, Hash}; + use primitives::v1::{ SignedAvailabilityBitfield, CompactStatement as Statement, ValidityAttestation, CollatorId, - CandidateCommitments, SignedStatement, AssignmentKind, + CandidateCommitments, SignedStatement, CandidateDescriptor, HeadData, ValidationCode, + AssignmentKind, }; use frame_support::traits::{OnFinalize, OnInitialize}; use keyring::Sr25519Keyring; @@ -545,22 +549,22 @@ mod tests { fn collator_sign_candidate( collator: Sr25519Keyring, - candidate: &mut AbridgedCandidateReceipt, + candidate: &mut CommittedCandidateReceipt, ) { - candidate.collator = collator.public().into(); + candidate.descriptor.collator = collator.public().into(); - let payload = primitives::parachain::collator_signature_payload( - &candidate.relay_parent, - &candidate.parachain_index, - &candidate.pov_block_hash, + let payload = primitives::v1::collator_signature_payload( + &candidate.descriptor.relay_parent, + &candidate.descriptor.para_id, + &candidate.descriptor.pov_hash, ); - candidate.signature = collator.sign(&payload[..]).into(); - assert!(candidate.check_signature().is_ok()); + candidate.descriptor.signature = collator.sign(&payload[..]).into(); + assert!(candidate.descriptor().check_collator_signature().is_ok()); } fn back_candidate( - candidate: AbridgedCandidateReceipt, + candidate: CommittedCandidateReceipt, validators: &[Sr25519Keyring], group: &[ValidatorIndex], signing_context: &SigningContext, @@ -603,7 +607,7 @@ mod tests { BackingKind::Lacking => false, }; - let successfully_backed = primitives::parachain::check_candidate_backing( + let successfully_backed = primitives::v1::check_candidate_backing( &backed, signing_context, group.len(), @@ -674,6 +678,33 @@ mod tests { ) } + #[derive(Default)] + struct TestCandidateBuilder { + para_id: ParaId, + head_data: HeadData, + pov_hash: Hash, + relay_parent: Hash, + new_validation_code: Option, + } + + impl TestCandidateBuilder { + fn build(self) -> CommittedCandidateReceipt { + CommittedCandidateReceipt { + descriptor: CandidateDescriptor { + para_id: self.para_id, + pov_hash: self.pov_hash, + relay_parent: self.relay_parent, + ..Default::default() + }, + commitments: CandidateCommitments { + head_data: self.head_data, + new_validation_code: self.new_validation_code, + ..Default::default() + }, + } + } + } + #[test] fn collect_pending_cleans_up_pending() { let chain_a = ParaId::from(1); @@ -895,11 +926,11 @@ mod tests { >::insert(chain_a, CandidatePendingAvailability { core: CoreIndex::from(0), - receipt: AbridgedCandidateReceipt { - parachain_index: chain_a, + receipt: TestCandidateBuilder { + para_id: chain_a, head_data: vec![1, 2, 3, 4].into(), ..Default::default() - }, + }.build(), availability_votes: default_availability_votes(), relay_parent_number: 0, backed_in_number: 0, @@ -907,11 +938,11 @@ mod tests { >::insert(chain_b, CandidatePendingAvailability { core: CoreIndex::from(1), - receipt: AbridgedCandidateReceipt { - parachain_index: chain_b, + receipt: TestCandidateBuilder { + para_id: chain_b, head_data: vec![5, 6, 7, 8].into(), ..Default::default() - }, + }.build(), availability_votes: default_availability_votes(), relay_parent_number: 0, backed_in_number: 0, @@ -1043,12 +1074,12 @@ mod tests { // unscheduled candidate. { - let mut candidate = AbridgedCandidateReceipt { - parachain_index: chain_a, + let mut candidate = TestCandidateBuilder { + para_id: chain_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([1; 32]), + pov_hash: Hash::from([1; 32]), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::One, &mut candidate, @@ -1071,18 +1102,18 @@ mod tests { // candidates out of order. { - let mut candidate_a = AbridgedCandidateReceipt { - parachain_index: chain_a, + let mut candidate_a = TestCandidateBuilder { + para_id: chain_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([1; 32]), + pov_hash: Hash::from([1; 32]), ..Default::default() - }; - let mut candidate_b = AbridgedCandidateReceipt { - parachain_index: chain_b, + }.build(); + let mut candidate_b = TestCandidateBuilder { + para_id: chain_b, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([2; 32]), + pov_hash: Hash::from([2; 32]), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::One, @@ -1119,12 +1150,12 @@ mod tests { // candidate not backed. { - let mut candidate = AbridgedCandidateReceipt { - parachain_index: chain_a, + let mut candidate = TestCandidateBuilder { + para_id: chain_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([1; 32]), + pov_hash: Hash::from([1; 32]), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::One, &mut candidate, @@ -1150,12 +1181,12 @@ mod tests { let wrong_parent_hash = Hash::from([222; 32]); assert!(System::parent_hash() != wrong_parent_hash); - let mut candidate = AbridgedCandidateReceipt { - parachain_index: chain_a, + let mut candidate = TestCandidateBuilder { + para_id: chain_a, relay_parent: wrong_parent_hash, - pov_block_hash: Hash::from([1; 32]), + pov_hash: Hash::from([1; 32]), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::One, &mut candidate, @@ -1178,12 +1209,12 @@ mod tests { // candidate has wrong collator. { - let mut candidate = AbridgedCandidateReceipt { - parachain_index: thread_a, + let mut candidate = TestCandidateBuilder { + para_id: thread_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([1; 32]), + pov_hash: Hash::from([1; 32]), ..Default::default() - }; + }.build(); assert!(CollatorId::from(Sr25519Keyring::One.public()) != thread_collator); collator_sign_candidate( @@ -1212,12 +1243,12 @@ mod tests { // candidate not well-signed by collator. { - let mut candidate = AbridgedCandidateReceipt { - parachain_index: thread_a, + let mut candidate = TestCandidateBuilder { + para_id: thread_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([1; 32]), + pov_hash: Hash::from([1; 32]), ..Default::default() - }; + }.build(); assert_eq!(CollatorId::from(Sr25519Keyring::Two.public()), thread_collator); collator_sign_candidate( @@ -1225,7 +1256,8 @@ mod tests { &mut candidate, ); - candidate.pov_block_hash = Hash::from([2; 32]); + // change the candidate after signing. + candidate.descriptor.pov_hash = Hash::from([2; 32]); let backed = back_candidate( candidate, @@ -1244,12 +1276,12 @@ mod tests { // para occupied - reject. { - let mut candidate = AbridgedCandidateReceipt { - parachain_index: chain_a, + let mut candidate = TestCandidateBuilder { + para_id: chain_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([1; 32]), + pov_hash: Hash::from([1; 32]), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::One, @@ -1283,16 +1315,13 @@ mod tests { // interfering code upgrade - reject { - let mut candidate = AbridgedCandidateReceipt { - parachain_index: chain_a, + let mut candidate = TestCandidateBuilder { + para_id: chain_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([1; 32]), - commitments: CandidateCommitments { - new_validation_code: Some(vec![5, 6, 7, 8].into()), - ..Default::default() - }, + pov_hash: Hash::from([1; 32]), + new_validation_code: Some(vec![5, 6, 7, 8].into()), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::One, @@ -1381,34 +1410,34 @@ mod tests { group_idx: GroupIndex::from(2), }; - let mut candidate_a = AbridgedCandidateReceipt { - parachain_index: chain_a, + let mut candidate_a = TestCandidateBuilder { + para_id: chain_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([1; 32]), + pov_hash: Hash::from([1; 32]), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::One, &mut candidate_a, ); - let mut candidate_b = AbridgedCandidateReceipt { - parachain_index: chain_b, + let mut candidate_b = TestCandidateBuilder { + para_id: chain_b, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([2; 32]), + pov_hash: Hash::from([2; 32]), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::One, &mut candidate_b, ); - let mut candidate_c = AbridgedCandidateReceipt { - parachain_index: thread_a, + let mut candidate_c = TestCandidateBuilder { + para_id: thread_a, relay_parent: System::parent_hash(), - pov_block_hash: Hash::from([3; 32]), + pov_hash: Hash::from([3; 32]), ..Default::default() - }; + }.build(); collator_sign_candidate( Sr25519Keyring::Two, &mut candidate_c, diff --git a/runtime/parachains/src/inclusion_inherent.rs b/runtime/parachains/src/inclusion_inherent.rs index 282b6f3b8a21..6d06961b461a 100644 --- a/runtime/parachains/src/inclusion_inherent.rs +++ b/runtime/parachains/src/inclusion_inherent.rs @@ -22,9 +22,8 @@ //! this module. use sp_std::prelude::*; -use primitives::{ - inclusion_inherent, - parachain::{BackedCandidate, SignedAvailabilityBitfields}, +use primitives::v1::{ + BackedCandidate, SignedAvailabilityBitfields, INCLUSION_INHERENT_IDENTIFIER, }; use frame_support::{ decl_error, decl_module, decl_storage, ensure, @@ -127,7 +126,7 @@ decl_module! { impl ProvideInherent for Module { type Call = Call; type Error = MakeFatalError<()>; - const INHERENT_IDENTIFIER: InherentIdentifier = inclusion_inherent::INHERENT_IDENTIFIER; + const INHERENT_IDENTIFIER: InherentIdentifier = INCLUSION_INHERENT_IDENTIFIER; fn create_inherent(data: &InherentData) -> Option { data.get_data(&Self::INHERENT_IDENTIFIER) diff --git a/runtime/parachains/src/initializer.rs b/runtime/parachains/src/initializer.rs index 9c0cda29697a..0c4f83cccea1 100644 --- a/runtime/parachains/src/initializer.rs +++ b/runtime/parachains/src/initializer.rs @@ -21,9 +21,7 @@ use sp_std::prelude::*; use frame_support::weights::Weight; -use primitives::{ - parachain::{ValidatorId}, -}; +use primitives::v1::ValidatorId; use frame_support::{ decl_storage, decl_module, decl_error, traits::Randomness, }; diff --git a/runtime/parachains/src/mock.rs b/runtime/parachains/src/mock.rs index 9cc9f2329b8f..8eb45359da48 100644 --- a/runtime/parachains/src/mock.rs +++ b/runtime/parachains/src/mock.rs @@ -24,10 +24,7 @@ use sp_runtime::{ BlakeTwo256, IdentityLookup, }, }; -use primitives::{ - BlockNumber, - Header, -}; +use primitives::v1::{BlockNumber, Header}; use frame_support::{ impl_outer_origin, impl_outer_dispatch, parameter_types, weights::Weight, traits::Randomness as RandomnessT, diff --git a/runtime/parachains/src/paras.rs b/runtime/parachains/src/paras.rs index 8c095751b3f6..0117089f1106 100644 --- a/runtime/parachains/src/paras.rs +++ b/runtime/parachains/src/paras.rs @@ -26,8 +26,8 @@ use sp_std::prelude::*; use sp_std::marker::PhantomData; use sp_runtime::traits::One; -use primitives::{ - parachain::{Id as ParaId, ValidationCode, HeadData}, +use primitives::v1::{ + Id as ParaId, ValidationCode, HeadData, }; use frame_support::{ decl_storage, decl_module, decl_error, @@ -541,7 +541,7 @@ impl Module { #[cfg(test)] mod tests { use super::*; - use primitives::BlockNumber; + use primitives::v1::BlockNumber; use frame_support::traits::{OnFinalize, OnInitialize}; use crate::mock::{new_test_ext, Paras, System, GenesisConfig as MockGenesisConfig}; diff --git a/runtime/parachains/src/scheduler.rs b/runtime/parachains/src/scheduler.rs index 772ab25cf4fd..9cc2bd72bd81 100644 --- a/runtime/parachains/src/scheduler.rs +++ b/runtime/parachains/src/scheduler.rs @@ -37,11 +37,9 @@ use sp_std::prelude::*; use sp_std::convert::TryInto; -use primitives::{ - parachain::{ - Id as ParaId, ValidatorIndex, CoreAssignment, CoreOccupied, CoreIndex, AssignmentKind, - GroupIndex, ParathreadClaim, ParathreadEntry, - }, +use primitives::v1::{ + Id as ParaId, ValidatorIndex, CoreAssignment, CoreOccupied, CoreIndex, AssignmentKind, + GroupIndex, ParathreadClaim, ParathreadEntry, }; use frame_support::{ decl_storage, decl_module, decl_error, @@ -586,7 +584,7 @@ impl Module { mod tests { use super::*; - use primitives::{BlockNumber, parachain::{CollatorId, ValidatorId}}; + use primitives::v1::{BlockNumber, ValidatorId, CollatorId}; use frame_support::traits::{OnFinalize, OnInitialize}; use keyring::Sr25519Keyring; diff --git a/runtime/polkadot/src/constants.rs b/runtime/polkadot/src/constants.rs index 331d97f364cf..8ad5478bcab8 100644 --- a/runtime/polkadot/src/constants.rs +++ b/runtime/polkadot/src/constants.rs @@ -16,7 +16,7 @@ /// Money matters. pub mod currency { - use primitives::Balance; + use primitives::v0::Balance; pub const DOTS: Balance = 1_000_000_000_000; pub const DOLLARS: Balance = DOTS / 100; // 10_000_000_000 @@ -30,7 +30,7 @@ pub mod currency { /// Time and blocks. pub mod time { - use primitives::{Moment, BlockNumber}; + use primitives::v0::{Moment, BlockNumber}; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 4 * HOURS; @@ -47,7 +47,7 @@ pub mod time { /// Fee-related. pub mod fee { pub use sp_runtime::Perbill; - use primitives::Balance; + use primitives::v0::Balance; use runtime_common::ExtrinsicBaseWeight; use frame_support::weights::{ WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index abd9687164c2..258a7b4781b4 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -31,9 +31,10 @@ use runtime_common::{ use sp_std::prelude::*; use sp_core::u32_trait::{_1, _2, _3, _4, _5}; use codec::{Encode, Decode}; -use primitives::{ +use primitives::v0::{ + self as parachain, AccountId, AccountIndex, Balance, BlockNumber, Hash, Nonce, Signature, Moment, - parachain::{self, ActiveParas, AbridgedCandidateReceipt, SigningContext}, + ActiveParas, AbridgedCandidateReceipt, SigningContext, }; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, ModuleId, @@ -629,7 +630,7 @@ impl grandpa::Trait for Runtime { type HandleEquivocation = grandpa::EquivocationHandler< Self::KeyOwnerIdentification, - primitives::fisherman::FishermanAppCrypto, + primitives::v0::fisherman::FishermanAppCrypto, Runtime, Offences, >; @@ -666,7 +667,7 @@ parameter_types! { } impl parachains::Trait for Runtime { - type AuthorityId = primitives::fisherman::FishermanAppCrypto; + type AuthorityId = primitives::v0::fisherman::FishermanAppCrypto; type Origin = Origin; type Call = Call; type ParachainCurrency = Balances; @@ -943,7 +944,7 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { construct_runtime! { pub enum Runtime where Block = Block, - NodeBlock = primitives::Block, + NodeBlock = primitives::v0::Block, UncheckedExtrinsic = UncheckedExtrinsic { // Basic stuff; balances is uncallable initially. @@ -1147,7 +1148,7 @@ sp_api::impl_runtime_apis! { fn signing_context() -> SigningContext { Parachains::signing_context() } - fn downward_messages(id: parachain::Id) -> Vec { + fn downward_messages(id: parachain::Id) -> Vec { Parachains::downward_messages(id) } } diff --git a/runtime/polkadot/tests/weights.rs b/runtime/polkadot/tests/weights.rs index 533783a4e491..3cdb71995801 100644 --- a/runtime/polkadot/tests/weights.rs +++ b/runtime/polkadot/tests/weights.rs @@ -29,7 +29,7 @@ use frame_support::{ use keyring::AccountKeyring; use polkadot_runtime::constants::currency::*; use polkadot_runtime::{self, Runtime}; -use primitives::AccountId; +use primitives::v0::AccountId; use runtime_common::MaximumBlockWeight; use democracy::Call as DemocracyCall; diff --git a/runtime/test-runtime/client/src/lib.rs b/runtime/test-runtime/client/src/lib.rs index 2554f4f1c824..58282d32b46b 100644 --- a/runtime/test-runtime/client/src/lib.rs +++ b/runtime/test-runtime/client/src/lib.rs @@ -326,7 +326,7 @@ pub fn new_native_executor() -> sc_executor::NativeExecutor { /// The index of the block must be provided to calculate a valid timestamp for the block. The value starts at 0 and /// should be incremented by one for every block produced. pub fn needed_extrinsics( - heads: Vec, + heads: Vec, i: u64, ) -> Vec { use polkadot_runtime_common::parachains; diff --git a/runtime/test-runtime/src/constants.rs b/runtime/test-runtime/src/constants.rs index b0431e55f268..ac90417b214c 100644 --- a/runtime/test-runtime/src/constants.rs +++ b/runtime/test-runtime/src/constants.rs @@ -16,7 +16,7 @@ /// Money matters. pub mod currency { - use primitives::Balance; + use primitives::v0::Balance; pub const DOTS: Balance = 1_000_000_000_000; pub const DOLLARS: Balance = DOTS; @@ -26,7 +26,7 @@ pub mod currency { /// Time and blocks. pub mod time { - use primitives::{Moment, BlockNumber}; + use primitives::v0::{Moment, BlockNumber}; // Testnet pub const MILLISECS_PER_BLOCK: Moment = 1000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; @@ -45,7 +45,7 @@ pub mod time { /// Fee-related. pub mod fee { pub use sp_runtime::Perbill; - use primitives::Balance; + use primitives::v0::Balance; use runtime_common::ExtrinsicBaseWeight; use frame_support::weights::{ WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index 57ceffa4a96f..45d5a04c313f 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -22,9 +22,10 @@ use rstd::prelude::*; use codec::{Encode, Decode}; -use primitives::{ +use primitives::v0::{ + self as parachain, AccountId, AccountIndex, Balance, BlockNumber, Hash as HashT, Nonce, Signature, Moment, - parachain::{self, ActiveParas, AbridgedCandidateReceipt, SigningContext}, ValidityError, + ActiveParas, AbridgedCandidateReceipt, SigningContext, ValidityError, }; use runtime_common::{ attestations, claims, parachains, registrar, slots, SlowAdjustingFeeUpdate, @@ -375,7 +376,7 @@ parameter_types! { } impl parachains::Trait for Runtime { - type AuthorityId = primitives::fisherman::FishermanAppCrypto; + type AuthorityId = primitives::v0::fisherman::FishermanAppCrypto; type Origin = Origin; type Call = Call; type ParachainCurrency = Balances; @@ -521,7 +522,7 @@ impl sudo::Trait for Runtime { construct_runtime! { pub enum Runtime where Block = Block, - NodeBlock = primitives::Block, + NodeBlock = primitives::v0::Block, UncheckedExtrinsic = UncheckedExtrinsic { // Basic stuff; balances is uncallable initially. @@ -702,7 +703,7 @@ sp_api::impl_runtime_apis! { fn signing_context() -> SigningContext { Parachains::signing_context() } - fn downward_messages(id: parachain::Id) -> Vec { + fn downward_messages(id: parachain::Id) -> Vec { Parachains::downward_messages(id) } } diff --git a/runtime/westend/src/constants.rs b/runtime/westend/src/constants.rs index ac25d621d856..f59a384fba8b 100644 --- a/runtime/westend/src/constants.rs +++ b/runtime/westend/src/constants.rs @@ -16,7 +16,7 @@ /// Money matters. pub mod currency { - use primitives::Balance; + use primitives::v0::Balance; pub const DOTS: Balance = 1_000_000_000_000; pub const DOLLARS: Balance = DOTS; @@ -30,7 +30,7 @@ pub mod currency { /// Time and blocks. pub mod time { - use primitives::{Moment, BlockNumber}; + use primitives::v0::{Moment, BlockNumber}; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 1 * HOURS; @@ -47,7 +47,7 @@ pub mod time { /// Fee-related. pub mod fee { pub use sp_runtime::Perbill; - use primitives::Balance; + use primitives::v0::Balance; use runtime_common::ExtrinsicBaseWeight; use frame_support::weights::{ WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 41613bbb0118..a40c4e3dd5a7 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -22,9 +22,10 @@ use sp_std::prelude::*; use codec::{Encode, Decode}; -use primitives::{ +use primitives::v0::{ + self as parachain, AccountId, AccountIndex, Balance, BlockNumber, Hash, Nonce, Signature, Moment, - parachain::{self, ActiveParas, AbridgedCandidateReceipt, SigningContext}, + ActiveParas, AbridgedCandidateReceipt, SigningContext, }; use runtime_common::{ attestations, parachains, registrar, SlowAdjustingFeeUpdate, @@ -385,7 +386,7 @@ impl grandpa::Trait for Runtime { type HandleEquivocation = grandpa::EquivocationHandler< Self::KeyOwnerIdentification, - primitives::fisherman::FishermanAppCrypto, + primitives::v0::fisherman::FishermanAppCrypto, Runtime, Offences, >; @@ -421,7 +422,7 @@ parameter_types! { } impl parachains::Trait for Runtime { - type AuthorityId = primitives::fisherman::FishermanAppCrypto; + type AuthorityId = primitives::v0::fisherman::FishermanAppCrypto; type Origin = Origin; type Call = Call; type ParachainCurrency = Balances; @@ -698,7 +699,7 @@ impl proxy::Trait for Runtime { construct_runtime! { pub enum Runtime where Block = Block, - NodeBlock = primitives::Block, + NodeBlock = primitives::v0::Block, UncheckedExtrinsic = UncheckedExtrinsic { // Basic stuff; balances is uncallable initially. @@ -887,7 +888,7 @@ sp_api::impl_runtime_apis! { fn signing_context() -> SigningContext { Parachains::signing_context() } - fn downward_messages(id: parachain::Id) -> Vec { + fn downward_messages(id: parachain::Id) -> Vec { Parachains::downward_messages(id) } } diff --git a/service/src/chain_spec.rs b/service/src/chain_spec.rs index 5e1bfbbdbab0..fe8d98d0553f 100644 --- a/service/src/chain_spec.rs +++ b/service/src/chain_spec.rs @@ -17,7 +17,7 @@ //! Polkadot chain configurations. use sp_core::{Pair, Public, crypto::UncheckedInto, sr25519}; -use polkadot_primitives::{AccountId, AccountPublic, parachain::ValidatorId}; +use polkadot_primitives::v0::{AccountId, AccountPublic, ValidatorId}; use polkadot_runtime as polkadot; use kusama_runtime as kusama; use westend_runtime as westend; @@ -48,9 +48,9 @@ const DEFAULT_PROTOCOL_ID: &str = "dot"; #[serde(rename_all = "camelCase")] pub struct Extensions { /// Block numbers with known hashes. - pub fork_blocks: sc_client_api::ForkBlocks, + pub fork_blocks: sc_client_api::ForkBlocks, /// Known bad block hashes. - pub bad_blocks: sc_client_api::BadBlocks, + pub bad_blocks: sc_client_api::BadBlocks, } /// The `ChainSpec parametrised for polkadot runtime`. diff --git a/service/src/grandpa_support.rs b/service/src/grandpa_support.rs index 794b4e4fc180..89a0691b360d 100644 --- a/service/src/grandpa_support.rs +++ b/service/src/grandpa_support.rs @@ -16,7 +16,7 @@ //! Polkadot-specific GRANDPA integration utilities. -use polkadot_primitives::Hash; +use polkadot_primitives::v0::Hash; use sp_runtime::traits::{Block as BlockT, NumberFor}; /// A custom GRANDPA voting rule that "pauses" voting (i.e. keeps voting for the @@ -98,7 +98,7 @@ impl grandpa::VotingRule for PauseAfterBlockFor Vec<( grandpa_primitives::SetId, - (Hash, polkadot_primitives::BlockNumber), + (Hash, polkadot_primitives::v0::BlockNumber), grandpa_primitives::AuthorityList, )> { use sp_core::crypto::Ss58Codec; diff --git a/service/src/lib.rs b/service/src/lib.rs index eaa5f9682f0c..d0b443ea7d88 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -22,7 +22,7 @@ mod client; use std::sync::Arc; use std::time::Duration; -use polkadot_primitives::{parachain, Hash, BlockId, AccountId, Nonce, Balance}; +use polkadot_primitives::v0::{self as parachain, Hash, BlockId, AccountId, Nonce, Balance}; #[cfg(feature = "full-node")] use polkadot_network::{legacy::gossip::Known, protocol as network_protocol}; use service::{error::Error as ServiceError, ServiceBuilder}; @@ -42,8 +42,7 @@ pub use sc_consensus::LongestChain; pub use sp_api::{Core as CoreApi, ConstructRuntimeApi, ProvideRuntimeApi, StateBackend}; pub use sp_runtime::traits::{HashFor, NumberFor}; pub use consensus_common::{SelectChain, BlockImport, block_validation::Chain}; -pub use polkadot_primitives::parachain::{CollatorId, ParachainHost}; -pub use polkadot_primitives::Block; +pub use polkadot_primitives::v0::{Block, CollatorId, ParachainHost}; pub use sp_runtime::traits::{Block as BlockT, self as runtime_traits, BlakeTwo256}; pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec}; #[cfg(feature = "full-node")] diff --git a/statement-table/src/generic.rs b/statement-table/src/generic.rs index 11c6a3c02478..cb95d74d6223 100644 --- a/statement-table/src/generic.rs +++ b/statement-table/src/generic.rs @@ -28,7 +28,7 @@ use std::collections::hash_map::{HashMap, Entry}; use std::hash::Hash; use std::fmt::Debug; -use primitives::parachain::{ValidityAttestation as PrimitiveValidityAttestation, ValidatorSignature}; +use primitives::v1::{ValidityAttestation as PrimitiveValidityAttestation, ValidatorSignature}; use codec::{Encode, Decode}; diff --git a/statement-table/src/lib.rs b/statement-table/src/lib.rs index 97d0cda76344..fed60ded0da2 100644 --- a/statement-table/src/lib.rs +++ b/statement-table/src/lib.rs @@ -16,75 +16,87 @@ pub mod generic; -pub use generic::Table; - -use primitives::parachain::{ - Id, AbridgedCandidateReceipt, CompactStatement as PrimitiveStatement, ValidatorSignature, ValidatorIndex, -}; -use primitives::Hash; - -/// Statements about candidates on the network. -pub type Statement = generic::Statement; - -/// Signed statements about candidates. -pub type SignedStatement = generic::SignedStatement< - AbridgedCandidateReceipt, - Hash, - ValidatorIndex, - ValidatorSignature, ->; - -/// Kinds of misbehavior, along with proof. -pub type Misbehavior = generic::Misbehavior< - AbridgedCandidateReceipt, - Hash, - ValidatorIndex, - ValidatorSignature, ->; - -/// A summary of import of a statement. -pub type Summary = generic::Summary; - -/// Context necessary to construct a table. -pub trait Context { - /// Whether a authority is a member of a group. - /// Members are meant to submit candidates and vote on validity. - fn is_member_of(&self, authority: ValidatorIndex, group: &Id) -> bool; - - /// requisite number of votes for validity from a group. - fn requisite_votes(&self, group: &Id) -> usize; -} - -impl generic::Context for C { - type AuthorityId = ValidatorIndex; - type Digest = Hash; - type GroupId = Id; - type Signature = ValidatorSignature; - type Candidate = AbridgedCandidateReceipt; - - fn candidate_digest(candidate: &AbridgedCandidateReceipt) -> Hash { - candidate.hash() - } - - fn candidate_group(candidate: &AbridgedCandidateReceipt) -> Id { - candidate.parachain_index.clone() - } - - fn is_member_of(&self, authority: &Self::AuthorityId, group: &Id) -> bool { - Context::is_member_of(self, *authority, group) - } - - fn requisite_votes(&self, group: &Id) -> usize { - Context::requisite_votes(self, group) +pub use generic::{Table, Context}; + +/// Concrete instantiations suitable for v0 primitives. +pub mod v0 { + use crate::generic; + use primitives::v0::{ + Hash, + Id, AbridgedCandidateReceipt, CompactStatement as PrimitiveStatement, ValidatorSignature, ValidatorIndex, + }; + + /// Statements about candidates on the network. + pub type Statement = generic::Statement; + + /// Signed statements about candidates. + pub type SignedStatement = generic::SignedStatement< + AbridgedCandidateReceipt, + Hash, + ValidatorIndex, + ValidatorSignature, + >; + + /// Kinds of misbehavior, along with proof. + pub type Misbehavior = generic::Misbehavior< + AbridgedCandidateReceipt, + Hash, + ValidatorIndex, + ValidatorSignature, + >; + + /// A summary of import of a statement. + pub type Summary = generic::Summary; + + impl<'a> From<&'a Statement> for PrimitiveStatement { + fn from(s: &'a Statement) -> PrimitiveStatement { + match *s { + generic::Statement::Valid(s) => PrimitiveStatement::Valid(s), + generic::Statement::Invalid(s) => PrimitiveStatement::Invalid(s), + generic::Statement::Candidate(ref s) => PrimitiveStatement::Candidate(s.hash()), + } + } } } -impl<'a> From<&'a Statement> for PrimitiveStatement { - fn from(s: &'a Statement) -> PrimitiveStatement { - match *s { - generic::Statement::Valid(s) => PrimitiveStatement::Valid(s), - generic::Statement::Invalid(s) => PrimitiveStatement::Invalid(s), - generic::Statement::Candidate(ref s) => PrimitiveStatement::Candidate(s.hash()), +/// Concrete instantiations suitable for v1 primitives. +pub mod v1 { + use crate::generic; + use primitives::v1::{ + Hash, + Id, CommittedCandidateReceipt, CompactStatement as PrimitiveStatement, + ValidatorSignature, ValidatorIndex, + }; + + /// Statements about candidates on the network. + pub type Statement = generic::Statement; + + /// Signed statements about candidates. + pub type SignedStatement = generic::SignedStatement< + CommittedCandidateReceipt, + Hash, + ValidatorIndex, + ValidatorSignature, + >; + + /// Kinds of misbehavior, along with proof. + pub type Misbehavior = generic::Misbehavior< + CommittedCandidateReceipt, + Hash, + ValidatorIndex, + ValidatorSignature, + >; + + /// A summary of import of a statement. + pub type Summary = generic::Summary; + + impl<'a> From<&'a Statement> for PrimitiveStatement { + fn from(s: &'a Statement) -> PrimitiveStatement { + match *s { + generic::Statement::Valid(s) => PrimitiveStatement::Valid(s), + generic::Statement::Invalid(s) => PrimitiveStatement::Invalid(s), + generic::Statement::Candidate(ref s) => PrimitiveStatement::Candidate(s.hash()), + } } } } diff --git a/validation/src/block_production.rs b/validation/src/block_production.rs index 30b7ac3ccd46..4804ba230c96 100644 --- a/validation/src/block_production.rs +++ b/validation/src/block_production.rs @@ -28,8 +28,8 @@ use std::{ use sp_blockchain::HeaderBackend; use block_builder::{BlockBuilderApi, BlockBuilderProvider}; use consensus::{Proposal, RecordProof}; -use polkadot_primitives::{Block, Header}; -use polkadot_primitives::parachain::{ +use polkadot_primitives::v0::{Block, Header}; +use polkadot_primitives::v0::{ ParachainHost, NEW_HEADS_IDENTIFIER, }; use runtime_primitives::traits::{DigestFor, HashFor}; diff --git a/validation/src/collation.rs b/validation/src/collation.rs index a2e682a066d6..b79b049b225f 100644 --- a/validation/src/collation.rs +++ b/validation/src/collation.rs @@ -21,11 +21,9 @@ use std::sync::Arc; -use polkadot_primitives::{ +use polkadot_primitives::v0::{ BlakeTwo256, Block, Hash, HashT, - parachain::{ - CollatorId, ParachainHost, Id as ParaId, Collation, ErasureChunk, CollationInfo, - }, + CollatorId, ParachainHost, Id as ParaId, Collation, ErasureChunk, CollationInfo, }; use polkadot_erasure_coding as erasure; use sp_api::ProvideRuntimeApi; diff --git a/validation/src/error.rs b/validation/src/error.rs index 83b51ed23670..5fd990a07133 100644 --- a/validation/src/error.rs +++ b/validation/src/error.rs @@ -16,7 +16,7 @@ //! Errors that can occur during the validation process. -use polkadot_primitives::{parachain::ValidatorId, Hash}; +use polkadot_primitives::v0::{ValidatorId, Hash}; /// Error type for validation #[derive(Debug, derive_more::Display, derive_more::From)] @@ -77,7 +77,7 @@ pub enum Error { CommitmentsMismatch, /// The parachain for which validation work is being done is not active. #[display(fmt = "Parachain {:?} is not active", _0)] - InactiveParachain(polkadot_primitives::parachain::Id), + InactiveParachain(polkadot_primitives::v0::Id), /// Block data is too big #[display(fmt = "Block data is too big (maximum allowed size: {}, actual size: {})", size, max_size)] BlockDataTooBig { size: u64, max_size: u64 }, diff --git a/validation/src/lib.rs b/validation/src/lib.rs index 667f66e275a9..a5b1c1d5c2df 100644 --- a/validation/src/lib.rs +++ b/validation/src/lib.rs @@ -34,7 +34,7 @@ use std::{ sync::Arc, }; use codec::Encode; -use polkadot_primitives::parachain::{ +use polkadot_primitives::v0::{ Id as ParaId, Chain, DutyRoster, AbridgedCandidateReceipt, CompactStatement as PrimitiveStatement, PoVBlock, ErasureChunk, ValidatorSignature, ValidatorIndex, diff --git a/validation/src/pipeline.rs b/validation/src/pipeline.rs index b29285716dd3..f2a705ba101d 100644 --- a/validation/src/pipeline.rs +++ b/validation/src/pipeline.rs @@ -19,12 +19,12 @@ use codec::Encode; use polkadot_erasure_coding as erasure; -use polkadot_primitives::parachain::{ +use polkadot_primitives::v0::{ CollationInfo, PoVBlock, LocalValidationData, GlobalValidationSchedule, OmittedValidationData, AvailableData, FeeSchedule, CandidateCommitments, ErasureChunk, ParachainHost, Id as ParaId, AbridgedCandidateReceipt, ValidationCode, }; -use polkadot_primitives::{Block, BlockId, Balance, Hash}; +use polkadot_primitives::v0::{Block, BlockId, Balance, Hash}; use parachain::{ wasm_executor::{self, ExecutionMode}, primitives::{UpwardMessage, ValidationParams}, @@ -125,7 +125,7 @@ impl<'a> ValidatedCandidate<'a> { omitted_validation, }; - let erasure_chunks = erasure::obtain_chunks( + let erasure_chunks = erasure::obtain_chunks_v0( n_validators, &available_data, )?; diff --git a/validation/src/shared_table/includable.rs b/validation/src/shared_table/includable.rs index 1396f66c5967..317b9e0f7bfe 100644 --- a/validation/src/shared_table/includable.rs +++ b/validation/src/shared_table/includable.rs @@ -18,7 +18,7 @@ use std::collections::HashMap; use futures::channel::oneshot; -use polkadot_primitives::Hash; +use polkadot_primitives::v0::Hash; /// Track includability of a set of candidates, pub(super) fn track>(candidates: I) diff --git a/validation/src/shared_table/mod.rs b/validation/src/shared_table/mod.rs index fd6702a7e640..d42c9b7e561c 100644 --- a/validation/src/shared_table/mod.rs +++ b/validation/src/shared_table/mod.rs @@ -21,11 +21,12 @@ use std::collections::hash_map::{HashMap, Entry}; use std::sync::Arc; use availability_store::{Store as AvailabilityStore}; -use table::{self, Table, Context as TableContextTrait}; -use polkadot_primitives::{Block, Hash}; -use polkadot_primitives::parachain::{ +use table::{v0 as table_v0, Table, Context as TableContextTrait}; +use polkadot_primitives::v0::{ + Block, Hash, Id as ParaId, AbridgedCandidateReceipt, ValidatorPair, ValidatorId, AttestedCandidate, ParachainHost, PoVBlock, ValidatorIndex, SigningContext, + ValidatorSignature, }; use parking_lot::Mutex; @@ -44,7 +45,7 @@ use crate::Error; mod includable; -pub use table::{SignedStatement, Statement}; +pub use table_v0::{SignedStatement, Statement}; pub use table::generic::Statement as GenericStatement; struct TableContext { @@ -54,9 +55,23 @@ struct TableContext { validators: Vec, } -impl table::Context for TableContext { - fn is_member_of(&self, authority: ValidatorIndex, group: &ParaId) -> bool { - let key = match self.validators.get(authority as usize) { +impl TableContextTrait for TableContext { + type AuthorityId = ValidatorIndex; + type Digest = Hash; + type GroupId = ParaId; + type Signature = ValidatorSignature; + type Candidate = AbridgedCandidateReceipt; + + fn candidate_digest(candidate: &AbridgedCandidateReceipt) -> Hash { + candidate.hash() + } + + fn candidate_group(candidate: &AbridgedCandidateReceipt) -> ParaId { + candidate.parachain_index + } + + fn is_member_of(&self, authority: &ValidatorIndex, group: &ParaId) -> bool { + let key = match self.validators.get(*authority as usize) { Some(val) => val, None => return false, }; @@ -84,7 +99,7 @@ impl TableContext { ) } - fn sign_statement(&self, statement: table::Statement) -> Option { + fn sign_statement(&self, statement: table_v0::Statement) -> Option { self.local_index().and_then(move |sender| self.key.as_ref() .map(|key| crate::sign_table_statement( @@ -93,7 +108,7 @@ impl TableContext { &self.signing_context, ).into() ) - .map(move |signature| table::SignedStatement { statement, signature, sender }) + .map(move |signature| table_v0::SignedStatement { statement, signature, sender }) ) } } @@ -145,7 +160,7 @@ impl SharedTableInner { &mut self, context: &TableContext, fetch_pov_block: impl Fn(&AbridgedCandidateReceipt) -> Fetch, - statement: table::SignedStatement, + statement: table_v0::SignedStatement, max_block_data_size: Option, ) -> Option( &self, fetch_pov_block: impl Fn(&AbridgedCandidateReceipt) -> Fetch, - statement: table::SignedStatement, + statement: table_v0::SignedStatement, ) -> Option> { @@ -487,7 +502,7 @@ impl SharedTable { iterable: I, ) -> U where - I: IntoIterator, + I: IntoIterator, U: ::std::iter::FromIterator>>, @@ -539,7 +554,7 @@ impl SharedTable { /// Get a set of candidates that can be proposed. pub fn proposed_set(&self) -> Vec { use table::generic::{ValidityAttestation as GAttestation}; - use polkadot_primitives::parachain::ValidityAttestation; + use polkadot_primitives::v0::ValidityAttestation; // we transform the types of the attestations gathered from the table // into the type expected by the runtime. This may do signature @@ -583,7 +598,7 @@ impl SharedTable { } /// Get all witnessed misbehavior. - pub fn get_misbehavior(&self) -> HashMap { + pub fn get_misbehavior(&self) -> HashMap { self.inner.lock().table.get_misbehavior().clone() } @@ -615,7 +630,7 @@ impl SharedTable { mod tests { use super::*; use sp_keyring::Sr25519Keyring; - use polkadot_primitives::parachain::{ + use polkadot_primitives::v0::{ BlockData, ErasureChunk, AvailableData, }; use polkadot_erasure_coding::{self as erasure}; @@ -706,7 +721,7 @@ mod tests { &validity_other_key.into(), &signing_context, ); - let signed_statement = ::table::generic::SignedStatement { + let signed_statement = table::generic::SignedStatement { statement: candidate_statement, signature: signature.into(), sender: validity_other_index, @@ -763,7 +778,7 @@ mod tests { &validity_other_key.into(), &signing_context, ); - let signed_statement = ::table::generic::SignedStatement { + let signed_statement = table::generic::SignedStatement { statement: candidate_statement, signature: signature.into(), sender: validity_other_index, @@ -860,7 +875,7 @@ mod tests { omitted_validation: Default::default(), }; - let chunks = erasure::obtain_chunks(n_validators, &available_data).unwrap(); + let chunks = erasure::obtain_chunks_v0(n_validators, &available_data).unwrap(); store.note_validator_index_and_n_validators( &relay_parent, @@ -947,7 +962,7 @@ mod tests { &validity_other_key.into(), &signing_context, ); - let signed_statement = ::table::generic::SignedStatement { + let signed_statement = table::generic::SignedStatement { statement: candidate_statement, signature: signature.into(), sender: validity_other_index, diff --git a/validation/src/validation_service/mod.rs b/validation/src/validation_service/mod.rs index d84b1be078ad..7f332f4c0d1a 100644 --- a/validation/src/validation_service/mod.rs +++ b/validation/src/validation_service/mod.rs @@ -32,8 +32,8 @@ use crate::pipeline::FullOutput; use sc_client_api::{BlockchainEvents, BlockBackend}; use consensus::SelectChain; use futures::prelude::*; -use polkadot_primitives::{Block, Hash, BlockId}; -use polkadot_primitives::parachain::{ +use polkadot_primitives::v0::{ + Block, Hash, BlockId, Chain, ParachainHost, Id as ParaId, ValidatorIndex, ValidatorId, ValidatorPair, CollationInfo, SigningContext, }; @@ -545,7 +545,7 @@ mod tests { use super::*; use futures::{executor, future::ready, channel::mpsc}; use availability_store::ErasureNetworking; - use polkadot_primitives::parachain::{ + use polkadot_primitives::v0::{ PoVBlock, AbridgedCandidateReceipt, ErasureChunk, ValidatorIndex, CollationInfo, DutyRoster, GlobalValidationSchedule, LocalValidationData, Retriable, CollatorId, BlockData, Chain, AvailableData, SigningContext, ValidationCode, @@ -706,7 +706,7 @@ mod tests { fn signing_context() -> SigningContext { Default::default() } - fn downward_messages(_: ParaId) -> Vec { + fn downward_messages(_: ParaId) -> Vec { Vec::new() } } From 9f1016d90c86a95e3debaf8a18c64d54c3a3ae24 Mon Sep 17 00:00:00 2001 From: Joseph Mark Date: Fri, 10 Jul 2020 07:58:02 +0200 Subject: [PATCH 8/9] Add Process.toml (#1361) * Add Process.toml * Apply suggestions from code review Co-authored-by: Robert Habermeier --- Process.toml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Process.toml diff --git a/Process.toml b/Process.toml new file mode 100644 index 000000000000..eaf03c1257f9 --- /dev/null +++ b/Process.toml @@ -0,0 +1,15 @@ +[Batch: Availability and Validity] +owner = "rphmeier" +whitelist = [] +matrix_room_id = "!wQXGIDhhJQSVXKqPwi:matrix.parity.io" + +[Batch: Codebase Restructure] +owner = "rphmeier" +whitelist = [] +matrix_room_id = "!wQXGIDhhJQSVXKqPwi:matrix.parity.io" + +[Cumulus] +owner = "bkchr" +whitelist = [] +matrix_room_id = "!wQXGIDhhJQSVXKqPwi:matrix.parity.io" + From 64d0c7ae7194d54fec6e8ca978dec9f2073c528e Mon Sep 17 00:00:00 2001 From: Peter Goodspeed-Niklaus Date: Fri, 10 Jul 2020 08:36:38 +0200 Subject: [PATCH 9/9] add more detail to provisioner block production section (#1370) Per https://github.com/paritytech/polkadot/commit/69ce9ff#r40392855 --- roadmap/implementers-guide/src/node/utility/provisioner.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roadmap/implementers-guide/src/node/utility/provisioner.md b/roadmap/implementers-guide/src/node/utility/provisioner.md index f646e738c467..e88f79ebc615 100644 --- a/roadmap/implementers-guide/src/node/utility/provisioner.md +++ b/roadmap/implementers-guide/src/node/utility/provisioner.md @@ -40,7 +40,7 @@ Note that block authors must re-send a `ProvisionerMessage::RequestBlockAuthorsh ## Block Production -When a validator is selected by BABE to author a block, it becomes a block producer. The provisioner is the subsystem best suited to choosing which specific backed candidates and availability bitfields should be assembled into the block. To engage this functionality, a `ProvisionerMessage::RequestInherentData` is sent; the response is a set of non-conflicting candidates and the appropriate bitfields. Non-conflicting generally means that there are never two distinct parachain candidates included for the same parachain. +When a validator is selected by BABE to author a block, it becomes a block producer. The provisioner is the subsystem best suited to choosing which specific backed candidates and availability bitfields should be assembled into the block. To engage this functionality, a `ProvisionerMessage::RequestInherentData` is sent; the response is a set of non-conflicting candidates and the appropriate bitfields. Non-conflicting means that there are never two distinct parachain candidates included for the same parachain and that new parachain candidates cannot be included until the previous one either gets declared available or expired. One might ask: given `ProvisionerMessage::RequestInherentData`, what's the point of `ProvisionerMessage::RequestBlockAuthorshipData`? The answer is that the block authorship data includes more information than is present in the inherent data; disputes, for example.