diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 66bd12584cb2..a68b0b5f7f94 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -577,20 +577,6 @@ generate-impl-guide: script: - mdbook build roadmap/implementers-guide -check-runtime-benchmarks: - stage: stage3 - # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs - needs: - - job: test-node-metrics - artifacts: false - <<: *test-refs - <<: *docker-env - <<: *compiler-info - script: - # Check that everything compiles with `runtime-benchmarks` feature flag. - - cargo check --features runtime-benchmarks --all - - sccache -s - check-try-runtime: stage: stage3 # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs @@ -620,6 +606,19 @@ check-no-default-features: - pushd cli && cargo check --no-default-features --features "service" && popd - sccache -s +build-short-benchmark: + stage: stage3 + <<: *test-refs + <<: *docker-env + <<: *collect-artifacts + # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs + needs: + - job: test-node-metrics + artifacts: false + script: + - cargo +nightly build --profile release --locked --features=runtime-benchmarks + - mkdir artifacts + - cp ./target/release/polkadot ./artifacts/ deploy-parity-testnet: stage: stage3 @@ -804,6 +803,32 @@ publish-rustdoc: after_script: - rm -rf .git/ ./* +# Run all pallet benchmarks only once to check if there are any errors +short-benchmark-polkadot: &short-bench + stage: stage4 + <<: *test-pr-refs + <<: *docker-env + # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs + needs: + - job: build-short-benchmark + artifacts: true + variables: + RUNTIME: polkadot + # FIXME: https://github.com/paritytech/substrate/pull/11109 + allow_failure: true + script: + - ./artifacts/polkadot benchmark --execution wasm --wasm-execution compiled --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 1 --repeat 1 + +short-benchmark-kusama: + <<: *short-bench + variables: + RUNTIME: kusama + +short-benchmark-westend: + <<: *short-bench + variables: + RUNTIME: westend + #### stage: .post # This job cancels the whole pipeline if any of provided jobs fail. @@ -814,8 +839,6 @@ cancel-pipeline: needs: - job: test-linux-stable artifacts: false - - job: check-runtime-benchmarks - artifacts: false - job: check-try-runtime artifacts: false rules: @@ -825,3 +848,5 @@ cancel-pipeline: PROJECT_ID: "${CI_PROJECT_ID}" PIPELINE_ID: "${CI_PIPELINE_ID}" trigger: "parity/infrastructure/ci_cd/pipeline-stopper" + + diff --git a/Cargo.lock b/Cargo.lock index 12f3ba7a24d9..ef9817640d08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -450,7 +450,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "beefy-primitives", "fnv", @@ -480,7 +480,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -503,12 +503,12 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" [[package]] name = "beefy-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "scale-info", @@ -1138,9 +1138,9 @@ dependencies = [ [[package]] name = "coarsetime" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "441947d9f3582f20b35fdd2bc5ada3a8c74c9ea380d66268607cb399b510ee08" +checksum = "454038500439e141804c655b4cd1bc6a70bcb95cd2bc9463af5661b6956f0e46" dependencies = [ "libc", "once_cell", @@ -2103,7 +2103,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", ] @@ -2121,7 +2121,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -2143,7 +2143,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "Inflector", "chrono", @@ -2186,7 +2186,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -2197,7 +2197,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2213,7 +2213,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -2241,7 +2241,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "bitflags", "frame-metadata", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -2282,7 +2282,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.1.3", @@ -2294,7 +2294,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "proc-macro2", "quote", @@ -2304,7 +2304,7 @@ dependencies = [ [[package]] name = "frame-support-test" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-support-test-pallet", @@ -2327,7 +2327,7 @@ dependencies = [ [[package]] name = "frame-support-test-pallet" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -2338,7 +2338,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "log", @@ -2355,7 +2355,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -2370,7 +2370,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "sp-api", @@ -2379,7 +2379,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "sp-api", @@ -2575,7 +2575,7 @@ dependencies = [ [[package]] name = "generate-bags" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "chrono", "frame-election-provider-support", @@ -5041,7 +5041,7 @@ checksum = "20448fd678ec04e6ea15bbe0476874af65e98a01515d667aa49f1434dc44ebf4" [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5055,7 +5055,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5071,7 +5071,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5086,7 +5086,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5110,7 +5110,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5130,7 +5130,7 @@ dependencies = [ [[package]] name = "pallet-bags-list-remote-tests" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-election-provider-support", "frame-support", @@ -5150,7 +5150,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5165,7 +5165,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "beefy-primitives", "frame-support", @@ -5181,7 +5181,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -5206,7 +5206,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5288,7 +5288,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5307,7 +5307,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5324,7 +5324,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5340,7 +5340,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5363,7 +5363,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5381,7 +5381,7 @@ dependencies = [ [[package]] name = "pallet-gilt" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5396,7 +5396,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5419,7 +5419,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5435,7 +5435,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5455,7 +5455,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5472,7 +5472,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5489,7 +5489,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -5507,7 +5507,7 @@ dependencies = [ [[package]] name = "pallet-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5523,7 +5523,7 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -5540,7 +5540,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5555,7 +5555,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5569,7 +5569,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5586,7 +5586,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5609,7 +5609,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5625,7 +5625,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5640,7 +5640,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5654,7 +5654,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5670,7 +5670,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5691,7 +5691,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5707,7 +5707,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5721,7 +5721,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5744,7 +5744,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -5755,7 +5755,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "log", "sp-arithmetic", @@ -5764,7 +5764,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5778,7 +5778,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5796,7 +5796,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5815,7 +5815,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-support", "frame-system", @@ -5832,7 +5832,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -5849,7 +5849,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5860,7 +5860,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5877,7 +5877,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -5893,7 +5893,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-benchmarking", "frame-support", @@ -7225,6 +7225,7 @@ name = "polkadot-primitives-test-helpers" version = "0.9.18" dependencies = [ "polkadot-primitives", + "rand 0.8.5", "sp-application-crypto", "sp-keyring", "sp-runtime", @@ -7458,6 +7459,7 @@ dependencies = [ "scale-info", "serde", "sp-api", + "sp-application-crypto", "sp-core", "sp-inherents", "sp-io", @@ -8356,7 +8358,7 @@ dependencies = [ [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "env_logger 0.9.0", "jsonrpsee 0.8.0", @@ -8704,7 +8706,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "log", "sp-core", @@ -8715,7 +8717,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "futures 0.3.21", @@ -8742,7 +8744,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "futures-timer", @@ -8765,7 +8767,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -8781,7 +8783,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "impl-trait-for-tuples", "memmap2 0.5.0", @@ -8798,7 +8800,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -8809,7 +8811,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "chrono", "clap", @@ -8847,7 +8849,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "fnv", "futures 0.3.21", @@ -8875,7 +8877,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "hash-db", "kvdb", @@ -8900,7 +8902,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "futures 0.3.21", @@ -8924,7 +8926,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "fork-tree", @@ -8967,7 +8969,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "jsonrpc-core", @@ -8991,7 +8993,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "fork-tree", "parity-scale-codec", @@ -9004,7 +9006,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "futures 0.3.21", @@ -9029,7 +9031,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "sc-client-api", "sp-authorship", @@ -9040,7 +9042,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "lazy_static", "lru 0.6.6", @@ -9067,7 +9069,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "environmental", "parity-scale-codec", @@ -9084,7 +9086,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "log", "parity-scale-codec", @@ -9100,7 +9102,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "cfg-if 1.0.0", "libc", @@ -9118,7 +9120,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "ahash", "async-trait", @@ -9158,7 +9160,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "finality-grandpa", "futures 0.3.21", @@ -9182,7 +9184,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "ansi_term", "futures 0.3.21", @@ -9199,7 +9201,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "hex", @@ -9214,7 +9216,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "asynchronous-codec 0.5.0", @@ -9263,7 +9265,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "ahash", "futures 0.3.21", @@ -9280,7 +9282,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "bytes 1.1.0", "fnv", @@ -9308,7 +9310,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "libp2p", @@ -9321,7 +9323,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -9330,7 +9332,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "hash-db", @@ -9361,7 +9363,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "jsonrpc-core", @@ -9387,7 +9389,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "jsonrpc-core", @@ -9404,7 +9406,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "directories", @@ -9468,7 +9470,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "log", "parity-scale-codec", @@ -9482,7 +9484,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -9503,7 +9505,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "chrono", "futures 0.3.21", @@ -9521,7 +9523,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "ansi_term", "atty", @@ -9552,7 +9554,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -9563,7 +9565,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "futures-timer", @@ -9590,7 +9592,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "log", @@ -9603,7 +9605,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "futures-timer", @@ -10107,7 +10109,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "hash-db", "log", @@ -10124,7 +10126,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "blake2 0.10.2", "proc-macro-crate 1.1.3", @@ -10136,7 +10138,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10149,7 +10151,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "integer-sqrt", "num-traits", @@ -10164,7 +10166,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10177,7 +10179,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "parity-scale-codec", @@ -10189,7 +10191,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "sp-api", @@ -10201,7 +10203,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "log", @@ -10219,7 +10221,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "futures 0.3.21", @@ -10238,7 +10240,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "merlin", @@ -10261,7 +10263,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10275,7 +10277,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -10287,7 +10289,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "base58", "bitflags", @@ -10333,7 +10335,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "blake2 0.10.2", "byteorder", @@ -10347,7 +10349,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "proc-macro2", "quote", @@ -10358,7 +10360,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "kvdb", "parking_lot 0.12.0", @@ -10367,7 +10369,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "proc-macro2", "quote", @@ -10377,7 +10379,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "environmental", "parity-scale-codec", @@ -10388,7 +10390,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "finality-grandpa", "log", @@ -10406,7 +10408,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -10420,7 +10422,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "hash-db", @@ -10445,7 +10447,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "lazy_static", "sp-core", @@ -10456,7 +10458,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "futures 0.3.21", @@ -10473,7 +10475,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "thiserror", "zstd", @@ -10482,7 +10484,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10496,7 +10498,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "sp-api", "sp-core", @@ -10506,7 +10508,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "backtrace", "lazy_static", @@ -10516,7 +10518,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "rustc-hash", "serde", @@ -10526,7 +10528,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "either", "hash256-std-hasher", @@ -10548,7 +10550,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -10565,7 +10567,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "Inflector", "proc-macro-crate 1.1.3", @@ -10577,7 +10579,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "serde", "serde_json", @@ -10586,7 +10588,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10600,7 +10602,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10611,7 +10613,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "hash-db", "log", @@ -10633,12 +10635,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10651,7 +10653,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "log", "sp-core", @@ -10664,7 +10666,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "futures-timer", @@ -10680,7 +10682,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "sp-std", @@ -10692,7 +10694,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "sp-api", "sp-runtime", @@ -10701,7 +10703,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "log", @@ -10717,7 +10719,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "hash-db", "memory-db", @@ -10733,7 +10735,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10750,7 +10752,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -10761,7 +10763,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "impl-trait-for-tuples", "log", @@ -10962,7 +10964,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "platforms", ] @@ -10970,7 +10972,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.21", @@ -10992,7 +10994,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures-util", "hyper", @@ -11005,7 +11007,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "async-trait", "futures 0.3.21", @@ -11031,7 +11033,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "futures 0.3.21", "substrate-test-utils-derive", @@ -11041,7 +11043,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -11052,7 +11054,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "ansi_term", "build-helper", @@ -11733,7 +11735,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#096f205d82303a889cf566792262e8ffe61bb7fb" +source = "git+https://github.com/paritytech/substrate?branch=master#666f39b8a22108f57732215de006518738034ba2" dependencies = [ "clap", "jsonrpsee 0.4.1", diff --git a/cli/src/command.rs b/cli/src/command.rs index 9b817156031c..2475b05630c9 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -394,7 +394,7 @@ pub fn run() -> Result<()> { Ok(runner.async_run(|mut config| { let (client, backend, _, task_manager) = service::new_chain_ops(&mut config, None)?; - Ok((cmd.run(client, backend).map_err(Error::SubstrateCli), task_manager)) + Ok((cmd.run(client, backend, None).map_err(Error::SubstrateCli), task_manager)) })?) }, Some(Subcommand::PvfPrepareWorker(cmd)) => { diff --git a/node/core/approval-voting/src/import.rs b/node/core/approval-voting/src/import.rs index cb8dea17a51e..c7d2b1588892 100644 --- a/node/core/approval-voting/src/import.rs +++ b/node/core/approval-voting/src/import.rs @@ -29,8 +29,9 @@ //! We maintain a rolling window of session indices. This starts as empty use polkadot_node_jaeger as jaeger; -use polkadot_node_primitives::approval::{ - self as approval_types, BlockApprovalMeta, RelayVRFStory, +use polkadot_node_primitives::{ + approval::{self as approval_types, BlockApprovalMeta, RelayVRFStory}, + MAX_FINALITY_LAG, }; use polkadot_node_subsystem::{ messages::{ @@ -299,7 +300,7 @@ pub(crate) async fn handle_new_head( head: Hash, finalized_number: &Option, ) -> SubsystemResult> { - const MAX_HEADS_LOOK_BACK: BlockNumber = 500; + const MAX_HEADS_LOOK_BACK: BlockNumber = MAX_FINALITY_LAG; let mut span = jaeger::Span::new(head, "approval-checking-import"); diff --git a/node/core/dispute-coordinator/src/real/initialized.rs b/node/core/dispute-coordinator/src/real/initialized.rs index ceb59e0e869d..f29a2fe96635 100644 --- a/node/core/dispute-coordinator/src/real/initialized.rs +++ b/node/core/dispute-coordinator/src/real/initialized.rs @@ -31,7 +31,7 @@ use sc_keystore::LocalKeystore; use polkadot_node_primitives::{ CandidateVotes, DisputeMessage, DisputeMessageCheckError, SignedDisputeStatement, - DISPUTE_WINDOW, + DISPUTE_WINDOW, MAX_FINALITY_LAG, }; use polkadot_node_subsystem::{ messages::{ @@ -69,9 +69,9 @@ use super::{ }; // The capacity and scrape depth are equal to the maximum allowed unfinalized depth. -const LRU_SCRAPED_BLOCKS_CAPACITY: usize = 500; -// This is in sync with `MAX_FINALITY_LAG` in relay chain selection. -const MAX_BATCH_SCRAPE_ANCESTORS: u32 = 500; +const LRU_SCRAPED_BLOCKS_CAPACITY: usize = MAX_FINALITY_LAG as usize; +// This is in sync with `MAX_FINALITY_LAG` in relay chain selection & node primitives. +const MAX_BATCH_SCRAPE_ANCESTORS: u32 = MAX_FINALITY_LAG; /// After the first active leaves update we transition to `Initialized` state. /// diff --git a/node/core/provisioner/src/lib.rs b/node/core/provisioner/src/lib.rs index b12b905066f6..35170bcfe4c7 100644 --- a/node/core/provisioner/src/lib.rs +++ b/node/core/provisioner/src/lib.rs @@ -150,12 +150,7 @@ pub enum Error { /// Provisioner run arguments. #[derive(Debug, Clone, Copy)] -pub struct ProvisionerConfig { - /// If enabled, dispute votes will be provided to `fn create_inherent`, otherwise not. - /// Long term we will obviously always want disputes to be enabled, this option exists for testing purposes - /// and will be removed in the near future. - pub disputes_enabled: bool, -} +pub struct ProvisionerConfig; impl JobTrait for ProvisionerJob { type ToJob = ProvisionerMessage; @@ -170,7 +165,7 @@ impl JobTrait for ProvisionerJob { // this function is in charge of creating and executing the job's main loop fn run( leaf: ActivatedLeaf, - run_args: Self::RunArgs, + _: Self::RunArgs, metrics: Self::Metrics, receiver: mpsc::Receiver, mut sender: JobSender, @@ -179,12 +174,8 @@ impl JobTrait for ProvisionerJob { async move { let job = ProvisionerJob::new(leaf, metrics, receiver); - job.run_loop( - sender.subsystem_sender(), - run_args.disputes_enabled, - PerLeafSpan::new(span, "provisioner"), - ) - .await + job.run_loop(sender.subsystem_sender(), PerLeafSpan::new(span, "provisioner")) + .await } .boxed() } @@ -210,7 +201,6 @@ impl ProvisionerJob { async fn run_loop( mut self, sender: &mut impl SubsystemSender, - disputes_enabled: bool, span: PerLeafSpan, ) -> Result<(), Error> { loop { @@ -221,7 +211,7 @@ impl ProvisionerJob { let _timer = self.metrics.time_request_inherent_data(); if self.inherent_after.is_ready() { - self.send_inherent_data(sender, vec![return_sender], disputes_enabled).await; + self.send_inherent_data(sender, vec![return_sender]).await; } else { self.awaiting_inherent.push(return_sender); } @@ -238,7 +228,7 @@ impl ProvisionerJob { let _span = span.child("send-inherent-data"); let return_senders = std::mem::take(&mut self.awaiting_inherent); if !return_senders.is_empty() { - self.send_inherent_data(sender, return_senders, disputes_enabled).await; + self.send_inherent_data(sender, return_senders).await; } } } @@ -251,7 +241,6 @@ impl ProvisionerJob { &mut self, sender: &mut impl SubsystemSender, return_senders: Vec>, - disputes_enabled: bool, ) { if let Err(err) = send_inherent_data( &self.leaf, @@ -259,7 +248,6 @@ impl ProvisionerJob { &self.backed_candidates, return_senders, sender, - disputes_enabled, &self.metrics, ) .await @@ -273,7 +261,6 @@ impl ProvisionerJob { signed_bitfield_count = self.signed_bitfields.len(), backed_candidates_count = self.backed_candidates.len(), leaf_hash = ?self.leaf.hash, - disputes_enabled, "inherent data sent successfully" ); } @@ -331,7 +318,6 @@ async fn send_inherent_data( candidates: &[CandidateReceipt], return_senders: Vec>, from_job: &mut impl SubsystemSender, - disputes_enabled: bool, metrics: &Metrics, ) -> Result<(), Error> { let availability_cores = request_availability_cores(leaf.hash, from_job) @@ -339,8 +325,7 @@ async fn send_inherent_data( .await .map_err(|err| Error::CanceledAvailabilityCores(err))??; - let disputes = - if disputes_enabled { select_disputes(from_job, metrics).await? } else { vec![] }; + let disputes = select_disputes(from_job, metrics).await?; // Only include bitfields on fresh leaves. On chain reversions, we want to make sure that // there will be at least one block, which cannot get disputed, so the chain can make progress. @@ -354,7 +339,6 @@ async fn send_inherent_data( gum::debug!( target: LOG_TARGET, - disputes_enabled = disputes_enabled, availability_cores_len = availability_cores.len(), disputes_count = disputes.len(), bitfields_count = bitfields.len(), diff --git a/node/core/pvf/src/executor_intf.rs b/node/core/pvf/src/executor_intf.rs index cc2e9835f8f6..b4064e13ecc0 100644 --- a/node/core/pvf/src/executor_intf.rs +++ b/node/core/pvf/src/executor_intf.rs @@ -24,31 +24,30 @@ use sc_executor_wasmtime::{Config, DeterministicStackLimit, Semantics}; use sp_core::storage::{ChildInfo, TrackedStorageKey}; use std::any::{Any, TypeId}; +// Memory configuration +// +// When Substrate Runtime is instantiated, a number of WASM pages are allocated for the Substrate +// Runtime instance's linear memory. The exact number of pages is a sum of whatever the WASM blob +// itself requests (by default at least enough to hold the data section as well as have some space +// left for the stack; this is, of course, overridable at link time when compiling the runtime) +// plus the number of pages specified in the `extra_heap_pages` passed to the executor. +// +// By default, rustc (or `lld` specifically) should allocate 1 MiB for the shadow stack, or 16 pages. +// The data section for runtimes are typically rather small and can fit in a single digit number of +// WASM pages, so let's say an extra 16 pages. Thus let's assume that 32 pages or 2 MiB are used for +// these needs by default. +const DEFAULT_HEAP_PAGES_ESTIMATE: u64 = 32; +const EXTRA_HEAP_PAGES: u64 = 2048; + const CONFIG: Config = Config { - // Memory configuration - // - // When Substrate Runtime is instantiated, a number of wasm pages are mounted for the Substrate - // Runtime instance. The number of pages is specified by `heap_pages`. - // - // Besides `heap_pages` linear memory requests an initial number of pages. Those pages are - // typically used for placing the so-called shadow stack and the data section. - // - // By default, rustc (or `lld` specifically) allocates 1 MiB for the shadow stack. That is, 16 - // wasm pages. - // - // Data section for runtimes are typically rather small and can fit in a single digit number of - // wasm pages. - // - // Thus let's assume that 32 pages or 2 MiB are used for these needs. - // - // Note that the memory limit is specified in bytes, so we multiply this value - // by wasm page size -- 64 KiB. - max_memory_size: Some((2048 + 32) * 65536), - heap_pages: 2048, + // NOTE: This is specified in bytes, so we multiply by WASM page size. + max_memory_size: Some(((DEFAULT_HEAP_PAGES_ESTIMATE + EXTRA_HEAP_PAGES) * 65536) as usize), allow_missing_func_imports: true, cache_path: None, semantics: Semantics { + extra_heap_pages: EXTRA_HEAP_PAGES, + fast_instance_reuse: false, // Enable deterministic stack limit to pin down the exact number of items the wasmtime stack // can contain before it traps with stack overflow. diff --git a/node/metered-channel/Cargo.toml b/node/metered-channel/Cargo.toml index fb4562b77e39..491ed35b3bcd 100644 --- a/node/metered-channel/Cargo.toml +++ b/node/metered-channel/Cargo.toml @@ -13,7 +13,7 @@ gum = { package = "tracing-gum", path = "../gum" } thiserror = "1.0.30" crossbeam-queue = "0.3.5" nanorand = { version = "0.7.0", default-features = false, features = ["wyrand"] } -coarsetime = "0.1.21" +coarsetime = "^0.1.22" [dev-dependencies] futures = { version = "0.3.21", features = ["thread-pool"] } diff --git a/node/network/approval-distribution/src/lib.rs b/node/network/approval-distribution/src/lib.rs index ca6f5dccc5a9..a231fe0b3472 100644 --- a/node/network/approval-distribution/src/lib.rs +++ b/node/network/approval-distribution/src/lib.rs @@ -720,7 +720,7 @@ impl State { // to all peers in the BlockEntry's known_by set who know about the block, // excluding the peer in the source, if source has kind MessageSource::Peer. let maybe_peer_id = source.peer_id(); - let peers = entry + let mut peers = entry .known_by .keys() .cloned() @@ -729,8 +729,7 @@ impl State { let assignments = vec![(assignment, claimed_candidate_index)]; let gossip_peers = &self.gossip_peers; - let peers = - util::choose_random_subset(|e| gossip_peers.contains(e), peers, MIN_GOSSIP_PEERS); + util::choose_random_subset(|e| gossip_peers.contains(e), &mut peers, MIN_GOSSIP_PEERS); // Add the fingerprint of the assignment to the knowledge of each peer. for peer in peers.iter() { @@ -943,7 +942,7 @@ impl State { // to all peers in the BlockEntry's known_by set who know about the block, // excluding the peer in the source, if source has kind MessageSource::Peer. let maybe_peer_id = source.peer_id(); - let peers = entry + let mut peers = entry .known_by .keys() .cloned() @@ -951,8 +950,7 @@ impl State { .collect::>(); let gossip_peers = &self.gossip_peers; - let peers = - util::choose_random_subset(|e| gossip_peers.contains(e), peers, MIN_GOSSIP_PEERS); + util::choose_random_subset(|e| gossip_peers.contains(e), &mut peers, MIN_GOSSIP_PEERS); // Add the fingerprint of the assignment to the knowledge of each peer. for peer in peers.iter() { diff --git a/node/network/bitfield-distribution/src/lib.rs b/node/network/bitfield-distribution/src/lib.rs index befdec66b359..6bd952233111 100644 --- a/node/network/bitfield-distribution/src/lib.rs +++ b/node/network/bitfield-distribution/src/lib.rs @@ -346,7 +346,7 @@ async fn relay_message( let _span = span.child("interested-peers"); // pass on the bitfield distribution to all interested peers - let interested_peers = peer_views + let mut interested_peers = peer_views .iter() .filter_map(|(peer, view)| { // check interest in the peer in this message's relay parent @@ -363,9 +363,9 @@ async fn relay_message( } }) .collect::>(); - let interested_peers = util::choose_random_subset( + util::choose_random_subset( |e| gossip_peers.contains(e), - interested_peers, + &mut interested_peers, MIN_GOSSIP_PEERS, ); interested_peers.iter().for_each(|peer| { diff --git a/node/network/statement-distribution/src/lib.rs b/node/network/statement-distribution/src/lib.rs index 1931c545c0d5..0bf43b883cd3 100644 --- a/node/network/statement-distribution/src/lib.rs +++ b/node/network/statement-distribution/src/lib.rs @@ -32,7 +32,7 @@ use polkadot_node_network_protocol::{ IfDisconnected, PeerId, UnifiedReputationChange as Rep, View, }; use polkadot_node_primitives::{SignedFullStatement, Statement, UncheckedSignedFullStatement}; -use polkadot_node_subsystem_util::{self as util, MIN_GOSSIP_PEERS}; +use polkadot_node_subsystem_util::{self as util, rand, MIN_GOSSIP_PEERS}; use polkadot_primitives::v2::{ AuthorityDiscoveryId, CandidateHash, CommittedCandidateReceipt, CompactStatement, Hash, @@ -115,16 +115,19 @@ const LOG_TARGET: &str = "parachain::statement-distribution"; const MAX_LARGE_STATEMENTS_PER_SENDER: usize = 20; /// The statement distribution subsystem. -pub struct StatementDistributionSubsystem { +pub struct StatementDistributionSubsystem { /// Pointer to a keystore, which is required for determining this node's validator index. keystore: SyncCryptoStorePtr, /// Receiver for incoming large statement requests. req_receiver: Option>, /// Prometheus metrics metrics: Metrics, + /// Pseudo-random generator for peers selection logic + rng: R, } -impl overseer::Subsystem for StatementDistributionSubsystem +impl overseer::Subsystem + for StatementDistributionSubsystem where Context: SubsystemContext, Context: overseer::SubsystemContext, @@ -142,17 +145,6 @@ where } } -impl StatementDistributionSubsystem { - /// Create a new Statement Distribution Subsystem - pub fn new( - keystore: SyncCryptoStorePtr, - req_receiver: IncomingRequestReceiver, - metrics: Metrics, - ) -> Self { - Self { keystore, req_receiver: Some(req_receiver), metrics } - } -} - #[derive(Default)] struct RecentOutdatedHeads { buf: VecDeque, @@ -906,6 +898,7 @@ async fn circulate_statement_and_dependents( statement: SignedFullStatement, priority_peers: Vec, metrics: &Metrics, + rng: &mut impl rand::Rng, ) { let active_head = match active_heads.get_mut(&relay_parent) { Some(res) => res, @@ -932,6 +925,7 @@ async fn circulate_statement_and_dependents( stored, priority_peers, metrics, + rng, ) .await, )), @@ -1019,6 +1013,7 @@ async fn circulate_statement<'a>( stored: StoredStatement<'a>, mut priority_peers: Vec, metrics: &Metrics, + rng: &mut impl rand::Rng, ) -> Vec { let fingerprint = stored.fingerprint(); @@ -1041,8 +1036,12 @@ async fn circulate_statement<'a>( let priority_set: HashSet<&PeerId> = priority_peers.iter().collect(); peers_to_send.retain(|p| !priority_set.contains(p)); - let mut peers_to_send = - util::choose_random_subset(|e| gossip_peers.contains(e), peers_to_send, MIN_GOSSIP_PEERS); + util::choose_random_subset_with_rng( + |e| gossip_peers.contains(e), + &mut peers_to_send, + rng, + MIN_GOSSIP_PEERS, + ); // We don't want to use less peers, than we would without any priority peers: let min_size = std::cmp::max(peers_to_send.len(), MIN_GOSSIP_PEERS); // Make set full: @@ -1313,6 +1312,7 @@ async fn handle_incoming_message_and_circulate<'a>( message: protocol_v1::StatementDistributionMessage, req_sender: &mpsc::Sender, metrics: &Metrics, + rng: &mut impl rand::Rng, ) { let handled_incoming = match peers.get_mut(&peer) { Some(data) => @@ -1348,6 +1348,7 @@ async fn handle_incoming_message_and_circulate<'a>( statement, Vec::new(), metrics, + rng, ) .await; } @@ -1458,7 +1459,12 @@ async fn handle_incoming_message<'a>( Ok(()) => {}, Err(DeniedStatement::NotUseful) => return None, Err(DeniedStatement::UsefulButKnown) => { + // Note a received statement in the peer data + peer_data + .receive(&relay_parent, &fingerprint, max_message_count) + .expect("checked in `check_can_receive` above; qed"); report_peer(ctx, peer, BENEFIT_VALID_STATEMENT).await; + return None }, } @@ -1558,6 +1564,7 @@ async fn update_peer_view_and_maybe_send_unlocked( active_heads: &HashMap, new_view: View, metrics: &Metrics, + rng: &mut impl rand::Rng, ) { let old_view = std::mem::replace(&mut peer_data.view, new_view); @@ -1568,9 +1575,10 @@ async fn update_peer_view_and_maybe_send_unlocked( let is_gossip_peer = gossip_peers.contains(&peer); let lucky = is_gossip_peer || - util::gen_ratio( + util::gen_ratio_rng( util::MIN_GOSSIP_PEERS.saturating_sub(gossip_peers.len()), util::MIN_GOSSIP_PEERS, + rng, ); // Add entries for all relay-parents in the new view but not the old. @@ -1597,6 +1605,7 @@ async fn handle_network_update( req_sender: &mpsc::Sender, update: NetworkBridgeEvent, metrics: &Metrics, + rng: &mut impl rand::Rng, ) { match update { NetworkBridgeEvent::PeerConnected(peer, role, maybe_authority) => { @@ -1638,6 +1647,7 @@ async fn handle_network_update( &*active_heads, view, metrics, + rng, ) .await } @@ -1654,6 +1664,7 @@ async fn handle_network_update( message, req_sender, metrics, + rng, ) .await; }, @@ -1670,6 +1681,7 @@ async fn handle_network_update( &*active_heads, view, metrics, + rng, ) .await, None => (), @@ -1681,7 +1693,17 @@ async fn handle_network_update( } } -impl StatementDistributionSubsystem { +impl StatementDistributionSubsystem { + /// Create a new Statement Distribution Subsystem + pub fn new( + keystore: SyncCryptoStorePtr, + req_receiver: IncomingRequestReceiver, + metrics: Metrics, + rng: R, + ) -> Self { + Self { keystore, req_receiver: Some(req_receiver), metrics, rng } + } + async fn run( mut self, mut ctx: (impl SubsystemContext @@ -1803,7 +1825,7 @@ impl StatementDistributionSubsystem { } async fn handle_requester_message( - &self, + &mut self, ctx: &mut impl SubsystemContext, gossip_peers: &HashSet, peers: &mut HashMap, @@ -1861,6 +1883,7 @@ impl StatementDistributionSubsystem { message, req_sender, &self.metrics, + &mut self.rng, ) .await; } @@ -1910,7 +1933,7 @@ impl StatementDistributionSubsystem { } async fn handle_subsystem_message( - &self, + &mut self, ctx: &mut (impl SubsystemContext + overseer::SubsystemContext), runtime: &mut RuntimeInfo, peers: &mut HashMap, @@ -2022,6 +2045,7 @@ impl StatementDistributionSubsystem { statement, group_peers, metrics, + &mut self.rng, ) .await; }, @@ -2036,6 +2060,7 @@ impl StatementDistributionSubsystem { req_sender, event, metrics, + &mut self.rng, ) .await; }, diff --git a/node/network/statement-distribution/src/tests.rs b/node/network/statement-distribution/src/tests.rs index 10462fc1a580..9e91ac5ba650 100644 --- a/node/network/statement-distribution/src/tests.rs +++ b/node/network/statement-distribution/src/tests.rs @@ -29,7 +29,9 @@ use polkadot_node_network_protocol::{ use polkadot_node_primitives::{Statement, UncheckedSignedFullStatement}; use polkadot_node_subsystem_test_helpers::mock::make_ferdie_keystore; use polkadot_primitives::v2::{Hash, SessionInfo, ValidationCode}; -use polkadot_primitives_test_helpers::{dummy_committed_candidate_receipt, dummy_hash}; +use polkadot_primitives_test_helpers::{ + dummy_committed_candidate_receipt, dummy_hash, AlwaysZeroRng, +}; use polkadot_subsystem::{ jaeger, messages::{RuntimeApiMessage, RuntimeApiRequest}, @@ -511,6 +513,7 @@ fn peer_view_update_sends_messages() { &active_heads, new_view.clone(), &Default::default(), + &mut AlwaysZeroRng, ) .await; @@ -640,6 +643,7 @@ fn circulated_statement_goes_to_all_peers_with_view() { statement, Vec::new(), &Metrics::default(), + &mut AlwaysZeroRng, ) .await; @@ -723,6 +727,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() { Arc::new(LocalKeystore::in_memory()), statement_req_receiver, Default::default(), + AlwaysZeroRng, ); s.run(ctx).await.unwrap(); }; @@ -915,6 +920,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing( make_ferdie_keystore(), statement_req_receiver, Default::default(), + AlwaysZeroRng, ); s.run(ctx).await.unwrap(); }; @@ -1412,6 +1418,7 @@ fn share_prioritizes_backing_group() { make_ferdie_keystore(), statement_req_receiver, Default::default(), + AlwaysZeroRng, ); s.run(ctx).await.unwrap(); }; @@ -1695,6 +1702,7 @@ fn peer_cant_flood_with_large_statements() { make_ferdie_keystore(), statement_req_receiver, Default::default(), + AlwaysZeroRng, ); s.run(ctx).await.unwrap(); }; @@ -1842,6 +1850,347 @@ fn peer_cant_flood_with_large_statements() { executor::block_on(future::join(test_fut, bg)); } +// This test addresses an issue when received knowledge is not updated on a +// subsequent `Seconded` statements +// See https://github.com/paritytech/polkadot/pull/5177 +#[test] +fn handle_multiple_seconded_statements() { + let relay_parent_hash = Hash::repeat_byte(1); + + let candidate = dummy_committed_candidate_receipt(relay_parent_hash); + let candidate_hash = candidate.hash(); + + // We want to ensure that our peers are not lucky + let mut all_peers: Vec = Vec::with_capacity(MIN_GOSSIP_PEERS + 4); + let peer_a = PeerId::random(); + let peer_b = PeerId::random(); + assert_ne!(peer_a, peer_b); + + for _ in 0..MIN_GOSSIP_PEERS + 2 { + all_peers.push(PeerId::random()); + } + all_peers.push(peer_a.clone()); + all_peers.push(peer_b.clone()); + + let mut lucky_peers = all_peers.clone(); + util::choose_random_subset_with_rng( + |_| false, + &mut lucky_peers, + &mut AlwaysZeroRng, + MIN_GOSSIP_PEERS, + ); + lucky_peers.sort(); + assert_eq!(lucky_peers.len(), MIN_GOSSIP_PEERS); + assert!(!lucky_peers.contains(&peer_a)); + assert!(!lucky_peers.contains(&peer_b)); + + let validators = vec![ + Sr25519Keyring::Alice.pair(), + Sr25519Keyring::Bob.pair(), + Sr25519Keyring::Charlie.pair(), + ]; + + let session_info = make_session_info(validators, vec![]); + + let session_index = 1; + + let pool = sp_core::testing::TaskExecutor::new(); + let (ctx, mut handle) = polkadot_node_subsystem_test_helpers::make_subsystem_context(pool); + + let (statement_req_receiver, _) = IncomingRequest::get_config_receiver(); + + let virtual_overseer_fut = async move { + let s = StatementDistributionSubsystem::new( + Arc::new(LocalKeystore::in_memory()), + statement_req_receiver, + Default::default(), + AlwaysZeroRng, + ); + s.run(ctx).await.unwrap(); + }; + + let test_fut = async move { + // register our active heads. + handle + .send(FromOverseer::Signal(OverseerSignal::ActiveLeaves( + ActiveLeavesUpdate::start_work(ActivatedLeaf { + hash: relay_parent_hash, + number: 1, + status: LeafStatus::Fresh, + span: Arc::new(jaeger::Span::Disabled), + }), + ))) + .await; + + assert_matches!( + handle.recv().await, + AllMessages::RuntimeApi( + RuntimeApiMessage::Request(r, RuntimeApiRequest::SessionIndexForChild(tx)) + ) + if r == relay_parent_hash + => { + let _ = tx.send(Ok(session_index)); + } + ); + + assert_matches!( + handle.recv().await, + AllMessages::RuntimeApi( + RuntimeApiMessage::Request(r, RuntimeApiRequest::SessionInfo(sess_index, tx)) + ) + if r == relay_parent_hash && sess_index == session_index + => { + let _ = tx.send(Ok(Some(session_info))); + } + ); + + // notify of peers and view + for peer in all_peers.iter() { + handle + .send(FromOverseer::Communication { + msg: StatementDistributionMessage::NetworkBridgeUpdateV1( + NetworkBridgeEvent::PeerConnected(peer.clone(), ObservedRole::Full, None), + ), + }) + .await; + handle + .send(FromOverseer::Communication { + msg: StatementDistributionMessage::NetworkBridgeUpdateV1( + NetworkBridgeEvent::PeerViewChange(peer.clone(), view![relay_parent_hash]), + ), + }) + .await; + } + + // Explicitly add all `lucky` peers to the gossip peers to ensure that neither `peerA` not `peerB` + // receive statements + handle + .send(FromOverseer::Communication { + msg: StatementDistributionMessage::NetworkBridgeUpdateV1( + NetworkBridgeEvent::NewGossipTopology( + lucky_peers.iter().cloned().collect::>(), + ), + ), + }) + .await; + + // receive a seconded statement from peer A. it should be propagated onwards to peer B and to + // candidate backing. + let statement = { + let signing_context = SigningContext { parent_hash: relay_parent_hash, session_index }; + + let keystore: SyncCryptoStorePtr = Arc::new(LocalKeystore::in_memory()); + let alice_public = CryptoStore::sr25519_generate_new( + &*keystore, + ValidatorId::ID, + Some(&Sr25519Keyring::Alice.to_seed()), + ) + .await + .unwrap(); + + SignedFullStatement::sign( + &keystore, + Statement::Seconded(candidate.clone()), + &signing_context, + ValidatorIndex(0), + &alice_public.into(), + ) + .await + .ok() + .flatten() + .expect("should be signed") + }; + + // `PeerA` sends a `Seconded` message + handle + .send(FromOverseer::Communication { + msg: StatementDistributionMessage::NetworkBridgeUpdateV1( + NetworkBridgeEvent::PeerMessage( + peer_a.clone(), + protocol_v1::StatementDistributionMessage::Statement( + relay_parent_hash, + statement.clone().into(), + ), + ), + ), + }) + .await; + + assert_matches!( + handle.recv().await, + AllMessages::NetworkBridge( + NetworkBridgeMessage::ReportPeer(p, r) + ) => { + assert_eq!(p, peer_a); + assert_eq!(r, BENEFIT_VALID_STATEMENT_FIRST); + } + ); + + // After the first valid statement, we expect messages to be circulated + assert_matches!( + handle.recv().await, + AllMessages::CandidateBacking( + CandidateBackingMessage::Statement(r, s) + ) => { + assert_eq!(r, relay_parent_hash); + assert_eq!(s, statement); + } + ); + + assert_matches!( + handle.recv().await, + AllMessages::NetworkBridge( + NetworkBridgeMessage::SendValidationMessage( + recipients, + protocol_v1::ValidationProtocol::StatementDistribution( + protocol_v1::StatementDistributionMessage::Statement(r, s) + ), + ) + ) => { + assert!(!recipients.contains(&peer_b)); + assert_eq!(r, relay_parent_hash); + assert_eq!(s, statement.clone().into()); + } + ); + + // `PeerB` sends a `Seconded` message: valid but known + handle + .send(FromOverseer::Communication { + msg: StatementDistributionMessage::NetworkBridgeUpdateV1( + NetworkBridgeEvent::PeerMessage( + peer_b.clone(), + protocol_v1::StatementDistributionMessage::Statement( + relay_parent_hash, + statement.clone().into(), + ), + ), + ), + }) + .await; + + assert_matches!( + handle.recv().await, + AllMessages::NetworkBridge( + NetworkBridgeMessage::ReportPeer(p, r) + ) => { + assert_eq!(p, peer_b); + assert_eq!(r, BENEFIT_VALID_STATEMENT); + } + ); + + // Create a `Valid` statement + let statement = { + let signing_context = SigningContext { parent_hash: relay_parent_hash, session_index }; + + let keystore: SyncCryptoStorePtr = Arc::new(LocalKeystore::in_memory()); + let alice_public = CryptoStore::sr25519_generate_new( + &*keystore, + ValidatorId::ID, + Some(&Sr25519Keyring::Alice.to_seed()), + ) + .await + .unwrap(); + + SignedFullStatement::sign( + &keystore, + Statement::Valid(candidate_hash), + &signing_context, + ValidatorIndex(0), + &alice_public.into(), + ) + .await + .ok() + .flatten() + .expect("should be signed") + }; + + // `PeerA` sends a `Valid` message + handle + .send(FromOverseer::Communication { + msg: StatementDistributionMessage::NetworkBridgeUpdateV1( + NetworkBridgeEvent::PeerMessage( + peer_a.clone(), + protocol_v1::StatementDistributionMessage::Statement( + relay_parent_hash, + statement.clone().into(), + ), + ), + ), + }) + .await; + + assert_matches!( + handle.recv().await, + AllMessages::NetworkBridge( + NetworkBridgeMessage::ReportPeer(p, r) + ) => { + assert_eq!(p, peer_a); + assert_eq!(r, BENEFIT_VALID_STATEMENT_FIRST); + } + ); + + assert_matches!( + handle.recv().await, + AllMessages::CandidateBacking( + CandidateBackingMessage::Statement(r, s) + ) => { + assert_eq!(r, relay_parent_hash); + assert_eq!(s, statement); + } + ); + + assert_matches!( + handle.recv().await, + AllMessages::NetworkBridge( + NetworkBridgeMessage::SendValidationMessage( + recipients, + protocol_v1::ValidationProtocol::StatementDistribution( + protocol_v1::StatementDistributionMessage::Statement(r, s) + ), + ) + ) => { + assert!(!recipients.contains(&peer_b)); + assert_eq!(r, relay_parent_hash); + assert_eq!(s, statement.clone().into()); + } + ); + + // `PeerB` sends a `Valid` message + handle + .send(FromOverseer::Communication { + msg: StatementDistributionMessage::NetworkBridgeUpdateV1( + NetworkBridgeEvent::PeerMessage( + peer_b.clone(), + protocol_v1::StatementDistributionMessage::Statement( + relay_parent_hash, + statement.clone().into(), + ), + ), + ), + }) + .await; + + // We expect that this is still valid despite the fact that `PeerB` was not + // the first when sending `Seconded` + assert_matches!( + handle.recv().await, + AllMessages::NetworkBridge( + NetworkBridgeMessage::ReportPeer(p, r) + ) => { + assert_eq!(p, peer_b); + assert_eq!(r, BENEFIT_VALID_STATEMENT); + } + ); + + handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; + }; + + futures::pin_mut!(test_fut); + futures::pin_mut!(virtual_overseer_fut); + + executor::block_on(future::join(test_fut, virtual_overseer_fut)); +} + fn make_session_info(validators: Vec, groups: Vec>) -> SessionInfo { let validator_groups: Vec> = groups .iter() diff --git a/node/primitives/src/lib.rs b/node/primitives/src/lib.rs index 2d09d9c96357..9075a168f0b7 100644 --- a/node/primitives/src/lib.rs +++ b/node/primitives/src/lib.rs @@ -76,6 +76,11 @@ pub const BACKING_EXECUTION_TIMEOUT: Duration = Duration::from_secs(2); /// dispute participants. pub const APPROVAL_EXECUTION_TIMEOUT: Duration = Duration::from_secs(6); +/// Linked to `MAX_FINALITY_LAG` in relay chain selection, +/// `MAX_HEADS_LOOK_BACK` in `approval-voting` and +/// `MAX_BATCH_SCRAPE_ANCESTORS` in `dispute-coordinator` +pub const MAX_FINALITY_LAG: u32 = 500; + /// Type of a session window size. /// /// We are not using `NonZeroU32` here because `expect` and `unwrap` are not yet const, so global diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index a563e95a7087..f9350a4f7259 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -731,23 +731,16 @@ where let auth_or_collator = role.is_authority() || is_collator.is_collator(); let requires_overseer_for_chain_sel = local_keystore.is_some() && auth_or_collator; - let disputes_enabled = chain_spec.is_rococo() || - chain_spec.is_kusama() || - chain_spec.is_westend() || - chain_spec.is_versi() || - chain_spec.is_wococo(); - let pvf_checker_enabled = !is_collator.is_collator() && chain_spec.is_versi(); let select_chain = if requires_overseer_for_chain_sel { let metrics = polkadot_node_subsystem_util::metrics::Metrics::register(prometheus_registry.as_ref())?; - SelectRelayChain::new_disputes_aware( + SelectRelayChain::new_with_overseer( basics.backend.clone(), overseer_handle.clone(), metrics, - disputes_enabled, ) } else { SelectRelayChain::new_longest_chain(basics.backend.clone()) @@ -1006,7 +999,6 @@ where candidate_validation_config, chain_selection_config, dispute_coordinator_config, - disputes_enabled, pvf_checker_enabled, }, ) diff --git a/node/service/src/overseer.rs b/node/service/src/overseer.rs index a9a757163381..4b80e40a5a95 100644 --- a/node/service/src/overseer.rs +++ b/node/service/src/overseer.rs @@ -63,6 +63,7 @@ pub use polkadot_node_core_dispute_coordinator::DisputeCoordinatorSubsystem; pub use polkadot_node_core_provisioner::ProvisionerSubsystem; pub use polkadot_node_core_pvf_checker::PvfCheckerSubsystem; pub use polkadot_node_core_runtime_api::RuntimeApiSubsystem; +use polkadot_node_subsystem_util::rand::{self, SeedableRng}; pub use polkadot_statement_distribution::StatementDistributionSubsystem; /// Arguments passed for overseer construction. @@ -108,8 +109,6 @@ where pub chain_selection_config: ChainSelectionConfig, /// Configuration for the dispute coordinator subsystem. pub dispute_coordinator_config: DisputeCoordinatorConfig, - /// Enable to disputes. - pub disputes_enabled: bool, /// Enable PVF pre-checking pub pvf_checker_enabled: bool, } @@ -138,7 +137,6 @@ pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>( candidate_validation_config, chain_selection_config, dispute_coordinator_config, - disputes_enabled, pvf_checker_enabled, }: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result< @@ -148,7 +146,7 @@ pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>( CandidateValidationSubsystem, PvfCheckerSubsystem, CandidateBackingSubsystem, - StatementDistributionSubsystem, + StatementDistributionSubsystem, AvailabilityDistributionSubsystem, AvailabilityRecoverySubsystem, BitfieldSigningSubsystem, @@ -243,7 +241,7 @@ where )) .provisioner(ProvisionerSubsystem::new( spawner.clone(), - ProvisionerConfig { disputes_enabled }, + ProvisionerConfig, Metrics::register(registry)?, )) .runtime_api(RuntimeApiSubsystem::new( @@ -255,6 +253,7 @@ where keystore.clone(), statement_req_receiver, Metrics::register(registry)?, + rand::rngs::StdRng::from_entropy(), )) .approval_distribution(ApprovalDistributionSubsystem::new(Metrics::register(registry)?)) .approval_voting(ApprovalVotingSubsystem::with_config( @@ -269,16 +268,12 @@ where authority_discovery_service.clone(), Metrics::register(registry)?, )) - .dispute_coordinator(if disputes_enabled { - DisputeCoordinatorSubsystem::new( - parachains_db.clone(), - dispute_coordinator_config, - keystore.clone(), - Metrics::register(registry)?, - ) - } else { - DisputeCoordinatorSubsystem::dummy() - }) + .dispute_coordinator(DisputeCoordinatorSubsystem::new( + parachains_db.clone(), + dispute_coordinator_config, + keystore.clone(), + Metrics::register(registry)?, + )) .dispute_distribution(DisputeDistributionSubsystem::new( keystore.clone(), dispute_req_receiver, diff --git a/node/service/src/relay_chain_selection.rs b/node/service/src/relay_chain_selection.rs index 9f6cd50342ec..bc3a9e14f844 100644 --- a/node/service/src/relay_chain_selection.rs +++ b/node/service/src/relay_chain_selection.rs @@ -38,6 +38,7 @@ use super::{HeaderProvider, HeaderProviderProvider}; use consensus_common::{Error as ConsensusError, SelectChain}; use futures::channel::oneshot; +use polkadot_node_primitives::MAX_FINALITY_LAG as PRIMITIVES_MAX_FINALITY_LAG; use polkadot_node_subsystem_util::metrics::{self, prometheus}; use polkadot_overseer::{AllMessages, Handle}; use polkadot_primitives::v2::{ @@ -53,9 +54,9 @@ use std::sync::Arc; /// or disputes. /// /// This is a safety net that should be removed at some point in the future. -// Until it's not, make sure to also update `MAX_HEADS_LOOK_BACK` in `approval-voting` -// and `MAX_BATCH_SCRAPE_ANCESTORS` in `dispute-coordinator` when changing its value. -const MAX_FINALITY_LAG: polkadot_primitives::v2::BlockNumber = 500; +// In sync with `MAX_HEADS_LOOK_BACK` in `approval-voting` +// and `MAX_BATCH_SCRAPE_ANCESTORS` in `dispute-coordinator`. +const MAX_FINALITY_LAG: polkadot_primitives::v2::BlockNumber = PRIMITIVES_MAX_FINALITY_LAG; const LOG_TARGET: &str = "parachain::chain-selection"; @@ -163,30 +164,13 @@ where /// Create a new [`SelectRelayChain`] wrapping the given chain backend /// and a handle to the overseer. - pub fn new_disputes_aware( - backend: Arc, - overseer: Handle, - metrics: Metrics, - disputes_enabled: bool, - ) -> Self { - gum::debug!( - target: LOG_TARGET, - "Using {} chain selection algorithm", - if disputes_enabled { - "dispute aware relay" - } else { - // no disputes are queried, that logic is disabled - // in `fn finality_target_with_longest_chain`. - "short-circuited relay" - } - ); + pub fn new_with_overseer(backend: Arc, overseer: Handle, metrics: Metrics) -> Self { + gum::debug!(target: LOG_TARGET, "Using dispute aware relay-chain selection algorithm",); + SelectRelayChain { longest_chain: sc_consensus::LongestChain::new(backend.clone()), selection: IsDisputesAwareWithOverseer::Yes(SelectRelayChainInner::new( - backend, - overseer, - metrics, - disputes_enabled, + backend, overseer, metrics, )), } } @@ -243,7 +227,6 @@ where pub struct SelectRelayChainInner { backend: Arc, overseer: OH, - disputes_enabled: bool, metrics: Metrics, } @@ -254,8 +237,8 @@ where { /// Create a new [`SelectRelayChainInner`] wrapping the given chain backend /// and a handle to the overseer. - pub fn new(backend: Arc, overseer: OH, metrics: Metrics, disputes_enabled: bool) -> Self { - SelectRelayChainInner { backend, overseer, metrics, disputes_enabled } + pub fn new(backend: Arc, overseer: OH, metrics: Metrics) -> Self { + SelectRelayChainInner { backend, overseer, metrics } } fn block_header(&self, hash: Hash) -> Result { @@ -293,7 +276,6 @@ where backend: self.backend.clone(), overseer: self.overseer.clone(), metrics: self.metrics.clone(), - disputes_enabled: self.disputes_enabled, } } } @@ -391,7 +373,7 @@ where let mut overseer = self.overseer.clone(); gum::trace!(target: LOG_TARGET, ?best_leaf, "Longest chain"); - let subchain_head = if self.disputes_enabled { + let subchain_head = { let (tx, rx) = oneshot::channel(); overseer .send_msg( @@ -412,13 +394,6 @@ where None => return Ok(target_hash), Some(best) => best, } - } else { - gum::trace!(target: LOG_TARGET, ?best_leaf, "Dummy disputes active"); - if best_leaf == target_hash { - return Ok(target_hash) - } else { - best_leaf - } }; let target_number = self.block_number(target_hash)?; @@ -492,7 +467,7 @@ where let lag = initial_leaf_number.saturating_sub(subchain_number); self.metrics.note_approval_checking_finality_lag(lag); - let (lag, subchain_head) = if self.disputes_enabled { + let (lag, subchain_head) = { // Prevent sending flawed data to the dispute-coordinator. if Some(subchain_block_descriptions.len() as _) != subchain_number.checked_sub(target_number) @@ -544,8 +519,6 @@ where }, }; (lag, subchain_head) - } else { - (lag, subchain_head) }; gum::trace!( diff --git a/node/service/src/tests.rs b/node/service/src/tests.rs index fe6b69946943..e657701543ae 100644 --- a/node/service/src/tests.rs +++ b/node/service/src/tests.rs @@ -83,7 +83,6 @@ fn test_harness>( Arc::new(case_vars.chain.clone()), context.sender().clone(), Default::default(), - true, ); let target_hash = case_vars.target_block.clone(); diff --git a/node/subsystem-util/src/lib.rs b/node/subsystem-util/src/lib.rs index ccdfe7982b59..6886d298eb9d 100644 --- a/node/subsystem-util/src/lib.rs +++ b/node/subsystem-util/src/lib.rs @@ -55,6 +55,7 @@ use polkadot_primitives::v2::{ PersistedValidationData, SessionIndex, SessionInfo, Signed, SigningContext, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature, }; +pub use rand; use sp_application_crypto::AppKey; use sp_core::{traits::SpawnNamed, ByteArray}; use sp_keystore::{CryptoStore, Error as KeystoreError, SyncCryptoStorePtr}; @@ -276,33 +277,41 @@ pub fn find_validator_group( /// Choose a random subset of `min` elements. /// But always include `is_priority` elements. -pub fn choose_random_subset bool>( +pub fn choose_random_subset bool>(is_priority: F, v: &mut Vec, min: usize) { + choose_random_subset_with_rng(is_priority, v, &mut rand::thread_rng(), min) +} + +/// Choose a random subset of `min` elements using a specific Random Generator `Rng` +/// But always include `is_priority` elements. +pub fn choose_random_subset_with_rng bool, R: rand::Rng>( is_priority: F, - mut v: Vec, + v: &mut Vec, + rng: &mut R, min: usize, -) -> Vec { +) { use rand::seq::SliceRandom as _; // partition the elements into priority first // the returned index is when non_priority elements start - let i = itertools::partition(&mut v, is_priority); + let i = itertools::partition(v.iter_mut(), is_priority); if i >= min || v.len() <= i { v.truncate(i); - return v + return } - let mut rng = rand::thread_rng(); - v[i..].shuffle(&mut rng); + v[i..].shuffle(rng); v.truncate(min); - v } /// Returns a `bool` with a probability of `a / b` of being true. pub fn gen_ratio(a: usize, b: usize) -> bool { - use rand::Rng as _; - let mut rng = rand::thread_rng(); + gen_ratio_rng(a, b, &mut rand::thread_rng()) +} + +/// Returns a `bool` with a probability of `a / b` of being true. +pub fn gen_ratio_rng(a: usize, b: usize, rng: &mut R) -> bool { rng.gen_ratio(a as u32, b as u32) } diff --git a/node/subsystem-util/src/tests.rs b/node/subsystem-util/src/tests.rs index c7c6cbf6d80c..166b4d557508 100644 --- a/node/subsystem-util/src/tests.rs +++ b/node/subsystem-util/src/tests.rs @@ -25,7 +25,7 @@ use polkadot_node_subsystem::{ }; use polkadot_node_subsystem_test_helpers::{self as test_helpers, make_subsystem_context}; use polkadot_primitives::v2::Hash; -use polkadot_primitives_test_helpers::{dummy_candidate_receipt, dummy_hash}; +use polkadot_primitives_test_helpers::{dummy_candidate_receipt, dummy_hash, AlwaysZeroRng}; use std::{ pin::Pin, sync::{ @@ -248,11 +248,23 @@ fn tick_tack_metronome() { #[test] fn subset_generation_check() { - let values = (0_u8..=25).collect::>(); + let mut values = (0_u8..=25).collect::>(); // 12 even numbers exist - let mut chosen = choose_random_subset::(|v| v & 0x01 == 0, values, 12); - chosen.sort(); - for (idx, v) in dbg!(chosen).into_iter().enumerate() { + choose_random_subset::(|v| v & 0x01 == 0, &mut values, 12); + values.sort(); + for (idx, v) in dbg!(values).into_iter().enumerate() { assert_eq!(v as usize, idx * 2); } } + +#[test] +fn subset_predefined_generation_check() { + let mut values = (0_u8..=25).collect::>(); + choose_random_subset_with_rng::(|_| false, &mut values, &mut AlwaysZeroRng, 12); + assert_eq!(values.len(), 12); + for (idx, v) in dbg!(values).into_iter().enumerate() { + // Since shuffle actually shuffles the indexes from 1..len, then + // our PRG that returns zeroes will shuffle 0 and 1, 1 and 2, ... len-2 and len-1 + assert_eq!(v as usize, idx + 1); + } +} diff --git a/primitives/test-helpers/Cargo.toml b/primitives/test-helpers/Cargo.toml index e8223c99cc5a..59fdf4e1a706 100644 --- a/primitives/test-helpers/Cargo.toml +++ b/primitives/test-helpers/Cargo.toml @@ -9,3 +9,4 @@ sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master sp-application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } polkadot-primitives = { path = "../" } +rand = "0.8.5" diff --git a/primitives/test-helpers/src/lib.rs b/primitives/test-helpers/src/lib.rs index 9d98cd0b55f5..02ba009b13cc 100644 --- a/primitives/test-helpers/src/lib.rs +++ b/primitives/test-helpers/src/lib.rs @@ -26,6 +26,7 @@ use polkadot_primitives::v2::{ CommittedCandidateReceipt, Hash, HeadData, Id as ParaId, ValidationCode, ValidationCodeHash, ValidatorId, }; +pub use rand; use sp_application_crypto::sr25519; use sp_keyring::Sr25519Keyring; use sp_runtime::generic::Digest; @@ -224,3 +225,33 @@ impl TestCandidateBuilder { CandidateReceipt { descriptor, commitments_hash: self.commitments_hash } } } + +/// A special `Rng` that always returns zero for testing something that implied +/// to be random but should not be random in the tests +pub struct AlwaysZeroRng; + +impl Default for AlwaysZeroRng { + fn default() -> Self { + Self {} + } +} +impl rand::RngCore for AlwaysZeroRng { + fn next_u32(&mut self) -> u32 { + 0_u32 + } + + fn next_u64(&mut self) -> u64 { + 0_u64 + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + for element in dest.iter_mut() { + *element = 0_u8; + } + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> { + self.fill_bytes(dest); + Ok(()) + } +} diff --git a/runtime/common/src/elections.rs b/runtime/common/src/elections.rs index a1b3a166203e..3a3ce5f85718 100644 --- a/runtime/common/src/elections.rs +++ b/runtime/common/src/elections.rs @@ -77,7 +77,7 @@ pub struct UseNominatorsAndUpdateBagsList(PhantomData); impl SortedListProvider for UseNominatorsAndUpdateBagsList { - type Error = pallet_bags_list::Error; + type Error = pallet_bags_list::ListError; type Score = ::Score; fn iter() -> Box> { diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 953f4535d9ca..35bfcb0c5f3d 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -580,7 +580,7 @@ impl pallet_staking::Config for Runtime { type NextNewSession = Session; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type OffendingValidatorsThreshold = OffendingValidatorsThreshold; - type SortedListProvider = BagsList; + type VoterList = BagsList; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type WeightInfo = weights::pallet_staking::WeightInfo; @@ -1519,7 +1519,10 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - CrowdloanIndexMigration, + ( + CrowdloanIndexMigration, + pallet_staking::migrations::v9::InjectValidatorsIntoVoterList, + ), >; /// The payload being signed in the transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/runtime/kusama/src/weights/runtime_parachains_paras.rs b/runtime/kusama/src/weights/runtime_parachains_paras.rs index 3e34104451f3..f646638c2786 100644 --- a/runtime/kusama/src/weights/runtime_parachains_paras.rs +++ b/runtime/kusama/src/weights/runtime_parachains_paras.rs @@ -1,4 +1,4 @@ -// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// Copyright 2017-2021 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify @@ -16,11 +16,11 @@ //! Autogenerated weights for `runtime_parachains::paras` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-03-15, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-02-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // --chain=kusama-dev // --steps=50 @@ -52,13 +52,13 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn force_set_current_code(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } // Storage: Paras Heads (r:0 w:1) fn force_set_current_head(s: u32, ) -> Weight { - (11_215_000 as Weight) + (10_155_000 as Weight) // Standard Error: 0 .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -77,7 +77,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn force_schedule_code_upgrade(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(9 as Weight)) .saturating_add(T::DbWeight::get().writes(8 as Weight)) } @@ -85,7 +85,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: Paras Heads (r:0 w:1) // Storage: Paras UpgradeGoAheadSignal (r:0 w:1) fn force_note_new_head(s: u32, ) -> Weight { - (14_968_000 as Weight) + (15_433_000 as Weight) // Standard Error: 0 .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) @@ -94,7 +94,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: ParasShared CurrentSessionIndex (r:1 w:0) // Storage: Paras ActionsQueue (r:1 w:1) fn force_queue_action() -> Weight { - (17_635_000 as Weight) + (16_160_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -103,15 +103,77 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn add_trusted_validation_code(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Paras CodeByHashRefs (r:1 w:0) // Storage: Paras CodeByHash (r:0 w:1) fn poke_unused_validation_code() -> Weight { - (2_669_000 as Weight) + (2_464_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + fn include_pvf_check_statement() -> Weight { + (117_279_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras UpcomingUpgrades (r:1 w:1) + // Storage: System Digest (r:1 w:1) + // Storage: Paras FutureCodeUpgrades (r:0 w:100) + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { + (624_849_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(104 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras CodeByHashRefs (r:1 w:1) + // Storage: Paras CodeByHash (r:0 w:1) + // Storage: Paras UpgradeGoAheadSignal (r:0 w:100) + // Storage: Paras FutureCodeHash (r:0 w:100) + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { + (551_320_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(204 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras ActionsQueue (r:1 w:1) + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { + (498_904_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras CodeByHashRefs (r:1 w:1) + // Storage: Paras ParaLifecycles (r:0 w:100) + // Storage: Paras CodeByHash (r:0 w:1) + // Storage: Paras CurrentCodeHash (r:0 w:100) + // Storage: Paras UpcomingParasGenesis (r:0 w:100) + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { + (609_470_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(304 as Weight)) + } } diff --git a/runtime/kusama/src/xcm_config.rs b/runtime/kusama/src/xcm_config.rs index 6f7e5ea149e4..1b7e1ef310ff 100644 --- a/runtime/kusama/src/xcm_config.rs +++ b/runtime/kusama/src/xcm_config.rs @@ -20,11 +20,7 @@ use super::{ parachains_origin, AccountId, Balances, Call, CouncilCollective, Event, Origin, ParaId, Runtime, WeightToFee, XcmPallet, }; -use frame_support::{ - match_types, parameter_types, - traits::{Everything, Nothing}, - weights::Weight, -}; +use frame_support::{match_types, parameter_types, traits::Everything, weights::Weight}; use runtime_common::{xcm_sender, ToAuthor}; use xcm::latest::prelude::*; use xcm_builder::{ @@ -169,14 +165,20 @@ pub type LocalOriginToLocation = ( ); impl pallet_xcm::Config for Runtime { type Event = Event; - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + // We don't allow any messages to be sent via the transaction yet. This is basically safe to + // enable, (safe the possibility of someone spamming the parachain if they're willing to pay + // the DOT to send from the Relay-chain). But it's useless until we bring in XCM v3 which will + // make `DescendOrigin` a bit more useful. + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; - // Anyone can execute XCM messages locally... + // Anyone can execute XCM messages locally. type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - // ...but they must match our filter, which rejects all. - type XcmExecuteFilter = Nothing; + type XcmExecuteFilter = Everything; type XcmExecutor = xcm_executor::XcmExecutor; + // Anyone is able to use teleportation regardless of who they are and what they want to teleport. type XcmTeleportFilter = Everything; + // Anyone is able to use reserve transfers regardless of who they are and what they want to + // transfer. type XcmReserveTransferFilter = Everything; type Weigher = FixedWeightBounds; type LocationInverter = LocationInverter; diff --git a/runtime/parachains/Cargo.toml b/runtime/parachains/Cargo.toml index 26e151f27a9f..ec1ec29650f2 100644 --- a/runtime/parachains/Cargo.toml +++ b/runtime/parachains/Cargo.toml @@ -23,6 +23,7 @@ sp-session = { git = "https://github.com/paritytech/substrate", branch = "master sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } +sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -96,6 +97,7 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "primitives/runtime-benchmarks", "static_assertions", + "sp-application-crypto", ] try-runtime = [ "frame-support/try-runtime", diff --git a/runtime/parachains/src/paras/benchmarking.rs b/runtime/parachains/src/paras/benchmarking.rs index e2c4954a2340..9d31453638a7 100644 --- a/runtime/parachains/src/paras/benchmarking.rs +++ b/runtime/parachains/src/paras/benchmarking.rs @@ -15,12 +15,16 @@ // along with Polkadot. If not, see . use super::*; -use crate::{configuration::HostConfiguration, shared}; +use crate::configuration::HostConfiguration; use frame_benchmarking::benchmarks; use frame_system::RawOrigin; use primitives::v2::{HeadData, Id as ParaId, ValidationCode, MAX_CODE_SIZE, MAX_HEAD_DATA_SIZE}; use sp_runtime::traits::{One, Saturating}; +mod pvf_check; + +use self::pvf_check::{VoteCause, VoteOutcome}; + // 2 ^ 10, because binary search time complexity is O(log(2, n)) and n = 1024 gives us a big and // round number. // Due to the limited number of parachains, the number of pruning, upcoming upgrades and cooldowns @@ -139,6 +143,48 @@ benchmarks! { let code_hash = [0; 32].into(); }: _(RawOrigin::Root, code_hash) + include_pvf_check_statement { + let (stmt, signature) = pvf_check::prepare_inclusion_bench::(); + }: { + let _ = Pallet::::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature); + } + + include_pvf_check_statement_finalize_upgrade_accept { + let (stmt, signature) = pvf_check::prepare_finalization_bench::( + VoteCause::Upgrade, + VoteOutcome::Accept, + ); + }: { + let _ = Pallet::::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature); + } + + include_pvf_check_statement_finalize_upgrade_reject { + let (stmt, signature) = pvf_check::prepare_finalization_bench::( + VoteCause::Upgrade, + VoteOutcome::Reject, + ); + }: { + let _ = Pallet::::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature); + } + + include_pvf_check_statement_finalize_onboarding_accept { + let (stmt, signature) = pvf_check::prepare_finalization_bench::( + VoteCause::Onboarding, + VoteOutcome::Accept, + ); + }: { + let _ = Pallet::::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature); + } + + include_pvf_check_statement_finalize_onboarding_reject { + let (stmt, signature) = pvf_check::prepare_finalization_bench::( + VoteCause::Onboarding, + VoteOutcome::Reject, + ); + }: { + let _ = Pallet::::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature); + } + impl_benchmark_test_suite!( Pallet, crate::mock::new_test_ext(Default::default()), diff --git a/runtime/parachains/src/paras/benchmarking/pvf_check.rs b/runtime/parachains/src/paras/benchmarking/pvf_check.rs new file mode 100644 index 000000000000..a89315c2857b --- /dev/null +++ b/runtime/parachains/src/paras/benchmarking/pvf_check.rs @@ -0,0 +1,195 @@ +// Copyright 2022 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 . + +//! This module focuses on the benchmarking of the `include_pvf_check_statement` dispatchable. + +use crate::{configuration, paras::*, shared::Pallet as ParasShared}; +use frame_system::RawOrigin; +use primitives::v2::{HeadData, Id as ParaId, ValidationCode, ValidatorId, ValidatorIndex}; +use sp_application_crypto::RuntimeAppPublic; + +// Constants for the benchmarking +const SESSION_INDEX: SessionIndex = 1; +const VALIDATOR_NUM: usize = 800; +const CAUSES_NUM: usize = 100; +fn validation_code() -> ValidationCode { + ValidationCode(vec![0]) +} +fn old_validation_code() -> ValidationCode { + ValidationCode(vec![1]) +} + +/// Prepares the PVF check statement and the validator signature to pass into +/// `include_pvf_check_statement` during benchmarking phase. +/// +/// It won't trigger finalization, so we expect the benchmarking will only measure the performance +/// of only vote accounting. +pub fn prepare_inclusion_bench() -> (PvfCheckStatement, ValidatorSignature) +where + T: Config + shared::Config, +{ + initialize::(); + // we do not plan to trigger finalization, thus the cause is inconsequential. + initialize_pvf_active_vote::(VoteCause::Onboarding); + + // `unwrap` cannot panic here since the `initialize` function should initialize validators count + // to be more than 0. + // + // VoteDirection doesn't matter here as well. + let stmt_n_sig = generate_statements::(VoteOutcome::Accept).next().unwrap(); + + stmt_n_sig +} + +/// Prepares conditions for benchmarking of the finalization part of `include_pvf_check_statement`. +/// +/// This function will initialize a PVF pre-check vote, then submit a number of PVF pre-checking +/// statements so that to achieve the quorum only one statement is left. This statement is returned +/// from this function and is expected to be passed into `include_pvf_check_statement` during the +/// benchmarking phase. +pub fn prepare_finalization_bench( + cause: VoteCause, + outcome: VoteOutcome, +) -> (PvfCheckStatement, ValidatorSignature) +where + T: Config + shared::Config, +{ + initialize::(); + initialize_pvf_active_vote::(cause); + + let mut stmts = generate_statements::(outcome).collect::>(); + // this should be ensured by the `initialize` function. + assert!(stmts.len() > 2); + + // stash the last statement to be used in the benchmarking phase. + let stmt_n_sig = stmts.pop().unwrap(); + + for (stmt, sig) in stmts { + let r = Pallet::::include_pvf_check_statement(RawOrigin::None.into(), stmt, sig); + assert!(r.is_ok()); + } + + stmt_n_sig +} + +/// What caused the PVF pre-checking vote? +#[derive(PartialEq, Eq, Copy, Clone, Debug)] +pub enum VoteCause { + Onboarding, + Upgrade, +} + +/// The outcome of the PVF pre-checking vote. +#[derive(PartialEq, Eq, Copy, Clone, Debug)] +pub enum VoteOutcome { + Accept, + Reject, +} + +fn initialize() +where + T: Config + shared::Config, +{ + // 0. generate a list of validators + let validators = (0..VALIDATOR_NUM) + .map(|_| ::generate_pair(None)) + .collect::>(); + + // 1. Make sure PVF pre-checking is enabled in the config. + let mut config = configuration::Pallet::::config(); + config.pvf_checking_enabled = true; + configuration::Pallet::::force_set_active_config(config.clone()); + + // 2. initialize a new session with deterministic validator set. + ParasShared::::set_active_validators_ascending(validators.clone()); + ParasShared::::set_session_index(SESSION_INDEX); +} + +/// Creates a new PVF pre-checking active vote. +/// +/// The subject of the vote (i.e. validation code) and the cause (upgrade/onboarding) is specified +/// by the test setup. +fn initialize_pvf_active_vote(vote_cause: VoteCause) +where + T: Config + shared::Config, +{ + for i in 0..CAUSES_NUM { + let id = ParaId::from(i as u32); + + if vote_cause == VoteCause::Upgrade { + // we do care about validation code being actually different, since there is a check + // that prevents upgrading to the same code. + let old_validation_code = old_validation_code(); + let validation_code = validation_code(); + + let mut parachains = ParachainsCache::new(); + Pallet::::initialize_para_now( + &mut parachains, + id, + &ParaGenesisArgs { + parachain: true, + genesis_head: HeadData(vec![1, 2, 3, 4]), + validation_code: old_validation_code, + }, + ); + // don't care about performance here, but we do care about robustness. So dump the cache + // asap. + drop(parachains); + + Pallet::::schedule_code_upgrade( + id, + validation_code, + /* relay_parent_number */ 1u32.into(), + &configuration::Pallet::::config(), + ); + } else { + let r = Pallet::::schedule_para_initialize( + id, + ParaGenesisArgs { + parachain: true, + genesis_head: HeadData(vec![1, 2, 3, 4]), + validation_code: validation_code(), + }, + ); + assert!(r.is_ok()); + } + } +} + +/// Generates a list of votes combined with signatures for the active validator set. The number of +/// votes is equal to the minimum number of votes required to reach the supermajority. +fn generate_statements( + vote_outcome: VoteOutcome, +) -> impl Iterator +where + T: Config + shared::Config, +{ + let validators = ParasShared::::active_validator_keys(); + + let required_votes = primitives::v2::supermajority_threshold(validators.len()); + (0..required_votes).map(move |validator_index| { + let stmt = PvfCheckStatement { + accept: vote_outcome == VoteOutcome::Accept, + subject: validation_code().hash(), + session_index: SESSION_INDEX, + + validator_index: ValidatorIndex(validator_index as u32), + }; + let signature = validators[validator_index].sign(&stmt.signing_payload()).unwrap(); + + (stmt, signature) + }) +} diff --git a/runtime/parachains/src/paras/mod.rs b/runtime/parachains/src/paras/mod.rs index 06902649d35b..4f49b6f2dd59 100644 --- a/runtime/parachains/src/paras/mod.rs +++ b/runtime/parachains/src/paras/mod.rs @@ -404,6 +404,12 @@ pub trait WeightInfo { fn force_queue_action() -> Weight; fn add_trusted_validation_code(c: u32) -> Weight; fn poke_unused_validation_code() -> Weight; + + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight; + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight; + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight; + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight; + fn include_pvf_check_statement() -> Weight; } pub struct TestWeightInfo; @@ -429,6 +435,22 @@ impl WeightInfo for TestWeightInfo { fn poke_unused_validation_code() -> Weight { Weight::MAX } + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { + Weight::MAX + } + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { + Weight::MAX + } + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { + Weight::MAX + } + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { + Weight::MAX + } + fn include_pvf_check_statement() -> Weight { + // This special value is to distinguish from the finalizing variants above in tests. + Weight::MAX - 1 + } } #[frame_support::pallet] @@ -855,12 +877,23 @@ pub mod pallet { /// Includes a statement for a PVF pre-checking vote. Potentially, finalizes the vote and /// enacts the results if that was the last vote before achieving the supermajority. - #[pallet::weight(Weight::MAX)] + #[pallet::weight( + sp_std::cmp::max( + sp_std::cmp::max( + ::WeightInfo::include_pvf_check_statement_finalize_upgrade_accept(), + ::WeightInfo::include_pvf_check_statement_finalize_upgrade_reject(), + ), + sp_std::cmp::max( + ::WeightInfo::include_pvf_check_statement_finalize_onboarding_accept(), + ::WeightInfo::include_pvf_check_statement_finalize_onboarding_reject(), + ) + ) + )] pub fn include_pvf_check_statement( origin: OriginFor, stmt: PvfCheckStatement, signature: ValidatorSignature, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { ensure_none(origin)?; // Make sure that PVF pre-checking is enabled. @@ -931,13 +964,17 @@ pub mod pallet { Self::enact_pvf_rejected(&stmt.subject, active_vote.causes); }, } + + // No weight refund since this statement was the last one and lead to finalization. + Ok(().into()) } else { - // No quorum has been achieved. So just store the updated state back into the - // storage. + // No quorum has been achieved. + // + // - So just store the updated state back into the storage. + // - Only charge weight for simple vote inclusion. PvfActiveVoteMap::::insert(&stmt.subject, active_vote); + Ok(Some(::WeightInfo::include_pvf_check_statement()).into()) } - - Ok(()) } } diff --git a/runtime/parachains/src/paras/tests.rs b/runtime/parachains/src/paras/tests.rs index f2fa90fcafb5..960132d5f804 100644 --- a/runtime/parachains/src/paras/tests.rs +++ b/runtime/parachains/src/paras/tests.rs @@ -1277,7 +1277,8 @@ fn pvf_check_submit_vote() { ::validate_unsigned(TransactionSource::InBlock, &call) .map(|_| ()); let dispatch_result = - Paras::include_pvf_check_statement(None.into(), stmt.clone(), signature.clone()); + Paras::include_pvf_check_statement(None.into(), stmt.clone(), signature.clone()) + .map(|_| ()); (validate_unsigned, dispatch_result) }; @@ -1375,6 +1376,69 @@ fn pvf_check_submit_vote() { }); } +#[test] +fn include_pvf_check_statement_refunds_weight() { + let a = ParaId::from(111); + let old_code: ValidationCode = vec![1, 2, 3].into(); + let new_code: ValidationCode = vec![3, 2, 1].into(); + + let paras = vec![( + a, + ParaGenesisArgs { + parachain: false, + genesis_head: Default::default(), + validation_code: old_code, + }, + )]; + + let genesis_config = MockGenesisConfig { + paras: GenesisConfig { paras, ..Default::default() }, + configuration: crate::configuration::GenesisConfig { + config: HostConfiguration { pvf_checking_enabled: true, ..Default::default() }, + ..Default::default() + }, + ..Default::default() + }; + + new_test_ext(genesis_config).execute_with(|| { + // At this point `a` is already onboarded. Run to block 1 performing session change at + // the end of block #0. + run_to_block(2, Some(vec![1])); + + // Relay parent of the block that schedules the upgrade. + const RELAY_PARENT: BlockNumber = 1; + // Expected current session index. + const EXPECTED_SESSION: SessionIndex = 1; + + Paras::schedule_code_upgrade(a, new_code.clone(), RELAY_PARENT, &Configuration::config()); + + let mut stmts = IntoIterator::into_iter([0, 1, 2, 3]) + .map(|i| { + let stmt = PvfCheckStatement { + accept: true, + subject: new_code.hash(), + session_index: EXPECTED_SESSION, + validator_index: (i as u32).into(), + }; + let sig = VALIDATORS[i].sign(&stmt.signing_payload()); + (stmt, sig) + }) + .collect::>(); + let last_one = stmts.pop().unwrap(); + + // Verify that just vote submission is priced accordingly. + for (stmt, sig) in stmts { + let r = Paras::include_pvf_check_statement(None.into(), stmt, sig.into()).unwrap(); + assert_eq!(r.actual_weight, Some(TestWeightInfo::include_pvf_check_statement())); + } + + // Verify that the last statement is priced maximally. + let (stmt, sig) = last_one; + let r = Paras::include_pvf_check_statement(None.into(), stmt, sig.into()).unwrap(); + assert_eq!(r.actual_weight, None); + }); +} + #[test] fn add_trusted_validation_code_inserts_with_no_users() { // This test is to ensure that trusted validation code is inserted into the storage diff --git a/runtime/parachains/src/shared.rs b/runtime/parachains/src/shared.rs index e309e128800a..3769ff4525c1 100644 --- a/runtime/parachains/src/shared.rs +++ b/runtime/parachains/src/shared.rs @@ -124,7 +124,7 @@ impl Pallet { CurrentSessionIndex::::set(index); } - #[cfg(test)] + #[cfg(any(feature = "runtime-benchmarks", test))] pub(crate) fn set_active_validators_ascending(active: Vec) { ActiveValidatorIndices::::set( (0..active.len()).map(|i| ValidatorIndex(i as _)).collect(), diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index d79c92d4149e..9805dd97f237 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -577,7 +577,7 @@ impl pallet_staking::Config for Runtime { type NextNewSession = Session; type ElectionProvider = ElectionProviderMultiPhase; type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf; - type SortedListProvider = BagsList; + type VoterList = BagsList; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type WeightInfo = weights::pallet_staking::WeightInfo; @@ -1227,7 +1227,8 @@ parameter_types! { impl parachains_ump::Config for Runtime { type Event = Event; - type UmpSink = (); + type UmpSink = + crate::parachains_ump::XcmSink, Runtime>; type FirstMessageFactorPercent = FirstMessageFactorPercent; type ExecuteOverweightOrigin = EnsureRoot; type WeightInfo = parachains_ump::TestWeightInfo; @@ -1473,7 +1474,11 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - (FixCouncilDepositMigration, CrowdloanIndexMigration), + ( + FixCouncilDepositMigration, + CrowdloanIndexMigration, + pallet_staking::migrations::v9::InjectValidatorsIntoVoterList, + ), >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/runtime/polkadot/src/weights/runtime_parachains_paras.rs b/runtime/polkadot/src/weights/runtime_parachains_paras.rs index 27ae677d5e90..ed4a040d4c18 100644 --- a/runtime/polkadot/src/weights/runtime_parachains_paras.rs +++ b/runtime/polkadot/src/weights/runtime_parachains_paras.rs @@ -1,4 +1,4 @@ -// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// Copyright 2017-2021 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify @@ -16,11 +16,11 @@ //! Autogenerated weights for `runtime_parachains::paras` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-03-15, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-02-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // --chain=polkadot-dev // --steps=50 @@ -52,13 +52,13 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn force_set_current_code(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } // Storage: Paras Heads (r:0 w:1) fn force_set_current_head(s: u32, ) -> Weight { - (10_412_000 as Weight) + (8_514_000 as Weight) // Standard Error: 0 .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -77,7 +77,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn force_schedule_code_upgrade(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(9 as Weight)) .saturating_add(T::DbWeight::get().writes(8 as Weight)) } @@ -85,7 +85,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: Paras Heads (r:0 w:1) // Storage: Paras UpgradeGoAheadSignal (r:0 w:1) fn force_note_new_head(s: u32, ) -> Weight { - (13_903_000 as Weight) + (13_963_000 as Weight) // Standard Error: 0 .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) @@ -94,7 +94,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: ParasShared CurrentSessionIndex (r:1 w:0) // Storage: Paras ActionsQueue (r:1 w:1) fn force_queue_action() -> Weight { - (18_447_000 as Weight) + (15_934_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -103,15 +103,77 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn add_trusted_validation_code(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Paras CodeByHashRefs (r:1 w:0) // Storage: Paras CodeByHash (r:0 w:1) fn poke_unused_validation_code() -> Weight { - (2_619_000 as Weight) + (2_406_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + fn include_pvf_check_statement() -> Weight { + (120_016_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras UpcomingUpgrades (r:1 w:1) + // Storage: System Digest (r:1 w:1) + // Storage: Paras FutureCodeUpgrades (r:0 w:100) + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { + (623_579_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(104 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras CodeByHashRefs (r:1 w:1) + // Storage: Paras CodeByHash (r:0 w:1) + // Storage: Paras UpgradeGoAheadSignal (r:0 w:100) + // Storage: Paras FutureCodeHash (r:0 w:100) + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { + (552_089_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(204 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras ActionsQueue (r:1 w:1) + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { + (498_524_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras CodeByHashRefs (r:1 w:1) + // Storage: Paras ParaLifecycles (r:0 w:100) + // Storage: Paras CodeByHash (r:0 w:1) + // Storage: Paras CurrentCodeHash (r:0 w:100) + // Storage: Paras UpcomingParasGenesis (r:0 w:100) + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { + (611_386_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(304 as Weight)) + } } diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index 3f78a9274d4c..f75d30d079f4 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -58,7 +58,7 @@ pub type SovereignAccountOf = ( AccountId32Aliases, ); -/// Our asset transactor. This is what allows us to interest with the runtime facilities from the point of +/// Our asset transactor. This is what allows us to interact with the runtime assets from the point of /// view of XCM-only concepts like `MultiLocation` and `MultiAsset`. /// /// Ours is only aware of the Balances pallet, which is mapped to `DotLocation`. @@ -75,13 +75,18 @@ pub type LocalAssetTransactor = XcmCurrencyAdapter< CheckAccount, >; -/// The means that we convert an the XCM message origin location into a local dispatch origin. +/// The means that we convert an XCM origin `MultiLocation` into the runtime's `Origin` type for +/// local dispatch. This is a conversion function from an `OriginKind` type along with the +/// `MultiLocation` value and returns an `Origin` value or an error. type LocalOriginConverter = ( - // A `Signed` origin of the sovereign account that the original location controls. + // If the origin kind is `Sovereign`, then return a `Signed` origin with the account determined + // by the `SovereignAccountOf` converter. SovereignSignedViaLocation, - // A child parachain, natively expressed, has the `Parachain` origin. + // If the origin kind is `Native` and the XCM origin is a child parachain, then we can express + // it with the special `parachains_origin::Origin` origin variant. ChildParachainAsNative, - // The AccountId32 location type can be expressed natively as a `Signed` origin. + // If the origin kind is `Native` and the XCM origin is the `AccountId32` location, then it can + // be expressed using the `Signed` origin variant. SignedAccountId32AsNative, ); @@ -105,6 +110,7 @@ parameter_types! { pub const PolkadotForStatemint: (MultiAssetFilter, MultiLocation) = (Polkadot::get(), Parachain(1000).into()); } +/// Polkadot Relay recognizes/respects the Statemint chain as a teleporter. pub type TrustedTeleporters = (xcm_builder::Case,); match_types! { @@ -131,6 +137,7 @@ impl xcm_executor::Config for XcmConfig { type XcmSender = XcmRouter; type AssetTransactor = LocalAssetTransactor; type OriginConverter = LocalOriginConverter; + // Polkadot Relay recognises no chains which act as reserves. type IsReserve = (); type IsTeleporter = TrustedTeleporters; type LocationInverter = LocationInverter; @@ -166,15 +173,16 @@ pub type LocalOriginToLocation = ( impl pallet_xcm::Config for Runtime { type Event = Event; - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + // Not much use in sending XCM at this point. + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; // == Deny All type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally... type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; // ...but they must match our filter, which rejects all. - type XcmExecuteFilter = Nothing; + type XcmExecuteFilter = Nothing; // == Deny All type XcmExecutor = xcm_executor::XcmExecutor; - type XcmTeleportFilter = Nothing; - type XcmReserveTransferFilter = Nothing; + type XcmTeleportFilter = Everything; // == Allow All + type XcmReserveTransferFilter = Everything; // == Allow All type Weigher = FixedWeightBounds; type LocationInverter = LocationInverter; type Origin = Origin; diff --git a/runtime/rococo/src/weights/runtime_parachains_paras.rs b/runtime/rococo/src/weights/runtime_parachains_paras.rs index e1ff4d6cc66d..6f6b6943a14f 100644 --- a/runtime/rococo/src/weights/runtime_parachains_paras.rs +++ b/runtime/rococo/src/weights/runtime_parachains_paras.rs @@ -1,4 +1,4 @@ -// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// Copyright 2017-2021 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ //! Autogenerated weights for `runtime_parachains::paras` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-03-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-02-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -58,7 +58,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn } // Storage: Paras Heads (r:0 w:1) fn force_set_current_head(s: u32, ) -> Weight { - (11_885_000 as Weight) + (10_856_000 as Weight) // Standard Error: 0 .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -85,7 +85,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: Paras Heads (r:0 w:1) // Storage: Paras UpgradeGoAheadSignal (r:0 w:1) fn force_note_new_head(s: u32, ) -> Weight { - (14_996_000 as Weight) + (13_762_000 as Weight) // Standard Error: 0 .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) @@ -94,7 +94,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: ParasShared CurrentSessionIndex (r:1 w:0) // Storage: Paras ActionsQueue (r:1 w:1) fn force_queue_action() -> Weight { - (15_924_000 as Weight) + (15_946_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -110,8 +110,70 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: Paras CodeByHashRefs (r:1 w:0) // Storage: Paras CodeByHash (r:0 w:1) fn poke_unused_validation_code() -> Weight { - (2_424_000 as Weight) + (2_509_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + fn include_pvf_check_statement() -> Weight { + (117_675_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras UpcomingUpgrades (r:1 w:1) + // Storage: System Digest (r:1 w:1) + // Storage: Paras FutureCodeUpgrades (r:0 w:100) + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { + (618_769_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(104 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras CodeByHashRefs (r:1 w:1) + // Storage: Paras CodeByHash (r:0 w:1) + // Storage: Paras UpgradeGoAheadSignal (r:0 w:100) + // Storage: Paras FutureCodeHash (r:0 w:100) + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { + (553_319_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(204 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras ActionsQueue (r:1 w:1) + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { + (507_519_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras CodeByHashRefs (r:1 w:1) + // Storage: Paras ParaLifecycles (r:0 w:100) + // Storage: Paras CodeByHash (r:0 w:1) + // Storage: Paras CurrentCodeHash (r:0 w:100) + // Storage: Paras UpcomingParasGenesis (r:0 w:100) + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { + (609_820_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(304 as Weight)) + } } diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index 2200e96e0f20..543cf75d868c 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -346,9 +346,7 @@ impl pallet_staking::Config for Runtime { frame_election_provider_support::onchain::OnChainSequentialPhragmen; type GenesisElectionProvider = frame_election_provider_support::onchain::OnChainSequentialPhragmen; - // Use the nominator map to iter voter AND no-ops for all SortedListProvider hooks. The migration - // to bags-list is a no-op, but the storage version will be updated. - type SortedListProvider = pallet_staking::UseNominatorsMap; + type VoterList = pallet_staking::UseNominatorsAndValidatorsMap; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type WeightInfo = (); diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index e38a48553c02..436b12826846 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -466,7 +466,7 @@ impl pallet_staking::Config for Runtime { type NextNewSession = Session; type ElectionProvider = ElectionProviderMultiPhase; type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf; - type SortedListProvider = BagsList; + type VoterList = BagsList; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type WeightInfo = weights::pallet_staking::WeightInfo; @@ -1087,7 +1087,10 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - CrowdloanIndexMigration, + ( + CrowdloanIndexMigration, + pallet_staking::migrations::v9::InjectValidatorsIntoVoterList, + ), >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/runtime/westend/src/weights/runtime_parachains_paras.rs b/runtime/westend/src/weights/runtime_parachains_paras.rs index 1fc1043bc40c..d64471c488c3 100644 --- a/runtime/westend/src/weights/runtime_parachains_paras.rs +++ b/runtime/westend/src/weights/runtime_parachains_paras.rs @@ -1,4 +1,4 @@ -// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// Copyright 2017-2021 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify @@ -16,11 +16,11 @@ //! Autogenerated weights for `runtime_parachains::paras` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-03-15, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-02-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // --chain=westend-dev // --steps=50 @@ -52,13 +52,13 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn force_set_current_code(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } // Storage: Paras Heads (r:0 w:1) fn force_set_current_head(s: u32, ) -> Weight { - (8_970_000 as Weight) + (10_166_000 as Weight) // Standard Error: 0 .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -76,7 +76,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn force_schedule_code_upgrade(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(8 as Weight)) .saturating_add(T::DbWeight::get().writes(8 as Weight)) } @@ -84,7 +84,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: Paras Heads (r:0 w:1) // Storage: Paras UpgradeGoAheadSignal (r:0 w:1) fn force_note_new_head(s: u32, ) -> Weight { - (11_059_000 as Weight) + (15_413_000 as Weight) // Standard Error: 0 .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) @@ -93,7 +93,7 @@ impl runtime_parachains::paras::WeightInfo for WeightIn // Storage: ParasShared CurrentSessionIndex (r:1 w:0) // Storage: Paras ActionsQueue (r:1 w:1) fn force_queue_action() -> Weight { - (18_200_000 as Weight) + (15_999_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -102,15 +102,72 @@ impl runtime_parachains::paras::WeightInfo for WeightIn fn add_trusted_validation_code(c: u32, ) -> Weight { (0 as Weight) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((2_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Paras CodeByHashRefs (r:1 w:0) // Storage: Paras CodeByHash (r:0 w:1) fn poke_unused_validation_code() -> Weight { - (2_708_000 as Weight) + (2_445_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + fn include_pvf_check_statement() -> Weight { + (116_591_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras UpcomingUpgrades (r:1 w:1) + // Storage: System Digest (r:1 w:1) + // Storage: Paras FutureCodeUpgrades (r:0 w:100) + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { + (622_057_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(104 as Weight)) + } + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras CodeByHashRefs (r:1 w:1) + // Storage: Paras CodeByHash (r:0 w:1) + // Storage: Paras UpgradeGoAheadSignal (r:0 w:100) + // Storage: Paras FutureCodeHash (r:0 w:100) + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { + (550_573_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(204 as Weight)) + } + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras ActionsQueue (r:1 w:1) + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { + (499_580_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: ParasShared ActiveValidatorKeys (r:1 w:0) + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Paras PvfActiveVoteMap (r:1 w:1) + // Storage: Paras PvfActiveVoteList (r:1 w:1) + // Storage: Paras CodeByHashRefs (r:1 w:1) + // Storage: Paras ParaLifecycles (r:0 w:100) + // Storage: Paras CodeByHash (r:0 w:1) + // Storage: Paras CurrentCodeHash (r:0 w:100) + // Storage: Paras UpcomingParasGenesis (r:0 w:100) + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { + (602_317_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(304 as Weight)) + } } diff --git a/xcm/pallet-xcm/src/lib.rs b/xcm/pallet-xcm/src/lib.rs index 5a079c29f1ab..84669fa602b2 100644 --- a/xcm/pallet-xcm/src/lib.rs +++ b/xcm/pallet-xcm/src/lib.rs @@ -474,9 +474,9 @@ pub mod pallet { /// Teleport some assets from the local chain to some destination chain. /// - /// Fee payment on the destination side is made from the first asset listed in the `assets` vector and - /// fee-weight is calculated locally and thus remote weights are assumed to be equal to - /// local weights. + /// Fee payment on the destination side is made from the asset in the `assets` vector of + /// index `fee_asset_item`. The weight limit for fees is not provided and thus is unlimited, + /// with all fees taken as needed from the asset. /// /// - `origin`: Must be capable of withdrawing the `assets` and executing XCM. /// - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send @@ -512,12 +512,12 @@ pub mod pallet { Self::do_teleport_assets(origin, dest, beneficiary, assets, fee_asset_item, None) } - /// Transfer some assets from the local chain to the sovereign account of a destination chain and forward - /// a notification XCM. + /// Transfer some assets from the local chain to the sovereign account of a destination + /// chain and forward a notification XCM. /// - /// Fee payment on the destination side is made from the first asset listed in the `assets` vector and - /// fee-weight is calculated locally and thus remote weights are assumed to be equal to - /// local weights. + /// Fee payment on the destination side is made from the asset in the `assets` vector of + /// index `fee_asset_item`. The weight limit for fees is not provided and thus is unlimited, + /// with all fees taken as needed from the asset. /// /// - `origin`: Must be capable of withdrawing the `assets` and executing XCM. /// - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send @@ -672,10 +672,13 @@ pub mod pallet { }) } - /// Transfer some assets from the local chain to the sovereign account of a destination chain and forward - /// a notification XCM. + /// Transfer some assets from the local chain to the sovereign account of a destination + /// chain and forward a notification XCM. /// - /// Fee payment on the destination side is made from the first asset listed in the `assets` vector. + /// Fee payment on the destination side is made from the asset in the `assets` vector of + /// index `fee_asset_item`, up to enough to pay for `weight_limit` of weight. If more weight + /// is needed than `weight_limit`, then the operation will fail and the assets send may be + /// at risk. /// /// - `origin`: Must be capable of withdrawing the `assets` and executing XCM. /// - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send @@ -719,7 +722,10 @@ pub mod pallet { /// Teleport some assets from the local chain to some destination chain. /// - /// Fee payment on the destination side is made from the first asset listed in the `assets` vector. + /// Fee payment on the destination side is made from the asset in the `assets` vector of + /// index `fee_asset_item`, up to enough to pay for `weight_limit` of weight. If more weight + /// is needed than `weight_limit`, then the operation will fail and the assets send may be + /// at risk. /// /// - `origin`: Must be capable of withdrawing the `assets` and executing XCM. /// - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send