diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 07b0dd319cf792dbee99c64b5addc4307ab14dd5..eb432191dbe682300ba62d1c050b2ad3d1bfe1d3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,8 +24,6 @@ stages:
- check
- test
- build
- - chaos-env
- - chaos
- publish
- deploy
- flaming-fir
@@ -305,13 +303,8 @@ check-web-wasm:
script:
# WASM support is in progress. As more and more crates support WASM, we
# should add entries here. See https://github.com/paritytech/substrate/issues/2416
- - time cargo build --target=wasm32-unknown-unknown -p sp-io
- - time cargo build --target=wasm32-unknown-unknown -p sp-runtime
- - time cargo build --target=wasm32-unknown-unknown -p sp-std
- - time cargo build --target=wasm32-unknown-unknown -p sc-consensus-aura
- - time cargo build --target=wasm32-unknown-unknown -p sc-consensus-babe
- - time cargo build --target=wasm32-unknown-unknown -p sp-consensus
- - time cargo build --target=wasm32-unknown-unknown -p sc-telemetry
+ # Note: we don't need to test crates imported in `bin/node/cli`
+ - time cargo build --manifest-path=client/consensus/aura/Cargo.toml --target=wasm32-unknown-unknown --features getrandom
# Note: the command below is a bit weird because several Cargo issues prevent us from compiling the node in a more straight-forward way.
- time cargo +nightly build --manifest-path=bin/node/cli/Cargo.toml --no-default-features --features browser --target=wasm32-unknown-unknown -Z features=itarget
# with-tracing must be explicitly activated, we run a test to ensure this works as expected in both cases
@@ -399,12 +392,11 @@ build-linux-substrate: &build-binary
<<: *collect-artifacts
<<: *docker-env
rules:
- # .build-refs with manual on PRs and chaos
+ # .build-refs with manual on PRs
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME == "tags"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- - if: $CI_COMMIT_MESSAGE =~ /\[chaos:(basic|medium|large)\]/ && $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # i.e add [chaos:basic] in commit message to trigger
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
when: manual
allow_failure: true
@@ -490,118 +482,37 @@ build-rust-doc:
- echo "" > ./crate-docs/index.html
- sccache -s
-#### stage: chaos-env
-
-build-chaos-docker:
- stage: chaos-env
- rules:
- # .build-refs with chaos
- - if: $CI_PIPELINE_SOURCE == "web"
- - if: $CI_COMMIT_REF_NAME == "master"
- - if: $CI_COMMIT_REF_NAME == "tags"
- - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- - if: $CI_COMMIT_MESSAGE =~ /\[chaos:(basic|medium|large)\]/ && $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # i.e add [chaos:basic] in commit message to trigger
- needs:
- - job: build-linux-substrate
- image: docker:stable
- tags:
- - kubernetes-parity-build
- variables:
- <<: *default-vars
- DOCKER_HOST: tcp://localhost:2375
- DOCKER_DRIVER: overlay2
- PRODUCT: substrate
- DOCKERFILE: $PRODUCT.Dockerfile
- CONTAINER_IMAGE: paritypr/$PRODUCT
- environment:
- name: parity-simnet
- services:
- - docker:dind
- before_script:
- - test "$DOCKER_CHAOS_USER" -a "$DOCKER_CHAOS_TOKEN"
- || ( echo "no docker credentials provided"; exit 1 )
- - docker login -u "$DOCKER_CHAOS_USER" -p "$DOCKER_CHAOS_TOKEN"
- - docker info
- script:
- - cd ./artifacts/$PRODUCT/
- - VERSION="ci-${CI_COMMIT_SHORT_SHA}"
- - echo "${PRODUCT} version = ${VERSION}"
- - test -z "${VERSION}" && exit 1
- - docker build
- --build-arg VCS_REF="${CI_COMMIT_SHA}"
- --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
- --tag $CONTAINER_IMAGE:$VERSION
- --file $DOCKERFILE .
- - docker push $CONTAINER_IMAGE:$VERSION
- after_script:
- - docker logout
-
-#### stage: chaos
-
-chaos-test-singlenodeheight:
- stage: chaos
- rules:
- # .build-refs with chaos
- - if: $CI_PIPELINE_SOURCE == "web"
- - if: $CI_COMMIT_REF_NAME == "master"
- - if: $CI_COMMIT_REF_NAME == "tags"
- - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- - if: $CI_COMMIT_MESSAGE =~ /\[chaos:(basic|medium|large)\]/ && $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # i.e add [chaos:basic] in commit message to trigger
- image: paritypr/simnet:latest
- needs:
- - job: build-chaos-docker
- tags:
- - parity-simnet
- variables:
- <<: *default-vars
- PRODUCT: substrate
- DOCKERFILE: $PRODUCT.Dockerfile
- CONTAINER_IMAGE: paritypr/$PRODUCT
- KEEP_NAMESPACE: 0
- NAMESPACE: "substrate-ci-${CI_COMMIT_SHORT_SHA}-${CI_PIPELINE_ID}"
- VERSION: "ci-${CI_COMMIT_SHORT_SHA}"
- interruptible: true
- environment:
- name: parity-simnet
- script:
- - simnet spawn dev -i $CONTAINER_IMAGE:$VERSION
- - simnet singlenodeheight -h 30
- after_script:
- - simnet clean
-
#### stage: publish
.build-push-docker-image: &build-push-docker-image
<<: *build-refs
<<: *kubernetes-build
- image: docker:stable
- services:
- - docker:dind
+ image: quay.io/buildah/stable
variables: &docker-build-vars
<<: *default-vars
- DOCKER_HOST: tcp://localhost:2375
- DOCKER_DRIVER: overlay2
GIT_STRATEGY: none
DOCKERFILE: $PRODUCT.Dockerfile
- CONTAINER_IMAGE: parity/$PRODUCT
+ IMAGE_NAME: docker.io/parity/$PRODUCT
before_script:
- - test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity"
- || ( echo "no docker credentials provided"; exit 1 )
- - docker login -u "$Docker_Hub_User_Parity" -p "$Docker_Hub_Pass_Parity"
- - docker info
+ - test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity" ||
+ ( echo "no docker credentials provided"; exit 1 )
script:
- cd ./artifacts/$PRODUCT/
- VERSION="$(cat ./VERSION)"
- echo "${PRODUCT} version = ${VERSION}"
- test -z "${VERSION}" && exit 1
- - docker build
- --build-arg VCS_REF="${CI_COMMIT_SHA}"
- --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
- --tag $CONTAINER_IMAGE:$VERSION
- --tag $CONTAINER_IMAGE:latest
- --file $DOCKERFILE .
- - docker push $CONTAINER_IMAGE:$VERSION
- - docker push $CONTAINER_IMAGE:latest
+ - buildah bud
+ --format=docker
+ --build-arg VCS_REF="${CI_COMMIT_SHA}"
+ --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
+ --tag "$IMAGE_NAME:$VERSION"
+ --tag "$IMAGE_NAME:latest"
+ --file "$DOCKERFILE" .
+ - echo "$Docker_Hub_Pass_Parity" |
+ buildah login --username "$Docker_Hub_User_Parity" --password-stdin docker.io
+ - buildah info
+ - buildah push --format=v2s2 "$IMAGE_NAME:$VERSION"
+ - buildah push --format=v2s2 "$IMAGE_NAME:latest"
publish-docker-substrate:
stage: publish
@@ -615,7 +526,7 @@ publish-docker-substrate:
<<: *docker-build-vars
PRODUCT: substrate
after_script:
- - docker logout
+ - buildah logout "$IMAGE_NAME"
# only VERSION information is needed for the deployment
- find ./artifacts/ -depth -not -name VERSION -type f -delete
@@ -629,7 +540,7 @@ publish-docker-subkey:
<<: *docker-build-vars
PRODUCT: subkey
after_script:
- - docker logout
+ - buildah logout "$IMAGE_NAME"
publish-s3-release:
stage: publish
diff --git a/.maintain/frame-weight-template.hbs b/.maintain/frame-weight-template.hbs
index 76f89eafbaeee28a638d8407a8058a4e214bfbdc..2253452e203daff7374cffae4ffabe9ae8407254 100644
--- a/.maintain/frame-weight-template.hbs
+++ b/.maintain/frame-weight-template.hbs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/.maintain/gitlab/check_polkadot_companion_build.sh b/.maintain/gitlab/check_polkadot_companion_build.sh
index 4a7e9869abf5e1cc238011a81ca584c4a567a8f7..f2b61c6192d620bf8f5bed5fcb510538174b8484 100755
--- a/.maintain/gitlab/check_polkadot_companion_build.sh
+++ b/.maintain/gitlab/check_polkadot_companion_build.sh
@@ -45,7 +45,7 @@ cargo install -f --version 0.2.0 diener
# Merge master into our branch before building Polkadot to make sure we don't miss
# any commits that are required by Polkadot.
-git fetch --depth 20 origin
+git fetch --depth 100 origin
git merge origin/master
# Clone the current Polkadot master branch into ./polkadot.
diff --git a/.maintain/sentry-node/docker-compose.yml b/.maintain/sentry-node/docker-compose.yml
index 2af9449853c771be95d34c8a25aef8adc867d72c..a4cc8f1ebb92ec4c0c8ab8a8c5b0487cda46220d 100644
--- a/.maintain/sentry-node/docker-compose.yml
+++ b/.maintain/sentry-node/docker-compose.yml
@@ -47,9 +47,9 @@ services:
- "--validator"
- "--alice"
- "--sentry-nodes"
- - "/dns/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi"
+ - "/dns/sentry-a/tcp/30333/p2p/12D3KooWSCufgHzV4fCwRijfH2k3abrpAJxTKxEvN1FDuRXA2U9x"
- "--reserved-nodes"
- - "/dns/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi"
+ - "/dns/sentry-a/tcp/30333/p2p/12D3KooWSCufgHzV4fCwRijfH2k3abrpAJxTKxEvN1FDuRXA2U9x"
# Not only bind to localhost.
- "--unsafe-ws-external"
- "--unsafe-rpc-external"
@@ -83,11 +83,11 @@ services:
- "--port"
- "30333"
- "--sentry"
- - "/dns/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR"
+ - "/dns/validator-a/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"
- "--reserved-nodes"
- - "/dns/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR"
+ - "/dns/validator-a/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"
- "--bootnodes"
- - "/dns/validator-b/tcp/30333/p2p/QmSVnNf9HwVMT1Y4cK1P6aoJcEZjmoTXpjKBmAABLMnZEk"
+ - "/dns/validator-b/tcp/30333/p2p/12D3KooWHdiAxVd8uMQR1hGWXccidmfCwLqcMpGwR6QcTP6QRMuD"
- "--no-telemetry"
- "--rpc-cors"
- "all"
@@ -118,9 +118,9 @@ services:
- "--validator"
- "--bob"
- "--bootnodes"
- - "/dns/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR"
+ - "/dns/validator-a/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"
- "--bootnodes"
- - "/dns/sentry-a/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi"
+ - "/dns/sentry-a/tcp/30333/p2p/12D3KooWSCufgHzV4fCwRijfH2k3abrpAJxTKxEvN1FDuRXA2U9x"
- "--no-telemetry"
- "--rpc-cors"
- "all"
diff --git a/.maintain/update-copyright.sh b/.maintain/update-copyright.sh
index d48fc3cc979d626898c09591f8a5df2944dba3cd..d67cab7c1e15222477fa11955fbe8951e7efbf78 100755
--- a/.maintain/update-copyright.sh
+++ b/.maintain/update-copyright.sh
@@ -1,15 +1,14 @@
#!/usr/bin/env bash
-SINGLE_DATES=$(grep -lr "// Copyright [0-9]* Parity Technologies (UK) Ltd.")
-RANGE_DATES=$(grep -lr "// Copyright [0-9]*-[0-9]* Parity Technologies (UK) Ltd.")
+SINGLE_DATES=$(grep -lr "// Copyright (C) [0-9]* Parity Technologies (UK) Ltd.")
YEAR=$(date +%Y)
for file in $SINGLE_DATES; do
- FILE_YEAR=$(cat $file | sed -n "s|// Copyright \([[:digit:]][[:digit:]][[:digit:]][[:digit:]]\) Parity Technologies (UK) Ltd.|\1|p")
+ FILE_YEAR=$(cat $file | sed -n "s|// Copyright (C) \([[:digit:]][[:digit:]][[:digit:]][[:digit:]]\) Parity Technologies (UK) Ltd.|\1|p")
if [ $YEAR -ne $FILE_YEAR ]; then
- sed -i -e "s|// Copyright \([[:digit:]][[:digit:]][[:digit:]][[:digit:]]\) Parity Technologies (UK) Ltd.|// Copyright \1-$YEAR Parity Technologies (UK) Ltd.|g" $file
+ sed -i -e "s|// Copyright (C) \([[:digit:]][[:digit:]][[:digit:]][[:digit:]]\) Parity Technologies (UK) Ltd.|// Copyright (C) \1-$YEAR Parity Technologies (UK) Ltd.|g" $file
fi
done
-grep -lr "// Copyright [0-9]*-[0-9]* Parity Technologies (UK) Ltd." |
- xargs sed -i -e "s|// Copyright \([[:digit:]][[:digit:]][[:digit:]][[:digit:]]\)-[[:digit:]][[:digit:]][[:digit:]][[:digit:]] Parity Technologies (UK) Ltd.|// Copyright \1-$YEAR Parity Technologies (UK) Ltd.|g"
+grep -lr "// Copyright (C) [0-9]*-[0-9]* Parity Technologies (UK) Ltd." |
+ xargs sed -i -e "s|// Copyright (C) \([[:digit:]][[:digit:]][[:digit:]][[:digit:]]\)-[[:digit:]][[:digit:]][[:digit:]][[:digit:]] Parity Technologies (UK) Ltd.|// Copyright (C) \1-$YEAR Parity Technologies (UK) Ltd.|g"
diff --git a/Cargo.lock b/Cargo.lock
index af25650433676ceae97481e0ecb1137619ad6123..23060f8342db82826b16335ae9f9785abef4ba50 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -79,12 +79,6 @@ dependencies = [
"opaque-debug 0.3.0",
]
-[[package]]
-name = "ahash"
-version = "0.3.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217"
-
[[package]]
name = "ahash"
version = "0.4.6"
@@ -716,6 +710,15 @@ dependencies = [
"winapi 0.3.9",
]
+[[package]]
+name = "cipher"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801"
+dependencies = [
+ "generic-array 0.14.4",
+]
+
[[package]]
name = "ckb-merkle-mountain-range"
version = "0.3.1"
@@ -1494,12 +1497,12 @@ dependencies = [
[[package]]
name = "fixed-hash"
-version = "0.6.1"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c"
+checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c"
dependencies = [
"byteorder",
- "rand 0.7.3",
+ "rand 0.8.1",
"rustc-hex",
"static_assertions",
]
@@ -1624,7 +1627,7 @@ dependencies = [
"frame-metadata",
"frame-support-procedural",
"frame-system",
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"log",
"once_cell",
"parity-scale-codec",
@@ -1649,6 +1652,7 @@ dependencies = [
name = "frame-support-procedural"
version = "2.0.0"
dependencies = [
+ "Inflector",
"frame-support-procedural-tools",
"proc-macro2",
"quote",
@@ -1701,7 +1705,7 @@ version = "2.0.0"
dependencies = [
"criterion",
"frame-support",
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"parity-scale-codec",
"serde",
"sp-core",
@@ -2007,6 +2011,19 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "getrandom"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6"
+dependencies = [
+ "cfg-if 1.0.0",
+ "js-sys",
+ "libc",
+ "wasi 0.10.0+wasi-snapshot-preview1",
+ "wasm-bindgen",
+]
+
[[package]]
name = "ghash"
version = "0.3.0"
@@ -2138,23 +2155,13 @@ dependencies = [
"crunchy",
]
-[[package]]
-name = "hashbrown"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25"
-dependencies = [
- "ahash 0.3.8",
- "autocfg 1.0.1",
-]
-
[[package]]
name = "hashbrown"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
dependencies = [
- "ahash 0.4.6",
+ "ahash",
]
[[package]]
@@ -2460,6 +2467,17 @@ dependencies = [
"syn",
]
+[[package]]
+name = "impl-trait-for-tuples"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f65a8ecf74feeacdab8d38cb129e550ca871cccaa7d1921d8636ecd75534903"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "indexmap"
version = "1.6.0"
@@ -2467,7 +2485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
dependencies = [
"autocfg 1.0.1",
- "hashbrown 0.9.1",
+ "hashbrown",
"serde",
]
@@ -2478,6 +2496,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613"
dependencies = [
"cfg-if 1.0.0",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
]
[[package]]
@@ -2555,9 +2576,9 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.45"
+version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8"
+checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175"
dependencies = [
"wasm-bindgen",
]
@@ -2723,9 +2744,9 @@ dependencies = [
[[package]]
name = "kvdb"
-version = "0.7.0"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0315ef2f688e33844400b31f11c263f2b3dc21d8b9355c6891c5f185fae43f9a"
+checksum = "92312348daade49976a6dc59263ad39ed54f840aacb5664874f7c9aa16e5f848"
dependencies = [
"parity-util-mem",
"smallvec 1.5.0",
@@ -2733,20 +2754,20 @@ dependencies = [
[[package]]
name = "kvdb-memorydb"
-version = "0.7.0"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73de822b260a3bdfb889dbbb65bb2d473eee2253973d6fa4a5d149a2a4a7c66e"
+checksum = "986052a8d16c692eaebe775391f9a3ac26714f3907132658500b601dec94c8c2"
dependencies = [
"kvdb",
"parity-util-mem",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
]
[[package]]
name = "kvdb-rocksdb"
-version = "0.9.1"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44947dd392f09475af614d740fe0320b66d01cb5b977f664bbbb5e45a70ea4c1"
+checksum = "8d92c36be64baba5ea549116ff0d7ffd445456a7be8aaee21ec05882b980cd11"
dependencies = [
"fs-swap",
"kvdb",
@@ -2754,7 +2775,7 @@ dependencies = [
"num_cpus",
"owning_ref",
"parity-util-mem",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"regex",
"rocksdb",
"smallvec 1.5.0",
@@ -2762,9 +2783,9 @@ dependencies = [
[[package]]
name = "kvdb-web"
-version = "0.7.0"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2701a1369d6ea4f1b9f606db46e5e2a4a8e47f22530a07823d653f85ab1f6c34"
+checksum = "f7bfe11b3202691673766b1224c432996f6b8047db17ceb743675bef3404e714"
dependencies = [
"futures 0.3.8",
"js-sys",
@@ -2772,7 +2793,8 @@ dependencies = [
"kvdb-memorydb",
"log",
"parity-util-mem",
- "send_wrapper 0.3.0",
+ "parking_lot 0.11.1",
+ "send_wrapper 0.5.0",
"wasm-bindgen",
"web-sys",
]
@@ -2819,9 +2841,9 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]]
name = "libp2p"
-version = "0.32.2"
+version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "022cdac4ab124be12de581e591796d4dfb7d1f1eef94669d2c1eaa0e98dd2f0e"
+checksum = "2e17c636b5fe5ff900ccc2840b643074bfac321551d821243a781d0d46f06588"
dependencies = [
"atomic",
"bytes 0.5.6",
@@ -2857,13 +2879,12 @@ dependencies = [
[[package]]
name = "libp2p-core"
-version = "0.25.2"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc9c96d3a606a696a3a6c0ad3c3352c57bda2082ec9090930f1bd9daf787039f"
+checksum = "e1cb706da14c064dce54d8864ade6836b3486b51689300da74eeb7053aa4551e"
dependencies = [
"asn1_der",
"bs58",
- "bytes 0.5.6",
"ed25519-dalek",
"either",
"fnv",
@@ -2902,9 +2923,9 @@ dependencies = [
[[package]]
name = "libp2p-deflate"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a579d7dd506d0620ba88ccc1754436b7de35ed6c884234f9a226bbfce382640"
+checksum = "e3257a41f376aa23f237231971fee7e350e4d8353cfcf233aef34d6d6b638f0c"
dependencies = [
"flate2",
"futures 0.3.8",
@@ -2913,9 +2934,9 @@ dependencies = [
[[package]]
name = "libp2p-dns"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15dea5933f570844d7b5222b12b58f7bd52e9ca38cd65a1bd4f35341f053f012"
+checksum = "2e09bab25af01326b4ed9486d31325911437448edda30bc57681502542d49f20"
dependencies = [
"futures 0.3.8",
"libp2p-core",
@@ -2924,9 +2945,9 @@ dependencies = [
[[package]]
name = "libp2p-floodsub"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23070a0838bd9a8adb27e6eba477eeb650c498f9d139383dd0135d20a8170253"
+checksum = "6fd8cdd5ef1dd0b7346975477216d752de976b92e43051bc8bd808c372ea6cec"
dependencies = [
"cuckoofilter",
"fnv",
@@ -2942,9 +2963,9 @@ dependencies = [
[[package]]
name = "libp2p-gossipsub"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65e8f3aa0906fbad435dac23c177eef3cdfaaf62609791bd7f54f8553edcfdf9"
+checksum = "d489531aa9d4ba8726a08b3b74e21c2e10a518ad266ebca98d79040123ab0036"
dependencies = [
"base64 0.13.0",
"byteorder",
@@ -2968,9 +2989,9 @@ dependencies = [
[[package]]
name = "libp2p-identify"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "802fb973a7e0dde3fb9a2113a62bad90338ebe01983b706e1d576d0c2af93cda"
+checksum = "c43bc51a9bc3780288c526615ba0f5f8216820ea6dcc02b89e8daee526c5fccb"
dependencies = [
"futures 0.3.8",
"libp2p-core",
@@ -2984,9 +3005,9 @@ dependencies = [
[[package]]
name = "libp2p-kad"
-version = "0.26.0"
+version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6506b7b7982f7626fc96a91bc61be4b1fe7ae9ac23824f0ecefcce21cb39238c"
+checksum = "a226956b49438a10f3206480b8faf5e61fc445c349ea9d9cc37766a83745fa9a"
dependencies = [
"arrayvec 0.5.2",
"bytes 0.5.6",
@@ -3002,7 +3023,7 @@ dependencies = [
"rand 0.7.3",
"sha2 0.9.2",
"smallvec 1.5.0",
- "uint",
+ "uint 0.8.5",
"unsigned-varint",
"void",
"wasm-timer",
@@ -3010,9 +3031,9 @@ dependencies = [
[[package]]
name = "libp2p-mdns"
-version = "0.26.0"
+version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b934ee03a361f317df7d75defa4177b285534c58f49d5e6e240278e13ef3f65"
+checksum = "8a9e12688e8f14008c950c1efde587cb44dbf316fa805f419cd4e524991236f5"
dependencies = [
"async-io",
"data-encoding",
@@ -3031,9 +3052,9 @@ dependencies = [
[[package]]
name = "libp2p-mplex"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae2132b14045009b0f8e577a06e1459592ef0a89dedc58f3d4baf4eac956837b"
+checksum = "ce3200fbe6608e623bd9efa459cc8bafa0e4efbb0a2dfcdd0e1387ff4181264b"
dependencies = [
"bytes 0.5.6",
"futures 0.3.8",
@@ -3049,9 +3070,9 @@ dependencies = [
[[package]]
name = "libp2p-noise"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9610a524bef4db383cd96b4ec3ec4722eafa72c7242fa89990b74166760583d"
+checksum = "0580e0d18019d254c9c349c03ff7b22e564b6f2ada70c045fc39738e144f2139"
dependencies = [
"bytes 0.5.6",
"curve25519-dalek 3.0.0",
@@ -3071,9 +3092,9 @@ dependencies = [
[[package]]
name = "libp2p-ping"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "659adf89356e04f65398bb74ee791b269e63da9e41b37f8dc19eaacd12487bfe"
+checksum = "50b2ec86a18cbf09d7df440e7786a2409640c774e476e9a3b4d031382c3d7588"
dependencies = [
"futures 0.3.8",
"libp2p-core",
@@ -3086,9 +3107,9 @@ dependencies = [
[[package]]
name = "libp2p-plaintext"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96dfe26270c91d4ff095030d1fcadd602f3fd84968ebd592829916d0715798a6"
+checksum = "6a7b1bdcbe46a3a2159c231601ed29645282653c0a96ce3a2ad8352c9fbe6800"
dependencies = [
"bytes 0.5.6",
"futures 0.3.8",
@@ -3103,13 +3124,13 @@ dependencies = [
[[package]]
name = "libp2p-pnet"
-version = "0.19.2"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96b3c2d5d26a9500e959a0e19743897239a6c4be78dadf99b70414301a70c006"
+checksum = "6ce3374f3b28162db9d3442c9347c4f14cb01e8290052615c7d341d40eae0599"
dependencies = [
"futures 0.3.8",
"log",
- "pin-project 0.4.27",
+ "pin-project 1.0.2",
"rand 0.7.3",
"salsa20",
"sha3",
@@ -3117,9 +3138,9 @@ dependencies = [
[[package]]
name = "libp2p-request-response"
-version = "0.7.0"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd96c3580fe59a9379ac7906c2f61c7f5ad3b7515362af0e72153a7cc9a45550"
+checksum = "620e2950decbf77554b5aed3824f7d0e2c04923f28c70f9bff1a402c47ef6b1e"
dependencies = [
"async-trait",
"bytes 0.5.6",
@@ -3137,9 +3158,9 @@ dependencies = [
[[package]]
name = "libp2p-swarm"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de333c483f27d02ecf7b6cef814a36f5e1876f15139eefb00225c405350e1c22"
+checksum = "fdf5894ee1ee63a38aa58d58a16e3dcf7ede6b59ea7b22302c00c1a41d7aec41"
dependencies = [
"either",
"futures 0.3.8",
@@ -3153,9 +3174,9 @@ dependencies = [
[[package]]
name = "libp2p-tcp"
-version = "0.25.1"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc28c9ad6dc43f4c3950411cf808639d90307a076330e7996e5e94e70279bde0"
+checksum = "1d2113a7dab2b502c55fe290910cd7399a2aa04fe70a2f5a415a87a1db600c0e"
dependencies = [
"async-std",
"futures 0.3.8",
@@ -3169,9 +3190,9 @@ dependencies = [
[[package]]
name = "libp2p-uds"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d821208d4b9af4b293a56dde470edd9f9fac8bb94a51f4f5327cc29a471b3f3"
+checksum = "af05fe92c2a3aa320bc82a308ddb7b33bef3b060154c5a4b9fb0b01f15385fc0"
dependencies = [
"async-std",
"futures 0.3.8",
@@ -3181,9 +3202,9 @@ dependencies = [
[[package]]
name = "libp2p-wasm-ext"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e6ef400b231ba78e866b860445480ca21ee447e03034138c6d57cf2969d6bf4"
+checksum = "37cd44ea05a4523f40183f60ab6e6a80e400a5ddfc98b0df1c55edeb85576cd9"
dependencies = [
"futures 0.3.8",
"js-sys",
@@ -3195,9 +3216,9 @@ dependencies = [
[[package]]
name = "libp2p-websocket"
-version = "0.26.3"
+version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "522a877ce42ededf1f5dd011dbc40ea116f1776818f09dacb3d7a206f3ad6305"
+checksum = "270c80528e21089ea25b41dd1ab8fd834bdf093ebee422fed3b68699a857a083"
dependencies = [
"async-tls",
"either",
@@ -3215,9 +3236,9 @@ dependencies = [
[[package]]
name = "libp2p-yamux"
-version = "0.28.0"
+version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3be7ac000fa3e42ac09a6e658e48de34ac8ef9fff64a4e6e6b08dcc8f4b0e5f6"
+checksum = "36799de9092c35782f080032eddbc8de870f94a0def87cf9f8883efccd5cacf0"
dependencies = [
"futures 0.3.8",
"libp2p-core",
@@ -3354,7 +3375,7 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be716eb6878ca2263eb5d00a781aa13264a794f519fe6af4fbb2668b2d5441c0"
dependencies = [
- "hashbrown 0.9.1",
+ "hashbrown",
]
[[package]]
@@ -3435,12 +3456,12 @@ dependencies = [
[[package]]
name = "memory-db"
-version = "0.24.1"
+version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a"
+checksum = "6cbd2a22f201c03cc1706a727842490abfea17b7b53260358239828208daba3c"
dependencies = [
"hash-db",
- "hashbrown 0.8.2",
+ "hashbrown",
"parity-util-mem",
]
@@ -3764,7 +3785,7 @@ dependencies = [
"pallet-timestamp",
"pallet-transaction-payment",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"platforms",
"rand 0.7.3",
"regex",
@@ -3938,6 +3959,7 @@ dependencies = [
"pallet-authorship",
"pallet-babe",
"pallet-balances",
+ "pallet-bounties",
"pallet-collective",
"pallet-contracts",
"pallet-contracts-primitives",
@@ -3948,6 +3970,7 @@ dependencies = [
"pallet-identity",
"pallet-im-online",
"pallet-indices",
+ "pallet-lottery",
"pallet-membership",
"pallet-mmr",
"pallet-multisig",
@@ -3964,6 +3987,7 @@ dependencies = [
"pallet-staking-reward-curve",
"pallet-sudo",
"pallet-timestamp",
+ "pallet-tips",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
"pallet-treasury",
@@ -4306,7 +4330,7 @@ dependencies = [
"pallet-session",
"pallet-timestamp",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"serde",
"sp-application-crypto",
"sp-consensus-aura",
@@ -4342,7 +4366,7 @@ version = "2.0.0"
dependencies = [
"frame-support",
"frame-system",
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"parity-scale-codec",
"sp-authorship",
"sp-core",
@@ -4397,6 +4421,24 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-bounties"
+version = "2.0.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "pallet-balances",
+ "pallet-treasury",
+ "parity-scale-codec",
+ "serde",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "sp-storage",
+]
+
[[package]]
name = "pallet-collective"
version = "2.0.0"
@@ -4676,6 +4718,21 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-lottery"
+version = "2.0.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "pallet-balances",
+ "parity-scale-codec",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-membership"
version = "2.0.0"
@@ -4878,7 +4935,7 @@ version = "2.0.0"
dependencies = [
"frame-support",
"frame-system",
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.1.3",
"lazy_static",
"pallet-timestamp",
"parity-scale-codec",
@@ -4945,7 +5002,7 @@ dependencies = [
"pallet-staking-reward-curve",
"pallet-timestamp",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"rand_chacha 0.2.2",
"serde",
"sp-application-crypto",
@@ -5026,7 +5083,7 @@ dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"parity-scale-codec",
"serde",
"sp-core",
@@ -5037,6 +5094,24 @@ dependencies = [
"sp-timestamp",
]
+[[package]]
+name = "pallet-tips"
+version = "2.0.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "pallet-balances",
+ "pallet-treasury",
+ "parity-scale-codec",
+ "serde",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "sp-storage",
+]
+
[[package]]
name = "pallet-transaction-payment"
version = "2.0.0"
@@ -5092,6 +5167,7 @@ dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
+ "impl-trait-for-tuples 0.2.0",
"pallet-balances",
"parity-scale-codec",
"serde",
@@ -5221,15 +5297,15 @@ dependencies = [
[[package]]
name = "parity-util-mem"
-version = "0.7.0"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "297ff91fa36aec49ce183484b102f6b75b46776822bd81525bfc4cc9b0dd0f5c"
+checksum = "8f17f15cb05897127bf36a240085a1f0bbef7bce3024849eccf7f93f6171bc27"
dependencies = [
- "cfg-if 0.1.10",
- "hashbrown 0.8.2",
- "impl-trait-for-tuples",
+ "cfg-if 1.0.0",
+ "hashbrown",
+ "impl-trait-for-tuples 0.2.0",
"parity-util-mem-derive",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"primitive-types",
"smallvec 1.5.0",
"winapi 0.3.9",
@@ -5642,14 +5718,14 @@ dependencies = [
[[package]]
name = "primitive-types"
-version = "0.7.3"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7dd39dcacf71411ba488570da7bbc89b717225e46478b30ba99b92db6b149809"
+checksum = "b3824ae2c5e27160113b9e029a10ec9e3f0237bad8029f69c7724393c9fdefd8"
dependencies = [
"fixed-hash",
"impl-codec",
"impl-serde",
- "uint",
+ "uint 0.9.0",
]
[[package]]
@@ -5891,7 +5967,7 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
- "getrandom",
+ "getrandom 0.1.15",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
@@ -5899,6 +5975,17 @@ dependencies = [
"rand_pcg 0.2.1",
]
+[[package]]
+name = "rand"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c24fcd450d3fa2b592732565aa4f17a27a61c65ece4726353e000939b0edee34"
+dependencies = [
+ "libc",
+ "rand_chacha 0.3.0",
+ "rand_core 0.6.1",
+]
+
[[package]]
name = "rand_chacha"
version = "0.1.1"
@@ -5919,6 +6006,16 @@ dependencies = [
"rand_core 0.5.1",
]
+[[package]]
+name = "rand_chacha"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.6.1",
+]
+
[[package]]
name = "rand_core"
version = "0.3.1"
@@ -5940,7 +6037,16 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
- "getrandom",
+ "getrandom 0.1.15",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5"
+dependencies = [
+ "getrandom 0.2.1",
]
[[package]]
@@ -6001,7 +6107,6 @@ dependencies = [
"libc",
"rand_core 0.4.2",
"rdrand",
- "wasm-bindgen",
"winapi 0.3.9",
]
@@ -6096,7 +6201,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
dependencies = [
- "getrandom",
+ "getrandom 0.1.15",
"redox_syscall",
"rust-argon2",
]
@@ -6333,11 +6438,11 @@ dependencies = [
[[package]]
name = "salsa20"
-version = "0.6.0"
+version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7f47b10fa80f6969bbbd9c8e7cc998f082979d402a9e10579e2303a87955395"
+checksum = "399f290ffc409596022fce5ea5d4138184be4784f2b28c62c59f0d8389059a15"
dependencies = [
- "stream-cipher",
+ "cipher",
]
[[package]]
@@ -6388,7 +6493,7 @@ dependencies = [
"futures-timer 3.0.2",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-block-builder",
"sc-client-api",
"sc-proposer-metrics",
@@ -6427,7 +6532,7 @@ dependencies = [
name = "sc-chain-spec"
version = "2.0.0"
dependencies = [
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"parity-scale-codec",
"sc-chain-spec-derive",
"sc-consensus-babe",
@@ -6520,7 +6625,7 @@ dependencies = [
"lazy_static",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-executor",
"sp-api",
"sp-blockchain",
@@ -6558,7 +6663,7 @@ dependencies = [
"parity-db",
"parity-scale-codec",
"parity-util-mem",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"quickcheck",
"sc-client-api",
"sc-executor",
@@ -6595,9 +6700,10 @@ dependencies = [
"derive_more",
"futures 0.3.8",
"futures-timer 3.0.2",
+ "getrandom 0.2.1",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-block-builder",
"sc-client-api",
"sc-consensus-slots",
@@ -6641,7 +6747,7 @@ dependencies = [
"num-rational",
"num-traits",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"pdqselect",
"rand 0.7.3",
"rand_chacha 0.2.2",
@@ -6716,7 +6822,7 @@ version = "0.8.0"
dependencies = [
"fork-tree",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-client-api",
"sp-blockchain",
"sp-runtime",
@@ -6734,7 +6840,7 @@ dependencies = [
"jsonrpc-derive",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-basic-authorship",
"sc-client-api",
"sc-consensus-babe",
@@ -6768,7 +6874,7 @@ dependencies = [
"futures-timer 3.0.2",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-client-api",
"sp-api",
"sp-block-builder",
@@ -6790,7 +6896,7 @@ dependencies = [
"futures-timer 3.0.2",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-client-api",
"sc-telemetry",
"sp-api",
@@ -6833,7 +6939,8 @@ dependencies = [
"log",
"parity-scale-codec",
"parity-wasm 0.41.0",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
+ "paste 0.1.18",
"sc-executor-common",
"sc-executor-wasmi",
"sc-executor-wasmtime",
@@ -6854,7 +6961,6 @@ dependencies = [
"sp-version",
"sp-wasm-interface",
"substrate-test-runtime",
- "test-case",
"tracing",
"tracing-subscriber",
"wasmi",
@@ -6920,7 +7026,7 @@ dependencies = [
"futures-timer 3.0.2",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"pin-project 0.4.27",
"rand 0.7.3",
"sc-block-builder",
@@ -7010,7 +7116,7 @@ dependencies = [
"futures-util",
"hex",
"merlin",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"rand 0.7.3",
"serde_json",
"sp-application-crypto",
@@ -7027,7 +7133,7 @@ dependencies = [
"hash-db",
"lazy_static",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-client-api",
"sc-executor",
"sp-api",
@@ -7062,7 +7168,6 @@ dependencies = [
"linked-hash-map",
"linked_hash_set",
"log",
- "lru",
"nohash-hasher",
"parity-scale-codec",
"parking_lot 0.11.1",
@@ -7121,11 +7226,12 @@ dependencies = [
name = "sc-network-test"
version = "0.8.0"
dependencies = [
+ "async-std",
"futures 0.3.8",
"futures-timer 3.0.2",
"libp2p",
"log",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"rand 0.7.3",
"sc-block-builder",
"sc-client-api",
@@ -7157,7 +7263,7 @@ dependencies = [
"log",
"num_cpus",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"rand 0.7.3",
"sc-client-api",
"sc-client-db",
@@ -7210,7 +7316,7 @@ dependencies = [
"lazy_static",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-block-builder",
"sc-cli",
"sc-client-api",
@@ -7251,7 +7357,7 @@ dependencies = [
"jsonrpc-pubsub",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"serde",
"serde_json",
"sp-chain-spec",
@@ -7310,7 +7416,7 @@ dependencies = [
"log",
"parity-scale-codec",
"parity-util-mem",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"pin-project 0.4.27",
"rand 0.7.3",
"sc-block-builder",
@@ -7373,7 +7479,7 @@ dependencies = [
"hex-literal",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-block-builder",
"sc-client-api",
"sc-client-db",
@@ -7408,7 +7514,7 @@ dependencies = [
"parity-scale-codec",
"parity-util-mem",
"parity-util-mem-derive",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-client-api",
"sp-core",
"thiserror",
@@ -7441,7 +7547,7 @@ dependencies = [
"futures-timer 3.0.2",
"libp2p",
"log",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"pin-project 0.4.27",
"rand 0.7.3",
"serde",
@@ -7462,7 +7568,7 @@ dependencies = [
"lazy_static",
"log",
"once_cell",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"regex",
"rustc-hash",
"sc-telemetry",
@@ -7488,7 +7594,7 @@ dependencies = [
"log",
"parity-scale-codec",
"parity-util-mem",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"retain_mut",
"serde",
"sp-blockchain",
@@ -7513,7 +7619,7 @@ dependencies = [
"log",
"parity-scale-codec",
"parity-util-mem",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-block-builder",
"sc-client-api",
"sc-transaction-graph",
@@ -7552,7 +7658,7 @@ dependencies = [
"arrayref",
"arrayvec 0.5.2",
"curve25519-dalek 2.1.0",
- "getrandom",
+ "getrandom 0.1.15",
"merlin",
"rand 0.7.3",
"rand_core 0.5.1",
@@ -7681,15 +7787,15 @@ dependencies = [
[[package]]
name = "send_wrapper"
-version = "0.3.0"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "686ef91cf020ad8d4aca9a7047641fd6add626b7b89e14546c2b6a76781cf822"
+checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0"
[[package]]
name = "send_wrapper"
-version = "0.4.0"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0"
+checksum = "930c0acf610d3fdb5e2ab6213019aaa04e227ebe9547b0649ba599b16d788bd7"
[[package]]
name = "serde"
@@ -8095,7 +8201,7 @@ dependencies = [
"log",
"lru",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sp-api",
"sp-consensus",
"sp-database",
@@ -8121,7 +8227,7 @@ dependencies = [
"libp2p",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"serde",
"sp-api",
"sp-core",
@@ -8223,7 +8329,7 @@ dependencies = [
"num-traits",
"parity-scale-codec",
"parity-util-mem",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"pretty_assertions",
"primitive-types",
"rand 0.7.3",
@@ -8254,7 +8360,7 @@ name = "sp-database"
version = "2.0.0"
dependencies = [
"kvdb",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
]
[[package]]
@@ -8297,7 +8403,7 @@ name = "sp-inherents"
version = "2.0.0"
dependencies = [
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sp-core",
"sp-std",
"thiserror",
@@ -8312,7 +8418,7 @@ dependencies = [
"libsecp256k1",
"log",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sp-core",
"sp-externalities",
"sp-keystore",
@@ -8345,7 +8451,7 @@ dependencies = [
"futures 0.3.8",
"merlin",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"rand 0.7.3",
"rand_chacha 0.2.2",
"schnorrkel",
@@ -8422,7 +8528,7 @@ version = "2.0.0"
dependencies = [
"either",
"hash256-std-hasher",
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"log",
"parity-scale-codec",
"parity-util-mem",
@@ -8442,7 +8548,7 @@ dependencies = [
name = "sp-runtime-interface"
version = "2.0.0"
dependencies = [
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"parity-scale-codec",
"primitive-types",
"rustversion",
@@ -8561,7 +8667,7 @@ dependencies = [
"log",
"num-traits",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"pretty_assertions",
"rand 0.7.3",
"smallvec 1.5.0",
@@ -8621,7 +8727,7 @@ dependencies = [
name = "sp-timestamp"
version = "2.0.0"
dependencies = [
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"parity-scale-codec",
"sp-api",
"sp-inherents",
@@ -8701,7 +8807,7 @@ dependencies = [
name = "sp-wasm-interface"
version = "2.0.0"
dependencies = [
- "impl-trait-for-tuples",
+ "impl-trait-for-tuples 0.2.0",
"parity-scale-codec",
"sp-std",
"wasmi",
@@ -8808,13 +8914,8 @@ dependencies = [
name = "subkey"
version = "2.0.0"
dependencies = [
- "frame-system",
- "node-primitives",
- "node-runtime",
"sc-cli",
- "sp-core",
"structopt",
- "substrate-frame-cli",
]
[[package]]
@@ -8840,11 +8941,11 @@ dependencies = [
"futures 0.1.30",
"futures 0.3.8",
"futures-timer 3.0.2",
+ "getrandom 0.2.1",
"js-sys",
"kvdb-web",
"libp2p-wasm-ext",
"log",
- "rand 0.6.5",
"rand 0.7.3",
"sc-chain-spec",
"sc-informant",
@@ -9024,7 +9125,7 @@ dependencies = [
"derive_more",
"futures 0.3.8",
"parity-scale-codec",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.1",
"sc-transaction-graph",
"sp-blockchain",
"sp-runtime",
@@ -9089,9 +9190,9 @@ checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd"
[[package]]
name = "syn"
-version = "1.0.48"
+version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
+checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5"
dependencies = [
"proc-macro2",
"quote",
@@ -9145,19 +9246,6 @@ dependencies = [
"winapi-util",
]
-[[package]]
-name = "test-case"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a605baa797821796a751f4a959e1206079b24a4b7e1ed302b7d785d81a9276c9"
-dependencies = [
- "lazy_static",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
[[package]]
name = "textwrap"
version = "0.11.0"
@@ -9652,9 +9740,9 @@ checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
[[package]]
name = "trie-bench"
-version = "0.25.0"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af2cc37cac8cc158119982c920cbb9b8243d8540c1d13b8aca84484bfc83a426"
+checksum = "92d03b477b8837fd2e6bd17df374e5de60959c54058208de98833347c02b778c"
dependencies = [
"criterion",
"hash-db",
@@ -9668,12 +9756,12 @@ dependencies = [
[[package]]
name = "trie-db"
-version = "0.22.1"
+version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0"
+checksum = "5cc176c377eb24d652c9c69c832c832019011b6106182bf84276c66b66d5c9a6"
dependencies = [
"hash-db",
- "hashbrown 0.8.2",
+ "hashbrown",
"log",
"rustc-hex",
"smallvec 1.5.0",
@@ -9706,8 +9794,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]]
name = "trybuild"
-version = "1.0.35"
-source = "git+https://github.com/bkchr/trybuild.git?branch=bkchr-use-workspace-cargo-lock#0eaad05ba8a32a743751ff52b57a7d9f57da4869"
+version = "1.0.38"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "17b06f8610494cbeb9a7665b398306f0109ab8708296d7f24b0bcd89178bb350"
dependencies = [
"dissimilar",
"glob",
@@ -9753,6 +9842,18 @@ dependencies = [
"static_assertions",
]
+[[package]]
+name = "uint"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e"
+dependencies = [
+ "byteorder",
+ "crunchy",
+ "hex",
+ "static_assertions",
+]
+
[[package]]
name = "unicase"
version = "2.6.0"
@@ -9940,11 +10041,11 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasm-bindgen"
-version = "0.2.68"
+version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
+checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e"
dependencies = [
- "cfg-if 0.1.10",
+ "cfg-if 1.0.0",
"serde",
"serde_json",
"wasm-bindgen-macro",
@@ -9952,9 +10053,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.68"
+version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
+checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62"
dependencies = [
"bumpalo",
"lazy_static",
@@ -9979,9 +10080,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.68"
+version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
+checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -9989,9 +10090,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.68"
+version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
+checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549"
dependencies = [
"proc-macro2",
"quote",
@@ -10002,9 +10103,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.68"
+version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
+checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158"
[[package]]
name = "wasm-bindgen-test"
@@ -10267,9 +10368,9 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.44"
+version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dda38f4e5ca63eda02c059d243aa25b5f35ab98451e518c51612cd0f1bd19a47"
+checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -10392,9 +10493,9 @@ dependencies = [
[[package]]
name = "zeroize"
-version = "1.1.1"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a"
+checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36"
dependencies = [
"zeroize_derive",
]
diff --git a/Cargo.toml b/Cargo.toml
index 206673c0ef2fa841bed945703a6ff9e1ec18f4d8..12e79490ef6b0e7a296586acb59d45dd428bc6c5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -66,6 +66,7 @@ members = [
"frame/babe",
"frame/balances",
"frame/benchmarking",
+ "frame/bounties",
"frame/collective",
"frame/contracts",
"frame/contracts/rpc",
@@ -80,6 +81,7 @@ members = [
"frame/identity",
"frame/im-online",
"frame/indices",
+ "frame/lottery",
"frame/membership",
"frame/merkle-mountain-range",
"frame/metadata",
@@ -112,6 +114,7 @@ members = [
"frame/transaction-payment/rpc",
"frame/transaction-payment/rpc/runtime-api",
"frame/treasury",
+ "frame/tips",
"frame/utility",
"frame/vesting",
"primitives/allocator",
diff --git a/HEADER b/HEADER-APACHE2
similarity index 92%
rename from HEADER
rename to HEADER-APACHE2
index c9b28a07b0f22975f2eb835c4d334bd17828e6fe..f364f4bdf845a20c9c4bc5cbcc1f35ccff5c9b3d 100644
--- a/HEADER
+++ b/HEADER-APACHE2
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/docs/license_header.txt b/HEADER-GPL3
similarity index 50%
rename from docs/license_header.txt
rename to HEADER-GPL3
index f9c1daa1ad1c14affab82e390c91bd5d8445ab71..0dd7e4f76028fb89205b8fac192936cab48a0b83 100644
--- a/docs/license_header.txt
+++ b/HEADER-GPL3
@@ -1,15 +1,17 @@
-// Copyright 2017-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
diff --git a/bin/node-template/node/src/chain_spec.rs b/bin/node-template/node/src/chain_spec.rs
index 41f582fb64a46cf598c0f424b23793b95f0291db..c5451e81f20c10b064df046010f7989036002925 100644
--- a/bin/node-template/node/src/chain_spec.rs
+++ b/bin/node-template/node/src/chain_spec.rs
@@ -39,7 +39,7 @@ pub fn authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) {
}
pub fn development_config() -> Result {
- let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?;
+ let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?;
Ok(ChainSpec::from_genesis(
// Name
@@ -78,7 +78,7 @@ pub fn development_config() -> Result {
}
pub fn local_testnet_config() -> Result {
- let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?;
+ let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?;
Ok(ChainSpec::from_genesis(
// Name
diff --git a/bin/node-template/node/src/command.rs b/bin/node-template/node/src/command.rs
index 5c41643a2932f67479ec5cf0529a48248f7f5b1f..1c22b388af78ea3375de531a057560b44e847b88 100644
--- a/bin/node-template/node/src/command.rs
+++ b/bin/node-template/node/src/command.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -66,7 +66,7 @@ pub fn run() -> sc_cli::Result<()> {
let cli = Cli::from_args();
match &cli.subcommand {
- Some(Subcommand::Key(cmd)) => cmd.run(),
+ Some(Subcommand::Key(cmd)) => cmd.run(&cli),
Some(Subcommand::BuildSpec(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs
index 7e1939fb023a8082d0abb147902b27b484f1fe35..92dfc8f1887cc2fe4f4f5048daa171b30cdf0f3c 100644
--- a/bin/node-template/node/src/service.rs
+++ b/bin/node-template/node/src/service.rs
@@ -107,7 +107,8 @@ pub fn new_full(mut config: Configuration) -> Result
}
};
}
- config.network.notifications_protocols.push(sc_finality_grandpa::GRANDPA_PROTOCOL_NAME.into());
+
+ config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config());
let (network, network_status_sinks, system_rpc_tx, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
@@ -244,7 +245,7 @@ pub fn new_light(mut config: Configuration) -> Result
let (client, backend, keystore_container, mut task_manager, on_demand) =
sc_service::new_light_parts::(&config)?;
- config.network.notifications_protocols.push(sc_finality_grandpa::GRANDPA_PROTOCOL_NAME.into());
+ config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config());
let select_chain = sc_consensus::LongestChain::new(backend.clone());
diff --git a/bin/node-template/pallets/template/src/mock.rs b/bin/node-template/pallets/template/src/mock.rs
index 84af63a1c3bb8c0a5b21b33511385d0ff5f1be0a..60d22aad7bc66eb9a78b6680c6e45e0ca2944a03 100644
--- a/bin/node-template/pallets/template/src/mock.rs
+++ b/bin/node-template/pallets/template/src/mock.rs
@@ -16,6 +16,7 @@ impl_outer_origin! {
pub struct Test;
parameter_types! {
pub const BlockHashCount: u64 = 250;
+ pub const SS58Prefix: u8 = 42;
}
impl system::Config for Test {
@@ -40,6 +41,7 @@ impl system::Config for Test {
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
+ type SS58Prefix = SS58Prefix;
}
impl Config for Test {
diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs
index 51df3dd5a3e4507e2ca51435a5126d0c4941b245..0812346779646e7a2d552c6c98db35e3159b5d78 100644
--- a/bin/node-template/runtime/src/lib.rs
+++ b/bin/node-template/runtime/src/lib.rs
@@ -136,6 +136,7 @@ parameter_types! {
::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
+ pub const SS58Prefix: u8 = 42;
}
// Configure FRAME pallets to include in runtime.
@@ -185,6 +186,8 @@ impl frame_system::Config for Runtime {
type AccountData = pallet_balances::AccountData;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
+ /// This is used as an identifier of the chain. 42 is the generic substrate prefix.
+ type SS58Prefix = SS58Prefix;
}
impl pallet_aura::Config for Runtime {
diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml
index 88362f7e510224a862878cab63665e3d129d7006..06d89ff7d0d5592aefb70e6cd45db5559d38e6b5 100644
--- a/bin/node/bench/Cargo.toml
+++ b/bin/node/bench/Cargo.toml
@@ -21,8 +21,8 @@ serde = "1.0.101"
serde_json = "1.0.41"
structopt = "0.3"
derive_more = "0.99.2"
-kvdb = "0.7"
-kvdb-rocksdb = "0.9.1"
+kvdb = "0.8.0"
+kvdb-rocksdb = "0.10.0"
sp-trie = { version = "2.0.0", path = "../../../primitives/trie" }
sp-core = { version = "2.0.0", path = "../../../primitives/core" }
sp-consensus = { version = "0.8.0", path = "../../../primitives/consensus/common" }
@@ -37,7 +37,7 @@ fs_extra = "1"
hex = "0.4.0"
rand = { version = "0.7.2", features = ["small_rng"] }
lazy_static = "1.4.0"
-parity-util-mem = { version = "0.7.0", default-features = false, features = ["primitive-types"] }
+parity-util-mem = { version = "0.8.0", default-features = false, features = ["primitive-types"] }
parity-db = { version = "0.1.2" }
sc-transaction-pool = { version = "2.0.0", path = "../../../client/transaction-pool" }
futures = { version = "0.3.4", features = ["thread-pool"] }
diff --git a/bin/node/bench/src/common.rs b/bin/node/bench/src/common.rs
index 2637d6e9bd04d809af5b374790adcc6e5207993f..d04d79e9907af2b25d4300cd498a1f7962c12abe 100644
--- a/bin/node/bench/src/common.rs
+++ b/bin/node/bench/src/common.rs
@@ -1,7 +1,6 @@
-
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -45,4 +44,4 @@ impl SizeType {
SizeType::Custom(val) => Some(*val),
}
}
-}
\ No newline at end of file
+}
diff --git a/bin/node/bench/src/construct.rs b/bin/node/bench/src/construct.rs
index 5506dc426de0bc6e7f69cf9e2825f33bb99f24b1..a8a02f19c306eeee2c5d0ccab85b77bbb3fb3aa5 100644
--- a/bin/node/bench/src/construct.rs
+++ b/bin/node/bench/src/construct.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/bench/src/core.rs b/bin/node/bench/src/core.rs
index 6faa7b72721f495ac6a481f3f48dd0b86e9efd3a..26b7f92b1448376fe3d0a2c9553abd568189358f 100644
--- a/bin/node/bench/src/core.rs
+++ b/bin/node/bench/src/core.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/bench/src/generator.rs b/bin/node/bench/src/generator.rs
index 759a4299c72758f540e92349de6a25591c506d39..c540ae147c9f0f59c13787f3b9233ba4c0abc042 100644
--- a/bin/node/bench/src/generator.rs
+++ b/bin/node/bench/src/generator.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/bench/src/import.rs b/bin/node/bench/src/import.rs
index ae28a20089e103dd6c5c0c538e87be7069a8c2fe..b4fee58dac0252332b6b1d72aeb80d05695a092a 100644
--- a/bin/node/bench/src/import.rs
+++ b/bin/node/bench/src/import.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/bench/src/main.rs b/bin/node/bench/src/main.rs
index 46b659dd88387e94c2d493e3d5975df3e7c28fab..40e9e1577777e81c8cbbadfa2c0e619639022a30 100644
--- a/bin/node/bench/src/main.rs
+++ b/bin/node/bench/src/main.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/bench/src/simple_trie.rs b/bin/node/bench/src/simple_trie.rs
index 3cfd7ddb300a9101b22d55a2d460526a283fa0e2..a29b51a38af58bb80343edf72988f73a5fb64a47 100644
--- a/bin/node/bench/src/simple_trie.rs
+++ b/bin/node/bench/src/simple_trie.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/bench/src/state_sizes.rs b/bin/node/bench/src/state_sizes.rs
index d35989f61be3467960c0870fca1bd5969d571081..f9288c10548981d87f14eb8cabbd836ceb83e520 100644
--- a/bin/node/bench/src/state_sizes.rs
+++ b/bin/node/bench/src/state_sizes.rs
@@ -1,18 +1,20 @@
-// Copyright 2015-2020 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
+// This file is part of Substrate.
-// Parity is free software: you can redistribute it and/or modify
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program 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.
-// Parity is distributed in the hope that it will be useful,
+// This program 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
+// 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 Parity. If not, see .
+// along with this program. If not, see .
/// Kusama value size distribution
pub const KUSAMA_STATE_DISTRIBUTION: &'static[(u32, u32)] = &[
@@ -4753,4 +4755,4 @@ pub const KUSAMA_STATE_DISTRIBUTION: &'static[(u32, u32)] = &[
(1516670, 1),
(1605731, 1),
(1605821, 1),
-];
\ No newline at end of file
+];
diff --git a/bin/node/bench/src/tempdb.rs b/bin/node/bench/src/tempdb.rs
index abce7daa518bfa75361b84fb69229f3d780752dc..31ef71fba7b5e34215210b72a80458555a516bd0 100644
--- a/bin/node/bench/src/tempdb.rs
+++ b/bin/node/bench/src/tempdb.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/bench/src/trie.rs b/bin/node/bench/src/trie.rs
index eb6c574e27170b8ce8a38c575db55468bcafb5d3..a3e7620473d98ba46646c8e8bc1ac1333c0535b5 100644
--- a/bin/node/bench/src/trie.rs
+++ b/bin/node/bench/src/trie.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/bench/src/txpool.rs b/bin/node/bench/src/txpool.rs
index 7ea13fc15ec68fb3a02ea7889282d281409bd67e..ecac3827adf684dd80bd865e2fb1eef84a306321 100644
--- a/bin/node/bench/src/txpool.rs
+++ b/bin/node/bench/src/txpool.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/browser-testing/Cargo.toml b/bin/node/browser-testing/Cargo.toml
index f60dc55b6f7e6c9643097a923b870e1961abc447..e29f104f87e470e20078e57ae987e318d737d070 100644
--- a/bin/node/browser-testing/Cargo.toml
+++ b/bin/node/browser-testing/Cargo.toml
@@ -8,11 +8,11 @@ license = "Apache-2.0"
[dependencies]
futures-timer = "3.0.2"
-libp2p = { version = "0.32.2", default-features = false }
+libp2p = { version = "0.33.0", default-features = false }
jsonrpc-core = "15.0.0"
serde = "1.0.106"
serde_json = "1.0.48"
-wasm-bindgen = { version = "=0.2.68", features = ["serde-serialize"] }
+wasm-bindgen = { version = "=0.2.69", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4.18"
wasm-bindgen-test = "0.3.18"
futures = "0.3.4"
diff --git a/bin/node/browser-testing/src/lib.rs b/bin/node/browser-testing/src/lib.rs
index f4dc0908567828eb7cd658b76cb27d8575274ad5..ad18de87b3d3eb7f112fd026dfd2dec9656cc682 100644
--- a/bin/node/browser-testing/src/lib.rs
+++ b/bin/node/browser-testing/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml
index 6574ccb733b52a3d48a77e38be10e5b358bb328e..773934e95fa3346da2d3d4c05da436a423cfbd57 100644
--- a/bin/node/cli/Cargo.toml
+++ b/bin/node/cli/Cargo.toml
@@ -42,7 +42,7 @@ log = "0.4.8"
rand = "0.7.2"
structopt = { version = "0.3.8", optional = true }
tracing = "0.1.22"
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
# primitives
sp-authority-discovery = { version = "2.0.0", path = "../../../primitives/authority-discovery" }
diff --git a/bin/node/cli/bin/main.rs b/bin/node/cli/bin/main.rs
index 299b760c82e36b2b6540f6ae4efd8111cf430640..cf32a7cf2886092d1f14d388a01c23257e6498a7 100644
--- a/bin/node/cli/bin/main.rs
+++ b/bin/node/cli/bin/main.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/build.rs b/bin/node/cli/build.rs
index a36f0d01a0a034a10686d3565e6abf538e6a5886..befcdaea6d9cff98ce2df3ad334d1430efe718e8 100644
--- a/bin/node/cli/build.rs
+++ b/bin/node/cli/build.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/src/browser.rs b/bin/node/cli/src/browser.rs
index 41770f5fcde6dc68c98e2f2feef0358461d953c8..42886a668d3480af97bfb4a7640e0c21ccc41f15 100644
--- a/bin/node/cli/src/browser.rs
+++ b/bin/node/cli/src/browser.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/src/chain_spec.rs b/bin/node/cli/src/chain_spec.rs
index 83dc95e3b64dffec313816a1d251935777538f5d..7bee74d6c677ebca220e740a1dac4f463e244a12 100644
--- a/bin/node/cli/src/chain_spec.rs
+++ b/bin/node/cli/src/chain_spec.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/src/cli.rs b/bin/node/cli/src/cli.rs
index 2130ff1e4b106b0ad294b84b4ec443d1d4806264..63a07e00e2197c65807f931583d697ab00208a14 100644
--- a/bin/node/cli/src/cli.rs
+++ b/bin/node/cli/src/cli.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/src/command.rs b/bin/node/cli/src/command.rs
index f8a0f3f9b3a3485f9af99d5c43dd6bd93f67cdd2..ed3aff88c75de629209a4f54511de12df8e4ca9c 100644
--- a/bin/node/cli/src/command.rs
+++ b/bin/node/cli/src/command.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -94,7 +94,7 @@ pub fn run() -> Result<()> {
You can enable it with `--features runtime-benchmarks`.".into())
}
}
- Some(Subcommand::Key(cmd)) => cmd.run(),
+ Some(Subcommand::Key(cmd)) => cmd.run(&cli),
Some(Subcommand::Sign(cmd)) => cmd.run(),
Some(Subcommand::Verify(cmd)) => cmd.run(),
Some(Subcommand::Vanity(cmd)) => cmd.run(),
diff --git a/bin/node/cli/src/lib.rs b/bin/node/cli/src/lib.rs
index bd2298514a7a2f1ed57fa008615b11ac0947d20b..d29836c7499f3cfedbe153de75aa228e797bdebd 100644
--- a/bin/node/cli/src/lib.rs
+++ b/bin/node/cli/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs
index 5eb8e35e69ec5e36c6f282919905d855accdad24..84d931b2a1e2e46ea1f12e9471b8c83561d4113d 100644
--- a/bin/node/cli/src/service.rs
+++ b/bin/node/cli/src/service.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -178,7 +178,7 @@ pub fn new_full_base(
let shared_voter_state = rpc_setup;
- config.network.notifications_protocols.push(grandpa::GRANDPA_PROTOCOL_NAME.into());
+ config.network.extra_sets.push(grandpa::grandpa_peers_set_config());
let (network, network_status_sinks, system_rpc_tx, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
@@ -346,7 +346,7 @@ pub fn new_light_base(mut config: Configuration) -> Result<(
let (client, backend, keystore_container, mut task_manager, on_demand) =
sc_service::new_light_parts::(&config)?;
- config.network.notifications_protocols.push(grandpa::GRANDPA_PROTOCOL_NAME.into());
+ config.network.extra_sets.push(grandpa::grandpa_peers_set_config());
let select_chain = sc_consensus::LongestChain::new(backend.clone());
diff --git a/bin/node/cli/tests/build_spec_works.rs b/bin/node/cli/tests/build_spec_works.rs
index 800a4a8c51e6175e2eb8fbfb1e5ddf375d30c264..6d863ea7f949d10a5ab4800f0733764331943912 100644
--- a/bin/node/cli/tests/build_spec_works.rs
+++ b/bin/node/cli/tests/build_spec_works.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/tests/check_block_works.rs b/bin/node/cli/tests/check_block_works.rs
index 34078b08cf074f218865df548ee20b3b94f19d74..39963fb002876bb4f098ad1bdc9a18c1e354547f 100644
--- a/bin/node/cli/tests/check_block_works.rs
+++ b/bin/node/cli/tests/check_block_works.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs
index 61a07dd1ca877c8814169f2babdfccd3a506ec76..c3bb96555da56a64f3c16c988ff3a3b1b1dadea0 100644
--- a/bin/node/cli/tests/common.rs
+++ b/bin/node/cli/tests/common.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/tests/export_import_flow.rs b/bin/node/cli/tests/export_import_flow.rs
index 557e722ddb7b505a13fa8daa8361838dcfd93c45..02fba49e834efc4ac61f802d9223c190134cac99 100644
--- a/bin/node/cli/tests/export_import_flow.rs
+++ b/bin/node/cli/tests/export_import_flow.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/tests/inspect_works.rs b/bin/node/cli/tests/inspect_works.rs
index aa9653acadba5a1db8ccd295da9d802967604a77..67dbc97056cf6789ef78ecd052c4de5e4e7e26a8 100644
--- a/bin/node/cli/tests/inspect_works.rs
+++ b/bin/node/cli/tests/inspect_works.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/tests/purge_chain_works.rs b/bin/node/cli/tests/purge_chain_works.rs
index 001bed8b136f5d2349f83fe86c557466f0b7a7ca..4c0727d26cb1776622a19c8c424ce90882735dc4 100644
--- a/bin/node/cli/tests/purge_chain_works.rs
+++ b/bin/node/cli/tests/purge_chain_works.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs
index bd79dcd77a49a9e6a81b28ae360ef90b3174b565..05eb9a7027b714667d66d8704f4b6d18a205e835 100644
--- a/bin/node/cli/tests/running_the_node_and_interrupt.rs
+++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/tests/temp_base_path_works.rs b/bin/node/cli/tests/temp_base_path_works.rs
index 9351568d87955b130bdde3d9f82f5ce977bc2b20..0152ddb464dc7bd3cf8d4575af6d86f650e6bf7a 100644
--- a/bin/node/cli/tests/temp_base_path_works.rs
+++ b/bin/node/cli/tests/temp_base_path_works.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/cli/tests/version.rs b/bin/node/cli/tests/version.rs
index bbc9139d4f0f8de78dfc5affd3557eb6f6b16a17..38e4b1fbda72eae4d5dc483c0da8b8cb39f21b41 100644
--- a/bin/node/cli/tests/version.rs
+++ b/bin/node/cli/tests/version.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/executor/benches/bench.rs b/bin/node/executor/benches/bench.rs
index 168cff0ff456887246ef679d54b11ac15efabb83..554e6c4af428df7162306eb31c13423cf859b9ef 100644
--- a/bin/node/executor/benches/bench.rs
+++ b/bin/node/executor/benches/bench.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/executor/src/lib.rs b/bin/node/executor/src/lib.rs
index 4c3b82bc7d3b538234d470a5560ca61db28976b7..e7fb09a19c514f6d9773c71137da8d3aec16886b 100644
--- a/bin/node/executor/src/lib.rs
+++ b/bin/node/executor/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs
index 09438bfacd455ca73e8718d9785c1bef6329e208..2b644fad2915b21639e69d513f0b57cbcb89008a 100644
--- a/bin/node/executor/tests/basic.rs
+++ b/bin/node/executor/tests/basic.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/executor/tests/common.rs b/bin/node/executor/tests/common.rs
index efc54ebebf1990188862460b26d5d314080e2a83..b376ebc35bae88bcb63fe38ec4d76c949bbe9f35 100644
--- a/bin/node/executor/tests/common.rs
+++ b/bin/node/executor/tests/common.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/executor/tests/fees.rs b/bin/node/executor/tests/fees.rs
index d04af1d827009f51340daeacc9e055ab6ec5e00e..07460e54680d973f50a8ae3638d52f708bfc3799 100644
--- a/bin/node/executor/tests/fees.rs
+++ b/bin/node/executor/tests/fees.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/executor/tests/submit_transaction.rs b/bin/node/executor/tests/submit_transaction.rs
index 5bac6b5e374c73a55d8fe721db52bb05f4e0e9ea..f3cb90cbecdd285fdd44bc642b62ee49a55dc1dd 100644
--- a/bin/node/executor/tests/submit_transaction.rs
+++ b/bin/node/executor/tests/submit_transaction.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/inspect/src/cli.rs b/bin/node/inspect/src/cli.rs
index d66644bab52fa78788098e3713ceae1576f25b6c..abdbedc296d022ab65c3bff12955abd6710a423e 100644
--- a/bin/node/inspect/src/cli.rs
+++ b/bin/node/inspect/src/cli.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/inspect/src/command.rs b/bin/node/inspect/src/command.rs
index fae6c10c7fe7846dc63e990dcf03254655467705..a1a9c947a561b00f03a890c71c83948e68ffa493 100644
--- a/bin/node/inspect/src/command.rs
+++ b/bin/node/inspect/src/command.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/inspect/src/lib.rs b/bin/node/inspect/src/lib.rs
index 02f5614b81a78044d1418d9d23f87322da2c298c..2a55fdcda62ee34482a361fefaa30bd3e38cd25b 100644
--- a/bin/node/inspect/src/lib.rs
+++ b/bin/node/inspect/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
//
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
//
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/primitives/src/lib.rs b/bin/node/primitives/src/lib.rs
index 137fb1d94c778aafa6b2f45713d4954070caa1d5..9470adc399f9680d4e185e081980416d980a5df3 100644
--- a/bin/node/primitives/src/lib.rs
+++ b/bin/node/primitives/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/rpc-client/src/main.rs b/bin/node/rpc-client/src/main.rs
index 31f1efa28ccd0684c363f577d491ce6e98b34e7f..ddd8a50ad36e44344466ccc20648f755e7cb7311 100644
--- a/bin/node/rpc-client/src/main.rs
+++ b/bin/node/rpc-client/src/main.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/rpc/src/lib.rs b/bin/node/rpc/src/lib.rs
index 1ced3d60ab362bf0817d0b654712720a9a4f6950..e68ca6843bc944aa7c92538e55b7e544dda00a7c 100644
--- a/bin/node/rpc/src/lib.rs
+++ b/bin/node/rpc/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml
index ad0f6b35a25d1e1757ddb4bfc426ccc4f5c33105..3aa906ba0fc53bdc22829b69dc0dad6b6c56ef06 100644
--- a/bin/node/runtime/Cargo.toml
+++ b/bin/node/runtime/Cargo.toml
@@ -48,6 +48,7 @@ pallet-authority-discovery = { version = "2.0.0", default-features = false, path
pallet-authorship = { version = "2.0.0", default-features = false, path = "../../../frame/authorship" }
pallet-babe = { version = "2.0.0", default-features = false, path = "../../../frame/babe" }
pallet-balances = { version = "2.0.0", default-features = false, path = "../../../frame/balances" }
+pallet-bounties = { version = "2.0.0", default-features = false, path = "../../../frame/bounties" }
pallet-collective = { version = "2.0.0", default-features = false, path = "../../../frame/collective" }
pallet-contracts = { version = "2.0.0", default-features = false, path = "../../../frame/contracts" }
pallet-contracts-primitives = { version = "2.0.0", default-features = false, path = "../../../frame/contracts/common/" }
@@ -58,6 +59,7 @@ pallet-grandpa = { version = "2.0.0", default-features = false, path = "../../..
pallet-im-online = { version = "2.0.0", default-features = false, path = "../../../frame/im-online" }
pallet-indices = { version = "2.0.0", default-features = false, path = "../../../frame/indices" }
pallet-identity = { version = "2.0.0", default-features = false, path = "../../../frame/identity" }
+pallet-lottery = { version = "2.0.0", default-features = false, path = "../../../frame/lottery" }
pallet-membership = { version = "2.0.0", default-features = false, path = "../../../frame/membership" }
pallet-mmr = { version = "2.0.0", default-features = false, path = "../../../frame/merkle-mountain-range" }
pallet-multisig = { version = "2.0.0", default-features = false, path = "../../../frame/multisig" }
@@ -74,6 +76,7 @@ pallet-scheduler = { version = "2.0.0", default-features = false, path = "../../
pallet-society = { version = "2.0.0", default-features = false, path = "../../../frame/society" }
pallet-sudo = { version = "2.0.0", default-features = false, path = "../../../frame/sudo" }
pallet-timestamp = { version = "2.0.0", default-features = false, path = "../../../frame/timestamp" }
+pallet-tips = { version = "2.0.0", default-features = false, path = "../../../frame/tips" }
pallet-treasury = { version = "2.0.0", default-features = false, path = "../../../frame/treasury" }
pallet-utility = { version = "2.0.0", default-features = false, path = "../../../frame/utility" }
pallet-transaction-payment = { version = "2.0.0", default-features = false, path = "../../../frame/transaction-payment" }
@@ -97,6 +100,7 @@ std = [
"sp-consensus-babe/std",
"pallet-babe/std",
"pallet-balances/std",
+ "pallet-bounties/std",
"sp-block-builder/std",
"codec/std",
"pallet-collective/std",
@@ -110,6 +114,7 @@ std = [
"pallet-im-online/std",
"pallet-indices/std",
"sp-inherents/std",
+ "pallet-lottery/std",
"pallet-membership/std",
"pallet-mmr/std",
"pallet-multisig/std",
@@ -136,6 +141,7 @@ std = [
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"pallet-timestamp/std",
+ "pallet-tips/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-treasury/std",
@@ -154,6 +160,7 @@ runtime-benchmarks = [
"pallet-assets/runtime-benchmarks",
"pallet-babe/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
+ "pallet-bounties/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-contracts/runtime-benchmarks",
"pallet-democracy/runtime-benchmarks",
@@ -162,6 +169,7 @@ runtime-benchmarks = [
"pallet-identity/runtime-benchmarks",
"pallet-im-online/runtime-benchmarks",
"pallet-indices/runtime-benchmarks",
+ "pallet-lottery/runtime-benchmarks",
"pallet-mmr/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
@@ -169,6 +177,7 @@ runtime-benchmarks = [
"pallet-society/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
+ "pallet-tips/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
diff --git a/bin/node/runtime/build.rs b/bin/node/runtime/build.rs
index 8a0b4d7a0c15745cbc743130b522ddf693d3822b..a1c4b2d892cfeda075e361c69b8f7fc7e4ebb980 100644
--- a/bin/node/runtime/build.rs
+++ b/bin/node/runtime/build.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/runtime/src/constants.rs b/bin/node/runtime/src/constants.rs
index 0301c30d5b6396a18e9b1e7ec5efd2b68067f122..f447486c7ffc49365123d76bedbc73d16d699368 100644
--- a/bin/node/runtime/src/constants.rs
+++ b/bin/node/runtime/src/constants.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs
index d7910c2c63b8a81c498f764e912ea1a48ee70886..c6a56e5ac0dab54c5d9b30c526f34aa10c046ec6 100644
--- a/bin/node/runtime/src/impls.rs
+++ b/bin/node/runtime/src/impls.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs
index fb8f720898bbe9516351ad494638bc5b4abcd35f..3e6452465831fcc220a3f1a7ed6cd19381087fc0 100644
--- a/bin/node/runtime/src/lib.rs
+++ b/bin/node/runtime/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -71,6 +71,7 @@ pub use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment, Currency
use pallet_session::{historical as pallet_session_historical};
use sp_inherents::{InherentData, CheckInherentsResult};
use static_assertions::const_assert;
+use pallet_contracts::WeightInfo;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
@@ -111,7 +112,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
- spec_version: 260,
+ spec_version: 261,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
@@ -176,6 +177,7 @@ parameter_types! {
})
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
.build_or_panic();
+ pub const SS58Prefix: u8 = 42;
}
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
@@ -202,6 +204,7 @@ impl frame_system::Config for Runtime {
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = frame_system::weights::SubstrateWeight;
+ type SS58Prefix = SS58Prefix;
}
impl pallet_utility::Config for Runtime {
@@ -671,36 +674,62 @@ impl pallet_treasury::Config for Runtime {
EnsureRoot,
pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>
>;
- type Tippers = Elections;
- type TipCountdown = TipCountdown;
- type TipFindersFee = TipFindersFee;
- type TipReportDepositBase = TipReportDepositBase;
- type DataDepositPerByte = DataDepositPerByte;
type Event = Event;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
+ type BurnDestination = ();
+ type SpendFunds = Bounties;
+ type WeightInfo = pallet_treasury::weights::SubstrateWeight;
+}
+
+impl pallet_bounties::Config for Runtime {
+ type Event = Event;
type BountyDepositBase = BountyDepositBase;
type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
type BountyUpdatePeriod = BountyUpdatePeriod;
type BountyCuratorDeposit = BountyCuratorDeposit;
type BountyValueMinimum = BountyValueMinimum;
+ type DataDepositPerByte = DataDepositPerByte;
type MaximumReasonLength = MaximumReasonLength;
- type BurnDestination = ();
- type WeightInfo = pallet_treasury::weights::SubstrateWeight;
+ type WeightInfo = pallet_bounties::weights::SubstrateWeight;
+}
+
+impl pallet_tips::Config for Runtime {
+ type Event = Event;
+ type DataDepositPerByte = DataDepositPerByte;
+ type MaximumReasonLength = MaximumReasonLength;
+ type Tippers = Elections;
+ type TipCountdown = TipCountdown;
+ type TipFindersFee = TipFindersFee;
+ type TipReportDepositBase = TipReportDepositBase;
+ type WeightInfo = pallet_tips::weights::SubstrateWeight;
}
parameter_types! {
- pub const TombstoneDeposit: Balance = 16 * MILLICENTS;
- pub const RentByteFee: Balance = 4 * MILLICENTS;
- pub const RentDepositOffset: Balance = 1000 * MILLICENTS;
+ pub const TombstoneDeposit: Balance = deposit(
+ 1,
+ sp_std::mem::size_of::>() as u32
+ );
+ pub const DepositPerContract: Balance = TombstoneDeposit::get();
+ pub const DepositPerStorageByte: Balance = deposit(0, 1);
+ pub const DepositPerStorageItem: Balance = deposit(1, 0);
+ pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * DAYS);
pub const SurchargeReward: Balance = 150 * MILLICENTS;
pub const SignedClaimHandicap: u32 = 2;
pub const MaxDepth: u32 = 32;
- pub const StorageSizeOffset: u32 = 8;
pub const MaxValueSize: u32 = 16 * 1024;
+ // The lazy deletion runs inside on_initialize.
+ pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *
+ RuntimeBlockWeights::get().max_block;
+ // The weight needed for decoding the queue should be less or equal than a fifth
+ // of the overall weight dedicated to the lazy deletion.
+ pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (
+ ::WeightInfo::on_initialize_per_queue_item(1) -
+ ::WeightInfo::on_initialize_per_queue_item(0)
+ )) / 5) as u32;
}
impl pallet_contracts::Config for Runtime {
@@ -711,14 +740,18 @@ impl pallet_contracts::Config for Runtime {
type RentPayment = ();
type SignedClaimHandicap = SignedClaimHandicap;
type TombstoneDeposit = TombstoneDeposit;
- type StorageSizeOffset = StorageSizeOffset;
- type RentByteFee = RentByteFee;
- type RentDepositOffset = RentDepositOffset;
+ type DepositPerContract = DepositPerContract;
+ type DepositPerStorageByte = DepositPerStorageByte;
+ type DepositPerStorageItem = DepositPerStorageItem;
+ type RentFraction = RentFraction;
type SurchargeReward = SurchargeReward;
type MaxDepth = MaxDepth;
type MaxValueSize = MaxValueSize;
type WeightPrice = pallet_transaction_payment::Module;
type WeightInfo = pallet_contracts::weights::SubstrateWeight;
+ type ChainExtension = ();
+ type DeletionQueueDepth = DeletionQueueDepth;
+ type DeletionWeightLimit = DeletionWeightLimit;
}
impl pallet_sudo::Config for Runtime {
@@ -924,6 +957,25 @@ impl pallet_mmr::Config for Runtime {
type WeightInfo = ();
}
+parameter_types! {
+ pub const LotteryModuleId: ModuleId = ModuleId(*b"py/lotto");
+ pub const MaxCalls: usize = 10;
+ pub const MaxGenerateRandom: u32 = 10;
+}
+
+impl pallet_lottery::Config for Runtime {
+ type ModuleId = LotteryModuleId;
+ type Call = Call;
+ type Event = Event;
+ type Currency = Balances;
+ type Randomness = RandomnessCollectiveFlip;
+ type ManagerOrigin = EnsureRoot;
+ type MaxCalls = MaxCalls;
+ type ValidateCall = Lottery;
+ type MaxGenerateRandom = MaxGenerateRandom;
+ type WeightInfo = pallet_lottery::weights::SubstrateWeight;
+}
+
parameter_types! {
pub const AssetDepositBase: Balance = 100 * DOLLARS;
pub const AssetDepositPerZombie: Balance = 1 * DOLLARS;
@@ -977,8 +1029,11 @@ construct_runtime!(
Scheduler: pallet_scheduler::{Module, Call, Storage, Event},
Proxy: pallet_proxy::{Module, Call, Storage, Event},
Multisig: pallet_multisig::{Module, Call, Storage, Event},
+ Bounties: pallet_bounties::{Module, Call, Storage, Event},
+ Tips: pallet_tips::{Module, Call, Storage, Event},
Assets: pallet_assets::{Module, Call, Storage, Event},
Mmr: pallet_mmr::{Module, Storage},
+ Lottery: pallet_lottery::{Module, Call, Storage, Event},
}
);
@@ -1126,6 +1181,14 @@ impl_runtime_apis! {
Babe::current_epoch_start()
}
+ fn current_epoch() -> sp_consensus_babe::Epoch {
+ Babe::current_epoch()
+ }
+
+ fn next_epoch() -> sp_consensus_babe::Epoch {
+ Babe::next_epoch()
+ }
+
fn generate_key_ownership_proof(
_slot_number: sp_consensus_babe::SlotNumber,
authority_id: sp_consensus_babe::AuthorityId,
@@ -1248,6 +1311,7 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_assets, Assets);
add_benchmark!(params, batches, pallet_babe, Babe);
add_benchmark!(params, batches, pallet_balances, Balances);
+ add_benchmark!(params, batches, pallet_bounties, Bounties);
add_benchmark!(params, batches, pallet_collective, Council);
add_benchmark!(params, batches, pallet_contracts, Contracts);
add_benchmark!(params, batches, pallet_democracy, Democracy);
@@ -1256,6 +1320,7 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_identity, Identity);
add_benchmark!(params, batches, pallet_im_online, ImOnline);
add_benchmark!(params, batches, pallet_indices, Indices);
+ add_benchmark!(params, batches, pallet_lottery, Lottery);
add_benchmark!(params, batches, pallet_mmr, Mmr);
add_benchmark!(params, batches, pallet_multisig, Multisig);
add_benchmark!(params, batches, pallet_offences, OffencesBench::);
@@ -1265,6 +1330,7 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_staking, Staking);
add_benchmark!(params, batches, frame_system, SystemBench::);
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
+ add_benchmark!(params, batches, pallet_tips, Tips);
add_benchmark!(params, batches, pallet_treasury, Treasury);
add_benchmark!(params, batches, pallet_utility, Utility);
add_benchmark!(params, batches, pallet_vesting, Vesting);
diff --git a/bin/node/testing/src/bench.rs b/bin/node/testing/src/bench.rs
index 35af52a2f36c1ad3170ff418fb4900c2f3a758f0..3bc31c6e414a698931ae20f09642ef04c335c89d 100644
--- a/bin/node/testing/src/bench.rs
+++ b/bin/node/testing/src/bench.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/testing/src/client.rs b/bin/node/testing/src/client.rs
index f44747b26b7a6eb6409e76063b23914f3fb43f66..c4ace4ced9b42b39ccab9b23ea1d3b86ead77897 100644
--- a/bin/node/testing/src/client.rs
+++ b/bin/node/testing/src/client.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/testing/src/genesis.rs b/bin/node/testing/src/genesis.rs
index 6fa178ba4bcddbc7cadb8e61fad4433d852ace22..75d0d18e6ef811cd91e0bf57eb38c2a72a3b414a 100644
--- a/bin/node/testing/src/genesis.rs
+++ b/bin/node/testing/src/genesis.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/testing/src/keyring.rs b/bin/node/testing/src/keyring.rs
index f0b8ff707294eb6bed32daf6d7fa18505b1c2333..da61040206ea4f8a41bc963226bb8a70eb1acdea 100644
--- a/bin/node/testing/src/keyring.rs
+++ b/bin/node/testing/src/keyring.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/node/testing/src/lib.rs b/bin/node/testing/src/lib.rs
index d682347e40019dd4a7ff74a8716929130623f31e..c5792bccee80da8f787424517653d484fe2f2ce6 100644
--- a/bin/node/testing/src/lib.rs
+++ b/bin/node/testing/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/utils/chain-spec-builder/build.rs b/bin/utils/chain-spec-builder/build.rs
index 8d5aac1a08742486a9b0e5d55aaf7959941abd77..57424f016f3e520e98345432cc105469a43efefc 100644
--- a/bin/utils/chain-spec-builder/build.rs
+++ b/bin/utils/chain-spec-builder/build.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/utils/chain-spec-builder/src/main.rs b/bin/utils/chain-spec-builder/src/main.rs
index c2db944050eb452708e50001edaeb609bbc0057c..f3336b1d53a84eceaac50a89887075e8152f90cd 100644
--- a/bin/utils/chain-spec-builder/src/main.rs
+++ b/bin/utils/chain-spec-builder/src/main.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/bin/utils/subkey/Cargo.toml b/bin/utils/subkey/Cargo.toml
index fa0b345bc8406f2f4ea33228276fdb712b1b4845..e445749c2c2eafe7feac54adcda1753668282452 100644
--- a/bin/utils/subkey/Cargo.toml
+++ b/bin/utils/subkey/Cargo.toml
@@ -16,13 +16,5 @@ name = "subkey"
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
-node-runtime = { version = "2.0.0", path = "../../node/runtime" }
-node-primitives = { version = "2.0.0", path = "../../node/primitives" }
sc-cli = { version = "0.8.0", path = "../../../client/cli" }
-substrate-frame-cli = { version = "2.0.0", path = "../../../utils/frame/frame-utilities-cli" }
structopt = "0.3.14"
-frame-system = { version = "2.0.0", path = "../../../frame/system" }
-sp-core = { version = "2.0.0", path = "../../../primitives/core" }
-
-[features]
-bench = []
diff --git a/bin/utils/subkey/src/lib.rs b/bin/utils/subkey/src/lib.rs
index c38a48576524301f85f323b6986ece5ab052b3d0..e7243fbd43e4633ac7695f000f5f1f8ee3624e69 100644
--- a/bin/utils/subkey/src/lib.rs
+++ b/bin/utils/subkey/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -18,11 +18,9 @@
use structopt::StructOpt;
use sc_cli::{
- Error, VanityCmd, SignCmd, VerifyCmd, InsertCmd,
- GenerateNodeKeyCmd, GenerateCmd, InspectKeyCmd, InspectNodeKeyCmd
+ Error, VanityCmd, SignCmd, VerifyCmd, GenerateNodeKeyCmd, GenerateCmd, InspectKeyCmd,
+ InspectNodeKeyCmd
};
-use substrate_frame_cli::ModuleIdCmd;
-use sp_core::crypto::Ss58Codec;
#[derive(Debug, StructOpt)]
#[structopt(
@@ -44,12 +42,6 @@ pub enum Subkey {
/// Print the peer ID corresponding to the node key in the given file
InspectNodeKey(InspectNodeKeyCmd),
- /// Insert a key to the keystore of a node.
- Insert(InsertCmd),
-
- /// Inspect a module ID address
- ModuleId(ModuleIdCmd),
-
/// Sign a message, with a given (secret) key.
Sign(SignCmd),
@@ -61,22 +53,14 @@ pub enum Subkey {
}
/// Run the subkey command, given the apropriate runtime.
-pub fn run() -> Result<(), Error>
- where
- R: frame_system::Config,
- R::AccountId: Ss58Codec
-{
+pub fn run() -> Result<(), Error> {
match Subkey::from_args() {
- Subkey::GenerateNodeKey(cmd) => cmd.run()?,
- Subkey::Generate(cmd) => cmd.run()?,
- Subkey::Inspect(cmd) => cmd.run()?,
- Subkey::InspectNodeKey(cmd) => cmd.run()?,
- Subkey::Insert(cmd) => cmd.run()?,
- Subkey::ModuleId(cmd) => cmd.run::()?,
- Subkey::Vanity(cmd) => cmd.run()?,
- Subkey::Verify(cmd) => cmd.run()?,
- Subkey::Sign(cmd) => cmd.run()?,
- };
-
- Ok(())
+ Subkey::GenerateNodeKey(cmd) => cmd.run(),
+ Subkey::Generate(cmd) => cmd.run(),
+ Subkey::Inspect(cmd) => cmd.run(),
+ Subkey::InspectNodeKey(cmd) => cmd.run(),
+ Subkey::Vanity(cmd) => cmd.run(),
+ Subkey::Verify(cmd) => cmd.run(),
+ Subkey::Sign(cmd) => cmd.run(),
+ }
}
diff --git a/bin/utils/subkey/src/main.rs b/bin/utils/subkey/src/main.rs
index dd14425130b7d32ce9ddb7123929a74aa63da93d..2a0f0850713fa949c6cd6c03cb9d924aa257cc95 100644
--- a/bin/utils/subkey/src/main.rs
+++ b/bin/utils/subkey/src/main.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -18,8 +18,6 @@
//! Subkey utility, based on node_runtime.
-use node_runtime::Runtime;
-
fn main() -> Result<(), sc_cli::Error> {
- subkey::run::()
+ subkey::run()
}
diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml
index 07036bfb414a26e45f7cfdd7d09120b3666c1842..63cdf39d7d282b76b2a4f311d1807819170cd511 100644
--- a/client/api/Cargo.toml
+++ b/client/api/Cargo.toml
@@ -24,9 +24,9 @@ futures = "0.3.1"
hash-db = { version = "0.15.2", default-features = false }
sp-blockchain = { version = "2.0.0", path = "../../primitives/blockchain" }
sp-inherents = { version = "2.0.0", default-features = false, path = "../../primitives/inherents" }
-kvdb = "0.7.0"
+kvdb = "0.8.0"
log = "0.4.8"
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
lazy_static = "1.4.0"
sp-database = { version = "2.0.0", path = "../../primitives/database" }
sp-core = { version = "2.0.0", default-features = false, path = "../../primitives/core" }
@@ -43,7 +43,7 @@ sp-transaction-pool = { version = "2.0.0", path = "../../primitives/transaction-
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.8.0", path = "../../utils/prometheus" }
[dev-dependencies]
-kvdb-memorydb = "0.7.0"
+kvdb-memorydb = "0.8.0"
sp-test-primitives = { version = "2.0.0", path = "../../primitives/test-primitives" }
substrate-test-runtime = { version = "2.0.0", path = "../../test-utils/runtime" }
thiserror = "1.0.21"
diff --git a/client/api/src/backend.rs b/client/api/src/backend.rs
index 162946a9e6d5b7a94d34ad5d01290d6b7f28e89b..1501e6f75b938f1da75bcb814a6d53154531c6fb 100644
--- a/client/api/src/backend.rs
+++ b/client/api/src/backend.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/api/src/call_executor.rs b/client/api/src/call_executor.rs
index 86e3440f19c93b6f25b5623bacefbce336a01d47..9c0ea87ea718e782365195763f0e80e15431eeb0 100644
--- a/client/api/src/call_executor.rs
+++ b/client/api/src/call_executor.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/api/src/cht.rs b/client/api/src/cht.rs
index 7fd7aa0dbcb7e7c18a35f7ce1da31bae173c2fc7..8fec00403bde11fb45b2d6504f7d8b575f9afc82 100644
--- a/client/api/src/cht.rs
+++ b/client/api/src/cht.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -22,7 +22,7 @@
//! One is generated for every `SIZE` blocks, allowing us to discard those blocks in
//! favor of the trie root. When the "ancient" blocks need to be accessed, we simply
//! request an inclusion proof of a specific block number against the trie with the
-//! root has. A correct proof implies that the claimed block is identical to the one
+//! root hash. A correct proof implies that the claimed block is identical to the one
//! we discarded.
use hash_db;
diff --git a/client/api/src/client.rs b/client/api/src/client.rs
index 53ebbe2d7883719ae8b54b287dfbe0d0dd98de61..aa823d5c192ca734f4b07823c22814b36a5b7878 100644
--- a/client/api/src/client.rs
+++ b/client/api/src/client.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! A set of APIs supported by the client along with their primitives.
diff --git a/client/api/src/execution_extensions.rs b/client/api/src/execution_extensions.rs
index c187e7580023570d91e57fa64472ac2514a4e665..68b412a0d778b0b6636700cc2a38a6f53e52062c 100644
--- a/client/api/src/execution_extensions.rs
+++ b/client/api/src/execution_extensions.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Execution extensions for runtime calls.
//!
diff --git a/client/api/src/in_mem.rs b/client/api/src/in_mem.rs
index 272a51ff171431db220fff0254b014c08bb9a6b9..bfa5bf8d073c9b123c112691b28c9430cbe5f8eb 100644
--- a/client/api/src/in_mem.rs
+++ b/client/api/src/in_mem.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/api/src/leaves.rs b/client/api/src/leaves.rs
index d10fa7ac0e565347803999d7a63a6aa2a0536fb5..1971012c6aabc1a696c175d3480d5cf6c448f039 100644
--- a/client/api/src/leaves.rs
+++ b/client/api/src/leaves.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/api/src/lib.rs b/client/api/src/lib.rs
index 677066936330e07b6b7b6df010fe78e4be031b6e..0f860b95e780550d0b68ec2c6f7a96f0ae383ed3 100644
--- a/client/api/src/lib.rs
+++ b/client/api/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Substrate client interfaces.
#![warn(missing_docs)]
diff --git a/client/api/src/light.rs b/client/api/src/light.rs
index f9ba64544a8c0199072e82b010a33d72de6c2a79..a068e2d4a3417c8576a9964b23d75058de3e6f45 100644
--- a/client/api/src/light.rs
+++ b/client/api/src/light.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Substrate light client interfaces
diff --git a/client/api/src/notifications.rs b/client/api/src/notifications.rs
index ec63c372c7e5969b28e5dfdbd54afae0b757b1b6..bfd419ec9a581a9cb87fe4ee6f96832598ad03b1 100644
--- a/client/api/src/notifications.rs
+++ b/client/api/src/notifications.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/api/src/proof_provider.rs b/client/api/src/proof_provider.rs
index 5749ae0576fc38799d8c2eeb9b2aeaccd49b2bca..a0dbcf1d1e807c2425be12499d582af024532d65 100644
--- a/client/api/src/proof_provider.rs
+++ b/client/api/src/proof_provider.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml
index 8878becd7e02a34e3986185dc6d53588a1b48e6c..5c1d0b9d91f831d8b7df61508132e34ad09b7548 100644
--- a/client/authority-discovery/Cargo.toml
+++ b/client/authority-discovery/Cargo.toml
@@ -23,7 +23,7 @@ derive_more = "0.99.2"
either = "1.5.3"
futures = "0.3.4"
futures-timer = "3.0.1"
-libp2p = { version = "0.32.2", default-features = false, features = ["kad"] }
+libp2p = { version = "0.33.0", default-features = false, features = ["kad"] }
log = "0.4.8"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0"}
prost = "0.6.1"
diff --git a/client/authority-discovery/src/error.rs b/client/authority-discovery/src/error.rs
index 82e4a6dd6f3fde8d25b54ab7304de77f9908b35c..b271f7b9d62bbac5227388a2910e778f19e8a6e6 100644
--- a/client/authority-discovery/src/error.rs
+++ b/client/authority-discovery/src/error.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Authority discovery errors.
@@ -36,8 +38,6 @@ pub enum Error {
CallingRuntime(sp_blockchain::Error),
/// Received a dht record with a key that does not match any in-flight awaited keys.
ReceivingUnexpectedRecord,
- /// Failed to set the authority discovery peerset priority group in the peerset module.
- SettingPeersetPriorityGroup(String),
/// Failed to encode a protobuf payload.
EncodingProto(prost::EncodeError),
/// Failed to decode a protobuf payload.
diff --git a/client/authority-discovery/src/interval.rs b/client/authority-discovery/src/interval.rs
index b3aa5b1c0f6785f68a9689e6f45a94e7e08b9d19..0710487203d5360f556c62ae621744851301f6aa 100644
--- a/client/authority-discovery/src/interval.rs
+++ b/client/authority-discovery/src/interval.rs
@@ -1,18 +1,20 @@
-// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use futures::stream::Stream;
use futures::future::FutureExt;
diff --git a/client/authority-discovery/src/lib.rs b/client/authority-discovery/src/lib.rs
index 41aa01e56bde20f36fbcde6eeee3156ac4addb6e..26d4396ca88302f5b4179744c1cd44903e4b1467 100644
--- a/client/authority-discovery/src/lib.rs
+++ b/client/authority-discovery/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
#![warn(missing_docs)]
#![recursion_limit = "1024"]
diff --git a/client/authority-discovery/src/service.rs b/client/authority-discovery/src/service.rs
index d23d2f3a480f7be7c97aa09dfde62d05d5c3da56..1da97cbb03b53cbc2a7ecf1b07eb18666c4d2e17 100644
--- a/client/authority-discovery/src/service.rs
+++ b/client/authority-discovery/src/service.rs
@@ -1,18 +1,20 @@
-// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use crate::ServicetoWorkerMsg;
diff --git a/client/authority-discovery/src/tests.rs b/client/authority-discovery/src/tests.rs
index 414ffc1e3f3947718241f6586ff1e5cfda4d8fb8..78e978e07a1a0418f1f6705b56f32e236ddf7e5e 100644
--- a/client/authority-discovery/src/tests.rs
+++ b/client/authority-discovery/src/tests.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/authority-discovery/src/worker.rs b/client/authority-discovery/src/worker.rs
index d886f24542d76885f15d5d854466af1a42bfc12d..e47f42a445ee9135d6e03c923acfae6758df4682 100644
--- a/client/authority-discovery/src/worker.rs
+++ b/client/authority-discovery/src/worker.rs
@@ -1,18 +1,20 @@
-// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use crate::{error::{Error, Result}, interval::ExpIncInterval, ServicetoWorkerMsg};
@@ -55,10 +57,6 @@ pub mod tests;
const LOG_TARGET: &'static str = "sub-authority-discovery";
-/// Name of the Substrate peerset priority group for authorities discovered through the authority
-/// discovery module.
-const AUTHORITIES_PRIORITY_GROUP_NAME: &'static str = "authorities";
-
/// Maximum number of addresses cached per authority. Additional addresses are discarded.
const MAX_ADDRESSES_PER_AUTHORITY: usize = 10;
@@ -113,9 +111,6 @@ pub struct Worker {
publish_interval: ExpIncInterval,
/// Interval at which to request addresses of authorities, refilling the pending lookups queue.
query_interval: ExpIncInterval,
- /// Interval on which to set the peerset priority group to a new random
- /// set of addresses.
- priority_group_set_interval: ExpIncInterval,
/// Queue of throttled lookups pending to be passed to the network.
pending_lookups: Vec,
@@ -164,13 +159,6 @@ where
Duration::from_secs(2),
config.max_query_interval,
);
- let priority_group_set_interval = ExpIncInterval::new(
- Duration::from_secs(2),
- // Trade-off between node connection churn and connectivity. Using half of
- // [`crate::WorkerConfig::max_query_interval`] to update priority group once at the
- // beginning and once in the middle of each query interval.
- config.max_query_interval / 2,
- );
let addr_cache = AddrCache::new();
@@ -194,7 +182,6 @@ where
dht_event_rx,
publish_interval,
query_interval,
- priority_group_set_interval,
pending_lookups: Vec::new(),
in_flight_lookups: HashMap::new(),
addr_cache,
@@ -224,15 +211,6 @@ where
msg = self.from_service.select_next_some() => {
self.process_message_from_service(msg);
},
- // Set peerset priority group to a new random set of addresses.
- _ = self.priority_group_set_interval.next().fuse() => {
- if let Err(e) = self.set_priority_group().await {
- error!(
- target: LOG_TARGET,
- "Failed to set priority group: {:?}", e,
- );
- }
- },
// Publish own addresses.
_ = self.publish_interval.next().fuse() => {
if let Err(e) = self.publish_ext_addresses().await {
@@ -580,38 +558,6 @@ where
Ok(intersection)
}
-
- /// Set the peer set 'authority' priority group to a new random set of
- /// [`Multiaddr`]s.
- async fn set_priority_group(&self) -> Result<()> {
- let addresses = self.addr_cache.get_random_subset();
-
- if addresses.is_empty() {
- debug!(
- target: LOG_TARGET,
- "Got no addresses in cache for peerset priority group.",
- );
- return Ok(());
- }
-
- if let Some(metrics) = &self.metrics {
- metrics.priority_group_size.set(addresses.len().try_into().unwrap_or(std::u64::MAX));
- }
-
- debug!(
- target: LOG_TARGET,
- "Applying priority group {:?} to peerset.", addresses,
- );
-
- self.network
- .set_priority_group(
- AUTHORITIES_PRIORITY_GROUP_NAME.to_string(),
- addresses.into_iter().collect(),
- ).await
- .map_err(Error::SettingPeersetPriorityGroup)?;
-
- Ok(())
- }
}
/// NetworkProvider provides [`Worker`] with all necessary hooks into the
@@ -619,13 +565,6 @@ where
/// [`sc_network::NetworkService`] directly is necessary to unit test [`Worker`].
#[async_trait]
pub trait NetworkProvider: NetworkStateInfo {
- /// Modify a peerset priority group.
- async fn set_priority_group(
- &self,
- group_id: String,
- peers: HashSet,
- ) -> std::result::Result<(), String>;
-
/// Start putting a value in the Dht.
fn put_value(&self, key: libp2p::kad::record::Key, value: Vec);
@@ -639,13 +578,6 @@ where
B: BlockT + 'static,
H: ExHashT,
{
- async fn set_priority_group(
- &self,
- group_id: String,
- peers: HashSet,
- ) -> std::result::Result<(), String> {
- self.set_priority_group(group_id, peers).await
- }
fn put_value(&self, key: libp2p::kad::record::Key, value: Vec) {
self.put_value(key, value)
}
@@ -668,7 +600,6 @@ pub(crate) struct Metrics {
dht_event_received: CounterVec,
handle_value_found_event_failure: Counter,
known_authorities_count: Gauge,
- priority_group_size: Gauge,
}
impl Metrics {
@@ -728,13 +659,6 @@ impl Metrics {
)?,
registry,
)?,
- priority_group_size: register(
- Gauge::new(
- "authority_discovery_priority_group_size",
- "Number of addresses passed to the peer set as a priority group."
- )?,
- registry,
- )?,
})
}
}
diff --git a/client/authority-discovery/src/worker/addr_cache.rs b/client/authority-discovery/src/worker/addr_cache.rs
index 75fcaa840176656998ef413fe4315587d39b27a5..1ad7f585e294b1d823036ae85585d8f57bb5c165 100644
--- a/client/authority-discovery/src/worker/addr_cache.rs
+++ b/client/authority-discovery/src/worker/addr_cache.rs
@@ -1,31 +1,27 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use libp2p::core::multiaddr::{Multiaddr, Protocol};
-use rand::seq::SliceRandom;
use std::collections::HashMap;
use sp_authority_discovery::AuthorityId;
use sc_network::PeerId;
-/// The maximum number of authority connections initialized through the authority discovery module.
-///
-/// In other words the maximum size of the `authority` peerset priority group.
-const MAX_NUM_AUTHORITY_CONN: usize = 10;
-
/// Cache for [`AuthorityId`] -> [`Vec`] and [`PeerId`] -> [`AuthorityId`] mappings.
pub(super) struct AddrCache {
authority_id_to_addresses: HashMap>,
@@ -75,30 +71,6 @@ impl AddrCache {
self.peer_id_to_authority_id.get(peer_id)
}
- /// Returns a single address for a random subset (maximum of [`MAX_NUM_AUTHORITY_CONN`]) of all
- /// known authorities.
- pub fn get_random_subset(&self) -> Vec {
- let mut rng = rand::thread_rng();
-
- let mut addresses = self
- .authority_id_to_addresses
- .iter()
- .filter_map(|(_authority_id, addresses)| {
- debug_assert!(!addresses.is_empty());
- addresses
- .choose(&mut rng)
- })
- .collect::>();
-
- addresses.sort_unstable_by(|a, b| a.as_ref().cmp(b.as_ref()));
- addresses.dedup();
-
- addresses
- .choose_multiple(&mut rng, MAX_NUM_AUTHORITY_CONN)
- .map(|a| (**a).clone())
- .collect()
- }
-
/// Removes all [`PeerId`]s and [`Multiaddr`]s from the cache that are not related to the given
/// [`AuthorityId`]s.
pub fn retain_ids(&mut self, authority_ids: &Vec) {
@@ -190,11 +162,6 @@ mod tests {
cache.insert(second.0.clone(), vec![second.1.clone()]);
cache.insert(third.0.clone(), vec![third.1.clone()]);
- let subset = cache.get_random_subset();
- assert!(
- subset.contains(&first.1) && subset.contains(&second.1) && subset.contains(&third.1),
- "Expect initial subset to contain all authorities.",
- );
assert_eq!(
Some(&vec![third.1.clone()]),
cache.get_addresses_by_authority_id(&third.0),
@@ -208,12 +175,6 @@ mod tests {
cache.retain_ids(&vec![first.0, second.0]);
- let subset = cache.get_random_subset();
- assert!(
- subset.contains(&first.1) || subset.contains(&second.1),
- "Expected both first and second authority."
- );
- assert!(!subset.contains(&third.1), "Did not expect address from third authority");
assert_eq!(
None, cache.get_addresses_by_authority_id(&third.0),
"Expect `get_addresses_by_authority_id` to not return `None` for third authority."
diff --git a/client/authority-discovery/src/worker/tests.rs b/client/authority-discovery/src/worker/tests.rs
index fee861dfeb0c7da2c09646ab1eada17261401872..20c4c937096a1a7b0c272eec5eb3313c9c3261c5 100644
--- a/client/authority-discovery/src/worker/tests.rs
+++ b/client/authority-discovery/src/worker/tests.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -18,7 +18,7 @@
use crate::worker::schema;
-use std::{iter::FromIterator, sync::{Arc, Mutex}, task::Poll};
+use std::{sync::{Arc, Mutex}, task::Poll};
use async_trait::async_trait;
use futures::channel::mpsc::{self, channel};
@@ -112,10 +112,6 @@ sp_api::mock_impl_runtime_apis! {
pub enum TestNetworkEvent {
GetCalled(kad::record::Key),
PutCalled(kad::record::Key, Vec),
- SetPriorityGroupCalled {
- group_id: String,
- peers: HashSet
- },
}
pub struct TestNetwork {
@@ -125,7 +121,6 @@ pub struct TestNetwork {
// vectors below.
pub put_value_call: Arc)>>>,
pub get_value_call: Arc>>,
- pub set_priority_group_call: Arc)>>>,
event_sender: mpsc::UnboundedSender,
event_receiver: Option>,
}
@@ -147,7 +142,6 @@ impl Default for TestNetwork {
],
put_value_call: Default::default(),
get_value_call: Default::default(),
- set_priority_group_call: Default::default(),
event_sender: tx,
event_receiver: Some(rx),
}
@@ -156,21 +150,6 @@ impl Default for TestNetwork {
#[async_trait]
impl NetworkProvider for TestNetwork {
- async fn set_priority_group(
- &self,
- group_id: String,
- peers: HashSet,
- ) -> std::result::Result<(), String> {
- self.set_priority_group_call
- .lock()
- .unwrap()
- .push((group_id.clone(), peers.clone()));
- self.event_sender.clone().unbounded_send(TestNetworkEvent::SetPriorityGroupCalled {
- group_id,
- peers,
- }).unwrap();
- Ok(())
- }
fn put_value(&self, key: kad::record::Key, value: Vec) {
self.put_value_call.lock().unwrap().push((key.clone(), value.clone()));
self.event_sender.clone().unbounded_send(TestNetworkEvent::PutCalled(key, value)).unwrap();
@@ -296,14 +275,6 @@ fn publish_discover_cycle() {
let (_dht_event_tx, dht_event_rx) = channel(1000);
let network: Arc = Arc::new(Default::default());
- let node_a_multiaddr = {
- let peer_id = network.local_peer_id();
- let address = network.external_addresses().pop().unwrap();
-
- address.with(multiaddr::Protocol::P2p(
- peer_id.into(),
- ))
- };
let key_store = KeyStore::new();
@@ -365,19 +336,6 @@ fn publish_discover_cycle() {
// Make authority discovery handle the event.
worker.handle_dht_event(dht_event).await;
-
- worker.set_priority_group().await.unwrap();
-
- // Expect authority discovery to set the priority set.
- assert_eq!(network.set_priority_group_call.lock().unwrap().len(), 1);
-
- assert_eq!(
- network.set_priority_group_call.lock().unwrap()[0],
- (
- "authorities".to_string(),
- HashSet::from_iter(vec![node_a_multiaddr.clone()].into_iter())
- )
- );
}.boxed_local().into());
pool.run();
diff --git a/client/basic-authorship/Cargo.toml b/client/basic-authorship/Cargo.toml
index f097d8044f612c1d9d6e2413013a4ef43f36ff92..f8d2c2f16c713dab83e133dc79c6db5dce3aabb3 100644
--- a/client/basic-authorship/Cargo.toml
+++ b/client/basic-authorship/Cargo.toml
@@ -31,6 +31,6 @@ sc-block-builder = { version = "0.8.0", path = "../block-builder" }
sc-proposer-metrics = { version = "0.8.0", path = "../proposer-metrics" }
[dev-dependencies]
-sc-transaction-pool = { version = "2.0.0", path = "../../client/transaction-pool" }
+sc-transaction-pool = { version = "2.0.0", path = "../transaction-pool" }
substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" }
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs
index 065acbde2cc95ea6019afc59f977305315774374..8a7750c69fe2e35ede972730b9804bbdac02f5e6 100644
--- a/client/basic-authorship/src/basic_authorship.rs
+++ b/client/basic-authorship/src/basic_authorship.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/basic-authorship/src/lib.rs b/client/basic-authorship/src/lib.rs
index 2cb66d4ccc40b7129dc8a67762701f8245e82d1b..3bb0a0b7e5c0e1fd017cf17bee9b05c9d04c2a09 100644
--- a/client/basic-authorship/src/lib.rs
+++ b/client/basic-authorship/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/block-builder/src/lib.rs b/client/block-builder/src/lib.rs
index cc1431ea349bf807ca3ea46974cdd64df7e53084..5a7e0277d9e8c61a9e4d41c3c3843e8069a642c9 100644
--- a/client/block-builder/src/lib.rs
+++ b/client/block-builder/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/chain-spec/Cargo.toml b/client/chain-spec/Cargo.toml
index 79f14058aad6def1d0a2224f1491f00deea98873..c47331a62457a889bd07fadccde3dc8a230719e8 100644
--- a/client/chain-spec/Cargo.toml
+++ b/client/chain-spec/Cargo.toml
@@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
sc-chain-spec-derive = { version = "2.0.0", path = "./derive" }
-impl-trait-for-tuples = "0.1.3"
+impl-trait-for-tuples = "0.2.0"
sc-network = { version = "0.8.0", path = "../network" }
sp-core = { version = "2.0.0", path = "../../primitives/core" }
serde = { version = "1.0.101", features = ["derive"] }
diff --git a/client/chain-spec/derive/Cargo.toml b/client/chain-spec/derive/Cargo.toml
index 6826168a206a5e9529b2decaac1d18ece966e7df..9ad50482da46fd082864fde294e6f20b973435da 100644
--- a/client/chain-spec/derive/Cargo.toml
+++ b/client/chain-spec/derive/Cargo.toml
@@ -18,6 +18,6 @@ proc-macro = true
proc-macro-crate = "0.1.4"
proc-macro2 = "1.0.6"
quote = "1.0.3"
-syn = "1.0.7"
+syn = "1.0.58"
[dev-dependencies]
diff --git a/client/chain-spec/derive/src/impls.rs b/client/chain-spec/derive/src/impls.rs
index ded961a6da8159d8cc5f1db8c3c7fe80dc94d77c..bb72270ed551ab5d8df7a6f5035748d8e74d3cd4 100644
--- a/client/chain-spec/derive/src/impls.rs
+++ b/client/chain-spec/derive/src/impls.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use proc_macro2::{Span, TokenStream};
use quote::quote;
diff --git a/client/chain-spec/derive/src/lib.rs b/client/chain-spec/derive/src/lib.rs
index 0dc053f7e301edcd36c4f9057f590d52d13785a2..53f0c69491ecd7a7e60b094d426588996535968e 100644
--- a/client/chain-spec/derive/src/lib.rs
+++ b/client/chain-spec/derive/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Macros to derive chain spec extension traits implementation.
diff --git a/client/chain-spec/src/chain_spec.rs b/client/chain-spec/src/chain_spec.rs
index 39c47e32908df7dae31cb5b61493a82ef2d56f16..2faf95568290e288ef9e2bc54f401ecdd9a6f4c3 100644
--- a/client/chain-spec/src/chain_spec.rs
+++ b/client/chain-spec/src/chain_spec.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/chain-spec/src/extension.rs b/client/chain-spec/src/extension.rs
index c0338203eb10edb822217082c8d81b4a55f24adf..c0352529f86738082657253ad83ab1af333f4bbf 100644
--- a/client/chain-spec/src/extension.rs
+++ b/client/chain-spec/src/extension.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Chain Spec extensions helpers.
diff --git a/client/chain-spec/src/lib.rs b/client/chain-spec/src/lib.rs
index 27657ccb7f8692427b408e34fe89326af729eda6..ee4f757f8cf0e3670f64d064cb0cb7f70e6be8e8 100644
--- a/client/chain-spec/src/lib.rs
+++ b/client/chain-spec/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Substrate chain configurations.
//!
diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml
index 02d14d0d1941c1ac70a52460c9990dbaeb260e02..cd8afb1cce1e4ca191ada218f021157d8ecdcd77 100644
--- a/client/cli/Cargo.toml
+++ b/client/cli/Cargo.toml
@@ -19,7 +19,7 @@ regex = "1.4.2"
tokio = { version = "0.2.21", features = [ "signal", "rt-core", "rt-threaded", "blocking" ] }
futures = "0.3.4"
fdlimit = "0.2.1"
-libp2p = "0.32.2"
+libp2p = "0.33.0"
parity-scale-codec = "1.3.0"
hex = "0.4.2"
rand = "0.7.3"
diff --git a/client/cli/proc-macro/Cargo.toml b/client/cli/proc-macro/Cargo.toml
index 9b9d134c5a83617b3600cf455ef1465e977a6167..9805d87cb30e3dee773a7e6625d393441bf5dfdc 100644
--- a/client/cli/proc-macro/Cargo.toml
+++ b/client/cli/proc-macro/Cargo.toml
@@ -18,4 +18,4 @@ proc-macro = true
proc-macro-crate = "0.1.4"
proc-macro2 = "1.0.6"
quote = { version = "1.0.3", features = ["proc-macro"] }
-syn = { version = "1.0.7", features = ["proc-macro", "full", "extra-traits", "parsing"] }
+syn = { version = "1.0.58", features = ["proc-macro", "full", "extra-traits", "parsing"] }
diff --git a/client/cli/proc-macro/src/lib.rs b/client/cli/proc-macro/src/lib.rs
index 775d1eb96ea383ec0d17e6b20c78795715811e1d..0e2466ec3ae77981988eea05bffc7284dda0808a 100644
--- a/client/cli/proc-macro/src/lib.rs
+++ b/client/cli/proc-macro/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/arg_enums.rs b/client/cli/src/arg_enums.rs
index 85400f2a27759fe3743173239fd44c67a39e9ab8..2ebfa38925e23b232e198e2ae7e6430591f65fb6 100644
--- a/client/cli/src/arg_enums.rs
+++ b/client/cli/src/arg_enums.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/build_spec_cmd.rs b/client/cli/src/commands/build_spec_cmd.rs
index 616c5139f64f0d370373bda2b221bacea8700b6c..3d66e752b81ecb6aa4c0feddcb3aa1269ff2d9a6 100644
--- a/client/cli/src/commands/build_spec_cmd.rs
+++ b/client/cli/src/commands/build_spec_cmd.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/check_block_cmd.rs b/client/cli/src/commands/check_block_cmd.rs
index b536d4f26bb6c875745e0ee180eca07a31158b68..74e2d34f975b2d874cfa15eafbda82d2353e9806 100644
--- a/client/cli/src/commands/check_block_cmd.rs
+++ b/client/cli/src/commands/check_block_cmd.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/export_blocks_cmd.rs b/client/cli/src/commands/export_blocks_cmd.rs
index 497531ad393ba299909703b0104f1ee9fa201e1b..55f05d9d7f3030079b5d4eccae2f4895468ce161 100644
--- a/client/cli/src/commands/export_blocks_cmd.rs
+++ b/client/cli/src/commands/export_blocks_cmd.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/export_state_cmd.rs b/client/cli/src/commands/export_state_cmd.rs
index c078db0d8aea922e23ddfda88112e22f5979bbbe..2211b3131a01362b26c8a700800f55ae8b017eb0 100644
--- a/client/cli/src/commands/export_state_cmd.rs
+++ b/client/cli/src/commands/export_state_cmd.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/generate.rs b/client/cli/src/commands/generate.rs
index 86b039ce6a4c5bd8f3f15fabcb03dfb2c6f42c6d..08b5f20772363bbc1267e84c888f0dd8bc5fc7d6 100644
--- a/client/cli/src/commands/generate.rs
+++ b/client/cli/src/commands/generate.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/client/cli/src/commands/generate_node_key.rs b/client/cli/src/commands/generate_node_key.rs
index ad292e4712d840efa5f015acb6341a0805ba9ebc..ec22c6298adb6f3b2d000b2668734f7be45ca0e5 100644
--- a/client/cli/src/commands/generate_node_key.rs
+++ b/client/cli/src/commands/generate_node_key.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/client/cli/src/commands/import_blocks_cmd.rs b/client/cli/src/commands/import_blocks_cmd.rs
index 00f8ec43b02fe937b26db243ab930adf793e75bc..89f70d06813ce2da2bec94460e87c8fa96a8ca7b 100644
--- a/client/cli/src/commands/import_blocks_cmd.rs
+++ b/client/cli/src/commands/import_blocks_cmd.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/insert.rs b/client/cli/src/commands/insert.rs
deleted file mode 100644
index 8b7fe98fc0b9d31a76d813f384717ea32a8bb8e7..0000000000000000000000000000000000000000
--- a/client/cli/src/commands/insert.rs
+++ /dev/null
@@ -1,94 +0,0 @@
-// This file is part of Substrate.
-
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
-// SPDX-License-Identifier: Apache-2.0
-
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//! Implementation of the `insert` subcommand
-
-use crate::{Error, KeystoreParams, CryptoSchemeFlag, SharedParams, utils, with_crypto_scheme};
-use std::sync::Arc;
-use structopt::StructOpt;
-use sp_core::crypto::KeyTypeId;
-use sp_keystore::{SyncCryptoStorePtr, SyncCryptoStore};
-use std::convert::TryFrom;
-use sc_service::config::KeystoreConfig;
-use sc_keystore::LocalKeystore;
-use sp_core::crypto::SecretString;
-
-/// The `insert` command
-#[derive(Debug, StructOpt)]
-#[structopt(
- name = "insert",
- about = "Insert a key to the keystore of a node."
-)]
-pub struct InsertCmd {
- /// The secret key URI.
- /// If the value is a file, the file content is used as URI.
- /// If not given, you will be prompted for the URI.
- #[structopt(long)]
- suri: Option,
-
- /// Key type, examples: "gran", or "imon"
- #[structopt(long)]
- key_type: String,
-
- #[allow(missing_docs)]
- #[structopt(flatten)]
- pub shared_params: SharedParams,
-
- #[allow(missing_docs)]
- #[structopt(flatten)]
- pub keystore_params: KeystoreParams,
-
- #[allow(missing_docs)]
- #[structopt(flatten)]
- pub crypto_scheme: CryptoSchemeFlag,
-}
-
-impl InsertCmd {
- /// Run the command
- pub fn run(&self) -> Result<(), Error> {
- let suri = utils::read_uri(self.suri.as_ref())?;
- let base_path = self.shared_params.base_path.as_ref()
- .ok_or_else(|| Error::MissingBasePath)?;
-
- let (keystore, public) = match self.keystore_params.keystore_config(base_path)? {
- (_, KeystoreConfig::Path { path, password }) => {
- let public = with_crypto_scheme!(
- self.crypto_scheme.scheme,
- to_vec(&suri, password.clone())
- )?;
- let keystore: SyncCryptoStorePtr = Arc::new(LocalKeystore::open(path, password)?);
- (keystore, public)
- },
- _ => unreachable!("keystore_config always returns path and password; qed")
- };
-
- let key_type = KeyTypeId::try_from(self.key_type.as_str())
- .map_err(|_e| {
- Error::KeyTypeInvalid
- })?;
-
- SyncCryptoStore::insert_unknown(&*keystore, key_type, &suri, &public[..])
- .map_err(|_| Error::KeyStoreOperation)?;
-
- Ok(())
- }
-}
-
-fn to_vec(uri: &str, pass: Option) -> Result, Error> {
- let p = utils::pair_from_suri::
(uri, pass)?;
- Ok(p.public().as_ref().to_vec())
-}
diff --git a/client/cli/src/commands/insert_key.rs b/client/cli/src/commands/insert_key.rs
new file mode 100644
index 0000000000000000000000000000000000000000..90588f96d20b03bd683612d9d72b7cbddb2baf41
--- /dev/null
+++ b/client/cli/src/commands/insert_key.rs
@@ -0,0 +1,173 @@
+// This file is part of Substrate.
+
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: Apache-2.0
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//! Implementation of the `insert` subcommand
+
+use crate::{
+ Error, KeystoreParams, CryptoSchemeFlag, SharedParams, utils, with_crypto_scheme,
+ SubstrateCli,
+};
+use std::{sync::Arc, convert::TryFrom};
+use structopt::StructOpt;
+use sp_core::{crypto::KeyTypeId, crypto::SecretString};
+use sp_keystore::{SyncCryptoStorePtr, SyncCryptoStore};
+use sc_keystore::LocalKeystore;
+use sc_service::config::{KeystoreConfig, BasePath};
+
+/// The `insert` command
+#[derive(Debug, StructOpt)]
+#[structopt(
+ name = "insert",
+ about = "Insert a key to the keystore of a node."
+)]
+pub struct InsertKeyCmd {
+ /// The secret key URI.
+ /// If the value is a file, the file content is used as URI.
+ /// If not given, you will be prompted for the URI.
+ #[structopt(long)]
+ suri: Option,
+
+ /// Key type, examples: "gran", or "imon"
+ #[structopt(long)]
+ key_type: String,
+
+ #[allow(missing_docs)]
+ #[structopt(flatten)]
+ pub shared_params: SharedParams,
+
+ #[allow(missing_docs)]
+ #[structopt(flatten)]
+ pub keystore_params: KeystoreParams,
+
+ #[allow(missing_docs)]
+ #[structopt(flatten)]
+ pub crypto_scheme: CryptoSchemeFlag,
+}
+
+impl InsertKeyCmd {
+ /// Run the command
+ pub fn run(&self, cli: &C) -> Result<(), Error> {
+ let suri = utils::read_uri(self.suri.as_ref())?;
+ let base_path = self.shared_params
+ .base_path()
+ .unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
+ let chain_id = self.shared_params.chain_id(self.shared_params.is_dev());
+ let chain_spec = cli.load_spec(&chain_id)?;
+ let config_dir = base_path.config_dir(chain_spec.id());
+
+ let (keystore, public) = match self.keystore_params.keystore_config(&config_dir)? {
+ (_, KeystoreConfig::Path { path, password }) => {
+ let public = with_crypto_scheme!(
+ self.crypto_scheme.scheme,
+ to_vec(&suri, password.clone())
+ )?;
+ let keystore: SyncCryptoStorePtr = Arc::new(LocalKeystore::open(path, password)?);
+ (keystore, public)
+ },
+ _ => unreachable!("keystore_config always returns path and password; qed")
+ };
+
+ let key_type = KeyTypeId::try_from(self.key_type.as_str()).map_err(|_| Error::KeyTypeInvalid)?;
+
+ SyncCryptoStore::insert_unknown(&*keystore, key_type, &suri, &public[..])
+ .map_err(|_| Error::KeyStoreOperation)?;
+
+ Ok(())
+ }
+}
+
+fn to_vec(uri: &str, pass: Option) -> Result, Error> {
+ let p = utils::pair_from_suri::
(uri, pass)?;
+ Ok(p.public().as_ref().to_vec())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use structopt::StructOpt;
+ use tempfile::TempDir;
+ use sp_core::{sr25519::Pair, Pair as _, Public};
+ use sc_service::{ChainSpec, GenericChainSpec, ChainType, NoExtension};
+
+ struct Cli;
+
+ impl SubstrateCli for Cli {
+ fn impl_name() -> String {
+ "test".into()
+ }
+
+ fn impl_version() -> String {
+ "2.0".into()
+ }
+
+ fn description() -> String {
+ "test".into()
+ }
+
+ fn support_url() -> String {
+ "test.test".into()
+ }
+
+ fn copyright_start_year() -> i32 {
+ 2020
+ }
+
+ fn author() -> String {
+ "test".into()
+ }
+
+ fn native_runtime_version(_: &Box) -> &'static sp_version::RuntimeVersion {
+ unimplemented!("Not required in tests")
+ }
+
+ fn load_spec(&self, _: &str) -> std::result::Result, String> {
+ Ok(
+ Box::new(
+ GenericChainSpec::from_genesis(
+ "test",
+ "test_id",
+ ChainType::Development,
+ || unimplemented!("Not required in tests"),
+ Vec::new(),
+ None,
+ None,
+ None,
+ NoExtension::None,
+ ),
+ ),
+ )
+ }
+ }
+
+ #[test]
+ fn insert_with_custom_base_path() {
+ let path = TempDir::new().unwrap();
+ let path_str = format!("{}", path.path().display());
+ let (key, uri, _) = Pair::generate_with_phrase(None);
+
+ let inspect = InsertKeyCmd::from_iter(
+ &["insert-key", "-d", &path_str, "--key-type", "test", "--suri", &uri],
+ );
+ assert!(inspect.run(&Cli).is_ok());
+
+ let keystore = LocalKeystore::open(
+ path.path().join("chains").join("test_id").join("keystore"),
+ None,
+ ).unwrap();
+ assert!(keystore.has_keys(&[(key.public().to_raw_vec(), KeyTypeId(*b"test"))]));
+ }
+}
diff --git a/client/cli/src/commands/inspect_key.rs b/client/cli/src/commands/inspect_key.rs
index fb3a7ef4f3b4413856ac738abc639d98f10378bc..2642eee88adcdd944b7b3a160417a99841eb433a 100644
--- a/client/cli/src/commands/inspect_key.rs
+++ b/client/cli/src/commands/inspect_key.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/client/cli/src/commands/inspect_node_key.rs b/client/cli/src/commands/inspect_node_key.rs
index be0b88589d5e9dfd2cc84d0a543ba2ccb4cd836f..4db32aefb5fbb51f1cb8e3719f8900e54dc8b275 100644
--- a/client/cli/src/commands/inspect_node_key.rs
+++ b/client/cli/src/commands/inspect_node_key.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/client/cli/src/commands/key.rs b/client/cli/src/commands/key.rs
index e5bce08145cb8bd482b1b150b81be8e3b2a1b5e2..546454159718d6da5f76de6029dd612e6fa14020 100644
--- a/client/cli/src/commands/key.rs
+++ b/client/cli/src/commands/key.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,11 +17,11 @@
//! Key related CLI utilities
-use crate::Error;
+use crate::{Error, SubstrateCli};
use structopt::StructOpt;
use super::{
- insert::InsertCmd,
+ insert_key::InsertKeyCmd,
inspect_key::InspectKeyCmd,
generate::GenerateCmd,
inspect_node_key::InspectNodeKeyCmd,
@@ -45,17 +45,17 @@ pub enum KeySubcommand {
InspectNodeKey(InspectNodeKeyCmd),
/// Insert a key to the keystore of a node.
- Insert(InsertCmd),
+ Insert(InsertKeyCmd),
}
impl KeySubcommand {
/// run the key subcommands
- pub fn run(&self) -> Result<(), Error> {
+ pub fn run(&self, cli: &C) -> Result<(), Error> {
match self {
KeySubcommand::GenerateNodeKey(cmd) => cmd.run(),
KeySubcommand::Generate(cmd) => cmd.run(),
KeySubcommand::InspectKey(cmd) => cmd.run(),
- KeySubcommand::Insert(cmd) => cmd.run(),
+ KeySubcommand::Insert(cmd) => cmd.run(cli),
KeySubcommand::InspectNodeKey(cmd) => cmd.run(),
}
}
diff --git a/client/cli/src/commands/mod.rs b/client/cli/src/commands/mod.rs
index 9867f61cd277fc626144d5ba8d3aedbe73032c3e..8c0d6acd6a51159bc6ec83fe275895ff44a34a51 100644
--- a/client/cli/src/commands/mod.rs
+++ b/client/cli/src/commands/mod.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -28,7 +28,7 @@ mod revert_cmd;
mod run_cmd;
mod generate_node_key;
mod generate;
-mod insert;
+mod insert_key;
mod inspect_node_key;
mod inspect_key;
mod key;
@@ -43,7 +43,7 @@ pub use self::{
purge_chain_cmd::PurgeChainCmd,
sign::SignCmd,
generate::GenerateCmd,
- insert::InsertCmd,
+ insert_key::InsertKeyCmd,
inspect_key::InspectKeyCmd,
generate_node_key::GenerateNodeKeyCmd,
inspect_node_key::InspectNodeKeyCmd,
diff --git a/client/cli/src/commands/purge_chain_cmd.rs b/client/cli/src/commands/purge_chain_cmd.rs
index 9c9c6e91fb2416c56e8a6e9a3894a8a7aeb31c10..1902d92e6345ad166c557e21012097040a2ab71c 100644
--- a/client/cli/src/commands/purge_chain_cmd.rs
+++ b/client/cli/src/commands/purge_chain_cmd.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/revert_cmd.rs b/client/cli/src/commands/revert_cmd.rs
index b2e3c1bf8e2b674e4313253aa6abd2431701d587..2745ce2c652417b53bbadb90ace51e2cf9d207fd 100644
--- a/client/cli/src/commands/revert_cmd.rs
+++ b/client/cli/src/commands/revert_cmd.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs
index 48bad16afb677336772990404841ed1f9f08d1b9..bbb8d6f68d7f97e162efbac1b201a2d49e069407 100644
--- a/client/cli/src/commands/run_cmd.rs
+++ b/client/cli/src/commands/run_cmd.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/sign.rs b/client/cli/src/commands/sign.rs
index 605fd5b12313f0c75fee8eef4951fafe9ee9f680..a39e14697b9956bf577c601b72969e265ba9184f 100644
--- a/client/cli/src/commands/sign.rs
+++ b/client/cli/src/commands/sign.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/utils.rs b/client/cli/src/commands/utils.rs
index 25c7294fd1e0afa906338c85e3f6e8183da25e9a..1bbff392eca435b902729f725a912ee65c69d012 100644
--- a/client/cli/src/commands/utils.rs
+++ b/client/cli/src/commands/utils.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/vanity.rs b/client/cli/src/commands/vanity.rs
index 33b9025c13fbc2e8e3c82a20205ba97ac7a74c5b..da47e8bb26cc870b1eea88048894b3cd2efeef47 100644
--- a/client/cli/src/commands/vanity.rs
+++ b/client/cli/src/commands/vanity.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/commands/verify.rs b/client/cli/src/commands/verify.rs
index 15abc04002f4c891d9be4f655e6915c6b7d28780..f5bd5a06060c6add64815e52d656de5f7d5038f8 100644
--- a/client/cli/src/commands/verify.rs
+++ b/client/cli/src/commands/verify.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/config.rs b/client/cli/src/config.rs
index 4e1ad19fc46f57569459965b26de22681c82e3d8..017d2b421683fd2357b03daacb9cc77a63ffa486 100644
--- a/client/cli/src/config.rs
+++ b/client/cli/src/config.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -22,7 +22,7 @@ use crate::arg_enums::Database;
use crate::error::Result;
use crate::{
init_logger, DatabaseParams, ImportParams, KeystoreParams, NetworkParams, NodeKeyParams,
- OffchainWorkerParams, PruningParams, SharedParams, SubstrateCli,
+ OffchainWorkerParams, PruningParams, SharedParams, SubstrateCli, InitLoggerParams,
};
use log::warn;
use names::{Generator, Name};
@@ -186,11 +186,11 @@ pub trait CliConfiguration: Sized {
/// Get the keystore configuration.
///
- /// Bu default this is retrieved from `KeystoreParams` if it is available. Otherwise it uses
+ /// By default this is retrieved from `KeystoreParams` if it is available. Otherwise it uses
/// `KeystoreConfig::InMemory`.
- fn keystore_config(&self, base_path: &PathBuf) -> Result<(Option, KeystoreConfig)> {
+ fn keystore_config(&self, config_dir: &PathBuf) -> Result<(Option, KeystoreConfig)> {
self.keystore_params()
- .map(|x| x.keystore_config(base_path))
+ .map(|x| x.keystore_config(config_dir))
.unwrap_or_else(|| Ok((None, KeystoreConfig::InMemory)))
}
@@ -454,15 +454,11 @@ pub trait CliConfiguration: Sized {
) -> Result {
let is_dev = self.is_dev()?;
let chain_id = self.chain_id(is_dev)?;
- let chain_spec = cli.load_spec(chain_id.as_str())?;
+ let chain_spec = cli.load_spec(&chain_id)?;
let base_path = self
.base_path()?
.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
- let config_dir = base_path
- .path()
- .to_path_buf()
- .join("chains")
- .join(chain_spec.id());
+ let config_dir = base_path.config_dir(chain_spec.id());
let net_config_dir = config_dir.join(DEFAULT_NETWORK_CONFIG_PATH);
let client_id = C::client_id();
let database_cache_size = self.database_cache_size()?.unwrap_or(128);
@@ -542,6 +538,11 @@ pub trait CliConfiguration: Sized {
Ok(self.shared_params().is_log_filter_reloading_disabled())
}
+ /// Should the log color output be disabled?
+ fn disable_log_color(&self) -> Result {
+ Ok(self.shared_params().disable_log_color())
+ }
+
/// Initialize substrate. This must be done only once per process.
///
/// This method:
@@ -554,15 +555,17 @@ pub trait CliConfiguration: Sized {
let tracing_receiver = self.tracing_receiver()?;
let tracing_targets = self.tracing_targets()?;
let disable_log_reloading = self.is_log_filter_reloading_disabled()?;
+ let disable_log_color = self.disable_log_color()?;
sp_panic_handler::set(&C::support_url(), &C::impl_version());
- init_logger(
- &logger_pattern,
+ init_logger(InitLoggerParams {
+ pattern: logger_pattern,
tracing_receiver,
tracing_targets,
disable_log_reloading,
- )?;
+ disable_log_color,
+ })?;
if let Some(new_limit) = fdlimit::raise_fd_limit() {
if new_limit < RECOMMENDED_OPEN_FILE_DESCRIPTOR_LIMIT {
diff --git a/client/cli/src/error.rs b/client/cli/src/error.rs
index 5190cae2c2ff89edc1b9a3916afe428c3969f51a..75867e2f76b280992b43ee1485515f739abee3df 100644
--- a/client/cli/src/error.rs
+++ b/client/cli/src/error.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -59,9 +59,6 @@ pub enum Error {
expected: usize,
},
- #[error("The base path is missing, please provide one")]
- MissingBasePath,
-
#[error("Unknown key type, must be a known 4-character sequence")]
KeyTypeInvalid,
diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs
index 80882924bd3ad2c67a2e16aba571c5a58bc46640..1402e5e7ae44c64d3e92f8a9c30da49311c78b41 100644
--- a/client/cli/src/lib.rs
+++ b/client/cli/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -112,10 +112,7 @@ pub trait SubstrateCli: Sized {
///
/// Gets the struct from the command line arguments. Print the
/// error message and quit the program in case of failure.
- fn from_args() -> Self
- where
- Self: StructOpt + Sized,
- {
+ fn from_args() -> Self where Self: StructOpt + Sized {
::from_iter(&mut std::env::args_os())
}
@@ -240,30 +237,50 @@ pub trait SubstrateCli: Sized {
fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion;
}
+/// The parameters for [`init_logger`].
+#[derive(Default)]
+pub struct InitLoggerParams {
+ /// A comma seperated list of logging patterns.
+ ///
+ /// E.g.: `test-crate=debug`
+ pub pattern: String,
+ /// The tracing receiver.
+ pub tracing_receiver: sc_tracing::TracingReceiver,
+ /// Optional comma seperated list of tracing targets.
+ pub tracing_targets: Option,
+ /// Should log reloading be disabled?
+ pub disable_log_reloading: bool,
+ /// Should the log color output be disabled?
+ pub disable_log_color: bool,
+}
+
/// Initialize the global logger
///
/// This sets various global logging and tracing instances and thus may only be called once.
pub fn init_logger(
- pattern: &str,
- tracing_receiver: sc_tracing::TracingReceiver,
- profiling_targets: Option,
- disable_log_reloading: bool,
+ InitLoggerParams {
+ pattern,
+ tracing_receiver,
+ tracing_targets,
+ disable_log_reloading,
+ disable_log_color,
+ }: InitLoggerParams,
) -> std::result::Result<(), String> {
use sc_tracing::parse_default_directive;
// Accept all valid directives and print invalid ones
- fn parse_user_directives(mut env_filter: EnvFilter, dirs: &str) -> std::result::Result {
+ fn parse_user_directives(
+ mut env_filter: EnvFilter,
+ dirs: &str,
+ ) -> std::result::Result {
for dir in dirs.split(',') {
env_filter = env_filter.add_directive(parse_default_directive(&dir)?);
}
Ok(env_filter)
}
- if let Err(e) = tracing_log::LogTracer::init() {
- return Err(format!(
- "Registering Substrate logger failed: {:}!", e
- ))
- }
+ tracing_log::LogTracer::init()
+ .map_err(|e| format!("Registering Substrate logger failed: {:}!", e))?;
// Initialize filter - ensure to use `parse_default_directive` for any defaults to persist
// after log filter reloading by RPC
@@ -293,7 +310,7 @@ pub fn init_logger(
if pattern != "" {
// We're not sure if log or tracing is available at this moment, so silently ignore the
// parse error.
- env_filter = parse_user_directives(env_filter, pattern)?;
+ env_filter = parse_user_directives(env_filter, &pattern)?;
}
// If we're only logging `INFO` entries then we'll use a simplified logging format.
@@ -311,11 +328,11 @@ pub fn init_logger(
);
// Make sure to include profiling targets in the filter
- if let Some(profiling_targets) = profiling_targets.clone() {
- env_filter = parse_user_directives(env_filter, &profiling_targets)?;
+ if let Some(tracing_targets) = tracing_targets.clone() {
+ env_filter = parse_user_directives(env_filter, &tracing_targets)?;
}
- let enable_color = atty::is(atty::Stream::Stderr);
+ let enable_color = atty::is(atty::Stream::Stderr) && !disable_log_color;
let timer = ChronoLocal::with_format(if simple {
"%Y-%m-%d %H:%M:%S".to_string()
} else {
@@ -336,7 +353,7 @@ pub fn init_logger(
let subscriber = subscriber_builder
.finish()
.with(logging::NodeNameLayer);
- initialize_tracing(subscriber, tracing_receiver, profiling_targets)
+ initialize_tracing(subscriber, tracing_receiver, tracing_targets)
} else {
let subscriber_builder = subscriber_builder.with_filter_reloading();
let handle = subscriber_builder.reload_handle();
@@ -344,7 +361,7 @@ pub fn init_logger(
let subscriber = subscriber_builder
.finish()
.with(logging::NodeNameLayer);
- initialize_tracing(subscriber, tracing_receiver, profiling_targets)
+ initialize_tracing(subscriber, tracing_receiver, tracing_targets)
}
}
@@ -383,7 +400,9 @@ mod tests {
#[test]
fn test_logger_filters() {
let test_pattern = "afg=debug,sync=trace,client=warn,telemetry,something-with-dash=error";
- init_logger(&test_pattern, Default::default(), Default::default(), false).unwrap();
+ init_logger(
+ InitLoggerParams { pattern: test_pattern.into(), ..Default::default() },
+ ).unwrap();
tracing::dispatcher::get_default(|dispatcher| {
let test_filter = |target, level| {
@@ -442,7 +461,9 @@ mod tests {
fn log_something_with_dash_target_name() {
if env::var("ENABLE_LOGGING").is_ok() {
let test_pattern = "test-target=info";
- init_logger(&test_pattern, Default::default(), Default::default(), false).unwrap();
+ init_logger(
+ InitLoggerParams { pattern: test_pattern.into(), ..Default::default() },
+ ).unwrap();
log::info!(target: "test-target", "{}", EXPECTED_LOG_MESSAGE);
}
@@ -478,7 +499,9 @@ mod tests {
fn prefix_in_log_lines_entrypoint() {
if env::var("ENABLE_LOGGING").is_ok() {
let test_pattern = "test-target=info";
- init_logger(&test_pattern, Default::default(), Default::default(), false).unwrap();
+ init_logger(
+ InitLoggerParams { pattern: test_pattern.into(), ..Default::default() },
+ ).unwrap();
prefix_in_log_lines_process();
}
}
@@ -494,7 +517,7 @@ mod tests {
#[test]
fn do_not_write_with_colors_on_tty_entrypoint() {
if env::var("ENABLE_LOGGING").is_ok() {
- init_logger("", Default::default(), Default::default(), false).unwrap();
+ init_logger(InitLoggerParams::default()).unwrap();
log::info!("{}", ansi_term::Colour::Yellow.paint(EXPECTED_LOG_MESSAGE));
}
}
diff --git a/client/cli/src/params/database_params.rs b/client/cli/src/params/database_params.rs
index 24b23f6076a02302071c76a6da614c8e5c11e6a0..21529f65a56b0b76f6557d31a89e2adb66b4053f 100644
--- a/client/cli/src/params/database_params.rs
+++ b/client/cli/src/params/database_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/params/import_params.rs b/client/cli/src/params/import_params.rs
index 376a72b8421f5446e4ccdfae606145478d329c73..7409dbf79dc0f7b1db5d08bc343ec1e4fbe0c5a5 100644
--- a/client/cli/src/params/import_params.rs
+++ b/client/cli/src/params/import_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/params/keystore_params.rs b/client/cli/src/params/keystore_params.rs
index f03fafeb965c0bb3489972816bd7adc18192b48e..d75cdebc5a56839db2a9104a12da7fc8f346825e 100644
--- a/client/cli/src/params/keystore_params.rs
+++ b/client/cli/src/params/keystore_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -18,8 +18,7 @@
use crate::error::Result;
use sc_service::config::KeystoreConfig;
-use std::fs;
-use std::path::PathBuf;
+use std::{fs, path::{PathBuf, Path}};
use structopt::StructOpt;
use crate::error;
use sp_core::crypto::SecretString;
@@ -33,6 +32,7 @@ pub struct KeystoreParams {
/// Specify custom URIs to connect to for keystore-services
#[structopt(long = "keystore-uri")]
pub keystore_uri: Option,
+
/// Specify custom keystore path.
#[structopt(long = "keystore-path", value_name = "PATH", parse(from_os_str))]
pub keystore_path: Option,
@@ -64,15 +64,14 @@ pub struct KeystoreParams {
/// Parse a sercret string, returning a displayable error.
pub fn secret_string_from_str(s: &str) -> std::result::Result {
- Ok(std::str::FromStr::from_str(s)
- .map_err(|_e| "Could not get SecretString".to_string())?)
+ std::str::FromStr::from_str(s).map_err(|_| "Could not get SecretString".to_string())
}
impl KeystoreParams {
/// Get the keystore configuration for the parameters
- /// returns a vector of remote-urls and the local Keystore configuration
- pub fn keystore_config(&self, base_path: &PathBuf) -> Result<(Option, KeystoreConfig)> {
-
+ ///
+ /// Returns a vector of remote-urls and the local Keystore configuration
+ pub fn keystore_config(&self, config_dir: &Path) -> Result<(Option, KeystoreConfig)> {
let password = if self.password_interactive {
#[cfg(not(target_os = "unknown"))]
{
@@ -92,7 +91,7 @@ impl KeystoreParams {
let path = self
.keystore_path
.clone()
- .unwrap_or_else(|| base_path.join(DEFAULT_KEYSTORE_CONFIG_PATH));
+ .unwrap_or_else(|| config_dir.join(DEFAULT_KEYSTORE_CONFIG_PATH));
Ok((self.keystore_uri.clone(), KeystoreConfig::Path { path, password }))
}
diff --git a/client/cli/src/params/mod.rs b/client/cli/src/params/mod.rs
index 93467bc8ec63778e95d116b57cf8b6dc92c12636..8308b123f71f3c5e83fa709cf4ddbc9d910df132 100644
--- a/client/cli/src/params/mod.rs
+++ b/client/cli/src/params/mod.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/params/network_params.rs b/client/cli/src/params/network_params.rs
index a973d61272ced7c47c65121f50e6c18054cc3416..130325a7f9d4fa588dbd7882d0d460b35e1d0e54 100644
--- a/client/cli/src/params/network_params.rs
+++ b/client/cli/src/params/network_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -18,7 +18,7 @@
use crate::params::node_key_params::NodeKeyParams;
use sc_network::{
- config::{NetworkConfiguration, NodeKeyConfig, NonReservedPeerMode, TransportConfig},
+ config::{NetworkConfiguration, NodeKeyConfig, NonReservedPeerMode, SetConfig, TransportConfig},
multiaddr::Protocol,
};
use sc_service::{ChainSpec, ChainType, config::{Multiaddr, MultiaddrWithPeerId}};
@@ -150,21 +150,23 @@ impl NetworkParams {
NetworkConfiguration {
boot_nodes,
net_config_path,
- reserved_nodes: self.reserved_nodes.clone(),
- non_reserved_mode: if self.reserved_only {
- NonReservedPeerMode::Deny
- } else {
- NonReservedPeerMode::Accept
+ default_peers_set: SetConfig {
+ in_peers: self.in_peers,
+ out_peers: self.out_peers,
+ reserved_nodes: self.reserved_nodes.clone(),
+ non_reserved_mode: if self.reserved_only {
+ NonReservedPeerMode::Deny
+ } else {
+ NonReservedPeerMode::Accept
+ },
},
listen_addresses,
public_addresses,
- notifications_protocols: Vec::new(),
+ extra_sets: Vec::new(),
request_response_protocols: Vec::new(),
node_key,
node_name: node_name.to_string(),
client_version: client_id.to_string(),
- in_peers: self.in_peers,
- out_peers: self.out_peers,
transport: TransportConfig::Normal {
enable_mdns: !is_dev && !self.no_mdns,
allow_private_ipv4: !self.no_private_ipv4,
diff --git a/client/cli/src/params/node_key_params.rs b/client/cli/src/params/node_key_params.rs
index 875411fbfb62000d3e8c5bfc00cce52d3082fa04..d43c87804dd3ba1404e5a3753effa5e3a63e8b09 100644
--- a/client/cli/src/params/node_key_params.rs
+++ b/client/cli/src/params/node_key_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/params/offchain_worker_params.rs b/client/cli/src/params/offchain_worker_params.rs
index f8d48edc4729d5f97e4f389fe78dd3cd794423b9..ef39a1ed41be26bb8f94e5391fbcff1d62006f7f 100644
--- a/client/cli/src/params/offchain_worker_params.rs
+++ b/client/cli/src/params/offchain_worker_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/params/pruning_params.rs b/client/cli/src/params/pruning_params.rs
index 7db808e6d8f2f8e249ff0e057a05297bfcf92a72..80118cafd8769b40c2dc4204b8b4b9de9bb9dbcf 100644
--- a/client/cli/src/params/pruning_params.rs
+++ b/client/cli/src/params/pruning_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/params/shared_params.rs b/client/cli/src/params/shared_params.rs
index 52b1488ea9ccdf9383f2dd6222a478e9b3528fb4..45ce41846bf120319e3b2952ae112340938b3ac4 100644
--- a/client/cli/src/params/shared_params.rs
+++ b/client/cli/src/params/shared_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -46,6 +46,10 @@ pub struct SharedParams {
#[structopt(short = "l", long, value_name = "LOG_PATTERN")]
pub log: Vec,
+ /// Disable log color output.
+ #[structopt(long)]
+ pub disable_log_color: bool,
+
/// Disable feature to dynamically update and reload the log filter.
///
/// By default this feature is enabled, however it leads to a small performance decrease.
@@ -99,6 +103,11 @@ impl SharedParams {
&self.log
}
+ /// Should the log color output be disabled?
+ pub fn disable_log_color(&self) -> bool {
+ self.disable_log_color
+ }
+
/// Is log reloading disabled
pub fn is_log_filter_reloading_disabled(&self) -> bool {
self.disable_log_reloading
diff --git a/client/cli/src/params/transaction_pool_params.rs b/client/cli/src/params/transaction_pool_params.rs
index 3ad278426922ec99ccc42e192cbda9db1d04207b..bf0ed53e531c9745dcd8351b9edebd0a55808997 100644
--- a/client/cli/src/params/transaction_pool_params.rs
+++ b/client/cli/src/params/transaction_pool_params.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/cli/src/runner.rs b/client/cli/src/runner.rs
index e6d35282ada2b491cacbe2b9a112b5cba82bd968..9836471fb9fa2ddd413aeb2c76d7df677a2d8ca3 100644
--- a/client/cli/src/runner.rs
+++ b/client/cli/src/runner.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml
index ccc4d515a8e1104ebbd058abeec0595e6ba6be21..b7bdf220d90c5e5bf74b07b65abec294e8fe3e65 100644
--- a/client/consensus/aura/Cargo.toml
+++ b/client/consensus/aura/Cargo.toml
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
sp-application-crypto = { version = "2.0.0", path = "../../../primitives/application-crypto" }
sp-consensus-aura = { version = "0.8.0", path = "../../../primitives/consensus/aura" }
sp-block-builder = { version = "2.0.0", path = "../../../primitives/block-builder" }
-sc-block-builder = { version = "0.8.0", path = "../../../client/block-builder" }
+sc-block-builder = { version = "0.8.0", path = "../../block-builder" }
sc-client-api = { version = "2.0.0", path = "../../api" }
codec = { package = "parity-scale-codec", version = "1.3.4" }
sp-consensus = { version = "0.8.0", path = "../../../primitives/consensus/common" }
@@ -25,7 +25,7 @@ futures = "0.3.4"
futures-timer = "3.0.1"
sp-inherents = { version = "2.0.0", path = "../../../primitives/inherents" }
log = "0.4.8"
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
sp-core = { version = "2.0.0", path = "../../../primitives/core" }
sp-blockchain = { version = "2.0.0", path = "../../../primitives/blockchain" }
sp-io = { version = "2.0.0", path = "../../../primitives/io" }
@@ -37,6 +37,9 @@ sp-timestamp = { version = "2.0.0", path = "../../../primitives/timestamp" }
sp-keystore = { version = "0.8.0", path = "../../../primitives/keystore" }
sc-telemetry = { version = "2.0.0", path = "../../telemetry" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0"}
+# We enable it only for web-wasm check
+# See https://docs.rs/getrandom/0.2.1/getrandom/#webassembly-support
+getrandom = { version = "0.2", features = ["js"], optional = true }
[dev-dependencies]
sp-keyring = { version = "2.0.0", path = "../../../primitives/keyring" }
diff --git a/client/consensus/aura/src/digests.rs b/client/consensus/aura/src/digests.rs
index 3332e4c6a6dff99f2ee9ad367031fde15a33ada6..fec412b62d1eaf3b38f696a12510fdeeab31832f 100644
--- a/client/consensus/aura/src/digests.rs
+++ b/client/consensus/aura/src/digests.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs
index b36af788a4f6e5b4dbb38f7bc91d9d67e30f4ebb..8886496a6c10b76709c5880f3706fde9339f46a7 100644
--- a/client/consensus/aura/src/lib.rs
+++ b/client/consensus/aura/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -256,7 +256,7 @@ where
) -> Option {
let expected_author = slot_author::
(slot_number, epoch_data);
expected_author.and_then(|p| {
- if SyncCryptoStore::has_keys(
+ if SyncCryptoStore::has_keys(
&*self.keystore,
&[(p.to_raw_vec(), sp_application_crypto::key_types::AURA)],
) {
diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml
index 2178f1cf970108ef935194baf1013dee182c3b55..1b97ba68cc8468a1e192afc2917036e7f59c24de 100644
--- a/client/consensus/babe/Cargo.toml
+++ b/client/consensus/babe/Cargo.toml
@@ -44,7 +44,7 @@ fork-tree = { version = "2.0.0", path = "../../../utils/fork-tree" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0"}
futures = "0.3.4"
futures-timer = "3.0.1"
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
log = "0.4.8"
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated"] }
rand = "0.7.2"
diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs
index a90964cdf73f71860365d08a8f4067939e5dfea5..4d5c091e0cbbd88add7aa93d17aeef63e418a790 100644
--- a/client/consensus/babe/rpc/src/lib.rs
+++ b/client/consensus/babe/rpc/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/babe/src/authorship.rs b/client/consensus/babe/src/authorship.rs
index 28a3692958e180430ba7a847505bdac5c68a8e0a..90ad12c4558c828cab7610b61c497ccabac9a361 100644
--- a/client/consensus/babe/src/authorship.rs
+++ b/client/consensus/babe/src/authorship.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! BABE authority selection and slot claiming.
diff --git a/client/consensus/babe/src/aux_schema.rs b/client/consensus/babe/src/aux_schema.rs
index 287121566a417247b835a6c8be55c781ecafb304..d399a12ea8a5b63f6d9c1c6da8235ea3a0a56475 100644
--- a/client/consensus/babe/src/aux_schema.rs
+++ b/client/consensus/babe/src/aux_schema.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Schema for BABE epoch changes in the aux-db.
diff --git a/client/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs
index a77158ed8471485b37039562aaf0a8d6392b0743..af7d900e210504b3c2e0be6079abe9680bf09a71 100644
--- a/client/consensus/babe/src/lib.rs
+++ b/client/consensus/babe/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! # BABE (Blind Assignment for Blockchain Extension)
//!
@@ -342,6 +344,11 @@ impl Config {
}
}
}
+
+ /// Get the inner slot duration, in milliseconds.
+ pub fn slot_duration(&self) -> u64 {
+ self.0.slot_duration()
+ }
}
impl std::ops::Deref for Config {
diff --git a/client/consensus/babe/src/tests.rs b/client/consensus/babe/src/tests.rs
index 4784a0254f1ae534546f6d6a13509310d08d5d51..3d411bc9f1b08e5be9a9fcbf1933a5be6f917d66 100644
--- a/client/consensus/babe/src/tests.rs
+++ b/client/consensus/babe/src/tests.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! BABE testsuite
diff --git a/client/consensus/babe/src/verification.rs b/client/consensus/babe/src/verification.rs
index fd3c27be4f34ef9bb00ba1ef12a4215d0e2a313d..47c4da0834d096c55c0cdf7c11b5e9c492ecd572 100644
--- a/client/consensus/babe/src/verification.rs
+++ b/client/consensus/babe/src/verification.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Verification for BABE headers.
use sp_runtime::{traits::Header, traits::DigestItemFor};
diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs
index 1d9b072cfe964f168ac471b2bfcf3cac29009048..a53517c5c35ead9aa8d11c9280972564025251a2 100644
--- a/client/consensus/common/src/lib.rs
+++ b/client/consensus/common/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Collection of common consensus specific implementations
mod longest_chain;
diff --git a/client/consensus/common/src/longest_chain.rs b/client/consensus/common/src/longest_chain.rs
index 981dbad0f607029671b7ad858f2327578fa24e94..8cf32a1dbd3c1587ea61dd9bb3fb23b40c71ddad 100644
--- a/client/consensus/common/src/longest_chain.rs
+++ b/client/consensus/common/src/longest_chain.rs
@@ -1,18 +1,21 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
+
//! Longest chain implementation
use std::sync::Arc;
@@ -98,4 +101,4 @@ impl SelectChain for LongestChain
self.backend.blockchain().best_containing(target_hash, maybe_max_number, import_lock)
.map_err(|e| ConsensusError::ChainLookup(e.to_string()).into())
}
-}
\ No newline at end of file
+}
diff --git a/client/consensus/epochs/Cargo.toml b/client/consensus/epochs/Cargo.toml
index d50ec29ed9c6e19a054d0b488e3d83bf2b13eb61..b7de4494bf7a5735bffe855629e076303b8f83fe 100644
--- a/client/consensus/epochs/Cargo.toml
+++ b/client/consensus/epochs/Cargo.toml
@@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", features = ["derive"] }
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
fork-tree = { version = "2.0.0", path = "../../../utils/fork-tree" }
sp-runtime = { path = "../../../primitives/runtime" , version = "2.0.0"}
sp-blockchain = { version = "2.0.0", path = "../../../primitives/blockchain" }
diff --git a/client/consensus/epochs/src/lib.rs b/client/consensus/epochs/src/lib.rs
index acb07dd668a3c4f3b2c7a2350451d9ac93008926..76e8c8ed5419d3d013407d15648329978449358d 100644
--- a/client/consensus/epochs/src/lib.rs
+++ b/client/consensus/epochs/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Generic utilities for epoch-based consensus engines.
diff --git a/client/consensus/epochs/src/migration.rs b/client/consensus/epochs/src/migration.rs
index e4717b5584e0ec67801ce3d264e90ff350286deb..6e7baba8053af65bfa06cd983b675b90e851d870 100644
--- a/client/consensus/epochs/src/migration.rs
+++ b/client/consensus/epochs/src/migration.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Migration types for epoch changes.
diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml
index d50cb593652691ab378fcd055d8b7cdc423c32c1..80dbed3668c03c6308a0ace33b1fcf87b4c648e1 100644
--- a/client/consensus/manual-seal/Cargo.toml
+++ b/client/consensus/manual-seal/Cargo.toml
@@ -19,7 +19,7 @@ jsonrpc-core = "15.1.0"
jsonrpc-core-client = "15.1.0"
jsonrpc-derive = "15.1.0"
log = "0.4.8"
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
codec = { package = "parity-scale-codec", version = "1.3.1" }
serde = { version = "1.0", features=["derive"] }
assert_matches = "1.3.0"
diff --git a/client/consensus/manual-seal/src/consensus.rs b/client/consensus/manual-seal/src/consensus.rs
index 7bafeb50207d486f93055c20e5bfe2649586e743..0cfd99cab5c99419c219b2a6483efa2a30299780 100644
--- a/client/consensus/manual-seal/src/consensus.rs
+++ b/client/consensus/manual-seal/src/consensus.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/manual-seal/src/consensus/babe.rs b/client/consensus/manual-seal/src/consensus/babe.rs
index c2fdf6243c30407504a74b0aba4fd370b9595e3d..1566b647f2c01556acf9a1bc3388c4aaa406eecf 100644
--- a/client/consensus/manual-seal/src/consensus/babe.rs
+++ b/client/consensus/manual-seal/src/consensus/babe.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/manual-seal/src/error.rs b/client/consensus/manual-seal/src/error.rs
index e2628008c24c7c2a3c203af47c0088ea635d13b5..77140c835a3eea86c651f841de8b3c03ca25630a 100644
--- a/client/consensus/manual-seal/src/error.rs
+++ b/client/consensus/manual-seal/src/error.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/manual-seal/src/finalize_block.rs b/client/consensus/manual-seal/src/finalize_block.rs
index 5780a25f97256331eb1d11b2370dd838ec112ac7..76ae6eeeae5aceebab426be0af8c7f66f13c3aa5 100644
--- a/client/consensus/manual-seal/src/finalize_block.rs
+++ b/client/consensus/manual-seal/src/finalize_block.rs
@@ -1,18 +1,20 @@
-// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Block finalization utilities
diff --git a/client/consensus/manual-seal/src/lib.rs b/client/consensus/manual-seal/src/lib.rs
index b5c037a212539b80086f0b8db7fcaea5f7427208..ba14cac54c632afafb70efd8f4388e668959c309 100644
--- a/client/consensus/manual-seal/src/lib.rs
+++ b/client/consensus/manual-seal/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/manual-seal/src/rpc.rs b/client/consensus/manual-seal/src/rpc.rs
index 77188ad909353cdf9b48fa431c14e16de884374e..eb056f22fed8b2ef090838315b36bec38efc697f 100644
--- a/client/consensus/manual-seal/src/rpc.rs
+++ b/client/consensus/manual-seal/src/rpc.rs
@@ -1,18 +1,20 @@
-// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! RPC interface for the `ManualSeal` Engine.
diff --git a/client/consensus/manual-seal/src/seal_block.rs b/client/consensus/manual-seal/src/seal_block.rs
index a4afaa343e9052561204a60cadf731907c863c73..59b99349bf9b2a6b6834d6d8f166be8738bfbd95 100644
--- a/client/consensus/manual-seal/src/seal_block.rs
+++ b/client/consensus/manual-seal/src/seal_block.rs
@@ -1,18 +1,20 @@
-// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Block sealing utilities
diff --git a/client/consensus/pow/Cargo.toml b/client/consensus/pow/Cargo.toml
index fbb02ccc71121a1855932dffb624a765593dbbb4..cd4d12c37188d2bbc3fd13855df60909fecfef12 100644
--- a/client/consensus/pow/Cargo.toml
+++ b/client/consensus/pow/Cargo.toml
@@ -26,7 +26,7 @@ sp-consensus = { version = "0.8.0", path = "../../../primitives/consensus/common
log = "0.4.8"
futures = { version = "0.3.1", features = ["compat"] }
futures-timer = "3.0.1"
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
sp-timestamp = { version = "2.0.0", path = "../../../primitives/timestamp" }
derive_more = "0.99.2"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0"}
diff --git a/client/consensus/pow/src/lib.rs b/client/consensus/pow/src/lib.rs
index cf1201b2f0b874cc678cd642015cff782ed0d0d0..26fd2c92d2a7ed5af1376bf0f9bbe9c63fc8ffb0 100644
--- a/client/consensus/pow/src/lib.rs
+++ b/client/consensus/pow/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/pow/src/worker.rs b/client/consensus/pow/src/worker.rs
index 4ed863dcd9ed986e6045ac1a96061a03b030a3b7..c19c5524d9774cf84863845ed911c8a8e160d5c4 100644
--- a/client/consensus/pow/src/worker.rs
+++ b/client/consensus/pow/src/worker.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml
index e8bd1f33631eaecfa4ddbfc65ea449dff8219690..35b08444d45dc3360c60637c37a95da8e85eb58d 100644
--- a/client/consensus/slots/Cargo.toml
+++ b/client/consensus/slots/Cargo.toml
@@ -30,7 +30,7 @@ sp-consensus = { version = "0.8.0", path = "../../../primitives/consensus/common
sp-inherents = { version = "2.0.0", path = "../../../primitives/inherents" }
futures = "0.3.4"
futures-timer = "3.0.1"
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
log = "0.4.11"
thiserror = "1.0.21"
diff --git a/client/consensus/slots/build.rs b/client/consensus/slots/build.rs
index 513cc234d4363a854961db1efdea1cbc7007ce56..57424f016f3e520e98345432cc105469a43efefc 100644
--- a/client/consensus/slots/build.rs
+++ b/client/consensus/slots/build.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use std::env;
diff --git a/client/consensus/slots/src/aux_schema.rs b/client/consensus/slots/src/aux_schema.rs
index 1f1fe37068f82b2fef9c789bf0877068d0b1d0c3..c8095f238ec8cefb9235c314650189d61787bfab 100644
--- a/client/consensus/slots/src/aux_schema.rs
+++ b/client/consensus/slots/src/aux_schema.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Schema for slots in the aux-db.
diff --git a/client/consensus/slots/src/lib.rs b/client/consensus/slots/src/lib.rs
index 571766bc44b1ae3c584f384fd7872ff4c4c535e4..93d3614584f8f2b196afa4c107fb385d07a2adb1 100644
--- a/client/consensus/slots/src/lib.rs
+++ b/client/consensus/slots/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Slots functionality for Substrate.
//!
diff --git a/client/consensus/slots/src/slots.rs b/client/consensus/slots/src/slots.rs
index e7c84a2c1fd283e437566a342e62cb3c75fe4e3f..0c93e16461ccb1c4783bdcce95bc06c5398b825b 100644
--- a/client/consensus/slots/src/slots.rs
+++ b/client/consensus/slots/src/slots.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Utility stream for yielding slots in a loop.
//!
diff --git a/client/consensus/uncles/src/lib.rs b/client/consensus/uncles/src/lib.rs
index 2a129b200063b97db9cd1bc8b3811d8b16abd75c..f38849300d0da2edf2a70cce0b6ff1c0556ddab1 100644
--- a/client/consensus/uncles/src/lib.rs
+++ b/client/consensus/uncles/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Uncles functionality for Substrate.
#![forbid(unsafe_code, missing_docs)]
diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml
index 70a0b19532593cb689c14320d7f44eb5906cf3d0..e5f5a59be9f5a8467bd37fad913d710fade0be76 100644
--- a/client/db/Cargo.toml
+++ b/client/db/Cargo.toml
@@ -13,14 +13,14 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
log = "0.4.8"
-kvdb = "0.7.0"
-kvdb-rocksdb = { version = "0.9.1", optional = true }
-kvdb-memorydb = "0.7.0"
+kvdb = "0.8.0"
+kvdb-rocksdb = { version = "0.10.0", optional = true }
+kvdb-memorydb = "0.8.0"
linked-hash-map = "0.5.2"
hash-db = "0.15.2"
-parity-util-mem = { version = "0.7.0", default-features = false, features = ["std"] }
+parity-util-mem = { version = "0.8.0", default-features = false, features = ["std"] }
codec = { package = "parity-scale-codec", version = "1.3.4", features = ["derive"] }
blake2-rfc = "0.2.18"
@@ -43,7 +43,7 @@ sp-keyring = { version = "2.0.0", path = "../../primitives/keyring" }
sp-tracing = { version = "2.0.0", path = "../../primitives/tracing" }
substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" }
quickcheck = "0.9"
-kvdb-rocksdb = "0.9.1"
+kvdb-rocksdb = "0.10.0"
tempfile = "3"
[features]
diff --git a/client/db/src/bench.rs b/client/db/src/bench.rs
index 5696922b4fbb3006689a01f602c65554e81f8511..f0c187bd379f13071828e7fd337a82729dcb3e54 100644
--- a/client/db/src/bench.rs
+++ b/client/db/src/bench.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/cache/list_cache.rs b/client/db/src/cache/list_cache.rs
index 15ad339b1f2c1a387fd3e5dbac70eaef5df3a79b..341105b16a5b3f324fa35102a4e6085e8a6d1a78 100644
--- a/client/db/src/cache/list_cache.rs
+++ b/client/db/src/cache/list_cache.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/cache/list_entry.rs b/client/db/src/cache/list_entry.rs
index d14fab9274ccb830694082491b5f16bcf27ecf2b..94d4eb9f49b2739c3a0325da899c8a7b57dc3ad6 100644
--- a/client/db/src/cache/list_entry.rs
+++ b/client/db/src/cache/list_entry.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/cache/list_storage.rs b/client/db/src/cache/list_storage.rs
index 377d744effa60faf57521d2a490852ef757ce1bf..e4b3677b4ab310de91323f0a208ec6a327c57115 100644
--- a/client/db/src/cache/list_storage.rs
+++ b/client/db/src/cache/list_storage.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/cache/mod.rs b/client/db/src/cache/mod.rs
index 5501f0f1864c156745c6a3e63e4d8ced9a1cf25c..005d25b90f933491a7dde3a62ae7041a8c155a13 100644
--- a/client/db/src/cache/mod.rs
+++ b/client/db/src/cache/mod.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/changes_tries_storage.rs b/client/db/src/changes_tries_storage.rs
index 14518fe7c9d0a21e82f610ea348b982f4ea693ba..365c167d64808547a889c294634720d80fbba501 100644
--- a/client/db/src/changes_tries_storage.rs
+++ b/client/db/src/changes_tries_storage.rs
@@ -1,18 +1,20 @@
-// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! DB-backed changes tries storage.
diff --git a/client/db/src/children.rs b/client/db/src/children.rs
index bfba797cd467bdbc3f7a1db5d23b7f97511b5be5..62352e6d0614aced3ca0fccee9c33b47a258befe 100644
--- a/client/db/src/children.rs
+++ b/client/db/src/children.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Functionality for reading and storing children hashes from db.
diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs
index d938f41760c8319fcf00cdc116ee02d0da532025..21033dadc13e74e12a9e7d8bf9555abadafe7770 100644
--- a/client/db/src/lib.rs
+++ b/client/db/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/light.rs b/client/db/src/light.rs
index acfb6217ce9e034dd66324e34642aa78eb0a8a95..91f37dd374d9f8912f40529cf1bbe89acc58288c 100644
--- a/client/db/src/light.rs
+++ b/client/db/src/light.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/offchain.rs b/client/db/src/offchain.rs
index c4f0ce115ca54f1453e857cc34b96fd26918f8a8..aead4397343ea32c23142988ad9c1b36e3d94780 100644
--- a/client/db/src/offchain.rs
+++ b/client/db/src/offchain.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/parity_db.rs b/client/db/src/parity_db.rs
index 313069706f33f5128004ada17d58ab241855227f..e56ca4de6cb78d028dd527ad098c1c5ee001f085 100644
--- a/client/db/src/parity_db.rs
+++ b/client/db/src/parity_db.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/stats.rs b/client/db/src/stats.rs
index 8d208024b4bb29a1f064dfc00f3fa14b8df07f85..3fd93db931d029fcb2a8da73fa75f674f6a5b438 100644
--- a/client/db/src/stats.rs
+++ b/client/db/src/stats.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/db/src/storage_cache.rs b/client/db/src/storage_cache.rs
index 292d3c5162601af1ee02a0463406e62895be4fd9..bbbc8413be797923549973b54b04358f944df12b 100644
--- a/client/db/src/storage_cache.rs
+++ b/client/db/src/storage_cache.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Global cache state.
diff --git a/client/db/src/upgrade.rs b/client/db/src/upgrade.rs
index 95592d071f777db07cf15e8e2765225f0756bfb2..e87b11b69660cae962f34fa9f11ec27ee602967b 100644
--- a/client/db/src/upgrade.rs
+++ b/client/db/src/upgrade.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Database upgrade logic.
diff --git a/client/db/src/utils.rs b/client/db/src/utils.rs
index e999469c18ff0c96f40580f0ed1192aae5a5268a..dfc1e945b3a4cfa0c3e79e1713e9c99a0b33cf91 100644
--- a/client/db/src/utils.rs
+++ b/client/db/src/utils.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/Cargo.toml b/client/executor/Cargo.toml
index c5ce4b86e12f5a0e05f4da82bf7bf463fe845ff4..44eb6b98b05678b6bd80dd1e5c41ae09a671dbdb 100644
--- a/client/executor/Cargo.toml
+++ b/client/executor/Cargo.toml
@@ -33,7 +33,7 @@ sp-externalities = { version = "0.8.0", path = "../../primitives/externalities"
sc-executor-common = { version = "0.8.0", path = "common" }
sc-executor-wasmi = { version = "0.8.0", path = "wasmi" }
sc-executor-wasmtime = { version = "0.8.0", path = "wasmtime", optional = true }
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
log = "0.4.8"
libsecp256k1 = "0.3.4"
@@ -44,12 +44,12 @@ hex-literal = "0.3.1"
sc-runtime-test = { version = "2.0.0", path = "runtime-test" }
substrate-test-runtime = { version = "2.0.0", path = "../../test-utils/runtime" }
sp-state-machine = { version = "0.8.0", path = "../../primitives/state-machine" }
-test-case = "0.3.3"
sp-runtime = { version = "2.0.0", path = "../../primitives/runtime" }
sp-tracing = { version = "2.0.0", path = "../../primitives/tracing" }
sc-tracing = { version = "2.0.0", path = "../tracing" }
tracing = "0.1.22"
tracing-subscriber = "0.2.15"
+paste = "0.1.6"
[features]
default = [ "std" ]
diff --git a/client/executor/common/src/error.rs b/client/executor/common/src/error.rs
index df0eaf8cc26101c7f611bf2f1ee46d07fd1fe6ee..0af148fd95809ef1d4c6de2f214fb647051d88a4 100644
--- a/client/executor/common/src/error.rs
+++ b/client/executor/common/src/error.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/common/src/lib.rs b/client/executor/common/src/lib.rs
index df839d4ab65232bc0552e18864fdc2ab16903c12..050bad27d6c3056a7510ce8dd1bbebfa942b87eb 100644
--- a/client/executor/common/src/lib.rs
+++ b/client/executor/common/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! A set of common definitions that are needed for defining execution engines.
diff --git a/client/executor/common/src/sandbox.rs b/client/executor/common/src/sandbox.rs
index b2c35b758271829c8771034da08aee46c52dd3db..8ed294bb83983099f5363c4573d2fb0cb61529ba 100644
--- a/client/executor/common/src/sandbox.rs
+++ b/client/executor/common/src/sandbox.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/common/src/util.rs b/client/executor/common/src/util.rs
index 564f9dadcbec691e1344872f330a30bd3c543740..5947be4469cd07211b54e82eb5aaacf7c59a4473 100644
--- a/client/executor/common/src/util.rs
+++ b/client/executor/common/src/util.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/common/src/wasm_runtime.rs b/client/executor/common/src/wasm_runtime.rs
index c407d9967cbf9839941772f17b9f75c74a89ea48..cca0d99c4b91cb5eee9e70cf033897d7a0465780 100644
--- a/client/executor/common/src/wasm_runtime.rs
+++ b/client/executor/common/src/wasm_runtime.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Definitions for a wasm runtime.
diff --git a/client/executor/runtime-test/build.rs b/client/executor/runtime-test/build.rs
index a83de21db7f0f387534d6feab29fbfc325474a90..9456d6bc90f4cf567d35a85765a9b0132233e2e9 100644
--- a/client/executor/runtime-test/build.rs
+++ b/client/executor/runtime-test/build.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use substrate_wasm_builder::WasmBuilder;
diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs
index 0a00375145fbad9365532720ff68456ff308caea..661d2c5d3d352052190d33329942acdf22aba560 100644
--- a/client/executor/src/integration_tests/mod.rs
+++ b/client/executor/src/integration_tests/mod.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -26,7 +26,6 @@ use sp_core::{
};
use sc_runtime_test::wasm_binary_unwrap;
use sp_state_machine::TestExternalities as CoreTestExternalities;
-use test_case::test_case;
use sp_trie::{TrieConfiguration, trie_types::Layout};
use sp_wasm_interface::HostFunctions as _;
use sp_runtime::traits::BlakeTwo256;
@@ -37,6 +36,34 @@ use crate::WasmExecutionMethod;
pub type TestExternalities = CoreTestExternalities;
type HostFunctions = sp_io::SubstrateHostFunctions;
+/// Simple macro that runs a given method as test with the available wasm execution methods.
+#[macro_export]
+macro_rules! test_wasm_execution {
+ ($method_name:ident) => {
+ paste::item! {
+ #[test]
+ fn [<$method_name _interpreted>]() {
+ $method_name(WasmExecutionMethod::Interpreted);
+ }
+
+ #[test]
+ #[cfg(feature = "wasmtime")]
+ fn [<$method_name _compiled>]() {
+ $method_name(WasmExecutionMethod::Compiled);
+ }
+ }
+ };
+
+ (interpreted_only $method_name:ident) => {
+ paste::item! {
+ #[test]
+ fn [<$method_name _interpreted>]() {
+ $method_name(WasmExecutionMethod::Interpreted);
+ }
+ }
+ };
+}
+
fn call_in_wasm(
function: &str,
call_data: &[u8],
@@ -59,8 +86,7 @@ fn call_in_wasm(
)
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(returning_should_work);
fn returning_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -74,8 +100,7 @@ fn returning_should_work(wasm_method: WasmExecutionMethod) {
assert_eq!(output, vec![0u8; 0]);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(call_not_existing_function);
fn call_not_existing_function(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -102,8 +127,7 @@ fn call_not_existing_function(wasm_method: WasmExecutionMethod) {
}
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(call_yet_another_not_existing_function);
fn call_yet_another_not_existing_function(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -130,8 +154,7 @@ fn call_yet_another_not_existing_function(wasm_method: WasmExecutionMethod) {
}
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(panicking_should_work);
fn panicking_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -161,8 +184,7 @@ fn panicking_should_work(wasm_method: WasmExecutionMethod) {
assert!(output.is_err());
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(storage_should_work);
fn storage_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
@@ -191,8 +213,7 @@ fn storage_should_work(wasm_method: WasmExecutionMethod) {
assert_eq!(ext, expected);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(clear_prefix_should_work);
fn clear_prefix_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
{
@@ -225,8 +246,7 @@ fn clear_prefix_should_work(wasm_method: WasmExecutionMethod) {
assert_eq!(expected, ext);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(blake2_256_should_work);
fn blake2_256_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -250,8 +270,7 @@ fn blake2_256_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(blake2_128_should_work);
fn blake2_128_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -275,8 +294,7 @@ fn blake2_128_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(sha2_256_should_work);
fn sha2_256_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -306,8 +324,7 @@ fn sha2_256_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(twox_256_should_work);
fn twox_256_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -335,8 +352,7 @@ fn twox_256_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(twox_128_should_work);
fn twox_128_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -360,8 +376,7 @@ fn twox_128_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(ed25519_verify_should_work);
fn ed25519_verify_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -397,8 +412,7 @@ fn ed25519_verify_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(sr25519_verify_should_work);
fn sr25519_verify_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -434,8 +448,7 @@ fn sr25519_verify_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(ordered_trie_root_should_work);
fn ordered_trie_root_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let trie_input = vec![b"zero".to_vec(), b"one".to_vec(), b"two".to_vec()];
@@ -450,8 +463,7 @@ fn ordered_trie_root_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(offchain_index);
fn offchain_index(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let (offchain, _state) = testing::TestOffchainExt::new();
@@ -472,8 +484,7 @@ fn offchain_index(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(offchain_local_storage_should_work);
fn offchain_local_storage_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let (offchain, state) = testing::TestOffchainExt::new();
@@ -490,8 +501,7 @@ fn offchain_local_storage_should_work(wasm_method: WasmExecutionMethod) {
assert_eq!(state.read().persistent_storage.get(b"test"), Some(vec![]));
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(offchain_http_should_work);
fn offchain_http_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let (offchain, state) = testing::TestOffchainExt::new();
@@ -519,9 +529,7 @@ fn offchain_http_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
-#[should_panic(expected = "Allocator ran out of space")]
+test_wasm_execution!(should_trap_when_heap_exhausted);
fn should_trap_when_heap_exhausted(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
@@ -531,18 +539,20 @@ fn should_trap_when_heap_exhausted(wasm_method: WasmExecutionMethod) {
HostFunctions::host_functions(),
8,
);
- executor.call_in_wasm(
+
+ let err = executor.call_in_wasm(
&wasm_binary_unwrap()[..],
None,
"test_exhaust_heap",
&[0],
&mut ext.ext(),
sp_core::traits::MissingHostFunctions::Allow,
- ).unwrap();
+ ).unwrap_err();
+
+ assert!(err.contains("Allocator ran out of space"));
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(returns_mutable_static);
fn returns_mutable_static(wasm_method: WasmExecutionMethod) {
let runtime = crate::wasm_runtime::create_wasm_runtime_with_code(
wasm_method,
@@ -567,8 +577,7 @@ fn returns_mutable_static(wasm_method: WasmExecutionMethod) {
// returned to its initial value and thus the stack space is going to be leaked.
//
// See https://github.com/paritytech/substrate/issues/2967 for details
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(restoration_of_globals);
fn restoration_of_globals(wasm_method: WasmExecutionMethod) {
// Allocate 32 pages (of 65536 bytes) which gives the runtime 2048KB of heap to operate on
// (plus some additional space unused from the initial pages requested by the wasm runtime
@@ -596,7 +605,7 @@ fn restoration_of_globals(wasm_method: WasmExecutionMethod) {
assert!(res.is_ok());
}
-#[test_case(WasmExecutionMethod::Interpreted)]
+test_wasm_execution!(interpreted_only heap_is_reset_between_calls);
fn heap_is_reset_between_calls(wasm_method: WasmExecutionMethod) {
let runtime = crate::wasm_runtime::create_wasm_runtime_with_code(
wasm_method,
@@ -620,8 +629,7 @@ fn heap_is_reset_between_calls(wasm_method: WasmExecutionMethod) {
instance.call_export("check_and_set_in_heap", ¶ms).unwrap();
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(parallel_execution);
fn parallel_execution(wasm_method: WasmExecutionMethod) {
let executor = std::sync::Arc::new(crate::WasmExecutor::new(
wasm_method,
@@ -656,7 +664,7 @@ fn parallel_execution(wasm_method: WasmExecutionMethod) {
}
}
-#[test_case(WasmExecutionMethod::Interpreted)]
+test_wasm_execution!(wasm_tracing_should_work);
fn wasm_tracing_should_work(wasm_method: WasmExecutionMethod) {
use std::sync::{Arc, Mutex};
@@ -728,10 +736,8 @@ fn wasm_tracing_should_work(wasm_method: WasmExecutionMethod) {
assert_eq!(len, 2);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(spawning_runtime_instance_should_work);
fn spawning_runtime_instance_should_work(wasm_method: WasmExecutionMethod) {
-
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -743,10 +749,8 @@ fn spawning_runtime_instance_should_work(wasm_method: WasmExecutionMethod) {
).unwrap();
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(spawning_runtime_instance_nested_should_work);
fn spawning_runtime_instance_nested_should_work(wasm_method: WasmExecutionMethod) {
-
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -758,10 +762,8 @@ fn spawning_runtime_instance_nested_should_work(wasm_method: WasmExecutionMethod
).unwrap();
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(panic_in_spawned_instance_panics_on_joining_its_result);
fn panic_in_spawned_instance_panics_on_joining_its_result(wasm_method: WasmExecutionMethod) {
-
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
diff --git a/client/executor/src/integration_tests/sandbox.rs b/client/executor/src/integration_tests/sandbox.rs
index 447e395c2fb084aa0644504138987a673c40614d..7ce9c94a2db8ae667a9446b069220355db4cb246 100644
--- a/client/executor/src/integration_tests/sandbox.rs
+++ b/client/executor/src/integration_tests/sandbox.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -18,12 +18,11 @@
use super::{TestExternalities, call_in_wasm};
use crate::WasmExecutionMethod;
+use crate::test_wasm_execution;
use codec::Encode;
-use test_case::test_case;
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(sandbox_should_work);
fn sandbox_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -60,8 +59,7 @@ fn sandbox_should_work(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(sandbox_trap);
fn sandbox_trap(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -87,8 +85,7 @@ fn sandbox_trap(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(start_called);
fn start_called(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -131,8 +128,7 @@ fn start_called(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(invoke_args);
fn invoke_args(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -171,8 +167,7 @@ fn invoke_args(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(return_val);
fn return_val(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -199,8 +194,7 @@ fn return_val(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(unlinkable_module);
fn unlinkable_module(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -225,8 +219,7 @@ fn unlinkable_module(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(corrupted_module);
fn corrupted_module(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -245,8 +238,7 @@ fn corrupted_module(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(start_fn_ok);
fn start_fn_ok(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -274,8 +266,7 @@ fn start_fn_ok(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(start_fn_traps);
fn start_fn_traps(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
@@ -304,8 +295,7 @@ fn start_fn_traps(wasm_method: WasmExecutionMethod) {
);
}
-#[test_case(WasmExecutionMethod::Interpreted)]
-#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
+test_wasm_execution!(get_global_val_works);
fn get_global_val_works(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
diff --git a/client/executor/src/lib.rs b/client/executor/src/lib.rs
index 56a81b24b4076e39c1d66a7bc57058ae1dcd8e7d..ccb7aa1b445b222db65924526cfdf6e661017cb4 100644
--- a/client/executor/src/lib.rs
+++ b/client/executor/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/src/native_executor.rs b/client/executor/src/native_executor.rs
index b5d67b9e73f4226a1c20d637c3ad7cb0dc41ea87..766dada331cd1b866a4e41a81d56454d74503104 100644
--- a/client/executor/src/native_executor.rs
+++ b/client/executor/src/native_executor.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/src/wasm_runtime.rs b/client/executor/src/wasm_runtime.rs
index 7288df35f31c42b02a6f66f1dc4222a3f60f446d..a7d8b0ce2387ef18b415ddf68e4e3dfe429f5a98 100644
--- a/client/executor/src/wasm_runtime.rs
+++ b/client/executor/src/wasm_runtime.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Traits and accessor functions for calling into the Substrate Wasm runtime.
//!
diff --git a/client/executor/wasmi/src/lib.rs b/client/executor/wasmi/src/lib.rs
index 17b92e04950c9766253af313a115073aed634690..e6a6ef3a61039e73b06e6909ca9bee765eb937f5 100644
--- a/client/executor/wasmi/src/lib.rs
+++ b/client/executor/wasmi/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! This crate provides an implementation of `WasmModule` that is baked by wasmi.
diff --git a/client/executor/wasmtime/src/host.rs b/client/executor/wasmtime/src/host.rs
index 8d20c9a566dc8c5ad3300e4f50c8a3c4bdfdbdc4..c1eb77ff81f344728721405e316f3769783d255e 100644
--- a/client/executor/wasmtime/src/host.rs
+++ b/client/executor/wasmtime/src/host.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! This module defines `HostState` and `HostContext` structs which provide logic and state
//! required for execution of host.
diff --git a/client/executor/wasmtime/src/imports.rs b/client/executor/wasmtime/src/imports.rs
index add62df5cef45851451503ce2a00b3d2e537b45f..b5eaeae5e66cd51f1e0baa6f525430e17cd4cbe9 100644
--- a/client/executor/wasmtime/src/imports.rs
+++ b/client/executor/wasmtime/src/imports.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/wasmtime/src/instance_wrapper.rs b/client/executor/wasmtime/src/instance_wrapper.rs
index 089d8cb237b56c42eb43e112d17dde718e6d94c3..2103ab9b7b98c463785aa6912f7e30576b825bd5 100644
--- a/client/executor/wasmtime/src/instance_wrapper.rs
+++ b/client/executor/wasmtime/src/instance_wrapper.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs b/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs
index 42935d851d95c638b22d35693d7a47d5147356cc..a6b1ed394150d86f38c952563370a1d25508c239 100644
--- a/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs
+++ b/client/executor/wasmtime/src/instance_wrapper/globals_snapshot.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/wasmtime/src/lib.rs b/client/executor/wasmtime/src/lib.rs
index 66e4e085235ac3adc2e4026679ec849d002ed94a..db7776d4c58455b7a9d1a571d8f30fbdf85477b8 100644
--- a/client/executor/wasmtime/src/lib.rs
+++ b/client/executor/wasmtime/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
///! Defines a `WasmRuntime` that uses the Wasmtime JIT to execute.
diff --git a/client/executor/wasmtime/src/runtime.rs b/client/executor/wasmtime/src/runtime.rs
index 965b0675357218902a50a1f8bb53e4721c7f5f35..a17a034918db74e6749e5bf4fb6102c8c365144c 100644
--- a/client/executor/wasmtime/src/runtime.rs
+++ b/client/executor/wasmtime/src/runtime.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Defines the compiled Wasm runtime that uses Wasmtime internally.
diff --git a/client/executor/wasmtime/src/state_holder.rs b/client/executor/wasmtime/src/state_holder.rs
index 711d3bb735d7c04306525ba451f1e4be84ed9d21..0e2684cd25130b8aaffa6280a01a6281b773b4b0 100644
--- a/client/executor/wasmtime/src/state_holder.rs
+++ b/client/executor/wasmtime/src/state_holder.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/executor/wasmtime/src/util.rs b/client/executor/wasmtime/src/util.rs
index d2de95d4cc7150d6ed8768ad48181ae9f9885cb4..1437c6f8509bf0350ce65f302002dd899a7d2f22 100644
--- a/client/executor/wasmtime/src/util.rs
+++ b/client/executor/wasmtime/src/util.rs
@@ -1,18 +1,20 @@
-// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use std::ops::Range;
diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml
index 8966f5e8f657aa922688a10c02b7e806b9ffb6b3..69744691b820468be1693dff79065fb1f1459ebe 100644
--- a/client/finality-grandpa/Cargo.toml
+++ b/client/finality-grandpa/Cargo.toml
@@ -20,7 +20,7 @@ fork-tree = { version = "2.0.0", path = "../../utils/fork-tree" }
futures = "0.3.4"
futures-timer = "3.0.1"
log = "0.4.8"
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
rand = "0.7.2"
parity-scale-codec = { version = "1.3.4", features = ["derive"] }
sp-application-crypto = { version = "2.0.0", path = "../../primitives/application-crypto" }
@@ -28,7 +28,7 @@ sp-arithmetic = { version = "2.0.0", path = "../../primitives/arithmetic" }
sp-runtime = { version = "2.0.0", path = "../../primitives/runtime" }
sp-utils = { version = "2.0.0", path = "../../primitives/utils" }
sp-consensus = { version = "0.8.0", path = "../../primitives/consensus/common" }
-sc-consensus = { version = "0.8.0", path = "../../client/consensus/common" }
+sc-consensus = { version = "0.8.0", path = "../consensus/common" }
sp-core = { version = "2.0.0", path = "../../primitives/core" }
sp-keystore = { version = "0.8.0", path = "../../primitives/keystore" }
sp-api = { version = "2.0.0", path = "../../primitives/api" }
diff --git a/client/finality-grandpa/rpc/src/error.rs b/client/finality-grandpa/rpc/src/error.rs
index 6464acbe10ea076ed637d603fbf48692509fb8e6..6122db03f880517d7ae43fbd815a76e751562c68 100644
--- a/client/finality-grandpa/rpc/src/error.rs
+++ b/client/finality-grandpa/rpc/src/error.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/rpc/src/finality.rs b/client/finality-grandpa/rpc/src/finality.rs
index 1f288b86a0e469efefcbc7b826f23c527a8344fc..9272edb39b64d5ce58934bedff6ff8a111d2e83e 100644
--- a/client/finality-grandpa/rpc/src/finality.rs
+++ b/client/finality-grandpa/rpc/src/finality.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/rpc/src/lib.rs b/client/finality-grandpa/rpc/src/lib.rs
index 172473ad6518bc90e709f9bb24ebe98058fb89de..c6e4613c4f5153f58fce2d2bacbf966fb6a91c32 100644
--- a/client/finality-grandpa/rpc/src/lib.rs
+++ b/client/finality-grandpa/rpc/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/rpc/src/notification.rs b/client/finality-grandpa/rpc/src/notification.rs
index fd03a622b21967c723bcdfb67a56bd70ffd5cdd3..4c9141be3631ae4acd359da36ecc0e6a247bd11d 100644
--- a/client/finality-grandpa/rpc/src/notification.rs
+++ b/client/finality-grandpa/rpc/src/notification.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/rpc/src/report.rs b/client/finality-grandpa/rpc/src/report.rs
index a635728cb938adf73d4ae94e1db1a63d5fcb9f50..0482d90f58f0a0bf67001d570c77686440a9f969 100644
--- a/client/finality-grandpa/rpc/src/report.rs
+++ b/client/finality-grandpa/rpc/src/report.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/src/authorities.rs b/client/finality-grandpa/src/authorities.rs
index de14c7b3ba390ab64f687e7cf897130fd86d7c4b..62a23a7ceab847fc1460333d122eb0704d020d5f 100644
--- a/client/finality-grandpa/src/authorities.rs
+++ b/client/finality-grandpa/src/authorities.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/src/aux_schema.rs b/client/finality-grandpa/src/aux_schema.rs
index 97041f4081a720a35f9de0d0479f84a6071fd69b..0146269c8f71aa27e8fc44eb5b4042542ac214dc 100644
--- a/client/finality-grandpa/src/aux_schema.rs
+++ b/client/finality-grandpa/src/aux_schema.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Schema for stuff in the aux-db.
diff --git a/client/finality-grandpa/src/communication/gossip.rs b/client/finality-grandpa/src/communication/gossip.rs
index 276529d555ffe062a12e79b8544cc3265272467e..c217218aecc4ff09502b0ea941aebb0ce9423a16 100644
--- a/client/finality-grandpa/src/communication/gossip.rs
+++ b/client/finality-grandpa/src/communication/gossip.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Gossip and politeness for polite-grandpa.
//!
diff --git a/client/finality-grandpa/src/communication/mod.rs b/client/finality-grandpa/src/communication/mod.rs
index 29fe8bc7471a0b74ac91e41bd77ad0cef832617f..77d2d15e5d0209e89ba86dbb2697096f8619f279 100644
--- a/client/finality-grandpa/src/communication/mod.rs
+++ b/client/finality-grandpa/src/communication/mod.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -846,7 +846,7 @@ fn check_catch_up(
}
Ok(())
- };
+ }
check_weight(
voters,
diff --git a/client/finality-grandpa/src/communication/periodic.rs b/client/finality-grandpa/src/communication/periodic.rs
index dadd7deb57fca1d34dd01baf0d434533f1a99fbe..377882ed5dd2d5d4bb2136fbd5314e0d557b890c 100644
--- a/client/finality-grandpa/src/communication/periodic.rs
+++ b/client/finality-grandpa/src/communication/periodic.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Periodic rebroadcast of neighbor packets.
diff --git a/client/finality-grandpa/src/communication/tests.rs b/client/finality-grandpa/src/communication/tests.rs
index 27a394a062bc8b99eca9f6af6022f681238991f7..b2e4c405b4f7926eadfc468b08858d59011ed3a2 100644
--- a/client/finality-grandpa/src/communication/tests.rs
+++ b/client/finality-grandpa/src/communication/tests.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Tests for the communication portion of the GRANDPA crate.
@@ -56,7 +58,11 @@ impl sc_network_gossip::Network for TestNetwork {
let _ = self.sender.unbounded_send(Event::Report(who, cost_benefit));
}
- fn disconnect_peer(&self, _: PeerId) {}
+ fn add_set_reserved(&self, _: PeerId, _: Cow<'static, str>) {}
+
+ fn remove_set_reserved(&self, _: PeerId, _: Cow<'static, str>) {}
+
+ fn disconnect_peer(&self, _: PeerId, _: Cow<'static, str>) {}
fn write_notification(&self, who: PeerId, _: Cow<'static, str>, message: Vec) {
let _ = self.sender.unbounded_send(Event::WriteNotification(who, message));
diff --git a/client/finality-grandpa/src/environment.rs b/client/finality-grandpa/src/environment.rs
index cc301e77d94e7df4e125657422098f60c2627f46..c1a3a11521fa744e16c338a24b2add2bbd6c16b0 100644
--- a/client/finality-grandpa/src/environment.rs
+++ b/client/finality-grandpa/src/environment.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/src/finality_proof.rs b/client/finality-grandpa/src/finality_proof.rs
index 0012be1f50fe17d3a39e49cdb6818e6c3bf52c3c..80227514e6af9a996bfd6a7bbe664ed6b7b5bbb6 100644
--- a/client/finality-grandpa/src/finality_proof.rs
+++ b/client/finality-grandpa/src/finality_proof.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/src/import.rs b/client/finality-grandpa/src/import.rs
index c1b2b6d070838596559130887ce9086a01a1ce8f..07d823bb5764a46bfa388d54dc3a9575baa43eab 100644
--- a/client/finality-grandpa/src/import.rs
+++ b/client/finality-grandpa/src/import.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -25,7 +25,7 @@ use parking_lot::RwLockWriteGuard;
use sp_blockchain::{BlockStatus, well_known_cache_keys};
use sc_client_api::{backend::Backend, utils::is_descendent_of};
use sp_utils::mpsc::TracingUnboundedSender;
-use sp_api::{TransactionFor};
+use sp_api::TransactionFor;
use sp_consensus::{
BlockImport, Error as ConsensusError,
diff --git a/client/finality-grandpa/src/justification.rs b/client/finality-grandpa/src/justification.rs
index d5ca92d50e9371cf76e80945b69edc3c3f9e3c13..9429acff06d8ce9f160bc78de66bf16032a79918 100644
--- a/client/finality-grandpa/src/justification.rs
+++ b/client/finality-grandpa/src/justification.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs
index 0757a484afb4a624ea35e93c5321907668ac691b..6215e2b9f993f6b70ba30031b1c0a3f0e2a68408 100644
--- a/client/finality-grandpa/src/lib.rs
+++ b/client/finality-grandpa/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -122,7 +122,6 @@ mod until_imported;
mod voting_rule;
pub use authorities::{SharedAuthoritySet, AuthoritySet};
-pub use communication::GRANDPA_PROTOCOL_NAME;
pub use finality_proof::{FinalityProofFragment, FinalityProofProvider, StorageAndProofProvider};
pub use notification::{GrandpaJustificationSender, GrandpaJustificationStream};
pub use import::GrandpaBlockImport;
@@ -656,7 +655,7 @@ pub struct GrandpaParams {
///
/// It is assumed that this network will feed us Grandpa notifications. When using the
/// `sc_network` crate, it is assumed that the Grandpa notifications protocol has been passed
- /// to the configuration of the networking.
+ /// to the configuration of the networking. See [`grandpa_peers_set_config`].
pub network: N,
/// If supplied, can be used to hook on telemetry connection established events.
pub telemetry_on_connect: Option>,
@@ -668,6 +667,20 @@ pub struct GrandpaParams {
pub shared_voter_state: SharedVoterState,
}
+/// Returns the configuration value to put in
+/// [`sc_network::config::NetworkConfiguration::extra_sets`].
+pub fn grandpa_peers_set_config() -> sc_network::config::NonDefaultSetConfig {
+ sc_network::config::NonDefaultSetConfig {
+ notifications_protocol: communication::GRANDPA_PROTOCOL_NAME.into(),
+ set_config: sc_network::config::SetConfig {
+ in_peers: 25,
+ out_peers: 25,
+ reserved_nodes: Vec::new(),
+ non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept,
+ },
+ }
+}
+
/// Run a GRANDPA voter as a task. Provide configuration and a link to a
/// block import worker that has already been instantiated with `block_import`.
pub fn run_grandpa_voter(
diff --git a/client/finality-grandpa/src/notification.rs b/client/finality-grandpa/src/notification.rs
index 8415583051902330a99f5c4cb723311045844ed8..b545f0d8a637e8948939e02e2c2d8003af624524 100644
--- a/client/finality-grandpa/src/notification.rs
+++ b/client/finality-grandpa/src/notification.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/src/observer.rs b/client/finality-grandpa/src/observer.rs
index c61998225e32300f542f256f70acdc0aa20102a7..c9db917e1699a89f11c816e6b8edbc7a4f54fc47 100644
--- a/client/finality-grandpa/src/observer.rs
+++ b/client/finality-grandpa/src/observer.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/src/tests.rs b/client/finality-grandpa/src/tests.rs
index 81b7be44c1ac04678dd860d89bc6a9ede2723654..5f45439ad9e29f9e1a61224640fb68bd21722e21 100644
--- a/client/finality-grandpa/src/tests.rs
+++ b/client/finality-grandpa/src/tests.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -1068,7 +1068,7 @@ fn voter_persists_its_votes() {
drop(_block_import);
r
})
- };
+ }
runtime.spawn(alice_voter1);
@@ -1110,7 +1110,7 @@ fn voter_persists_its_votes() {
let runtime_handle = runtime_handle.clone();
async move {
- if state.compare_and_swap(0, 1, Ordering::SeqCst) == 0 {
+ if state.compare_exchange(0, 1, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 0 {
// the first message we receive should be a prevote from alice.
let prevote = match signed.message {
finality_grandpa::Message::Prevote(prevote) => prevote,
@@ -1156,7 +1156,7 @@ fn voter_persists_its_votes() {
// we send in a loop including a delay until items are received, this can be
// ignored for the sake of reduced complexity.
Pin::new(&mut *round_tx.lock()).start_send(finality_grandpa::Message::Prevote(prevote)).unwrap();
- } else if state.compare_and_swap(1, 2, Ordering::SeqCst) == 1 {
+ } else if state.compare_exchange(1, 2, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 1 {
// the next message we receive should be our own prevote
let prevote = match signed.message {
finality_grandpa::Message::Prevote(prevote) => prevote,
@@ -1170,7 +1170,7 @@ fn voter_persists_its_votes() {
// therefore we won't ever receive it again since it will be a
// known message on the gossip layer
- } else if state.compare_and_swap(2, 3, Ordering::SeqCst) == 2 {
+ } else if state.compare_exchange(2, 3, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 2 {
// we then receive a precommit from alice for block 15
// even though we casted a prevote for block 30
let precommit = match signed.message {
diff --git a/client/finality-grandpa/src/until_imported.rs b/client/finality-grandpa/src/until_imported.rs
index 3ac94f3b062f0273f975e714c7318b9539243dae..c27eab5351562557ee1fc1a182b98ba6211d859a 100644
--- a/client/finality-grandpa/src/until_imported.rs
+++ b/client/finality-grandpa/src/until_imported.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/finality-grandpa/src/voting_rule.rs b/client/finality-grandpa/src/voting_rule.rs
index 700b0aeb551cd2a647b8722c4ab148bc7885cd52..a861e792755feaed872caff1cc644ceab751e8b8 100644
--- a/client/finality-grandpa/src/voting_rule.rs
+++ b/client/finality-grandpa/src/voting_rule.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml
index 871cc3ef426ec5fc26bff690258a3b2c3d3df7de..7cc321e4001f74ac311eeaa84c565d32e175faa9 100644
--- a/client/informant/Cargo.toml
+++ b/client/informant/Cargo.toml
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
ansi_term = "0.12.1"
futures = "0.3.4"
log = "0.4.8"
-parity-util-mem = { version = "0.7.0", default-features = false, features = ["primitive-types"] }
+parity-util-mem = { version = "0.8.0", default-features = false, features = ["primitive-types"] }
sc-client-api = { version = "2.0.0", path = "../api" }
sc-network = { version = "0.8.0", path = "../network" }
sp-blockchain = { version = "2.0.0", path = "../../primitives/blockchain" }
diff --git a/client/informant/src/display.rs b/client/informant/src/display.rs
index 5c8f5f8ef84aa4354238cb4d02fa7b53896b96b1..0caef4e5fbae8fabc2c0a9b92ccc272d181b407c 100644
--- a/client/informant/src/display.rs
+++ b/client/informant/src/display.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use crate::OutputFormat;
use ansi_term::Colour;
diff --git a/client/informant/src/lib.rs b/client/informant/src/lib.rs
index d4f34cb488a9789eaa36223dd1a077bf071164c5..c955834c0f111dbcce7850b99cb259666ad79197 100644
--- a/client/informant/src/lib.rs
+++ b/client/informant/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/keystore/Cargo.toml b/client/keystore/Cargo.toml
index c0c3acde25edfc6c252735176504808896e28c9d..d4d06b6f48d48b71693d0b4b705965f929b3427b 100644
--- a/client/keystore/Cargo.toml
+++ b/client/keystore/Cargo.toml
@@ -24,7 +24,7 @@ sp-core = { version = "2.0.0", path = "../../primitives/core" }
sp-keystore = { version = "0.8.0", path = "../../primitives/keystore" }
hex = "0.4.0"
merlin = { version = "2.0", default-features = false }
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
rand = "0.7.2"
serde_json = "1.0.41"
subtle = "2.1.1"
diff --git a/client/keystore/src/lib.rs b/client/keystore/src/lib.rs
index 0b6d654bc623ecda634b3612ac0df9350a342a28..9cad56efacfd66eb8aac3af9790957f15d02175b 100644
--- a/client/keystore/src/lib.rs
+++ b/client/keystore/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2017-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Keystore (and session key management) for ed25519 based chains like Polkadot.
diff --git a/client/keystore/src/local.rs b/client/keystore/src/local.rs
index a31e3e1f1e402df5bae884de80993d1f1fdcb630..866a50ae4c93ce43f7382db0053006a9dbabe35b 100644
--- a/client/keystore/src/local.rs
+++ b/client/keystore/src/local.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -167,9 +167,7 @@ impl SyncCryptoStore for LocalKeystore {
let all_keys = SyncCryptoStore::keys(self, id)?
.into_iter()
.collect::>();
- Ok(keys.into_iter()
- .filter(|key| all_keys.contains(key))
- .collect::>())
+ Ok(keys.into_iter().filter(|key| all_keys.contains(key)).collect::>())
}
fn sign_with(
diff --git a/client/light/Cargo.toml b/client/light/Cargo.toml
index d9fecb7aa8fa2c22e270d48a58269d17b37511d8..4516b5c4b6659de6abeb97ca0baaa8a1e3607f28 100644
--- a/client/light/Cargo.toml
+++ b/client/light/Cargo.toml
@@ -11,7 +11,7 @@ documentation = "https://docs.rs/sc-light"
readme = "README.md"
[dependencies]
-parking_lot = "0.10.0"
+parking_lot = "0.11.1"
lazy_static = "1.4.0"
hash-db = "0.15.2"
sp-runtime = { version = "2.0.0", path = "../../primitives/runtime" }
diff --git a/client/light/src/backend.rs b/client/light/src/backend.rs
index 741931a3991e541135f26cc4cb36b48ad682a1c3..0e511515e77e87fc9528de85000c2a419be31494 100644
--- a/client/light/src/backend.rs
+++ b/client/light/src/backend.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/light/src/blockchain.rs b/client/light/src/blockchain.rs
index b953b0c3802e95498ff9cd53464fe4b7a0762757..43d4ae55ed6610951eabb3deb63ad4fb980b549a 100644
--- a/client/light/src/blockchain.rs
+++ b/client/light/src/blockchain.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/light/src/call_executor.rs b/client/light/src/call_executor.rs
index 458ea2bd6b844b5b430f08823f94f283a785ad87..7115f24a77d67168ecebbced1c52cee9ec1488c1 100644
--- a/client/light/src/call_executor.rs
+++ b/client/light/src/call_executor.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/light/src/fetcher.rs b/client/light/src/fetcher.rs
index 60fce87b8d0c26ecddbdf22d2ebd09e08060a696..b71c4871803da4fa907959cefc924333912c2ef4 100644
--- a/client/light/src/fetcher.rs
+++ b/client/light/src/fetcher.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/light/src/lib.rs b/client/light/src/lib.rs
index 899d1ae31a3dd951a89090a0ed69cc6e5fb71f5f..e647b8743cc0f8865a84b793f9f6fc621dfda8a9 100644
--- a/client/light/src/lib.rs
+++ b/client/light/src/lib.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/network-gossip/Cargo.toml b/client/network-gossip/Cargo.toml
index 5b82bd679c0112b6f23cc61c4245d419dd1e757c..5c3990d320bb08cd62896d2b110ea1ffc3ec44c5 100644
--- a/client/network-gossip/Cargo.toml
+++ b/client/network-gossip/Cargo.toml
@@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
futures = "0.3.4"
futures-timer = "3.0.1"
-libp2p = { version = "0.32.2", default-features = false }
+libp2p = { version = "0.33.0", default-features = false }
log = "0.4.8"
lru = "0.6.1"
sc-network = { version = "0.8.0", path = "../network" }
diff --git a/client/network-gossip/src/bridge.rs b/client/network-gossip/src/bridge.rs
index 4deaad6d748fd13f7dc11f3f8d41fcfe77976862..d444409d1cd3d9598c0bae9c11e8897f9dedb078 100644
--- a/client/network-gossip/src/bridge.rs
+++ b/client/network-gossip/src/bridge.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use crate::{Network, Validator};
use crate::state_machine::{ConsensusGossip, TopicNotification, PERIODIC_MAINTENANCE_INTERVAL};
@@ -178,6 +180,12 @@ impl Future for GossipEngine {
ForwardingState::Idle => {
match this.network_event_stream.poll_next_unpin(cx) {
Poll::Ready(Some(event)) => match event {
+ Event::SyncConnected { remote } => {
+ this.network.add_set_reserved(remote, this.protocol.clone());
+ }
+ Event::SyncDisconnected { remote } => {
+ this.network.remove_set_reserved(remote, this.protocol.clone());
+ }
Event::NotificationStreamOpened { remote, protocol, role } => {
if protocol != this.protocol {
continue;
@@ -323,10 +331,16 @@ mod tests {
fn report_peer(&self, _: PeerId, _: ReputationChange) {
}
- fn disconnect_peer(&self, _: PeerId) {
+ fn disconnect_peer(&self, _: PeerId, _: Cow<'static, str>) {
unimplemented!();
}
+ fn add_set_reserved(&self, _: PeerId, _: Cow<'static, str>) {
+ }
+
+ fn remove_set_reserved(&self, _: PeerId, _: Cow<'static, str>) {
+ }
+
fn write_notification(&self, _: PeerId, _: Cow<'static, str>, _: Vec) {
unimplemented!();
}
diff --git a/client/network-gossip/src/lib.rs b/client/network-gossip/src/lib.rs
index 2b333610223e2a19c0c4553b8973eb77e65919ee..59c99088bdf24f87fa177d3ce14e1d6c225be613 100644
--- a/client/network-gossip/src/lib.rs
+++ b/client/network-gossip/src/lib.rs
@@ -1,18 +1,20 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
//! Polite gossiping.
//!
@@ -38,6 +40,11 @@
//! - Use the methods of the `GossipEngine` in order to send out messages and receive incoming
//! messages.
//!
+//! The `GossipEngine` will automatically use `Network::add_set_reserved` and
+//! `Network::remove_set_reserved` to maintain a set of peers equal to the set of peers the
+//! node is syncing from. See the documentation of `sc-network` for more explanations about the
+//! concepts of peer sets.
+//!
//! # What is a validator?
//!
//! The primary role of a `Validator` is to process incoming messages from peers, and decide
@@ -59,9 +66,9 @@ pub use self::state_machine::TopicNotification;
pub use self::validator::{DiscardAll, MessageIntent, Validator, ValidatorContext, ValidationResult};
use futures::prelude::*;
-use sc_network::{Event, ExHashT, NetworkService, PeerId, ReputationChange};
+use sc_network::{multiaddr, Event, ExHashT, NetworkService, PeerId, ReputationChange};
use sp_runtime::{traits::Block as BlockT};
-use std::{borrow::Cow, pin::Pin, sync::Arc};
+use std::{borrow::Cow, iter, pin::Pin, sync::Arc};
mod bridge;
mod state_machine;
@@ -75,8 +82,14 @@ pub trait Network {
/// Adjust the reputation of a node.
fn report_peer(&self, peer_id: PeerId, reputation: ReputationChange);
+ /// Adds the peer to the set of peers to be connected to with this protocol.
+ fn add_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>);
+
+ /// Removes the peer from the set of peers to be connected to with this protocol.
+ fn remove_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>);
+
/// Force-disconnect a peer.
- fn disconnect_peer(&self, who: PeerId);
+ fn disconnect_peer(&self, who: PeerId, protocol: Cow<'static, str>);
/// Send a notification to a peer.
fn write_notification(&self, who: PeerId, protocol: Cow<'static, str>, message: Vec);
@@ -97,8 +110,26 @@ impl Network for Arc> {
NetworkService::report_peer(self, peer_id, reputation);
}
- fn disconnect_peer(&self, who: PeerId) {
- NetworkService::disconnect_peer(self, who)
+ fn add_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>) {
+ let addr = iter::once(multiaddr::Protocol::P2p(who.into()))
+ .collect::();
+ let result = NetworkService::add_to_peers_set(self, protocol, iter::once(addr).collect());
+ if let Err(err) = result {
+ log::error!(target: "gossip", "add_set_reserved failed: {}", err);
+ }
+ }
+
+ fn remove_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>) {
+ let addr = iter::once(multiaddr::Protocol::P2p(who.into()))
+ .collect::();
+ let result = NetworkService::remove_from_peers_set(self, protocol, iter::once(addr).collect());
+ if let Err(err) = result {
+ log::error!(target: "gossip", "remove_set_reserved failed: {}", err);
+ }
+ }
+
+ fn disconnect_peer(&self, who: PeerId, protocol: Cow<'static, str>) {
+ NetworkService::disconnect_peer(self, who, protocol)
}
fn write_notification(&self, who: PeerId, protocol: Cow<'static, str>, message: Vec) {
diff --git a/client/network-gossip/src/state_machine.rs b/client/network-gossip/src/state_machine.rs
index 88f9d48375dec9e7c834651b87666fd2c7ad9717..58a0f62cb13049470c7e9a72f1d8df33a8eb5066 100644
--- a/client/network-gossip/src/state_machine.rs
+++ b/client/network-gossip/src/state_machine.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
@@ -495,10 +495,16 @@ mod tests {
self.inner.lock().unwrap().peer_reports.push((peer_id, reputation_change));
}
- fn disconnect_peer(&self, _: PeerId) {
+ fn disconnect_peer(&self, _: PeerId, _: Cow<'static, str>) {
unimplemented!();
}
+ fn add_set_reserved(&self, _: PeerId, _: Cow<'static, str>) {
+ }
+
+ fn remove_set_reserved(&self, _: PeerId, _: Cow<'static, str>) {
+ }
+
fn write_notification(&self, _: PeerId, _: Cow<'static, str>, _: Vec) {
unimplemented!();
}
diff --git a/client/network-gossip/src/validator.rs b/client/network-gossip/src/validator.rs
index fd29aaddafe6dcd89f2e722bdcfa07854fc04225..4b5440c1a06f3c7d7f6fa38b84a64a87e3543629 100644
--- a/client/network-gossip/src/validator.rs
+++ b/client/network-gossip/src/validator.rs
@@ -1,6 +1,6 @@
// This file is part of Substrate.
-// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
+// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml
index 1ad54366ce428609d02581104e32f0e8b56418c5..a300dac19bfccad7563cb6e02b3757dbfc388ae8 100644
--- a/client/network/Cargo.toml
+++ b/client/network/Cargo.toml
@@ -36,7 +36,6 @@ ip_network = "0.3.4"
linked-hash-map = "0.5.2"
linked_hash_set = "0.1.3"
log = "0.4.8"
-lru = "0.6.1"
nohash-hasher = "0.2.0"
parking_lot = "0.11.1"
pin-project = "0.4.6"
@@ -61,16 +60,16 @@ thiserror = "1"
unsigned-varint = { version = "0.5.0", features = ["futures", "futures-codec"] }
void = "1.0.2"
wasm-timer = "0.2"
-zeroize = "1.0.0"
+zeroize = "1.2.0"
[dependencies.libp2p]
-version = "0.32.2"
+version = "0.33.0"
default-features = false
features = ["identify", "kad", "mdns", "mplex", "noise", "ping", "request-response", "tcp-async-std", "websocket", "yamux"]
[dev-dependencies]
assert_matches = "1.3"
-libp2p = { version = "0.32.2", default-features = false }
+libp2p = { version = "0.33.0", default-features = false }
quickcheck = "0.9.0"
rand = "0.7.2"
sp-keyring = { version = "2.0.0", path = "../../primitives/keyring" }
diff --git a/client/network/src/behaviour.rs b/client/network/src/behaviour.rs
index 7b39cfeae3a85f1287516acab88d6921deaba026..13b687495c91003584a80026ff322538468752db 100644
--- a/client/network/src/behaviour.rs
+++ b/client/network/src/behaviour.rs
@@ -1,34 +1,37 @@
-// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
-// Substrate is free software: you can redistribute it and/or modify
+// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// Substrate is distributed in the hope that it will be useful,
+// This program 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with Substrate. If not, see .
+// along with this program. If not, see .
use crate::{
- config::{ProtocolId, Role}, block_requests, light_client_handler,
- peer_info, request_responses, discovery::{DiscoveryBehaviour, DiscoveryConfig, DiscoveryOut},
+ config::{ProtocolId, Role}, light_client_handler, peer_info, request_responses,
+ discovery::{DiscoveryBehaviour, DiscoveryConfig, DiscoveryOut},
protocol::{message::Roles, CustomMessageOutcome, NotificationsSink, Protocol},
ObservedRole, DhtEvent, ExHashT,
};
use bytes::Bytes;
-use codec::Encode as _;
+use futures::channel::oneshot;
use libp2p::NetworkBehaviour;
use libp2p::core::{Multiaddr, PeerId, PublicKey};
use libp2p::identify::IdentifyInfo;
use libp2p::kad::record;
use libp2p::swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess, PollParameters};
use log::debug;
+use prost::Message;
use sp_consensus::{BlockOrigin, import_queue::{IncomingBlock, Origin}};
use sp_runtime::{traits::{Block as BlockT, NumberFor}, Justifications};
use std::{
@@ -40,7 +43,7 @@ use std::{
};
pub use crate::request_responses::{
- ResponseFailure, InboundFailure, RequestFailure, OutboundFailure, RequestId, SendRequestError
+ ResponseFailure, InboundFailure, RequestFailure, OutboundFailure, RequestId,
};
/// General behaviour of the network. Combines all protocols together.
@@ -56,8 +59,6 @@ pub struct Behaviour {
discovery: DiscoveryBehaviour,
/// Generic request-reponse protocols.
request_responses: request_responses::RequestResponsesBehaviour,
- /// Block request handling.
- block_requests: block_requests::BlockRequests,
/// Light client request handling.
light_client_handler: light_client_handler::LightClientHandler,
@@ -68,6 +69,11 @@ pub struct Behaviour {
/// Role of our local node, as originally passed from the configuration.
#[behaviour(ignore)]
role: Role,
+
+ /// Protocol name used to send out block requests via
+ /// [`request_responses::RequestResponsesBehaviour`].
+ #[behaviour(ignore)]
+ block_request_protocol_name: String,
}
/// Event generated by `Behaviour`.
@@ -88,37 +94,21 @@ pub enum BehaviourOut {
protocol: Cow<'static, str>,
/// If `Ok`, contains the time elapsed between when we received the request and when we
/// sent back the response. If `Err`, the error that happened.
- result: Result